From 30b193ff6334f24d408afa7adaa5bc7220394d3a Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 17 Apr 2022 05:11:47 +0300 Subject: [PATCH 04/41] macOS: Add hbinstall.sh script For installing homebrew environment for building macOS .app See osdn #44400 Signed-off-by: Marko Lindqvist --- Makefile.am | 1 + macOS/homebrew/hbinstall.sh | 85 +++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100755 macOS/homebrew/hbinstall.sh diff --git a/Makefile.am b/Makefile.am index 0157042ec2..8447758b1f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -28,6 +28,7 @@ docs = \ EXTRA_DIST = autogen.sh \ configure.ac \ + macOS/homebrew/hbinstall.sh \ m4/ax_cxx_compile_stdcxx.m4 \ m4/c99.m4 \ m4/c11.m4 \ diff --git a/macOS/homebrew/hbinstall.sh b/macOS/homebrew/hbinstall.sh new file mode 100755 index 0000000000..ab861d67e7 --- /dev/null +++ b/macOS/homebrew/hbinstall.sh @@ -0,0 +1,85 @@ +#!/bin/bash + +# Install homebrew for building MacOS freeciv .app +# WIP + +# Can be "master", if you want development version +HBVER="3.4.6" + +if test "$1" = "" ; then + echo "No installation directory given." >&2 + exit 1 +fi + +MAINDIR="$1" + +if ! mkdir -p "${MAINDIR}/Contents" ; then + echo "Failed to create \"${MAINDIR}/Contents\"" >&2 + exit 1 +fi + +if ! mkdir -p "${MAINDIR}/Contents/Resources" ; then + echo "Failed to create \"${MAINDIR}/Contents/Resources\"" >&2 + exit 1 +fi + +if ! mkdir -p "${MAINDIR}/Contents/MacOS" ; then + echo "Failed to create \"${MAINDIR}/Contents/MacOS\"" >&2 + exit 1 +fi + +if ! curl -L "https://github.com/Homebrew/brew/tarball/${HBVER}" | + tar xz --strip 1 -C "${MAINDIR}/Contents/Resources" +then + echo "Homebrew install failed" >&2 + exit 1 +fi + +eval "$("${MAINDIR}/Contents/Resources/bin/brew" shellenv)" + +# Packages that we temporarily take from HEAD +# - shared-mime-info : current version available from homebrew does not build with recent meson +# - meson : version available from homebrew fails building latest gtk+3 +HEAD_PACKAGES="\ + meson \ + shared-mime-info \ +" + +PACKAGES="\ + lua@5.4 \ + autoconf \ + automake \ + gettext \ + libtool \ + pkg-config \ + atk \ + freetype \ + gettext \ + glib \ + gtk+3 \ + icu4c \ + pango \ + sdl2_gfx \ + sdl2_image \ + sdl2_mixer \ + sdl2_ttf \ + qt@6 \ + adwaita-icon-theme \ +" + +if test "$HEAD_PACKAGES" != "" ; then + if ! brew install --HEAD $HEAD_PACKAGES ; then + echo "Homebrew install of HEAD packages failed" >&2 + exit 1 + fi +fi + +if ! brew fetch $PACKAGES ; then + echo "Homebrew fetching packages failed." >&2 + exit 1 +fi + +if ! brew install $PACKAGES ; then + echo "Homebrew packages installation failed." >&2 + exit 1 +fi -- 2.35.1