Last active
August 29, 2015 14:03
-
-
Save dbuenzli/c9e647b43da749ed5e27 to your computer and use it in GitHub Desktop.
Build osx bundle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>CFBundleName</key><string>Test</string> | |
<key>CFDisplayName</key><string>Test</string> | |
<key>CFBundleIdentifier</key><string>org.example.Test</string> | |
<key>CFBundlePackageType</key><string>APPL</string> | |
<key>CFBundleSignature</key><string>????</string> | |
<key>CFBundleVersion</key><string>%%VERSION%%</string> | |
<key>CFBundleShortVersionString</key><string>%%VERSION%%</string> | |
<key>CFBundleExecutable</key><string>Test</string> | |
<key>CFBundleDevelopmentRegion</key><string>en</string> | |
<key>CFBundleGetInfoString</key> | |
<string>Copyright © 2014 Yourname</string> | |
<key>NSHumanReadableCopyright</key> | |
<string>Copyright © 2014 Yourname</string> | |
<key>CFBundleInfoDictionaryVersion</key><string>6.0</string> | |
<key>NSHighResolutionCapable</key><true/> | |
<key>CFBundleDocumentTypes</key> | |
<array> | |
<dict> | |
<key>CFBundleTypeRole</key> | |
<string>Viewer</string> | |
<key>LSItemContentTypes</key> | |
<array> | |
<string>public.item</string> | |
</array> | |
</dict> | |
</array> | |
</dict> | |
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Invoke as follows: | |
# | |
# macosx_app Appname execname libs res_dir | |
# | |
# res_dir should have at least the above Info.plist | |
# | |
# Example: | |
# macosx_app Test _build/src/test.native "libSDL2 libffi" app | |
macosx_app () | |
{ | |
BUILDDIR=_build | |
APP=$1 | |
EXE=$2 | |
DYLIBS=$3 | |
RESDIR=$4 | |
mkdir -p $BUILDDIR/$APP.app/Contents | |
mkdir -p $BUILDDIR/$APP.app/Contents/MacOS | |
mkdir -p $BUILDDIR/$APP.app/Contents/Frameworks | |
mkdir -p $BUILDDIR/$APP.app/Contents/Resources | |
for f in $RESDIR/* ; do | |
if [ "$f" == "$RESDIR/Info.plist" ]; then | |
cp $f $BUILDDIR/$APP.app/Contents/ | |
else | |
cp $f $BUILDDIR/$APP.app/Contents/Resources | |
fi | |
done | |
APPEXE="$BUILDDIR/$APP.app/Contents/MacOS/$APP" | |
cp $EXE $APPEXE | |
for libname in $DYLIBS; do | |
ID=`otool -L $APPEXE | grep -o "/.*$libname.*.dylib"` | |
NEWID="@loader_path/../Frameworks/`basename $ID`" | |
LOC="$BUILDDIR/$APP.app/Contents/Frameworks/`basename $ID`" | |
cp $ID $LOC | |
chmod u+w $LOC | |
install_name_tool -id $NEWID $LOC | |
install_name_tool -change $ID $NEWID $APPEXE | |
done | |
if [ ! -h $APP.app ]; then | |
ln -s $BUILDDIR/$APP.app $APP.app | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment