[MacPorts] #63033: Notes on Godot 3.3.2 and legacy OS's.
MacPorts
noreply at macports.org
Sun Jun 6 14:43:10 UTC 2021
#63033: Notes on Godot 3.3.2 and legacy OS's.
------------------------------------+--------------------
Reporter: Wowfunhappy | Owner: (none)
Type: enhancement | Status: new
Priority: Low | Milestone:
Component: ports | Version: 2.7.1
Resolution: | Keywords:
Port: godot macports-libcxx |
------------------------------------+--------------------
Description changed by Wowfunhappy:
Old 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.
New 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.
Reinstall Godot twice, with one of the below lines added to your portfile
for the debug and release templates, respectively:
{{{
build.env-append tools=no
build.env-append tools=no target=release
}}}
After each build, make sure the binary is linked to macports-libcxx via a
relative path, such as via:
{{{
sudo port install dylibbundler
dylibbundler -p '@executable_path/../Frameworks' -d ../Frameworks -b -x
Godot
}}}
Then replace the debug and release binaries in the OSX template with your
versions, and copy over the Frameworks folder with the macports-libcxx
libraries. Don't forget to change the minimum OS in info.plist!
----------
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.
--
--
Ticket URL: <https://trac.macports.org/ticket/63033#comment:2>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list