mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-19 05:14:52 +08:00
Some prerequisites for refactor
This commit is contained in:
parent
371a588396
commit
8909b62dc4
@ -12,7 +12,7 @@ DOCKER_EXECUTABLE="docker"
|
|||||||
# shellcheck disable=SC2046
|
# shellcheck disable=SC2046
|
||||||
if [ $(id -u) -ne 0 ]; then
|
if [ $(id -u) -ne 0 ]; then
|
||||||
if ! docker info > /dev/null 2>&1; 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"
|
echo "Docker command requires sudo"
|
||||||
# shellcheck disable=SC2039
|
# shellcheck disable=SC2039
|
||||||
echo -n 'To use sudo to run docker, run "export SPC_USE_SUDO=yes" and run command again'
|
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=SC2086
|
||||||
# shellcheck disable=SC2090
|
# 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
|
||||||
|
|||||||
@ -28,7 +28,6 @@
|
|||||||
; PATH: static-php-cli will add `$BUILD_BIN_PATH` to PATH.
|
; 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: 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.
|
; 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:
|
; * 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`)
|
; 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
|
; LIBS for configuring php
|
||||||
SPC_CMD_VAR_PHP_CONFIGURE_LIBS="-ldl -lpthread -lm"
|
SPC_CMD_VAR_PHP_CONFIGURE_LIBS="-ldl -lpthread -lm"
|
||||||
; EXTRA_CFLAGS for `make` php
|
; 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
|
; EXTRA_LIBS for `make` php
|
||||||
SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS=""
|
SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS=""
|
||||||
; EXTRA_LDFLAGS_PROGRAM for `make` php
|
; EXTRA_LDFLAGS_PROGRAM for `make` php
|
||||||
@ -132,7 +131,7 @@ SPC_CMD_VAR_PHP_CONFIGURE_CPPFLAGS="-I${BUILD_INCLUDE_PATH}"
|
|||||||
; LDFLAGS for configuring php
|
; LDFLAGS for configuring php
|
||||||
SPC_CMD_VAR_PHP_CONFIGURE_LDFLAGS="-L${BUILD_LIB_PATH}"
|
SPC_CMD_VAR_PHP_CONFIGURE_LDFLAGS="-L${BUILD_LIB_PATH}"
|
||||||
; EXTRA_CFLAGS for `make` php
|
; 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
|
; EXTRA_LIBS for `make` php
|
||||||
SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS="-lresolv"
|
SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS="-lresolv"
|
||||||
; embed type for php, static (libphp.a) or shared (libphp.dylib)
|
; embed type for php, static (libphp.a) or shared (libphp.dylib)
|
||||||
|
|||||||
@ -919,15 +919,14 @@
|
|||||||
},
|
},
|
||||||
"xdebug": {
|
"xdebug": {
|
||||||
"type": "external",
|
"type": "external",
|
||||||
|
"source": "xdebug",
|
||||||
|
"target": ["shared"],
|
||||||
"support": {
|
"support": {
|
||||||
"Windows": "wip",
|
"Windows": "wip",
|
||||||
"BSD": "no",
|
"BSD": "no",
|
||||||
"Darwin": "no",
|
"Darwin": "no",
|
||||||
"Linux": "wip"
|
"Linux": "wip"
|
||||||
},
|
},
|
||||||
"lib-depends": [
|
|
||||||
"xdebug"
|
|
||||||
],
|
|
||||||
"notes": true
|
"notes": true
|
||||||
},
|
},
|
||||||
"xhprof": {
|
"xhprof": {
|
||||||
|
|||||||
@ -751,12 +751,6 @@
|
|||||||
"libiconv"
|
"libiconv"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"xdebug": {
|
|
||||||
"source": "xdebug",
|
|
||||||
"static-libs-unix": [
|
|
||||||
"xdebug.so"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"xz": {
|
"xz": {
|
||||||
"source": "xz",
|
"source": "xz",
|
||||||
"static-libs-unix": [
|
"static-libs-unix": [
|
||||||
|
|||||||
@ -914,11 +914,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"xdebug": {
|
"xdebug": {
|
||||||
"type": "ghrel",
|
"type": "url",
|
||||||
"repo": "xdebug/xdebug",
|
"url": "https://pecl.php.net/get/xdebug",
|
||||||
"match": "Source code",
|
"filename": "xdebug.tgz",
|
||||||
"prefer-stable": true,
|
|
||||||
"provide-pre-built": false,
|
|
||||||
"license": {
|
"license": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"path": "LICENSE"
|
"path": "LICENSE"
|
||||||
|
|||||||
@ -106,6 +106,21 @@ class Config
|
|||||||
return self::$lib;
|
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 FileSystemException
|
||||||
* @throws WrongUsageException
|
* @throws WrongUsageException
|
||||||
|
|||||||
@ -40,9 +40,6 @@ class GlobalEnvManager
|
|||||||
self::putenv('PATH=' . BUILD_ROOT_PATH . '/bin:' . getenv('PATH'));
|
self::putenv('PATH=' . BUILD_ROOT_PATH . '/bin:' . getenv('PATH'));
|
||||||
self::putenv('PKG_CONFIG=' . BUILD_BIN_PATH . '/pkg-config');
|
self::putenv('PKG_CONFIG=' . BUILD_BIN_PATH . '/pkg-config');
|
||||||
self::putenv('PKG_CONFIG_PATH=' . BUILD_ROOT_PATH . '/lib/pkgconfig');
|
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
|
// Define env vars for linux
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user