forked from BlitterStudio/amiberry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make-bundle.sh
48 lines (43 loc) · 2.17 KB
/
make-bundle.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
#!/usr/bin/env sh
USERDIR=`echo ~`
LONGVER=`cat src/osdep/target.h | grep AMIBERRYVERSION | awk -F '_T\\\(\\\"' '{print $2}' | awk -F '\\\"' '{printf $1}'`
VERSION=`echo $LONGVER | awk -F v '{printf $2}' | awk '{print $1}'`
MAJOR=`echo $VERSION | awk -F . '{printf $1}'`
MINOR=`echo $VERSION | awk -F . '{printf $2}'`
echo "Removing old App directory"
rm -Rf Amiberry.app
echo "Creating App directory"
# Make directory for App bundle
mkdir -p Amiberry.app/Contents/MacOS
mkdir -p Amiberry.app/Contents/Frameworks
mkdir -p Amiberry.app/Contents/Resources
# Copy executable into App bundle
cp amiberry Amiberry.app/Contents/MacOS/Amiberry
# Copy launch script into the bundle
cp run_amiberry.zsh Amiberry.app/Contents/MacOS
chmod +x Amiberry.app/Contents/MacOS/run_amiberry.zsh
# Copy parameter list into the bundle
cat Info.plist.template | sed -e "s/LONGVERSION/$LONGVER/" | sed -e "s/VERSION/$VERSION/" | sed -e "s/MAJOR/$MAJOR/" | sed -e "s/MINOR/$MINOR/" > Amiberry.app/Contents/Info.plist
# Self-sign binary
export CODE_SIGN_ENTITLEMENTS=Entitlements.plist
codesign --entitlements=Entitlements.plist --force -s - Amiberry.app
# Copy OSX specific conf template into the bundle
cp -R conf Amiberry.app/Contents/Resources/Configurations
# Copy controllers into the bundle
cp -R controllers Amiberry.app/Contents/Resources/Controllers
# Copy kickstarts into the bundle
cp -R kickstarts Amiberry.app/Contents/Resources/Kickstarts
# Copy data into the bundle
cp -R data Amiberry.app/Contents/Resources/Data
# Copy docs into the bundle
cp -R docs Amiberry.app/Contents/Resources/Docs
# Copy whdboot into the bundle
cp -R whdboot Amiberry.app/Contents/Resources/Whdboot
# Overwrite default conf with OSX specific one
mkdir Amiberry.app/Contents/resources/conf
cat conf/amiberry-osx.conf | sed -e "s#USERDIR#$USERDIR#g" >Amiberry.app/Contents/Resources/conf/amiberry.conf
# Use dylibbundler to install into app if exists
dylibbundler -od -b -x Amiberry.app/Contents/MacOS/Amiberry -d Amiberry.app/Contents/libs/ -s external/libguisan/dylib/
if [ $? -gt 0 ]; then
echo "Can't find dylibbundler, use brew to install it, or manually copy external/libguisan/dylib/libguisan.dylib into /usr/local/lib (you'll need sudo)"
fi