mirror of
https://git.code.sf.net/p/fldigi/flmsg
synced 2026-08-13 17:30:58 -04:00
OS X build script
* Modify to build dmg with dylibs only
This commit is contained in:
parent
028b0ca1ca
commit
23111e97e6
2 changed files with 97 additions and 90 deletions
|
|
@ -1,119 +1,126 @@
|
|||
#!/bin/sh
|
||||
|
||||
### Script to create the .app structure for osx
|
||||
### 20090730 Stelios Bounanos M0GLD
|
||||
### 20180201 David Freese W1HKJ
|
||||
|
||||
if [ $# -ne 2 ]; then
|
||||
echo "Syntax: $0 data-dir build-dir" >&2
|
||||
exit 1
|
||||
echo "Syntax: $0 data-dir build-dir" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
upcase1()
|
||||
{
|
||||
sed 'h; s/\(^.\).*/\1/; y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/; G; s/\n.//'
|
||||
}
|
||||
|
||||
function copy_libs()
|
||||
{
|
||||
list="$1"
|
||||
while test "x$list" != "x"; do
|
||||
change="$list"
|
||||
list=""
|
||||
|
||||
for obj in $change; do
|
||||
for lib in `otool -L $obj | \
|
||||
sed -n 's!^.*[[:space:]]\([^[:space:]]*\.dylib\).*$!\1!p' | \
|
||||
grep -Ev '^/(usr/lib|System)'`; do
|
||||
libfn="`basename $lib`"
|
||||
if ! test -f "Frameworks/$libfn"; then
|
||||
cp "$lib" "Frameworks/$libfn"
|
||||
install_name_tool -id "@executable_path/../Frameworks/$libfn" "Frameworks/$libfn"
|
||||
list="$list Frameworks/$libfn"
|
||||
fi
|
||||
install_name_tool -change "$lib" "@executable_path/../Frameworks/$libfn" "$obj"
|
||||
done
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
function bundle()
|
||||
{
|
||||
appname="${binary}-${appversion}.app"
|
||||
|
||||
cd "$build"
|
||||
|
||||
echo "creating ${build}/$bundle_dir/$appname"
|
||||
|
||||
$mkinstalldirs "$bundle_dir/$appname/Contents/MacOS" "$bundle_dir/$appname/Contents/Resources"
|
||||
cd "$bundle_dir"
|
||||
|
||||
$INSTALL_PROGRAM "${build}/$binary" "$appname/Contents/MacOS"
|
||||
test "x$NOSTRIP" = "x" && ${STRIP:-strip} -S "$appname/Contents/MacOS/$binary"
|
||||
$INSTALL_DATA "$icon" "$appname/Contents/Resources"
|
||||
|
||||
echo "APPL${signature}" > "$appname/Contents/PkgInfo"
|
||||
sed -e "s!%%IDENTIFIER%%!${identifier}!g; s!%%NAME%%!${name}!g;\
|
||||
s!%%SIGNATURE%%!${signature}!g; s!%%BINARY%%!${binary}!g;\
|
||||
s!%%VERSION%%!${version}!g; s!%%ICON%%!${icon##*/}!g;" < "$plist" > "$appname/Contents/Info.plist"
|
||||
|
||||
if grep '%%[A-Z]*%%' "$appname/Contents/Info.plist"; then
|
||||
echo "E: unsubstituted variables in $appname/Contents/Info.plist" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
$mkinstalldirs "$appname/Contents/Frameworks"
|
||||
cd "$appname/Contents"
|
||||
|
||||
copy_libs "MacOS/$binary"
|
||||
|
||||
}
|
||||
|
||||
#=======================================================================
|
||||
|
||||
if [ -z "$PACKAGE_TARNAME" ]; then
|
||||
echo "E: \$PACKAGE_TARNAME undefined"
|
||||
exit 1
|
||||
echo "E: \$PACKAGE_TARNAME undefined"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PWD=`pwd`
|
||||
data="${PWD}/$1"
|
||||
build="${PWD}/$2"
|
||||
bundle_dir="$APPBUNDLE_NOLIBS"
|
||||
static_bundle_dir="$APPBUNDLE"
|
||||
bundle_dir="$APPBUNDLE"
|
||||
|
||||
# more sanity checks
|
||||
for d in "$data" "$build"; do
|
||||
test -d "$d" && continue
|
||||
echo "E: ${d}: not a directory" >&2
|
||||
exit 1
|
||||
test -d "$d" && continue
|
||||
echo "E: ${d}: not a directory" >&2
|
||||
exit 1
|
||||
done
|
||||
if ! test -w "$build"; then
|
||||
echo "E: ${build} is not writeable" >&2
|
||||
exit 1
|
||||
echo "E: ${build} is not writeable" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
plist="${data}/mac/Info.plist.in"
|
||||
FLMSG_icon="${data}/mac/FLMSG.icns"
|
||||
for f in "$plist" "$FLMSG_icon"; do
|
||||
test -r "$f" && continue
|
||||
echo "E: ${f}: not readable" >&2
|
||||
exit 1
|
||||
done
|
||||
|
||||
# aaaaaaaaaargh => Aaaaaaaaaargh
|
||||
upcase1()
|
||||
{
|
||||
sed 'h; s/\(^.\).*/\1/; y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/; G; s/\n.//'
|
||||
}
|
||||
|
||||
function copy_libs()
|
||||
{
|
||||
list="$1"
|
||||
while test "x$list" != "x"; do
|
||||
change="$list"
|
||||
list=""
|
||||
|
||||
for obj in $change; do
|
||||
for lib in `otool -L $obj | \
|
||||
sed -n 's!^.*[[:space:]]\([^[:space:]]*\.dylib\).*$!\1!p' | \
|
||||
grep -Ev '^/(usr/lib|System)'`; do
|
||||
libfn="`basename $lib`"
|
||||
if ! test -f "Frameworks/$libfn"; then
|
||||
cp "$lib" "Frameworks/$libfn"
|
||||
install_name_tool -id "@executable_path/../Frameworks/$libfn" "Frameworks/$libfn"
|
||||
list="$list Frameworks/$libfn"
|
||||
fi
|
||||
install_name_tool -change "$lib" "@executable_path/../Frameworks/$libfn" "$obj"
|
||||
done
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
function bundle()
|
||||
{
|
||||
appname="${binary}-${appversion}.app"
|
||||
cd "$build"
|
||||
|
||||
# bundle the binary
|
||||
echo "creating ${build}/$bundle_dir/$appname"
|
||||
$mkinstalldirs "$bundle_dir/$appname/Contents/MacOS" "$bundle_dir/$appname/Contents/Resources"
|
||||
cd "$bundle_dir"
|
||||
$INSTALL_PROGRAM "${build}/$binary" "$appname/Contents/MacOS"
|
||||
test "x$NOSTRIP" = "x" && ${STRIP:-strip} -S "$appname/Contents/MacOS/$binary"
|
||||
|
||||
$INSTALL_DATA "$icon" "$appname/Contents/Resources"
|
||||
echo "APPL${signature}" > "$appname/Contents/PkgInfo"
|
||||
sed -e "s!%%IDENTIFIER%%!${identifier}!g; s!%%NAME%%!${name}!g;\
|
||||
s!%%SIGNATURE%%!${signature}!g; s!%%BINARY%%!${binary}!g;\
|
||||
s!%%VERSION%%!${version}!g; s!%%ICON%%!${icon##*/}!g;" < "$plist" > "$appname/Contents/Info.plist"
|
||||
if grep '%%[A-Z]*%%' "$appname/Contents/Info.plist"; then
|
||||
echo "E: unsubstituted variables in $appname/Contents/Info.plist" >&2
|
||||
flmsg_icon="${data}/mac/flmsg.icns"
|
||||
for f in "$plist" "$flmsg_icon"; do
|
||||
test -r "$f" && continue
|
||||
echo "E: ${f}: not readable" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# bundle the binary and its non-standard dependencies
|
||||
echo "creating ${build}/$static_bundle_dir/$appname"
|
||||
cd ..
|
||||
$mkinstalldirs "$static_bundle_dir"
|
||||
cp -pR "$bundle_dir/$appname" "$static_bundle_dir"
|
||||
$mkinstalldirs "$static_bundle_dir/$appname/Contents/Frameworks"
|
||||
cd "$static_bundle_dir/$appname/Contents"
|
||||
copy_libs "MacOS/$binary"
|
||||
}
|
||||
done
|
||||
|
||||
set -e
|
||||
|
||||
identifier="com.w1hkj.$PACKAGE_TARNAME"
|
||||
name=$(echo "$PACKAGE_TARNAME" | upcase1)
|
||||
|
||||
# we'll use the first four consonants as the signature
|
||||
|
||||
signature="$(echo $PACKAGE_TARNAME | sed 's/[aeiouAEIOU]//g; s/\(^....\).*/\1/')"
|
||||
|
||||
signature="$PACKAGE_TARNAME"
|
||||
binary="$PACKAGE_TARNAME"
|
||||
icon="$FLMSG_icon"
|
||||
version="${FLMSG_VERSION_MAJOR}.${FLMSG_VERSION_MINOR}"
|
||||
appversion="$FLMSG_VERSION"
|
||||
icon="$flmsg_icon"
|
||||
version="${flmsg_VERSION_MAJOR}.${flmsg_VERSION_MINOR}"
|
||||
appversion="$flmsg_VERSION"
|
||||
|
||||
bundle
|
||||
|
||||
cd "$build"
|
||||
echo $ECHO_N "creating disk image"
|
||||
hdiutil create -ov -srcfolder "$bundle_dir" -format UDZO -tgtimagekey zlib-level=9 "${APPBUNDLE}-nolibs.dmg"
|
||||
echo $ECHO_N "creating disk image"
|
||||
hdiutil create -ov -srcfolder "$static_bundle_dir" -format UDZO -tgtimagekey zlib-level=9 "${APPBUNDLE}.dmg"
|
||||
|
||||
echo "creating disk image"
|
||||
|
||||
echo " source: " $bundle_dir
|
||||
echo " target: " ${APPBUNDLE}.dmg
|
||||
|
||||
hdiutil create -ov -srcfolder "$bundle_dir" -format UDZO -tgtimagekey zlib-level=9 "${APPBUNDLE}.dmg"
|
||||
|
|
|
|||
|
|
@ -61,10 +61,10 @@ endif
|
|||
########################################################################
|
||||
|
||||
|
||||
FLMSG_VERSION_MAJOR = @FLMSG_VERSION_MAJOR@
|
||||
FLMSG_VERSION_MINOR = @FLMSG_VERSION_MINOR@
|
||||
FLMSG_VERSION_PATCH = @FLMSG_VERSION_PATCH@
|
||||
FLMSG_VERSION = @FLMSG_VERSION@
|
||||
flmsg_VERSION_MAJOR = @FLMSG_VERSION_MAJOR@
|
||||
flmsg_VERSION_MINOR = @FLMSG_VERSION_MINOR@
|
||||
flmsg_VERSION_PATCH = @FLMSG_VERSION_PATCH@
|
||||
flmsg_VERSION = @FLMSG_VERSION@
|
||||
|
||||
.EXPORT_ALL_VARIABLES: nsisinst appbundle
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue