-
Notifications
You must be signed in to change notification settings - Fork 0
/
makeBundle.sh
executable file
·169 lines (159 loc) · 4.35 KB
/
makeBundle.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#!/bin/bash
#
# Build CuisApp image and package bundle
#
# Link the CuisAppo repository in the Cuis release folder.
# Execute the script from Cuis release folder.
# If necessary, in the Path section below, adjust cuisAppRepo, vmExec variables.
# Adjust below the rel variable to the wished CuisApp release number
# CuisApp release number
rel="23.12a-beta"
# Smalltalk image version
cuisVersion=`cat drgeo/cuisVersion`
smalltalk=Cuis$cuisVersion
smalltalkSources=Cuis$cuisVersion.sources
# To build CuisApp we need:
# A Cuis image, its source, the virtual machine,
# the Smalltalk installation script and the CuisApp source
# Path
imagePath="./CuisImage"
cuisAppRepo="./CuisApp"
buildPath="$cuisAppRepo/build"
bundlesPath="$buildPath/bundles"
src="$cuisAppRepo/src"
resources="$cuisAppRepo/resources"
vmExec=CuisVM.app/Contents/Linux-x86_64/squeak
installScript="$src/install-image.st"
buildImage () {
# INSTALL PACKAGE
# prepare the app image
rm $imagePath/app.*
cp $imagePath/$smalltalk.image $imagePath/app.image
cp $imagePath/$smalltalk.changes $imagePath/app.changes
# install source code in the app image and configure it
$vmExec $imagePath/app.image -s $installScript
ls -lh $imagePath/app.image
echo "--== DONE building CuisApp image ==--"
}
copyToBundle () {
# copy a built image to an existing gnulinux bundle (for quick testing)
bundlePath="$bundlesPath/gnulinux"
bundleApp="$bundlePath/CuisApp"
bundleResources="$bundleApp/Resources"
rsync -av $imagePath/app.{image,changes} $bundleResources/image
}
makeBundle () {
# $1 OS target (gnulinux windows mac)
# clean up the bundle space
mkdir $bundlesPath
bundlePath="$bundlesPath/$1"
bundleTemplate="$buildPath/bundleTemplates/$1"
cuisVMPath="CuisVM.app/Contents"
case "$1" in
gnulinux)
bundleApp="$bundlePath/CuisApp"
cuisVM="Linux-x86_64"
destVM="VM"
;;
windows)
bundleApp="$bundlePath/CuisApp"
cuisVM="Windows-x86_64"
destVM="VM"
;;
mac)
bundleApp="$bundlePath/Cuis.app"
cuisVM="MacOS Resources"
# Subfolder Resources to be considered as well
destVM="Contents"
;;
esac
bundleResources="$bundleApp/Resources"
# INSTALL BUNDLES...
rm -rf $bundlePath
# ...template
rsync -a --exclude '*~' $bundleTemplate $bundlesPath
# ...doc
cp $resources/doc/ChangeLog $bundleApp
# ...icons
rsync -a $resources/graphics/icons/* $bundleResources/icons
# ...vm
for i in $cuisVM
do
rsync -a $cuisVMPath/$i $bundleApp/$destVM/
done
# ...Smalltalk Image
rsync -a $imagePath/app.{image,changes} $bundleResources/image
# ...Smalltalk Source
rsync -a $imagePath/$smalltalkSources $bundleResources/image
# ...locales
rsync -a "$cuisAppRepo/i18n/locale" $bundleResources/image
# set exec flag
case "$1" in
gnulinux)
chmod +x $bundleApp/CuisApp.sh
chmod +x $bundleApp/VM/$cuisVM/squeak
;;
mac)
chmod +x $bundleApp/Contents/MacOS/Squeak
;;
esac
# Create an archive out of the bundle
cd $bundlePath
zip -r --symlinks -qdgds 5m CuisApp-$1-$rel.zip "`basename $bundleApp`" -x \*/.bzr/* \*~
ls -sh CuisApp-$1-$rel.zip
echo "--== DONE packaging CuisApp for $1 ==--"
echo -n "Signing..."
gpg --armor --sign --detach-sign CuisApp-$1-$rel.zip
echo "...done."
cd -
}
# Option
# Build image:
# $1 = --build
# Package from an already built image:
# $1 = --package , $2 = all | gnulinux | windows | mac
# Build image and package all bundles:
# $1 = --all
case "$1" in
--build)
buildImage
;;
--package)
case "$2" in
all)
makeBundle "gnulinux"
makeBundle "windows"
makeBundle "mac"
;;
gnulinux)
makeBundle "gnulinux"
;;
windows)
makeBundle "windows"
;;
mac)
makeBundle "mac"
;;
*)
echo -e "Unknow \"$2\" --package argument.\nValid arguments are gnulinux, windows, mac."
;;
esac
;;
--all)
buildImage
makeBundle "gnulinux"
makeBundle "windows"
makeBundle "mac"
;;
--copy)
copyToBundle
;;
--help|*)
echo "Usage: makeBundle [OPTION] [ARGUMENT]"
echo
echo -e "--build\t\t\t\t\tBuild CuisApp image"
echo -e "--package all|gnulinux|windows|mac\tPackage CuisApp with an already built image"
echo -e "--all\t\t\t\t\tBuild image and package for all OS"
echo -e "--copy\t\t\t\tCopy a built image to an existing gnulinux bundle"
;;
esac