From 9ac578dfd608185d829fed46bd68fd4210dffffd Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Fri, 5 Sep 2025 11:00:46 +0800 Subject: [PATCH] Use arch-specified pkgroot --- bin/spc-alpine-docker | 9 +++++++-- bin/spc-gnu-docker | 9 +++++++-- src/globals/internal-env.php | 5 ++++- 3 files changed, 18 insertions(+), 5 deletions(-) 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/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) {