Skip to content

Commit

Permalink
simplify libpng compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
DubbleClick committed Oct 27, 2023
1 parent e84a246 commit d40f2ca
Showing 1 changed file with 2 additions and 23 deletions.
25 changes: 2 additions & 23 deletions src/SPC/builder/linux/library/libpng.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,36 +20,14 @@

namespace SPC\builder\linux\library;

use SPC\builder\linux\SystemUtil;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\store\FileSystem;

class libpng extends LinuxLibraryBase
{
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 RuntimeException
Expand All @@ -66,6 +44,7 @@ public function build(): void
->exec('chmod +x ./configure')
->exec('chmod +x ./install-sh')
->exec(
'LDFLAGS="-L' . BUILD_LIB_PATH . '" ' .
'./configure ' .
'--disable-shared ' .
'--enable-static ' .
Expand All @@ -75,7 +54,7 @@ public function build(): void
'--prefix='
)
->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);
$this->patchPkgconfPrefix(['libpng16.pc'], PKGCONF_PATCH_PREFIX);
$this->cleanLaFiles();
Expand Down

0 comments on commit d40f2ca

Please sign in to comment.