forked from pharo-project/pharo-launcher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·194 lines (169 loc) · 5.79 KB
/
build.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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
#!/usr/bin/env bash
set -ex
# Pharo Launcher build script
#
# We expect to have $PHARO and $VM parameter available in the environment
# $PHARO : version of the Pharo image, e.g. 61
# $VM : version of the VM, e.g. vm
# $ARCHITECTURE : targeted architecture 32 or 64 bits. Default will be 32.
# $VERSION: the Metacello version of PharoLauncher to load
# Script parameters
# $1: the target to run between prepare | test | developer | user
# $2: a value for $VERSION (optional)
function prepare_image() {
case "$ARCHITECTURE" in
32) ARCH_PATH=
;;
64) ARCH_PATH="64/"
;;
*) echo "Error! Architecture $ARCHITECTURE is not supported!"
exit 1
;;
esac
wget --quiet -O - get.pharo.org/$ARCH_PATH$PHARO+$VM | bash
./pharo Pharo.image save PharoLauncher --delete-old
./pharo PharoLauncher.image --version > version.txt
local REPO=http://smalltalkhub.com/mc/Pharo/PharoLauncher/main
./pharo PharoLauncher.image config $REPO ConfigurationOfPharoLauncher --install=$VERSION
}
function run_tests() {
./pharo PharoLauncher.image test --junit-xml-output "PharoLauncher.*"
}
function package_developer_version() {
./pharo PharoLauncher.image eval --save "PhLDirectoryBasedImageRepository location"
./pharo PharoLauncher.image eval '(MBConfigurationRoot current configurationInfoFor: ConfigurationOfPharoLauncher) version versionNumber' > launcher-version.txt
set_env
zip -9r PharoLauncher-developer-$VERSION_NUMBER.zip PharoLauncher.image PharoLauncher.changes launcher-version.txt
}
function package_user_version() {
./pharo PharoLauncher.image eval --save "PhLDeploymentScript doAll"
# Faster the startup of the launcher image
./pharo PharoLauncher.image eval --save ""
# Create the platform-specific archives
mkdir One
cp PharoLauncher.image One/Pharo.image
cp PharoLauncher.changes One/Pharo.changes
mkdir One/win
cp ProcessWrapperPlugin.dll One/win/
cd One
get_pharo_sources_version $PHARO
copy_current_stable_image
cd ..
set_env
zip -9r PharoLauncher-user-$VERSION_NUMBER.zip PharoLauncher.image PharoLauncher.changes launcher-version.txt
md5sum PharoLauncher-user-$VERSION_NUMBER.zip > PharoLauncher-user-$VERSION_NUMBER.zip.md5sum
}
function package_linux_version() {
set_env
./pharo-build-scripts/build-platform.sh -i Pharo -o Pharo -r $PHARO -s $PHARO_SOURCES -v $VERSION-$DATE -t Pharo -p linux
mv Pharo-linux.zip PharoLauncher-linux-$VERSION_NUMBER.zip
}
function prepare_mac_resources_for_build_platform_script() {
rm -f pharo-build-scripts/platform/icons/*
cd icons
./build-icns.sh pharo-launcher.png PharoLauncher.iconset
cd ..
cp icons/PharoLauncher.icns pharo-build-scripts/platform/icons/
rm -f pharo-build-scripts/platform/templates/mac/Contents/*
cp mac/Info.plist.template pharo-build-scripts/platform/templates/mac/Contents/
}
function package_mac_version() {
set_env
prepare_mac_resources_for_build_platform_script
bash ./pharo-build-scripts/build-platform.sh -i Pharo -o PharoLauncher -r $PHARO -s $PHARO_SOURCES -v $VERSION-$DATE -t PharoLauncher -p mac
unzip PharoLauncher-mac.zip -d .
mv mac-installer-background.png background.png
VERSION=$VERSION_NUMBER APP_NAME=PharoLauncher ./mac/build-dmg.sh
local generated_dmg=$(echo *.dmg)
mv "$generated_dmg" "PharoLauncher-$VERSION_NUMBER.dmg"
generated_dmg=$(echo *.dmg)
md5 "$generated_dmg" > "$generated_dmg.md5sum"
}
function package_windows_version() {
set_env
bash ./pharo-build-scripts/build-platform.sh -i Pharo -o Pharo -r $PHARO -s $PHARO_SOURCES -v $VERSION-$DATE -t Pharo -p win
unzip Pharo-win.zip -d .
cmd /c windows\\build-launcher-installer.bat
}
function set_env() {
DATE=$(date +%Y.%m.%d)
case "$ARCHITECTURE" in
32) ARCH_SUFFIX="x86"
;;
64) ARCH_SUFFIX="x64"
export ARCH=64
;;
*) echo "Error! Architecture $ARCH is not supported!"
exit 1
;;
esac
if [ "$VERSION" == "bleedingEdge" ]
then
VERSION_NUMBER="$VERSION-$DATE-$ARCH_SUFFIX"
else
VERSION_NUMBER="$VERSION-$ARCH_SUFFIX"
fi
set_pharo_sources_version
}
function copy_current_stable_image() {
local IMAGES_PATH="images"
mkdir "$IMAGES_PATH"
wget -P $IMAGES_PATH https://files.pharo.org/image/stable/latest.zip
mv "$IMAGES_PATH/latest.zip" "$IMAGES_PATH/pharo-stable.zip"
}
function set_pharo_sources_version() {
local sources_file=$(ls One/PharoV*.sources)
if [ -z "$sources_file" ]
then
# Need to determine Sources file version
local HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" https://files.pharo.org/sources/PharoV$1.sources.zip)
if [ $HTTP_CODE -eq 404 ]
then
PHARO_SOURCES=60
fi
else
# Sources file already retrieved
PHARO_SOURCES=${sources_file:10:2}
fi
}
function get_pharo_sources_version() {
set_pharo_sources_version
wget --quiet https://files.pharo.org/sources/PharoV${PHARO_SOURCES}.sources.zip && unzip PharoV${PHARO_SOURCES}.sources.zip PharoV${PHARO_SOURCES}.sources && rm PharoV${PHARO_SOURCES}.sources.zip
}
PHARO=${PHARO:=61} # If PHARO not set, set it to 61.
VM=${VM:=vm} # If VM not set, set it to vm.
ARCH=${ARCH:-'32'} # If ARCH not set, set it to 32 bits
VERSION=${VERSION:=$2} # If VERSION not set, set it to the first parameter of this script. Will fail if not provided
SCRIPT_TARGET=${1:-all}
echo "Running target $SCRIPT_TARGET"
echo "Using a Pharo$PHARO image and ${ARCH}-bits $VM virtual machines from get-giles. Will load version $VERSION of PharoLauncher"
case $SCRIPT_TARGET in
prepare)
prepare_image
;;
test)
run_tests
;;
developer)
package_developer_version
;;
user)
package_user_version
;;
win-package)
package_windows_version
;;
mac-package)
package_mac_version
;;
linux-package)
package_linux_version
;;
all)
prepare_image && run_tests && package_developer_version && package_user_version \
&& package_linux_version
;;
*)
echo "No valid target specified! Exiting"
;;
esac