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:
Marc Henderkes 2025-03-05 11:35:03 +01:00
parent 89e8c152dc
commit 460699c48c
7 changed files with 124 additions and 2 deletions

View File

@ -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": [

View File

@ -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",

View File

@ -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");

View 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';
}

View 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';
}

View 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();
}
}

View 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();
}
}