From 30bda87db47f9eee9646b5e73b70039d95bb7113 Mon Sep 17 00:00:00 2001 From: martin Date: Sun, 7 Feb 2021 22:49:15 +0300 Subject: [PATCH] helper scripts for mac app helpers --- .../AppHelper/create_mac_helper_apps.sh | 57 +++++++++++++++++++ .../SimpleBrowser2/create_mac_helper.sh | 8 +++ 2 files changed, 65 insertions(+) create mode 100755 demos/Lazarus_Mac/AppHelper/create_mac_helper_apps.sh create mode 100755 demos/Lazarus_Mac/SimpleBrowser2/create_mac_helper.sh diff --git a/demos/Lazarus_Mac/AppHelper/create_mac_helper_apps.sh b/demos/Lazarus_Mac/AppHelper/create_mac_helper_apps.sh new file mode 100755 index 00000000..4050723f --- /dev/null +++ b/demos/Lazarus_Mac/AppHelper/create_mac_helper_apps.sh @@ -0,0 +1,57 @@ +#!/bin/sh + +BASEDIR=$(dirname "$0") +DEST=$1 +SRC=$2 + +if [ "$SRC" = "" ]; +then + SRC=$BASEDIR/../../../bin/AppHelper.app +fi + +if [ "$1" = "" ] || [ ! -e "$DEST" ] || [ ! -e "$SRC" ]; +then + echo "Usage" + echo " $0 destpath/project.app" + echo " $0 destpath/project.app sourcedir/AppHelper.app" + echo + if [ ! -e "$DEST" ]; + then + echo "Error: Target app bundle not found. (Did you compile AND create the bundle?)" + fi + if [ ! -e "$SRC" ]; + then + echo "Error: Source (AppHelper) app bundle not found. (Did you compile AND create the bundle?)" + fi + exit; +fi + +SRCAPP=$(basename "$SRC") +SRCAPP="${SRCAPP%\.app}" +DESTAPP=$(basename "$DEST") +DESTAPP="${DESTAPP%\.app}" + +SUB="" +rm -rf "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app" +cp -r "$SRC" "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app" +mv "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app/Contents/MacOS/$SRCAPP" "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app/Contents/MacOS/$DESTAPP Helper$SUB" +sed -i '' "s/$SRCAPP/$DESTAPP Helper$SUB/g" "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app/Contents/Info.plist" + +SUB=" (GPU)" +rm -rf "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app" +cp -r "$SRC" "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app" +mv "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app/Contents/MacOS/$SRCAPP" "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app/Contents/MacOS/$DESTAPP Helper$SUB" +sed -i '' "s/$SRCAPP/$DESTAPP Helper$SUB/g" "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app/Contents/Info.plist" + +SUB=" (Renderer)" +rm -rf "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app" +cp -r "$SRC" "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app" +mv "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app/Contents/MacOS/$SRCAPP" "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app/Contents/MacOS/$DESTAPP Helper$SUB" +sed -i '' "s/$SRCAPP/$DESTAPP Helper$SUB/g" "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app/Contents/Info.plist" + +SUB=" (Plugin)" +rm -rf "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app" +cp -r "$SRC" "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app" +mv "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app/Contents/MacOS/$SRCAPP" "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app/Contents/MacOS/$DESTAPP Helper$SUB" +sed -i '' "s/$SRCAPP/$DESTAPP Helper$SUB/g" "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app/Contents/Info.plist" + diff --git a/demos/Lazarus_Mac/SimpleBrowser2/create_mac_helper.sh b/demos/Lazarus_Mac/SimpleBrowser2/create_mac_helper.sh new file mode 100755 index 00000000..43b6334b --- /dev/null +++ b/demos/Lazarus_Mac/SimpleBrowser2/create_mac_helper.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +CDIR=$(pwd) +cd "$(dirname "$0")" + +../AppHelper/create_mac_helper_apps.sh ../../../bin/SimpleBrowser2.app + +cd "$CDIR"