From 9599acdc675a29c689f17107c08ed6081002b434 Mon Sep 17 00:00:00 2001 From: jmjoy Date: Mon, 5 Sep 2022 23:45:23 +0800 Subject: [PATCH 01/15] Improve CI, with macos support. --- .github/workflows/ci.yml | 6 ++++-- .github/workflows/license.yml | 2 +- .github/workflows/publish.yml | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 714c9d2f..cfa9fc5a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,8 @@ jobs: fail-fast: false matrix: os: - - ubuntu-latest + - ubuntu-20.04 + - macos-11 php-version: - "7.0" - "7.1" @@ -56,6 +57,7 @@ jobs: tools: php-config - name: Setup php-fpm + if: matrix.os == 'ubuntu-20.04' run: | sudo apt-get install -y php${{ matrix.php-version }}-fpm sudo rm -f /usr/sbin/php-fpm @@ -124,7 +126,7 @@ jobs: fail-fast: false matrix: os: - - ubuntu-latest + - ubuntu-20.04 php-version: - "7.4" features: diff --git a/.github/workflows/license.yml b/.github/workflows/license.yml index c1db07d0..8676d60f 100644 --- a/.github/workflows/license.yml +++ b/.github/workflows/license.yml @@ -20,7 +20,7 @@ on: jobs: license-check: name: License check - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: Checkout uses: actions/checkout@v2 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 241a64a6..0eaa542c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -26,7 +26,7 @@ jobs: publish: name: Publish - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - name: Checkout uses: actions/checkout@v2 From 6f5f6308e247563c851a0e00c944d17b4acff050 Mon Sep 17 00:00:00 2001 From: jmjoy Date: Mon, 5 Sep 2022 23:47:37 +0800 Subject: [PATCH 02/15] Fix CI. --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cfa9fc5a..e8e91fa3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,6 +48,7 @@ jobs: uses: actions/checkout@v2 - name: Install libclang + if: matrix.os == 'ubuntu-20.04' run: sudo apt-get install -y llvm-10-dev libclang-10-dev - name: Setup PHP From caedf42433d6c221b33d0dc93011f2d58e62ed91 Mon Sep 17 00:00:00 2001 From: jmjoy Date: Mon, 5 Sep 2022 23:58:50 +0800 Subject: [PATCH 03/15] Fix build.rs. --- phper-sys/build.rs | 1 + phper-sys/php_wrapper.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/phper-sys/build.rs b/phper-sys/build.rs index eaea8223..8f5e9fe8 100644 --- a/phper-sys/build.rs +++ b/phper-sys/build.rs @@ -189,6 +189,7 @@ fn main() { .blocklist_function("__hypotl") .blocklist_function("__ilogbf64x") .blocklist_function("__ilogbl") + .blocklist_function("__infl") .blocklist_function("__iscanonicall") .blocklist_function("__iseqsigl") .blocklist_function("__iseqsigl") diff --git a/phper-sys/php_wrapper.c b/phper-sys/php_wrapper.c index 81b3fce6..0ba5c911 100644 --- a/phper-sys/php_wrapper.c +++ b/phper-sys/php_wrapper.c @@ -183,7 +183,6 @@ bool phper_object_init_ex(zval *arg, zend_class_entry *class_type) { } bool phper_call_user_function(HashTable *function_table, zval *object, zval *function_name, zval *retval_ptr, uint32_t param_count, zval params[]) { - function_table = function_table; return call_user_function(function_table, object, function_name, retval_ptr, param_count, params) == SUCCESS; } From d3250c7fb214e59e57d1dfbe81baeefd67ea4dd6 Mon Sep 17 00:00:00 2001 From: jmjoy Date: Tue, 6 Sep 2022 00:21:06 +0800 Subject: [PATCH 04/15] Fix macos failed. --- phper-sys/php_wrapper.c | 1 + tests/integration/build.rs | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 tests/integration/build.rs diff --git a/phper-sys/php_wrapper.c b/phper-sys/php_wrapper.c index 0ba5c911..1a1b0042 100644 --- a/phper-sys/php_wrapper.c +++ b/phper-sys/php_wrapper.c @@ -183,6 +183,7 @@ bool phper_object_init_ex(zval *arg, zend_class_entry *class_type) { } bool phper_call_user_function(HashTable *function_table, zval *object, zval *function_name, zval *retval_ptr, uint32_t param_count, zval params[]) { + (void)function_table; // suppress "unused parameter" warnings. return call_user_function(function_table, object, function_name, retval_ptr, param_count, params) == SUCCESS; } diff --git a/tests/integration/build.rs b/tests/integration/build.rs new file mode 100644 index 00000000..ce7f3394 --- /dev/null +++ b/tests/integration/build.rs @@ -0,0 +1,17 @@ +// Copyright (c) 2022 PHPER Framework Team +// PHPER is licensed under Mulan PSL v2. +// You can use this software according to the terms and conditions of the Mulan +// PSL v2. You may obtain a copy of Mulan PSL v2 at: +// http://license.coscl.org.cn/MulanPSL2 +// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +// See the Mulan PSL v2 for more details. + +fn main() { + #[cfg(target_os = "macos")] + { + println!("cargo:rustc-cdylib-link-arg=-undefined"); + println!("cargo:rustc-cdylib-link-arg=dynamic_lookup"); + } +} From 5265f6a52fe1f62cce7801afe8f3177e6d0861a4 Mon Sep 17 00:00:00 2001 From: jmjoy Date: Tue, 6 Sep 2022 09:07:41 +0800 Subject: [PATCH 05/15] Macsos link args. --- phper/build.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/phper/build.rs b/phper/build.rs index 78e1c7a6..bf4b4177 100644 --- a/phper/build.rs +++ b/phper/build.rs @@ -17,6 +17,8 @@ fn main() { { println!("cargo:rustc-cdylib-link-arg=-undefined"); println!("cargo:rustc-cdylib-link-arg=dynamic_lookup"); + println!("cargo:rustc-link-arg=-undefined"); + println!("cargo:rustc-link-arg=dynamic_lookup"); } assert_eq!( From 0163128d55855e9535312c7d6ed77afbf305af74 Mon Sep 17 00:00:00 2001 From: jmjoy Date: Tue, 6 Sep 2022 09:19:53 +0800 Subject: [PATCH 06/15] Fix again. --- tests/integration/build.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/integration/build.rs b/tests/integration/build.rs index ce7f3394..1c9cea9c 100644 --- a/tests/integration/build.rs +++ b/tests/integration/build.rs @@ -13,5 +13,7 @@ fn main() { { println!("cargo:rustc-cdylib-link-arg=-undefined"); println!("cargo:rustc-cdylib-link-arg=dynamic_lookup"); + println!("cargo:rustc-link-arg=-undefined"); + println!("cargo:rustc-link-arg=dynamic_lookup"); } } From 5b240da3eeab84a9b80ae085011a7f20e1e702d8 Mon Sep 17 00:00:00 2001 From: jmjoy Date: Tue, 6 Sep 2022 10:02:29 +0800 Subject: [PATCH 07/15] Update CI. --- .github/workflows/ci.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e8e91fa3..4a0de1b5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,8 +66,8 @@ jobs: - name: PHP version run: | - php-config || true - /usr/sbin/php-fpm --version + php-config${{ matrix.php-version }} || true + php-fpm${{ matrix.php-version }} --version - name: Install Rust Nightly uses: actions-rs/toolchain@v1 @@ -99,6 +99,8 @@ jobs: - name: Cargo clippy uses: actions-rs/cargo@v1 + env: + PHP_CONFIG: php-config${{ matrix.php-version }} with: toolchain: stable command: clippy @@ -106,6 +108,8 @@ jobs: - name: Cargo test uses: actions-rs/cargo@v1 + env: + PHP_CONFIG: php-config${{ matrix.php-version }} with: toolchain: stable command: test @@ -115,6 +119,7 @@ jobs: uses: actions-rs/cargo@v1 env: RUSTDOCFLAGS: "-D warnings --cfg docsrs" + PHP_CONFIG: php-config${{ matrix.php-version }} with: toolchain: nightly command: doc From dc2748e84849305d4e1808b4a78ef145d47fdb60 Mon Sep 17 00:00:00 2001 From: jmjoy Date: Tue, 6 Sep 2022 10:38:35 +0800 Subject: [PATCH 08/15] Fix CI. --- .github/workflows/ci.yml | 17 ++++++----------- phper-sys/build.rs | 8 ++++++++ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4a0de1b5..05bf370d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,8 +66,8 @@ jobs: - name: PHP version run: | - php-config${{ matrix.php-version }} || true - php-fpm${{ matrix.php-version }} --version + php-config || true + php-fpm --version - name: Install Rust Nightly uses: actions-rs/toolchain@v1 @@ -90,26 +90,22 @@ jobs: command: fmt args: --all -- --check - - name: Cargo build + - name: Cargo clippy uses: actions-rs/cargo@v1 with: toolchain: stable - command: build + command: clippy args: --release - - name: Cargo clippy + - name: Cargo build uses: actions-rs/cargo@v1 - env: - PHP_CONFIG: php-config${{ matrix.php-version }} with: toolchain: stable - command: clippy + command: build args: --release - name: Cargo test uses: actions-rs/cargo@v1 - env: - PHP_CONFIG: php-config${{ matrix.php-version }} with: toolchain: stable command: test @@ -119,7 +115,6 @@ jobs: uses: actions-rs/cargo@v1 env: RUSTDOCFLAGS: "-D warnings --cfg docsrs" - PHP_CONFIG: php-config${{ matrix.php-version }} with: toolchain: nightly command: doc diff --git a/phper-sys/build.rs b/phper-sys/build.rs index 8f5e9fe8..2228ade8 100644 --- a/phper-sys/build.rs +++ b/phper-sys/build.rs @@ -15,6 +15,14 @@ fn main() { println!("cargo:rerun-if-changed=php_wrapper.c"); println!("cargo:rerun-if-env-changed=PHP_CONFIG"); + #[cfg(target_os = "macos")] + { + println!("cargo:rustc-cdylib-link-arg=-undefined"); + println!("cargo:rustc-cdylib-link-arg=dynamic_lookup"); + println!("cargo:rustc-link-arg=-undefined"); + println!("cargo:rustc-link-arg=dynamic_lookup"); + } + let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); let php_config = env::var("PHP_CONFIG").unwrap_or_else(|_| "php-config".to_string()); From b13c9b8b6614d4df7ae50a1001a030aa1c595661 Mon Sep 17 00:00:00 2001 From: jmjoy Date: Tue, 6 Sep 2022 11:56:00 +0800 Subject: [PATCH 09/15] Setup php-fpm. --- .github/workflows/ci.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 05bf370d..e17eae83 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,13 +57,18 @@ jobs: php-version: ${{ matrix.php-version }} tools: php-config - - name: Setup php-fpm + - name: Setup php-fpm for Linux if: matrix.os == 'ubuntu-20.04' run: | sudo apt-get install -y php${{ matrix.php-version }}-fpm sudo rm -f /usr/sbin/php-fpm sudo ln -s /usr/sbin/php-fpm${{ matrix.php-version }} /usr/sbin/php-fpm + - name: Setup php-fpm for Macos + if: matrix.os == 'macos-11' + run: | + brew install php@${{ matrix.php-version }} + - name: PHP version run: | php-config || true From 53d15d16ada0a0f449d259e973021023c5ec4ca1 Mon Sep 17 00:00:00 2001 From: jmjoy Date: Tue, 6 Sep 2022 12:51:30 +0800 Subject: [PATCH 10/15] Add link flags. --- examples/hello/build.rs | 3 +++ examples/http-client/build.rs | 16 ++++++++++++++++ examples/http-server/build.rs | 16 ++++++++++++++++ examples/logging/build.rs | 16 ++++++++++++++++ phper-sys/build.rs | 7 +------ 5 files changed, 52 insertions(+), 6 deletions(-) create mode 100644 examples/http-client/build.rs create mode 100644 examples/http-server/build.rs create mode 100644 examples/logging/build.rs diff --git a/examples/hello/build.rs b/examples/hello/build.rs index 190ba756..0e799649 100644 --- a/examples/hello/build.rs +++ b/examples/hello/build.rs @@ -10,4 +10,7 @@ fn main() { phper_build::register_configures(); + + #[cfg(target_os = "macos")] + println!("cargo:rustc-link-arg=-undefined dynamic_lookup"); } diff --git a/examples/http-client/build.rs b/examples/http-client/build.rs new file mode 100644 index 00000000..0e799649 --- /dev/null +++ b/examples/http-client/build.rs @@ -0,0 +1,16 @@ +// Copyright (c) 2022 PHPER Framework Team +// PHPER is licensed under Mulan PSL v2. +// You can use this software according to the terms and conditions of the Mulan +// PSL v2. You may obtain a copy of Mulan PSL v2 at: +// http://license.coscl.org.cn/MulanPSL2 +// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +// See the Mulan PSL v2 for more details. + +fn main() { + phper_build::register_configures(); + + #[cfg(target_os = "macos")] + println!("cargo:rustc-link-arg=-undefined dynamic_lookup"); +} diff --git a/examples/http-server/build.rs b/examples/http-server/build.rs new file mode 100644 index 00000000..0e799649 --- /dev/null +++ b/examples/http-server/build.rs @@ -0,0 +1,16 @@ +// Copyright (c) 2022 PHPER Framework Team +// PHPER is licensed under Mulan PSL v2. +// You can use this software according to the terms and conditions of the Mulan +// PSL v2. You may obtain a copy of Mulan PSL v2 at: +// http://license.coscl.org.cn/MulanPSL2 +// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +// See the Mulan PSL v2 for more details. + +fn main() { + phper_build::register_configures(); + + #[cfg(target_os = "macos")] + println!("cargo:rustc-link-arg=-undefined dynamic_lookup"); +} diff --git a/examples/logging/build.rs b/examples/logging/build.rs new file mode 100644 index 00000000..0e799649 --- /dev/null +++ b/examples/logging/build.rs @@ -0,0 +1,16 @@ +// Copyright (c) 2022 PHPER Framework Team +// PHPER is licensed under Mulan PSL v2. +// You can use this software according to the terms and conditions of the Mulan +// PSL v2. You may obtain a copy of Mulan PSL v2 at: +// http://license.coscl.org.cn/MulanPSL2 +// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +// See the Mulan PSL v2 for more details. + +fn main() { + phper_build::register_configures(); + + #[cfg(target_os = "macos")] + println!("cargo:rustc-link-arg=-undefined dynamic_lookup"); +} diff --git a/phper-sys/build.rs b/phper-sys/build.rs index 2228ade8..4bb6b8a0 100644 --- a/phper-sys/build.rs +++ b/phper-sys/build.rs @@ -16,12 +16,7 @@ fn main() { println!("cargo:rerun-if-env-changed=PHP_CONFIG"); #[cfg(target_os = "macos")] - { - println!("cargo:rustc-cdylib-link-arg=-undefined"); - println!("cargo:rustc-cdylib-link-arg=dynamic_lookup"); - println!("cargo:rustc-link-arg=-undefined"); - println!("cargo:rustc-link-arg=dynamic_lookup"); - } + println!("cargo:rustc-link-arg=-undefined dynamic_lookup"); let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); let php_config = env::var("PHP_CONFIG").unwrap_or_else(|_| "php-config".to_string()); From da903af29ced185e060268ddd2fac6f248537e48 Mon Sep 17 00:00:00 2001 From: jmjoy Date: Tue, 6 Sep 2022 13:30:28 +0800 Subject: [PATCH 11/15] Fix. --- examples/http-client/build.rs | 2 -- examples/http-server/build.rs | 2 -- examples/logging/build.rs | 2 -- 3 files changed, 6 deletions(-) diff --git a/examples/http-client/build.rs b/examples/http-client/build.rs index 0e799649..92ddc9d2 100644 --- a/examples/http-client/build.rs +++ b/examples/http-client/build.rs @@ -9,8 +9,6 @@ // See the Mulan PSL v2 for more details. fn main() { - phper_build::register_configures(); - #[cfg(target_os = "macos")] println!("cargo:rustc-link-arg=-undefined dynamic_lookup"); } diff --git a/examples/http-server/build.rs b/examples/http-server/build.rs index 0e799649..92ddc9d2 100644 --- a/examples/http-server/build.rs +++ b/examples/http-server/build.rs @@ -9,8 +9,6 @@ // See the Mulan PSL v2 for more details. fn main() { - phper_build::register_configures(); - #[cfg(target_os = "macos")] println!("cargo:rustc-link-arg=-undefined dynamic_lookup"); } diff --git a/examples/logging/build.rs b/examples/logging/build.rs index 0e799649..92ddc9d2 100644 --- a/examples/logging/build.rs +++ b/examples/logging/build.rs @@ -9,8 +9,6 @@ // See the Mulan PSL v2 for more details. fn main() { - phper_build::register_configures(); - #[cfg(target_os = "macos")] println!("cargo:rustc-link-arg=-undefined dynamic_lookup"); } From 728a4b5ca893cf7d3bdfd364a510852650d2ccf7 Mon Sep 17 00:00:00 2001 From: jmjoy Date: Tue, 6 Sep 2022 13:48:45 +0800 Subject: [PATCH 12/15] Macsos link args. --- examples/hello/build.rs | 3 --- examples/http-client/build.rs | 14 -------------- examples/http-server/build.rs | 14 -------------- examples/logging/build.rs | 14 -------------- phper-sys/build.rs | 5 ++++- phper/build.rs | 8 -------- tests/integration/build.rs | 19 ------------------- 7 files changed, 4 insertions(+), 73 deletions(-) delete mode 100644 examples/http-client/build.rs delete mode 100644 examples/http-server/build.rs delete mode 100644 examples/logging/build.rs delete mode 100644 tests/integration/build.rs diff --git a/examples/hello/build.rs b/examples/hello/build.rs index 0e799649..190ba756 100644 --- a/examples/hello/build.rs +++ b/examples/hello/build.rs @@ -10,7 +10,4 @@ fn main() { phper_build::register_configures(); - - #[cfg(target_os = "macos")] - println!("cargo:rustc-link-arg=-undefined dynamic_lookup"); } diff --git a/examples/http-client/build.rs b/examples/http-client/build.rs deleted file mode 100644 index 92ddc9d2..00000000 --- a/examples/http-client/build.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) 2022 PHPER Framework Team -// PHPER is licensed under Mulan PSL v2. -// You can use this software according to the terms and conditions of the Mulan -// PSL v2. You may obtain a copy of Mulan PSL v2 at: -// http://license.coscl.org.cn/MulanPSL2 -// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY -// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -// See the Mulan PSL v2 for more details. - -fn main() { - #[cfg(target_os = "macos")] - println!("cargo:rustc-link-arg=-undefined dynamic_lookup"); -} diff --git a/examples/http-server/build.rs b/examples/http-server/build.rs deleted file mode 100644 index 92ddc9d2..00000000 --- a/examples/http-server/build.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) 2022 PHPER Framework Team -// PHPER is licensed under Mulan PSL v2. -// You can use this software according to the terms and conditions of the Mulan -// PSL v2. You may obtain a copy of Mulan PSL v2 at: -// http://license.coscl.org.cn/MulanPSL2 -// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY -// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -// See the Mulan PSL v2 for more details. - -fn main() { - #[cfg(target_os = "macos")] - println!("cargo:rustc-link-arg=-undefined dynamic_lookup"); -} diff --git a/examples/logging/build.rs b/examples/logging/build.rs deleted file mode 100644 index 92ddc9d2..00000000 --- a/examples/logging/build.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) 2022 PHPER Framework Team -// PHPER is licensed under Mulan PSL v2. -// You can use this software according to the terms and conditions of the Mulan -// PSL v2. You may obtain a copy of Mulan PSL v2 at: -// http://license.coscl.org.cn/MulanPSL2 -// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY -// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -// See the Mulan PSL v2 for more details. - -fn main() { - #[cfg(target_os = "macos")] - println!("cargo:rustc-link-arg=-undefined dynamic_lookup"); -} diff --git a/phper-sys/build.rs b/phper-sys/build.rs index 4bb6b8a0..6ad6211a 100644 --- a/phper-sys/build.rs +++ b/phper-sys/build.rs @@ -16,7 +16,10 @@ fn main() { println!("cargo:rerun-if-env-changed=PHP_CONFIG"); #[cfg(target_os = "macos")] - println!("cargo:rustc-link-arg=-undefined dynamic_lookup"); + { + println!("cargo:rustc-link-arg=-undefined"); + println!("cargo:rustc-link-arg=dynamic_lookup"); + } let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); let php_config = env::var("PHP_CONFIG").unwrap_or_else(|_| "php-config".to_string()); diff --git a/phper/build.rs b/phper/build.rs index bf4b4177..ff0e6224 100644 --- a/phper/build.rs +++ b/phper/build.rs @@ -13,14 +13,6 @@ use phper_sys::*; fn main() { phper_build::register_configures(); - #[cfg(target_os = "macos")] - { - println!("cargo:rustc-cdylib-link-arg=-undefined"); - println!("cargo:rustc-cdylib-link-arg=dynamic_lookup"); - println!("cargo:rustc-link-arg=-undefined"); - println!("cargo:rustc-link-arg=dynamic_lookup"); - } - assert_eq!( USING_ZTS, 0, "PHPER not support ZTS mode now (php built with `--enable-maintainer-zts` or \ diff --git a/tests/integration/build.rs b/tests/integration/build.rs deleted file mode 100644 index 1c9cea9c..00000000 --- a/tests/integration/build.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2022 PHPER Framework Team -// PHPER is licensed under Mulan PSL v2. -// You can use this software according to the terms and conditions of the Mulan -// PSL v2. You may obtain a copy of Mulan PSL v2 at: -// http://license.coscl.org.cn/MulanPSL2 -// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY -// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO -// NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. -// See the Mulan PSL v2 for more details. - -fn main() { - #[cfg(target_os = "macos")] - { - println!("cargo:rustc-cdylib-link-arg=-undefined"); - println!("cargo:rustc-cdylib-link-arg=dynamic_lookup"); - println!("cargo:rustc-link-arg=-undefined"); - println!("cargo:rustc-link-arg=dynamic_lookup"); - } -} From ccff8cedfd2fc9e362821c3f4a02b030f2e3a1ec Mon Sep 17 00:00:00 2001 From: jmjoy Date: Tue, 6 Sep 2022 18:13:42 +0800 Subject: [PATCH 13/15] Try again. --- examples/hello/build.rs | 6 ++++++ examples/http-client/build.rs | 17 +++++++++++++++++ examples/http-server/build.rs | 17 +++++++++++++++++ examples/logging/build.rs | 17 +++++++++++++++++ phper-sys/build.rs | 6 ------ phper/build.rs | 6 ++++++ tests/integration/build.rs | 17 +++++++++++++++++ 7 files changed, 80 insertions(+), 6 deletions(-) create mode 100644 examples/http-client/build.rs create mode 100644 examples/http-server/build.rs create mode 100644 examples/logging/build.rs create mode 100644 tests/integration/build.rs diff --git a/examples/hello/build.rs b/examples/hello/build.rs index 190ba756..7c54d289 100644 --- a/examples/hello/build.rs +++ b/examples/hello/build.rs @@ -10,4 +10,10 @@ fn main() { phper_build::register_configures(); + + #[cfg(target_os = "macos")] + { + println!("cargo:rustc-cdylib-link-arg=-undefined"); + println!("cargo:rustc-cdylib-link-arg=dynamic_lookup"); + } } diff --git a/examples/http-client/build.rs b/examples/http-client/build.rs new file mode 100644 index 00000000..ce7f3394 --- /dev/null +++ b/examples/http-client/build.rs @@ -0,0 +1,17 @@ +// Copyright (c) 2022 PHPER Framework Team +// PHPER is licensed under Mulan PSL v2. +// You can use this software according to the terms and conditions of the Mulan +// PSL v2. You may obtain a copy of Mulan PSL v2 at: +// http://license.coscl.org.cn/MulanPSL2 +// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +// See the Mulan PSL v2 for more details. + +fn main() { + #[cfg(target_os = "macos")] + { + println!("cargo:rustc-cdylib-link-arg=-undefined"); + println!("cargo:rustc-cdylib-link-arg=dynamic_lookup"); + } +} diff --git a/examples/http-server/build.rs b/examples/http-server/build.rs new file mode 100644 index 00000000..ce7f3394 --- /dev/null +++ b/examples/http-server/build.rs @@ -0,0 +1,17 @@ +// Copyright (c) 2022 PHPER Framework Team +// PHPER is licensed under Mulan PSL v2. +// You can use this software according to the terms and conditions of the Mulan +// PSL v2. You may obtain a copy of Mulan PSL v2 at: +// http://license.coscl.org.cn/MulanPSL2 +// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +// See the Mulan PSL v2 for more details. + +fn main() { + #[cfg(target_os = "macos")] + { + println!("cargo:rustc-cdylib-link-arg=-undefined"); + println!("cargo:rustc-cdylib-link-arg=dynamic_lookup"); + } +} diff --git a/examples/logging/build.rs b/examples/logging/build.rs new file mode 100644 index 00000000..ce7f3394 --- /dev/null +++ b/examples/logging/build.rs @@ -0,0 +1,17 @@ +// Copyright (c) 2022 PHPER Framework Team +// PHPER is licensed under Mulan PSL v2. +// You can use this software according to the terms and conditions of the Mulan +// PSL v2. You may obtain a copy of Mulan PSL v2 at: +// http://license.coscl.org.cn/MulanPSL2 +// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +// See the Mulan PSL v2 for more details. + +fn main() { + #[cfg(target_os = "macos")] + { + println!("cargo:rustc-cdylib-link-arg=-undefined"); + println!("cargo:rustc-cdylib-link-arg=dynamic_lookup"); + } +} diff --git a/phper-sys/build.rs b/phper-sys/build.rs index 6ad6211a..8f5e9fe8 100644 --- a/phper-sys/build.rs +++ b/phper-sys/build.rs @@ -15,12 +15,6 @@ fn main() { println!("cargo:rerun-if-changed=php_wrapper.c"); println!("cargo:rerun-if-env-changed=PHP_CONFIG"); - #[cfg(target_os = "macos")] - { - println!("cargo:rustc-link-arg=-undefined"); - println!("cargo:rustc-link-arg=dynamic_lookup"); - } - let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); let php_config = env::var("PHP_CONFIG").unwrap_or_else(|_| "php-config".to_string()); diff --git a/phper/build.rs b/phper/build.rs index ff0e6224..78e1c7a6 100644 --- a/phper/build.rs +++ b/phper/build.rs @@ -13,6 +13,12 @@ use phper_sys::*; fn main() { phper_build::register_configures(); + #[cfg(target_os = "macos")] + { + println!("cargo:rustc-cdylib-link-arg=-undefined"); + println!("cargo:rustc-cdylib-link-arg=dynamic_lookup"); + } + assert_eq!( USING_ZTS, 0, "PHPER not support ZTS mode now (php built with `--enable-maintainer-zts` or \ diff --git a/tests/integration/build.rs b/tests/integration/build.rs new file mode 100644 index 00000000..ce7f3394 --- /dev/null +++ b/tests/integration/build.rs @@ -0,0 +1,17 @@ +// Copyright (c) 2022 PHPER Framework Team +// PHPER is licensed under Mulan PSL v2. +// You can use this software according to the terms and conditions of the Mulan +// PSL v2. You may obtain a copy of Mulan PSL v2 at: +// http://license.coscl.org.cn/MulanPSL2 +// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY +// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO +// NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +// See the Mulan PSL v2 for more details. + +fn main() { + #[cfg(target_os = "macos")] + { + println!("cargo:rustc-cdylib-link-arg=-undefined"); + println!("cargo:rustc-cdylib-link-arg=dynamic_lookup"); + } +} From 821b7a1132f345ac8fc7a10f8f8b0735d8bde0a0 Mon Sep 17 00:00:00 2001 From: jmjoy Date: Tue, 6 Sep 2022 18:31:56 +0800 Subject: [PATCH 14/15] dynamic_lookup --- examples/hello/build.rs | 2 ++ examples/http-client/build.rs | 2 ++ examples/http-server/build.rs | 2 ++ examples/logging/build.rs | 2 ++ phper/build.rs | 2 ++ tests/integration/build.rs | 2 ++ 6 files changed, 12 insertions(+) diff --git a/examples/hello/build.rs b/examples/hello/build.rs index 7c54d289..f42bb89f 100644 --- a/examples/hello/build.rs +++ b/examples/hello/build.rs @@ -15,5 +15,7 @@ fn main() { { println!("cargo:rustc-cdylib-link-arg=-undefined"); println!("cargo:rustc-cdylib-link-arg=dynamic_lookup"); + println!("cargo:rustc-link-arg=-undefined"); + println!("cargo:rustc-link-arg=dynamic_lookup"); } } diff --git a/examples/http-client/build.rs b/examples/http-client/build.rs index ce7f3394..1c9cea9c 100644 --- a/examples/http-client/build.rs +++ b/examples/http-client/build.rs @@ -13,5 +13,7 @@ fn main() { { println!("cargo:rustc-cdylib-link-arg=-undefined"); println!("cargo:rustc-cdylib-link-arg=dynamic_lookup"); + println!("cargo:rustc-link-arg=-undefined"); + println!("cargo:rustc-link-arg=dynamic_lookup"); } } diff --git a/examples/http-server/build.rs b/examples/http-server/build.rs index ce7f3394..1c9cea9c 100644 --- a/examples/http-server/build.rs +++ b/examples/http-server/build.rs @@ -13,5 +13,7 @@ fn main() { { println!("cargo:rustc-cdylib-link-arg=-undefined"); println!("cargo:rustc-cdylib-link-arg=dynamic_lookup"); + println!("cargo:rustc-link-arg=-undefined"); + println!("cargo:rustc-link-arg=dynamic_lookup"); } } diff --git a/examples/logging/build.rs b/examples/logging/build.rs index ce7f3394..1c9cea9c 100644 --- a/examples/logging/build.rs +++ b/examples/logging/build.rs @@ -13,5 +13,7 @@ fn main() { { println!("cargo:rustc-cdylib-link-arg=-undefined"); println!("cargo:rustc-cdylib-link-arg=dynamic_lookup"); + println!("cargo:rustc-link-arg=-undefined"); + println!("cargo:rustc-link-arg=dynamic_lookup"); } } diff --git a/phper/build.rs b/phper/build.rs index 78e1c7a6..bf4b4177 100644 --- a/phper/build.rs +++ b/phper/build.rs @@ -17,6 +17,8 @@ fn main() { { println!("cargo:rustc-cdylib-link-arg=-undefined"); println!("cargo:rustc-cdylib-link-arg=dynamic_lookup"); + println!("cargo:rustc-link-arg=-undefined"); + println!("cargo:rustc-link-arg=dynamic_lookup"); } assert_eq!( diff --git a/tests/integration/build.rs b/tests/integration/build.rs index ce7f3394..1c9cea9c 100644 --- a/tests/integration/build.rs +++ b/tests/integration/build.rs @@ -13,5 +13,7 @@ fn main() { { println!("cargo:rustc-cdylib-link-arg=-undefined"); println!("cargo:rustc-cdylib-link-arg=dynamic_lookup"); + println!("cargo:rustc-link-arg=-undefined"); + println!("cargo:rustc-link-arg=dynamic_lookup"); } } From 3150d3bc47e1f7c77184fc98b0009e4b8889c1b2 Mon Sep 17 00:00:00 2001 From: jmjoy Date: Tue, 6 Sep 2022 18:59:03 +0800 Subject: [PATCH 15/15] Support macos. --- README.md | 2 +- examples/hello/build.rs | 2 -- examples/http-client/build.rs | 2 -- examples/http-server/build.rs | 2 -- examples/logging/build.rs | 2 -- phper/build.rs | 2 -- tests/integration/build.rs | 2 -- 7 files changed, 1 insertion(+), 13 deletions(-) diff --git a/README.md b/README.md index 9651dd67..5c8c866b 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ The framework that allows us to write PHP extensions using pure and safe Rust wh - **OS** - [x] linux - - [ ] macos + - [x] macos - [ ] windows - **PHP** - **version** diff --git a/examples/hello/build.rs b/examples/hello/build.rs index f42bb89f..0c111d7a 100644 --- a/examples/hello/build.rs +++ b/examples/hello/build.rs @@ -13,8 +13,6 @@ fn main() { #[cfg(target_os = "macos")] { - println!("cargo:rustc-cdylib-link-arg=-undefined"); - println!("cargo:rustc-cdylib-link-arg=dynamic_lookup"); println!("cargo:rustc-link-arg=-undefined"); println!("cargo:rustc-link-arg=dynamic_lookup"); } diff --git a/examples/http-client/build.rs b/examples/http-client/build.rs index 1c9cea9c..682a4a6b 100644 --- a/examples/http-client/build.rs +++ b/examples/http-client/build.rs @@ -11,8 +11,6 @@ fn main() { #[cfg(target_os = "macos")] { - println!("cargo:rustc-cdylib-link-arg=-undefined"); - println!("cargo:rustc-cdylib-link-arg=dynamic_lookup"); println!("cargo:rustc-link-arg=-undefined"); println!("cargo:rustc-link-arg=dynamic_lookup"); } diff --git a/examples/http-server/build.rs b/examples/http-server/build.rs index 1c9cea9c..682a4a6b 100644 --- a/examples/http-server/build.rs +++ b/examples/http-server/build.rs @@ -11,8 +11,6 @@ fn main() { #[cfg(target_os = "macos")] { - println!("cargo:rustc-cdylib-link-arg=-undefined"); - println!("cargo:rustc-cdylib-link-arg=dynamic_lookup"); println!("cargo:rustc-link-arg=-undefined"); println!("cargo:rustc-link-arg=dynamic_lookup"); } diff --git a/examples/logging/build.rs b/examples/logging/build.rs index 1c9cea9c..682a4a6b 100644 --- a/examples/logging/build.rs +++ b/examples/logging/build.rs @@ -11,8 +11,6 @@ fn main() { #[cfg(target_os = "macos")] { - println!("cargo:rustc-cdylib-link-arg=-undefined"); - println!("cargo:rustc-cdylib-link-arg=dynamic_lookup"); println!("cargo:rustc-link-arg=-undefined"); println!("cargo:rustc-link-arg=dynamic_lookup"); } diff --git a/phper/build.rs b/phper/build.rs index bf4b4177..2975236d 100644 --- a/phper/build.rs +++ b/phper/build.rs @@ -15,8 +15,6 @@ fn main() { #[cfg(target_os = "macos")] { - println!("cargo:rustc-cdylib-link-arg=-undefined"); - println!("cargo:rustc-cdylib-link-arg=dynamic_lookup"); println!("cargo:rustc-link-arg=-undefined"); println!("cargo:rustc-link-arg=dynamic_lookup"); } diff --git a/tests/integration/build.rs b/tests/integration/build.rs index 1c9cea9c..682a4a6b 100644 --- a/tests/integration/build.rs +++ b/tests/integration/build.rs @@ -11,8 +11,6 @@ fn main() { #[cfg(target_os = "macos")] { - println!("cargo:rustc-cdylib-link-arg=-undefined"); - println!("cargo:rustc-cdylib-link-arg=dynamic_lookup"); println!("cargo:rustc-link-arg=-undefined"); println!("cargo:rustc-link-arg=dynamic_lookup"); }