mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 21:04:52 +08:00
* Remove SPC_NO_MUSL_PATH, remove --libc, use SPC_LIBC instead * Fix tests * Internally use GNU_ARCH for unified * Update EXTENSION_DIR comments for env.ini * Remove redundant -fPIC cflags in curl
37 lines
1.3 KiB
PHP
37 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace SPC\builder\unix\library;
|
|
|
|
use SPC\builder\linux\library\LinuxLibraryBase;
|
|
|
|
trait pkgconfig
|
|
{
|
|
protected function build(): void
|
|
{
|
|
$cflags = PHP_OS_FAMILY !== 'Linux' ? "{$this->builder->arch_c_flags} -Wimplicit-function-declaration -Wno-int-conversion" : '';
|
|
$ldflags = !($this instanceof LinuxLibraryBase) || getenv('SPC_LIBC') === 'glibc' ? '' : '--static';
|
|
|
|
shell()->cd($this->source_dir)
|
|
->setEnv(['CFLAGS' => "{$this->getLibExtraCFlags()} {$cflags}", 'LDFLAGS' => "{$this->getLibExtraLdFlags()} {$ldflags}", 'LIBS' => $this->getLibExtraLibs()])
|
|
->execWithEnv(
|
|
'./configure ' .
|
|
'--disable-shared ' .
|
|
'--enable-static ' .
|
|
'--with-internal-glib ' .
|
|
'--disable-host-tool ' .
|
|
'--with-pic ' .
|
|
'--prefix=' . BUILD_ROOT_PATH . ' ' .
|
|
'--without-sysroot ' .
|
|
'--without-system-include-path ' .
|
|
'--without-system-library-path ' .
|
|
'--without-pc-path'
|
|
)
|
|
->exec('make clean')
|
|
->execWithEnv("make -j{$this->builder->concurrency}")
|
|
->execWithEnv('make install-exec');
|
|
shell()->exec('strip ' . BUILD_ROOT_PATH . '/bin/pkg-config');
|
|
}
|
|
}
|