Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
4 changes: 2 additions & 2 deletions .github/workflows/build-unix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ jobs:
linux-x86_64)
DOWN_CMD="./bin/spc-alpine-docker download"
BUILD_CMD="./bin/spc-alpine-docker build"
RUNS_ON="ubuntu-latest"
RUNS_ON="ubuntu-24.04"
;;
linux-aarch64)
DOWN_CMD="./bin/spc-alpine-docker download"
Expand All @@ -136,7 +136,7 @@ jobs:
macos-x86_64)
DOWN_CMD="composer update --no-dev --classmap-authoritative && ./bin/spc doctor --auto-fix && ./bin/spc download"
BUILD_CMD="./bin/spc build"
RUNS_ON="macos-13"
RUNS_ON="macos-14"
;;
macos-aarch64)
DOWN_CMD="composer update --no-dev --classmap-authoritative && ./bin/spc doctor --auto-fix && ./bin/spc download"
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/ext-matrix-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ jobs:
- "8.4"
operating-system:
- "ubuntu-latest"
#- "macos-13"
#- "debian-arm64-self-hosted"
- "macos-14"

Expand All @@ -99,11 +98,11 @@ jobs:
OS=""
if [ "${{ matrix.operating-system }}" = "ubuntu-latest" ]; then
OS="linux-x86_64"
elif [ "${{ matrix.operating-system }}" = "macos-13" ]; then
elif [ "${{ matrix.operating-system }}" = "macos-14" ]; then
OS="macos-x86_64"
elif [ "${{ matrix.operating-system }}" = "debian-arm64-self-hosted" ]; then
OS="linux-aarch64"
elif [ "${{ matrix.operating-system }}" = "macos-14" ]; then
elif [ "${{ matrix.operating-system }}" = "macos-15" ]; then
OS="macos-aarch64"
fi
echo "OS=$OS" >> $GITHUB_ENV
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ jobs:
os: "ubuntu-latest"
filename: "spc-linux-x86_64.tar.gz"
- name: "macos-x86_64"
os: "macos-13"
os: "macos-14"
filename: "spc-macos-x86_64.tar.gz"
- name: "linux-aarch64"
os: "ubuntu-latest"
filename: "spc-linux-aarch64.tar.gz"
- name: "macos-aarch64"
os: "macos-14"
os: "macos-15"
filename: "spc-macos-aarch64.tar.gz"
- name: "windows-x64"
os: "ubuntu-latest"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ jobs:
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

- name: "Run PHPUnit Tests"
run: SPC_LIBC=glibc vendor/bin/phpunit tests/ --no-coverage
run: vendor/bin/phpunit tests/ --no-coverage

define-matrix:
name: "Define Matrix"
Expand Down
158 changes: 0 additions & 158 deletions bin/build-static-frankenphp

This file was deleted.

2 changes: 0 additions & 2 deletions bin/spc-gnu-docker
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ ADD ./bin/spc /app/bin/spc
RUN /app/bin/setup-runtime
RUN /app/bin/php /app/bin/composer install --no-dev
ENV PATH="/app/bin:/cmake/bin:$PATH"
ENV SPC_LIBC=glibc

ADD ./config/env.ini /app/config/env.ini
RUN CC=gcc bin/spc doctor --auto-fix --debug
Expand Down Expand Up @@ -159,7 +158,6 @@ echo 'CXX=/opt/rh/devtoolset-10/root/usr/bin/g++' >> /tmp/spc-gnu-docker.env
echo 'AR=/opt/rh/devtoolset-10/root/usr/bin/ar' >> /tmp/spc-gnu-docker.env
echo 'LD=/opt/rh/devtoolset-10/root/usr/bin/ld' >> /tmp/spc-gnu-docker.env
echo 'SPC_DEFAULT_C_FLAGS=-fPIC' >> /tmp/spc-gnu-docker.env
echo 'SPC_LIBC=glibc' >> /tmp/spc-gnu-docker.env
echo 'SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS_PROGRAM="-Wl,-O1 -pie"' >> /tmp/spc-gnu-docker.env
echo 'SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS="-ldl -lpthread -lm -lresolv -lutil -lrt"' >> /tmp/spc-gnu-docker.env

Expand Down
12 changes: 5 additions & 7 deletions config/env.ini
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,11 @@ UPX_EXEC="${PKG_ROOT_PATH}\bin\upx.exe"
SPC_MICRO_PATCHES=static_extensions_win32,cli_checks,disable_huge_page,vcruntime140,win32,zend_stream,cli_static

[linux]
; include PATH for musl libc.
SPC_LIBC=musl
; compiler environments
CC=${SPC_LINUX_DEFAULT_CC}
CXX=${SPC_LINUX_DEFAULT_CXX}
AR=${SPC_LINUX_DEFAULT_AR}
LD=${SPC_LINUX_DEFAULT_LD}
CC=gcc
CXX=g++
AR=ar
LD=ld
; default compiler flags, used in CMake toolchain file, openssl and pkg-config build
SPC_DEFAULT_C_FLAGS="-fPIC -Os"
SPC_DEFAULT_CXX_FLAGS="-fPIC -Os"
Expand All @@ -78,7 +76,7 @@ SPC_EXTRA_LIBS=
; upx executable path
UPX_EXEC=${PKG_ROOT_PATH}/bin/upx
; phpmicro patches, for more info, see: https://github.com/easysoft/phpmicro/tree/master/patches
SPC_MICRO_PATCHES=static_extensions_win32,cli_checks,disable_huge_page,vcruntime140,win32,zend_stream
SPC_MICRO_PATCHES=cli_checks,disable_huge_page,zend_stream

; *** default build command for building php ***
; buildconf command
Expand Down
6 changes: 3 additions & 3 deletions src/SPC/builder/extension/imagick.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function patchBeforeMake(): bool
if (PHP_OS_FAMILY !== 'Linux') {
return false;
}
if (getenv('SPC_LIBC') === 'glibc' && str_contains(getenv('CC'), 'devtoolset-10')) {
if (getenv('NO_LIBGOMP')) {
return false;
}
// imagick with calls omp_pause_all, which requires openmp, on non-musl we build imagick without openmp
Expand All @@ -26,15 +26,15 @@ public function patchBeforeMake(): bool

public function getUnixConfigureArg(bool $shared = false): string
{
$disable_omp = !(getenv('SPC_LIBC') === 'glibc' && str_contains(getenv('CC'), 'devtoolset-10')) ? '' : ' ac_cv_func_omp_pause_resource_all=no';
$disable_omp = !(getenv('NO_LIBGOMP')) ? '' : ' ac_cv_func_omp_pause_resource_all=no';
return '--with-imagick=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH . $disable_omp;
}

protected function getStaticAndSharedLibs(): array
{
// on centos 7, it will use the symbol _ZTINSt6thread6_StateE, which is not defined in system libstdc++.so.6
[$static, $shared] = parent::getStaticAndSharedLibs();
if (getenv('SPC_LIBC') === 'glibc' && str_contains(getenv('CC'), 'devtoolset-10')) {
if (str_contains(getenv('CC'), 'devtoolset-10')) {
$static .= ' -lstdc++';
$shared = str_replace('-lstdc++', '', $shared);
}
Expand Down
12 changes: 0 additions & 12 deletions src/SPC/builder/linux/LinuxBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,6 @@ public function __construct(array $options = [])

GlobalEnvManager::init($this);

if (getenv('SPC_LIBC') === 'musl' && !SystemUtil::isMuslDist()) {
$this->setOptionIfNotExist('library_path', "LIBRARY_PATH=\"/usr/local/musl/{$arch}-linux-musl/lib\"");
$this->setOptionIfNotExist('ld_library_path', "LD_LIBRARY_PATH=\"/usr/local/musl/{$arch}-linux-musl/lib\"");
$configure = getenv('SPC_CMD_PREFIX_PHP_CONFIGURE');
$configure = "LD_LIBRARY_PATH=\"/usr/local/musl/{$arch}-linux-musl/lib\" " . $configure;
GlobalEnvManager::putenv("SPC_CMD_PREFIX_PHP_CONFIGURE={$configure}");

if (!file_exists("/usr/local/musl/{$arch}-linux-musl/lib/libc.a")) {
throw new WrongUsageException('You are building with musl-libc target in glibc distro, but musl-toolchain is not installed, please install musl-toolchain first. (You can use `doctor` command to install it)');
}
}

// concurrency
$this->concurrency = intval(getenv('SPC_CONCURRENCY'));
// cflags
Expand Down
26 changes: 19 additions & 7 deletions src/SPC/builder/linux/SystemUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ public static function isMuslDist(): bool
return static::getOSRelease()['dist'] === 'alpine';
}

public static function isGlibcDist(): bool
{
return PHP_OS_FAMILY === 'Linux' && static::getOSRelease()['dist'] !== 'alpine';
}

public static function getCpuCount(): int
{
$ncpu = 1;
Expand Down Expand Up @@ -193,7 +198,7 @@ public static function getLibcVersionIfExists(): ?string
if (self::$libc_version !== null) {
return self::$libc_version;
}
if (PHP_OS_FAMILY === 'Linux' && getenv('SPC_LIBC') === 'glibc') {
if (PHP_OS_FAMILY === 'Linux' && !SystemUtil::isMuslDist()) {
$result = shell()->execWithResult('ldd --version', false);
if ($result[0] !== 0) {
return null;
Expand All @@ -208,12 +213,8 @@ public static function getLibcVersionIfExists(): ?string
}
return null;
}
if (PHP_OS_FAMILY === 'Linux' && getenv('SPC_LIBC') === 'musl') {
if (self::isMuslDist()) {
$result = shell()->execWithResult('ldd 2>&1', false);
} else {
$result = shell()->execWithResult('/usr/local/musl/lib/libc.so 2>&1', false);
}
if (PHP_OS_FAMILY === 'Linux' && SystemUtil::isMuslDist()) {
$result = shell()->execWithResult('ldd 2>&1', false);
// Match Version * line
// match ldd version: "Version 1.2.3" match 1.2.3
$pattern = '/Version\s+(\d+\.\d+\.\d+)/';
Expand All @@ -224,4 +225,15 @@ public static function getLibcVersionIfExists(): ?string
}
return null;
}

public static function getLibcName()
{
if (PHP_OS_FAMILY === 'Darwin') {
return 'libSystem';
}
if (PHP_OS_FAMILY === 'Windows') {
return 'msvcrt';
}
return self::isMuslDist() ? 'musl' : 'glibc';
}
}
3 changes: 2 additions & 1 deletion src/SPC/builder/linux/library/icu.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace SPC\builder\linux\library;

use SPC\builder\linux\SystemUtil;
use SPC\store\FileSystem;

class icu extends LinuxLibraryBase
Expand All @@ -16,7 +17,7 @@ protected function build(): void
{
$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 = getenv('SPC_LIBC') !== 'glibc' ? 'LDFLAGS="-static"' : '';
$ldflags = SystemUtil::isMuslDist() ? 'LDFLAGS="-static"' : '';
shell()->cd($this->source_dir . '/source')->initializeEnv($this)
->exec(
"{$cppflags} {$cxxflags} {$ldflags} " .
Expand Down
Loading
Loading