35 lines
1.2 KiB
PHP
Raw Normal View History

<?php
declare(strict_types=1);
namespace SPC\builder\unix\library;
trait pkgconfig
{
protected function build(): void
{
$cflags = PHP_OS_FAMILY !== 'Linux' ? "{$this->builder->arch_c_flags} -Wimplicit-function-declaration -Wno-int-conversion" : '';
$ldflags = PHP_OS_FAMILY !== 'Linux' ? '' : '--static';
shell()->cd($this->source_dir)
2024-04-07 15:52:24 +08:00
->setEnv(['CFLAGS' => $this->getLibExtraCFlags() ?: $cflags, 'LDFLAGS' => $this->getLibExtraLdFlags() ?: $ldflags, 'LIBS' => $this->getLibExtraLibs()])
->execWithEnv(
'./configure ' .
'--disable-shared ' .
'--enable-static ' .
'--with-internal-glib ' .
2024-02-20 14:03:44 +08:00
'--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')
2024-04-07 15:52:24 +08:00
->execWithEnv("make -j{$this->builder->concurrency}")
->execWithEnv('make install-exec');
2024-02-20 14:03:44 +08:00
shell()->exec('strip ' . BUILD_ROOT_PATH . '/bin/pkg-config');
}
}