mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-09 18:05:36 +08:00
Compare commits
21 Commits
392733b7c3
...
v3c/librar
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f8674f667 | ||
|
|
8034ae37ea | ||
|
|
c9f24b980d | ||
|
|
facc7bc5a7 | ||
|
|
160d7f5537 | ||
|
|
afa5f535e9 | ||
|
|
0dde151632 | ||
|
|
e906edb332 | ||
|
|
7d6c082c86 | ||
|
|
db4f7c6a0c | ||
|
|
ca0167c83e | ||
|
|
331da67049 | ||
|
|
cc448d463b | ||
|
|
dc55881b78 | ||
|
|
a59473e4ab | ||
|
|
c6a227f4de | ||
|
|
63ab28097f | ||
|
|
80ae7b093c | ||
|
|
daea8e10ad | ||
|
|
727600a73a | ||
|
|
29a8c9c196 |
48
.github/workflows/post-test-bot-comment.yml
vendored
Normal file
48
.github/workflows/post-test-bot-comment.yml
vendored
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
name: Post Test Bot Comment
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_run:
|
||||||
|
workflows: ["v3 Tests"]
|
||||||
|
types: [completed]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
pull-requests: write
|
||||||
|
actions: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
post-comment:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 5
|
||||||
|
steps:
|
||||||
|
- name: Download bot output
|
||||||
|
id: download
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
continue-on-error: true
|
||||||
|
with:
|
||||||
|
name: bot-output
|
||||||
|
run-id: ${{ github.event.workflow_run.id }}
|
||||||
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Post/Update comment
|
||||||
|
if: steps.download.outcome == 'success'
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
COMMENT_BODY=$(jq -r '.comment_body' bot-output.json)
|
||||||
|
PR_NUMBER=$(jq -r '.pr_number' bot-output.json)
|
||||||
|
MARKER="<!-- spc-test-bot -->"
|
||||||
|
|
||||||
|
# Find existing bot comment id
|
||||||
|
EXISTING_ID=$(gh api \
|
||||||
|
"repos/${{ github.repository }}/issues/${PR_NUMBER}/comments" \
|
||||||
|
--jq "[.[] | select(.body | startswith(\"${MARKER}\")) | .id] | first // empty")
|
||||||
|
|
||||||
|
if [ -n "$EXISTING_ID" ]; then
|
||||||
|
gh api --method PATCH \
|
||||||
|
"repos/${{ github.repository }}/issues/comments/${EXISTING_ID}" \
|
||||||
|
-f body="$COMMENT_BODY"
|
||||||
|
else
|
||||||
|
gh pr comment "$PR_NUMBER" \
|
||||||
|
--repo "${{ github.repository }}" \
|
||||||
|
--body "$COMMENT_BODY"
|
||||||
|
fi
|
||||||
27
.github/workflows/tests.yml
vendored
27
.github/workflows/tests.yml
vendored
@@ -131,7 +131,6 @@ jobs:
|
|||||||
if: needs.check-gate.outputs.enabled == 'true'
|
if: needs.check-gate.outputs.enabled == 'true'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
pull-requests: write
|
|
||||||
contents: read
|
contents: read
|
||||||
outputs:
|
outputs:
|
||||||
need_test: ${{ steps.bot.outputs.need_test }}
|
need_test: ${{ steps.bot.outputs.need_test }}
|
||||||
@@ -168,23 +167,17 @@ jobs:
|
|||||||
echo "php_versions=$(echo "$BOT_JSON" | jq -c '.php_versions')" >> "$GITHUB_OUTPUT"
|
echo "php_versions=$(echo "$BOT_JSON" | jq -c '.php_versions')" >> "$GITHUB_OUTPUT"
|
||||||
echo "tier2=$(echo "$BOT_JSON" | jq -r '.tier2')" >> "$GITHUB_OUTPUT"
|
echo "tier2=$(echo "$BOT_JSON" | jq -r '.tier2')" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
COMMENT_BODY=$(echo "$BOT_JSON" | jq -r '.comment_body')
|
# Save JSON for the comment-posting workflow
|
||||||
MARKER="<!-- spc-test-bot -->"
|
jq -n --argjson bot "$BOT_JSON" \
|
||||||
|
--arg pr '${{ github.event.pull_request.number }}' \
|
||||||
|
'$bot + {pr_number: $pr}' > bot-output.json
|
||||||
|
|
||||||
# Find existing bot comment id
|
- name: Upload bot output
|
||||||
EXISTING_ID=$(gh api \
|
uses: actions/upload-artifact@v4
|
||||||
repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \
|
with:
|
||||||
--jq "[.[] | select(.body | startswith(\"$MARKER\")) | .id] | first // empty")
|
name: bot-output
|
||||||
|
path: bot-output.json
|
||||||
if [ -n "$EXISTING_ID" ]; then
|
retention-days: 1
|
||||||
gh api --method PATCH \
|
|
||||||
repos/${{ github.repository }}/issues/comments/"$EXISTING_ID" \
|
|
||||||
-f body="$COMMENT_BODY"
|
|
||||||
else
|
|
||||||
gh pr comment ${{ github.event.pull_request.number }} \
|
|
||||||
--repo ${{ github.repository }} \
|
|
||||||
--body "$COMMENT_BODY"
|
|
||||||
fi
|
|
||||||
|
|
||||||
gen-matrix:
|
gen-matrix:
|
||||||
name: "Generate test matrix"
|
name: "Generate test matrix"
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class curl
|
|||||||
// which requires secur32.lib for SSL/TLS functions (SslEncryptPackage, etc.).
|
// which requires secur32.lib for SSL/TLS functions (SslEncryptPackage, etc.).
|
||||||
$extra_libs = getenv('SPC_EXTRA_LIBS') ?: '';
|
$extra_libs = getenv('SPC_EXTRA_LIBS') ?: '';
|
||||||
if (!str_contains($extra_libs, 'secur32.lib')) {
|
if (!str_contains($extra_libs, 'secur32.lib')) {
|
||||||
putenv('SPC_EXTRA_LIBS=' . trim($extra_libs . ' secur32.lib'));
|
putenv('SPC_EXTRA_LIBS=' . trim("{$extra_libs} secur32.lib"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Package\Extension;
|
|
||||||
|
|
||||||
use Package\Target\php;
|
|
||||||
use StaticPHP\Attribute\Package\BeforeStage;
|
|
||||||
use StaticPHP\Attribute\Package\Extension;
|
|
||||||
use StaticPHP\Package\PackageInstaller;
|
|
||||||
use StaticPHP\Util\FileSystem;
|
|
||||||
|
|
||||||
#[Extension('pdo_sqlite')]
|
|
||||||
class pdo_sqlite
|
|
||||||
{
|
|
||||||
#[BeforeStage('php', [php::class, 'configureForUnix'], 'ext-pdo_sqlite')]
|
|
||||||
public function patchBeforeConfigure(PackageInstaller $installer): void
|
|
||||||
{
|
|
||||||
FileSystem::replaceFileRegex(
|
|
||||||
"{$installer->getTargetPackage('php')->getSourceDir()}/configure",
|
|
||||||
'/sqlite3_column_table_name=yes/',
|
|
||||||
'sqlite3_column_table_name=no'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -50,8 +50,9 @@ class simdjson extends PhpExtensionPackage
|
|||||||
if (!str_contains((string) $extra, '-lstdc++')) {
|
if (!str_contains((string) $extra, '-lstdc++')) {
|
||||||
f_putenv('SPC_COMPILER_EXTRA=' . clean_spaces($extra . ' -lstdc++'));
|
f_putenv('SPC_COMPILER_EXTRA=' . clean_spaces($extra . ' -lstdc++'));
|
||||||
}
|
}
|
||||||
$env['CFLAGS'] .= ' -Xclang -target-feature -Xclang +evex512';
|
|
||||||
$env['CXXFLAGS'] .= ' -Xclang -target-feature -Xclang +evex512';
|
$env['CFLAGS'] .= ' -fno-sanitize=undefined -Xclang -target-feature -Xclang +evex512';
|
||||||
|
$env['CXXFLAGS'] .= ' -fno-sanitize=undefined -Xclang -target-feature -Xclang +evex512';
|
||||||
}
|
}
|
||||||
return $env;
|
return $env;
|
||||||
}
|
}
|
||||||
@@ -63,8 +64,8 @@ class simdjson extends PhpExtensionPackage
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$extra_cflags = getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS') ?: '';
|
$extra_cflags = getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS') ?: '';
|
||||||
GlobalEnvManager::putenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS=' . trim($extra_cflags . ' -Xclang -target-feature -Xclang +evex512'));
|
GlobalEnvManager::putenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS=' . trim($extra_cflags . ' -fno-sanitize=undefined -Xclang -target-feature -Xclang +evex512'));
|
||||||
$extra_cxxflags = getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CXXFLAGS') ?: '';
|
$extra_cxxflags = getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CXXFLAGS') ?: '';
|
||||||
GlobalEnvManager::putenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CXXFLAGS=' . trim($extra_cxxflags . ' -Xclang -target-feature -Xclang +evex512'));
|
GlobalEnvManager::putenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CXXFLAGS=' . trim($extra_cxxflags . ' -fno-sanitize=undefined -Xclang -target-feature -Xclang +evex512'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ class swoole extends PhpExtensionPackage
|
|||||||
if ($installer->getPhpExtensionPackage('swoole-hook-odbc') && $installer->getPhpExtensionPackage('pdo_odbc')?->isBuildStatic()) {
|
if ($installer->getPhpExtensionPackage('swoole-hook-odbc') && $installer->getPhpExtensionPackage('pdo_odbc')?->isBuildStatic()) {
|
||||||
throw new WrongUsageException('swoole-hook-odbc provides pdo_odbc, if you enable odbc hook for swoole, you must remove pdo_odbc extension.');
|
throw new WrongUsageException('swoole-hook-odbc provides pdo_odbc, if you enable odbc hook for swoole, you must remove pdo_odbc extension.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// swoole-hook-pgsql conflicts with pdo_pgsql
|
// swoole-hook-pgsql conflicts with pdo_pgsql
|
||||||
if ($installer->getPhpExtensionPackage('swoole-hook-pgsql') && $installer->getPhpExtensionPackage('pdo_pgsql')?->isBuildStatic()) {
|
if ($installer->getPhpExtensionPackage('swoole-hook-pgsql') && $installer->getPhpExtensionPackage('pdo_pgsql')?->isBuildStatic()) {
|
||||||
throw new WrongUsageException('swoole-hook-pgsql provides pdo_pgsql, if you enable pgsql hook for swoole, you must remove pdo_pgsql extension.');
|
throw new WrongUsageException('swoole-hook-pgsql provides pdo_pgsql, if you enable pgsql hook for swoole, you must remove pdo_pgsql extension.');
|
||||||
|
|||||||
@@ -27,7 +27,10 @@ class brotli
|
|||||||
{
|
{
|
||||||
UnixCMakeExecutor::create($lib)
|
UnixCMakeExecutor::create($lib)
|
||||||
->setBuildDir($lib->getSourceDir() . '/build-dir')
|
->setBuildDir($lib->getSourceDir() . '/build-dir')
|
||||||
->addConfigureArgs("-DSHARE_INSTALL_PREFIX={$lib->getBuildRootPath()}")
|
->addConfigureArgs(
|
||||||
|
"-DSHARE_INSTALL_PREFIX={$lib->getBuildRootPath()}",
|
||||||
|
'-DBROTLI_DISABLE_TESTS=ON',
|
||||||
|
)
|
||||||
->build();
|
->build();
|
||||||
|
|
||||||
// Patch pkg-config files
|
// Patch pkg-config files
|
||||||
|
|||||||
@@ -17,7 +17,9 @@ class bzip2
|
|||||||
#[PatchBeforeBuild]
|
#[PatchBeforeBuild]
|
||||||
public function patchBeforeBuild(LibraryPackage $lib): void
|
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')]
|
#[BuildFor('Windows')]
|
||||||
|
|||||||
@@ -18,9 +18,11 @@ class fastlz
|
|||||||
{
|
{
|
||||||
$cc = getenv('CC') ?: 'cc';
|
$cc = getenv('CC') ?: 'cc';
|
||||||
$ar = getenv('AR') ?: 'ar';
|
$ar = getenv('AR') ?: 'ar';
|
||||||
|
$extra = trim((string) getenv('SPC_DEFAULT_CFLAGS'));
|
||||||
|
$extra = $extra !== '' ? $extra . ' -fPIC' : '-O3 -fPIC';
|
||||||
|
|
||||||
shell()->cd($lib->getSourceDir())->initializeEnv($lib)
|
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");
|
->exec("{$ar} rcs libfastlz.a fastlz.o");
|
||||||
|
|
||||||
// Copy header file
|
// Copy header file
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ use StaticPHP\Attribute\Package\BuildFor;
|
|||||||
use StaticPHP\Attribute\Package\Library;
|
use StaticPHP\Attribute\Package\Library;
|
||||||
use StaticPHP\Package\LibraryPackage;
|
use StaticPHP\Package\LibraryPackage;
|
||||||
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
||||||
|
use StaticPHP\Runtime\SystemTarget;
|
||||||
|
|
||||||
#[Library('gmp')]
|
#[Library('gmp')]
|
||||||
class gmp
|
class gmp
|
||||||
@@ -16,10 +17,12 @@ class gmp
|
|||||||
#[BuildFor('Darwin')]
|
#[BuildFor('Darwin')]
|
||||||
public function build(LibraryPackage $lib): void
|
public function build(LibraryPackage $lib): void
|
||||||
{
|
{
|
||||||
UnixAutoconfExecutor::create($lib)
|
$make = UnixAutoconfExecutor::create($lib)->appendEnv(['CFLAGS' => '-std=c17']);
|
||||||
->appendEnv(['CFLAGS' => '-std=c17'])
|
if (SystemTarget::getTargetArch() === 'x86_64' && SystemTarget::getTargetOS() === 'Linux') {
|
||||||
->configure('--enable-fat')
|
$libc = SystemTarget::getLibc() === 'glibc' ? 'gnu' : 'musl';
|
||||||
->make();
|
$make->addConfigureArgs(["--host=x86_64-pc-linux-{$libc}"]);
|
||||||
|
}
|
||||||
|
$make->configure('--enable-fat')->make();
|
||||||
$lib->patchPkgconfPrefix(['gmp.pc']);
|
$lib->patchPkgconfPrefix(['gmp.pc']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,9 +24,12 @@ class icu
|
|||||||
#[BuildFor('Linux')]
|
#[BuildFor('Linux')]
|
||||||
public function buildLinux(LibraryPackage $lib, ToolchainInterface $toolchain, PackageBuilder $builder): void
|
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"';
|
$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"';
|
$cxxflags = "CXXFLAGS=\"-std=c++17 -DPIC -fPIC -fno-ident {$userCxxFlags}\"";
|
||||||
$ldflags = $toolchain->isStatic() ? 'LDFLAGS="-static"' : '';
|
$ldflags = $toolchain->isStatic() ? "LDFLAGS=\"-static {$userLdFlags}\"" : "LDFLAGS=\"{$userLdFlags}\"";
|
||||||
shell()->cd($lib->getSourceDir() . '/source')->initializeEnv($lib)
|
shell()->cd($lib->getSourceDir() . '/source')->initializeEnv($lib)
|
||||||
->exec(
|
->exec(
|
||||||
"{$cppflags} {$cxxflags} {$ldflags} " .
|
"{$cppflags} {$cxxflags} {$ldflags} " .
|
||||||
|
|||||||
@@ -45,6 +45,9 @@ class imagemagick
|
|||||||
// implicit --with-gcc-arch
|
// implicit --with-gcc-arch
|
||||||
// bleeds host cpu features into built binaries
|
// bleeds host cpu features into built binaries
|
||||||
'--without-gcc-arch',
|
'--without-gcc-arch',
|
||||||
|
'--disable-docs',
|
||||||
|
'--without-utilities',
|
||||||
|
'--disable-dpc',
|
||||||
);
|
);
|
||||||
|
|
||||||
// special: linux-static target needs `-static`
|
// special: linux-static target needs `-static`
|
||||||
|
|||||||
@@ -17,7 +17,9 @@ class jbig
|
|||||||
#[PatchBeforeBuild]
|
#[PatchBeforeBuild]
|
||||||
public function patchBeforeBuild(LibraryPackage $lib): void
|
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')]
|
#[BuildFor('Darwin')]
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ class ldap
|
|||||||
->optionalPackage('libsodium', '--with-argon2=libsodium', '--enable-argon2=no')
|
->optionalPackage('libsodium', '--with-argon2=libsodium', '--enable-argon2=no')
|
||||||
->addConfigureArgs(
|
->addConfigureArgs(
|
||||||
'--disable-slapd',
|
'--disable-slapd',
|
||||||
|
'--disable-debug',
|
||||||
'--without-systemd',
|
'--without-systemd',
|
||||||
'--without-cyrus-sasl',
|
'--without-cyrus-sasl',
|
||||||
'ac_cv_func_pthread_kill_other_threads_np=no'
|
'ac_cv_func_pthread_kill_other_threads_np=no'
|
||||||
|
|||||||
@@ -9,8 +9,10 @@ use StaticPHP\Attribute\Package\Library;
|
|||||||
use StaticPHP\Package\LibraryPackage;
|
use StaticPHP\Package\LibraryPackage;
|
||||||
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
||||||
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
|
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
|
||||||
|
use StaticPHP\Runtime\SystemTarget;
|
||||||
use StaticPHP\Toolchain\Interface\ToolchainInterface;
|
use StaticPHP\Toolchain\Interface\ToolchainInterface;
|
||||||
use StaticPHP\Toolchain\ZigToolchain;
|
use StaticPHP\Toolchain\ZigToolchain;
|
||||||
|
use StaticPHP\Util\System\UnixUtil;
|
||||||
|
|
||||||
#[Library('libaom')]
|
#[Library('libaom')]
|
||||||
class libaom extends LibraryPackage
|
class libaom extends LibraryPackage
|
||||||
@@ -39,9 +41,23 @@ class libaom extends LibraryPackage
|
|||||||
$new = trim($extra . ' -D_GNU_SOURCE');
|
$new = trim($extra . ' -D_GNU_SOURCE');
|
||||||
f_putenv("SPC_COMPILER_EXTRA={$new}");
|
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)
|
UnixCMakeExecutor::create($this)
|
||||||
->setBuildDir("{$this->getSourceDir()}/builddir")
|
->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();
|
->build();
|
||||||
f_putenv("SPC_COMPILER_EXTRA={$extra}");
|
f_putenv("SPC_COMPILER_EXTRA={$extra}");
|
||||||
$this->patchPkgconfPrefix(['aom.pc']);
|
$this->patchPkgconfPrefix(['aom.pc']);
|
||||||
|
|||||||
@@ -35,7 +35,12 @@ class libavif
|
|||||||
->optionalPackage('libjpeg', '-DAVIF_JPEG=SYSTEM', '-DAVIF_JPEG=OFF')
|
->optionalPackage('libjpeg', '-DAVIF_JPEG=SYSTEM', '-DAVIF_JPEG=OFF')
|
||||||
->optionalPackage('libxml2', '-DAVIF_LIBXML2=SYSTEM', '-DAVIF_LIBXML2=OFF')
|
->optionalPackage('libxml2', '-DAVIF_LIBXML2=SYSTEM', '-DAVIF_LIBXML2=OFF')
|
||||||
->optionalPackage('libpng', '-DAVIF_LIBPNG=SYSTEM', '-DAVIF_LIBPNG=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();
|
->build();
|
||||||
// patch pkgconfig
|
// patch pkgconfig
|
||||||
$lib->patchPkgconfPrefix(['libavif.pc']);
|
$lib->patchPkgconfPrefix(['libavif.pc']);
|
||||||
@@ -49,7 +54,7 @@ class libavif
|
|||||||
'-DAVIF_BUILD_APPS=OFF',
|
'-DAVIF_BUILD_APPS=OFF',
|
||||||
'-DAVIF_BUILD_TESTS=OFF',
|
'-DAVIF_BUILD_TESTS=OFF',
|
||||||
'-DAVIF_LIBYUV=OFF',
|
'-DAVIF_LIBYUV=OFF',
|
||||||
'-DAVIF_ENABLE_GTEST=OFF',
|
'-DAVIF_GTEST=OFF',
|
||||||
)
|
)
|
||||||
->build();
|
->build();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ class libde265 extends LibraryPackage
|
|||||||
->addConfigureArgs(
|
->addConfigureArgs(
|
||||||
'-DENABLE_SDL=OFF',
|
'-DENABLE_SDL=OFF',
|
||||||
'-DENABLE_DECODER=OFF',
|
'-DENABLE_DECODER=OFF',
|
||||||
|
'-DENABLE_SIMD=OFF',
|
||||||
'-DHAVE_NEON=OFF',
|
'-DHAVE_NEON=OFF',
|
||||||
)
|
)
|
||||||
->build();
|
->build();
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class libffi extends LibraryPackage
|
|||||||
public function buildLinux(): void
|
public function buildLinux(): void
|
||||||
{
|
{
|
||||||
UnixAutoconfExecutor::create($this)
|
UnixAutoconfExecutor::create($this)
|
||||||
->configure()->make();
|
->configure('--disable-docs')->make();
|
||||||
|
|
||||||
if (is_file("{$this->getBuildRootPath()}/lib64/libffi.a")) {
|
if (is_file("{$this->getBuildRootPath()}/lib64/libffi.a")) {
|
||||||
copy("{$this->getBuildRootPath()}/lib64/libffi.a", "{$this->getBuildRootPath()}/lib/libffi.a");
|
copy("{$this->getBuildRootPath()}/lib64/libffi.a", "{$this->getBuildRootPath()}/lib/libffi.a");
|
||||||
@@ -33,6 +33,7 @@ class libffi extends LibraryPackage
|
|||||||
->configure(
|
->configure(
|
||||||
"--host={$arch}-apple-darwin",
|
"--host={$arch}-apple-darwin",
|
||||||
"--target={$arch}-apple-darwin",
|
"--target={$arch}-apple-darwin",
|
||||||
|
'--disable-docs',
|
||||||
)
|
)
|
||||||
->make();
|
->make();
|
||||||
$this->patchPkgconfPrefix(['libffi.pc']);
|
$this->patchPkgconfPrefix(['libffi.pc']);
|
||||||
|
|||||||
@@ -24,6 +24,17 @@ class libheif
|
|||||||
'list(APPEND REQUIRES_PRIVATE "libbrotlidec")' . "\n" . ' list(APPEND REQUIRES_PRIVATE "libbrotlienc")'
|
'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')]
|
#[BuildFor('Darwin')]
|
||||||
@@ -36,6 +47,7 @@ class libheif
|
|||||||
'-DWITH_EXAMPLES=OFF',
|
'-DWITH_EXAMPLES=OFF',
|
||||||
'-DWITH_GDK_PIXBUF=OFF',
|
'-DWITH_GDK_PIXBUF=OFF',
|
||||||
'-DBUILD_TESTING=OFF',
|
'-DBUILD_TESTING=OFF',
|
||||||
|
'-DBUILD_DOCUMENTATION=OFF',
|
||||||
'-DWITH_LIBSHARPYUV=ON', // optional: libwebp
|
'-DWITH_LIBSHARPYUV=ON', // optional: libwebp
|
||||||
'-DENABLE_PLUGIN_LOADING=OFF',
|
'-DENABLE_PLUGIN_LOADING=OFF',
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ class libjxl extends LibraryPackage
|
|||||||
'-DJPEGXL_ENABLE_MANPAGES=OFF',
|
'-DJPEGXL_ENABLE_MANPAGES=OFF',
|
||||||
'-DJPEGXL_ENABLE_BENCHMARK=OFF',
|
'-DJPEGXL_ENABLE_BENCHMARK=OFF',
|
||||||
'-DJPEGXL_ENABLE_PLUGINS=OFF',
|
'-DJPEGXL_ENABLE_PLUGINS=OFF',
|
||||||
|
'-DJPEGXL_ENABLE_DOXYGEN=OFF',
|
||||||
'-DJPEGXL_ENABLE_SJPEG=ON',
|
'-DJPEGXL_ENABLE_SJPEG=ON',
|
||||||
'-DJPEGXL_ENABLE_JNI=OFF',
|
'-DJPEGXL_ENABLE_JNI=OFF',
|
||||||
'-DJPEGXL_ENABLE_TRANSCODE_JPEG=ON',
|
'-DJPEGXL_ENABLE_TRANSCODE_JPEG=ON',
|
||||||
|
|||||||
@@ -12,17 +12,25 @@ use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
|||||||
#[Library('libmemcached')]
|
#[Library('libmemcached')]
|
||||||
class libmemcached extends LibraryPackage
|
class libmemcached extends LibraryPackage
|
||||||
{
|
{
|
||||||
|
private const array DISABLE_ARGS = [
|
||||||
|
'-DBUILD_TESTING=OFF',
|
||||||
|
'-DBUILD_DOCS=OFF',
|
||||||
|
'-DENABLE_MEMASLAP=OFF',
|
||||||
|
];
|
||||||
|
|
||||||
#[BuildFor('Linux')]
|
#[BuildFor('Linux')]
|
||||||
public function buildLinux(): void
|
public function buildLinux(): void
|
||||||
{
|
{
|
||||||
UnixCMakeExecutor::create($this)
|
UnixCMakeExecutor::create($this)
|
||||||
->addConfigureArgs('-DCMAKE_INSTALL_RPATH=""')
|
->addConfigureArgs('-DCMAKE_INSTALL_RPATH=""', ...self::DISABLE_ARGS)
|
||||||
->build();
|
->build();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[BuildFor('Darwin')]
|
#[BuildFor('Darwin')]
|
||||||
public function buildDarwin(): void
|
public function buildDarwin(): void
|
||||||
{
|
{
|
||||||
UnixCMakeExecutor::create($this)->build();
|
UnixCMakeExecutor::create($this)
|
||||||
|
->addConfigureArgs(...self::DISABLE_ARGS)
|
||||||
|
->build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ class libpng
|
|||||||
{
|
{
|
||||||
$args = [
|
$args = [
|
||||||
'--enable-hardware-optimizations',
|
'--enable-hardware-optimizations',
|
||||||
|
'--disable-tests',
|
||||||
|
'--disable-tools',
|
||||||
"--with-zlib-prefix={$lib->getBuildRootPath()}",
|
"--with-zlib-prefix={$lib->getBuildRootPath()}",
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -13,17 +13,29 @@ use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
|
|||||||
#[Library('librabbitmq')]
|
#[Library('librabbitmq')]
|
||||||
class librabbitmq extends LibraryPackage
|
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('Darwin')]
|
||||||
#[BuildFor('Linux')]
|
#[BuildFor('Linux')]
|
||||||
public function buildUnix(): void
|
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')]
|
#[BuildFor('Windows')]
|
||||||
public function buildWin(): void
|
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");
|
rename("{$this->getLibDir()}\\librabbitmq.4.lib", "{$this->getLibDir()}\\rabbitmq.4.lib");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,9 @@ class libtiff
|
|||||||
'--disable-libdeflate',
|
'--disable-libdeflate',
|
||||||
'--disable-tools',
|
'--disable-tools',
|
||||||
'--disable-contrib',
|
'--disable-contrib',
|
||||||
|
'--disable-tests',
|
||||||
|
'--disable-docs',
|
||||||
|
'--disable-sphinx',
|
||||||
'--disable-cxx',
|
'--disable-cxx',
|
||||||
'--without-x',
|
'--without-x',
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -13,12 +13,18 @@ use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
|
|||||||
#[Library('libuv')]
|
#[Library('libuv')]
|
||||||
class libuv
|
class libuv
|
||||||
{
|
{
|
||||||
|
private const array DISABLE_ARGS = [
|
||||||
|
'-DLIBUV_BUILD_SHARED=OFF',
|
||||||
|
'-DLIBUV_BUILD_TESTS=OFF',
|
||||||
|
'-DLIBUV_BUILD_BENCH=OFF',
|
||||||
|
];
|
||||||
|
|
||||||
#[BuildFor('Darwin')]
|
#[BuildFor('Darwin')]
|
||||||
#[BuildFor('Linux')]
|
#[BuildFor('Linux')]
|
||||||
public function buildUnix(LibraryPackage $lib): void
|
public function buildUnix(LibraryPackage $lib): void
|
||||||
{
|
{
|
||||||
UnixCMakeExecutor::create($lib)
|
UnixCMakeExecutor::create($lib)
|
||||||
->addConfigureArgs('-DLIBUV_BUILD_SHARED=OFF')
|
->addConfigureArgs(...self::DISABLE_ARGS)
|
||||||
->build();
|
->build();
|
||||||
// patch pkgconfig
|
// patch pkgconfig
|
||||||
$lib->patchPkgconfPrefix(['libuv-static.pc']);
|
$lib->patchPkgconfPrefix(['libuv-static.pc']);
|
||||||
@@ -28,7 +34,7 @@ class libuv
|
|||||||
public function buildWindows(LibraryPackage $lib): void
|
public function buildWindows(LibraryPackage $lib): void
|
||||||
{
|
{
|
||||||
WindowsCMakeExecutor::create($lib)
|
WindowsCMakeExecutor::create($lib)
|
||||||
->addConfigureArgs('-DLIBUV_BUILD_SHARED=OFF')
|
->addConfigureArgs(...self::DISABLE_ARGS)
|
||||||
->build();
|
->build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ class libxslt
|
|||||||
'--without-crypto',
|
'--without-crypto',
|
||||||
'--without-debug',
|
'--without-debug',
|
||||||
'--without-debugger',
|
'--without-debugger',
|
||||||
|
'--without-profiler',
|
||||||
"--with-libxml-prefix={$lib->getBuildRootPath()}",
|
"--with-libxml-prefix={$lib->getBuildRootPath()}",
|
||||||
);
|
);
|
||||||
if (getenv('SPC_LD_LIBRARY_PATH') && getenv('SPC_LIBRARY_PATH')) {
|
if (getenv('SPC_LD_LIBRARY_PATH') && getenv('SPC_LIBRARY_PATH')) {
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ class mimalloc
|
|||||||
->addConfigureArgs(
|
->addConfigureArgs(
|
||||||
'-DMI_BUILD_SHARED=OFF',
|
'-DMI_BUILD_SHARED=OFF',
|
||||||
'-DMI_BUILD_OBJECT=OFF',
|
'-DMI_BUILD_OBJECT=OFF',
|
||||||
|
'-DMI_BUILD_TESTS=OFF',
|
||||||
'-DMI_INSTALL_TOPLEVEL=ON',
|
'-DMI_INSTALL_TOPLEVEL=ON',
|
||||||
);
|
);
|
||||||
if (SystemTarget::getLibc() === 'musl') {
|
if (SystemTarget::getLibc() === 'musl') {
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ namespace Package\Library;
|
|||||||
|
|
||||||
use StaticPHP\Attribute\Package\BuildFor;
|
use StaticPHP\Attribute\Package\BuildFor;
|
||||||
use StaticPHP\Attribute\Package\Library;
|
use StaticPHP\Attribute\Package\Library;
|
||||||
|
use StaticPHP\Attribute\Package\PatchBeforeBuild;
|
||||||
|
use StaticPHP\Attribute\PatchDescription;
|
||||||
use StaticPHP\Package\LibraryPackage;
|
use StaticPHP\Package\LibraryPackage;
|
||||||
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
||||||
use StaticPHP\Toolchain\Interface\ToolchainInterface;
|
use StaticPHP\Toolchain\Interface\ToolchainInterface;
|
||||||
@@ -16,6 +18,24 @@ use StaticPHP\Util\FileSystem;
|
|||||||
#[Library('ncursesw')]
|
#[Library('ncursesw')]
|
||||||
class ncurses
|
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('Darwin')]
|
||||||
#[BuildFor('Linux')]
|
#[BuildFor('Linux')]
|
||||||
public function build(LibraryPackage $package, ToolchainInterface $toolchain): void
|
public function build(LibraryPackage $package, ToolchainInterface $toolchain): void
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ class nghttp3
|
|||||||
'-DBUILD_SHARED_LIBS=OFF',
|
'-DBUILD_SHARED_LIBS=OFF',
|
||||||
'-DENABLE_STATIC_CRT=ON',
|
'-DENABLE_STATIC_CRT=ON',
|
||||||
'-DENABLE_LIB_ONLY=ON',
|
'-DENABLE_LIB_ONLY=ON',
|
||||||
|
'-DBUILD_TESTING=OFF',
|
||||||
)
|
)
|
||||||
->build();
|
->build();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ class ngtcp2
|
|||||||
'-DENABLE_STATIC_CRT=ON',
|
'-DENABLE_STATIC_CRT=ON',
|
||||||
'-DENABLE_LIB_ONLY=ON',
|
'-DENABLE_LIB_ONLY=ON',
|
||||||
'-DENABLE_OPENSSL=OFF',
|
'-DENABLE_OPENSSL=OFF',
|
||||||
|
'-DBUILD_TESTING=OFF',
|
||||||
)
|
)
|
||||||
->build();
|
->build();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,6 +111,12 @@ class openssl
|
|||||||
$openssl_dir ??= LinuxUtil::getOSRelease()['dist'] === 'redhat' ? '/etc/pki/tls' : '/etc/ssl';
|
$openssl_dir ??= LinuxUtil::getOSRelease()['dist'] === 'redhat' ? '/etc/pki/tls' : '/etc/ssl';
|
||||||
$ex_lib = trim($ex_lib);
|
$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)
|
shell()->cd($lib->getSourceDir())->initializeEnv($lib)
|
||||||
->exec(
|
->exec(
|
||||||
"{$env} ./Configure no-shared zlib " .
|
"{$env} ./Configure no-shared zlib " .
|
||||||
@@ -121,7 +127,8 @@ class openssl
|
|||||||
'enable-pie ' .
|
'enable-pie ' .
|
||||||
'no-legacy ' .
|
'no-legacy ' .
|
||||||
'no-tests ' .
|
'no-tests ' .
|
||||||
"linux-{$arch}"
|
"linux-{$arch} " .
|
||||||
|
$userExtra
|
||||||
)
|
)
|
||||||
->exec('make clean')
|
->exec('make clean')
|
||||||
->exec("make -j{$lib->getBuilder()->concurrency} CNF_EX_LIBS=\"{$ex_lib}\"")
|
->exec("make -j{$lib->getBuilder()->concurrency} CNF_EX_LIBS=\"{$ex_lib}\"")
|
||||||
|
|||||||
@@ -20,6 +20,11 @@ class qdbm
|
|||||||
{
|
{
|
||||||
$ac = UnixAutoconfExecutor::create($lib)->configure();
|
$ac = UnixAutoconfExecutor::create($lib)->configure();
|
||||||
FileSystem::replaceFileRegex($lib->getSourceDir() . '/Makefile', '/MYLIBS = libqdbm.a.*/m', 'MYLIBS = libqdbm.a');
|
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' : '');
|
$ac->make(SystemTarget::getTargetOS() === 'Darwin' ? 'mac' : '');
|
||||||
$lib->patchPkgconfPrefix(['qdbm.pc']);
|
$lib->patchPkgconfPrefix(['qdbm.pc']);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ class readline
|
|||||||
->configure(
|
->configure(
|
||||||
'--with-curses',
|
'--with-curses',
|
||||||
'--enable-multibyte=yes',
|
'--enable-multibyte=yes',
|
||||||
|
'--disable-install-examples',
|
||||||
)
|
)
|
||||||
->make();
|
->make();
|
||||||
$lib->patchPkgconfPrefix(['readline.pc']);
|
$lib->patchPkgconfPrefix(['readline.pc']);
|
||||||
|
|||||||
@@ -19,7 +19,12 @@ class sqlite
|
|||||||
#[BuildFor('Linux')]
|
#[BuildFor('Linux')]
|
||||||
public function buildUnix(LibraryPackage $lib): void
|
public function buildUnix(LibraryPackage $lib): void
|
||||||
{
|
{
|
||||||
UnixAutoconfExecutor::create($lib)->configure()->make();
|
UnixAutoconfExecutor::create($lib)
|
||||||
|
->appendEnv([
|
||||||
|
'CFLAGS' => '-DSQLITE_ENABLE_COLUMN_METADATA=1',
|
||||||
|
])
|
||||||
|
->configure()
|
||||||
|
->make();
|
||||||
$lib->patchPkgconfPrefix(['sqlite3.pc']);
|
$lib->patchPkgconfPrefix(['sqlite3.pc']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,8 @@ class tidy
|
|||||||
->setBuildDir("{$lib->getSourceDir()}/build-dir")
|
->setBuildDir("{$lib->getSourceDir()}/build-dir")
|
||||||
->addConfigureArgs(
|
->addConfigureArgs(
|
||||||
'-DSUPPORT_CONSOLE_APP=OFF',
|
'-DSUPPORT_CONSOLE_APP=OFF',
|
||||||
'-DBUILD_SHARED_LIB=OFF'
|
'-DBUILD_SHARED_LIB=OFF',
|
||||||
|
'-DSUPPORT_LOCALIZATIONS=OFF',
|
||||||
);
|
);
|
||||||
if (version_compare(get_cmake_version(), '4.0.0', '>=')) {
|
if (version_compare(get_cmake_version(), '4.0.0', '>=')) {
|
||||||
$cmake->addConfigureArgs('-DCMAKE_POLICY_VERSION_MINIMUM=3.5');
|
$cmake->addConfigureArgs('-DCMAKE_POLICY_VERSION_MINIMUM=3.5');
|
||||||
@@ -38,7 +39,8 @@ class tidy
|
|||||||
->setBuildDir("{$lib->getSourceDir()}/build-dir")
|
->setBuildDir("{$lib->getSourceDir()}/build-dir")
|
||||||
->addConfigureArgs(
|
->addConfigureArgs(
|
||||||
'-DSUPPORT_CONSOLE_APP=OFF',
|
'-DSUPPORT_CONSOLE_APP=OFF',
|
||||||
'-DBUILD_SHARED_LIB=OFF'
|
'-DBUILD_SHARED_LIB=OFF',
|
||||||
|
'-DSUPPORT_LOCALIZATIONS=OFF',
|
||||||
)->build();
|
)->build();
|
||||||
|
|
||||||
// rename tidy_static.lib to tidy_a.lib
|
// rename tidy_static.lib to tidy_a.lib
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ class unixodbc extends LibraryPackage
|
|||||||
'--with-included-ltdl',
|
'--with-included-ltdl',
|
||||||
"--sysconfdir={$sysconf_selector}",
|
"--sysconfdir={$sysconf_selector}",
|
||||||
'--enable-gui=no',
|
'--enable-gui=no',
|
||||||
|
'--enable-readline=no',
|
||||||
)
|
)
|
||||||
->make();
|
->make();
|
||||||
$this->patchPkgconfPrefix(['odbc.pc', 'odbccr.pc', 'odbcinst.pc']);
|
$this->patchPkgconfPrefix(['odbc.pc', 'odbccr.pc', 'odbcinst.pc']);
|
||||||
|
|||||||
@@ -22,6 +22,11 @@ class xz
|
|||||||
->configure(
|
->configure(
|
||||||
'--disable-scripts',
|
'--disable-scripts',
|
||||||
'--disable-doc',
|
'--disable-doc',
|
||||||
|
'--disable-xz',
|
||||||
|
'--disable-xzdec',
|
||||||
|
'--disable-lzmadec',
|
||||||
|
'--disable-lzmainfo',
|
||||||
|
'--disable-lzma-links',
|
||||||
'--with-libiconv',
|
'--with-libiconv',
|
||||||
'--bindir=/tmp/xz', // xz binary will corrupt `tar` command, that's really strange.
|
'--bindir=/tmp/xz', // xz binary will corrupt `tar` command, that's really strange.
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -14,16 +14,20 @@ use StaticPHP\Util\FileSystem;
|
|||||||
#[Library('zstd')]
|
#[Library('zstd')]
|
||||||
class 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')]
|
#[BuildFor('Windows')]
|
||||||
public function buildWin(LibraryPackage $package): void
|
public function buildWin(LibraryPackage $package): void
|
||||||
{
|
{
|
||||||
WindowsCMakeExecutor::create($package)
|
WindowsCMakeExecutor::create($package)
|
||||||
->setWorkingDir("{$package->getSourceDir()}/build/cmake")
|
->setWorkingDir("{$package->getSourceDir()}/build/cmake")
|
||||||
->setBuildDir("{$package->getSourceDir()}/build/cmake/build")
|
->setBuildDir("{$package->getSourceDir()}/build/cmake/build")
|
||||||
->addConfigureArgs(
|
->addConfigureArgs(...self::DISABLE_ARGS)
|
||||||
'-DZSTD_BUILD_STATIC=ON',
|
|
||||||
'-DZSTD_BUILD_SHARED=OFF',
|
|
||||||
)
|
|
||||||
->build();
|
->build();
|
||||||
FileSystem::copy($package->getLibDir() . '\zstd_static.lib', $package->getLibDir() . '/zstd.lib');
|
FileSystem::copy($package->getLibDir() . '\zstd_static.lib', $package->getLibDir() . '/zstd.lib');
|
||||||
FileSystem::copy($package->getLibDir() . '\zstd_static.lib', $package->getLibDir() . '/libzstd.lib');
|
FileSystem::copy($package->getLibDir() . '\zstd_static.lib', $package->getLibDir() . '/libzstd.lib');
|
||||||
@@ -35,10 +39,7 @@ class zstd
|
|||||||
{
|
{
|
||||||
UnixCMakeExecutor::create($lib)
|
UnixCMakeExecutor::create($lib)
|
||||||
->setBuildDir("{$lib->getSourceDir()}/build/cmake/build")
|
->setBuildDir("{$lib->getSourceDir()}/build/cmake/build")
|
||||||
->addConfigureArgs(
|
->addConfigureArgs(...self::DISABLE_ARGS)
|
||||||
'-DZSTD_BUILD_STATIC=ON',
|
|
||||||
'-DZSTD_BUILD_SHARED=OFF',
|
|
||||||
)
|
|
||||||
->build();
|
->build();
|
||||||
|
|
||||||
$lib->patchPkgconfPrefix(['libzstd.pc'], PKGCONF_PATCH_PREFIX);
|
$lib->patchPkgconfPrefix(['libzstd.pc'], PKGCONF_PATCH_PREFIX);
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ class curl
|
|||||||
'-DZSTD_LIBRARY=' . BUILD_LIB_PATH . '/zstd_static.lib',
|
'-DZSTD_LIBRARY=' . BUILD_LIB_PATH . '/zstd_static.lib',
|
||||||
'-DBUILD_TESTING=OFF',
|
'-DBUILD_TESTING=OFF',
|
||||||
'-DBUILD_EXAMPLES=OFF',
|
'-DBUILD_EXAMPLES=OFF',
|
||||||
|
'-DBUILD_LIBCURL_DOCS=OFF',
|
||||||
|
'-DENABLE_CURL_MANUAL=OFF',
|
||||||
'-DUSE_LIBIDN2=OFF',
|
'-DUSE_LIBIDN2=OFF',
|
||||||
'-DCURL_USE_LIBPSL=OFF',
|
'-DCURL_USE_LIBPSL=OFF',
|
||||||
'-DUSE_WINDOWS_SSPI=ON',
|
'-DUSE_WINDOWS_SSPI=ON',
|
||||||
@@ -81,6 +83,9 @@ class curl
|
|||||||
->addConfigureArgs(
|
->addConfigureArgs(
|
||||||
'-DBUILD_CURL_EXE=ON',
|
'-DBUILD_CURL_EXE=ON',
|
||||||
'-DBUILD_LIBCURL_DOCS=OFF',
|
'-DBUILD_LIBCURL_DOCS=OFF',
|
||||||
|
'-DBUILD_TESTING=OFF',
|
||||||
|
'-DBUILD_EXAMPLES=OFF',
|
||||||
|
'-DENABLE_CURL_MANUAL=OFF',
|
||||||
'-DOPENSSL_ROOT_DIR=' . BUILD_ROOT_PATH,
|
'-DOPENSSL_ROOT_DIR=' . BUILD_ROOT_PATH,
|
||||||
)
|
)
|
||||||
->build();
|
->build();
|
||||||
|
|||||||
@@ -107,7 +107,12 @@ class GenExtTestMatrixCommand extends BaseCommand
|
|||||||
// Separate into regular and virtual extensions (build-static:false excluded globally)
|
// Separate into regular and virtual extensions (build-static:false excluded globally)
|
||||||
$all_regular = [];
|
$all_regular = [];
|
||||||
$all_virtual = [];
|
$all_virtual = [];
|
||||||
|
$all_libraries = [];
|
||||||
foreach ($all as $pkg_name => $config) {
|
foreach ($all as $pkg_name => $config) {
|
||||||
|
if (($config['type'] ?? '') === 'library') {
|
||||||
|
$all_libraries[$pkg_name] = $config;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (($config['type'] ?? '') !== 'php-extension') {
|
if (($config['type'] ?? '') !== 'php-extension') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -154,10 +159,7 @@ class GenExtTestMatrixCommand extends BaseCommand
|
|||||||
$raw,
|
$raw,
|
||||||
fn ($d) => isset($pool_set[$d]) && $d !== $pkg_name
|
fn ($d) => isset($pool_set[$d]) && $d !== $pkg_name
|
||||||
));
|
));
|
||||||
$os_lib_deps[$this->displayName($pkg_name)] = array_values(array_filter(
|
$os_lib_deps[$this->displayName($pkg_name)] = $this->collectLibraryDeps($raw, $all_libraries, $os);
|
||||||
$raw,
|
|
||||||
fn ($d) => !str_starts_with($d, 'ext-')
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
$all_ext_lib_deps[$os] = $os_lib_deps;
|
$all_ext_lib_deps[$os] = $os_lib_deps;
|
||||||
|
|
||||||
@@ -246,22 +248,23 @@ class GenExtTestMatrixCommand extends BaseCommand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($filter_extensions)) {
|
if (!empty($filter_extensions) || !empty($filter_libs)) {
|
||||||
$entries = array_values(array_filter($entries, function (array $entry) use ($filter_extensions): bool {
|
$entries = array_values(array_filter($entries, function (array $entry) use ($filter_extensions, $filter_libs, $all_ext_lib_deps): bool {
|
||||||
$names = explode(',', $entry['extension']);
|
$names = explode(',', $entry['extension']);
|
||||||
return count(array_intersect($names, $filter_extensions)) > 0;
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($filter_libs)) {
|
if (!empty($filter_extensions) && count(array_intersect($names, $filter_extensions)) > 0) {
|
||||||
$entries = array_values(array_filter($entries, function (array $entry) use ($filter_libs, $all_ext_lib_deps): bool {
|
return true;
|
||||||
$names = explode(',', $entry['extension']);
|
}
|
||||||
$lib_deps = $all_ext_lib_deps[$entry['os']] ?? [];
|
|
||||||
foreach ($names as $name) {
|
if (!empty($filter_libs)) {
|
||||||
if (count(array_intersect($lib_deps[$name] ?? [], $filter_libs)) > 0) {
|
$lib_deps = $all_ext_lib_deps[$entry['os']] ?? [];
|
||||||
return true;
|
foreach ($names as $name) {
|
||||||
|
if (count(array_intersect($lib_deps[$name] ?? [], $filter_libs)) > 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@@ -300,6 +303,41 @@ class GenExtTestMatrixCommand extends BaseCommand
|
|||||||
return str_starts_with($pkg_name, 'ext-') ? substr($pkg_name, 4) : $pkg_name;
|
return str_starts_with($pkg_name, 'ext-') ? substr($pkg_name, 4) : $pkg_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Collect direct and transitive library dependencies from a package dependency list.
|
||||||
|
*
|
||||||
|
* @param string[] $deps
|
||||||
|
* @param array<string, mixed[]> $library_configs
|
||||||
|
* @param array<string, true> $seen
|
||||||
|
*
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
private function collectLibraryDeps(array $deps, array $library_configs, string $platform, array $seen = []): array
|
||||||
|
{
|
||||||
|
$collected = [];
|
||||||
|
foreach ($deps as $dep) {
|
||||||
|
if (str_starts_with($dep, 'ext-') || isset($seen[$dep])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$seen[$dep] = true;
|
||||||
|
$collected[$dep] = $dep;
|
||||||
|
|
||||||
|
if (!isset($library_configs[$dep])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$child_deps = array_merge(
|
||||||
|
$this->resolvePlatformList($library_configs[$dep], 'depends', $platform),
|
||||||
|
$this->resolvePlatformList($library_configs[$dep], 'suggests', $platform),
|
||||||
|
);
|
||||||
|
foreach ($this->collectLibraryDeps($child_deps, $library_configs, $platform, $seen) as $child_dep) {
|
||||||
|
$collected[$child_dep] = $child_dep;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return array_values($collected);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Split orphans into batches such that no two conflicting extensions share a batch.
|
* Split orphans into batches such that no two conflicting extensions share a batch.
|
||||||
* Uses a greedy graph-coloring approach.
|
* Uses a greedy graph-coloring approach.
|
||||||
|
|||||||
16
src/globals/ext-tests/pdo_sqlite.php
Normal file
16
src/globals/ext-tests/pdo_sqlite.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
$pdo = new PDO('sqlite::memory:');
|
||||||
|
$pdo->exec('CREATE TABLE spc_column_metadata_test (id INTEGER)');
|
||||||
|
|
||||||
|
$stmt = $pdo->query('SELECT id FROM spc_column_metadata_test');
|
||||||
|
if ($stmt === false) {
|
||||||
|
throw new RuntimeException('Failed to query SQLite metadata test table.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$metadata = $stmt->getColumnMeta(0);
|
||||||
|
if (($metadata['table'] ?? null) !== 'spc_column_metadata_test') {
|
||||||
|
throw new RuntimeException('PDO SQLite column metadata does not include the origin table.');
|
||||||
|
}
|
||||||
10
src/globals/ext-tests/sqlite3.php
Normal file
10
src/globals/ext-tests/sqlite3.php
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
$sqlite = new SQLite3(':memory:');
|
||||||
|
$enabled = $sqlite->querySingle("SELECT sqlite_compileoption_used('ENABLE_COLUMN_METADATA')");
|
||||||
|
|
||||||
|
if ((int) $enabled !== 1) {
|
||||||
|
throw new RuntimeException('SQLite was not built with SQLITE_ENABLE_COLUMN_METADATA.');
|
||||||
|
}
|
||||||
@@ -176,6 +176,31 @@ class GenExtTestMatrixCommandTest extends TestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* --for-libs must include extensions that depend on the library through other libraries.
|
||||||
|
*/
|
||||||
|
public function testForLibsFilterIncludesTransitiveLibraryDeps(): void
|
||||||
|
{
|
||||||
|
$matrix = $this->runMatrix(['--os' => 'Linux', '--for-libs' => 'libde265']);
|
||||||
|
|
||||||
|
$this->assertNotEmpty($matrix, '--for-libs=libde265 must yield at least one entry');
|
||||||
|
foreach ($matrix as $entry) {
|
||||||
|
$parts = explode(',', $entry['extension']);
|
||||||
|
$this->assertContains('imagick', $parts, "Entry {$entry['extension']} should not appear in --for-libs=libde265 results");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Multiple filters should include entries matching any changed package.
|
||||||
|
*/
|
||||||
|
public function testExtensionAndLibraryFiltersAreCombinedAsUnion(): void
|
||||||
|
{
|
||||||
|
$matrix = $this->runMatrix(['--os' => 'Linux', '--for-extensions' => 'simdjson', '--for-libs' => 'libde265']);
|
||||||
|
|
||||||
|
$this->assertNotEmpty($this->findEntriesContaining($matrix, 'simdjson'), 'simdjson entry must be included');
|
||||||
|
$this->assertNotEmpty($this->findEntriesContaining($matrix, 'imagick'), 'imagick entry must be included through libde265');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* --tier2 must produce only Tier2 runners and no Windows entries.
|
* --tier2 must produce only Tier2 runners and no Windows entries.
|
||||||
*/
|
*/
|
||||||
@@ -258,14 +283,17 @@ class GenExtTestMatrixCommandTest extends TestCase
|
|||||||
* - ext-swoole-hook-* virtual (arg-type: none) — must be bundled with swoole
|
* - ext-swoole-hook-* virtual (arg-type: none) — must be bundled with swoole
|
||||||
* - ext-curl simple orphan, depended on by swoole but must NOT be pulled into swoole entry
|
* - ext-curl simple orphan, depended on by swoole but must NOT be pulled into swoole entry
|
||||||
* - ext-redis simple orphan
|
* - ext-redis simple orphan
|
||||||
|
* - ext-simdjson simple orphan used for combined filter tests
|
||||||
* - ext-xml depends on lib 'libxml2'
|
* - ext-xml depends on lib 'libxml2'
|
||||||
* - ext-dom depends on ext-xml (DFS chain)
|
* - ext-dom depends on ext-xml (DFS chain)
|
||||||
|
* - ext-imagick depends on imagemagick -> libheif -> libde265
|
||||||
* - ext-linux-only restricted to Linux via os: [Linux]
|
* - ext-linux-only restricted to Linux via os: [Linux]
|
||||||
*/
|
*/
|
||||||
private static function buildFixture(): array
|
private static function buildFixture(): array
|
||||||
{
|
{
|
||||||
// php-extension must be a non-empty assoc array ([] fails is_assoc_array() check).
|
// php-extension must be a non-empty assoc array ([] fails is_assoc_array() check).
|
||||||
$ext = static fn (array $phpExt = ['arg-type' => 'standard'], array $topLevel = []): array => array_merge(['type' => 'php-extension', 'php-extension' => $phpExt], $topLevel);
|
$ext = static fn (array $phpExt = ['arg-type' => 'standard'], array $topLevel = []): array => array_merge(['type' => 'php-extension', 'php-extension' => $phpExt], $topLevel);
|
||||||
|
$lib = static fn (array $topLevel = []): array => array_merge(['type' => 'library', 'artifact' => ['source' => 'custom']], $topLevel);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
// Isolated standalones
|
// Isolated standalones
|
||||||
@@ -279,11 +307,18 @@ class GenExtTestMatrixCommandTest extends TestCase
|
|||||||
// Simple orphans
|
// Simple orphans
|
||||||
'ext-curl' => $ext(),
|
'ext-curl' => $ext(),
|
||||||
'ext-redis' => $ext(),
|
'ext-redis' => $ext(),
|
||||||
|
'ext-simdjson' => $ext(),
|
||||||
|
|
||||||
// DFS chain: dom depends on xml; xml depends on lib 'libxml2'
|
// DFS chain: dom depends on xml; xml depends on lib 'libxml2'
|
||||||
'ext-xml' => $ext(['arg-type' => 'standard'], ['depends' => ['libxml2']]),
|
'ext-xml' => $ext(['arg-type' => 'standard'], ['depends' => ['libxml2']]),
|
||||||
'ext-dom' => $ext(['arg-type' => 'standard'], ['depends' => ['ext-xml']]),
|
'ext-dom' => $ext(['arg-type' => 'standard'], ['depends' => ['ext-xml']]),
|
||||||
|
|
||||||
|
// Transitive library chain: imagick -> imagemagick -> libheif -> libde265
|
||||||
|
'ext-imagick' => $ext(['arg-type' => 'standard'], ['depends' => ['imagemagick']]),
|
||||||
|
'imagemagick' => $lib(['depends' => ['libheif']]),
|
||||||
|
'libheif' => $lib(['depends' => ['libde265']]),
|
||||||
|
'libde265' => $lib(),
|
||||||
|
|
||||||
// OS-restricted to Linux only
|
// OS-restricted to Linux only
|
||||||
'ext-linux-only' => $ext(['os' => ['Linux']]),
|
'ext-linux-only' => $ext(['os' => ['Linux']]),
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user