From 2ea3172f527e3e902ef265a628fdf749b216479c Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 17 Apr 2022 05:15:47 +0300 Subject: [PATCH 26/26] 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 | 84 +++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100755 macOS/homebrew/hbinstall.sh diff --git a/Makefile.am b/Makefile.am index 56fd7f17f3..8ea3152728 100644 --- a/Makefile.am +++ b/Makefile.am @@ -25,6 +25,7 @@ SUBDIRS = gen_headers $(DSUBDIRS) dependencies utility common tests windows $(SS EXTRA_DIST = autogen.sh \ configure.ac \ + macOS/homebrew/hbinstall.sh \ m4/c99.m4 \ m4/c11.m4 \ m4/c++11.m4 \ diff --git a/macOS/homebrew/hbinstall.sh b/macOS/homebrew/hbinstall.sh new file mode 100755 index 0000000000..940baf1d0a --- /dev/null +++ b/macOS/homebrew/hbinstall.sh @@ -0,0 +1,84 @@ +#!/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}/Resources" ; then + echo "Failed to create \"${MAINDIR}/Resources\"" >&2 + exit 1 +fi + +if ! mkdir -p "${MAINDIR}/MacOS" ; then + echo "Failed to create \"${MAINDIR}/MacOS\"" >&2 + exit 1 +fi + +if ! curl -L "https://github.com/Homebrew/brew/tarball/${HBVER}" | + tar xz --strip 1 -C "${MAINDIR}/Resources" +then + echo "Homebrew install failed" >&2 + exit 1 +fi + +eval "$("${MAINDIR}/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.3 \ + autoconf \ + automake \ + gettext \ + libtool \ + pkg-config \ + atk \ + freetype \ + gettext \ + glib \ + gtk+3 \ + icu4c \ + pango \ + sdl2_gfx \ + sdl2_image \ + sdl2_mixer \ + sdl2_ttf \ + qt@5 \ +" + +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