From 9b1fe3a2dc887f366a53014c8efa70aa19f9fb06 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 4 Dec 2022 10:41:37 +0200 Subject: [PATCH 34/34] macos: Add homebrew-appbundle.sh build script Based on patch by ddeanbrown See osdn #44549 Signed-off-by: Marko Lindqvist --- Makefile.am | 1 + platforms/macos/homebrew-appbundle.sh | 103 ++++++++++++++++++++++++++ 2 files changed, 104 insertions(+) create mode 100755 platforms/macos/homebrew-appbundle.sh diff --git a/Makefile.am b/Makefile.am index a7d4496469..9e236b5ba2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -86,6 +86,7 @@ EXTRA_DIST = autogen.sh \ flatpak/org.freeciv.mp.gtk3.yml \ flatpak/org.freeciv.qt.yml \ flatpak/org.freeciv.sdl2.yml \ + platforms/macos/homebrew-appbundle.sh \ scripts/mapimg2anim \ scripts/setup_auth_server.sh \ scripts/replace \ diff --git a/platforms/macos/homebrew-appbundle.sh b/platforms/macos/homebrew-appbundle.sh new file mode 100755 index 0000000000..44271ca49a --- /dev/null +++ b/platforms/macos/homebrew-appbundle.sh @@ -0,0 +1,103 @@ +#!/bin/bash + +# Freeciv - Copyright (C) 2022 - Freeciv team +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +export CPPFLAGS="-I$(brew --prefix readline)/include" +export LDFLAGS="-L$(brew --prefix icu4c)/lib -L$(brew --prefix readline)/lib" +export PKG_CONFIG_PATH="$(brew --prefix icu4c)/lib/pkgconfig" + +CONTENTSDIR="/Applications/Freeciv.app/Contents/" + +if ! mkdir -p "${CONTENTSDIR}" ; then + echo "Failed to create \"${CONTENTSDIR}" >&2 + exit 1 +fi + +if ! mkdir -p "${CONTENTSDIR}Resources" ; then + echo "Failed to create directory \"${CONTENTSDIR}Resources\"" >&2 + exit 1 +fi + +if ! cp data/freeciv-client.icns "${CONTENTSDIR}Resources" ; then + echo "Failed to copy file \"freeciv-client.icns\"" >&2 + exit 1 +fi + +if ! mkdir -p "${CONTENTSDIR}MacOS" ; then + echo "Failed to create directory \"${CONTENTSDIR}MacOS\"" >&2 + exit 1 +fi + +if ! mkdir -p "${CONTENTSDIR}lib" ; then + echo "Failed to create directory \"${CONTENTSDIR}lib\"" >&2 + exit 1 +fi + +if ! echo " + + + LSEnvironment + + LD_LIBRARY_PATH + /Applications/Freeciv.app/Contents/lib + + CFBundleName + freeciv + CFBundleIdentifier + freeciv + CFBundleVersion + 3.1.0-alpha + CFBundleShortVersionString + 3.1.0-alpha + CFBundleExecutable + ../bin/freeciv-gtk3.22 + CFBundleIconFile + freeciv-client.icns + CFBundleDevelopmentRegion + English + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleInfoDictionaryVersion + 6.0 + +" > "${CONTENTSDIR}Info.plist" ; then + echo "Failed to create file \"${CONTENTSDIR}Info.plist\"" >&2 + exit 1 +fi + +if ! echo -n "APPL????" > "${CONTENTSDIR}PkgInfo" ; then + echo "Failed to create file \"${CONTENTSDIR}PkgInfo\"" >&2 + exit 1 +fi + +if ! mkdir build ; then + echo "Failed to create build directory" >&2 + exit 1 +fi + +cd build || exit 1 + +if ! meson setup .. \ + -Druledit=false \ + -Dsyslua=true \ + -Dclients=gtk3.22 \ + -Dfcmp=gtk3 \ + -Dprefix="$CONTENTSDIR" || + ! ninja || + ! ninja install +then + echo "Build failed!" >&2 + exit 1 +fi -- 2.35.1