Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
eff4620
add --pgi and --pgo to facilitate PGO builds
henderkes Apr 27, 2026
b536d0c
lint
henderkes Apr 27, 2026
b5dca48
exit handlers patch instead of continuous
henderkes Apr 28, 2026
d774fda
add cs profiling as optional second step profiling pass
henderkes Apr 30, 2026
d19930a
unrelated cs-fix
henderkes Apr 30, 2026
5293f76
Merge branch 'main' into feat/pgo
henderkes Apr 30, 2026
814d3cb
move pgo from new to static creation method
henderkes Apr 30, 2026
b72b734
profile atomic
henderkes May 1, 2026
2003009
pass proper optimization flags to a few libs that ignored them
henderkes May 2, 2026
7dfa4c5
only run micro patches when building it
henderkes May 2, 2026
bcafd9c
only link static ext libraries into sapi builds
henderkes May 4, 2026
6557fc9
fix last libs to use cflags
henderkes May 4, 2026
c5edacd
fix linter in CI
henderkes May 4, 2026
5f43d6a
ready for packages
henderkes May 5, 2026
7be718e
forgot to add file
henderkes May 5, 2026
cec488f
fix fastlz header location
henderkes May 5, 2026
956e8d0
fix unixodbc with lto?
henderkes May 5, 2026
a38fd23
explicitly set openssl dir?
henderkes May 5, 2026
b4e7080
simpler patch
henderkes May 5, 2026
aed01c9
remove leftovers
henderkes May 5, 2026
9129066
set c std libs instead
henderkes May 5, 2026
5d4bb27
god
henderkes May 5, 2026
a0c86c1
use correct ar and ranlib for cmake
henderkes May 5, 2026
410f1d2
extra libs only option in craft
henderkes May 5, 2026
712beff
fixes for thin lto
henderkes May 6, 2026
f553ee9
dont patch out configure command
henderkes May 6, 2026
3314177
comments
henderkes May 6, 2026
82998a7
Merge branch 'main' into feat/pgo
henderkes May 6, 2026
edeb5b9
fix musl check
henderkes May 7, 2026
ff9a849
fix zig-cc script with different PKG_ROOT_PATH (and filter out some g…
henderkes May 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@ jobs:
php-version: '8.4'
extensions: curl, openssl, mbstring
ini-values: memory_limit=-1
tools: pecl, composer, php-cs-fixer
tools: pecl, composer

- name: "Install dependencies"
run: composer install --no-progress --prefer-dist --optimize-autoloader

- name: Run PHP-CS-Fixer fix
run: php-cs-fixer fix --dry-run --diff --ansi
run: vendor/bin/php-cs-fixer fix --dry-run --diff --ansi

phpstan:
runs-on: ubuntu-latest
Expand Down
106 changes: 88 additions & 18 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions config/env.ini
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ SPC_LIBC=musl
CC=${SPC_LINUX_DEFAULT_CC}
CXX=${SPC_LINUX_DEFAULT_CXX}
AR=${SPC_LINUX_DEFAULT_AR}
RANLIB=${SPC_LINUX_DEFAULT_RANLIB}
LD=${SPC_LINUX_DEFAULT_LD}
; default compiler flags, used in CMake toolchain file, openssl and pkg-config build
SPC_DEFAULT_C_FLAGS="-fPIC -Os"
Expand Down
2 changes: 1 addition & 1 deletion config/lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
"libfastlz.a"
],
"headers": [
"fastlz/fastlz.h"
"fastlz.h"
]
},
"freetype": {
Expand Down
8 changes: 5 additions & 3 deletions src/SPC/builder/BuilderBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ abstract class BuilderBase
/** @var array<int, string> extension names */
protected array $ext_list = [];

/** @var array<int, string> library names */
/** @var array<int, string> all libraries being built (resolved dep list) */
protected array $lib_list = [];

/** @var bool compile libs only (just mark it) */
Expand Down Expand Up @@ -143,7 +143,7 @@ public function setLibsOnly(bool $status = true): void
*
* @internal
*/
public function proveExts(array $static_extensions, array $shared_extensions = [], bool $skip_check_deps = false, bool $skip_extract = false): void
public function proveExts(array $static_extensions, array $shared_extensions = [], bool $skip_check_deps = false, bool $skip_extract = false, int $build_target = BUILD_TARGET_NONE): void
{
// judge ext
foreach ($static_extensions as $ext) {
Expand Down Expand Up @@ -171,7 +171,9 @@ public function proveExts(array $static_extensions, array $shared_extensions = [
SourceManager::initSource(exts: [...$static_extensions, ...$shared_extensions]);
$this->emitPatchPoint('after-exts-extract');
// patch micro
SourcePatcher::patchMicro();
if (($build_target & BUILD_TARGET_MICRO) === BUILD_TARGET_MICRO) {
SourcePatcher::patchMicro();
}
}

foreach ([...$static_extensions, ...$shared_extensions] as $extension) {
Expand Down
22 changes: 5 additions & 17 deletions src/SPC/builder/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use SPC\toolchain\ZigToolchain;
use SPC\util\GlobalEnvManager;
use SPC\util\SPCConfigUtil;
use SPC\util\SPCTarget;

class Extension
{
Expand Down Expand Up @@ -187,14 +186,6 @@ public function patchBeforeWindowsConfigure(): bool
*/
public function patchBeforeMake(): bool
{
if (SPCTarget::getTargetOS() === 'Linux' && $this->isBuildShared() && ($objs = getenv('SPC_EXTRA_RUNTIME_OBJECTS'))) {
FileSystem::replaceFileRegex(
SOURCE_PATH . '/php-src/Makefile',
"/^(shared_objects_{$this->getName()}\\s*=.*)$/m",
"$1 {$objs}",
);
return true;
}
return false;
}

Expand Down Expand Up @@ -244,13 +235,6 @@ public function patchBeforeSharedMake(): bool
);
}

if ($objs = getenv('SPC_EXTRA_RUNTIME_OBJECTS')) {
FileSystem::replaceFileRegex(
$this->source_dir . '/Makefile',
"/^(shared_objects_{$this->getName()}\\s*=.*)$/m",
"$1 {$objs}",
);
}
return true;
}

Expand Down Expand Up @@ -555,11 +539,15 @@ protected function getSharedExtensionEnv(): array
[$staticLibs, $sharedLibs] = $this->splitLibsIntoStaticAndShared($config['libs']);
$preStatic = PHP_OS_FAMILY === 'Darwin' ? '' : '-Wl,--start-group ';
$postStatic = PHP_OS_FAMILY === 'Darwin' ? '' : ' -Wl,--end-group ';
$extraLd = trim((string) getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS'));
if (PHP_OS_FAMILY !== 'Darwin') {
$extraLd = trim($extraLd . ' -Wl,-Bsymbolic');
}
return [
'CFLAGS' => $config['cflags'],
'CXXFLAGS' => $config['cflags'],
'LDFLAGS' => $config['ldflags'],
'EXTRA_LDFLAGS' => getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS'),
'EXTRA_LDFLAGS' => $extraLd,
'LIBS' => clean_spaces("{$preStatic} {$staticLibs} {$postStatic} {$sharedLibs}"),
'LD_LIBRARY_PATH' => BUILD_LIB_PATH,
];
Expand Down
5 changes: 4 additions & 1 deletion src/SPC/builder/extension/opcache.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ public function getUnixConfigureArg(bool $shared = false): string
) {
$opcache_jit = ' --disable-opcache-jit';
}
return '--enable-opcache' . ($shared ? '=shared' : '') . $opcache_jit;
if ($phpVersionID < 80500) {
return '--enable-opcache' . ($shared ? '=shared' : '') . $opcache_jit;
}
return trim($opcache_jit);
}

public function getDistName(): string
Expand Down
Loading
Loading