diff --git a/bin/spc-gnu-docker b/bin/spc-gnu-docker index fa84e58c..d96abbc5 100755 --- a/bin/spc-gnu-docker +++ b/bin/spc-gnu-docker @@ -12,7 +12,7 @@ DOCKER_EXECUTABLE="docker" # shellcheck disable=SC2046 if [ $(id -u) -ne 0 ]; then if ! docker info > /dev/null 2>&1; then - if [ "$SPC_USE_SUDO" != "yes" ]; then + if [ "$SPC_USE_SUDO" != "yes" ] && [ "$SPC_DOCKER_DEBUG" != "yes" ]; then echo "Docker command requires sudo" # shellcheck disable=SC2039 echo -n 'To use sudo to run docker, run "export SPC_USE_SUDO=yes" and run command again' @@ -145,4 +145,9 @@ echo 'SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS="-ldl -lpthread -lm -lresolv -lutil -lrt"' # shellcheck disable=SC2086 # shellcheck disable=SC2090 -$DOCKER_EXECUTABLE run --rm $INTERACT -e SPC_FIX_DEPLOY_ROOT="$(pwd)" --env-file /tmp/spc-gnu-docker.env $MOUNT_LIST cwcc-spc-gnu-$SPC_USE_ARCH bin/spc $@ +if [ "$SPC_DOCKER_DEBUG" = "yes" ]; then + echo -e "\e[033m* Debug mode enabled, run docker in interactive mode.\e[0m" + $DOCKER_EXECUTABLE run --rm $INTERACT -e SPC_FIX_DEPLOY_ROOT="$(pwd)" --env-file /tmp/spc-gnu-docker.env $MOUNT_LIST cwcc-spc-gnu-$SPC_USE_ARCH +else + $DOCKER_EXECUTABLE run --rm $INTERACT -e SPC_FIX_DEPLOY_ROOT="$(pwd)" --env-file /tmp/spc-gnu-docker.env $MOUNT_LIST cwcc-spc-gnu-$SPC_USE_ARCH bin/spc $@ +fi diff --git a/config/env.ini b/config/env.ini index 652b0fe6..3ef5ba0f 100644 --- a/config/env.ini +++ b/config/env.ini @@ -28,7 +28,6 @@ ; PATH: static-php-cli will add `$BUILD_BIN_PATH` to PATH. ; PKG_CONFIG: static-php-cli will set `$BUILD_BIN_PATH/pkg-config` to PKG_CONFIG. ; PKG_CONFIG_PATH: static-php-cli will set `$BUILD_LIB_PATH/pkgconfig` to PKG_CONFIG_PATH. -; SPC_PHP_DEFAULT_OPTIMIZE_CFLAGS: the default optimization CFLAGS for compiling php. (if --no-strip option is set: `-g -O0`, else: `-g -Os`) ; ; * These vars are only be defined in LinuxBuilder and cannot be changed anywhere: ; SPC_LINUX_DEFAULT_CC: the default compiler for linux. (For alpine linux: `gcc`, default: `$GNU_ARCH-linux-musl-gcc`) @@ -98,7 +97,7 @@ SPC_CMD_VAR_PHP_CONFIGURE_LDFLAGS="-L${BUILD_LIB_PATH}" ; LIBS for configuring php SPC_CMD_VAR_PHP_CONFIGURE_LIBS="-ldl -lpthread -lm" ; EXTRA_CFLAGS for `make` php -SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS="${SPC_PHP_DEFAULT_OPTIMIZE_CFLAGS} -fno-ident -fPIE -fPIC" +SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS="-g -fstack-protector-strong -fpic -fpie -Os -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fno-ident -fPIE -fPIC" ; EXTRA_LIBS for `make` php SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS="" ; EXTRA_LDFLAGS_PROGRAM for `make` php @@ -132,7 +131,7 @@ SPC_CMD_VAR_PHP_CONFIGURE_CPPFLAGS="-I${BUILD_INCLUDE_PATH}" ; LDFLAGS for configuring php SPC_CMD_VAR_PHP_CONFIGURE_LDFLAGS="-L${BUILD_LIB_PATH}" ; EXTRA_CFLAGS for `make` php -SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS="${SPC_PHP_DEFAULT_OPTIMIZE_CFLAGS}" +SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS="-g -fstack-protector-strong -fpic -fpie -Os -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" ; EXTRA_LIBS for `make` php SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS="-lresolv" ; embed type for php, static (libphp.a) or shared (libphp.dylib) diff --git a/config/ext.json b/config/ext.json index 691be764..1cf1dae0 100644 --- a/config/ext.json +++ b/config/ext.json @@ -919,15 +919,14 @@ }, "xdebug": { "type": "external", + "source": "xdebug", + "target": ["shared"], "support": { "Windows": "wip", "BSD": "no", "Darwin": "no", "Linux": "wip" }, - "lib-depends": [ - "xdebug" - ], "notes": true }, "xhprof": { diff --git a/config/lib.json b/config/lib.json index a39409ed..0dae815f 100644 --- a/config/lib.json +++ b/config/lib.json @@ -751,12 +751,6 @@ "libiconv" ] }, - "xdebug": { - "source": "xdebug", - "static-libs-unix": [ - "xdebug.so" - ] - }, "xz": { "source": "xz", "static-libs-unix": [ diff --git a/config/source.json b/config/source.json index 553f0527..4a9c3cef 100644 --- a/config/source.json +++ b/config/source.json @@ -914,11 +914,9 @@ } }, "xdebug": { - "type": "ghrel", - "repo": "xdebug/xdebug", - "match": "Source code", - "prefer-stable": true, - "provide-pre-built": false, + "type": "url", + "url": "https://pecl.php.net/get/xdebug", + "filename": "xdebug.tgz", "license": { "type": "file", "path": "LICENSE" diff --git a/src/SPC/store/Config.php b/src/SPC/store/Config.php index 07ed2887..9c00715d 100644 --- a/src/SPC/store/Config.php +++ b/src/SPC/store/Config.php @@ -106,6 +106,21 @@ class Config return self::$lib; } + /** + * @throws WrongUsageException + * @throws FileSystemException + */ + public static function getExtTarget(string $name): ?array + { + if (self::$ext === null) { + self::$ext = FileSystem::loadConfigArray('ext'); + } + if (!isset(self::$ext[$name])) { + throw new WrongUsageException('ext [' . $name . '] is not supported yet'); + } + return self::$ext[$name]['target'] ?? ['static', 'shared']; + } + /** * @throws FileSystemException * @throws WrongUsageException diff --git a/src/SPC/util/GlobalEnvManager.php b/src/SPC/util/GlobalEnvManager.php index 7988244f..8ffd5d05 100644 --- a/src/SPC/util/GlobalEnvManager.php +++ b/src/SPC/util/GlobalEnvManager.php @@ -40,9 +40,6 @@ class GlobalEnvManager self::putenv('PATH=' . BUILD_ROOT_PATH . '/bin:' . getenv('PATH')); self::putenv('PKG_CONFIG=' . BUILD_BIN_PATH . '/pkg-config'); self::putenv('PKG_CONFIG_PATH=' . BUILD_ROOT_PATH . '/lib/pkgconfig'); - if ($builder instanceof BuilderBase) { - self::putenv('SPC_PHP_DEFAULT_OPTIMIZE_CFLAGS=' . ($builder->getOption('no-strip') ? '-g -O0' : '-g -fstack-protector-strong -fpic -fpie -Os -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64')); - } } // Define env vars for linux