Compare commits
2 Commits
8f975ad44b
...
d323a7fb00
Author | SHA1 | Date |
---|---|---|
Alison G. Watson | d323a7fb00 | |
Alison G. Watson | 43ac712f34 |
|
@ -0,0 +1,115 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
err_ok=0
|
||||
err_bad_arg=1
|
||||
err_bad_run=2
|
||||
|
||||
rm_if() {
|
||||
if [[ -d $1 ]];
|
||||
then
|
||||
rm -rf "$1" && echo "removed dir $1"
|
||||
elif [[ -f $1 ]]
|
||||
then
|
||||
rm -f "$1" && echo "removed file $1"
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
perish() {
|
||||
rm_if "${tmpdir}"
|
||||
exit "$1"
|
||||
}
|
||||
err() {
|
||||
echo "error, dropping build"
|
||||
rm_if "${appdir}"
|
||||
rm_if "${dmg}"
|
||||
perish $1
|
||||
}
|
||||
:() {
|
||||
echo "$@"
|
||||
echo
|
||||
eval "$@" || err ${err_bad_run}
|
||||
}
|
||||
|
||||
declare -A icon_names=(
|
||||
[Tycho]="resources/color/pfhor-hand.png"
|
||||
)
|
||||
|
||||
name=$1
|
||||
exe=$2
|
||||
|
||||
if [[ ! $name ]]
|
||||
then
|
||||
echo "program name needed (available: Tycho)"
|
||||
err ${err_bad_arg}
|
||||
fi
|
||||
|
||||
if [[ ! $exe ]]
|
||||
then
|
||||
echo "full path to executable required (ex. '$0 $name ~/bin/maraiah-tycho')"
|
||||
err ${err_bad_arg}
|
||||
fi
|
||||
|
||||
app=${name}.app
|
||||
|
||||
srcdir=${PWD}/${name,,}
|
||||
exedir=$(dirname "${exe}")
|
||||
appdir=${exedir}/${app}
|
||||
|
||||
tmpdir=$(mktemp -d)
|
||||
diskdir=${tmpdir}/disk
|
||||
icondir=${tmpdir}/${name}.iconset
|
||||
|
||||
icon=${srcdir}/${icon_names[${name}]}
|
||||
dmg=${exedir}/${name}.dmg
|
||||
|
||||
: rm_if "${appdir}"
|
||||
|
||||
: mkdir -p "${appdir}/Contents/"{Frameworks,MacOS,Resources}
|
||||
|
||||
: cp "${exe}" "${appdir}/Contents/MacOS"
|
||||
: cp "${srcdir}/resources/Info.plist" "${appdir}/Contents"
|
||||
|
||||
: mkdir -p "${icondir}"
|
||||
|
||||
: sips -z 16 16 "${icon}" --out "${icondir}/icon_16x16.png"
|
||||
: sips -z 32 32 "${icon}" --out "${icondir}/icon_32x32.png"
|
||||
: sips -z 64 64 "${icon}" --out "${icondir}/icon_64x64.png"
|
||||
: sips -z 128 128 "${icon}" --out "${icondir}/icon_128x128.png"
|
||||
: sips -z 256 256 "${icon}" --out "${icondir}/icon_256x256.png"
|
||||
: sips -z 512 512 "${icon}" --out "${icondir}/icon_512x512.png"
|
||||
: sips -z 1024 1024 "${icon}" --out "${icondir}/icon_512x512@2x.png"
|
||||
|
||||
: cp "${icondir}/icon_32x32.png" "${icondir}/icon_16x16@2x.png"
|
||||
: cp "${icondir}/icon_64x64.png" "${icondir}/icon_32x32@2x.png"
|
||||
: cp "${icondir}/icon_256x256.png" "${icondir}/icon_128x128@2x.png"
|
||||
: cp "${icondir}/icon_512x512.png" "${icondir}/icon_256x256@2x.png"
|
||||
|
||||
: iconutil -c icns -o "${appdir}/Contents/Resources/${name}.icns" "${icondir}"
|
||||
|
||||
while IFS= read -r lnk
|
||||
do
|
||||
lnk=$(dirname "${lnk}")
|
||||
: cp -r "${lnk}" "${appdir}/Contents/Frameworks"
|
||||
done < "${exedir}"/build/maraiah-tycho-*/out/etc/link.txt
|
||||
|
||||
echo "success: bundle written to ${appdir}"
|
||||
|
||||
if [[ ! "$NO_DMG" ]]
|
||||
then
|
||||
echo "creating the disk image..."
|
||||
|
||||
: rm_if "${dmg}"
|
||||
|
||||
: mkdir -p "${diskdir}"
|
||||
: cp -r "${appdir}" "${diskdir}"
|
||||
: cp "${srcdir}/resources/Image.DS_Store" "${diskdir}/.DS_Store"
|
||||
: ln -s /Applications "${diskdir}"
|
||||
: hdiutil create -volname "${name}" -srcfolder "${diskdir}" "${dmg}"
|
||||
|
||||
echo "success: dmg written to ${dmg}"
|
||||
fi
|
||||
|
||||
perish ${err_ok}
|
||||
|
||||
## EOF
|
Binary file not shown.
|
@ -0,0 +1,36 @@
|
|||
<?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>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>Tycho</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>maraiah-tycho</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>Tycho.icns</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>net.greyserv.maraiah.tycho</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>Tycho</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.0.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>20190704.093221</string>
|
||||
<key>CSResourcesFileMapped</key>
|
||||
<true/>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.developer-tools</string>
|
||||
<key>LSRequiresCarbon</key>
|
||||
<true/>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<true/>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Public domain software.</string>
|
||||
</dict>
|
||||
</plist>
|
Loading…
Reference in New Issue