mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
simplify libpng compilation
This commit is contained in:
parent
e84a246dd2
commit
d40f2cafec
@ -20,36 +20,14 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace SPC\builder\linux\library;
|
namespace SPC\builder\linux\library;
|
||||||
|
|
||||||
use SPC\builder\linux\SystemUtil;
|
|
||||||
use SPC\exception\FileSystemException;
|
use SPC\exception\FileSystemException;
|
||||||
use SPC\exception\RuntimeException;
|
use SPC\exception\RuntimeException;
|
||||||
use SPC\exception\WrongUsageException;
|
use SPC\exception\WrongUsageException;
|
||||||
use SPC\store\FileSystem;
|
|
||||||
|
|
||||||
class libpng extends LinuxLibraryBase
|
class libpng extends LinuxLibraryBase
|
||||||
{
|
{
|
||||||
public const NAME = 'libpng';
|
public const NAME = 'libpng';
|
||||||
|
|
||||||
/**
|
|
||||||
* @throws FileSystemException
|
|
||||||
*/
|
|
||||||
public function patchBeforeBuild(): bool
|
|
||||||
{
|
|
||||||
FileSystem::replaceFileStr(
|
|
||||||
SOURCE_PATH . '/libpng/configure',
|
|
||||||
'-lz',
|
|
||||||
BUILD_LIB_PATH . '/libz.a'
|
|
||||||
);
|
|
||||||
if (SystemUtil::getOSRelease()['dist'] === 'alpine') {
|
|
||||||
FileSystem::replaceFileStr(
|
|
||||||
SOURCE_PATH . '/libpng/configure',
|
|
||||||
'-lm',
|
|
||||||
'/usr/lib/libm.a'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws FileSystemException
|
* @throws FileSystemException
|
||||||
* @throws RuntimeException
|
* @throws RuntimeException
|
||||||
@ -66,6 +44,7 @@ class libpng extends LinuxLibraryBase
|
|||||||
->exec('chmod +x ./configure')
|
->exec('chmod +x ./configure')
|
||||||
->exec('chmod +x ./install-sh')
|
->exec('chmod +x ./install-sh')
|
||||||
->exec(
|
->exec(
|
||||||
|
'LDFLAGS="-L' . BUILD_LIB_PATH . '" ' .
|
||||||
'./configure ' .
|
'./configure ' .
|
||||||
'--disable-shared ' .
|
'--disable-shared ' .
|
||||||
'--enable-static ' .
|
'--enable-static ' .
|
||||||
@ -75,7 +54,7 @@ class libpng extends LinuxLibraryBase
|
|||||||
'--prefix='
|
'--prefix='
|
||||||
)
|
)
|
||||||
->exec('make clean')
|
->exec('make clean')
|
||||||
->exec("make -j{$this->builder->concurrency} DEFAULT_INCLUDES='-I. -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->cleanLaFiles();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user