Add Linux support for GLFW extension and fix macOS C++ linking#1061
Add Linux support for GLFW extension and fix macOS C++ linking#1061hmennen90 wants to merge 2 commits intocrazywhalecc:mainfrom
Conversation
- Enable GLFW on Linux in ext.json (was "no", now "yes") - Add Linux-specific static libs to lib.json - Create Linux GLFW library builder (builds from vendor/glfw with X11) - Add -lc++ to macOS builds for ogt_vox_c_wrapper.cpp Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…eplacement The previous approach tried to patch the configure script string which was fragile and didn't work on all platforms. Now uses the proper builder option mechanism (same pattern as iconv extension). Uses -lc++ on macOS (Clang) and -lstdc++ on Linux (GCC/musl).
|
This is not suitable for a linux musl build. It has to be restricted to glibc or musl -dynamic (zig). Furthermore, instead of symlinking into buildroot, it should directly use the pkg configs of the operating system (user must set PKG_CONFIG_PATH=/usr/lib64/pkgconfig for e.g. RHEL 10). Because this is poorly supported on v2 I'm against merging this in its current form. It will be better in v3 where we will allow linking a selection of libraries as shared libs. |
|
I've implemented on v3 version, but v3 is still under development. You could try the latest dev branch that not merged one https://github.com/crazywhalecc/static-php-cli/tree/v3-refactor/new-extensions but there is no any guarantee it's stable. We also haven't implemented full features yet. We are currently generally fixing bugs and issues affecting short-term builds on the v2 branch only. |
What does this PR do?
Adds Linux support for the GLFW extension (php-glfw) and fixes macOS C++ linking.
Changes
config/ext.json— Set GLFW Linux support from"no"to"yes"config/lib.json— Addedstatic-libs-linuxandheadersentries for GLFWsrc/SPC/builder/linux/library/glfw.php— New Linux GLFW library builder (mirrors the existing macOS version). Builds GLFW from the vendored source in php-glfw with X11 backend (Wayland disabled).src/SPC/builder/extension/glfw.php— Added-lc++to macOS EXTRA_LIBS. The php-glfw extension includesogt_vox_c_wrapper.cppwhich requires the C++ standard library for linking.Notes
libx11-dev,libxrandr-dev,libxinerama-dev,libxcursor-dev,libxi-dev) installed on the host and symlinked intobuildroot/since the musltoolchain restricts header search to that directory.
Checklist before merging
*.phpor*.json, run them locally to ensure your changes are valid:composer cs-fixcomposer analysecomposer testbin/spc dev:sort-configsrc/globals/test-extensions.php.extension testortest extensionsto trigger full test suite.