mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-07 08:45:40 +08:00
add imagemagick (imagick) for macos, pkg-config for unix.=
This commit is contained in:
@@ -4,6 +4,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\unix\library;
|
||||
|
||||
use SPC\store\FileSystem;
|
||||
|
||||
trait freetype
|
||||
{
|
||||
protected function build()
|
||||
@@ -25,5 +27,13 @@ trait freetype
|
||||
->exec("make -j{$this->builder->concurrency}")
|
||||
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
|
||||
$this->patchPkgconfPrefix(['freetype2.pc']);
|
||||
FileSystem::replaceFile(
|
||||
BUILD_ROOT_PATH . '/lib/pkgconfig/freetype2.pc',
|
||||
REPLACE_FILE_STR,
|
||||
' -L/lib ',
|
||||
' -L' . BUILD_ROOT_PATH . '/lib '
|
||||
);
|
||||
|
||||
$this->cleanLaFiles();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,5 +24,6 @@ trait libavif
|
||||
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
|
||||
// patch pkgconfig
|
||||
$this->patchPkgconfPrefix(['libavif.pc']);
|
||||
$this->cleanLaFiles();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,5 +24,6 @@ trait libjpeg
|
||||
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
|
||||
// patch pkgconfig
|
||||
$this->patchPkgconfPrefix(['libjpeg.pc', 'libturbojpeg.pc']);
|
||||
$this->cleanLaFiles();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,5 +28,6 @@ trait libwebp
|
||||
->exec("make -j{$this->builder->concurrency}")
|
||||
->exec('make install DESTDIR=' . $destdir);
|
||||
$this->patchPkgconfPrefix(['libsharpyuv.pc', 'libwebp.pc', 'libwebpdecoder.pc', 'libwebpdemux.pc', 'libwebpmux.pc'], PKGCONF_PATCH_PREFIX);
|
||||
$this->cleanLaFiles();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,8 @@ trait libzip
|
||||
$extra .= $this->builder->getLib('bzip2') ? '-DENABLE_BZIP2=ON ' : '-DENABLE_BZIP2=OFF ';
|
||||
// lib:xz
|
||||
$extra .= $this->builder->getLib('xz') ? '-DENABLE_LZMA=ON ' : '-DENABLE_LZMA=OFF ';
|
||||
// lib:zstd
|
||||
$extra .= $this->builder->getLib('zstd') ? '-DENABLE_ZSTD=ON ' : '-DENABLE_ZSTD=OFF ';
|
||||
// lib:zstd (disabled due to imagemagick link issue
|
||||
$extra .= /* $this->builder->getLib('zstd') ? '-DENABLE_ZSTD=ON ' : */ '-DENABLE_ZSTD=OFF ';
|
||||
// lib:openssl
|
||||
$extra .= $this->builder->getLib('openssl') ? '-DENABLE_OPENSSL=ON ' : '-DENABLE_OPENSSL=OFF ';
|
||||
|
||||
|
||||
43
src/SPC/builder/unix/library/pkgconfig.php
Normal file
43
src/SPC/builder/unix/library/pkgconfig.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\unix\library;
|
||||
|
||||
trait pkgconfig
|
||||
{
|
||||
protected function build()
|
||||
{
|
||||
$macos_env = 'PKG_CONFIG_PATH="' . BUILD_LIB_PATH . '/pkgconfig/" ' .
|
||||
"CC='{$this->builder->cc}' " .
|
||||
"CXX='{$this->builder->cxx}' " .
|
||||
"CFLAGS='{$this->builder->arch_c_flags} -Wimplicit-function-declaration' ";
|
||||
$linux_env = 'PKG_CONFIG_PATH="' . BUILD_LIB_PATH . '/pkgconfig" ' .
|
||||
"CC='{$this->builder->cc}' " .
|
||||
"CXX='{$this->builder->cxx}' ";
|
||||
|
||||
$extra = match (PHP_OS_FAMILY) {
|
||||
'Darwin' => '',
|
||||
default => '--with-internal-glib ',
|
||||
};
|
||||
shell()->cd($this->source_dir)
|
||||
->exec(
|
||||
match (PHP_OS_FAMILY) {
|
||||
'Darwin' => $macos_env,
|
||||
default => $linux_env,
|
||||
} .
|
||||
'./configure ' .
|
||||
'--disable-shared ' .
|
||||
'--enable-static ' .
|
||||
$extra .
|
||||
'--prefix=' . BUILD_ROOT_PATH . ' ' .
|
||||
'--without-sysroot ' .
|
||||
'--without-system-include-path ' .
|
||||
'--without-system-library-path ' .
|
||||
'--without-pc-path'
|
||||
)
|
||||
->exec('make clean')
|
||||
->exec("make -j{$this->builder->concurrency}")
|
||||
->exec('make install');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user