forked from openmusic-project/openmusic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release
executable file
·181 lines (149 loc) · 5.57 KB
/
release
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
#!/bin/bash
# 32bits:
# LWARCH=32-bit
# LWEXEC=lispworks-7-0-0-x86-darwin
LWARCH=64-bit
LWVERSION=7.1
LWEXEC=lispworks-7-1-0-amd64-darwin
OM_VERSION="6.15"
APP_FOLDER="OM 6.15"
DMG_NAME="OM-6.15-macOS"
get_abs_filename() {
# $1 : relative filename
filename=$1
parentdir=$(dirname "${filename}")
if [ -d "${filename}" ]; then
echo "$(cd "${filename}" && pwd)"
elif [ -d "${parentdir}" ]; then
echo "$(cd "${parentdir}" && pwd)/$(basename "${filename}")"
fi
}
LIBS_SOURCE_FOLDER="$(get_abs_filename "../")"
#LIBS_FOLDER="$(get_abs_filename "../../om-libs-forum/")"
LIBS_RELEASE_FOLDER="$(get_abs_filename "../OM-LIBRARIES-RELEASE/")"
# => /Users/bresson/SRC/omlibraries/
deliver_app()
{
echo "***************************************************"
echo "COMPILING STANDALONE EXE"
echo "***************************************************"
rm -rf ./OPENMUSIC/*.app/
/Applications/LispWorks\ $LWVERSION\ \($LWARCH\)/LispWorks\ \($LWARCH\).app/Contents/MacOS/$LWEXEC -build ./OPENMUSIC/build/deliver.lisp
}
# deliver_app MUST have been called before..
pack_app()
{
echo "***************************************************"
echo "Packing $APP_FOLDER"
echo "***************************************************"
cd ./OPENMUSIC/build/
/Applications/LispWorks\ $LWVERSION\ \($LWARCH\)/LispWorks\ \($LWARCH\).app/Contents/MacOS/$LWEXEC -build pack-om.lisp
cd ../..
cp "README.txt" "$APP_FOLDER"
}
# deliver_app MUST have been called before..
pack_lib()
{
echo "***************************************************"
echo "Packing library: name"
echo "***************************************************"
echo "(setf *lib-name* #P\"$LIBS_SOURCE_FOLDER/$1/\" *release-dir* #P\"$2/\")" > 'lib-name.lisp.tmp'
cd ./OPENMUSIC/build/
/Applications/LispWorks\ $LWVERSION\ \($LWARCH\)/LispWorks\ \($LWARCH\).app/Contents/MacOS/$LWEXEC -build pack-library.lisp
cd ../..
rm 'lib-name.lisp.tmp'
}
pack_om_libs()
{
OMLIBS_RELEASE_FOLDER="$(get_abs_filename "$APP_FOLDER"/Libraries/)"
mkdir "$OMLIBS_RELEASE_FOLDER"
pack_lib "RepMus" "$OMLIBS_RELEASE_FOLDER"
pack_lib "Profile" "$OMLIBS_RELEASE_FOLDER"
pack_lib "Esquisse" "$OMLIBS_RELEASE_FOLDER"
pack_lib "Alea" "$OMLIBS_RELEASE_FOLDER"
pack_lib "Chaos" "$OMLIBS_RELEASE_FOLDER"
pack_lib "Situation" "$OMLIBS_RELEASE_FOLDER"
pack_lib "Clouds" "$OMLIBS_RELEASE_FOLDER"
pack_lib "LZ" "$OMLIBS_RELEASE_FOLDER"
}
# pack_app MUST have been called before..
set_fonts()
{
echo "***************************************************"
echo "Setting font resources in $APP_FOLDER"
echo "***************************************************"
cp "$APP_FOLDER"/"$APP_FOLDER".app/Contents/Resources/fonts/mac/* "$APP_FOLDER"/"$APP_FOLDER".app/Contents/Resources/fonts/
rm -rf "$APP_FOLDER"/"$APP_FOLDER".app/Contents/Resources/fonts/mac/
rm -rf "$APP_FOLDER"/"$APP_FOLDER".app/Contents/Resources/fonts/win/
rm -rf "$APP_FOLDER"/"$APP_FOLDER".app/Contents/Resources/fonts/linux/
cp "$APP_FOLDER"/"$APP_FOLDER".app/Contents/Info.plist .
defaults write $(pwd)/Info.plist ATSApplicationFontsPath -string "fonts/"
mv ./Info.plist "$APP_FOLDER"/"$APP_FOLDER".app/Contents/Info.plist
chmod 644 "$APP_FOLDER"/"$APP_FOLDER".app/Contents/Info.plist
}
# pack_app MUST have been called before..
create_simple_dmg()
{
echo "***************************************************"
echo "Preparing DMG distribution for $APP_FOLDER"
echo "***************************************************"
rm -f $DMG_NAME.dmg
#rm -rf _DMG
#mkdir _DMG
#cp -R "$APP_FOLDER" _DMG
#ln -s /Applications/ _DMG/Applications
#hdiutil create -fs HFS+ -volname $DMG_NAME -srcfolder _DMG $DMG_NAME.dmg
hdiutil create -fs HFS+ -volname $DMG_NAME -srcfolder "$APP_FOLDER" $DMG_NAME.dmg
#rm -rf _DMG
}
zip_release()
{
rm ./"$DMG_NAME".zip
zip -r ./"$DMG_NAME".zip ./"$APP_FOLDER"/
}
change_permission()
{
# this function change the permission for a given folder
# $1 : the folder
echo "Setting permissions for $1"
sudo chown -R root "$1"
sudo chgrp -R admin "$1"
sudo chmod -R o+rx "$1"
sudo chmod -R ug+rwx "$1"
}
sign_release()
{
./codesign-om6
}
#=============================
# MAIN SCRIPT
#=============================
if [ $1 = "-d" ]; then deliver_app
elif [ $1 = "-p" ]; then pack_app; set_fonts
elif [ $1 = "-dp" ]; then deliver_app; pack_app; set_fonts
elif [ $1 = "-dmg" ]; then create_simple_dmg
elif [ $1 = "-zip" ]; then zip_release
elif [ $1 = "-sign" ]; then sign_release
elif [ $1 = "-dpd" ]; then deliver_app; pack_app; set_fonts; create_simple_dmg
elif [ $1 = "-dpz" ]; then deliver_app; pack_app; set_fonts; zip_release
elif [ $1 = "-lib" ]; then pack_lib $2 $LIBS_RELEASE_FOLDER
elif [ $1 = "-omlibs" ]; then pack_om_libs
elif [ $1 = "-om" ]; then deliver_app; pack_app; set_fonts; sign_release; zip_release; create_simple_dmg
elif [ $1 = "-all" ]; then deliver_app; pack_app; set_fonts; sign_release; zip_release; pack_om_libs; create_simple_dmg
else
echo "Dont'know what to do! :("
echo "Options:"
echo "-d = deliver app"
echo "-p = pack delivered app as a separate folder (including fonts) "
echo "-dp = deliver and pack"
echo "-sign = sign delivered package"
echo "-zip = create ZIP from previously packed app"
echo "-dmg = create DMG from previously packed app"
echo "-dpd = deliver, pack and create DMG"
echo "-dpz = deliver, pack and zip"
echo "-lib \"LIB_NAME\" = deliver a library in the default lib-delivery folder"
echo "-omlibs = deliver standard OM libraries in the OM build folder"
echo "-om = deliver, pack, sign, zip and create DMG"
echo "-all = deliver, pack, sign, zip (OM only), include libraries and create DMG"
fi
exit 0