mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +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 install-libLTLIBRARIES install-data-am DESTDIR=' . BUILD_ROOT_PATH);
|
||||
$this->patchPkgconfPrefix(['libpng16.pc'], PKGCONF_PATCH_PREFIX);
|
||||
$this->cleanLaFiles();
|
||||
$this->patchLaDependencyPrefix();
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,7 +59,6 @@ class libpng extends MacOSLibraryBase
|
||||
->cd(BUILD_LIB_PATH)
|
||||
->exec('ln -sf libpng16.a libpng.a');
|
||||
$this->patchPkgconfPrefix(['libpng16.pc'], PKGCONF_PATCH_PREFIX);
|
||||
$this->patchLaDependencyPrefix(['libpng16.la']);
|
||||
$this->cleanLaFiles();
|
||||
$this->patchLaDependencyPrefix();
|
||||
}
|
||||
}
|
||||
|
||||
@ -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');
|
||||
$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) {
|
||||
$realpath = realpath(BUILD_LIB_PATH . '/' . $name);
|
||||
if ($realpath === false) {
|
||||
throw new RuntimeException('Cannot find library [' . static::NAME . '] la file [' . $name . '] !');
|
||||
if ($throwOnMissing) {
|
||||
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);
|
||||
// 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
|
||||
{
|
||||
$env = getenv($this->getSnakeCaseName() . '_CFLAGS') ?: '';
|
||||
|
||||
@ -38,7 +38,5 @@ trait freetype
|
||||
' -L/lib ',
|
||||
' -L' . BUILD_ROOT_PATH . '/lib '
|
||||
);
|
||||
|
||||
$this->cleanLaFiles();
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,6 +34,6 @@ trait gettext
|
||||
->exec('make clean')
|
||||
->exec("make -j{$this->builder->concurrency}")
|
||||
->exec('make install');
|
||||
$this->patchLaDependencyPrefix(['libintl.la']);
|
||||
$this->patchLaDependencyPrefix();
|
||||
}
|
||||
}
|
||||
|
||||
@ -78,10 +78,6 @@ trait imagemagick
|
||||
'includearchdir=${prefix}/include/ImageMagick-7'
|
||||
);
|
||||
}
|
||||
$this->patchLaDependencyPrefix([
|
||||
'libMagick++-7.Q16HDRI.la',
|
||||
'libMagickCore-7.Q16HDRI.la',
|
||||
'libMagickWand-7.Q16HDRI.la',
|
||||
]);
|
||||
$this->patchLaDependencyPrefix();
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,6 +48,6 @@ trait ldap
|
||||
|
||||
FileSystem::replaceFileLineContainsString(BUILD_LIB_PATH . '/pkgconfig/ldap.pc', 'Libs: -L${libdir} -lldap', 'Libs: -L${libdir} -lldap -llber');
|
||||
$this->patchPkgconfPrefix(['ldap.pc', 'lber.pc']);
|
||||
$this->patchLaDependencyPrefix(['libldap.la', 'liblber.la']);
|
||||
$this->patchLaDependencyPrefix();
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,6 +23,5 @@ trait libavif
|
||||
->build();
|
||||
// patch pkgconfig
|
||||
$this->patchPkgconfPrefix(['libavif.pc']);
|
||||
$this->cleanLaFiles();
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,6 +21,6 @@ trait libiconv
|
||||
->exec("make -j{$this->builder->concurrency}")
|
||||
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
|
||||
|
||||
$this->patchLaDependencyPrefix(['libiconv.la']);
|
||||
$this->patchLaDependencyPrefix();
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,6 +26,5 @@ trait libjpeg
|
||||
->build();
|
||||
// patch pkgconfig
|
||||
$this->patchPkgconfPrefix(['libjpeg.pc', 'libturbojpeg.pc']);
|
||||
$this->cleanLaFiles();
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,8 +24,6 @@ trait libwebp
|
||||
// patch pkgconfig
|
||||
$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->cleanLaFiles();
|
||||
// fix imagemagick binary linking issue
|
||||
$this->patchPkgconfPrefix(['libwebp.pc'], PKGCONF_PATCH_CUSTOM, ['/-lwebp$/m', '-lwebp -lsharpyuv']);
|
||||
}
|
||||
}
|
||||
|
||||
@ -47,8 +47,8 @@ trait libxslt
|
||||
->exec('make clean')
|
||||
->exec("make -j{$this->builder->concurrency}")
|
||||
->exec('make install DESTDIR=' . escapeshellarg(BUILD_ROOT_PATH));
|
||||
$this->patchPkgconfPrefix(['libexslt.pc']);
|
||||
$this->patchLaDependencyPrefix(['libxslt.la', 'libexslt.la']);
|
||||
$this->patchPkgconfPrefix(['libxslt.pc', 'libexslt.pc']);
|
||||
$this->patchLaDependencyPrefix();
|
||||
shell()->cd(BUILD_LIB_PATH)
|
||||
->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");
|
||||
|
||||
@ -54,6 +54,6 @@ trait nghttp2
|
||||
->exec("make -j{$this->builder->concurrency}")
|
||||
->exec("make install DESTDIR={$destdir}");
|
||||
$this->patchPkgconfPrefix(['libnghttp2.pc']);
|
||||
$this->patchLaDependencyPrefix(['libnghttp2.la']);
|
||||
$this->patchLaDependencyPrefix();
|
||||
}
|
||||
}
|
||||
|
||||
@ -28,6 +28,6 @@ trait nghttp3
|
||||
->exec("make -j{$this->builder->concurrency}")
|
||||
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
|
||||
$this->patchPkgconfPrefix(['libnghttp3.pc']);
|
||||
$this->patchLaDependencyPrefix(['libnghttp3.la']);
|
||||
$this->patchLaDependencyPrefix();
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ trait ngtcp2
|
||||
->exec("make -j{$this->builder->concurrency}")
|
||||
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
|
||||
$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?
|
||||
// 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 install DESTDIR=' . BUILD_ROOT_PATH);
|
||||
$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 install DESTDIR=' . BUILD_ROOT_PATH);
|
||||
$this->patchPkgconfPrefix(['liblzma.pc']);
|
||||
$this->patchLaDependencyPrefix(['liblzma.la']);
|
||||
$this->patchLaDependencyPrefix();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user