mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 12:54:52 +08:00
make patchLaDependencyPrefix argument optional, remove cleanLaFiles
This commit is contained in:
parent
684b5d4534
commit
9ed62b02b6
@ -59,6 +59,6 @@ class libpng extends LinuxLibraryBase
|
|||||||
->exec("make -j{$this->builder->concurrency} DEFAULT_INCLUDES='-I{$this->source_dir} -I" . BUILD_INCLUDE_PATH . "' LIBS= libpng16.la")
|
->exec("make -j{$this->builder->concurrency} DEFAULT_INCLUDES='-I{$this->source_dir} -I" . BUILD_INCLUDE_PATH . "' LIBS= libpng16.la")
|
||||||
->exec('make install-libLTLIBRARIES install-data-am DESTDIR=' . BUILD_ROOT_PATH);
|
->exec('make install-libLTLIBRARIES install-data-am DESTDIR=' . BUILD_ROOT_PATH);
|
||||||
$this->patchPkgconfPrefix(['libpng16.pc'], PKGCONF_PATCH_PREFIX);
|
$this->patchPkgconfPrefix(['libpng16.pc'], PKGCONF_PATCH_PREFIX);
|
||||||
$this->cleanLaFiles();
|
$this->patchLaDependencyPrefix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,7 +59,6 @@ class libpng extends MacOSLibraryBase
|
|||||||
->cd(BUILD_LIB_PATH)
|
->cd(BUILD_LIB_PATH)
|
||||||
->exec('ln -sf libpng16.a libpng.a');
|
->exec('ln -sf libpng16.a libpng.a');
|
||||||
$this->patchPkgconfPrefix(['libpng16.pc'], PKGCONF_PATCH_PREFIX);
|
$this->patchPkgconfPrefix(['libpng16.pc'], PKGCONF_PATCH_PREFIX);
|
||||||
$this->patchLaDependencyPrefix(['libpng16.la']);
|
$this->patchLaDependencyPrefix();
|
||||||
$this->cleanLaFiles();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -84,13 +84,24 @@ trait UnixLibraryTrait
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function patchLaDependencyPrefix(array $files): void
|
public function patchLaDependencyPrefix(?array $files = null): void
|
||||||
{
|
{
|
||||||
logger()->info('Patching library [' . static::NAME . '] la files');
|
logger()->info('Patching library [' . static::NAME . '] la files');
|
||||||
|
$throwOnMissing = true;
|
||||||
|
if ($files === null) {
|
||||||
|
$files = $this->getStaticLibs();
|
||||||
|
$files = array_map(fn ($name) => str_replace('.a', '.la', $name), $files);
|
||||||
|
$throwOnMissing = false;
|
||||||
|
}
|
||||||
foreach ($files as $name) {
|
foreach ($files as $name) {
|
||||||
$realpath = realpath(BUILD_LIB_PATH . '/' . $name);
|
$realpath = realpath(BUILD_LIB_PATH . '/' . $name);
|
||||||
if ($realpath === false) {
|
if ($realpath === false) {
|
||||||
|
if ($throwOnMissing) {
|
||||||
throw new RuntimeException('Cannot find library [' . static::NAME . '] la file [' . $name . '] !');
|
throw new RuntimeException('Cannot find library [' . static::NAME . '] la file [' . $name . '] !');
|
||||||
|
} else {
|
||||||
|
logger()->warning('Cannot find library [' . static::NAME . '] la file [' . $name . '] !');
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
logger()->debug('Patching ' . $realpath);
|
logger()->debug('Patching ' . $realpath);
|
||||||
// replace prefix
|
// replace prefix
|
||||||
@ -105,22 +116,6 @@ trait UnixLibraryTrait
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* remove libtool archive files
|
|
||||||
*
|
|
||||||
* @throws FileSystemException
|
|
||||||
* @throws WrongUsageException
|
|
||||||
*/
|
|
||||||
public function cleanLaFiles(): void
|
|
||||||
{
|
|
||||||
foreach ($this->getStaticLibs() as $lib) {
|
|
||||||
$filename = pathinfo($lib, PATHINFO_FILENAME) . '.la';
|
|
||||||
if (file_exists(BUILD_LIB_PATH . '/' . $filename)) {
|
|
||||||
unlink(BUILD_LIB_PATH . '/' . $filename);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getLibExtraCFlags(): string
|
public function getLibExtraCFlags(): string
|
||||||
{
|
{
|
||||||
$env = getenv($this->getSnakeCaseName() . '_CFLAGS') ?: '';
|
$env = getenv($this->getSnakeCaseName() . '_CFLAGS') ?: '';
|
||||||
|
|||||||
@ -38,7 +38,5 @@ trait freetype
|
|||||||
' -L/lib ',
|
' -L/lib ',
|
||||||
' -L' . BUILD_ROOT_PATH . '/lib '
|
' -L' . BUILD_ROOT_PATH . '/lib '
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->cleanLaFiles();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,6 +34,6 @@ trait gettext
|
|||||||
->exec('make clean')
|
->exec('make clean')
|
||||||
->exec("make -j{$this->builder->concurrency}")
|
->exec("make -j{$this->builder->concurrency}")
|
||||||
->exec('make install');
|
->exec('make install');
|
||||||
$this->patchLaDependencyPrefix(['libintl.la']);
|
$this->patchLaDependencyPrefix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -78,10 +78,6 @@ trait imagemagick
|
|||||||
'includearchdir=${prefix}/include/ImageMagick-7'
|
'includearchdir=${prefix}/include/ImageMagick-7'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$this->patchLaDependencyPrefix([
|
$this->patchLaDependencyPrefix();
|
||||||
'libMagick++-7.Q16HDRI.la',
|
|
||||||
'libMagickCore-7.Q16HDRI.la',
|
|
||||||
'libMagickWand-7.Q16HDRI.la',
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,6 +48,6 @@ trait ldap
|
|||||||
|
|
||||||
FileSystem::replaceFileLineContainsString(BUILD_LIB_PATH . '/pkgconfig/ldap.pc', 'Libs: -L${libdir} -lldap', 'Libs: -L${libdir} -lldap -llber');
|
FileSystem::replaceFileLineContainsString(BUILD_LIB_PATH . '/pkgconfig/ldap.pc', 'Libs: -L${libdir} -lldap', 'Libs: -L${libdir} -lldap -llber');
|
||||||
$this->patchPkgconfPrefix(['ldap.pc', 'lber.pc']);
|
$this->patchPkgconfPrefix(['ldap.pc', 'lber.pc']);
|
||||||
$this->patchLaDependencyPrefix(['libldap.la', 'liblber.la']);
|
$this->patchLaDependencyPrefix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,6 +23,5 @@ trait libavif
|
|||||||
->build();
|
->build();
|
||||||
// patch pkgconfig
|
// patch pkgconfig
|
||||||
$this->patchPkgconfPrefix(['libavif.pc']);
|
$this->patchPkgconfPrefix(['libavif.pc']);
|
||||||
$this->cleanLaFiles();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,6 +21,6 @@ trait libiconv
|
|||||||
->exec("make -j{$this->builder->concurrency}")
|
->exec("make -j{$this->builder->concurrency}")
|
||||||
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
|
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
|
||||||
|
|
||||||
$this->patchLaDependencyPrefix(['libiconv.la']);
|
$this->patchLaDependencyPrefix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,6 +26,5 @@ trait libjpeg
|
|||||||
->build();
|
->build();
|
||||||
// patch pkgconfig
|
// patch pkgconfig
|
||||||
$this->patchPkgconfPrefix(['libjpeg.pc', 'libturbojpeg.pc']);
|
$this->patchPkgconfPrefix(['libjpeg.pc', 'libturbojpeg.pc']);
|
||||||
$this->cleanLaFiles();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,8 +24,6 @@ trait libwebp
|
|||||||
// patch pkgconfig
|
// patch pkgconfig
|
||||||
$this->patchPkgconfPrefix(['libsharpyuv.pc', 'libwebp.pc', 'libwebpdecoder.pc', 'libwebpdemux.pc', 'libwebpmux.pc'], PKGCONF_PATCH_PREFIX | PKGCONF_PATCH_LIBDIR);
|
$this->patchPkgconfPrefix(['libsharpyuv.pc', 'libwebp.pc', 'libwebpdecoder.pc', 'libwebpdemux.pc', 'libwebpmux.pc'], PKGCONF_PATCH_PREFIX | PKGCONF_PATCH_LIBDIR);
|
||||||
$this->patchPkgconfPrefix(['libsharpyuv.pc'], PKGCONF_PATCH_CUSTOM, ['/^includedir=.*$/m', 'includedir=${prefix}/include/webp']);
|
$this->patchPkgconfPrefix(['libsharpyuv.pc'], PKGCONF_PATCH_CUSTOM, ['/^includedir=.*$/m', 'includedir=${prefix}/include/webp']);
|
||||||
$this->cleanLaFiles();
|
|
||||||
// fix imagemagick binary linking issue
|
|
||||||
$this->patchPkgconfPrefix(['libwebp.pc'], PKGCONF_PATCH_CUSTOM, ['/-lwebp$/m', '-lwebp -lsharpyuv']);
|
$this->patchPkgconfPrefix(['libwebp.pc'], PKGCONF_PATCH_CUSTOM, ['/-lwebp$/m', '-lwebp -lsharpyuv']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,8 +47,8 @@ trait libxslt
|
|||||||
->exec('make clean')
|
->exec('make clean')
|
||||||
->exec("make -j{$this->builder->concurrency}")
|
->exec("make -j{$this->builder->concurrency}")
|
||||||
->exec('make install DESTDIR=' . escapeshellarg(BUILD_ROOT_PATH));
|
->exec('make install DESTDIR=' . escapeshellarg(BUILD_ROOT_PATH));
|
||||||
$this->patchPkgconfPrefix(['libexslt.pc']);
|
$this->patchPkgconfPrefix(['libxslt.pc', 'libexslt.pc']);
|
||||||
$this->patchLaDependencyPrefix(['libxslt.la', 'libexslt.la']);
|
$this->patchLaDependencyPrefix();
|
||||||
shell()->cd(BUILD_LIB_PATH)
|
shell()->cd(BUILD_LIB_PATH)
|
||||||
->exec("ar -t libxslt.a | grep '\\.a$' | xargs -n1 ar d libxslt.a")
|
->exec("ar -t libxslt.a | grep '\\.a$' | xargs -n1 ar d libxslt.a")
|
||||||
->exec("ar -t libexslt.a | grep '\\.a$' | xargs -n1 ar d libexslt.a");
|
->exec("ar -t libexslt.a | grep '\\.a$' | xargs -n1 ar d libexslt.a");
|
||||||
|
|||||||
@ -54,6 +54,6 @@ trait nghttp2
|
|||||||
->exec("make -j{$this->builder->concurrency}")
|
->exec("make -j{$this->builder->concurrency}")
|
||||||
->exec("make install DESTDIR={$destdir}");
|
->exec("make install DESTDIR={$destdir}");
|
||||||
$this->patchPkgconfPrefix(['libnghttp2.pc']);
|
$this->patchPkgconfPrefix(['libnghttp2.pc']);
|
||||||
$this->patchLaDependencyPrefix(['libnghttp2.la']);
|
$this->patchLaDependencyPrefix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,6 +28,6 @@ trait nghttp3
|
|||||||
->exec("make -j{$this->builder->concurrency}")
|
->exec("make -j{$this->builder->concurrency}")
|
||||||
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
|
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
|
||||||
$this->patchPkgconfPrefix(['libnghttp3.pc']);
|
$this->patchPkgconfPrefix(['libnghttp3.pc']);
|
||||||
$this->patchLaDependencyPrefix(['libnghttp3.la']);
|
$this->patchLaDependencyPrefix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,7 +44,7 @@ trait ngtcp2
|
|||||||
->exec("make -j{$this->builder->concurrency}")
|
->exec("make -j{$this->builder->concurrency}")
|
||||||
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
|
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
|
||||||
$this->patchPkgconfPrefix(['libngtcp2.pc', 'libngtcp2_crypto_ossl.pc']);
|
$this->patchPkgconfPrefix(['libngtcp2.pc', 'libngtcp2_crypto_ossl.pc']);
|
||||||
$this->patchLaDependencyPrefix(['libngtcp2.la', 'libngtcp2_crypto_ossl.la']);
|
$this->patchLaDependencyPrefix();
|
||||||
|
|
||||||
// on macOS, the static library may contain other static libraries?
|
// on macOS, the static library may contain other static libraries?
|
||||||
// ld: archive member 'libssl.a' not a mach-o file in libngtcp2_crypto_ossl.a
|
// ld: archive member 'libssl.a' not a mach-o file in libngtcp2_crypto_ossl.a
|
||||||
|
|||||||
@ -31,6 +31,6 @@ trait unixodbc
|
|||||||
->exec("make -j{$this->builder->concurrency}")
|
->exec("make -j{$this->builder->concurrency}")
|
||||||
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
|
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
|
||||||
$this->patchPkgconfPrefix(['odbc.pc', 'odbccr.pc', 'odbcinst.pc']);
|
$this->patchPkgconfPrefix(['odbc.pc', 'odbccr.pc', 'odbcinst.pc']);
|
||||||
$this->cleanLaFiles();
|
$this->patchLaDependencyPrefix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,6 +30,6 @@ trait xz
|
|||||||
->exec("make -j{$this->builder->concurrency}")
|
->exec("make -j{$this->builder->concurrency}")
|
||||||
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
|
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
|
||||||
$this->patchPkgconfPrefix(['liblzma.pc']);
|
$this->patchPkgconfPrefix(['liblzma.pc']);
|
||||||
$this->patchLaDependencyPrefix(['liblzma.la']);
|
$this->patchLaDependencyPrefix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user