mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-19 13:24:51 +08:00
add (lib)attr and libacl as optional libraries
when libacl is built and --enable-fpm is used, also enable --with-fpm-acl
This commit is contained in:
parent
89e8c152dc
commit
460699c48c
@ -24,6 +24,12 @@
|
||||
"pkg-config"
|
||||
]
|
||||
},
|
||||
"attr": {
|
||||
"source": "attr",
|
||||
"static-libs-unix": [
|
||||
"libattr.a"
|
||||
]
|
||||
},
|
||||
"brotli": {
|
||||
"source": "brotli",
|
||||
"static-libs-unix": [
|
||||
@ -234,6 +240,15 @@
|
||||
"libsodium"
|
||||
]
|
||||
},
|
||||
"libacl": {
|
||||
"source": "libacl",
|
||||
"static-libs-unix": [
|
||||
"libacl.a"
|
||||
],
|
||||
"lib-depends": [
|
||||
"attr"
|
||||
]
|
||||
},
|
||||
"libaom": {
|
||||
"source": "libaom",
|
||||
"static-libs-unix": [
|
||||
|
||||
@ -36,6 +36,16 @@
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"attr": {
|
||||
"type": "git",
|
||||
"rev": "v2.5.2",
|
||||
"url": "https://git.savannah.nongnu.org/git/attr.git",
|
||||
"provide-pre-built": false,
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "doc/COPYING"
|
||||
}
|
||||
},
|
||||
"brotli": {
|
||||
"type": "ghtar",
|
||||
"repo": "google/brotli",
|
||||
@ -323,6 +333,16 @@
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"libacl": {
|
||||
"type": "git",
|
||||
"rev": "v2.3.2",
|
||||
"url": "https://git.savannah.nongnu.org/git/acl.git",
|
||||
"provide-pre-built": false,
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "doc/COPYING"
|
||||
}
|
||||
},
|
||||
"libaom": {
|
||||
"type": "git",
|
||||
"rev": "main",
|
||||
|
||||
@ -174,7 +174,7 @@ class LinuxBuilder extends UnixBuilderBase
|
||||
->exec(
|
||||
getenv('SPC_CMD_PREFIX_PHP_CONFIGURE') . ' ' .
|
||||
($enable_cli ? '--enable-cli ' : '--disable-cli ') .
|
||||
($enable_fpm ? '--enable-fpm ' : '--disable-fpm ') .
|
||||
($enable_fpm ? '--enable-fpm ' . ($this->getLib('libacl') !== null ? '--with-fpm-acl ' : '') : '--disable-fpm ') .
|
||||
($enable_embed ? "--enable-embed={$embed_type} " : '--disable-embed ') .
|
||||
($enable_micro ? '--enable-micro=all-static ' : '--disable-micro ') .
|
||||
$config_file_path .
|
||||
@ -287,7 +287,14 @@ class LinuxBuilder extends UnixBuilderBase
|
||||
*/
|
||||
protected function buildFpm(): void
|
||||
{
|
||||
$vars = SystemUtil::makeEnvVarString($this->getMakeExtraVars());
|
||||
$vars = $this->getMakeExtraVars();
|
||||
if ($this->getLib('libacl') !== null) {
|
||||
$ldflags_program = $vars['EXTRA_LDFLAGS_PROGRAM'] ?? '';
|
||||
if (!str_contains($ldflags_program, '-L' . BUILD_LIB_PATH)) {
|
||||
$vars['EXTRA_LDFLAGS_PROGRAM'] = trim('-L' . BUILD_LIB_PATH . ' ' . $ldflags_program);
|
||||
}
|
||||
}
|
||||
$vars = $this->getEnvString($vars);
|
||||
shell()->cd(SOURCE_PATH . '/php-src')
|
||||
->exec('sed -i "s|//lib|/lib|g" Makefile')
|
||||
->exec("\$SPC_CMD_PREFIX_PHP_MAKE {$vars} fpm");
|
||||
|
||||
12
src/SPC/builder/linux/library/attr.php
Normal file
12
src/SPC/builder/linux/library/attr.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
class attr extends LinuxLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\attr;
|
||||
|
||||
public const NAME = 'attr';
|
||||
}
|
||||
12
src/SPC/builder/linux/library/libacl.php
Normal file
12
src/SPC/builder/linux/library/libacl.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
class libacl extends LinuxLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\libacl;
|
||||
|
||||
public const NAME = 'libacl';
|
||||
}
|
||||
26
src/SPC/builder/unix/library/attr.php
Normal file
26
src/SPC/builder/unix/library/attr.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\unix\library;
|
||||
|
||||
use SPC\exception\RuntimeException;
|
||||
|
||||
trait attr
|
||||
{
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
protected function build(): void
|
||||
{
|
||||
shell()->cd($this->source_dir)
|
||||
->setEnv(['CFLAGS' => $this->getLibExtraCFlags(), 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs()])
|
||||
->execWithEnv('./autogen.sh')
|
||||
->execWithEnv('./configure --prefix= --enable-static --disable-shared --disable-tests')
|
||||
->execWithEnv("make -j {$this->builder->concurrency}")
|
||||
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
|
||||
|
||||
$this->patchPkgconfPrefix(['libattr.pc'], PKGCONF_PATCH_PREFIX);
|
||||
$this->cleanLaFiles();
|
||||
}
|
||||
}
|
||||
30
src/SPC/builder/unix/library/libacl.php
Normal file
30
src/SPC/builder/unix/library/libacl.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\unix\library;
|
||||
|
||||
use SPC\exception\RuntimeException;
|
||||
|
||||
trait libacl
|
||||
{
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
protected function build(): void
|
||||
{
|
||||
shell()->cd($this->source_dir)
|
||||
->setEnv([
|
||||
'CFLAGS' => trim('-I' . BUILD_INCLUDE_PATH . ' ' . $this->getLibExtraCFlags()),
|
||||
'LDFLAGS' => trim('-L' . BUILD_LIB_PATH . ' ' . $this->getLibExtraLdFlags()),
|
||||
'LIBS' => $this->getLibExtraLibs(),
|
||||
])
|
||||
->execWithEnv('./autogen.sh')
|
||||
->execWithEnv('./configure --prefix= --enable-static --disable-shared --disable-tests --disable-nls')
|
||||
->execWithEnv("make -j {$this->builder->concurrency}")
|
||||
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
|
||||
|
||||
$this->patchPkgconfPrefix(['libacl.pc'], PKGCONF_PATCH_PREFIX);
|
||||
$this->cleanLaFiles();
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user