From 2bc02bdaac5302f76716dd54a8da50d9e09ad137 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Fri, 18 Aug 2023 18:17:52 +0800 Subject: [PATCH] add glfw support for macOS --- config/ext.json | 8 ++++++++ config/source.json | 9 +++++++++ src/SPC/builder/extension/glfw.php | 24 ++++++++++++++++++++++++ src/SPC/builder/macos/library/glfw.php | 21 +++++++++++++++++++++ 4 files changed, 62 insertions(+) create mode 100644 src/SPC/builder/extension/glfw.php create mode 100644 src/SPC/builder/macos/library/glfw.php diff --git a/config/ext.json b/config/ext.json index 6e52f57c..df9da7fa 100644 --- a/config/ext.json +++ b/config/ext.json @@ -135,6 +135,14 @@ "imagemagick" ] }, + "glfw": { + "type": "external", + "arg-type": "custom", + "source": "ext-glfw", + "lib-depends": [ + "glfw" + ] + }, "imap": { "type": "builtin", "arg-type": "with", diff --git a/config/source.json b/config/source.json index b550587c..b4ba3e74 100644 --- a/config/source.json +++ b/config/source.json @@ -6,6 +6,15 @@ "path": "LICENSE" } }, + "ext-glfw": { + "type": "git", + "url": "https://github.com/mario-deluna/php-glfw", + "rev": "master", + "license": { + "type": "file", + "path": "LICENSE" + } + }, "apcu": { "type": "url", "url": "https://pecl.php.net/get/APCu", diff --git a/src/SPC/builder/extension/glfw.php b/src/SPC/builder/extension/glfw.php new file mode 100644 index 00000000..7a52bb7c --- /dev/null +++ b/src/SPC/builder/extension/glfw.php @@ -0,0 +1,24 @@ +cd(SOURCE_PATH . '/ext-glfw/vendor/glfw') + ->exec("{$this->builder->configure_env} cmake . {$this->builder->makeCmakeArgs()} -DBUILD_SHARED_LIBS=OFF -DGLFW_BUILD_EXAMPLES=OFF -DGLFW_BUILD_TESTS=OFF") + ->exec("make -j{$this->builder->concurrency}") + ->exec('make install DESTDIR=' . BUILD_ROOT_PATH); + // patch pkgconf + $this->patchPkgconfPrefix(['glfw3.pc']); + } +}