From ea7c145c62a98e536c53359db065d318cd9687fb Mon Sep 17 00:00:00 2001 From: henderkes Date: Sun, 18 May 2025 15:52:15 +0700 Subject: [PATCH] libxml2 pic... --- src/SPC/builder/linux/library/libxml2.php | 12 +++++++++--- src/SPC/builder/unix/library/postgresql.php | 10 ++++++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/SPC/builder/linux/library/libxml2.php b/src/SPC/builder/linux/library/libxml2.php index 6f42d672..6d9470ae 100644 --- a/src/SPC/builder/linux/library/libxml2.php +++ b/src/SPC/builder/linux/library/libxml2.php @@ -24,13 +24,19 @@ class libxml2 extends LinuxLibraryBase FileSystem::resetDir($this->source_dir . '/build'); shell()->cd($this->source_dir . '/build') - ->exec( + ->setEnv([ + 'CFLAGS' => $this->getLibExtraCFlags(), + 'LDFLAGS' => $this->getLibExtraLdFlags(), + 'LIBS' => $this->getLibExtraLibs(), + ]) + ->execWithEnv( 'cmake ' . '-DCMAKE_BUILD_TYPE=Release ' . '-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' . '-DCMAKE_INSTALL_LIBDIR=' . BUILD_LIB_PATH . ' ' . "-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " . '-DBUILD_SHARED_LIBS=OFF ' . + '-DPOSITION_INDEPENDENT_CODE=ON ' . '-DIconv_IS_BUILT_IN=OFF ' . '-DLIBXML2_WITH_ICONV=ON ' . "-DLIBXML2_WITH_ZLIB={$enable_zlib} " . @@ -41,8 +47,8 @@ class libxml2 extends LinuxLibraryBase '-DLIBXML2_WITH_TESTS=OFF ' . '..' ) - ->exec("cmake --build . -j {$this->builder->concurrency}") - ->exec('make install'); + ->execWithEnv("cmake --build . -j {$this->builder->concurrency}") + ->execWithEnv('make install'); FileSystem::replaceFileStr( BUILD_LIB_PATH . '/pkgconfig/libxml-2.0.pc', diff --git a/src/SPC/builder/unix/library/postgresql.php b/src/SPC/builder/unix/library/postgresql.php index 43efca38..5a0da5de 100644 --- a/src/SPC/builder/unix/library/postgresql.php +++ b/src/SPC/builder/unix/library/postgresql.php @@ -39,10 +39,12 @@ trait postgresql $output = shell()->execWithResult("pkg-config --cflags-only-I --static {$packages}"); $error_exec_cnt += $output[0] === 0 ? 0 : 1; + $macos_15_bug_cflags = PHP_OS_FAMILY === 'Darwin' ? ' -Wno-unguarded-availability-new' : ''; + $cflags = ''; if (!empty($output[1][0])) { - $cppflags = $output[1][0]; - $macos_15_bug_cflags = PHP_OS_FAMILY === 'Darwin' ? ' -Wno-unguarded-availability-new' : ''; - $envs .= " CPPFLAGS=\"{$cppflags} -DPIC -fpic -fPIC -fPIE -fno-ident{$macos_15_bug_cflags}\""; + $cflags = $output[1][0]; + $envs .= ' CPPFLAGS="-DPIC"'; + $cflags = "{$cflags} -fno-ident{$macos_15_bug_cflags}"; } $output = shell()->execWithResult("pkg-config --libs-only-L --static {$packages}"); $error_exec_cnt += $output[0] === 0 ? 0 : 1; @@ -79,7 +81,7 @@ trait postgresql } $env = [ - 'CFLAGS' => $this->getLibExtraCFlags() . ' -DPIC -fpic', + 'CFLAGS' => $this->getLibExtraCFlags() . ' ' . $cflags, 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs(), ];