From 740b89c64f16a5d0fda344366985b5754e594501 Mon Sep 17 00:00:00 2001 From: Ian C Date: Wed, 10 Jan 2024 10:45:25 +0000 Subject: Initial attempt. Icons not working. --- exe2app.bash | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100755 exe2app.bash (limited to 'exe2app.bash') diff --git a/exe2app.bash b/exe2app.bash new file mode 100755 index 0000000..737027b --- /dev/null +++ b/exe2app.bash @@ -0,0 +1,95 @@ +#!/bin/bash + +SCR=$(basename $0) + +unset IFS + +function usage() +{ + echo "$SCR: usage $SCR -x executable " + echo " -i icon" + echo " -o app" + echo " -v version" + echo " -n bundle_identifier" + echo " -c creator_code (4 chars)" +} + +function log() +{ + echo "$SCR: $*" +} + +while getopts x:i:o:v:n:c: arg ; do + case "$arg" in + x) + EXE="$OPTARG" + ;; + i) + ICON="$OPTARG" + ;; + o) + APP="$OPTARG".app + ;; + v) + VERSION="$OPTARG" + ;; + n) + BUNDLE_ID="$OPTARG" + ;; + c) + CREATOR="$OPTARG" + ;; + *) + usage + exit 1 + ;; + esac +done + +if [ -z "$EXE" -o -z "$ICON" -o -z "$APP" \ + -o -z "$VERSION" -o -z "$BUNDLE_ID" -o -z "$CREATOR" ] ; then + usage + exit 1 +fi + +APPNAME=$(basename "$APP" .app) +EXENAME=$(basename "$EXE") + +log Generating $APPNAME from $EXE + +mkdir -p "$APP/Contents" +mkdir -p "$APP/Contents/MacOS" +mkdir -p "$APP/Contents/MacOS/lib" + +# Copy executable +# +cp "$EXE" "$APP/Contents/MacOS" + +# Create icons +# +convert $ICON -resize 512x512 "$APP/Contents/$APPNAME.png" + +# Create the plist file +# +cat > "$APP/Contents/Info.plist" << EOF + + + + +CFBundleName +$APPNAME +CFBundleDisplayName +$APPNAME +CFBundleIdentifier +$BUNDLE_ID +CFBundleVersion +$VERSION +CFBundlePackageType +APPL +CFBundleSignature +$CREATOR +CFBundleExecutable +$EXENAME + + +EOF -- cgit v1.2.3