mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-02 14:25:41 +08:00
Compare commits
5 Commits
b4ed673261
...
v3c/librar
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
63ab28097f | ||
|
|
80ae7b093c | ||
|
|
daea8e10ad | ||
|
|
727600a73a | ||
|
|
29a8c9c196 |
@@ -27,7 +27,10 @@ class brotli
|
||||
{
|
||||
UnixCMakeExecutor::create($lib)
|
||||
->setBuildDir($lib->getSourceDir() . '/build-dir')
|
||||
->addConfigureArgs("-DSHARE_INSTALL_PREFIX={$lib->getBuildRootPath()}")
|
||||
->addConfigureArgs(
|
||||
"-DSHARE_INSTALL_PREFIX={$lib->getBuildRootPath()}",
|
||||
'-DBROTLI_DISABLE_TESTS=ON',
|
||||
)
|
||||
->build();
|
||||
|
||||
// Patch pkg-config files
|
||||
|
||||
@@ -17,7 +17,9 @@ class bzip2
|
||||
#[PatchBeforeBuild]
|
||||
public function patchBeforeBuild(LibraryPackage $lib): void
|
||||
{
|
||||
FileSystem::replaceFileStr($lib->getSourceDir() . '/Makefile', 'CFLAGS=-Wall', 'CFLAGS=-fPIC -Wall');
|
||||
// Makefile pins -O2 -fPIC; inject SPC_DEFAULT_CFLAGS
|
||||
$extra = deduplicate_flags(trim((string) getenv('SPC_DEFAULT_CFLAGS')) . ' -fPIC -Wall');
|
||||
FileSystem::replaceFileStr($lib->getSourceDir() . '/Makefile', 'CFLAGS=-Wall', "CFLAGS={$extra}");
|
||||
}
|
||||
|
||||
#[BuildFor('Windows')]
|
||||
|
||||
@@ -18,9 +18,11 @@ class fastlz
|
||||
{
|
||||
$cc = getenv('CC') ?: 'cc';
|
||||
$ar = getenv('AR') ?: 'ar';
|
||||
$extra = trim((string) getenv('SPC_DEFAULT_CFLAGS'));
|
||||
$extra = $extra !== '' ? $extra . ' -fPIC' : '-O3 -fPIC';
|
||||
|
||||
shell()->cd($lib->getSourceDir())->initializeEnv($lib)
|
||||
->exec("{$cc} -c -O3 -fPIC fastlz.c -o fastlz.o")
|
||||
->exec("{$cc} -c {$extra} fastlz.c -o fastlz.o")
|
||||
->exec("{$ar} rcs libfastlz.a fastlz.o");
|
||||
|
||||
// Copy header file
|
||||
|
||||
@@ -8,6 +8,7 @@ use StaticPHP\Attribute\Package\BuildFor;
|
||||
use StaticPHP\Attribute\Package\Library;
|
||||
use StaticPHP\Package\LibraryPackage;
|
||||
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
||||
use StaticPHP\Runtime\SystemTarget;
|
||||
|
||||
#[Library('gmp')]
|
||||
class gmp
|
||||
@@ -16,10 +17,12 @@ class gmp
|
||||
#[BuildFor('Darwin')]
|
||||
public function build(LibraryPackage $lib): void
|
||||
{
|
||||
UnixAutoconfExecutor::create($lib)
|
||||
->appendEnv(['CFLAGS' => '-std=c17'])
|
||||
->configure('--enable-fat')
|
||||
->make();
|
||||
$make = UnixAutoconfExecutor::create($lib)->appendEnv(['CFLAGS' => '-std=c17']);
|
||||
if (SystemTarget::getTargetArch() === 'x86_64' && SystemTarget::getTargetOS() === 'Linux') {
|
||||
$libc = SystemTarget::getLibc() === 'glibc' ? 'gnu' : 'musl';
|
||||
$make->addConfigureArgs(["--host=x86_64-pc-linux-{$libc}"]);
|
||||
}
|
||||
$make->configure('--enable-fat')->make();
|
||||
$lib->patchPkgconfPrefix(['gmp.pc']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,9 +24,12 @@ class icu
|
||||
#[BuildFor('Linux')]
|
||||
public function buildLinux(LibraryPackage $lib, ToolchainInterface $toolchain, PackageBuilder $builder): void
|
||||
{
|
||||
// runConfigureICU bakes CXXFLAGS/LDFLAGS, apply user flags too
|
||||
$userCxxFlags = trim((string) getenv('SPC_DEFAULT_CXXFLAGS'));
|
||||
$userLdFlags = trim((string) getenv('SPC_DEFAULT_LDFLAGS'));
|
||||
$cppflags = 'CPPFLAGS="-DU_CHARSET_IS_UTF8=1 -DU_USING_ICU_NAMESPACE=1 -DU_STATIC_IMPLEMENTATION=1 -DPIC -fPIC"';
|
||||
$cxxflags = 'CXXFLAGS="-std=c++17 -DPIC -fPIC -fno-ident"';
|
||||
$ldflags = $toolchain->isStatic() ? 'LDFLAGS="-static"' : '';
|
||||
$cxxflags = "CXXFLAGS=\"-std=c++17 -DPIC -fPIC -fno-ident {$userCxxFlags}\"";
|
||||
$ldflags = $toolchain->isStatic() ? "LDFLAGS=\"-static {$userLdFlags}\"" : "LDFLAGS=\"{$userLdFlags}\"";
|
||||
shell()->cd($lib->getSourceDir() . '/source')->initializeEnv($lib)
|
||||
->exec(
|
||||
"{$cppflags} {$cxxflags} {$ldflags} " .
|
||||
|
||||
@@ -45,6 +45,9 @@ class imagemagick
|
||||
// implicit --with-gcc-arch
|
||||
// bleeds host cpu features into built binaries
|
||||
'--without-gcc-arch',
|
||||
'--disable-docs',
|
||||
'--without-utilities',
|
||||
'--disable-dpc',
|
||||
);
|
||||
|
||||
// special: linux-static target needs `-static`
|
||||
|
||||
@@ -17,7 +17,9 @@ class jbig
|
||||
#[PatchBeforeBuild]
|
||||
public function patchBeforeBuild(LibraryPackage $lib): void
|
||||
{
|
||||
FileSystem::replaceFileStr($lib->getSourceDir() . '/Makefile', 'CFLAGS = -O2 -W -Wno-unused-result', 'CFLAGS = -O2 -W -Wno-unused-result -fPIC');
|
||||
$extra = trim((string) getenv('SPC_DEFAULT_CFLAGS'));
|
||||
$cflags = ($extra !== '' ? $extra : '-O2') . ' -W -Wno-unused-result -fPIC';
|
||||
FileSystem::replaceFileStr($lib->getSourceDir() . '/Makefile', 'CFLAGS = -O2 -W -Wno-unused-result', "CFLAGS = {$cflags}");
|
||||
}
|
||||
|
||||
#[BuildFor('Darwin')]
|
||||
|
||||
@@ -35,6 +35,7 @@ class ldap
|
||||
->optionalPackage('libsodium', '--with-argon2=libsodium', '--enable-argon2=no')
|
||||
->addConfigureArgs(
|
||||
'--disable-slapd',
|
||||
'--disable-debug',
|
||||
'--without-systemd',
|
||||
'--without-cyrus-sasl',
|
||||
'ac_cv_func_pthread_kill_other_threads_np=no'
|
||||
|
||||
@@ -9,8 +9,10 @@ use StaticPHP\Attribute\Package\Library;
|
||||
use StaticPHP\Package\LibraryPackage;
|
||||
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
||||
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
|
||||
use StaticPHP\Runtime\SystemTarget;
|
||||
use StaticPHP\Toolchain\Interface\ToolchainInterface;
|
||||
use StaticPHP\Toolchain\ZigToolchain;
|
||||
use StaticPHP\Util\System\UnixUtil;
|
||||
|
||||
#[Library('libaom')]
|
||||
class libaom extends LibraryPackage
|
||||
@@ -39,9 +41,23 @@ class libaom extends LibraryPackage
|
||||
$new = trim($extra . ' -D_GNU_SOURCE');
|
||||
f_putenv("SPC_COMPILER_EXTRA={$new}");
|
||||
}
|
||||
$targetCpu = SystemTarget::getTargetArch();
|
||||
if (str_starts_with($targetCpu, 'aarch')) {
|
||||
$targetCpu = str_replace('aarch', 'arm', $targetCpu);
|
||||
}
|
||||
if (!UnixUtil::findCommand('nasm') && !UnixUtil::findCommand('yasm')) {
|
||||
$targetCpu = 'generic';
|
||||
}
|
||||
UnixCMakeExecutor::create($this)
|
||||
->setBuildDir("{$this->getSourceDir()}/builddir")
|
||||
->addConfigureArgs('-DAOM_TARGET_CPU=generic')
|
||||
->addConfigureArgs(
|
||||
"-DAOM_TARGET_CPU={$targetCpu}",
|
||||
'-DCONFIG_RUNTIME_CPU_DETECT=1',
|
||||
'-DENABLE_EXAMPLES=OFF',
|
||||
'-DENABLE_TESTS=OFF',
|
||||
'-DENABLE_TOOLS=OFF',
|
||||
'-DENABLE_DOCS=OFF',
|
||||
)
|
||||
->build();
|
||||
f_putenv("SPC_COMPILER_EXTRA={$extra}");
|
||||
$this->patchPkgconfPrefix(['aom.pc']);
|
||||
|
||||
@@ -35,7 +35,12 @@ class libavif
|
||||
->optionalPackage('libjpeg', '-DAVIF_JPEG=SYSTEM', '-DAVIF_JPEG=OFF')
|
||||
->optionalPackage('libxml2', '-DAVIF_LIBXML2=SYSTEM', '-DAVIF_LIBXML2=OFF')
|
||||
->optionalPackage('libpng', '-DAVIF_LIBPNG=SYSTEM', '-DAVIF_LIBPNG=OFF')
|
||||
->addConfigureArgs('-DAVIF_LIBYUV=OFF')
|
||||
->addConfigureArgs(
|
||||
'-DAVIF_LIBYUV=OFF',
|
||||
'-DAVIF_BUILD_APPS=OFF',
|
||||
'-DAVIF_BUILD_TESTS=OFF',
|
||||
'-DAVIF_GTEST=OFF',
|
||||
)
|
||||
->build();
|
||||
// patch pkgconfig
|
||||
$lib->patchPkgconfPrefix(['libavif.pc']);
|
||||
@@ -49,7 +54,7 @@ class libavif
|
||||
'-DAVIF_BUILD_APPS=OFF',
|
||||
'-DAVIF_BUILD_TESTS=OFF',
|
||||
'-DAVIF_LIBYUV=OFF',
|
||||
'-DAVIF_ENABLE_GTEST=OFF',
|
||||
'-DAVIF_GTEST=OFF',
|
||||
)
|
||||
->build();
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ class libffi extends LibraryPackage
|
||||
public function buildLinux(): void
|
||||
{
|
||||
UnixAutoconfExecutor::create($this)
|
||||
->configure()->make();
|
||||
->configure('--disable-docs')->make();
|
||||
|
||||
if (is_file("{$this->getBuildRootPath()}/lib64/libffi.a")) {
|
||||
copy("{$this->getBuildRootPath()}/lib64/libffi.a", "{$this->getBuildRootPath()}/lib/libffi.a");
|
||||
@@ -33,6 +33,7 @@ class libffi extends LibraryPackage
|
||||
->configure(
|
||||
"--host={$arch}-apple-darwin",
|
||||
"--target={$arch}-apple-darwin",
|
||||
'--disable-docs',
|
||||
)
|
||||
->make();
|
||||
$this->patchPkgconfPrefix(['libffi.pc']);
|
||||
|
||||
@@ -24,6 +24,17 @@ class libheif
|
||||
'list(APPEND REQUIRES_PRIVATE "libbrotlidec")' . "\n" . ' list(APPEND REQUIRES_PRIVATE "libbrotlienc")'
|
||||
);
|
||||
}
|
||||
// libheif 1.22+ ships a C-incompatible header: `struct heif_bad_pixel`
|
||||
$heif_properties = $lib->getSourceDir() . '/libheif/api/libheif/heif_properties.h';
|
||||
if (file_exists($heif_properties)
|
||||
&& str_contains(file_get_contents($heif_properties), 'struct heif_bad_pixel { uint32_t row; uint32_t column; };')
|
||||
) {
|
||||
FileSystem::replaceFileStr(
|
||||
$heif_properties,
|
||||
'struct heif_bad_pixel { uint32_t row; uint32_t column; };',
|
||||
'typedef struct heif_bad_pixel { uint32_t row; uint32_t column; } heif_bad_pixel;'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[BuildFor('Darwin')]
|
||||
@@ -36,6 +47,7 @@ class libheif
|
||||
'-DWITH_EXAMPLES=OFF',
|
||||
'-DWITH_GDK_PIXBUF=OFF',
|
||||
'-DBUILD_TESTING=OFF',
|
||||
'-DBUILD_DOCUMENTATION=OFF',
|
||||
'-DWITH_LIBSHARPYUV=ON', // optional: libwebp
|
||||
'-DENABLE_PLUGIN_LOADING=OFF',
|
||||
)
|
||||
|
||||
@@ -25,6 +25,7 @@ class libjxl extends LibraryPackage
|
||||
'-DJPEGXL_ENABLE_MANPAGES=OFF',
|
||||
'-DJPEGXL_ENABLE_BENCHMARK=OFF',
|
||||
'-DJPEGXL_ENABLE_PLUGINS=OFF',
|
||||
'-DJPEGXL_ENABLE_DOXYGEN=OFF',
|
||||
'-DJPEGXL_ENABLE_SJPEG=ON',
|
||||
'-DJPEGXL_ENABLE_JNI=OFF',
|
||||
'-DJPEGXL_ENABLE_TRANSCODE_JPEG=ON',
|
||||
|
||||
@@ -12,17 +12,25 @@ use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
||||
#[Library('libmemcached')]
|
||||
class libmemcached extends LibraryPackage
|
||||
{
|
||||
private const array DISABLE_ARGS = [
|
||||
'-DBUILD_TESTING=OFF',
|
||||
'-DBUILD_DOCS=OFF',
|
||||
'-DENABLE_MEMASLAP=OFF',
|
||||
];
|
||||
|
||||
#[BuildFor('Linux')]
|
||||
public function buildLinux(): void
|
||||
{
|
||||
UnixCMakeExecutor::create($this)
|
||||
->addConfigureArgs('-DCMAKE_INSTALL_RPATH=""')
|
||||
->addConfigureArgs('-DCMAKE_INSTALL_RPATH=""', ...self::DISABLE_ARGS)
|
||||
->build();
|
||||
}
|
||||
|
||||
#[BuildFor('Darwin')]
|
||||
public function buildDarwin(): void
|
||||
{
|
||||
UnixCMakeExecutor::create($this)->build();
|
||||
UnixCMakeExecutor::create($this)
|
||||
->addConfigureArgs(...self::DISABLE_ARGS)
|
||||
->build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ class libpng
|
||||
{
|
||||
$args = [
|
||||
'--enable-hardware-optimizations',
|
||||
'--disable-tests',
|
||||
'--disable-tools',
|
||||
"--with-zlib-prefix={$lib->getBuildRootPath()}",
|
||||
];
|
||||
|
||||
|
||||
@@ -13,17 +13,29 @@ use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
|
||||
#[Library('librabbitmq')]
|
||||
class librabbitmq extends LibraryPackage
|
||||
{
|
||||
private const array DISABLE_ARGS = [
|
||||
'-DBUILD_EXAMPLES=OFF',
|
||||
'-DBUILD_TESTING=OFF',
|
||||
'-DBUILD_TOOLS=OFF',
|
||||
'-DBUILD_TOOLS_DOCS=OFF',
|
||||
'-DBUILD_API_DOCS=OFF',
|
||||
];
|
||||
|
||||
#[BuildFor('Darwin')]
|
||||
#[BuildFor('Linux')]
|
||||
public function buildUnix(): void
|
||||
{
|
||||
UnixCMakeExecutor::create($this)->addConfigureArgs('-DBUILD_STATIC_LIBS=ON')->build();
|
||||
UnixCMakeExecutor::create($this)
|
||||
->addConfigureArgs('-DBUILD_STATIC_LIBS=ON', ...self::DISABLE_ARGS)
|
||||
->build();
|
||||
}
|
||||
|
||||
#[BuildFor('Windows')]
|
||||
public function buildWin(): void
|
||||
{
|
||||
WindowsCMakeExecutor::create($this)->build();
|
||||
WindowsCMakeExecutor::create($this)
|
||||
->addConfigureArgs(...self::DISABLE_ARGS)
|
||||
->build();
|
||||
rename("{$this->getLibDir()}\\librabbitmq.4.lib", "{$this->getLibDir()}\\rabbitmq.4.lib");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,9 @@ class libtiff
|
||||
'--disable-libdeflate',
|
||||
'--disable-tools',
|
||||
'--disable-contrib',
|
||||
'--disable-tests',
|
||||
'--disable-docs',
|
||||
'--disable-sphinx',
|
||||
'--disable-cxx',
|
||||
'--without-x',
|
||||
)
|
||||
|
||||
@@ -13,12 +13,18 @@ use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
|
||||
#[Library('libuv')]
|
||||
class libuv
|
||||
{
|
||||
private const array DISABLE_ARGS = [
|
||||
'-DLIBUV_BUILD_SHARED=OFF',
|
||||
'-DLIBUV_BUILD_TESTS=OFF',
|
||||
'-DLIBUV_BUILD_BENCH=OFF',
|
||||
];
|
||||
|
||||
#[BuildFor('Darwin')]
|
||||
#[BuildFor('Linux')]
|
||||
public function buildUnix(LibraryPackage $lib): void
|
||||
{
|
||||
UnixCMakeExecutor::create($lib)
|
||||
->addConfigureArgs('-DLIBUV_BUILD_SHARED=OFF')
|
||||
->addConfigureArgs(...self::DISABLE_ARGS)
|
||||
->build();
|
||||
// patch pkgconfig
|
||||
$lib->patchPkgconfPrefix(['libuv-static.pc']);
|
||||
@@ -28,7 +34,7 @@ class libuv
|
||||
public function buildWindows(LibraryPackage $lib): void
|
||||
{
|
||||
WindowsCMakeExecutor::create($lib)
|
||||
->addConfigureArgs('-DLIBUV_BUILD_SHARED=OFF')
|
||||
->addConfigureArgs(...self::DISABLE_ARGS)
|
||||
->build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ class libxslt
|
||||
'--without-crypto',
|
||||
'--without-debug',
|
||||
'--without-debugger',
|
||||
'--without-profiler',
|
||||
"--with-libxml-prefix={$lib->getBuildRootPath()}",
|
||||
);
|
||||
if (getenv('SPC_LD_LIBRARY_PATH') && getenv('SPC_LIBRARY_PATH')) {
|
||||
|
||||
@@ -21,6 +21,7 @@ class mimalloc
|
||||
->addConfigureArgs(
|
||||
'-DMI_BUILD_SHARED=OFF',
|
||||
'-DMI_BUILD_OBJECT=OFF',
|
||||
'-DMI_BUILD_TESTS=OFF',
|
||||
'-DMI_INSTALL_TOPLEVEL=ON',
|
||||
);
|
||||
if (SystemTarget::getLibc() === 'musl') {
|
||||
|
||||
@@ -6,6 +6,8 @@ namespace Package\Library;
|
||||
|
||||
use StaticPHP\Attribute\Package\BuildFor;
|
||||
use StaticPHP\Attribute\Package\Library;
|
||||
use StaticPHP\Attribute\Package\PatchBeforeBuild;
|
||||
use StaticPHP\Attribute\PatchDescription;
|
||||
use StaticPHP\Package\LibraryPackage;
|
||||
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
||||
use StaticPHP\Toolchain\Interface\ToolchainInterface;
|
||||
@@ -16,6 +18,24 @@ use StaticPHP\Util\FileSystem;
|
||||
#[Library('ncursesw')]
|
||||
class ncurses
|
||||
{
|
||||
#[PatchBeforeBuild]
|
||||
#[PatchDescription('Filter clang/zig "N warning(s) generated." line out of MKlib_gen.sh preprocessor pipe')]
|
||||
public function patchBeforeBuild(LibraryPackage $lib): void
|
||||
{
|
||||
// MKlib_gen.sh feeds the C preprocessor's stdout through a sed/awk
|
||||
// pipeline into lib_gen.c. zig-cc/clang emits "N warning(s) generated."
|
||||
// on stdout (not stderr), and that line ends up as invalid C in the
|
||||
// generated source. Filter it out of the pipe before sed sees it.
|
||||
$mklibGen = $lib->getSourceDir() . '/ncurses/base/MKlib_gen.sh';
|
||||
if (is_file($mklibGen) && !str_contains((string) file_get_contents($mklibGen), "| grep -v ' generated")) {
|
||||
FileSystem::replaceFileStr(
|
||||
$mklibGen,
|
||||
'$preprocessor $TMP 2>/dev/null \\',
|
||||
"\$preprocessor \$TMP 2>/dev/null \\\n| grep -v ' generated\\.\$' \\",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[BuildFor('Darwin')]
|
||||
#[BuildFor('Linux')]
|
||||
public function build(LibraryPackage $package, ToolchainInterface $toolchain): void
|
||||
|
||||
@@ -24,6 +24,7 @@ class nghttp3
|
||||
'-DBUILD_SHARED_LIBS=OFF',
|
||||
'-DENABLE_STATIC_CRT=ON',
|
||||
'-DENABLE_LIB_ONLY=ON',
|
||||
'-DBUILD_TESTING=OFF',
|
||||
)
|
||||
->build();
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ class ngtcp2
|
||||
'-DENABLE_STATIC_CRT=ON',
|
||||
'-DENABLE_LIB_ONLY=ON',
|
||||
'-DENABLE_OPENSSL=OFF',
|
||||
'-DBUILD_TESTING=OFF',
|
||||
)
|
||||
->build();
|
||||
}
|
||||
|
||||
@@ -111,6 +111,12 @@ class openssl
|
||||
$openssl_dir ??= LinuxUtil::getOSRelease()['dist'] === 'redhat' ? '/etc/pki/tls' : '/etc/ssl';
|
||||
$ex_lib = trim($ex_lib);
|
||||
|
||||
// anything we want included (PGO -fprofile-*, LTO, custom hardening)
|
||||
// has to be appended on the command line *after* the target name.
|
||||
$userCFlags = trim((string) getenv('SPC_DEFAULT_CFLAGS'));
|
||||
$userLdFlags = trim((string) getenv('SPC_DEFAULT_LDFLAGS'));
|
||||
$userExtra = trim($userCFlags . ' ' . $userLdFlags);
|
||||
|
||||
shell()->cd($lib->getSourceDir())->initializeEnv($lib)
|
||||
->exec(
|
||||
"{$env} ./Configure no-shared zlib " .
|
||||
@@ -121,7 +127,8 @@ class openssl
|
||||
'enable-pie ' .
|
||||
'no-legacy ' .
|
||||
'no-tests ' .
|
||||
"linux-{$arch}"
|
||||
"linux-{$arch} " .
|
||||
$userExtra
|
||||
)
|
||||
->exec('make clean')
|
||||
->exec("make -j{$lib->getBuilder()->concurrency} CNF_EX_LIBS=\"{$ex_lib}\"")
|
||||
|
||||
@@ -20,6 +20,11 @@ class qdbm
|
||||
{
|
||||
$ac = UnixAutoconfExecutor::create($lib)->configure();
|
||||
FileSystem::replaceFileRegex($lib->getSourceDir() . '/Makefile', '/MYLIBS = libqdbm.a.*/m', 'MYLIBS = libqdbm.a');
|
||||
// Makefile pins -O3, replace with SPC_DEFAULT_CFLAGS
|
||||
$extra = trim((string) getenv('SPC_DEFAULT_CFLAGS'));
|
||||
if ($extra !== '') {
|
||||
FileSystem::replaceFileRegex($lib->getSourceDir() . '/Makefile', '/^CFLAGS = .*$/m', "CFLAGS = -Wall {$extra}");
|
||||
}
|
||||
$ac->make(SystemTarget::getTargetOS() === 'Darwin' ? 'mac' : '');
|
||||
$lib->patchPkgconfPrefix(['qdbm.pc']);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ class readline
|
||||
->configure(
|
||||
'--with-curses',
|
||||
'--enable-multibyte=yes',
|
||||
'--disable-install-examples',
|
||||
)
|
||||
->make();
|
||||
$lib->patchPkgconfPrefix(['readline.pc']);
|
||||
|
||||
@@ -22,7 +22,8 @@ class tidy
|
||||
->setBuildDir("{$lib->getSourceDir()}/build-dir")
|
||||
->addConfigureArgs(
|
||||
'-DSUPPORT_CONSOLE_APP=OFF',
|
||||
'-DBUILD_SHARED_LIB=OFF'
|
||||
'-DBUILD_SHARED_LIB=OFF',
|
||||
'-DSUPPORT_LOCALIZATIONS=OFF',
|
||||
);
|
||||
if (version_compare(get_cmake_version(), '4.0.0', '>=')) {
|
||||
$cmake->addConfigureArgs('-DCMAKE_POLICY_VERSION_MINIMUM=3.5');
|
||||
@@ -38,7 +39,8 @@ class tidy
|
||||
->setBuildDir("{$lib->getSourceDir()}/build-dir")
|
||||
->addConfigureArgs(
|
||||
'-DSUPPORT_CONSOLE_APP=OFF',
|
||||
'-DBUILD_SHARED_LIB=OFF'
|
||||
'-DBUILD_SHARED_LIB=OFF',
|
||||
'-DSUPPORT_LOCALIZATIONS=OFF',
|
||||
)->build();
|
||||
|
||||
// rename tidy_static.lib to tidy_a.lib
|
||||
|
||||
@@ -35,6 +35,7 @@ class unixodbc extends LibraryPackage
|
||||
'--with-included-ltdl',
|
||||
"--sysconfdir={$sysconf_selector}",
|
||||
'--enable-gui=no',
|
||||
'--enable-readline=no',
|
||||
)
|
||||
->make();
|
||||
$this->patchPkgconfPrefix(['odbc.pc', 'odbccr.pc', 'odbcinst.pc']);
|
||||
|
||||
@@ -22,6 +22,11 @@ class xz
|
||||
->configure(
|
||||
'--disable-scripts',
|
||||
'--disable-doc',
|
||||
'--disable-xz',
|
||||
'--disable-xzdec',
|
||||
'--disable-lzmadec',
|
||||
'--disable-lzmainfo',
|
||||
'--disable-lzma-links',
|
||||
'--with-libiconv',
|
||||
'--bindir=/tmp/xz', // xz binary will corrupt `tar` command, that's really strange.
|
||||
)
|
||||
|
||||
@@ -14,16 +14,20 @@ use StaticPHP\Util\FileSystem;
|
||||
#[Library('zstd')]
|
||||
class zstd
|
||||
{
|
||||
private const array DISABLE_ARGS = [
|
||||
'-DZSTD_BUILD_STATIC=ON',
|
||||
'-DZSTD_BUILD_SHARED=OFF',
|
||||
'-DZSTD_BUILD_PROGRAMS=OFF',
|
||||
'-DZSTD_BUILD_TESTS=OFF',
|
||||
];
|
||||
|
||||
#[BuildFor('Windows')]
|
||||
public function buildWin(LibraryPackage $package): void
|
||||
{
|
||||
WindowsCMakeExecutor::create($package)
|
||||
->setWorkingDir("{$package->getSourceDir()}/build/cmake")
|
||||
->setBuildDir("{$package->getSourceDir()}/build/cmake/build")
|
||||
->addConfigureArgs(
|
||||
'-DZSTD_BUILD_STATIC=ON',
|
||||
'-DZSTD_BUILD_SHARED=OFF',
|
||||
)
|
||||
->addConfigureArgs(...self::DISABLE_ARGS)
|
||||
->build();
|
||||
FileSystem::copy($package->getLibDir() . '\zstd_static.lib', $package->getLibDir() . '/zstd.lib');
|
||||
FileSystem::copy($package->getLibDir() . '\zstd_static.lib', $package->getLibDir() . '/libzstd.lib');
|
||||
@@ -35,10 +39,7 @@ class zstd
|
||||
{
|
||||
UnixCMakeExecutor::create($lib)
|
||||
->setBuildDir("{$lib->getSourceDir()}/build/cmake/build")
|
||||
->addConfigureArgs(
|
||||
'-DZSTD_BUILD_STATIC=ON',
|
||||
'-DZSTD_BUILD_SHARED=OFF',
|
||||
)
|
||||
->addConfigureArgs(...self::DISABLE_ARGS)
|
||||
->build();
|
||||
|
||||
$lib->patchPkgconfPrefix(['libzstd.pc'], PKGCONF_PATCH_PREFIX);
|
||||
|
||||
@@ -43,6 +43,8 @@ class curl
|
||||
'-DZSTD_LIBRARY=zstd_static.lib',
|
||||
'-DBUILD_TESTING=OFF',
|
||||
'-DBUILD_EXAMPLES=OFF',
|
||||
'-DBUILD_LIBCURL_DOCS=OFF',
|
||||
'-DENABLE_CURL_MANUAL=OFF',
|
||||
'-DUSE_LIBIDN2=OFF',
|
||||
'-DCURL_USE_LIBPSL=OFF',
|
||||
'-DUSE_WINDOWS_SSPI=ON',
|
||||
@@ -81,6 +83,9 @@ class curl
|
||||
->addConfigureArgs(
|
||||
'-DBUILD_CURL_EXE=ON',
|
||||
'-DBUILD_LIBCURL_DOCS=OFF',
|
||||
'-DBUILD_TESTING=OFF',
|
||||
'-DBUILD_EXAMPLES=OFF',
|
||||
'-DENABLE_CURL_MANUAL=OFF',
|
||||
'-DOPENSSL_ROOT_DIR=' . BUILD_ROOT_PATH,
|
||||
)
|
||||
->build();
|
||||
|
||||
Reference in New Issue
Block a user