Compare commits

...

32 Commits

Author SHA1 Message Date
Jerry Ma
6b8df97282 Add uv/libuv support (#296)
* add uv/libuv support

* sort config
2023-12-23 16:23:37 +08:00
crazywhalecc
584f96484c add liblz4 suggest 2023-12-23 15:18:39 +08:00
crazywhalecc
e1e5515694 fix tests 2023-12-23 15:18:39 +08:00
crazywhalecc
d3ff6fd8c0 sort config 2023-12-23 15:18:39 +08:00
crazywhalecc
6bcda6a5a0 add lz4, igbinary support for redis 2023-12-23 15:18:39 +08:00
crazywhalecc
3828ba7c77 fix x86_64 build 2023-12-22 13:28:22 +08:00
crazywhalecc
a632caed54 add sqlsrv support test 2023-12-22 13:28:22 +08:00
crazywhalecc
1e0265e673 add sqlsrv support 2023-12-22 13:28:22 +08:00
Jerry Ma
a39cd9a238 Update README.md 2023-12-21 12:55:20 +08:00
Jerry Ma
2d437952f2 Update README.md 2023-12-21 12:54:43 +08:00
crazywhalecc
7e5b0d6f43 use bulk combination for setup-runtime 2023-12-21 01:45:54 +08:00
Jerry Ma
cf198e0f0a Merge pull request #64 from mpociot/libargon2-support
Add support for libargon2
2023-12-19 20:49:50 +08:00
crazywhalecc
248918e458 remove ldap test for known reason 2023-12-19 20:04:13 +08:00
crazywhalecc
c4cfc01b88 fix linux build (dont know why linux failed) 2023-12-19 19:37:19 +08:00
crazywhalecc
339c03adb2 fix linux build (dont know why linux failed) 2023-12-19 19:31:56 +08:00
crazywhalecc
48551cc602 add linux support for libargon2 2023-12-19 19:13:19 +08:00
crazywhalecc
e0550b4a45 add argon2 test 2023-12-19 19:04:49 +08:00
crazywhalecc
93a55e87d5 temporarily use pkg-config mirror (freedesktop.org down) 2023-12-19 19:03:16 +08:00
Marcel Pociot
e68f1ce3fe Merge branch 'main' into libargon2-support 2023-12-19 10:05:45 +01:00
crazywhalecc
3573007485 Merge remote-tracking branch 'origin/main' 2023-12-18 00:14:34 +08:00
crazywhalecc
b961c34d9a add ldap test 2023-12-18 00:14:14 +08:00
Jerry Ma
33e1759caa Update README.md 2023-12-17 12:16:54 +08:00
crazywhalecc
fbf5c958d0 sort configs 2023-11-05 17:55:39 +08:00
crazywhalecc
672a4102cd overwrite password-argon2 cli check 2023-11-05 17:53:48 +08:00
crazywhalecc
52d61365b7 Merge branch 'main' into libargon2-support 2023-11-05 17:50:00 +08:00
crazywhalecc
3604ea6d67 Update lock 2023-11-05 17:32:29 +08:00
crazywhalecc
967292be5c Remove old configure_env 2023-11-05 17:31:17 +08:00
crazywhalecc
4f5335bba4 Merge branch 'main' into libargon2-support
# Conflicts:
#	config/lib.json
#	config/source.json
2023-11-05 17:25:36 +08:00
Marcel Pociot
0569c69634 remove path 2023-06-03 00:04:02 +02:00
Marcel Pociot
1b734073b0 Merge refactor 2023-06-02 22:47:59 +02:00
Marcel Pociot
47d068e6d3 Merge branch 'refactor' into libargon2-support 2023-06-02 22:47:47 +02:00
Marcel Pociot
4537bfb247 Add support for libargon2 2023-05-31 10:03:40 +02:00
23 changed files with 415 additions and 45 deletions

View File

@@ -140,7 +140,7 @@ jobs:
run: bin/spc doctor --auto-fix run: bin/spc doctor --auto-fix
- name: "Run Build Tests (download)" - name: "Run Build Tests (download)"
run: bin/spc download --for-extensions="$(php src/globals/test-extensions.php)" --with-php=${{ matrix.php }} --debug run: bin/spc download --for-extensions="$(php src/globals/test-extensions.php extensions)" --with-php=${{ matrix.php }} --debug
- name: "Run Build Tests (build)" - name: "Run Build Tests (build)"
run: bin/spc build "$(php src/globals/test-extensions.php)" --build-cli --build-micro --build-fpm --debug run: bin/spc build $(php src/globals/test-extensions.php cmd) --build-cli --build-micro --build-fpm --debug

View File

@@ -18,10 +18,9 @@ You can also use the micro binary file to combine php binary and php source code
[![Version](https://img.shields.io/badge/Version-2.0--rc8-pink.svg?style=flat-square)]() [![Version](https://img.shields.io/badge/Version-2.0--rc8-pink.svg?style=flat-square)]()
[![License](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)]() [![License](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)]()
[![](https://img.shields.io/github/actions/workflow/status/crazywhalecc/static-php-cli/build-linux-x86_64.yml?branch=refactor&label=Linux%20Build&style=flat-square)](https://github.com/crazywhalecc/static-php-cli/actions/workflows/build.yml) [![](https://img.shields.io/github/actions/workflow/status/crazywhalecc/static-php-cli/tests.yml?branch=main&label=Build%20Test&style=flat-square)](https://github.com/crazywhalecc/static-php-cli/actions/workflows/tests.yml)
[![](https://img.shields.io/github/actions/workflow/status/crazywhalecc/static-php-cli/build-macos-x86_64.yml?branch=refactor&label=macOS%20Build&style=flat-square)](https://github.com/crazywhalecc/static-php-cli/actions/workflows/build.yml)
[![](https://img.shields.io/badge/Extension%20Counter-65+-yellow.svg?style=flat-square)]() [![](https://img.shields.io/badge/Extension%20Counter-65+-yellow.svg?style=flat-square)]([https://static-php.dev/](https://static-php.dev/en/guide/extensions.html))
[![](https://img.shields.io/github/search/crazywhalecc/static-php-cli/TODO?label=TODO%20Counter&style=flat-square)]() [![](https://img.shields.io/github/search/crazywhalecc/static-php-cli/TODO?label=TODO%20Counter&style=flat-square)]()
## Documentation ## Documentation
@@ -36,9 +35,9 @@ If you don't want to compile yourself, you can download example pre-compiled art
Below are several precompiled static-php binaries with different extension combinations, Below are several precompiled static-php binaries with different extension combinations,
which can be downloaded directly according to your needs. which can be downloaded directly according to your needs.
- [Extension-Combination - common](https://dl.static-php.dev/static-php-cli/common/): `common` combination contains about [30+](https://dl.static-php.dev/static-php-cli/common/README.txt) commonly used extensions, and the size is about 22MB. - [Extension-Combination - common](https://dl.static-php.dev/static-php-cli/common/): `common` contains about [30+](https://dl.static-php.dev/static-php-cli/common/README.txt) commonly used extensions, and the size is about 22MB.
- [Extension-Combination - bulk](https://dl.static-php.dev/static-php-cli/bulk/): `bulk` combination contains [50+](https://dl.static-php.dev/static-php-cli/bulk/README.txt) extensions and is about 70MB in size. - [Extension-Combination - bulk](https://dl.static-php.dev/static-php-cli/bulk/): `bulk` contains [50+](https://dl.static-php.dev/static-php-cli/bulk/README.txt) extensions and is about 70MB in size.
- [Extension-Combination - minimal](https://dl.static-php.dev/static-php-cli/minimal/): `minimal` combination contains [5](https://dl.static-php.dev/static-php-cli/minimal/README.txt) extensions and is about 6MB in size. - [Extension-Combination - minimal](https://dl.static-php.dev/static-php-cli/minimal/): `minimal` contains [5](https://dl.static-php.dev/static-php-cli/minimal/README.txt) extensions and is about 6MB in size.
## Use static-php-cli to build PHP ## Use static-php-cli to build PHP

View File

@@ -25,7 +25,7 @@ __DIR__=$(cd "$(dirname "$0")" && pwd)
__PROJECT__=$(cd "${__DIR__}"/../ && pwd) __PROJECT__=$(cd "${__DIR__}"/../ && pwd)
# set download dir # set download dir
__PHP_RUNTIME_URL__="https://dl.static-php.dev/static-php-cli/common/php-8.2.12-cli-${__OS_FIXED__}-${__ARCH__}.tar.gz" __PHP_RUNTIME_URL__="https://dl.static-php.dev/static-php-cli/bulk/php-8.2.13-cli-${__OS_FIXED__}-${__ARCH__}.tar.gz"
__COMPOSER_URL__="https://getcomposer.org/download/latest-stable/composer.phar" __COMPOSER_URL__="https://getcomposer.org/download/latest-stable/composer.phar"
# use china mirror # use china mirror
@@ -46,7 +46,7 @@ done
case "$mirror" in case "$mirror" in
china) china)
__PHP_RUNTIME_URL__="https://dl.static-php.dev/static-php-cli/common/php-8.2.12-cli-${__OS_FIXED__}-${__ARCH__}.tar.gz" __PHP_RUNTIME_URL__="https://dl.static-php.dev/static-php-cli/bulk/php-8.2.13-cli-${__OS_FIXED__}-${__ARCH__}.tar.gz"
__COMPOSER_URL__="https://mirrors.aliyun.com/composer/composer.phar" __COMPOSER_URL__="https://mirrors.aliyun.com/composer/composer.phar"
;; ;;

View File

@@ -122,6 +122,10 @@
"libiconv" "libiconv"
] ]
}, },
"igbinary": {
"type": "external",
"source": "igbinary"
},
"imagick": { "imagick": {
"type": "external", "type": "external",
"source": "ext-imagick", "source": "ext-imagick",
@@ -242,6 +246,13 @@
"zlib" "zlib"
] ]
}, },
"password-argon2": {
"type": "builtin",
"arg-type": "with-prefix",
"lib-depends": [
"libargon2"
]
},
"pcntl": { "pcntl": {
"type": "builtin", "type": "builtin",
"unix-only": true "unix-only": true
@@ -324,7 +335,12 @@
"source": "redis", "source": "redis",
"arg-type": "custom", "arg-type": "custom",
"ext-suggests": [ "ext-suggests": [
"session" "session",
"igbinary"
],
"lib-suggests": [
"zstd",
"liblz4"
] ]
}, },
"session": { "session": {
@@ -384,6 +400,17 @@
"sqlite" "sqlite"
] ]
}, },
"sqlsrv": {
"type": "external",
"source": "sqlsrv",
"lib-depends": [
"unixodbc"
],
"cpp-extension": true,
"ext-depends-linux": [
"pcntl"
]
},
"ssh2": { "ssh2": {
"type": "external", "type": "external",
"source": "ext-ssh2", "source": "ext-ssh2",
@@ -444,6 +471,14 @@
"tokenizer": { "tokenizer": {
"type": "builtin" "type": "builtin"
}, },
"uv": {
"type": "external",
"source": "ext-uv",
"arg-type": "with-prefix",
"lib-depends": [
"libuv"
]
},
"xlswriter": { "xlswriter": {
"type": "external", "type": "external",
"source": "xlswriter", "source": "xlswriter",

View File

@@ -163,6 +163,12 @@
"libsodium" "libsodium"
] ]
}, },
"libargon2": {
"source": "libargon2",
"static-libs-unix": [
"libargon2.a"
]
},
"libavif": { "libavif": {
"source": "libavif", "source": "libavif",
"static-libs-unix": [ "static-libs-unix": [
@@ -218,10 +224,10 @@
"libturbojpeg.a" "libturbojpeg.a"
] ]
}, },
"libmcrypt": { "liblz4": {
"source": "libmcrypt", "source": "liblz4",
"static-libs-unix": [ "static-libs-unix": [
"libmcrypt.a" "liblz4.a"
] ]
}, },
"libmemcached": { "libmemcached": {
@@ -278,6 +284,12 @@
"zlib" "zlib"
] ]
}, },
"libuv": {
"source": "libuv",
"static-libs-unix": [
"libuv.a"
]
},
"libwebp": { "libwebp": {
"source": "libwebp", "source": "libwebp",
"static-libs-unix": [ "static-libs-unix": [
@@ -362,12 +374,6 @@
"openssl" "openssl"
] ]
}, },
"mcrypt": {
"source": "mcrypt",
"static-libs-unix": [
"libmcrypt.a"
]
},
"ncurses": { "ncurses": {
"source": "ncurses", "source": "ncurses",
"static-libs-unix": [ "static-libs-unix": [
@@ -490,6 +496,17 @@
"libtidy.a" "libtidy.a"
] ]
}, },
"unixodbc": {
"source": "unixodbc",
"static-libs-unix": [
"libodbc.a",
"libodbccr.a",
"libodbcinst.a"
],
"lib-depends": [
"libiconv"
]
},
"xz": { "xz": {
"source": "xz", "source": "xz",
"static-libs-unix": [ "static-libs-unix": [

View File

@@ -100,6 +100,16 @@
"path": "LICENSE" "path": "LICENSE"
} }
}, },
"ext-uv": {
"type": "url",
"url": "https://pecl.php.net/get/uv",
"path": "php-src/ext/uv",
"filename": "uv.tgz",
"license": {
"type": "file",
"path": "LICENSE"
}
},
"ext-zstd": { "ext-zstd": {
"type": "git", "type": "git",
"path": "php-src/ext/zstd", "path": "php-src/ext/zstd",
@@ -136,6 +146,16 @@
"path": "LICENSE" "path": "LICENSE"
} }
}, },
"igbinary": {
"type": "url",
"url": "https://pecl.php.net/get/igbinary",
"path": "php-src/ext/igbinary",
"filename": "igbinary.tgz",
"license": {
"type": "file",
"path": "COPYING"
}
},
"imagemagick": { "imagemagick": {
"type": "ghtar", "type": "ghtar",
"repo": "ImageMagick/ImageMagick", "repo": "ImageMagick/ImageMagick",
@@ -172,6 +192,15 @@
"path": "LICENSE" "path": "LICENSE"
} }
}, },
"libargon2": {
"type": "git",
"rev": "master",
"url": "https://github.com/mpociot/phc-winner-argon2",
"license": {
"type": "file",
"path": "LICENSE"
}
},
"libavif": { "libavif": {
"type": "ghtar", "type": "ghtar",
"repo": "AOMediaCodec/libavif", "repo": "AOMediaCodec/libavif",
@@ -215,12 +244,13 @@
"path": "LICENSE.md" "path": "LICENSE.md"
} }
}, },
"libmcrypt": { "liblz4": {
"type": "url", "type": "ghrel",
"url": "https://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz", "repo": "lz4/lz4",
"match": "lz4-.+\\.tar\\.gz",
"license": { "license": {
"type": "file", "type": "file",
"path": "COPYING" "path": "LICENSE"
} }
}, },
"libmemcached": { "libmemcached": {
@@ -242,8 +272,9 @@
} }
}, },
"libsodium": { "libsodium": {
"type": "url", "type": "ghrel",
"url": "https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz", "repo": "jedisct1/libsodium",
"match": "libsodium-\\d+(\\.\\d+)*\\.tar\\.gz",
"license": { "license": {
"type": "file", "type": "file",
"path": "LICENSE" "path": "LICENSE"
@@ -258,6 +289,20 @@
"path": "COPYING" "path": "COPYING"
} }
}, },
"libuv": {
"type": "ghtar",
"repo": "libuv/libuv",
"license": [
{
"type": "file",
"path": "LICENSE"
},
{
"type": "file",
"path": "LICENSE-extra"
}
]
},
"libwebp": { "libwebp": {
"type": "url", "type": "url",
"url": "https://github.com/webmproject/libwebp/archive/refs/tags/v1.3.2.tar.gz", "url": "https://github.com/webmproject/libwebp/archive/refs/tags/v1.3.2.tar.gz",
@@ -301,14 +346,6 @@
"path": "LICENSE" "path": "LICENSE"
} }
}, },
"mcrypt": {
"type": "url",
"url": "https://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz",
"license": {
"type": "file",
"path": "COPYING"
}
},
"memcached": { "memcached": {
"type": "url", "type": "url",
"url": "https://pecl.php.net/get/memcached", "url": "https://pecl.php.net/get/memcached",
@@ -376,9 +413,8 @@
} }
}, },
"pkg-config": { "pkg-config": {
"type": "filelist", "type": "url",
"url": "https://pkgconfig.freedesktop.org/releases/", "url": "https://dl.static-php.dev/static-php-cli/deps/pkg-config/pkg-config-0.29.2.tar.gz",
"regex": "/href=\"(?<file>pkg-config-(?<version>[^\"]+)\\.tar\\.gz)\"/",
"license": { "license": {
"type": "file", "type": "file",
"path": "COPYING" "path": "COPYING"
@@ -449,6 +485,16 @@
"text": "The author disclaims copyright to this source code. In place of\na legal notice, here is a blessing:\n\n * May you do good and not evil.\n * May you find forgiveness for yourself and forgive others.\n * May you share freely, never taking more than you give." "text": "The author disclaims copyright to this source code. In place of\na legal notice, here is a blessing:\n\n * May you do good and not evil.\n * May you find forgiveness for yourself and forgive others.\n * May you share freely, never taking more than you give."
} }
}, },
"sqlsrv": {
"type": "url",
"url": "https://pecl.php.net/get/sqlsrv",
"path": "php-src/ext/sqlsrv",
"filename": "sqlsrv.tgz",
"license": {
"type": "file",
"path": "LICENSE"
}
},
"swoole": { "swoole": {
"type": "ghtar", "type": "ghtar",
"path": "php-src/ext/swoole", "path": "php-src/ext/swoole",
@@ -478,6 +524,14 @@
"path": "README/LICENSE.md" "path": "README/LICENSE.md"
} }
}, },
"unixodbc": {
"type": "url",
"url": "https://www.unixodbc.org/unixODBC-2.3.12.tar.gz",
"license": {
"type": "file",
"path": "COPYING"
}
},
"xlswriter": { "xlswriter": {
"type": "url", "type": "url",
"url": "https://pecl.php.net/get/xlswriter", "url": "https://pecl.php.net/get/xlswriter",

View File

@@ -0,0 +1,21 @@
<?php
declare(strict_types=1);
namespace SPC\builder\extension;
use SPC\builder\Extension;
use SPC\exception\RuntimeException;
use SPC\util\CustomExt;
#[CustomExt('password-argon2')]
class password_argon2 extends Extension
{
public function runCliCheck(): void
{
[$ret] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php -r "assert(defined(\'PASSWORD_ARGON2I\'));"');
if ($ret !== 0) {
throw new RuntimeException('extension ' . $this->getName() . ' failed sanity check');
}
}
}

View File

@@ -13,14 +13,14 @@ class redis extends Extension
public function getUnixConfigureArg(): string public function getUnixConfigureArg(): string
{ {
$arg = '--enable-redis'; $arg = '--enable-redis';
if (!$this->builder->getExt('session')) { $arg .= $this->builder->getExt('session') ? ' --enable-redis-session' : ' --disable-redis-session';
$arg .= ' --disable-redis-session'; $arg .= $this->builder->getExt('igbinary') ? ' --enable-redis-igbinary' : ' --disable-redis-igbinary';
} else {
$arg .= ' --enable-redis-session';
}
if ($this->builder->getLib('zstd')) { if ($this->builder->getLib('zstd')) {
$arg .= ' --enable-redis-zstd --with-libzstd="' . BUILD_ROOT_PATH . '"'; $arg .= ' --enable-redis-zstd --with-libzstd="' . BUILD_ROOT_PATH . '"';
} }
if ($this->builder->getLib('liblz4')) {
$arg .= ' --enable-redis-lz4 --with-liblz4="' . BUILD_ROOT_PATH . '"';
}
return $arg; return $arg;
} }
} }

View File

@@ -144,6 +144,7 @@ class LinuxBuilder extends BuilderBase
// prepare build php envs // prepare build php envs
$envs_build_php = SystemUtil::makeEnvVarString([ $envs_build_php = SystemUtil::makeEnvVarString([
'CFLAGS' => $cflags, 'CFLAGS' => $cflags,
'CPPFLAGS' => '-I' . BUILD_INCLUDE_PATH,
'LIBS' => '-ldl -lpthread', 'LIBS' => '-ldl -lpthread',
]); ]);

View File

@@ -0,0 +1,25 @@
<?php
declare(strict_types=1);
namespace SPC\builder\linux\library;
use SPC\exception\WrongUsageException;
use SPC\store\FileSystem;
class libargon2 extends LinuxLibraryBase
{
use \SPC\builder\unix\library\libargon2;
public const NAME = 'libargon2';
public function patchBeforeBuild(): bool
{
// detect libsodium (The libargon2 conflicts with the libsodium library.)
if ($this->builder->getLib('libsodium') !== null) {
throw new WrongUsageException('libargon2 (required by password-argon2) conflicts with the libsodium library !');
}
FileSystem::replaceFileStr($this->source_dir . '/Makefile', 'LIBRARY_REL ?= lib/x86_64-linux-gnu', 'LIBRARY_REL ?= lib');
return true;
}
}

View File

@@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
namespace SPC\builder\linux\library;
class liblz4 extends LinuxLibraryBase
{
use \SPC\builder\unix\library\liblz4;
public const NAME = 'liblz4';
}

View File

@@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
namespace SPC\builder\linux\library;
class libuv extends LinuxLibraryBase
{
use \SPC\builder\unix\library\libuv;
public const NAME = 'libuv';
}

View File

@@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
namespace SPC\builder\linux\library;
class unixodbc extends LinuxLibraryBase
{
use \SPC\builder\unix\library\unixodbc;
public const NAME = 'unixodbc';
}

View File

@@ -163,6 +163,7 @@ class MacOSBuilder extends BuilderBase
'--enable-shared=no ' . '--enable-shared=no ' .
'--enable-static=yes ' . '--enable-static=yes ' .
"CFLAGS='{$this->arch_c_flags} -Werror=unknown-warning-option' " . "CFLAGS='{$this->arch_c_flags} -Werror=unknown-warning-option' " .
"CPPFLAGS='-I" . BUILD_INCLUDE_PATH . "' " .
'--disable-all ' . '--disable-all ' .
'--disable-cgi ' . '--disable-cgi ' .
'--disable-phpdbg ' . '--disable-phpdbg ' .

View File

@@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
namespace SPC\builder\macos\library;
class libargon2 extends MacOSLibraryBase
{
use \SPC\builder\unix\library\libargon2;
public const NAME = 'libargon2';
}

View File

@@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
namespace SPC\builder\macos\library;
class liblz4 extends MacOSLibraryBase
{
use \SPC\builder\unix\library\liblz4;
public const NAME = 'liblz4';
}

View File

@@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
namespace SPC\builder\macos\library;
class libuv extends MacOSLibraryBase
{
use \SPC\builder\unix\library\libuv;
public const NAME = 'libuv';
}

View File

@@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
namespace SPC\builder\macos\library;
class unixodbc extends MacOSLibraryBase
{
use \SPC\builder\unix\library\unixodbc;
public const NAME = 'unixodbc';
}

View File

@@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\store\FileSystem;
trait libargon2
{
protected function build()
{
shell()->cd($this->source_dir)
->exec("make PREFIX='' clean")
->exec("make -j{$this->builder->concurrency} PREFIX=''")
->exec("make install PREFIX='' DESTDIR=" . BUILD_ROOT_PATH);
$this->patchPkgconfPrefix(['libargon2.pc']);
foreach (FileSystem::scanDirFiles(BUILD_ROOT_PATH . '/lib/', false, true) as $filename) {
if (str_starts_with($filename, 'libargon2') && (str_contains($filename, '.so') || str_ends_with($filename, '.dylib'))) {
unlink(BUILD_ROOT_PATH . '/lib/' . $filename);
}
}
}
}

View File

@@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\store\FileSystem;
trait liblz4
{
protected function build()
{
shell()->cd($this->source_dir)
->exec("make PREFIX='' clean")
->exec("make -j{$this->builder->concurrency} PREFIX=''")
->exec("make install PREFIX='' DESTDIR=" . BUILD_ROOT_PATH);
$this->patchPkgconfPrefix(['liblz4.pc']);
foreach (FileSystem::scanDirFiles(BUILD_ROOT_PATH . '/lib/', false, true) as $filename) {
if (str_starts_with($filename, 'liblz4') && (str_contains($filename, '.so') || str_ends_with($filename, '.dylib'))) {
unlink(BUILD_ROOT_PATH . '/lib/' . $filename);
}
}
}
}

View File

@@ -0,0 +1,29 @@
<?php
declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\store\FileSystem;
trait libuv
{
/**
* @throws FileSystemException
* @throws RuntimeException
*/
protected function build(): void
{
// CMake needs a clean build directory
FileSystem::resetDir($this->source_dir . '/build');
// Start build
shell()->cd($this->source_dir . '/build')
->exec("cmake {$this->builder->makeCmakeArgs()} -DLIBUV_BUILD_SHARED=OFF ..")
->exec("cmake --build . -j {$this->builder->concurrency}")
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
// patch pkgconfig
$this->patchPkgconfPrefix(['libuv-static.pc']);
}
}

View File

@@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
trait unixodbc
{
/**
* @throws FileSystemException
* @throws RuntimeException
*/
protected function build(): void
{
shell()->cd($this->source_dir)
->exec(
'./configure ' .
'--enable-static --disable-shared ' .
'--disable-debug ' .
'--disable-dependency-tracking ' .
'--with-libiconv-prefix=' . BUILD_ROOT_PATH . ' ' .
'--with-included-ltdl ' .
'--enable-gui=no ' .
'--prefix='
)
->exec('make clean')
->exec("make -j{$this->builder->concurrency}")
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
$this->patchPkgconfPrefix(['odbc.pc', 'odbccr.pc', 'odbcinst.pc']);
$this->cleanLaFiles();
}
}

View File

@@ -2,7 +2,24 @@
declare(strict_types=1); declare(strict_types=1);
# If you want to test new extensions here, just modify it. # Normal test, contains `common` extension.
$extensions = 'apcu,bcmath,bz2,calendar,ctype,curl,dba,dom,event,exif,fileinfo,filter,ftp,gd,gmp,iconv,imagick,imap,intl,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pcntl,pdo,pdo_mysql,pdo_pgsql,pdo_sqlite,pgsql,phar,posix,protobuf,readline,redis,session,shmop,simplexml,soap,sockets,sodium,sqlite3,swoole,sysvmsg,sysvsem,sysvshm,tokenizer,xml,xmlreader,xmlwriter,xsl,zip,zlib'; $extensions = 'bcmath,bz2,calendar,ctype,curl,dom,exif,fileinfo,filter,ftp,gd,gmp,iconv,xml,mbstring,mbregex,mysqlnd,openssl,pcntl,pdo,pdo_mysql,pdo_sqlite,phar,posix,redis,session,simplexml,soap,sockets,sqlite3,tokenizer,xmlwriter,xmlreader,zlib,zip';
echo $extensions; # Normal test, contains gd extra libraries.
$additional_libs = 'libwebp,libavif,libjpeg,freetype';
# If you want to test additional extensions, add them below. (comma start)
$extensions .= ',uv';
# If you want to test additional features for extensions, add libs below. (comma start like extensions)
$additional_libs .= '';
if (!isset($argv[1])) {
exit("Please use 'extensions', 'cmd' or 'libs' as output type");
}
echo match ($argv[1]) {
'extensions' => $extensions,
'libs' => $additional_libs,
'cmd' => $extensions . ' --with-libs=' . $additional_libs,
default => '',
};