158 lines
8.4 KiB
INI
Raw Permalink Normal View History

2025-10-31 16:48:36 +08:00
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2024-10-01 15:37:37 +08:00
; static-php-cli (spc) env configuration
;
; This file is used to set default env vars for static-php-cli build.
; As dynamic build process, some of these vars can be overwritten by CLI options.
; And you can also overwrite these vars by setting them in your shell environment.
2025-10-31 16:48:36 +08:00
; The value should be changed only if you know what you are doing. Otherwise, please leave them as default.
2024-10-01 15:37:37 +08:00
;
; We need to use some pre-defined internal env vars, like `BUILD_ROOT_PATH`, `DOWNLOAD_PATH`, etc.
2025-10-31 16:48:36 +08:00
; Please note that these vars cannot be defined in this file, they should only be defined before static-php-cli running.
2024-10-01 15:37:37 +08:00
;
2025-10-31 16:48:36 +08:00
; Here's a list of env vars, these variables will be defined if not defined:
;
2024-10-01 15:37:37 +08:00
; BUILD_ROOT_PATH: the root path of the build process. (default: `$(pwd)/buildroot`)
; BUILD_INCLUDE_PATH: the path of the include files. (default: `$BUILD_ROOT_PATH/include`)
; BUILD_LIB_PATH: the path of the lib files. (default: `$BUILD_ROOT_PATH/lib`)
; BUILD_BIN_PATH: the path of the bin files. (default: `$BUILD_ROOT_PATH/bin`)
2025-10-31 16:48:36 +08:00
; BUILD_MODULES_PATH: the path of the php modules (shared extensions) files. (default: `$BUILD_ROOT_PATH/modules`)
; PKG_ROOT_PATH: the root path of the package files. (default: `$(pwd)/pkgroot/$GNU_ARCH-{darwin|linux|windows}`)
2024-10-01 15:37:37 +08:00
; SOURCE_PATH: the path of the source files. (default: `$(pwd)/source`)
; DOWNLOAD_PATH: the path of the download files. (default: `$(pwd)/downloads`)
2025-10-31 16:48:36 +08:00
; PATH: (*nix only) static-php-cli will add `$BUILD_BIN_PATH` to PATH.
; PKG_CONFIG_PATH: (*nix only) static-php-cli will set `$BUILD_LIB_PATH/pkgconfig` to PKG_CONFIG_PATH.
2024-10-01 15:37:37 +08:00
;
2025-10-31 16:48:36 +08:00
; Here's a list of env vars, these variables is defined in SPC and cannot be changed anywhere:
2024-10-01 15:37:37 +08:00
;
2025-10-31 16:48:36 +08:00
; SPC_VERSION: the version of static-php-cli.
; WORKING_DIR: the working directory of the build process. (default: `$(pwd)`)
; ROOT_DIR: the root directory of static-php-cli. (default: `/path/to/static-php-cli`, when running in phar or micro mode: `phar://path/to/spc.phar`)
; CPU_COUNT: the count of the CPU cores. (default: `$(nproc)`)
; SPC_ARCH: the arch of the current system, for some libraries needed `--host=XXX` args. (default: `$(uname -m)`, e.g. `x86_64`, `aarch64`, `arm64`)
; GNU_ARCH: the GNU arch of the current system. (default: `$(uname -m)`, e.g. `x86_64`, `aarch64`)
; MAC_ARCH: the MAC arch of the current system. (default: `$(uname -m)`, e.g. `x86_64`, `arm64`)
; PKG_CONFIG: (*nix only) static-php-cli will set `$BUILD_BIN_PATH/pkg-config` to PKG_CONFIG.
; SPC_LINUX_DEFAULT_CC: (linux only) the default compiler for linux. (For alpine linux: `gcc`, default: `$GNU_ARCH-linux-musl-gcc`)
; SPC_LINUX_DEFAULT_CXX: (linux only) the default c++ compiler for linux. (For alpine linux: `g++`, default: `$GNU_ARCH-linux-musl-g++`)
; SPC_LINUX_DEFAULT_AR: (linux only) the default archiver for linux. (For alpine linux: `ar`, default: `$GNU_ARCH-linux-musl-ar`)
; SPC_EXTRA_PHP_VARS: (linux only) the extra vars for building php, used in `configure` and `make` command.
2024-10-01 15:37:37 +08:00
[global]
2024-10-03 15:25:44 +08:00
; Build concurrency for make -jN, default is CPU_COUNT, this value are used in every libs.
2024-10-01 15:37:37 +08:00
SPC_CONCURRENCY=${CPU_COUNT}
; Ignore PHP version check before building some extensions
SPC_SKIP_PHP_VERSION_CHECK="no"
2024-10-03 14:53:25 +08:00
; Ignore some check item for bin/spc doctor command, comma separated (e.g. SPC_SKIP_DOCTOR_CHECK_ITEMS="if homebrew has installed")
SPC_SKIP_DOCTOR_CHECK_ITEMS=""
2025-06-18 10:48:09 +07:00
; extra modules that xcaddy will include in the FrankenPHP build
SPC_CMD_VAR_FRANKENPHP_XCADDY_MODULES="--with github.com/dunglas/mercure/caddy --with github.com/dunglas/vulcain/caddy --with github.com/dunglas/caddy-cbrotli"
2025-08-01 10:58:31 +08:00
; The display message for php version output (PHP >= 8.4 available)
PHP_BUILD_PROVIDER="static-php-cli ${SPC_VERSION}"
2025-06-18 10:48:09 +07:00
; EXTENSION_DIR where the built php will look for extension when a .ini instructs to load them
; only useful for builds targeting not pure-static linking
; default paths
; Ubuntu/Debian: /usr/lib/php/{PHP_VERSION}/
; RHEL: /usr/lib64/php/modules
; Alpine: /usr/lib/php{PHP_VERSION}/modules
; where {PHP_VERSION} is 84 for php 8.4
2025-04-14 11:01:39 +07:00
; EXTENSION_DIR=
2024-10-01 15:37:37 +08:00
[windows]
; build target: win7-static
2025-06-29 16:03:38 +08:00
SPC_TARGET=native-windows
2024-10-01 15:37:37 +08:00
; php-sdk-binary-tools path
2024-10-04 18:20:25 +08:00
PHP_SDK_PATH="${WORKING_DIR}\php-sdk-binary-tools"
2024-10-01 15:37:37 +08:00
; upx executable path
2024-10-04 18:20:25 +08:00
UPX_EXEC="${PKG_ROOT_PATH}\bin\upx.exe"
2024-10-01 15:37:37 +08:00
; phpmicro patches, for more info, see: https://github.com/easysoft/phpmicro/tree/master/patches
2025-10-25 13:42:04 +08:00
SPC_MICRO_PATCHES=static_extensions_win32,cli_checks,disable_huge_page,vcruntime140,win32,zend_stream,cli_static,win32_api
2024-10-01 15:37:37 +08:00
[linux]
2025-07-01 14:01:48 +07:00
; Linux can use different build toolchains.
; - musl (default, when SPC_LIBC=musl): used for general linux distros, can build `musl` (statically linked) only.
; - zig (will become default): usable on all Linux distros, can build `-musl`, `arch-linux-musl -dynamic` and `arch-linux-gnu` targets. Can specify version such as `x86_64-linux-gnu.2.17`.
; - musl-native: used for alpine linux, can build `musl` and `musl -dynamic` target.
; - gnu-native: used for general linux distros, can build gnu target for the installed glibc version only.
; option to specify the target, superceded by SPC_TARGET if set
SPC_LIBC=musl
; uncomment to link libc dynamically on musl
; SPC_MUSL_DYNAMIC=true
2025-07-01 14:01:48 +07:00
; Recommended: specify your target here. Zig toolchain will be used.
; examples:
2025-07-01 14:07:41 +07:00
; `native-native-gnu` - links against glibc, current OS version
; `native-native-gnu.2.17` - links against glibc, version 2.17
; `native-native` - links against system libc dynamically
; `native-native-musl` - links against musl libc statically
; `native-native-musl -dynamic` - links against musl libc dynamically
2025-07-01 14:01:48 +07:00
; SPC_TARGET=
2024-10-01 15:37:37 +08:00
; compiler environments
CC=${SPC_LINUX_DEFAULT_CC}
CXX=${SPC_LINUX_DEFAULT_CXX}
AR=${SPC_LINUX_DEFAULT_AR}
LD=${SPC_LINUX_DEFAULT_LD}
2024-10-01 15:37:37 +08:00
; 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"
SPC_DEFAULT_LD_FLAGS=""
2024-10-01 15:37:37 +08:00
; 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=cli_checks,disable_huge_page
2024-10-01 15:37:37 +08:00
; *** default build command for building php ***
; buildconf command
SPC_CMD_PREFIX_PHP_BUILDCONF="./buildconf --force"
; configure command
2025-09-04 14:05:00 +08:00
SPC_CMD_PREFIX_PHP_CONFIGURE="./configure --prefix= --with-valgrind=no --disable-shared --enable-static --disable-all --disable-phpdbg --with-pic"
2024-10-01 15:37:37 +08:00
; *** default build vars for building php ***
2025-07-25 12:44:22 +08:00
; embed type for php, static (libphp.a) or shared (libphp.so)
SPC_CMD_VAR_PHP_EMBED_TYPE="static"
; EXTRA_CFLAGS for `configure` and `make` php
2025-06-22 17:21:28 +07:00
SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS="-g -fstack-protector-strong -fno-ident -fPIE ${SPC_DEFAULT_C_FLAGS}"
; EXTRA_LDFLAGS for `make` php, can use -release to set a soname for libphp.so
SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS=""
2024-10-01 15:37:37 +08:00
2026-01-19 10:22:33 +01:00
; optional, path to openssl conf. This affects where openssl will look for the default CA.
; default on Debian/Alpine: /etc/ssl, default on RHEL: /etc/pki/tls
OPENSSLDIR=""
2024-10-01 15:37:37 +08:00
[macos]
; build target: macho or macho (possibly we could support macho-universal in the future)
; Currently we do not support universal and cross-compilation for macOS.
2025-06-29 16:03:38 +08:00
SPC_TARGET=native-macos
2024-10-01 15:37:37 +08:00
; compiler environments
CC=clang
CXX=clang++
2025-08-22 13:19:42 +08:00
AR=ar
LD=ld
2024-10-01 15:37:37 +08:00
; default compiler flags, used in CMake toolchain file, openssl and pkg-config build
2025-06-12 11:01:05 +07:00
SPC_DEFAULT_C_FLAGS="--target=${MAC_ARCH}-apple-darwin -Os"
SPC_DEFAULT_CXX_FLAGS="--target=${MAC_ARCH}-apple-darwin -Os"
2025-07-29 09:20:33 +07:00
SPC_DEFAULT_LD_FLAGS=""
2024-10-01 15:37:37 +08:00
; phpmicro patches, for more info, see: https://github.com/easysoft/phpmicro/tree/master/patches
2025-06-28 16:47:19 +08:00
SPC_MICRO_PATCHES=cli_checks,macos_iconv
2024-10-01 15:37:37 +08:00
; *** default build command for building php ***
; buildconf command
SPC_CMD_PREFIX_PHP_BUILDCONF="./buildconf --force"
; configure command
2025-09-04 14:05:00 +08:00
SPC_CMD_PREFIX_PHP_CONFIGURE="./configure --prefix= --with-valgrind=no --enable-shared=no --enable-static=yes --disable-all --disable-phpdbg"
2024-10-01 15:37:37 +08:00
; *** default build vars for building php ***
2025-07-25 12:44:22 +08:00
; embed type for php, static (libphp.a) or shared (libphp.dylib)
SPC_CMD_VAR_PHP_EMBED_TYPE="static"
; EXTRA_CFLAGS for `configure` and `make` php
SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS="-g -fstack-protector-strong -fpic -fpie -Werror=unknown-warning-option ${SPC_DEFAULT_C_FLAGS}"
; minimum compatible macOS version (LLVM vars, availability not guaranteed)
MACOSX_DEPLOYMENT_TARGET=12.0
2024-10-01 15:37:37 +08:00
[freebsd]
; compiler environments
CC=clang
CXX=clang++