Opened 3 years ago

Last modified 2 years ago

#63033 closed enhancement

Notes on Godot 3.3.2 and legacy OS's. — at Initial Version

Reported by: Wowfunhappy (Jonathan) Owned by:
Priority: Low Milestone:
Component: ports Version: 2.7.1
Keywords: Cc:
Port: godot macports-libcxx

Description

As of this writing, MacPorts's Godot port is still on version 3.2.3. The latest upstream version, 3.3.2, has officially dropped support for OS's older than 10.12, but it can still work at least as far back as 10.9 with some tweaks, and with the help of macports-libcxx.

I wanted to document what I'd discovered for future users.


1.

In the Portfile, the line:

reinplace s|${sconstruct_default_mp_clang}\.0|${selected_clang_v}|g \
    ${worksrcpath}/SConstruct

needs to be replaced with

reinplace s|${sconstruct_default_mp_clang}\.0|${selected_clang_v}|g \
    ${worksrcpath}/platform/osx/detect.py

Because SConstruct was factored out into separate, per-platform files.


2.

For a reason I wasn't able to track down, the lines:

#if MAC_OS_X_VERSION_MAX_ALLOWED < 101200
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101200

in platform/osx/os_osx.mm no longer have the desired effect; the compiler is convinced MAX_ALLOWED is always above 101200. I had to manually comment out the relevant blocks of code.

There is probably a better way to fix this.


3.

As mentioned above, Godot needs to be compiled against MacPorts-libcxx. I tried various ways of setting this nicely via flags and environment variables in the Portfile, but the only thing that seemed to work was editing /platform/osx/detect.py. Below line 108, which reads env.Append(LINKFLAGS=["-isysroot", "$MACOS_SDK_PATH"]), I added:

env.Append(CCXFLAGS=["-nostdinc++", "-I/opt/local/include/libcxx/v1"])
env.Append(LINKFLAGS=["-L/opt/local/lib/libcxx"])

4.

After the port has been installed, edit Godot's info.plist to change LSMinimumSystemVersion from 10.12 to whatever OS you're running.


Addenda

Addendum A.

I set the compiler to Clang 11 for possibly-better compatibility with macports-libcxx. I do not know if this was actually necessary. In the Portfile:

set clang_versions {5.0 6.0 7.0 8.0 9.0 11}

Addendum B.

To make Godot itself produce binaries (games) that are compatible with 10.11 and below, you need to also recompile the export templates. If I'm reading the documentation correctly, this should just mean building with build.env-append tools=no, and then integrating the new libcxx library into the app bundle with something like:

sudo port install dylibbundler
dylibbundler -p '@executable_path/../Frameworks' -d ../Frameworks -b -x Godot

This is compiling as I write this, so not tested just yet!


Because of the level of non-optimal hackery involved (esp point 2), I don't personally intend to submit a pull request for any of this; these are just notes! 🙂 Let me know if there's a better place than trac for such things in the future.

Change History (0)

Note: See TracTickets for help on using tickets.