mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-02 14:25:41 +08:00
libxml2 pic...
This commit is contained in:
@@ -24,13 +24,19 @@ class libxml2 extends LinuxLibraryBase
|
|||||||
|
|
||||||
FileSystem::resetDir($this->source_dir . '/build');
|
FileSystem::resetDir($this->source_dir . '/build');
|
||||||
shell()->cd($this->source_dir . '/build')
|
shell()->cd($this->source_dir . '/build')
|
||||||
->exec(
|
->setEnv([
|
||||||
|
'CFLAGS' => $this->getLibExtraCFlags(),
|
||||||
|
'LDFLAGS' => $this->getLibExtraLdFlags(),
|
||||||
|
'LIBS' => $this->getLibExtraLibs(),
|
||||||
|
])
|
||||||
|
->execWithEnv(
|
||||||
'cmake ' .
|
'cmake ' .
|
||||||
'-DCMAKE_BUILD_TYPE=Release ' .
|
'-DCMAKE_BUILD_TYPE=Release ' .
|
||||||
'-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' .
|
'-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' .
|
||||||
'-DCMAKE_INSTALL_LIBDIR=' . BUILD_LIB_PATH . ' ' .
|
'-DCMAKE_INSTALL_LIBDIR=' . BUILD_LIB_PATH . ' ' .
|
||||||
"-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " .
|
"-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " .
|
||||||
'-DBUILD_SHARED_LIBS=OFF ' .
|
'-DBUILD_SHARED_LIBS=OFF ' .
|
||||||
|
'-DPOSITION_INDEPENDENT_CODE=ON ' .
|
||||||
'-DIconv_IS_BUILT_IN=OFF ' .
|
'-DIconv_IS_BUILT_IN=OFF ' .
|
||||||
'-DLIBXML2_WITH_ICONV=ON ' .
|
'-DLIBXML2_WITH_ICONV=ON ' .
|
||||||
"-DLIBXML2_WITH_ZLIB={$enable_zlib} " .
|
"-DLIBXML2_WITH_ZLIB={$enable_zlib} " .
|
||||||
@@ -41,8 +47,8 @@ class libxml2 extends LinuxLibraryBase
|
|||||||
'-DLIBXML2_WITH_TESTS=OFF ' .
|
'-DLIBXML2_WITH_TESTS=OFF ' .
|
||||||
'..'
|
'..'
|
||||||
)
|
)
|
||||||
->exec("cmake --build . -j {$this->builder->concurrency}")
|
->execWithEnv("cmake --build . -j {$this->builder->concurrency}")
|
||||||
->exec('make install');
|
->execWithEnv('make install');
|
||||||
|
|
||||||
FileSystem::replaceFileStr(
|
FileSystem::replaceFileStr(
|
||||||
BUILD_LIB_PATH . '/pkgconfig/libxml-2.0.pc',
|
BUILD_LIB_PATH . '/pkgconfig/libxml-2.0.pc',
|
||||||
|
|||||||
@@ -39,10 +39,12 @@ trait postgresql
|
|||||||
|
|
||||||
$output = shell()->execWithResult("pkg-config --cflags-only-I --static {$packages}");
|
$output = shell()->execWithResult("pkg-config --cflags-only-I --static {$packages}");
|
||||||
$error_exec_cnt += $output[0] === 0 ? 0 : 1;
|
$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])) {
|
if (!empty($output[1][0])) {
|
||||||
$cppflags = $output[1][0];
|
$cflags = $output[1][0];
|
||||||
$macos_15_bug_cflags = PHP_OS_FAMILY === 'Darwin' ? ' -Wno-unguarded-availability-new' : '';
|
$envs .= ' CPPFLAGS="-DPIC"';
|
||||||
$envs .= " CPPFLAGS=\"{$cppflags} -DPIC -fpic -fPIC -fPIE -fno-ident{$macos_15_bug_cflags}\"";
|
$cflags = "{$cflags} -fno-ident{$macos_15_bug_cflags}";
|
||||||
}
|
}
|
||||||
$output = shell()->execWithResult("pkg-config --libs-only-L --static {$packages}");
|
$output = shell()->execWithResult("pkg-config --libs-only-L --static {$packages}");
|
||||||
$error_exec_cnt += $output[0] === 0 ? 0 : 1;
|
$error_exec_cnt += $output[0] === 0 ? 0 : 1;
|
||||||
@@ -79,7 +81,7 @@ trait postgresql
|
|||||||
}
|
}
|
||||||
|
|
||||||
$env = [
|
$env = [
|
||||||
'CFLAGS' => $this->getLibExtraCFlags() . ' -DPIC -fpic',
|
'CFLAGS' => $this->getLibExtraCFlags() . ' ' . $cflags,
|
||||||
'LDFLAGS' => $this->getLibExtraLdFlags(),
|
'LDFLAGS' => $this->getLibExtraLdFlags(),
|
||||||
'LIBS' => $this->getLibExtraLibs(),
|
'LIBS' => $this->getLibExtraLibs(),
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user