diff --git a/.gitignore b/.gitignore index d15edf75..4bf41b55 100644 --- a/.gitignore +++ b/.gitignore @@ -34,6 +34,7 @@ packlib_files.txt /bin/* !/bin/spc* !/bin/setup-runtime* +!/bin/docker-entrypoint.sh # exclude windows build tools /php-sdk-binary-tools/ diff --git a/bin/docker-entrypoint.sh b/bin/docker-entrypoint.sh new file mode 100644 index 00000000..dbe81d0f --- /dev/null +++ b/bin/docker-entrypoint.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +set -e +TARGET_DIR="/app/pkgroot/$(uname -m)-linux" +BACKUP_DIR="/app/pkgroot-private" +# copy private pkgroot to pkgroot if pkgroot is empty +if [ ! -d "$TARGET_DIR" ] || [ -z "$(ls -A "$TARGET_DIR")" ]; then + echo "* Copying private pkgroot to pkgroot ..." + rm -rf "$TARGET_DIR" + cp -r "$BACKUP_DIR" "$TARGET_DIR" +fi +exec "$@" diff --git a/bin/setup-runtime b/bin/setup-runtime index 453b5918..d925ff8a 100755 --- a/bin/setup-runtime +++ b/bin/setup-runtime @@ -25,7 +25,7 @@ __DIR__=$(cd "$(dirname "$0")" && pwd) __PROJECT__=$(cd "${__DIR__}"/../ && pwd) # set download dir -__PHP_RUNTIME_URL__="https://dl.static-php.dev/static-php-cli/bulk/php-8.4.4-cli-${__OS_FIXED__}-${__ARCH__}.tar.gz" +__PHP_RUNTIME_URL__="https://dl.static-php.dev/static-php-cli/bulk/php-8.4.12-cli-${__OS_FIXED__}-${__ARCH__}.tar.gz" __COMPOSER_URL__="https://getcomposer.org/download/latest-stable/composer.phar" # use china mirror @@ -45,7 +45,7 @@ done case "$mirror" in china) - __PHP_RUNTIME_URL__="https://dl.static-php.dev/static-php-cli/bulk/php-8.4.4-cli-${__OS_FIXED__}-${__ARCH__}.tar.gz" + __PHP_RUNTIME_URL__="https://dl.static-php.dev/static-php-cli/bulk/php-8.4.12-cli-${__OS_FIXED__}-${__ARCH__}.tar.gz" __COMPOSER_URL__="https://mirrors.tencent.com/composer/composer.phar" ;; diff --git a/bin/spc-alpine-docker b/bin/spc-alpine-docker index df71ae25..3a58547f 100755 --- a/bin/spc-alpine-docker +++ b/bin/spc-alpine-docker @@ -123,8 +123,13 @@ COPY ./composer.* /app/ ADD ./bin /app/bin RUN composer install --no-dev ADD ./config /app/config -RUN PKG_ROOT_PATH=/app/pkgroot-private bin/spc doctor --auto-fix -RUN PKG_ROOT_PATH=/app/pkgroot-private bin/spc install-pkg upx +RUN bin/spc doctor --auto-fix +RUN bin/spc install-pkg upx + +RUN mv /app/pkgroot/\$(uname -m)-linux /app/pkgroot-private +ADD bin/docker-entrypoint.sh /bin/docker-entrypoint.sh +RUN chmod +x /bin/docker-entrypoint.sh +ENTRYPOINT ["/bin/docker-entrypoint.sh"] EOF fi diff --git a/bin/spc-gnu-docker b/bin/spc-gnu-docker index 6b92fe82..97c9a089 100755 --- a/bin/spc-gnu-docker +++ b/bin/spc-gnu-docker @@ -112,8 +112,8 @@ ENV SPC_LIBC=glibc ENV PATH="/app/bin:/cmake/bin:/opt/rh/devtoolset-10/root/usr/bin:\$PATH" ADD ./config /app/config -RUN CC=gcc PKG_ROOT_PATH=/app/pkgroot-private bin/spc doctor --auto-fix --debug -RUN PKG_ROOT_PATH=/app/pkgroot-private bin/spc install-pkg upx +RUN CC=gcc bin/spc doctor --auto-fix --debug +RUN bin/spc install-pkg upx RUN if [ -f /app/buildroot/bin/re2c ]; then \ cp /app/buildroot/bin/re2c /usr/local/bin/re2c ;\ fi @@ -133,6 +133,11 @@ RUN curl -o automake.tgz -fsSL https://ftp.gnu.org/gnu/automake/automake-1.17.ta make && \ make install && \ ln -sf /usr/local/bin/automake /usr/bin/automake + +RUN mv /app/pkgroot/\$(uname -m)-linux /app/pkgroot-private +ADD bin/docker-entrypoint.sh /bin/docker-entrypoint.sh +RUN chmod +x /bin/docker-entrypoint.sh +ENTRYPOINT ["/bin/docker-entrypoint.sh"] EOF fi diff --git a/composer.lock b/composer.lock index e774214d..069a340f 100644 --- a/composer.lock +++ b/composer.lock @@ -2861,16 +2861,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.87.0", + "version": "v3.87.1", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "50a13c4c5f25d2c6894e30e92c051474cf0e115a" + "reference": "2f5170365e2a422d0c5421f9c8818b2c078105f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/50a13c4c5f25d2c6894e30e92c051474cf0e115a", - "reference": "50a13c4c5f25d2c6894e30e92c051474cf0e115a", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/2f5170365e2a422d0c5421f9c8818b2c078105f6", + "reference": "2f5170365e2a422d0c5421f9c8818b2c078105f6", "shasum": "" }, "require": { @@ -2903,7 +2903,7 @@ "require-dev": { "facile-it/paraunit": "^1.3.1 || ^2.7", "infection/infection": "^0.29.14", - "justinrainbow/json-schema": "^6.4", + "justinrainbow/json-schema": "^6.5", "keradus/cli-executor": "^2.2", "mikey179/vfsstream": "^1.6.12", "php-coveralls/php-coveralls": "^2.8", @@ -2953,7 +2953,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v97773{PHP_CS_FIXER_VERSION}" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.87.1" }, "funding": [ { @@ -2961,7 +2961,7 @@ "type": "github" } ], - "time": "2025-09-02T10:58:35+00:00" + "time": "2025-09-02T15:27:36+00:00" }, { "name": "humbug/box", diff --git a/src/SPC/builder/unix/UnixBuilderBase.php b/src/SPC/builder/unix/UnixBuilderBase.php index f89676f4..a7bb6f5d 100644 --- a/src/SPC/builder/unix/UnixBuilderBase.php +++ b/src/SPC/builder/unix/UnixBuilderBase.php @@ -10,8 +10,6 @@ use SPC\exception\SPCInternalException; use SPC\exception\ValidationException; use SPC\exception\WrongUsageException; use SPC\store\Config; -use SPC\store\CurlHook; -use SPC\store\Downloader; use SPC\store\FileSystem; use SPC\store\pkg\GoXcaddy; use SPC\toolchain\GccNativeToolchain; diff --git a/src/SPC/util/GlobalEnvManager.php b/src/SPC/util/GlobalEnvManager.php index 073394a7..9f74d2df 100644 --- a/src/SPC/util/GlobalEnvManager.php +++ b/src/SPC/util/GlobalEnvManager.php @@ -40,10 +40,6 @@ class GlobalEnvManager if (is_unix()) { self::addPathIfNotExists(BUILD_BIN_PATH); self::addPathIfNotExists(PKG_ROOT_PATH . '/bin'); - // internally use `WORKING_DIR/pkgroot-private` to avoid volume mount issues in Docker - if (is_dir(WORKING_DIR . '/pkgroot-private/bin')) { - self::addPathIfNotExists(WORKING_DIR . '/pkgroot-private/bin'); - } self::putenv('PKG_CONFIG_PATH=' . BUILD_LIB_PATH . '/pkgconfig'); } diff --git a/src/SPC/util/PkgConfigUtil.php b/src/SPC/util/PkgConfigUtil.php index 14c2691f..25e0e1f2 100644 --- a/src/SPC/util/PkgConfigUtil.php +++ b/src/SPC/util/PkgConfigUtil.php @@ -23,7 +23,6 @@ class PkgConfigUtil { // Find pkg-config executable $find_list = [ - WORKING_DIR . '/pkgroot-private/bin/pkg-config', // used in Docker build, which is installed inside the container to avoid volume mounting issues PKG_ROOT_PATH . '/bin/pkg-config', BUILD_BIN_PATH . '/pkg-config', ]; diff --git a/src/globals/internal-env.php b/src/globals/internal-env.php index 5b6fe57f..9f893df2 100644 --- a/src/globals/internal-env.php +++ b/src/globals/internal-env.php @@ -22,7 +22,10 @@ define('BUILD_BIN_PATH', FileSystem::convertPath(is_string($a = getenv('BUILD_BI // output path for shared extensions define('BUILD_MODULES_PATH', FileSystem::convertPath(is_string($a = getenv('BUILD_MODULES_PATH')) ? $a : (BUILD_ROOT_PATH . '/modules'))); -define('PKG_ROOT_PATH', FileSystem::convertPath(is_string($a = getenv('PKG_ROOT_PATH')) ? $a : (WORKING_DIR . '/pkgroot'))); +// pkg arch name +$_pkg_arch_name = arch2gnu(php_uname('m')) . '-' . strtolower(PHP_OS_FAMILY); +define('PKG_ROOT_PATH', FileSystem::convertPath(is_string($a = getenv('PKG_ROOT_PATH')) ? $a : (WORKING_DIR . "/pkgroot/{$_pkg_arch_name}"))); + define('SOURCE_PATH', FileSystem::convertPath(is_string($a = getenv('SOURCE_PATH')) ? $a : (WORKING_DIR . '/source'))); define('DOWNLOAD_PATH', FileSystem::convertPath(is_string($a = getenv('DOWNLOAD_PATH')) ? $a : (WORKING_DIR . '/downloads'))); define('CPU_COUNT', match (PHP_OS_FAMILY) { diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index 97eaa850..764cfc7d 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -43,7 +43,7 @@ $no_strip = false; $upx = false; // whether to test frankenphp build, only available for macos and linux -$frankenphp = true; +$frankenphp = false; // prefer downloading pre-built packages to speed up the build process $prefer_pre_built = false;