source: orange/install-scripts/mac/bundle-build-hg.sh @ 10488:edfcf36e26c8

Revision 10488:edfcf36e26c8, 4.1 KB checked in by Ales Erjavec <ales.erjavec@…>, 2 years ago (diff)

Make a link to Orange in $APP/Contents/Resources.

  • Property exe set to *
Line 
1#!/bin/bash -e
2#
3# Build the orange Mac OSX bundle
4#
5# ./bundle-build-hg.sh work_dir revision bundle_output_file
6# ./bundle-build-hg.sh /private/tmp tip /private/tmp/orange-bundle-hg-tip.dmg
7#
8
9WORK_DIR=$1
10REVISION=$2
11BUNDLE=$3
12
13TMP_BUNDLE_DIR=${WORK_DIR}/bundle
14REPOS_DIR=${WORK_DIR}/repos
15
16# Remove leftovers if any
17if [ -e $TMP_BUNDLE_DIR ]; then
18    rm -rf $TMP_BUNDLE_DIR
19fi
20
21echo "Preaparing the bundle template"
22curl --silent http://orange.biolab.si/download/bundle-templates/Orange-template-2.0a2.tar.gz | tar -xz -C $WORK_DIR
23#svn export --non-interactive http://orange.biolab.si/svn/orange/externals/trunk/install-scripts/mac/bundle/ $TMP_BUNDLE_DIR
24
25# Make repos dir if it does not yet exist
26if [ ! -e $REPOS_DIR ]; then
27    mkdir $REPOS_DIR
28fi
29
30#Python interpreter in the bundle
31PYTHON=${TMP_BUNDLE_DIR}/Orange.app/Contents/MacOS/python
32
33#Python version
34PY_VER=`$PYTHON -c "import sys; print sys.version[:3]"`
35
36echo "Checkouting and building orange"
37echo "==============================="
38./bundle-inject-hg.sh https://bitbucket.org/biolab/orange orange $REVISION $REPOS_DIR ${TMP_BUNDLE_DIR}/Orange.app
39
40echo "Checkouting and building bioinformatics addon"
41echo "============================================="
42./bundle-inject-hg.sh https://bitbucket.org/biolab/orange-addon-bioinformatics bioinformatics $REVISION $REPOS_DIR ${TMP_BUNDLE_DIR}/Orange.app
43
44echo "Checkouting and building text addon"
45echo "==================================="
46./bundle-inject-hg.sh https://bitbucket.org/biolab/orange-addon-text text $REVISION $REPOS_DIR ${TMP_BUNDLE_DIR}/Orange.app
47
48echo "Installing networkx"
49echo "+++++++++++++++++++++"
50./bundle-inject-pypi.sh networkx-1.6 http://pypi.python.org/packages/source/n/networkx/networkx-1.6.tar.gz $REPOS_DIR ${TMP_BUNDLE_DIR}/Orange.app
51
52echo "Installing distribute"
53echo "+++++++++++++++++++++"
54./bundle-inject-pypi.sh distribute-0.6.24 http://pypi.python.org/packages/source/d/distribute/distribute-0.6.24.tar.gz $REPOS_DIR ${TMP_BUNDLE_DIR}/Orange.app
55
56# TODO: from here on we could use easy_install to install pip and then use that
57echo "Installing suds library"
58echo "+++++++++++++++++++++++"
59./bundle-inject-pypi.sh suds-0.4 http://pypi.python.org/packages/source/s/suds/suds-0.4.tar.gz $REPOS_DIR ${TMP_BUNDLE_DIR}/Orange.app
60
61echo "Removing unnecessary files."
62find $TMP_BUNDLE_DIR \( -name '*~' -or -name '*.bak' -or -name '*.pyc' -or -name '*.pyo' -or -name '*.pyd' \) -exec rm -rf {} ';'
63
64ln -s ../Frameworks/Python.framework/Versions/Current/lib/python${PY_VER}/site-packages/Orange ${TMP_BUNDLE_DIR}/Orange.app/Contents/Resources/Orange
65
66   
67echo "Preparing the .dmg image"
68echo "========================"
69
70# Makes a link to Applications folder
71ln -s /Applications/ $TMP_BUNDLE_DIR/Applications
72
73echo "Fixing bundle permissions."
74
75{ chown -Rh root:wheel $TMP_BUNDLE_DIR; } || { echo "Could not fix bundle permissions"; }
76
77echo "Creating temporary image with the bundle."
78
79TMP_BUNDLE=${WORK_DIR}/bundle.dmg
80rm -f $TMP_BUNDLE
81
82hdiutil detach /Volumes/Orange -force || true
83hdiutil create -format UDRW -volname Orange -fs HFS+ -fsargs "-c c=64,a=16,e=16" -srcfolder $TMP_BUNDLE_DIR $TMP_BUNDLE
84MOUNT_OUTPUT=`hdiutil attach -readwrite -noverify -noautoopen $TMP_BUNDLE | egrep '^/dev/'`
85DEV_NAME=`echo -n "$MOUNT_OUTPUT" | head -n 1 | awk '{print $1}'`
86MOUNT_POINT=`echo -n "$MOUNT_OUTPUT" | tail -n 1 | awk '{print $3}'`
87
88# Makes the disk image window open automatically when mounted
89bless -openfolder "$MOUNT_POINT"
90# Hides background directory even more
91/Developer/Tools/SetFile -a V "$MOUNT_POINT/.background/"
92# Sets the custom icon volume flag so that volume has nice Orange icon after mount (.VolumeIcon.icns)
93/Developer/Tools/SetFile -a C "$MOUNT_POINT"
94
95# Might mot have permissions to do this
96{ rm -rf "$MOUNT_POINT/.Trashes/"; } || { echo "Could not remove $MOUNT_POINT/.Trashes/"; }
97
98{ rm -rf "$MOUNT_POINT/.fseventsd/"; } || { echo "Could not remove $MOUNT_POINT/.fseventsd/"; }
99
100hdiutil detach "$DEV_NAME" -force
101
102echo "Converting temporary image to a compressed image."
103
104if [ -e $BUNDLE ]; then
105    rm -f $BUNDLE
106fi
107
108hdiutil convert $TMP_BUNDLE -format UDZO -imagekey zlib-level=9 -o $BUNDLE
109
110echo "Cleaning up."
111rm -f $TMP_BUNDLE
112rm -rf $TMP_BUNDLE_DIR
113
114true
Note: See TracBrowser for help on using the repository browser.