mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-02 14:25:41 +08:00
[3.0] Refactor new extensions (#1051)
This commit is contained in:
9
config/artifact/ncurses.yml
Normal file
9
config/artifact/ncurses.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
ncurses:
|
||||
binary: hosted
|
||||
metadata:
|
||||
license-files:
|
||||
- COPYING
|
||||
source:
|
||||
type: filelist
|
||||
url: 'https://ftp.gnu.org/pub/gnu/ncurses/'
|
||||
regex: '/href="(?<file>ncurses-(?<version>[^"]+)\.tar\.gz)"/'
|
||||
@@ -121,6 +121,8 @@ SPC_CMD_PREFIX_PHP_CONFIGURE="./configure --prefix= --with-valgrind=no --disable
|
||||
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 -fno-ident -fPIE ${SPC_DEFAULT_C_FLAGS}"
|
||||
; EXTRA_CXXFLAGS for `configure` and `make` php
|
||||
SPC_CMD_VAR_PHP_MAKE_EXTRA_CXXFLAGS="-g -fstack-protector-strong -fno-ident -fPIE ${SPC_DEFAULT_CXX_FLAGS}"
|
||||
; EXTRA_LDFLAGS for `make` php, can use -release to set a soname for libphp.so
|
||||
SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS=""
|
||||
|
||||
@@ -155,5 +157,9 @@ SPC_CMD_PREFIX_PHP_CONFIGURE="./configure --prefix= --with-valgrind=no --enable-
|
||||
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}"
|
||||
; EXTRA_CXXFLAGS for `configure` and `make` php
|
||||
SPC_CMD_VAR_PHP_MAKE_EXTRA_CXXFLAGS="-g -fstack-protector-strong -fno-ident -fpie -Werror=unknown-warning-option ${SPC_DEFAULT_CXX_FLAGS}"
|
||||
; EXTRA_LDFLAGS for `make` php, can use -release to set a soname for libphp.dylib
|
||||
SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS=""
|
||||
; minimum compatible macOS version (LLVM vars, availability not guaranteed)
|
||||
MACOSX_DEPLOYMENT_TARGET=12.0
|
||||
|
||||
@@ -1,5 +1,110 @@
|
||||
ext-bcmath:
|
||||
type: php-extension
|
||||
ext-bz2:
|
||||
type: php-extension
|
||||
depends:
|
||||
- bzip2
|
||||
php-extension:
|
||||
arg-type@unix: with-path
|
||||
arg-type@windows: with
|
||||
ext-calendar:
|
||||
type: php-extension
|
||||
ext-ctype:
|
||||
type: php-extension
|
||||
ext-curl:
|
||||
type: php-extension
|
||||
depends:
|
||||
- curl
|
||||
depends@windows:
|
||||
- ext-zlib
|
||||
- ext-openssl
|
||||
php-extension:
|
||||
arg-type: with
|
||||
ext-dba:
|
||||
type: php-extension
|
||||
suggests:
|
||||
- qdbm
|
||||
php-extension:
|
||||
arg-type: custom
|
||||
ext-dom:
|
||||
type: php-extension
|
||||
depends:
|
||||
- libxml2
|
||||
- ext-xml
|
||||
php-extension:
|
||||
arg-type: '--enable-dom@shared_suffix@ --with-libxml=@build_root_path@'
|
||||
arg-type@windows: with
|
||||
ext-exif:
|
||||
type: php-extension
|
||||
ext-ffi:
|
||||
type: php-extension
|
||||
depends@unix:
|
||||
- libffi
|
||||
php-extension:
|
||||
arg-type@unix: '--with-ffi=@shared_suffix@ --enable-zend-signals'
|
||||
arg-type@windows: with
|
||||
ext-fileinfo:
|
||||
type: php-extension
|
||||
ext-filter:
|
||||
type: php-extension
|
||||
ext-ftp:
|
||||
type: php-extension
|
||||
suggests:
|
||||
- ext-openssl
|
||||
ext-gd:
|
||||
type: php-extension
|
||||
depends:
|
||||
- zlib
|
||||
- libpng
|
||||
- ext-zlib
|
||||
suggests:
|
||||
- libavif
|
||||
- libwebp
|
||||
- libjpeg
|
||||
- freetype
|
||||
php-extension:
|
||||
arg-type: custom
|
||||
ext-gettext:
|
||||
type: php-extension
|
||||
depends:
|
||||
- gettext
|
||||
php-extension:
|
||||
arg-type: with-path
|
||||
ext-gmp:
|
||||
type: php-extension
|
||||
depends:
|
||||
- gmp
|
||||
php-extension:
|
||||
arg-type: with-path
|
||||
ext-iconv:
|
||||
type: php-extension
|
||||
depends@unix:
|
||||
- libiconv
|
||||
php-extension:
|
||||
arg-type@unix: with-path
|
||||
arg-type@windows: with
|
||||
ext-intl:
|
||||
type: php-extension
|
||||
depends@unix:
|
||||
- icu
|
||||
ext-ldap:
|
||||
type: php-extension
|
||||
depends:
|
||||
- ldap
|
||||
suggests:
|
||||
- gmp
|
||||
- libsodium
|
||||
- ext-openssl
|
||||
php-extension:
|
||||
arg-type: with-path
|
||||
ext-libxml:
|
||||
type: php-extension
|
||||
depends:
|
||||
- ext-xml
|
||||
php-extension:
|
||||
build-with-php: true
|
||||
build-shared: false
|
||||
arg-type: none
|
||||
ext-mbregex:
|
||||
type: php-extension
|
||||
depends:
|
||||
@@ -14,6 +119,34 @@ ext-mbstring:
|
||||
type: php-extension
|
||||
php-extension:
|
||||
arg-type: custom
|
||||
ext-mysqli:
|
||||
type: php-extension
|
||||
depends:
|
||||
- ext-mysqlnd
|
||||
php-extension:
|
||||
arg-type: with
|
||||
build-with-php: true
|
||||
ext-mysqlnd:
|
||||
type: php-extension
|
||||
depends:
|
||||
- zlib
|
||||
php-extension:
|
||||
arg-type@unix: enable
|
||||
arg-type@windows: with
|
||||
build-with-php: true
|
||||
ext-odbc:
|
||||
type: php-extension
|
||||
depends@unix:
|
||||
- unixodbc
|
||||
php-extension:
|
||||
arg-type@unix: '--with-unixODBC@shared_path_suffix@'
|
||||
ext-opcache:
|
||||
type: php-extension
|
||||
php-extension:
|
||||
arg-type@unix: custom
|
||||
arg-type@windows: enable
|
||||
zend-extension: true
|
||||
display-name: 'Zend Opcache'
|
||||
ext-openssl:
|
||||
type: php-extension
|
||||
depends:
|
||||
@@ -24,10 +157,65 @@ ext-openssl:
|
||||
arg-type: custom
|
||||
arg-type@windows: with
|
||||
build-with-php: true
|
||||
ext-password-argon2:
|
||||
type: php-extension
|
||||
depends:
|
||||
- libargon2
|
||||
- ext-openssl
|
||||
php-extension:
|
||||
arg-type: custom
|
||||
display-name: ''
|
||||
ext-pcntl:
|
||||
type: php-extension
|
||||
ext-pdo:
|
||||
type: php-extension
|
||||
ext-pdo_mysql:
|
||||
type: php-extension
|
||||
depends:
|
||||
- ext-pdo
|
||||
- ext-mysqlnd
|
||||
php-extension:
|
||||
arg-type: with
|
||||
ext-pdo_odbc:
|
||||
type: php-extension
|
||||
depends:
|
||||
- ext-pdo
|
||||
- ext-odbc
|
||||
depends@unix:
|
||||
- unixodbc
|
||||
- ext-pdo
|
||||
- ext-odbc
|
||||
php-extension:
|
||||
arg-type: custom
|
||||
ext-pdo_pgsql:
|
||||
type: php-extension
|
||||
depends@unix:
|
||||
- ext-pdo
|
||||
- ext-pgsql
|
||||
- postgresql
|
||||
php-extension:
|
||||
arg-type@unix: with-path
|
||||
arg-type@windows: '--with-pdo-pgsql=yes'
|
||||
ext-pdo_sqlite:
|
||||
type: php-extension
|
||||
depends:
|
||||
- ext-pdo
|
||||
- ext-sqlite3
|
||||
- sqlite
|
||||
php-extension:
|
||||
arg-type: with
|
||||
ext-pgsql:
|
||||
type: php-extension
|
||||
depends@unix:
|
||||
- postgresql
|
||||
php-extension:
|
||||
arg-type: custom
|
||||
ext-phar:
|
||||
type: php-extension
|
||||
depends:
|
||||
- zlib
|
||||
ext-posix:
|
||||
type: php-extension
|
||||
ext-readline:
|
||||
type: php-extension
|
||||
depends:
|
||||
@@ -36,9 +224,118 @@ ext-readline:
|
||||
support:
|
||||
Windows: wip
|
||||
BSD: wip
|
||||
arg-type: with-path
|
||||
arg-type: '--with-libedit --without-readline'
|
||||
build-shared: false
|
||||
build-static: true
|
||||
ext-session:
|
||||
type: php-extension
|
||||
ext-shmop:
|
||||
type: php-extension
|
||||
php-extension:
|
||||
build-with-php: true
|
||||
ext-simplexml:
|
||||
type: php-extension
|
||||
depends:
|
||||
- ext-xml
|
||||
php-extension:
|
||||
arg-type@unix: '--enable-simplexml@shared_suffix@ --with-libxml=@build_root_path@'
|
||||
arg-type@windows: with
|
||||
build-with-php: true
|
||||
ext-snmp:
|
||||
type: php-extension
|
||||
depends:
|
||||
- net-snmp
|
||||
php-extension:
|
||||
arg-type: with
|
||||
ext-soap:
|
||||
type: php-extension
|
||||
depends:
|
||||
- ext-xml
|
||||
- ext-session
|
||||
php-extension:
|
||||
arg-type@unix: '--enable-soap@shared_suffix@ --with-libxml=@build_root_path@'
|
||||
arg-type@windows: with
|
||||
build-with-php: true
|
||||
ext-sockets:
|
||||
type: php-extension
|
||||
ext-sodium:
|
||||
type: php-extension
|
||||
depends:
|
||||
- libsodium
|
||||
php-extension:
|
||||
arg-type: with
|
||||
ext-sqlite3:
|
||||
type: php-extension
|
||||
depends:
|
||||
- sqlite
|
||||
php-extension:
|
||||
arg-type@unix: with-path
|
||||
arg-type@windows: with
|
||||
build-with-php: true
|
||||
ext-sysvmsg:
|
||||
type: php-extension
|
||||
php-extension:
|
||||
support:
|
||||
Windows: 'no'
|
||||
BSD: wip
|
||||
ext-sysvsem:
|
||||
type: php-extension
|
||||
php-extension:
|
||||
support:
|
||||
Windows: 'no'
|
||||
BSD: wip
|
||||
ext-sysvshm:
|
||||
type: php-extension
|
||||
php-extension:
|
||||
support:
|
||||
BSD: wip
|
||||
ext-tidy:
|
||||
type: php-extension
|
||||
depends:
|
||||
- tidy
|
||||
php-extension:
|
||||
support:
|
||||
Windows: wip
|
||||
BSD: wip
|
||||
arg-type: with-path
|
||||
ext-tokenizer:
|
||||
type: php-extension
|
||||
php-extension:
|
||||
build-with-php: true
|
||||
ext-xml:
|
||||
type: php-extension
|
||||
depends:
|
||||
- libxml2
|
||||
depends@windows:
|
||||
- libxml2
|
||||
- ext-iconv
|
||||
php-extension:
|
||||
arg-type: '--enable-xml@shared_suffix@ --with-libxml=@build_root_path@'
|
||||
arg-type@windows: with
|
||||
build-with-php: true
|
||||
ext-xmlreader:
|
||||
type: php-extension
|
||||
depends:
|
||||
- libxml2
|
||||
php-extension:
|
||||
arg-type: '--enable-xmlreader@shared_suffix@ --with-libxml=@build_root_path@'
|
||||
build-with-php: true
|
||||
ext-xmlwriter:
|
||||
type: php-extension
|
||||
depends:
|
||||
- libxml2
|
||||
php-extension:
|
||||
arg-type: '--enable-xmlwriter@shared_suffix@ --with-libxml=@build_root_path@'
|
||||
build-with-php: true
|
||||
ext-xsl:
|
||||
type: php-extension
|
||||
depends:
|
||||
- libxslt
|
||||
- ext-xml
|
||||
- ext-dom
|
||||
php-extension:
|
||||
arg-type: with-path
|
||||
build-with-php: true
|
||||
ext-zlib:
|
||||
type: php-extension
|
||||
depends:
|
||||
|
||||
@@ -4,3 +4,6 @@ ext-ast:
|
||||
source:
|
||||
type: pecl
|
||||
name: ast
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: BSD-3-Clause
|
||||
|
||||
13
config/pkg/ext/ext-brotli.yml
Normal file
13
config/pkg/ext/ext-brotli.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
ext-brotli:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: git
|
||||
extract: php-src/ext/brotli
|
||||
rev: master
|
||||
url: 'https://github.com/kjdev/php-ext-brotli'
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: MIT
|
||||
depends:
|
||||
- brotli
|
||||
9
config/pkg/ext/ext-dio.yml
Normal file
9
config/pkg/ext/ext-dio.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
ext-dio:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: pecl
|
||||
name: dio
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: PHP-3.01
|
||||
9
config/pkg/ext/ext-ds.yml
Normal file
9
config/pkg/ext/ext-ds.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
ext-ds:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: pecl
|
||||
name: ds
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: MIT
|
||||
13
config/pkg/ext/ext-ev.yml
Normal file
13
config/pkg/ext/ext-ev.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
ext-ev:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: pecl
|
||||
name: ev
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: PHP-3.01
|
||||
depends:
|
||||
- ext-sockets
|
||||
php-extension:
|
||||
arg-type@windows: with
|
||||
19
config/pkg/ext/ext-event.yml
Normal file
19
config/pkg/ext/ext-event.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
ext-event:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: url
|
||||
url: 'https://bitbucket.org/osmanov/pecl-event/get/3.1.4.tar.gz'
|
||||
extract: php-src/ext/event
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: PHP-3.01
|
||||
depends:
|
||||
- libevent
|
||||
- ext-openssl
|
||||
suggests:
|
||||
- ext-sockets
|
||||
php-extension:
|
||||
support:
|
||||
Windows: wip
|
||||
arg-type: custom
|
||||
9
config/pkg/ext/ext-excimer.yml
Normal file
9
config/pkg/ext/ext-excimer.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
ext-excimer:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: pecl
|
||||
name: excimer
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: PHP-3.01
|
||||
@@ -3,3 +3,5 @@ ext-glfw:
|
||||
artifact: glfw
|
||||
depends:
|
||||
- glfw
|
||||
php-extension:
|
||||
arg-type@unix: '--enable-glfw --with-glfw-dir=@build_root_path@'
|
||||
|
||||
12
config/pkg/ext/ext-gmssl.yml
Normal file
12
config/pkg/ext/ext-gmssl.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
ext-gmssl:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: ghtar
|
||||
repo: gmssl/GmSSL-PHP
|
||||
extract: php-src/ext/gmssl
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: PHP-3.01
|
||||
depends:
|
||||
- gmssl
|
||||
14
config/pkg/ext/ext-grpc.yml
Normal file
14
config/pkg/ext/ext-grpc.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
ext-grpc:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: pecl
|
||||
name: grpc
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: Apache-2.0
|
||||
depends:
|
||||
- grpc
|
||||
lang: cpp
|
||||
php-extension:
|
||||
arg-type@unix: enable-path
|
||||
12
config/pkg/ext/ext-igbinary.yml
Normal file
12
config/pkg/ext/ext-igbinary.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
ext-igbinary:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: pecl
|
||||
name: igbinary
|
||||
metadata:
|
||||
license-files: [COPYING]
|
||||
license: BSD-3-Clause
|
||||
suggests:
|
||||
- ext-session
|
||||
- ext-apcu
|
||||
13
config/pkg/ext/ext-imagick.yml
Normal file
13
config/pkg/ext/ext-imagick.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
ext-imagick:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: pecl
|
||||
name: imagick
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: PHP-3.01
|
||||
depends:
|
||||
- imagemagick
|
||||
php-extension:
|
||||
arg-type: custom
|
||||
15
config/pkg/ext/ext-imap.yml
Normal file
15
config/pkg/ext/ext-imap.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
ext-imap:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: pecl
|
||||
name: imap
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: PHP-3.01
|
||||
depends:
|
||||
- imap
|
||||
suggests:
|
||||
- ext-openssl
|
||||
php-extension:
|
||||
arg-type: custom
|
||||
9
config/pkg/ext/ext-inotify.yml
Normal file
9
config/pkg/ext/ext-inotify.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
ext-inotify:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: pecl
|
||||
name: inotify
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: PHP-3.01
|
||||
15
config/pkg/ext/ext-lz4.yml
Normal file
15
config/pkg/ext/ext-lz4.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
ext-lz4:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: ghtagtar
|
||||
repo: kjdev/php-ext-lz4
|
||||
extract: php-src/ext/lz4
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: MIT
|
||||
depends:
|
||||
- liblz4
|
||||
php-extension:
|
||||
arg-type@unix: '--enable-lz4=@shared_suffix@ --with-lz4-includedir=@build_root_path@'
|
||||
arg-type@windows: '--enable-lz4'
|
||||
13
config/pkg/ext/ext-maxminddb.yml
Normal file
13
config/pkg/ext/ext-maxminddb.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
ext-maxminddb:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: pecl
|
||||
name: maxminddb
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: Apache-2.0
|
||||
depends:
|
||||
- libmaxminddb
|
||||
php-extension:
|
||||
arg-type: with
|
||||
14
config/pkg/ext/ext-memcache.yml
Normal file
14
config/pkg/ext/ext-memcache.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
ext-memcache:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: pecl
|
||||
name: memcache
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: PHP-3.0
|
||||
depends:
|
||||
- ext-zlib
|
||||
- ext-session
|
||||
php-extension:
|
||||
arg-type: '--enable-memcache@shared_suffix@ --with-zlib-dir=@build_root_path@'
|
||||
23
config/pkg/ext/ext-memcached.yml
Normal file
23
config/pkg/ext/ext-memcached.yml
Normal file
@@ -0,0 +1,23 @@
|
||||
ext-memcached:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: pecl
|
||||
name: memcached
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: PHP-3.01
|
||||
depends:
|
||||
- libmemcached
|
||||
depends@unix:
|
||||
- libmemcached
|
||||
- fastlz
|
||||
- ext-session
|
||||
- ext-zlib
|
||||
suggests:
|
||||
- zstd
|
||||
- ext-igbinary
|
||||
- ext-msgpack
|
||||
- ext-session
|
||||
php-extension:
|
||||
arg-type: '--enable-memcached@shared_suffix@ --with-zlib-dir=@build_root_path@'
|
||||
21
config/pkg/ext/ext-mongodb.yml
Normal file
21
config/pkg/ext/ext-mongodb.yml
Normal file
@@ -0,0 +1,21 @@
|
||||
ext-mongodb:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: ghrel
|
||||
repo: mongodb/mongo-php-driver
|
||||
match: mongodb.+\.tgz
|
||||
extract: php-src/ext/mongodb
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: PHP-3.01
|
||||
suggests:
|
||||
- icu
|
||||
- openssl
|
||||
- zstd
|
||||
- zlib
|
||||
frameworks:
|
||||
- CoreFoundation
|
||||
- Security
|
||||
php-extension:
|
||||
arg-type: custom
|
||||
14
config/pkg/ext/ext-msgpack.yml
Normal file
14
config/pkg/ext/ext-msgpack.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
ext-msgpack:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: pecl
|
||||
name: msgpack
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: BSD-3-Clause
|
||||
depends:
|
||||
- ext-session
|
||||
php-extension:
|
||||
arg-type@unix: with
|
||||
arg-type@windows: enable
|
||||
18
config/pkg/ext/ext-mysqlnd_ed25519.yml
Normal file
18
config/pkg/ext/ext-mysqlnd_ed25519.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
ext-mysqlnd_ed25519:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: pie
|
||||
repo: mariadb/mysqlnd_ed25519
|
||||
extract: php-src/ext/mysqlnd_ed25519
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: BSD-3-Clause
|
||||
depends:
|
||||
- ext-mysqlnd
|
||||
- libsodium
|
||||
suggests:
|
||||
- openssl
|
||||
php-extension:
|
||||
arg-type: '--with-mysqlnd_ed25519=@shared_suffix@'
|
||||
build-static: false
|
||||
17
config/pkg/ext/ext-mysqlnd_parsec.yml
Normal file
17
config/pkg/ext/ext-mysqlnd_parsec.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
ext-mysqlnd_parsec:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: pie
|
||||
repo: mariadb/mysqlnd_parsec
|
||||
extract: php-src/ext/mysqlnd_parsec
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: BSD-3-Clause
|
||||
depends:
|
||||
- ext-mysqlnd
|
||||
- libsodium
|
||||
- openssl
|
||||
php-extension:
|
||||
arg-type: '--enable-mysqlnd_parsec'
|
||||
build-static: false
|
||||
9
config/pkg/ext/ext-opentelemetry.yml
Normal file
9
config/pkg/ext/ext-opentelemetry.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
ext-opentelemetry:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: pecl
|
||||
name: opentelemetry
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: Apache-2.0
|
||||
9
config/pkg/ext/ext-parallel.yml
Normal file
9
config/pkg/ext/ext-parallel.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
ext-parallel:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: pecl
|
||||
name: parallel
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: PHP-3.01
|
||||
12
config/pkg/ext/ext-pcov.yml
Normal file
12
config/pkg/ext/ext-pcov.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
ext-pcov:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: pecl
|
||||
name: pcov
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: PHP-3.01
|
||||
php-extension:
|
||||
build-static: false
|
||||
build-shared: true
|
||||
14
config/pkg/ext/ext-pdo_sqlsrv.yml
Normal file
14
config/pkg/ext/ext-pdo_sqlsrv.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
ext-pdo_sqlsrv:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: pecl
|
||||
name: pdo_sqlsrv
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: MIT
|
||||
depends:
|
||||
- ext-pdo
|
||||
- ext-sqlsrv
|
||||
php-extension:
|
||||
arg-type: with
|
||||
9
config/pkg/ext/ext-protobuf.yml
Normal file
9
config/pkg/ext/ext-protobuf.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
ext-protobuf:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: pecl
|
||||
name: protobuf
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: BSD-3-Clause
|
||||
12
config/pkg/ext/ext-rar.yml
Normal file
12
config/pkg/ext/ext-rar.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
ext-rar:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: git
|
||||
url: 'https://github.com/static-php/php-rar.git'
|
||||
rev: issue-php82
|
||||
extract: php-src/ext/rar
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: PHP-3.01
|
||||
lang: cpp
|
||||
15
config/pkg/ext/ext-rdkafka.yml
Normal file
15
config/pkg/ext/ext-rdkafka.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
ext-rdkafka:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: ghtar
|
||||
repo: arnaud-lb/php-rdkafka
|
||||
extract: php-src/ext/rdkafka
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: MIT
|
||||
depends:
|
||||
- librdkafka
|
||||
lang: cpp
|
||||
php-extension:
|
||||
arg-type: custom
|
||||
21
config/pkg/ext/ext-redis.yml
Normal file
21
config/pkg/ext/ext-redis.yml
Normal file
@@ -0,0 +1,21 @@
|
||||
ext-redis:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: pecl
|
||||
name: redis
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: PHP-3.01
|
||||
suggests:
|
||||
- ext-session
|
||||
- ext-igbinary
|
||||
- ext-msgpack
|
||||
suggests@unix:
|
||||
- ext-session
|
||||
- ext-igbinary
|
||||
- ext-msgpack
|
||||
- zstd
|
||||
- liblz4
|
||||
php-extension:
|
||||
arg-type: custom
|
||||
10
config/pkg/ext/ext-simdjson.yml
Normal file
10
config/pkg/ext/ext-simdjson.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
ext-simdjson:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: pecl
|
||||
name: simdjson
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: Apache-2.0
|
||||
lang: cpp
|
||||
18
config/pkg/ext/ext-snappy.yml
Normal file
18
config/pkg/ext/ext-snappy.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
ext-snappy:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: git
|
||||
url: 'https://github.com/kjdev/php-ext-snappy'
|
||||
rev: master
|
||||
extract: php-src/ext/snappy
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: PHP-3.01
|
||||
depends:
|
||||
- snappy
|
||||
suggests:
|
||||
- ext-apcu
|
||||
lang: cpp
|
||||
php-extension:
|
||||
arg-type@unix: '--enable-snappy --with-snappy-includedir=@build_root_path@'
|
||||
14
config/pkg/ext/ext-spx.yml
Normal file
14
config/pkg/ext/ext-spx.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
ext-spx:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: pie
|
||||
repo: noisebynorthwest/php-spx
|
||||
extract: php-src/ext/spx
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: GPL-3.0-or-later
|
||||
depends:
|
||||
- ext-zlib
|
||||
php-extension:
|
||||
arg-type: '--enable-SPX@shared_suffix@'
|
||||
15
config/pkg/ext/ext-sqlsrv.yml
Normal file
15
config/pkg/ext/ext-sqlsrv.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
ext-sqlsrv:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: pecl
|
||||
name: sqlsrv
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: MIT
|
||||
depends@linux:
|
||||
- unixodbc
|
||||
- ext-pcntl
|
||||
depends@macos:
|
||||
- unixodbc
|
||||
lang: cpp
|
||||
15
config/pkg/ext/ext-ssh2.yml
Normal file
15
config/pkg/ext/ext-ssh2.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
ext-ssh2:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: pecl
|
||||
name: ssh2
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: PHP-3.01
|
||||
depends:
|
||||
- libssh2
|
||||
- ext-openssl
|
||||
- ext-zlib
|
||||
php-extension:
|
||||
arg-type: with-path
|
||||
72
config/pkg/ext/ext-swoole.yml
Normal file
72
config/pkg/ext/ext-swoole.yml
Normal file
@@ -0,0 +1,72 @@
|
||||
ext-swoole:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: ghtar
|
||||
repo: swoole/swoole-src
|
||||
extract: php-src/ext/swoole
|
||||
match: v6\.+
|
||||
prefer-stable: true
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: Apache-2.0
|
||||
depends:
|
||||
- libcares
|
||||
- brotli
|
||||
- nghttp2
|
||||
- zlib
|
||||
- ext-openssl
|
||||
- ext-curl
|
||||
suggests:
|
||||
- zstd
|
||||
- ext-sockets
|
||||
- ext-swoole-hook-pgsql
|
||||
- ext-swoole-hook-mysql
|
||||
- ext-swoole-hook-sqlite
|
||||
- ext-swoole-hook-odbc
|
||||
suggests@linux:
|
||||
- zstd
|
||||
- liburing
|
||||
- ext-sockets
|
||||
- ext-swoole-hook-pgsql
|
||||
- ext-swoole-hook-mysql
|
||||
- ext-swoole-hook-sqlite
|
||||
- ext-swoole-hook-odbc
|
||||
lang: cpp
|
||||
php-extension:
|
||||
arg-type: custom
|
||||
ext-swoole-hook-mysql:
|
||||
type: php-extension
|
||||
depends:
|
||||
- ext-mysqlnd
|
||||
- ext-pdo
|
||||
- ext-pdo_mysql
|
||||
suggests:
|
||||
- ext-mysqli
|
||||
php-extension:
|
||||
arg-type: none
|
||||
display-name: swoole
|
||||
ext-swoole-hook-odbc:
|
||||
type: php-extension
|
||||
depends:
|
||||
- ext-pdo
|
||||
- unixodbc
|
||||
php-extension:
|
||||
arg-type: none
|
||||
display-name: swoole
|
||||
ext-swoole-hook-pgsql:
|
||||
type: php-extension
|
||||
depends:
|
||||
- ext-pgsql
|
||||
- ext-pdo
|
||||
php-extension:
|
||||
arg-type: none
|
||||
display-name: swoole
|
||||
ext-swoole-hook-sqlite:
|
||||
type: php-extension
|
||||
depends:
|
||||
- ext-sqlite3
|
||||
- ext-pdo
|
||||
php-extension:
|
||||
arg-type: none
|
||||
display-name: swoole
|
||||
18
config/pkg/ext/ext-swow.yml
Normal file
18
config/pkg/ext/ext-swow.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
ext-swow:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
extract: php-src/ext/swow-src
|
||||
type: ghtar
|
||||
repo: swow/swow
|
||||
prefer-stable: true
|
||||
metadata:
|
||||
license: Apache-2.0
|
||||
license-files: [LICENSE]
|
||||
suggests:
|
||||
- openssl
|
||||
- curl
|
||||
- ext-openssl
|
||||
- ext-curl
|
||||
php-extension:
|
||||
arg-type: custom
|
||||
14
config/pkg/ext/ext-trader.yml
Normal file
14
config/pkg/ext/ext-trader.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
ext-trader:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: pecl
|
||||
name: trader
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: BSD-2-Clause
|
||||
php-extension:
|
||||
support:
|
||||
BSD: wip
|
||||
Windows: wip
|
||||
arg-type: enable
|
||||
16
config/pkg/ext/ext-uuid.yml
Normal file
16
config/pkg/ext/ext-uuid.yml
Normal file
@@ -0,0 +1,16 @@
|
||||
ext-uuid:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: pecl
|
||||
name: uuid
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: LGPL-2.1-only
|
||||
depends:
|
||||
- libuuid
|
||||
php-extension:
|
||||
support:
|
||||
Windows: wip
|
||||
BSD: wip
|
||||
arg-type: with-path
|
||||
18
config/pkg/ext/ext-uv.yml
Normal file
18
config/pkg/ext/ext-uv.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
ext-uv:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: pecl
|
||||
name: uv
|
||||
prefer-stable: false
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: PHP-3.01
|
||||
depends:
|
||||
- libuv
|
||||
- ext-sockets
|
||||
php-extension:
|
||||
support:
|
||||
Windows: wip
|
||||
BSD: wip
|
||||
arg-type: with-path
|
||||
14
config/pkg/ext/ext-xdebug.yml
Normal file
14
config/pkg/ext/ext-xdebug.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
ext-xdebug:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: pie
|
||||
repo: xdebug/xdebug
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: Xdebug-1.03
|
||||
php-extension:
|
||||
zend-extension: true
|
||||
build-static: false
|
||||
build-shared: true
|
||||
build-with-php: false
|
||||
18
config/pkg/ext/ext-xhprof.yml
Normal file
18
config/pkg/ext/ext-xhprof.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
ext-xhprof:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: pecl
|
||||
name: xhprof
|
||||
extract: php-src/ext/xhprof-src
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: Apache-2.0
|
||||
depends:
|
||||
- ext-ctype
|
||||
php-extension:
|
||||
support:
|
||||
Windows: wip
|
||||
BSD: wip
|
||||
arg-type: enable
|
||||
build-with-php: true
|
||||
18
config/pkg/ext/ext-xlswriter.yml
Normal file
18
config/pkg/ext/ext-xlswriter.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
ext-xlswriter:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: pecl
|
||||
name: xlswriter
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: BSD-2-Clause
|
||||
depends:
|
||||
- ext-zlib
|
||||
- ext-zip
|
||||
suggests:
|
||||
- openssl
|
||||
php-extension:
|
||||
support:
|
||||
BSD: wip
|
||||
arg-type: custom
|
||||
15
config/pkg/ext/ext-xz.yml
Normal file
15
config/pkg/ext/ext-xz.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
ext-xz:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: git
|
||||
url: 'https://github.com/codemasher/php-ext-xz'
|
||||
rev: main
|
||||
extract: php-src/ext/xz
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: PHP-3.01
|
||||
depends:
|
||||
- xz
|
||||
php-extension:
|
||||
arg-type: with-path
|
||||
14
config/pkg/ext/ext-yac.yml
Normal file
14
config/pkg/ext/ext-yac.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
ext-yac:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: pecl
|
||||
name: yac
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: PHP-3.01
|
||||
depends@unix:
|
||||
- fastlz
|
||||
- ext-igbinary
|
||||
php-extension:
|
||||
arg-type@unix: '--enable-yac@shared_suffix@ --enable-igbinary --enable-json --with-system-fastlz'
|
||||
16
config/pkg/ext/ext-yaml.yml
Normal file
16
config/pkg/ext/ext-yaml.yml
Normal file
@@ -0,0 +1,16 @@
|
||||
ext-yaml:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: git
|
||||
url: 'https://github.com/php/pecl-file_formats-yaml'
|
||||
rev: php7
|
||||
extract: php-src/ext/yaml
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: MIT
|
||||
depends:
|
||||
- libyaml
|
||||
php-extension:
|
||||
arg-type@unix: with-path
|
||||
arg-type@windows: with
|
||||
17
config/pkg/ext/ext-zip.yml
Normal file
17
config/pkg/ext/ext-zip.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
ext-zip:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: pecl
|
||||
name: zip
|
||||
extract: ext-zip
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: PHP-3.01
|
||||
depends@unix:
|
||||
- libzip
|
||||
php-extension:
|
||||
support:
|
||||
BSD: wip
|
||||
arg-type: custom
|
||||
arg-type@windows: enable
|
||||
15
config/pkg/ext/ext-zstd.yml
Normal file
15
config/pkg/ext/ext-zstd.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
ext-zstd:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: git
|
||||
url: 'https://github.com/kjdev/php-ext-zstd'
|
||||
rev: master
|
||||
extract: php-src/ext/zstd
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: MIT
|
||||
depends:
|
||||
- zstd
|
||||
php-extension:
|
||||
arg-type: '--enable-zstd --with-libzstd=@build_root_path@'
|
||||
@@ -1,12 +1,10 @@
|
||||
ncurses:
|
||||
type: library
|
||||
artifact:
|
||||
source:
|
||||
type: filelist
|
||||
url: 'https://ftp.gnu.org/pub/gnu/ncurses/'
|
||||
regex: '/href="(?<file>ncurses-(?<version>[^"]+)\.tar\.gz)"/'
|
||||
binary: hosted
|
||||
metadata:
|
||||
license-files: [COPYING]
|
||||
artifact: ncurses
|
||||
static-libs@unix:
|
||||
- libncurses.a
|
||||
ncursesw:
|
||||
type: library
|
||||
artifact: ncurses
|
||||
static-libs@unix:
|
||||
- libncursesw.a
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
curl:
|
||||
type: library
|
||||
type: target
|
||||
artifact:
|
||||
source:
|
||||
type: ghrel
|
||||
@@ -29,5 +29,7 @@ curl:
|
||||
- SystemConfiguration
|
||||
headers:
|
||||
- curl
|
||||
static-bins@unix:
|
||||
- curl
|
||||
static-libs@unix:
|
||||
- libcurl.a
|
||||
@@ -2,5 +2,11 @@ go-xcaddy:
|
||||
type: target
|
||||
artifact:
|
||||
binary: custom
|
||||
env:
|
||||
GOROOT: '{pkg_root_path}/go-xcaddy'
|
||||
GOBIN: '{pkg_root_path}/go-xcaddy/bin'
|
||||
GOPATH: '{pkg_root_path}/go-xcaddy/go'
|
||||
path@unix:
|
||||
- '{pkg_root_path}/go-xcaddy/bin'
|
||||
static-bins:
|
||||
- xcaddy
|
||||
|
||||
10
config/pkg/target/htop.yml
Normal file
10
config/pkg/target/htop.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
htop:
|
||||
type: target
|
||||
artifact:
|
||||
source:
|
||||
type: ghrel
|
||||
repo: htop-dev/htop
|
||||
match: htop.+\.tar\.xz
|
||||
prefer-stable: true
|
||||
depends:
|
||||
- ncursesw
|
||||
8
config/pkg/target/protoc.yml
Normal file
8
config/pkg/target/protoc.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
protoc:
|
||||
type: target
|
||||
artifact:
|
||||
binary:
|
||||
linux-x86_64: { type: ghrel, repo: protocolbuffers/protobuf, match: 'protoc-([0-9.]+)-linux-x86_64\.zip', extract: '{pkg_root_path}/protoc' }
|
||||
linux-aarch64: { type: ghrel, repo: protocolbuffers/protobuf, match: 'protoc-([0-9.]+)-linux-aarch_64\.zip', extract: '{pkg_root_path}/protoc' }
|
||||
path:
|
||||
- '{pkg_root_path}/protoc/bin'
|
||||
6
config/pkg/target/rust.yml
Normal file
6
config/pkg/target/rust.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
rust:
|
||||
type: target
|
||||
artifact:
|
||||
binary: custom
|
||||
path:
|
||||
- '{pkg_root_path}/rust/bin'
|
||||
@@ -361,7 +361,7 @@
|
||||
},
|
||||
"gmp": {
|
||||
"type": "filelist",
|
||||
"url": "https://gmplib.org/download/gmp/",
|
||||
"url": "https://ftp.gnu.org/gnu/gmp/",
|
||||
"regex": "/href=\"(?<file>gmp-(?<version>[^\"]+)\\.tar\\.xz)\"/",
|
||||
"provide-pre-built": true,
|
||||
"alt": {
|
||||
|
||||
@@ -7,7 +7,6 @@ namespace Package\Artifact;
|
||||
use Package\Target\php;
|
||||
use StaticPHP\Attribute\Artifact\AfterSourceExtract;
|
||||
use StaticPHP\Attribute\PatchDescription;
|
||||
use StaticPHP\Runtime\SystemTarget;
|
||||
use StaticPHP\Util\FileSystem;
|
||||
use StaticPHP\Util\SourcePatcher;
|
||||
|
||||
@@ -52,16 +51,6 @@ class php_src
|
||||
}
|
||||
}
|
||||
|
||||
#[AfterSourceExtract('php-src')]
|
||||
#[PatchDescription('Patch FFI extension on CentOS 7 with -O3 optimization (strncmp issue)')]
|
||||
public function patchFfiCentos7FixO3strncmp(): void
|
||||
{
|
||||
spc_skip_if(!($ver = SystemTarget::getLibcVersion()) || version_compare($ver, '2.17', '>'));
|
||||
$ver_id = php::getPHPVersionID(return_null_if_failed: true);
|
||||
spc_skip_if($ver_id === null || $ver_id < 80316);
|
||||
SourcePatcher::patchFile('ffi_centos7_fix_O3_strncmp.patch', SOURCE_PATH . '/php-src');
|
||||
}
|
||||
|
||||
#[AfterSourceExtract('php-src')]
|
||||
#[PatchDescription('Add LICENSE file to IMAP extension if missing')]
|
||||
public function patchImapLicense(): void
|
||||
|
||||
85
src/Package/Artifact/rust.php
Normal file
85
src/Package/Artifact/rust.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Artifact;
|
||||
|
||||
use StaticPHP\Artifact\ArtifactDownloader;
|
||||
use StaticPHP\Artifact\Downloader\DownloadResult;
|
||||
use StaticPHP\Artifact\Downloader\Type\CheckUpdateResult;
|
||||
use StaticPHP\Attribute\Artifact\AfterBinaryExtract;
|
||||
use StaticPHP\Attribute\Artifact\CustomBinary;
|
||||
use StaticPHP\Attribute\Artifact\CustomBinaryCheckUpdate;
|
||||
use StaticPHP\Exception\DownloaderException;
|
||||
use StaticPHP\Runtime\SystemTarget;
|
||||
use StaticPHP\Util\System\LinuxUtil;
|
||||
|
||||
class rust
|
||||
{
|
||||
#[CustomBinary('rust', [
|
||||
'linux-x86_64',
|
||||
'linux-aarch64',
|
||||
])]
|
||||
public function downBinary(ArtifactDownloader $downloader): DownloadResult
|
||||
{
|
||||
// determine distro first
|
||||
$distro = LinuxUtil::isMuslDist() ? 'musl' : 'gnu';
|
||||
$arch = SystemTarget::getTargetArch();
|
||||
|
||||
// get latest rust version from link
|
||||
$toml_config = default_shell()->executeCurl('https://static.rust-lang.org/dist/channel-rust-stable.toml', retries: $downloader->getRetry());
|
||||
// parse toml by regex since we want to avoid adding a toml parser dependency just for this
|
||||
$cnt = preg_match_all('/^version = "([^"]+)"$/m', $toml_config ?: '', $matches);
|
||||
if (!$cnt) {
|
||||
throw new DownloaderException('Failed to parse Rust version from channel config');
|
||||
}
|
||||
$versions = $matches[1];
|
||||
// strip version num \d.\d.\d (some version number is like "x.x.x (abcdefg 1970-01-01)"
|
||||
$versions = array_filter(array_map(fn ($v) => preg_match('/^(\d+\.\d+\.\d+)/', $v, $m) ? $m[1] : null, $versions));
|
||||
usort($versions, 'version_compare');
|
||||
$latest_version = end($versions);
|
||||
if (!$latest_version) {
|
||||
throw new DownloaderException('Could not determine latest Rust version');
|
||||
}
|
||||
|
||||
// merge download link
|
||||
$download_url = "https://static.rust-lang.org/dist/rust-{$latest_version}-{$arch}-unknown-linux-{$distro}.tar.xz";
|
||||
$path = DOWNLOAD_PATH . DIRECTORY_SEPARATOR . basename($download_url);
|
||||
default_shell()->executeCurlDownload($download_url, $path, retries: $downloader->getRetry());
|
||||
return DownloadResult::archive(basename($path), ['url' => $download_url, 'version' => $latest_version], extract: PKG_ROOT_PATH . '/rust-install', verified: false, version: $latest_version);
|
||||
}
|
||||
|
||||
#[CustomBinaryCheckUpdate('rust', [
|
||||
'linux-x86_64',
|
||||
'linux-aarch64',
|
||||
])]
|
||||
public function checkUpdateBinary(?string $old_version, ArtifactDownloader $downloader): CheckUpdateResult
|
||||
{
|
||||
$toml_config = default_shell()->executeCurl('https://static.rust-lang.org/dist/channel-rust-stable.toml', retries: $downloader->getRetry());
|
||||
$cnt = preg_match_all('/^version = "([^"]+)"$/m', $toml_config ?: '', $matches);
|
||||
if (!$cnt) {
|
||||
throw new DownloaderException('Failed to parse Rust version from channel config');
|
||||
}
|
||||
$versions = array_filter(array_map(fn ($v) => preg_match('/^(\d+\.\d+\.\d+)/', $v, $m) ? $m[1] : null, $matches[1]));
|
||||
usort($versions, 'version_compare');
|
||||
$latest_version = end($versions);
|
||||
if (!$latest_version) {
|
||||
throw new DownloaderException('Could not determine latest Rust version');
|
||||
}
|
||||
return new CheckUpdateResult(
|
||||
old: $old_version,
|
||||
new: $latest_version,
|
||||
needUpdate: $old_version === null || $latest_version !== $old_version,
|
||||
);
|
||||
}
|
||||
|
||||
#[AfterBinaryExtract('rust', [
|
||||
'linux-x86_64',
|
||||
'linux-aarch64',
|
||||
])]
|
||||
public function postExtractRust(string $target_path): void
|
||||
{
|
||||
$prefix = PKG_ROOT_PATH . '/rust';
|
||||
shell()->exec("cd {$target_path} && ./install.sh --prefix={$prefix}");
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,9 @@ class zig
|
||||
$index_json = default_shell()->executeCurl('https://ziglang.org/download/index.json', retries: $downloader->getRetry());
|
||||
$index_json = json_decode($index_json ?: '', true);
|
||||
$latest_version = null;
|
||||
if ($index_json === null) {
|
||||
throw new DownloaderException('Failed to fetch Zig version index');
|
||||
}
|
||||
foreach ($index_json as $version => $data) {
|
||||
if ($version !== 'master') {
|
||||
$latest_version = $version;
|
||||
|
||||
28
src/Package/Extension/dba.php
Normal file
28
src/Package/Extension/dba.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use StaticPHP\Attribute\Package\CustomPhpConfigureArg;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Package\PackageInstaller;
|
||||
|
||||
#[Extension('dba')]
|
||||
class dba
|
||||
{
|
||||
#[CustomPhpConfigureArg('Darwin')]
|
||||
#[CustomPhpConfigureArg('Linux')]
|
||||
public function getUnixConfigureArg(bool $shared, PackageInstaller $installer): string
|
||||
{
|
||||
$qdbm = ($qdbm = $installer->getLibraryPackage('qdbm')) ? (" --with-qdbm={$qdbm->getBuildRootPath()}") : '';
|
||||
return '--enable-dba' . ($shared ? '=shared' : '') . $qdbm;
|
||||
}
|
||||
|
||||
#[CustomPhpConfigureArg('Windows')]
|
||||
public function getWindowsConfigureArg(PackageInstaller $installer): string
|
||||
{
|
||||
$qdbm = $installer->getLibraryPackage('qdbm') ? ' --with-qdbm' : '';
|
||||
return '--with-dba' . $qdbm;
|
||||
}
|
||||
}
|
||||
23
src/Package/Extension/dio.php
Normal file
23
src/Package/Extension/dio.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use Package\Target\php;
|
||||
use StaticPHP\Attribute\Package\BeforeStage;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Package\PhpExtensionPackage;
|
||||
use StaticPHP\Util\FileSystem;
|
||||
|
||||
#[Extension('dio')]
|
||||
class dio extends PhpExtensionPackage
|
||||
{
|
||||
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-dio')]
|
||||
public function patchBeforeBuildconf(): void
|
||||
{
|
||||
if (!file_exists("{$this->getSourceDir()}/php_dio.h")) {
|
||||
FileSystem::writeFile("{$this->getSourceDir()}/php_dio.h", FileSystem::readFile("{$this->getSourceDir()}/src/php_dio.h"));
|
||||
}
|
||||
}
|
||||
}
|
||||
46
src/Package/Extension/event.php
Normal file
46
src/Package/Extension/event.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use Package\Target\php;
|
||||
use StaticPHP\Attribute\Package\BeforeStage;
|
||||
use StaticPHP\Attribute\Package\CustomPhpConfigureArg;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Attribute\PatchDescription;
|
||||
use StaticPHP\Package\PackageInstaller;
|
||||
use StaticPHP\Package\PhpExtensionPackage;
|
||||
use StaticPHP\Runtime\SystemTarget;
|
||||
use StaticPHP\Util\FileSystem;
|
||||
|
||||
#[Extension('event')]
|
||||
class event extends PhpExtensionPackage
|
||||
{
|
||||
#[CustomPhpConfigureArg('Darwin')]
|
||||
#[CustomPhpConfigureArg('Linux')]
|
||||
public function getUnixConfigureArg(PackageInstaller $installer): string
|
||||
{
|
||||
$arg = "--with-event-core --with-event-extra --with-event-libevent-dir={$this->getBuilder()->getBuildRootPath()}";
|
||||
if ($installer->getLibraryPackage('openssl')) {
|
||||
$arg .= " --with-event-openssl={$this->getBuilder()->getBuildRootPath()}";
|
||||
}
|
||||
if ($installer->getPhpExtensionPackage('ext-sockets')) {
|
||||
$arg .= ' --enable-event-sockets';
|
||||
} else {
|
||||
$arg .= ' --disable-event-sockets';
|
||||
}
|
||||
return $arg;
|
||||
}
|
||||
|
||||
#[BeforeStage('php', [php::class, 'makeForUnix'], 'ext-event')]
|
||||
#[PatchDescription('Prevent event extension compile error on macOS')]
|
||||
public function patchBeforeMake(PackageInstaller $installer): void
|
||||
{
|
||||
// Prevent event extension compile error on macOS
|
||||
if (SystemTarget::getTargetOS() === 'Darwin') {
|
||||
$php_src = $installer->getTargetPackage('php')->getSourceDir();
|
||||
FileSystem::replaceFileRegex("{$php_src}/main/php_config.h", '/^#define HAVE_OPENPTY 1$/m', '');
|
||||
}
|
||||
}
|
||||
}
|
||||
19
src/Package/Extension/excimer.php
Normal file
19
src/Package/Extension/excimer.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Package\PhpExtensionPackage;
|
||||
|
||||
#[Extension('excimer')]
|
||||
class excimer extends PhpExtensionPackage
|
||||
{
|
||||
public function getSharedExtensionEnv(): array
|
||||
{
|
||||
$env = parent::getSharedExtensionEnv();
|
||||
$env['LIBS'] = clean_spaces(str_replace('-lphp', '', $env['LIBS']));
|
||||
return $env;
|
||||
}
|
||||
}
|
||||
29
src/Package/Extension/ffi.php
Normal file
29
src/Package/Extension/ffi.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use Package\Target\php;
|
||||
use StaticPHP\Attribute\Package\BeforeStage;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Attribute\PatchDescription;
|
||||
use StaticPHP\Package\PhpExtensionPackage;
|
||||
use StaticPHP\Runtime\SystemTarget;
|
||||
use StaticPHP\Util\SourcePatcher;
|
||||
use StaticPHP\Util\System\LinuxUtil;
|
||||
|
||||
#[Extension('ffi')]
|
||||
class ffi extends PhpExtensionPackage
|
||||
{
|
||||
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-ffi')]
|
||||
#[PatchDescription('Patch FFI extension on CentOS 7 with -O3 optimization (strncmp issue)')]
|
||||
public function patchBeforeBuildconf(): void
|
||||
{
|
||||
spc_skip_if(!($ver = SystemTarget::getLibcVersion()) || version_compare($ver, '2.17', '>'));
|
||||
$ver_id = php::getPHPVersionID(return_null_if_failed: true);
|
||||
spc_skip_if($ver_id === null || $ver_id < 80316);
|
||||
spc_skip_if(LinuxUtil::getOSRelease()['dist'] !== 'centos');
|
||||
SourcePatcher::patchFile('ffi_centos7_fix_O3_strncmp.patch', SOURCE_PATH . '/php-src');
|
||||
}
|
||||
}
|
||||
26
src/Package/Extension/gd.php
Normal file
26
src/Package/Extension/gd.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use StaticPHP\Attribute\Package\CustomPhpConfigureArg;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Package\PackageInstaller;
|
||||
use StaticPHP\Package\PhpExtensionPackage;
|
||||
|
||||
#[Extension('gd')]
|
||||
class gd extends PhpExtensionPackage
|
||||
{
|
||||
#[CustomPhpConfigureArg('Darwin')]
|
||||
#[CustomPhpConfigureArg('Linux')]
|
||||
public function getUnixConfigureArg(bool $shared, PackageInstaller $installer): string
|
||||
{
|
||||
$arg = '--enable-gd' . ($shared ? '=shared' : '');
|
||||
$arg .= $installer->getLibraryPackage('freetype') ? ' --with-freetype' : '';
|
||||
$arg .= $installer->getLibraryPackage('libjpeg') ? ' --with-jpeg' : '';
|
||||
$arg .= $installer->getLibraryPackage('libwebp') ? ' --with-webp' : '';
|
||||
$arg .= $installer->getLibraryPackage('libavif') ? ' --with-avif' : '';
|
||||
return $arg;
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@ namespace Package\Extension;
|
||||
|
||||
use Package\Target\php;
|
||||
use StaticPHP\Attribute\Package\BeforeStage;
|
||||
use StaticPHP\Attribute\Package\CustomPhpConfigureArg;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Attribute\PatchDescription;
|
||||
use StaticPHP\Package\PhpExtensionPackage;
|
||||
@@ -49,11 +48,4 @@ class glfw extends PhpExtensionPackage
|
||||
putenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS=' . $extra_ldflags);
|
||||
}
|
||||
}
|
||||
|
||||
#[CustomPhpConfigureArg('Darwin')]
|
||||
#[CustomPhpConfigureArg('Linux')]
|
||||
public function getUnixConfigureArg(bool $shared = false): string
|
||||
{
|
||||
return '--enable-glfw --with-glfw-dir=' . BUILD_ROOT_PATH;
|
||||
}
|
||||
}
|
||||
|
||||
70
src/Package/Extension/grpc.php
Normal file
70
src/Package/Extension/grpc.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use Package\Target\php;
|
||||
use StaticPHP\Attribute\Package\BeforeStage;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Exception\EnvironmentException;
|
||||
use StaticPHP\Package\PhpExtensionPackage;
|
||||
use StaticPHP\Runtime\SystemTarget;
|
||||
use StaticPHP\Util\FileSystem;
|
||||
|
||||
#[Extension('grpc')]
|
||||
class grpc extends PhpExtensionPackage
|
||||
{
|
||||
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-grpc')]
|
||||
public function patchBeforeBuildconf(): void
|
||||
{
|
||||
if (SystemTarget::getTargetOS() === 'Windows') {
|
||||
throw new EnvironmentException('grpc extension does not support windows yet');
|
||||
}
|
||||
|
||||
// Fix deprecated PHP API usage in call.c
|
||||
FileSystem::replaceFileStr(
|
||||
"{$this->getSourceDir()}/src/php/ext/grpc/call.c",
|
||||
'zend_exception_get_default(TSRMLS_C),',
|
||||
'zend_ce_exception,',
|
||||
);
|
||||
|
||||
// custom config.m4 content for grpc extension, to prevent building libgrpc.a again
|
||||
$config_m4 = <<<'M4'
|
||||
PHP_ARG_ENABLE(grpc, [whether to enable grpc support], [AS_HELP_STRING([--enable-grpc], [Enable grpc support])])
|
||||
|
||||
if test "$PHP_GRPC" != "no"; then
|
||||
PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/include)
|
||||
PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/src/php/ext/grpc)
|
||||
GRPC_LIBDIR=@@build_lib_path@@
|
||||
PHP_ADD_LIBPATH($GRPC_LIBDIR)
|
||||
PHP_ADD_LIBRARY(grpc,,GRPC_SHARED_LIBADD)
|
||||
LIBS="-lpthread $LIBS"
|
||||
PHP_ADD_LIBRARY(pthread)
|
||||
|
||||
case $host in
|
||||
*darwin*)
|
||||
PHP_ADD_LIBRARY(c++,1,GRPC_SHARED_LIBADD)
|
||||
;;
|
||||
*)
|
||||
PHP_ADD_LIBRARY(stdc++,1,GRPC_SHARED_LIBADD)
|
||||
PHP_ADD_LIBRARY(rt,,GRPC_SHARED_LIBADD)
|
||||
PHP_ADD_LIBRARY(rt)
|
||||
;;
|
||||
esac
|
||||
|
||||
PHP_NEW_EXTENSION(grpc, @grpc_c_files@, $ext_shared, , -DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK=1)
|
||||
PHP_SUBST(GRPC_SHARED_LIBADD)
|
||||
PHP_INSTALL_HEADERS([ext/grpc], [php_grpc.h])
|
||||
fi
|
||||
M4;
|
||||
$replace = get_pack_replace();
|
||||
// load grpc c files from src/php/ext/grpc
|
||||
$c_files = glob("{$this->getSourceDir()}/src/php/ext/grpc/*.c");
|
||||
$replace['@grpc_c_files@'] = implode(" \\\n ", array_map(fn ($f) => 'src/php/ext/grpc/' . basename($f), $c_files));
|
||||
$config_m4 = str_replace(array_keys($replace), array_values($replace), $config_m4);
|
||||
file_put_contents("{$this->getSourceDir()}/config.m4", $config_m4);
|
||||
|
||||
copy("{$this->getSourceDir()}/src/php/ext/grpc/php_grpc.h", "{$this->getSourceDir()}/php_grpc.h");
|
||||
}
|
||||
}
|
||||
21
src/Package/Extension/imagick.php
Normal file
21
src/Package/Extension/imagick.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use StaticPHP\Attribute\Package\CustomPhpConfigureArg;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Package\PackageBuilder;
|
||||
|
||||
#[Extension('imagick')]
|
||||
class imagick
|
||||
{
|
||||
#[CustomPhpConfigureArg('Darwin')]
|
||||
#[CustomPhpConfigureArg('Linux')]
|
||||
public function getUnixConfigureArg(bool $shared, PackageBuilder $builder): string
|
||||
{
|
||||
$disable_omp = ' ac_cv_func_omp_pause_resource_all=no';
|
||||
return '--with-imagick=' . ($shared ? 'shared,' : '') . $builder->getBuildRootPath() . $disable_omp;
|
||||
}
|
||||
}
|
||||
55
src/Package/Extension/imap.php
Normal file
55
src/Package/Extension/imap.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use Package\Target\php;
|
||||
use StaticPHP\Attribute\Package\BeforeStage;
|
||||
use StaticPHP\Attribute\Package\CustomPhpConfigureArg;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Attribute\Package\Validate;
|
||||
use StaticPHP\Exception\WrongUsageException;
|
||||
use StaticPHP\Package\PackageBuilder;
|
||||
use StaticPHP\Package\PackageInstaller;
|
||||
use StaticPHP\Package\PhpExtensionPackage;
|
||||
use StaticPHP\Util\FileSystem;
|
||||
|
||||
#[Extension('imap')]
|
||||
class imap extends PhpExtensionPackage
|
||||
{
|
||||
#[Validate]
|
||||
public function validate(PackageBuilder $builder): void
|
||||
{
|
||||
if ($builder->getOption('enable-zts')) {
|
||||
throw new WrongUsageException('ext-imap is not thread safe, do not build it with ZTS builds');
|
||||
}
|
||||
}
|
||||
|
||||
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-imap')]
|
||||
public function patchBeforeBuildconf(PackageInstaller $installer): void
|
||||
{
|
||||
if ($installer->getLibraryPackage('openssl')) {
|
||||
// sometimes imap with openssl does not contain zlib (required by openssl)
|
||||
// we need to add it manually
|
||||
FileSystem::replaceFileStr("{$this->getSourceDir()}/config.m4", 'TST_LIBS="$DLIBS $IMAP_SHARED_LIBADD"', 'TST_LIBS="$DLIBS $IMAP_SHARED_LIBADD -lz"');
|
||||
}
|
||||
// c-client is built with PASSWDTYPE=nul so libcrypt is not referenced.
|
||||
FileSystem::replaceFileStr(
|
||||
"{$this->getSourceDir()}/config.m4",
|
||||
" PHP_CHECK_LIBRARY(crypt, crypt,\n [\n PHP_ADD_LIBRARY(crypt,, IMAP_SHARED_LIBADD)\n AC_DEFINE(HAVE_LIBCRYPT,1,[ ])\n ])",
|
||||
' dnl Skipped: crypt check not needed (c-client built with PASSWDTYPE=nul)'
|
||||
);
|
||||
}
|
||||
|
||||
#[CustomPhpConfigureArg('Darwin')]
|
||||
#[CustomPhpConfigureArg('Linux')]
|
||||
public function getUnixConfigureArg(PackageInstaller $installer, PackageBuilder $builder): string
|
||||
{
|
||||
$arg = "--with-imap={$builder->getBuildRootPath()}";
|
||||
if (($ssl = $installer->getLibraryPackage('openssl')) !== null) {
|
||||
$arg .= " --with-imap-ssl={$ssl->getBuildRootPath()}";
|
||||
}
|
||||
return $arg;
|
||||
}
|
||||
}
|
||||
30
src/Package/Extension/maxminddb.php
Normal file
30
src/Package/Extension/maxminddb.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use Package\Target\php;
|
||||
use StaticPHP\Attribute\Package\BeforeStage;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Attribute\PatchDescription;
|
||||
use StaticPHP\Package\PhpExtensionPackage;
|
||||
use StaticPHP\Util\FileSystem;
|
||||
|
||||
#[Extension('maxminddb')]
|
||||
class maxminddb extends PhpExtensionPackage
|
||||
{
|
||||
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-maxminddb')]
|
||||
#[PatchDescription('Patch maxminddb extension for buildconf to support new source structure')]
|
||||
public function patchBeforeBuildconf(): void
|
||||
{
|
||||
if (file_exists("{$this->getSourceDir()}/config.m4")) {
|
||||
return;
|
||||
}
|
||||
// move ext/maxminddb/ext/* to ext/maxminddb/
|
||||
$files = FileSystem::scanDirFiles("{$this->getSourceDir()}/ext", false, true);
|
||||
foreach ($files as $file) {
|
||||
rename("{$this->getSourceDir()}/ext/{$file}", "{$this->getSourceDir()}/{$file}");
|
||||
}
|
||||
}
|
||||
}
|
||||
75
src/Package/Extension/memcache.php
Normal file
75
src/Package/Extension/memcache.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use Package\Target\php;
|
||||
use StaticPHP\Attribute\Package\BeforeStage;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Attribute\PatchDescription;
|
||||
use StaticPHP\Package\PhpExtensionPackage;
|
||||
use StaticPHP\Util\FileSystem;
|
||||
|
||||
#[Extension('memcache')]
|
||||
class memcache extends PhpExtensionPackage
|
||||
{
|
||||
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-memcache')]
|
||||
public function patchBeforeBuildconf(): bool
|
||||
{
|
||||
if (!$this->isBuildStatic()) {
|
||||
return false;
|
||||
}
|
||||
FileSystem::replaceFileStr(
|
||||
"{$this->getSourceDir()}/config9.m4",
|
||||
'if test -d $abs_srcdir/src ; then',
|
||||
'if test -d $abs_srcdir/main ; then'
|
||||
);
|
||||
FileSystem::replaceFileStr(
|
||||
"{$this->getSourceDir()}/config9.m4",
|
||||
'export CPPFLAGS="$CPPFLAGS $INCLUDES"',
|
||||
'export CPPFLAGS="$CPPFLAGS $INCLUDES -I$abs_srcdir/main"'
|
||||
);
|
||||
// add for in-tree building
|
||||
file_put_contents(
|
||||
"{$this->getSourceDir()}/php_memcache.h",
|
||||
<<<'EOF'
|
||||
#ifndef PHP_MEMCACHE_H
|
||||
#define PHP_MEMCACHE_H
|
||||
|
||||
extern zend_module_entry memcache_module_entry;
|
||||
#define phpext_memcache_ptr &memcache_module_entry
|
||||
|
||||
#endif
|
||||
EOF
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
#[BeforeStage('ext-memcache', [self::class, 'configureForUnix'])]
|
||||
#[PatchDescription('Fix memcache extension compile error when building as shared')]
|
||||
public function patchBeforeSharedConfigure(): bool
|
||||
{
|
||||
if (!$this->isBuildShared()) {
|
||||
return false;
|
||||
}
|
||||
FileSystem::replaceFileStr(
|
||||
"{$this->getSourceDir()}/config9.m4",
|
||||
'if test -d $abs_srcdir/main ; then',
|
||||
'if test -d $abs_srcdir/src ; then',
|
||||
);
|
||||
FileSystem::replaceFileStr(
|
||||
"{$this->getSourceDir()}/config9.m4",
|
||||
'export CPPFLAGS="$CPPFLAGS $INCLUDES -I$abs_srcdir/main"',
|
||||
'export CPPFLAGS="$CPPFLAGS $INCLUDES"',
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getSharedExtensionEnv(): array
|
||||
{
|
||||
$parent = parent::getSharedExtensionEnv();
|
||||
$parent['CFLAGS'] .= ' -std=c17';
|
||||
return $parent;
|
||||
}
|
||||
}
|
||||
30
src/Package/Extension/memcached.php
Normal file
30
src/Package/Extension/memcached.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use StaticPHP\Attribute\Package\CustomPhpConfigureArg;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Package\PackageInstaller;
|
||||
use StaticPHP\Package\PhpExtensionPackage;
|
||||
|
||||
#[Extension('memcached')]
|
||||
class memcached extends PhpExtensionPackage
|
||||
{
|
||||
#[CustomPhpConfigureArg('Darwin')]
|
||||
#[CustomPhpConfigureArg('Linux')]
|
||||
public function getUnixConfigureArg(bool $shared, PackageInstaller $installer): string
|
||||
{
|
||||
return '--enable-memcached' . ($shared ? '=shared' : '') . ' ' .
|
||||
'--with-zlib-dir=' . $installer->getLibraryPackage('zlib')->getBuildRootPath() . ' ' .
|
||||
'--with-libmemcached-dir=' . $installer->getLibraryPackage('libmemcached')->getBuildRootPath() . ' ' .
|
||||
'--disable-memcached-sasl ' .
|
||||
'--enable-memcached-json ' .
|
||||
($installer->getLibraryPackage('zstd') ? '--with-zstd ' : '') .
|
||||
($installer->getPhpExtensionPackage('ext-igbinary') ? '--enable-memcached-igbinary ' : '') .
|
||||
($installer->getPhpExtensionPackage('ext-session') ? '--enable-memcached-session ' : '') .
|
||||
($installer->getPhpExtensionPackage('ext-msgpack') ? '--enable-memcached-msgpack ' : '') .
|
||||
'--with-system-fastlz';
|
||||
}
|
||||
}
|
||||
38
src/Package/Extension/mongodb.php
Normal file
38
src/Package/Extension/mongodb.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use StaticPHP\Attribute\Package\CustomPhpConfigureArg;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Package\PackageInstaller;
|
||||
use StaticPHP\Package\PhpExtensionPackage;
|
||||
|
||||
#[Extension('mongodb')]
|
||||
class mongodb extends PhpExtensionPackage
|
||||
{
|
||||
#[CustomPhpConfigureArg('Darwin')]
|
||||
#[CustomPhpConfigureArg('Linux')]
|
||||
public function getUnixConfigureArg(bool $shared, PackageInstaller $installer): string
|
||||
{
|
||||
$arg = ' --enable-mongodb' . ($shared ? '=shared' : '') . ' ';
|
||||
$arg .= ' --with-mongodb-system-libs=no --with-mongodb-client-side-encryption=no ';
|
||||
$arg .= ' --with-mongodb-sasl=no ';
|
||||
if ($installer->getLibraryPackage('openssl')) {
|
||||
$arg .= '--with-mongodb-ssl=openssl';
|
||||
}
|
||||
$arg .= $installer->getLibraryPackage('icu') ? ' --with-mongodb-icu=yes ' : ' --with-mongodb-icu=no ';
|
||||
$arg .= $installer->getLibraryPackage('zstd') ? ' --with-mongodb-zstd=yes ' : ' --with-mongodb-zstd=no ';
|
||||
// $arg .= $installer->getLibraryPackage('snappy') ? ' --with-mongodb-snappy=yes ' : ' --with-mongodb-snappy=no ';
|
||||
$arg .= $installer->getLibraryPackage('zlib') ? ' --with-mongodb-zlib=yes ' : ' --with-mongodb-zlib=bundled ';
|
||||
return clean_spaces($arg);
|
||||
}
|
||||
|
||||
public function getSharedExtensionEnv(): array
|
||||
{
|
||||
$parent = parent::getSharedExtensionEnv();
|
||||
$parent['CFLAGS'] .= ' -std=c17';
|
||||
return $parent;
|
||||
}
|
||||
}
|
||||
76
src/Package/Extension/opcache.php
Normal file
76
src/Package/Extension/opcache.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use Package\Target\php;
|
||||
use StaticPHP\Attribute\Package\BeforeStage;
|
||||
use StaticPHP\Attribute\Package\CustomPhpConfigureArg;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Attribute\Package\Validate;
|
||||
use StaticPHP\Attribute\PatchDescription;
|
||||
use StaticPHP\Exception\WrongUsageException;
|
||||
use StaticPHP\Package\PackageBuilder;
|
||||
use StaticPHP\Package\PackageInstaller;
|
||||
use StaticPHP\Package\PhpExtensionPackage;
|
||||
use StaticPHP\Runtime\SystemTarget;
|
||||
use StaticPHP\Util\SourcePatcher;
|
||||
|
||||
#[Extension('opcache')]
|
||||
class opcache extends PhpExtensionPackage
|
||||
{
|
||||
#[Validate]
|
||||
public function validate(): void
|
||||
{
|
||||
if (php::getPHPVersionID() < 80000 && getenv('SPC_SKIP_PHP_VERSION_CHECK') !== 'yes') {
|
||||
throw new WrongUsageException('Statically compiled PHP with Zend Opcache only available for PHP >= 8.0 !');
|
||||
}
|
||||
}
|
||||
|
||||
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-opcache')]
|
||||
#[PatchDescription('Fix static opcache build for PHP 8.2.0 to 8.4.x')]
|
||||
public function patchBeforeBuildconf(PackageInstaller $installer): bool
|
||||
{
|
||||
$version = php::getPHPVersion();
|
||||
$php_src = $installer->getTargetPackage('php')->getSourceDir();
|
||||
if (file_exists("{$php_src}/.opcache_patched")) {
|
||||
return false;
|
||||
}
|
||||
// if 8.2.0 <= PHP_VERSION < 8.2.23, we need to patch from legacy patch file
|
||||
if (version_compare($version, '8.2.0', '>=') && version_compare($version, '8.2.23', '<')) {
|
||||
SourcePatcher::patchFile('spc_fix_static_opcache_before_80222.patch', $php_src);
|
||||
}
|
||||
// if 8.3.0 <= PHP_VERSION < 8.3.11, we need to patch from legacy patch file
|
||||
elseif (version_compare($version, '8.3.0', '>=') && version_compare($version, '8.3.11', '<')) {
|
||||
SourcePatcher::patchFile('spc_fix_static_opcache_before_80310.patch', $php_src);
|
||||
}
|
||||
// if 8.3.12 <= PHP_VERSION < 8.5.0-dev, we need to patch from legacy patch file
|
||||
elseif (version_compare($version, '8.5.0-dev', '<')) {
|
||||
SourcePatcher::patchPhpSrc(items: ['static_opcache']);
|
||||
}
|
||||
// PHP 8.5.0-dev and later supports static opcache without patching
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
return file_put_contents($php_src . '/.opcache_patched', '1') !== false;
|
||||
}
|
||||
|
||||
#[CustomPhpConfigureArg('Darwin')]
|
||||
#[CustomPhpConfigureArg('Linux')]
|
||||
public function getUnixConfigureArg(bool $shared, PackageBuilder $builder): string
|
||||
{
|
||||
$phpVersionID = php::getPHPVersionID();
|
||||
$opcache_jit = ' --enable-opcache-jit';
|
||||
if ((SystemTarget::getTargetOS() === 'Linux' &&
|
||||
SystemTarget::getLibc() === 'musl' &&
|
||||
$builder->getOption('enable-zts') &&
|
||||
SystemTarget::getTargetArch() === 'x86_64' &&
|
||||
$phpVersionID < 80500) ||
|
||||
$builder->getOption('disable-opcache-jit')
|
||||
) {
|
||||
$opcache_jit = ' --disable-opcache-jit';
|
||||
}
|
||||
return '--enable-opcache' . ($shared ? '=shared' : '') . $opcache_jit;
|
||||
}
|
||||
}
|
||||
21
src/Package/Extension/opentelemetry.php
Normal file
21
src/Package/Extension/opentelemetry.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use Package\Target\php;
|
||||
use StaticPHP\Attribute\Package\BeforeStage;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Util\GlobalEnvManager;
|
||||
|
||||
#[Extension('opentelemetry')]
|
||||
class opentelemetry
|
||||
{
|
||||
#[BeforeStage('php', [php::class, 'makeForUnix'], 'ext-opentelemetry')]
|
||||
public function patchBeforeMake(): void
|
||||
{
|
||||
// add -Wno-strict-prototypes
|
||||
GlobalEnvManager::putenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS=' . getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS') . ' -Wno-strict-prototypes');
|
||||
}
|
||||
}
|
||||
35
src/Package/Extension/parallel.php
Normal file
35
src/Package/Extension/parallel.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use Package\Target\php;
|
||||
use StaticPHP\Attribute\Package\BeforeStage;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Attribute\Package\Validate;
|
||||
use StaticPHP\Attribute\PatchDescription;
|
||||
use StaticPHP\Exception\WrongUsageException;
|
||||
use StaticPHP\Package\PackageBuilder;
|
||||
use StaticPHP\Package\PhpExtensionPackage;
|
||||
use StaticPHP\Util\FileSystem;
|
||||
|
||||
#[Extension('parallel')]
|
||||
class parallel extends PhpExtensionPackage
|
||||
{
|
||||
#[Validate]
|
||||
public function validate(PackageBuilder $builder): void
|
||||
{
|
||||
if (!$builder->getOption('enable-zts')) {
|
||||
throw new WrongUsageException('ext-parallel must be built with ZTS builds. Use "--enable-zts" option!');
|
||||
}
|
||||
}
|
||||
|
||||
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-parallel')]
|
||||
#[PatchDescription('Fix parallel m4 hardcoded PHP_VERSION check')]
|
||||
public function patchBeforeBuildconf(): bool
|
||||
{
|
||||
FileSystem::replaceFileRegex("{$this->getSourceDir()}/config.m4", '/PHP_VERSION=.*/m', '');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
37
src/Package/Extension/password_argon2.php
Normal file
37
src/Package/Extension/password_argon2.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use Package\Target\php;
|
||||
use StaticPHP\Attribute\Package\CustomPhpConfigureArg;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Exception\ValidationException;
|
||||
use StaticPHP\Package\PackageBuilder;
|
||||
use StaticPHP\Package\PackageInstaller;
|
||||
use StaticPHP\Package\PhpExtensionPackage;
|
||||
|
||||
#[Extension('password-argon2')]
|
||||
class password_argon2 extends PhpExtensionPackage
|
||||
{
|
||||
public function runSmokeTestCliUnix(): void
|
||||
{
|
||||
[$ret] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php -n -r "assert(defined(\'PASSWORD_ARGON2I\'));"');
|
||||
if ($ret !== 0) {
|
||||
throw new ValidationException('extension ' . $this->getName() . ' failed sanity check', validation_module: 'password_argon2 function check');
|
||||
}
|
||||
}
|
||||
|
||||
#[CustomPhpConfigureArg('Linux')]
|
||||
#[CustomPhpConfigureArg('Darwin')]
|
||||
public function getConfigureArg(PackageInstaller $installer, PackageBuilder $builder): string
|
||||
{
|
||||
if ($installer->getLibraryPackage('openssl') !== null) {
|
||||
if (php::getPHPVersionID() >= 80500 || (php::getPHPVersionID() >= 80400 && !$builder->getOption('enable-zts'))) {
|
||||
return '--without-password-argon2'; // use --with-openssl-argon2 in openssl extension instead
|
||||
}
|
||||
}
|
||||
return '--with-password-argon2';
|
||||
}
|
||||
}
|
||||
35
src/Package/Extension/pdo_odbc.php
Normal file
35
src/Package/Extension/pdo_odbc.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use Package\Target\php;
|
||||
use StaticPHP\Attribute\Package\BeforeStage;
|
||||
use StaticPHP\Attribute\Package\CustomPhpConfigureArg;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Package\PhpExtensionPackage;
|
||||
use StaticPHP\Util\FileSystem;
|
||||
|
||||
#[Extension('pdo_odbc')]
|
||||
class pdo_odbc extends PhpExtensionPackage
|
||||
{
|
||||
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-pdo_odbc')]
|
||||
public function patchBeforeBuildconf(): void
|
||||
{
|
||||
FileSystem::replaceFileStr("{$this->getSourceDir()}/config.m4", 'PDO_ODBC_LDFLAGS="$pdo_odbc_def_ldflags', 'PDO_ODBC_LDFLAGS="-liconv $pdo_odbc_def_ldflags');
|
||||
}
|
||||
|
||||
#[CustomPhpConfigureArg('Linux')]
|
||||
#[CustomPhpConfigureArg('Darwin')]
|
||||
public function getUnixConfigureArg(bool $shared): string
|
||||
{
|
||||
return '--with-pdo-odbc=' . ($shared ? 'shared,' : '') . 'unixODBC,' . BUILD_ROOT_PATH;
|
||||
}
|
||||
|
||||
#[CustomPhpConfigureArg('Windows')]
|
||||
public function getWindowsConfigureArg(bool $shared): string
|
||||
{
|
||||
return '--with-pdo-odbc';
|
||||
}
|
||||
}
|
||||
25
src/Package/Extension/pdo_sqlite.php
Normal file
25
src/Package/Extension/pdo_sqlite.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use Package\Target\php;
|
||||
use StaticPHP\Attribute\Package\BeforeStage;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Package\PackageInstaller;
|
||||
use StaticPHP\Util\FileSystem;
|
||||
|
||||
#[Extension('pdo_sqlite')]
|
||||
class pdo_sqlite
|
||||
{
|
||||
#[BeforeStage('php', [php::class, 'configureForUnix'], 'ext-pdo_sqlite')]
|
||||
public function patchBeforeConfigure(PackageInstaller $installer): void
|
||||
{
|
||||
FileSystem::replaceFileRegex(
|
||||
"{$installer->getTargetPackage('php')->getSourceDir()}/configure",
|
||||
'/sqlite3_column_table_name=yes/',
|
||||
'sqlite3_column_table_name=no'
|
||||
);
|
||||
}
|
||||
}
|
||||
48
src/Package/Extension/pgsql.php
Normal file
48
src/Package/Extension/pgsql.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use Package\Target\php;
|
||||
use StaticPHP\Attribute\Package\CustomPhpConfigureArg;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Package\PackageBuilder;
|
||||
use StaticPHP\Package\PackageInstaller;
|
||||
use StaticPHP\Package\PhpExtensionPackage;
|
||||
use StaticPHP\Util\SPCConfigUtil;
|
||||
|
||||
#[Extension('pgsql')]
|
||||
class pgsql extends PhpExtensionPackage
|
||||
{
|
||||
#[CustomPhpConfigureArg('Darwin')]
|
||||
#[CustomPhpConfigureArg('Linux')]
|
||||
public function getUnixConfigureArg(bool $shared, PackageBuilder $builder, PackageInstaller $installer): string
|
||||
{
|
||||
if (php::getPHPVersionID() >= 80400) {
|
||||
$libfiles = new SPCConfigUtil(['libs_only_deps' => true, 'absolute_libs' => true])->getPackageDepsConfig('postgresql', array_keys($installer->getResolvedPackages()), $builder->getOption('with-suggests'))['libs'];
|
||||
$libfiles = str_replace("{$builder->getLibDir()}/lib", '-l', $libfiles);
|
||||
$libfiles = str_replace('.a', '', $libfiles);
|
||||
return '--with-pgsql' . ($shared ? '=shared' : '') .
|
||||
' PGSQL_CFLAGS=-I' . $builder->getIncludeDir() .
|
||||
' PGSQL_LIBS="-L' . $builder->getLibDir() . ' ' . $libfiles . '"';
|
||||
}
|
||||
return '--with-pgsql=' . ($shared ? 'shared,' : '') . $builder->getBuildRootPath();
|
||||
}
|
||||
|
||||
#[CustomPhpConfigureArg('Windows')]
|
||||
public function getWindowsConfigureArg(bool $shared, PackageBuilder $builder): string
|
||||
{
|
||||
if (php::getPHPVersionID() >= 80400) {
|
||||
return '--with-pgsql';
|
||||
}
|
||||
return "--with-pgsql={$builder->getBuildRootPath()}";
|
||||
}
|
||||
|
||||
public function getSharedExtensionEnv(): array
|
||||
{
|
||||
$parent = parent::getSharedExtensionEnv();
|
||||
$parent['CFLAGS'] .= ' -std=c17 -Wno-int-conversion';
|
||||
return $parent;
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,8 @@ use StaticPHP\Attribute\Package\AfterStage;
|
||||
use StaticPHP\Attribute\Package\BeforeStage;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Attribute\PatchDescription;
|
||||
use StaticPHP\Package\PhpExtensionPackage;
|
||||
use StaticPHP\Util\FileSystem;
|
||||
use StaticPHP\Util\SourcePatcher;
|
||||
|
||||
#[Extension('phar')]
|
||||
@@ -26,4 +28,24 @@ class phar
|
||||
{
|
||||
SourcePatcher::unpatchMicroPhar();
|
||||
}
|
||||
|
||||
#[BeforeStage('ext-phar', 'build')]
|
||||
public function beforeBuildShared(PhpExtensionPackage $pkg): void
|
||||
{
|
||||
FileSystem::replaceFileStr(
|
||||
"{$pkg->getSourceDir()}/config.m4",
|
||||
['$ext_dir/phar.1', '$ext_dir/phar.phar.1'],
|
||||
['${ext_dir}phar.1', '${ext_dir}phar.phar.1']
|
||||
);
|
||||
}
|
||||
|
||||
#[AfterStage('ext-phar', 'build')]
|
||||
public function afterBuildShared(PhpExtensionPackage $pkg): void
|
||||
{
|
||||
FileSystem::replaceFileStr(
|
||||
"{$pkg->getSourceDir()}/config.m4",
|
||||
['${ext_dir}phar.1', '${ext_dir}phar.phar.1'],
|
||||
['$ext_dir/phar.1', '$ext_dir/phar.phar.1']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
28
src/Package/Extension/protobuf.php
Normal file
28
src/Package/Extension/protobuf.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use Package\Target\php;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Attribute\Package\Validate;
|
||||
use StaticPHP\Exception\ValidationException;
|
||||
use StaticPHP\Package\PackageInstaller;
|
||||
|
||||
#[Extension('protobuf')]
|
||||
class protobuf
|
||||
{
|
||||
#[Validate]
|
||||
public function validate(PackageInstaller $installer): void
|
||||
{
|
||||
if (php::getPHPVersionID() < 80000 && getenv('SPC_SKIP_PHP_VERSION_CHECK') !== 'yes') {
|
||||
throw new ValidationException('The latest protobuf extension requires PHP 8.0 or later');
|
||||
}
|
||||
$grpc = $installer->getPhpExtensionPackage('ext-grpc');
|
||||
// protobuf conflicts with grpc
|
||||
if ($grpc?->isBuildStatic()) {
|
||||
throw new ValidationException('protobuf conflicts with grpc, please remove grpc or protobuf extension');
|
||||
}
|
||||
}
|
||||
}
|
||||
27
src/Package/Extension/rar.php
Normal file
27
src/Package/Extension/rar.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use Package\Target\php;
|
||||
use StaticPHP\Attribute\Package\BeforeStage;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Attribute\PatchDescription;
|
||||
use StaticPHP\Package\PhpExtensionPackage;
|
||||
use StaticPHP\Runtime\SystemTarget;
|
||||
use StaticPHP\Util\FileSystem;
|
||||
|
||||
#[Extension('rar')]
|
||||
class rar extends PhpExtensionPackage
|
||||
{
|
||||
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-rar')]
|
||||
#[PatchDescription('rar extension workaround for newer Xcode clang (>= 15.0)')]
|
||||
public function patchBeforeBuildconf(): void
|
||||
{
|
||||
// workaround for newer Xcode clang (>= 15.0)
|
||||
if (SystemTarget::getTargetOS() === 'Darwin') {
|
||||
FileSystem::replaceFileStr("{$this->getSourceDir()}/config.m4", '-Wall -fvisibility=hidden', '-Wall -Wno-incompatible-function-pointer-types -fvisibility=hidden');
|
||||
}
|
||||
}
|
||||
}
|
||||
55
src/Package/Extension/rdkafka.php
Normal file
55
src/Package/Extension/rdkafka.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use Package\Target\php;
|
||||
use StaticPHP\Attribute\Package\BeforeStage;
|
||||
use StaticPHP\Attribute\Package\CustomPhpConfigureArg;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Attribute\PatchDescription;
|
||||
use StaticPHP\Package\PackageBuilder;
|
||||
use StaticPHP\Package\PhpExtensionPackage;
|
||||
use StaticPHP\Util\FileSystem;
|
||||
use StaticPHP\Util\SPCConfigUtil;
|
||||
|
||||
#[Extension('rdkafka')]
|
||||
class rdkafka extends PhpExtensionPackage
|
||||
{
|
||||
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-rdkafka')]
|
||||
#[PatchDescription('Patch rdkafka extension config.m4 to support pkg-config and fix library check')]
|
||||
public function patchBeforeBuildconf(): bool
|
||||
{
|
||||
FileSystem::replaceFileStr("{$this->getSourceDir()}/config.m4", "-L\$RDKAFKA_DIR/\$PHP_LIBDIR -lm\n", "-L\$RDKAFKA_DIR/\$PHP_LIBDIR -lm \$RDKAFKA_LIBS\n");
|
||||
FileSystem::replaceFileStr("{$this->getSourceDir()}/config.m4", "-L\$RDKAFKA_DIR/\$PHP_LIBDIR -lm\"\n", '-L$RDKAFKA_DIR/$PHP_LIBDIR -lm $RDKAFKA_LIBS"');
|
||||
FileSystem::replaceFileStr("{$this->getSourceDir()}/config.m4", 'PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL,', 'AC_CHECK_LIB([$LIBNAME], [$LIBSYMBOL],');
|
||||
return true;
|
||||
}
|
||||
|
||||
#[BeforeStage('php', [php::class, 'makeForUnix'], 'ext-rdkafka')]
|
||||
#[PatchDescription('Patch rdkafka extension source code to fix build errors with inline builds')]
|
||||
public function patchBeforeMake(): bool
|
||||
{
|
||||
// when compiling rdkafka with inline builds, it shows some errors, I don't know why.
|
||||
FileSystem::replaceFileStr(
|
||||
"{$this->getSourceDir()}/rdkafka.c",
|
||||
"#ifdef HAS_RD_KAFKA_TRANSACTIONS\n#include \"kafka_error_exception.h\"\n#endif",
|
||||
'#include "kafka_error_exception.h"'
|
||||
);
|
||||
FileSystem::replaceFileStr(
|
||||
"{$this->getSourceDir()}/kafka_error_exception.h",
|
||||
['#ifdef HAS_RD_KAFKA_TRANSACTIONS', '#endif'],
|
||||
''
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
#[CustomPhpConfigureArg('Darwin')]
|
||||
#[CustomPhpConfigureArg('Linux')]
|
||||
public function getUnixConfigureArg(bool $shared, PackageBuilder $builder): string
|
||||
{
|
||||
$pkgconf_libs = new SPCConfigUtil(['no_php' => true, 'libs_only_deps' => true])->getExtensionConfig($this);
|
||||
return '--with-rdkafka=' . ($shared ? 'shared,' : '') . $builder->getBuildRootPath() . " RDKAFKA_LIBS=\"{$pkgconf_libs['libs']}\"";
|
||||
}
|
||||
}
|
||||
47
src/Package/Extension/redis.php
Normal file
47
src/Package/Extension/redis.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use StaticPHP\Attribute\Package\CustomPhpConfigureArg;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Package\PackageBuilder;
|
||||
use StaticPHP\Package\PackageInstaller;
|
||||
use StaticPHP\Package\PhpExtensionPackage;
|
||||
|
||||
#[Extension('redis')]
|
||||
class redis extends PhpExtensionPackage
|
||||
{
|
||||
#[CustomPhpConfigureArg('Darwin')]
|
||||
#[CustomPhpConfigureArg('Linux')]
|
||||
public function getUnixConfigureArg(bool $shared, PackageInstaller $installer, PackageBuilder $builder): string
|
||||
{
|
||||
$arg = '--enable-redis';
|
||||
if ($this->isBuildStatic()) {
|
||||
$arg .= $installer->getPhpExtensionPackage('session')?->isBuildStatic() ? ' --enable-redis-session' : ' --disable-redis-session';
|
||||
$arg .= $installer->getPhpExtensionPackage('igbinary')?->isBuildStatic() ? ' --enable-redis-igbinary' : ' --disable-redis-igbinary';
|
||||
$arg .= $installer->getPhpExtensionPackage('msgpack')?->isBuildStatic() ? ' --enable-redis-msgpack' : ' --disable-redis-msgpack';
|
||||
} else {
|
||||
$arg .= $installer->getPhpExtensionPackage('session') ? ' --enable-redis-session' : ' --disable-redis-session';
|
||||
$arg .= $installer->getPhpExtensionPackage('igbinary') ? ' --enable-redis-igbinary' : ' --disable-redis-igbinary';
|
||||
$arg .= $installer->getPhpExtensionPackage('msgpack') ? ' --enable-redis-msgpack' : ' --disable-redis-msgpack';
|
||||
}
|
||||
if ($zstd = $installer->getLibraryPackage('zstd')) {
|
||||
$arg .= ' --enable-redis-zstd --with-libzstd="' . $zstd->getBuildRootPath() . '"';
|
||||
}
|
||||
if ($liblz4 = $installer->getLibraryPackage('liblz4')) {
|
||||
$arg .= ' --enable-redis-lz4 --with-liblz4="' . $liblz4->getBuildRootPath() . '"';
|
||||
}
|
||||
return $arg;
|
||||
}
|
||||
|
||||
#[CustomPhpConfigureArg('Windows')]
|
||||
public function getWindowsConfigureArg(bool $shared, PackageInstaller $installer): string
|
||||
{
|
||||
$arg = '--enable-redis';
|
||||
$arg .= $installer->getPhpExtensionPackage('session') ? ' --enable-redis-session' : ' --disable-redis-session';
|
||||
$arg .= $installer->getPhpExtensionPackage('igbinary') ? ' --enable-redis-igbinary' : ' --disable-redis-igbinary';
|
||||
return $arg;
|
||||
}
|
||||
}
|
||||
70
src/Package/Extension/simdjson.php
Normal file
70
src/Package/Extension/simdjson.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use Package\Target\php;
|
||||
use StaticPHP\Attribute\Package\BeforeStage;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\DI\ApplicationContext;
|
||||
use StaticPHP\Package\PackageInstaller;
|
||||
use StaticPHP\Package\PhpExtensionPackage;
|
||||
use StaticPHP\Toolchain\Interface\ToolchainInterface;
|
||||
use StaticPHP\Toolchain\ZigToolchain;
|
||||
use StaticPHP\Util\FileSystem;
|
||||
use StaticPHP\Util\GlobalEnvManager;
|
||||
|
||||
#[Extension('simdjson')]
|
||||
class simdjson extends PhpExtensionPackage
|
||||
{
|
||||
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-simdjson')]
|
||||
#[BeforeStage('php', [php::class, 'buildconfForWindows'], 'ext-simdjson')]
|
||||
public function patchBeforeBuildconf(PackageInstaller $installer): bool
|
||||
{
|
||||
$php = $installer->getTargetPackage('php');
|
||||
$php_ver = php::getPHPVersionID();
|
||||
FileSystem::replaceFileRegex(
|
||||
"{$this->getSourceDir()}/config.m4",
|
||||
'/php_version=(`.*`)$/m',
|
||||
"php_version={$php_ver}"
|
||||
);
|
||||
FileSystem::replaceFileStr(
|
||||
"{$this->getSourceDir()}/config.m4",
|
||||
'if test -z "$PHP_CONFIG"; then',
|
||||
'if false; then'
|
||||
);
|
||||
FileSystem::replaceFileStr(
|
||||
"{$this->getSourceDir()}/config.w32",
|
||||
"'yes',",
|
||||
'PHP_SIMDJSON_SHARED,'
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getSharedExtensionEnv(): array
|
||||
{
|
||||
$env = parent::getSharedExtensionEnv();
|
||||
if (ApplicationContext::get(ToolchainInterface::class) instanceof ZigToolchain) {
|
||||
$extra = getenv('SPC_COMPILER_EXTRA');
|
||||
if (!str_contains((string) $extra, '-lstdc++')) {
|
||||
f_putenv('SPC_COMPILER_EXTRA=' . clean_spaces($extra . ' -lstdc++'));
|
||||
}
|
||||
$env['CFLAGS'] .= ' -Xclang -target-feature -Xclang +evex512';
|
||||
$env['CXXFLAGS'] .= ' -Xclang -target-feature -Xclang +evex512';
|
||||
}
|
||||
return $env;
|
||||
}
|
||||
|
||||
#[BeforeStage('php', [php::class, 'makeForUnix'], 'ext-simdjson')]
|
||||
public function patchBeforeMake(): void
|
||||
{
|
||||
if (!ApplicationContext::get(ToolchainInterface::class) instanceof ZigToolchain) {
|
||||
return;
|
||||
}
|
||||
$extra_cflags = getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS') ?: '';
|
||||
GlobalEnvManager::putenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS=' . trim($extra_cflags . ' -Xclang -target-feature -Xclang +evex512'));
|
||||
$extra_cxxflags = getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CXXFLAGS') ?: '';
|
||||
GlobalEnvManager::putenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CXXFLAGS=' . trim($extra_cxxflags . ' -Xclang -target-feature -Xclang +evex512'));
|
||||
}
|
||||
}
|
||||
34
src/Package/Extension/snmp.php
Normal file
34
src/Package/Extension/snmp.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use Package\Target\php;
|
||||
use StaticPHP\Attribute\Package\BeforeStage;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Attribute\PatchDescription;
|
||||
use StaticPHP\Package\PhpExtensionPackage;
|
||||
use StaticPHP\Util\FileSystem;
|
||||
use StaticPHP\Util\PkgConfigUtil;
|
||||
|
||||
#[Extension('snmp')]
|
||||
class snmp extends PhpExtensionPackage
|
||||
{
|
||||
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-snmp')]
|
||||
#[PatchDescription('Fix snmp extension compile error when building with older PHP version and newer net-snmp library')]
|
||||
public function patchBeforeBuildconf(): bool
|
||||
{
|
||||
// Overwrite m4 config using newer PHP version
|
||||
if (php::getPHPVersionID() < 80400) {
|
||||
FileSystem::copy(ROOT_DIR . '/src/globals/extra/snmp-ext-config-old.m4', "{$this->getSourceDir()}/config.m4");
|
||||
}
|
||||
$libs = implode(' ', PkgConfigUtil::getLibsArray('netsnmp'));
|
||||
FileSystem::replaceFileStr(
|
||||
"{$this->getSourceDir()}/config.m4",
|
||||
'PHP_EVAL_LIBLINE([$SNMP_LIBS], [SNMP_SHARED_LIBADD])',
|
||||
"SNMP_LIBS=\"{$libs}\"\nPHP_EVAL_LIBLINE([\$SNMP_LIBS], [SNMP_SHARED_LIBADD])"
|
||||
);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
52
src/Package/Extension/spx.php
Normal file
52
src/Package/Extension/spx.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use Package\Target\php;
|
||||
use StaticPHP\Attribute\Package\BeforeStage;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Attribute\PatchDescription;
|
||||
use StaticPHP\Package\PhpExtensionPackage;
|
||||
use StaticPHP\Util\FileSystem;
|
||||
|
||||
#[Extension('spx')]
|
||||
class spx extends PhpExtensionPackage
|
||||
{
|
||||
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-spx')]
|
||||
#[PatchDescription('Fix spx extension compile error when building as static')]
|
||||
public function patchBeforeBuildconf(): bool
|
||||
{
|
||||
FileSystem::replaceFileStr(
|
||||
"{$this->getSourceDir()}/config.m4",
|
||||
'CFLAGS="$CFLAGS -Werror -Wall -O3 -pthread -std=gnu90"',
|
||||
'CFLAGS="$CFLAGS -pthread"'
|
||||
);
|
||||
FileSystem::replaceFileStr(
|
||||
"{$this->getSourceDir()}/src/php_spx.h",
|
||||
"extern zend_module_entry spx_module_entry;\n",
|
||||
"extern zend_module_entry spx_module_entry;;\n#define phpext_spx_ptr &spx_module_entry\n"
|
||||
);
|
||||
FileSystem::copy("{$this->getSourceDir()}/src/php_spx.h", "{$this->getSourceDir()}/php_spx.h");
|
||||
return true;
|
||||
}
|
||||
|
||||
#[BeforeStage('php', [php::class, 'configureForUnix'], 'ext-spx')]
|
||||
#[PatchDescription('Fix spx extension compile error when configuring')]
|
||||
public function patchBeforeConfigure(): void
|
||||
{
|
||||
FileSystem::replaceFileStr(
|
||||
"{$this->getSourceDir()}/Makefile.frag",
|
||||
'@cp -r assets/web-ui/*',
|
||||
"@cp -r {$this->getSourceDir()}/assets/web-ui/*",
|
||||
);
|
||||
}
|
||||
|
||||
public function getSharedExtensionEnv(): array
|
||||
{
|
||||
$env = parent::getSharedExtensionEnv();
|
||||
$env['SPX_SHARED_LIBADD'] = $env['LIBS'];
|
||||
return $env;
|
||||
}
|
||||
}
|
||||
150
src/Package/Extension/swoole.php
Normal file
150
src/Package/Extension/swoole.php
Normal file
@@ -0,0 +1,150 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use Package\Target\php;
|
||||
use StaticPHP\Attribute\Package\AfterStage;
|
||||
use StaticPHP\Attribute\Package\BeforeStage;
|
||||
use StaticPHP\Attribute\Package\CustomPhpConfigureArg;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Attribute\Package\Validate;
|
||||
use StaticPHP\Attribute\PatchDescription;
|
||||
use StaticPHP\Exception\ValidationException;
|
||||
use StaticPHP\Exception\WrongUsageException;
|
||||
use StaticPHP\Package\PackageBuilder;
|
||||
use StaticPHP\Package\PackageInstaller;
|
||||
use StaticPHP\Package\PhpExtensionPackage;
|
||||
use StaticPHP\Runtime\SystemTarget;
|
||||
use StaticPHP\Util\FileSystem;
|
||||
use StaticPHP\Util\SPCConfigUtil;
|
||||
|
||||
#[Extension('swoole')]
|
||||
class swoole extends PhpExtensionPackage
|
||||
{
|
||||
#[Validate]
|
||||
public function validate(PackageInstaller $installer): void
|
||||
{
|
||||
// swoole-hook-odbc conflicts with pdo_odbc
|
||||
if ($installer->getPhpExtensionPackage('swoole-hook-odbc') && $installer->getPhpExtensionPackage('pdo_odbc')?->isBuildStatic()) {
|
||||
throw new WrongUsageException('swoole-hook-odbc provides pdo_odbc, if you enable odbc hook for swoole, you must remove pdo_odbc extension.');
|
||||
}
|
||||
// swoole-hook-pgsql conflicts with pdo_pgsql
|
||||
if ($installer->getPhpExtensionPackage('swoole-hook-pgsql') && $installer->getPhpExtensionPackage('pdo_pgsql')?->isBuildStatic()) {
|
||||
throw new WrongUsageException('swoole-hook-pgsql provides pdo_pgsql, if you enable pgsql hook for swoole, you must remove pdo_pgsql extension.');
|
||||
}
|
||||
// swoole-hook-sqlite conflicts with pdo_sqlite
|
||||
if ($installer->getPhpExtensionPackage('swoole-hook-sqlite') && $installer->getPhpExtensionPackage('pdo_sqlite')?->isBuildStatic()) {
|
||||
throw new WrongUsageException('swoole-hook-sqlite provides pdo_sqlite, if you enable sqlite hook for swoole, you must remove pdo_sqlite extension.');
|
||||
}
|
||||
}
|
||||
|
||||
#[BeforeStage('php', [php::class, 'makeForUnix'], 'ext-swoole')]
|
||||
#[PatchDescription('Fix maximum version check for Swoole 6.2')]
|
||||
public function patchBeforeMake(): void
|
||||
{
|
||||
FileSystem::replaceFileStr($this->getSourceDir() . '/ext-src/php_swoole_private.h', 'PHP_VERSION_ID > 80500', 'PHP_VERSION_ID >= 80600');
|
||||
}
|
||||
|
||||
#[BeforeStage('php', [php::class, 'makeForUnix'], 'ext-swoole')]
|
||||
#[PatchDescription('Fix swoole with event extension <util.h> conflict bug on macOS')]
|
||||
public function patchBeforeMake2(): void
|
||||
{
|
||||
if (SystemTarget::getTargetOS() === 'Darwin') {
|
||||
// Fix swoole with event extension <util.h> conflict bug
|
||||
$util_path = shell()->execWithResult('xcrun --show-sdk-path', false)[1][0] . '/usr/include/util.h';
|
||||
FileSystem::replaceFileStr(
|
||||
"{$this->getSourceDir()}/thirdparty/php/standard/proc_open.cc",
|
||||
'include <util.h>',
|
||||
"include \"{$util_path}\"",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[CustomPhpConfigureArg('Darwin')]
|
||||
#[CustomPhpConfigureArg('Linux')]
|
||||
public function getUnixConfigureArg(bool $shared, PackageBuilder $builder, PackageInstaller $installer): string
|
||||
{
|
||||
// enable swoole
|
||||
$arg = '--enable-swoole' . ($shared ? '=shared' : '');
|
||||
|
||||
// commonly used feature: coroutine-time
|
||||
$arg .= ' --enable-swoole-coro-time --with-pic';
|
||||
|
||||
$arg .= $builder->getOption('enable-zts') ? ' --enable-swoole-thread --disable-thread-context' : ' --disable-swoole-thread --enable-thread-context';
|
||||
|
||||
// required features: curl, openssl (but curl hook is buggy for php 8.0)
|
||||
$arg .= php::getPHPVersionID() >= 80100 ? ' --enable-swoole-curl' : ' --disable-swoole-curl';
|
||||
$arg .= ' --enable-openssl';
|
||||
|
||||
// additional features that only require libraries
|
||||
$arg .= $installer->getLibraryPackage('libcares') ? ' --enable-cares' : '';
|
||||
$arg .= $installer->getLibraryPackage('brotli') ? (' --enable-brotli --with-brotli-dir=' . BUILD_ROOT_PATH) : '';
|
||||
$arg .= $installer->getLibraryPackage('nghttp2') ? (' --with-nghttp2-dir=' . BUILD_ROOT_PATH) : '';
|
||||
$arg .= $installer->getLibraryPackage('zstd') ? ' --enable-zstd' : '';
|
||||
$arg .= $installer->getLibraryPackage('liburing') ? ' --enable-iouring' : '';
|
||||
$arg .= $installer->getPhpExtensionPackage('sockets') ? ' --enable-sockets' : '';
|
||||
|
||||
// enable additional features that require the pdo extension, but conflict with pdo_* extensions
|
||||
// to make sure everything works as it should, this is done in fake addon extensions
|
||||
$arg .= $installer->getPhpExtensionPackage('swoole-hook-pgsql') ? ' --enable-swoole-pgsql' : ' --disable-swoole-pgsql';
|
||||
$arg .= $installer->getPhpExtensionPackage('swoole-hook-mysql') ? ' --enable-mysqlnd' : ' --disable-mysqlnd';
|
||||
$arg .= $installer->getPhpExtensionPackage('swoole-hook-sqlite') ? ' --enable-swoole-sqlite' : ' --disable-swoole-sqlite';
|
||||
if ($installer->getPhpExtensionPackage('swoole-hook-odbc')) {
|
||||
$config = new SPCConfigUtil()->getLibraryConfig($installer->getLibraryPackage('unixodbc'));
|
||||
$arg .= " --with-swoole-odbc=unixODBC,{$builder->getBuildRootPath()} SWOOLE_ODBC_LIBS=\"{$config['libs']}\"";
|
||||
}
|
||||
|
||||
// Get version from source directory
|
||||
$ver = null;
|
||||
$file = SOURCE_PATH . '/php-src/ext/swoole/include/swoole_version.h';
|
||||
// Match #define SWOOLE_VERSION "5.1.3"
|
||||
$pattern = '/#define SWOOLE_VERSION "(.+)"/';
|
||||
if (preg_match($pattern, file_get_contents($file), $matches)) {
|
||||
$ver = $matches[1];
|
||||
}
|
||||
|
||||
if ($ver && $ver >= '6.1.0') {
|
||||
$arg .= ' --enable-swoole-stdext';
|
||||
}
|
||||
|
||||
if (SystemTarget::getTargetOS() === 'Darwin') {
|
||||
$arg .= ' ac_cv_lib_pthread_pthread_barrier_init=no';
|
||||
}
|
||||
|
||||
return $arg;
|
||||
}
|
||||
|
||||
#[AfterStage('php', [php::class, 'smokeTestCliForUnix'], 'ext-swoole-hook-mysql')]
|
||||
public function mysqlTest(PackageInstaller $installer): void
|
||||
{
|
||||
[$ret, $out] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php -n' . $this->getSharedExtensionLoadString() . ' --ri "swoole"', false);
|
||||
$out = implode('', $out);
|
||||
if ($ret !== 0) {
|
||||
throw new ValidationException("extension {$this->getName()} failed compile check: php-cli returned {$ret}", validation_module: 'extension swoole_hook_mysql sanity check');
|
||||
}
|
||||
// mysqlnd
|
||||
if ($installer->getPhpExtensionPackage('swoole-hook-mysql') && !str_contains($out, 'mysqlnd')) {
|
||||
throw new ValidationException('swoole mysql hook is not enabled correctly.', validation_module: 'Extension swoole mysql hook availability check');
|
||||
}
|
||||
// coroutine_odbc
|
||||
if ($installer->getPhpExtensionPackage('swoole-hook-odbc') && !str_contains($out, 'coroutine_odbc')) {
|
||||
throw new ValidationException('swoole odbc hook is not enabled correctly.', validation_module: 'Extension swoole odbc hook availability check');
|
||||
}
|
||||
// coroutine_pgsql
|
||||
if ($installer->getPhpExtensionPackage('swoole-hook-pgsql') && !str_contains($out, 'coroutine_pgsql')) {
|
||||
throw new ValidationException(
|
||||
'swoole pgsql hook is not enabled correctly.',
|
||||
validation_module: 'Extension swoole pgsql hook availability check'
|
||||
);
|
||||
}
|
||||
// coroutine_sqlite
|
||||
if ($installer->getPhpExtensionPackage('swoole-hook-sqlite') && !str_contains($out, 'coroutine_sqlite')) {
|
||||
throw new ValidationException(
|
||||
'swoole sqlite hook is not enabled correctly.',
|
||||
validation_module: 'Extension swoole sqlite hook availability check'
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
44
src/Package/Extension/swow.php
Normal file
44
src/Package/Extension/swow.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use Package\Target\php;
|
||||
use StaticPHP\Attribute\Package\BeforeStage;
|
||||
use StaticPHP\Attribute\Package\CustomPhpConfigureArg;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Package\PackageInstaller;
|
||||
use StaticPHP\Package\PhpExtensionPackage;
|
||||
use StaticPHP\Util\FileSystem;
|
||||
|
||||
#[Extension('swow')]
|
||||
class swow extends PhpExtensionPackage
|
||||
{
|
||||
#[CustomPhpConfigureArg('Darwin')]
|
||||
#[CustomPhpConfigureArg('Linux')]
|
||||
public function configureArg(PackageInstaller $installer): string
|
||||
{
|
||||
$arg = '--enable-swow';
|
||||
$arg .= $installer->getLibraryPackage('openssl') ? ' --enable-swow-ssl' : ' --disable-swow-ssl';
|
||||
$arg .= $installer->getLibraryPackage('curl') ? ' --enable-swow-curl' : ' --disable-swow-curl';
|
||||
return $arg;
|
||||
}
|
||||
|
||||
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-swow')]
|
||||
#[BeforeStage('php', [php::class, 'buildconfForWindows'], 'ext-swow')]
|
||||
public function patchBeforeBuildconf(PackageInstaller $installer): bool
|
||||
{
|
||||
$php_src = $installer->getTargetPackage('php')->getSourceDir();
|
||||
if (php::getPHPVersionID() >= 80000 && !is_link("{$php_src}/ext/swow")) {
|
||||
if (PHP_OS_FAMILY === 'Windows') {
|
||||
f_passthru("cd {$php_src}/ext && mklink /D swow swow-src\\ext");
|
||||
} else {
|
||||
f_passthru("cd {$php_src}/ext && ln -s swow-src/ext swow");
|
||||
}
|
||||
}
|
||||
// replace AC_DEFUN([SWOW_PKG_CHECK_MODULES] to AC_DEFUN([SWOW_PKG_CHECK_MODULES_STATIC]
|
||||
FileSystem::replaceFileStr($this->getSourceDir() . '/ext/config.m4', 'AC_DEFUN([SWOW_PKG_CHECK_MODULES]', 'AC_DEFUN([SWOW_PKG_CHECK_MODULES_STATIC]');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
23
src/Package/Extension/trader.php
Normal file
23
src/Package/Extension/trader.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use Package\Target\php;
|
||||
use StaticPHP\Attribute\Package\BeforeStage;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Package\PackageInstaller;
|
||||
use StaticPHP\Package\PhpExtensionPackage;
|
||||
use StaticPHP\Util\FileSystem;
|
||||
|
||||
#[Extension('trader')]
|
||||
class trader extends PhpExtensionPackage
|
||||
{
|
||||
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-trader')]
|
||||
public function patchBeforeBuildconf(PackageInstaller $installer): bool
|
||||
{
|
||||
FileSystem::replaceFileStr("{$this->getSourceDir()}/config.m4", 'PHP_TA', 'PHP_TRADER');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
36
src/Package/Extension/uv.php
Normal file
36
src/Package/Extension/uv.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use Package\Target\php;
|
||||
use StaticPHP\Attribute\Package\BeforeStage;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Attribute\Package\Validate;
|
||||
use StaticPHP\Exception\ValidationException;
|
||||
use StaticPHP\Package\PhpExtensionPackage;
|
||||
use StaticPHP\Runtime\SystemTarget;
|
||||
use StaticPHP\Util\FileSystem;
|
||||
|
||||
#[Extension('uv')]
|
||||
class uv extends PhpExtensionPackage
|
||||
{
|
||||
#[Validate]
|
||||
public function validate(): void
|
||||
{
|
||||
if (php::getPHPVersionID() < 80000 && getenv('SPC_SKIP_PHP_VERSION_CHECK') !== 'yes') {
|
||||
throw new ValidationException('The latest uv extension requires PHP 8.0 or later');
|
||||
}
|
||||
}
|
||||
|
||||
#[BeforeStage('ext-uv', [PhpExtensionPackage::class, 'makeForUnix'])]
|
||||
public function patchBeforeSharedMake(PhpExtensionPackage $pkg): bool
|
||||
{
|
||||
if (SystemTarget::getTargetOS() !== 'Linux' || SystemTarget::getTargetArch() !== 'aarch64') {
|
||||
return false;
|
||||
}
|
||||
FileSystem::replaceFileRegex("{$pkg->getSourceDir()}/Makefile", '/^(LDFLAGS =.*)$/m', '$1 -luv -ldl -lrt -pthread');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
35
src/Package/Extension/xhprof.php
Normal file
35
src/Package/Extension/xhprof.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use Package\Target\php;
|
||||
use StaticPHP\Attribute\Package\BeforeStage;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Package\PackageInstaller;
|
||||
use StaticPHP\Package\PhpExtensionPackage;
|
||||
use StaticPHP\Util\FileSystem;
|
||||
|
||||
#[Extension('xhprof')]
|
||||
class xhprof extends PhpExtensionPackage
|
||||
{
|
||||
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-xhprof')]
|
||||
public function patchBeforeBuildconf(PackageInstaller $installer): bool
|
||||
{
|
||||
$php_src = $installer->getTargetPackage('php')->getSourceDir();
|
||||
$link = "{$php_src}/ext/xhprof";
|
||||
if (!is_link($link)) {
|
||||
shell()->cd("{$php_src}/ext")->exec('ln -s xhprof-src/extension xhprof');
|
||||
|
||||
// patch config.m4
|
||||
FileSystem::replaceFileStr(
|
||||
"{$this->getSourceDir()}/extension/config.m4",
|
||||
'if test -f $phpincludedir/ext/pcre/php_pcre.h; then',
|
||||
'if test -f $abs_srcdir/ext/pcre/php_pcre.h; then'
|
||||
);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
25
src/Package/Extension/xlswriter.php
Normal file
25
src/Package/Extension/xlswriter.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use StaticPHP\Attribute\Package\CustomPhpConfigureArg;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Package\PackageInstaller;
|
||||
use StaticPHP\Package\PhpExtensionPackage;
|
||||
|
||||
#[Extension('xlswriter')]
|
||||
class xlswriter extends PhpExtensionPackage
|
||||
{
|
||||
#[CustomPhpConfigureArg('Darwin')]
|
||||
#[CustomPhpConfigureArg('Linux')]
|
||||
public function getUnixConfigureArg(bool $shared, PackageInstaller $installer): string
|
||||
{
|
||||
$arg = '--with-xlswriter --enable-reader';
|
||||
if ($installer->getLibraryPackage('openssl')) {
|
||||
$arg .= ' --with-openssl=' . $installer->getLibraryPackage('openssl')->getBuildRootPath();
|
||||
}
|
||||
return $arg;
|
||||
}
|
||||
}
|
||||
25
src/Package/Extension/yac.php
Normal file
25
src/Package/Extension/yac.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use Package\Target\php;
|
||||
use StaticPHP\Attribute\Package\BeforeStage;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Package\PackageInstaller;
|
||||
use StaticPHP\Package\PhpExtensionPackage;
|
||||
use StaticPHP\Util\FileSystem;
|
||||
|
||||
#[Extension('yac')]
|
||||
class yac extends PhpExtensionPackage
|
||||
{
|
||||
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-yac')]
|
||||
public function patchBeforeBuildconf(PackageInstaller $installer): bool
|
||||
{
|
||||
FileSystem::replaceFileStr("{$this->getSourceDir()}/storage/allocator/yac_allocator.h", 'defined(HAVE_SHM_MMAP_ANON)', 'defined(YAC_ALLOCATOR_H)');
|
||||
FileSystem::replaceFileStr("{$this->getSourceDir()}/serializer/igbinary.c", '#ifdef YAC_ENABLE_IGBINARY', '#if 1');
|
||||
FileSystem::replaceFileStr("{$this->getSourceDir()}/serializer/json.c", '#if YAC_ENABLE_JSON', '#if 1');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
20
src/Package/Extension/zip.php
Normal file
20
src/Package/Extension/zip.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use StaticPHP\Attribute\Package\CustomPhpConfigureArg;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Package\PhpExtensionPackage;
|
||||
|
||||
#[Extension('zip')]
|
||||
class zip extends PhpExtensionPackage
|
||||
{
|
||||
#[CustomPhpConfigureArg('Darwin')]
|
||||
#[CustomPhpConfigureArg('Linux')]
|
||||
public function getUnixConfigureArg(bool $shared): string
|
||||
{
|
||||
return !$shared ? ('--with-zip=' . BUILD_ROOT_PATH) : '--enable-zip=shared';
|
||||
}
|
||||
}
|
||||
22
src/Package/Extension/zlib.php
Normal file
22
src/Package/Extension/zlib.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use Package\Target\php;
|
||||
use StaticPHP\Attribute\Package\CustomPhpConfigureArg;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Package\PackageBuilder;
|
||||
|
||||
#[Extension('zlib')]
|
||||
class zlib
|
||||
{
|
||||
#[CustomPhpConfigureArg('Darwin')]
|
||||
#[CustomPhpConfigureArg('Linux')]
|
||||
public function unixConfigureArg(PackageBuilder $builder): string
|
||||
{
|
||||
$zlib_dir = php::getPHPVersionID() >= 80400 ? '' : ' --with-zlib-dir=' . $builder->getBuildRootPath();
|
||||
return '--with-zlib' . $zlib_dir;
|
||||
}
|
||||
}
|
||||
@@ -48,6 +48,7 @@ class grpc
|
||||
'-DgRPC_ZLIB_PROVIDER=package',
|
||||
'-DgRPC_CARES_PROVIDER=package',
|
||||
'-DgRPC_SSL_PROVIDER=package',
|
||||
'-DCMAKE_SKIP_INSTALL_RPATH=ON',
|
||||
);
|
||||
|
||||
if (PHP_OS_FAMILY === 'Linux' && $toolchain->isStatic() && !LinuxUtil::isMuslDist()) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user