[freeciv-dev] Re: Freeciv for macOS

  • From: Dean <ddeanbrown@xxxxxxxxxxx>
  • To: freeciv-dev@xxxxxxxxxxxxx
  • Date: Tue, 26 Apr 2022 22:02:21 -0400

Good news, I was able to do the patch and test the hbinstall.sh script.

Problem - the "Resources" and "MacOS" directories need to go inside the "Contents" directory. So replace lines 21-38 with

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)"


With this fix it seems to work as intended. Takes a long time to run. Have not yet tried to build freeciv with it. I did discover that the path to the script file cannot contain any space chars, which I think is a common Unix problem.


Possible small improvement, can you do something like -

CONTENTSDIR="${MAINDIR}/Contents"

and use ${CONTENTSDIR} ?


Annoying problem that you/CI won't have - homebrew keeps complaining my Xcode is outdated, but I can't update it unless I update my system to version 12, which I'll have to do eventually.

On 4/18/22 2:46 AM, Marko Lindqvist wrote:

  Well, you haven't tested it yet (nor has the review period passed),
so can't push it in the repo yet.

  You won't need git, as we now have the nightly tarballs :-)

  Also, you might have a hard time testing the master/S3_1 version
anyway. At least before I get
https://osdn.net/projects/freeciv/ticket/44412 implemented.

  So at this point you may test S3_0 version (can apply the patch to a
nightly tarball, or 3.0.1 release tarball. Either should work)

  Applying patches is discussed in
http://www.freeciv.org/wiki/How_to_Contribute#How_to_use_the_patch_command
  In short: "patch -u -p1 -d freeciv-3.0-src <
0026-macOS-Add-hbinstall.sh-script.patch", where freeciv-3.0-src is
the source directory extracted from the tarball.

  To  remove it, use '-R' (reverse):
  "patch -u -p1 -d freeciv-3.0-src -R < 
0026-macOS-Add-hbinstall.sh-script.patch"

Other related posts: