-
Notifications
You must be signed in to change notification settings - Fork 14
/
release
executable file
·169 lines (130 loc) · 4.59 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
#!/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=$(<"VERSION")
BUILD_FOLDER="_BUILD"
APP_NAME="om-sharp"
CYAN='\033[0;36m'
BLUE='\033[0;34m'
RED='\033[0;31m'
GREEN='\033[92m'
NC='\033[0m' # No Color
deliver_app()
{
echo -e "${CYAN}***************************************************${NC}"
echo -e "${CYAN}COMPILING STANDALONE IMAGE${NC}"
echo -e "${CYAN}***************************************************${NC}"
rm -rf ./*.app/
/Applications/LispWorks\ $LWVERSION\ \($LWARCH\)/LispWorks\ \($LWARCH\).app/Contents/MacOS/$LWEXEC -build ./build/deliver.lisp
# update version
OM_VERSION=$(<"VERSION")
echo -e "${GREEN}=> IMAGE DONE!${NC}"
}
# deliver_app MUST have been called before..
pack_app()
{
echo -e "${CYAN}***************************************************${NC}"
echo -e "${CYAN}Packing $BUILD_FOLDER/$APP_NAME.app${NC}"
echo -e "${CYAN}***************************************************${NC}"
rm -Rf $BUILD_FOLDER
mkdir $BUILD_FOLDER
cp -R "$APP_NAME".app $BUILD_FOLDER
echo -e "${CYAN}=> Setting fonts....${NC}"
# cp om/resources/fonts/* "$BUILD_FOLDER"/"$APP_NAME".app/Contents/Resources/fonts/
cp "$BUILD_FOLDER"/"$APP_NAME".app/Contents/Info.plist .
defaults write $(pwd)/Info.plist ATSApplicationFontsPath -string "fonts/"
mv ./Info.plist "$BUILD_FOLDER"/"$APP_NAME".app/Contents/Info.plist
echo -e "${GREEN}=> PACKED IN BUILD FOLDER!${NC}"
}
# pack_app MUST have been called before..
create_simple_dmg()
{
DMG_NAME="$APP_NAME"-"$OM_VERSION"-macOS.dmg
echo -e "${CYAN}***************************************************${NC}"
echo -e "${CYAN}Preparing DMG distribution for $APP_NAME${NC}"
echo -e "${CYAN}***************************************************${NC}"
cd $BUILD_FOLDER
rm -f "$DMG_NAME"
rm -rf _DMG
mkdir _DMG
cp -R "$APP_NAME".app _DMG/
#cp "README.txt" "$BUILD_FOLDER"/_DMG/
#ln -s /Applications/ _DMG/Applications
hdiutil create -fs HFS+ -volname $DMG_NAME -srcfolder _DMG "$DMG_NAME"
rm -rf _DMG
cd ..
echo -e "${GREEN}=> DMG DONE: $DMG_NAME ${NC}"
}
zip_release()
{
ZIP_NAME="$APP_NAME"-"$OM_VERSION".zip
echo -e "${CYAN}***************************************************${NC}"
echo -e "${CYAN}Preparing ZIP distribution for $APP_NAME${NC}"
echo -e "${CYAN}***************************************************${NC}"
cd $BUILD_FOLDER
rm -f "$ZIP_NAME"
rm -rf "$APP_NAME"
mkdir "$APP_NAME"
cp -R "$APP_NAME".app "$APP_NAME"/
zip -r -q -dg "$ZIP_NAME" "$APP_NAME"
rm -rf "$APP_NAME"
cd ..
echo -e "${GREEN}=> ZIP DONE: $ZIP_NAME ${NC}"
}
sign_release()
{
echo -e "${CYAN}***************************************************${NC}"
echo -e "${CYAN}Code Signature (calling external script)${NC}"
echo -e "${CYAN}***************************************************${NC}"
./codesign.sh "$BUILD_FOLDER"/"$APP_NAME".app
echo -e "${GREEN}=> CODE SIGNATURE: DONE${NC}"
}
notarize_dmg()
{
DMG_NAME="$APP_NAME"-"$OM_VERSION"-macOS.dmg
echo -e "${CYAN}***************************************************${NC}"
echo -e "${CYAN}Notarization (calling external script)${NC}"
echo -e "${CYAN}***************************************************${NC}"
./notarize.sh "$BUILD_FOLDER"/"$DMG_NAME"
}
change_permission()
{
# this function change the permission for a given folder
# $1 : the folder
echo -e "${CYAN}Setting permissions for $1${NC}"
sudo chown -R root "$1"
sudo chgrp -R admin "$1"
sudo chmod -R o+rx "$1"
sudo chmod -R ug+rwx "$1"
}
#=============================
# MAIN SCRIPT
#=============================
if [ "$1" = "-d" ]; then deliver_app
elif [ "$1" = "-p" ]; then pack_app
elif [ "$1" = "-dp" ]; then deliver_app; pack_app
elif [ "$1" = "-dmg" ]; then create_simple_dmg
elif [ "$1" = "-zip" ]; then zip_release
elif [ "$1" = "-sign" ]; then sign_release
elif [ "$1" = "-notarize" ]; then notarize_dmg
elif [ "$1" = "-dpd" ]; then deliver_app; pack_app; sign_release;create_simple_dmg
elif [ "$1" = "-dpz" ]; then deliver_app; pack_app; sign_release; zip_release
elif [ "$1" = "-all" ]; then deliver_app; pack_app; sign_release; zip_release; 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, sign and create DMG"
echo "-dpz = deliver, pack, sign and zip"
echo "-all = deliver, pack, SIGN and create zip + DGM"
fi
exit 0