mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-17 20:34:51 +08:00
Add libtiff support (#361)
* add libtiff support * fix command option not working on *nix * fix test with libs ext test
This commit is contained in:
parent
b46655ecfe
commit
9664709f21
@ -147,7 +147,8 @@
|
|||||||
"libpng",
|
"libpng",
|
||||||
"libjpeg",
|
"libjpeg",
|
||||||
"libwebp",
|
"libwebp",
|
||||||
"freetype"
|
"freetype",
|
||||||
|
"libtiff"
|
||||||
],
|
],
|
||||||
"lib-suggests": [
|
"lib-suggests": [
|
||||||
"zstd",
|
"zstd",
|
||||||
@ -330,6 +331,12 @@
|
|||||||
"zlib"
|
"zlib"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"libtiff": {
|
||||||
|
"source": "libtiff",
|
||||||
|
"static-libs-unix": [
|
||||||
|
"libtiff.a"
|
||||||
|
]
|
||||||
|
},
|
||||||
"libuv": {
|
"libuv": {
|
||||||
"source": "libuv",
|
"source": "libuv",
|
||||||
"static-libs-unix": [
|
"static-libs-unix": [
|
||||||
|
|||||||
@ -325,6 +325,15 @@
|
|||||||
"path": "COPYING"
|
"path": "COPYING"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"libtiff": {
|
||||||
|
"type": "filelist",
|
||||||
|
"url": "https://download.osgeo.org/libtiff/",
|
||||||
|
"regex": "/href=\"(?<file>tiff-(?<version>[^\"]+)\\.tar\\.xz)\"/",
|
||||||
|
"license": {
|
||||||
|
"type": "file",
|
||||||
|
"path": "LICENSE.md"
|
||||||
|
}
|
||||||
|
},
|
||||||
"libuv": {
|
"libuv": {
|
||||||
"type": "ghtar",
|
"type": "ghtar",
|
||||||
"repo": "libuv/libuv",
|
"repo": "libuv/libuv",
|
||||||
|
|||||||
12
src/SPC/builder/linux/library/libtiff.php
Normal file
12
src/SPC/builder/linux/library/libtiff.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\linux\library;
|
||||||
|
|
||||||
|
class libtiff extends LinuxLibraryBase
|
||||||
|
{
|
||||||
|
use \SPC\builder\unix\library\libtiff;
|
||||||
|
|
||||||
|
public const NAME = 'libtiff';
|
||||||
|
}
|
||||||
12
src/SPC/builder/macos/library/libtiff.php
Normal file
12
src/SPC/builder/macos/library/libtiff.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\macos\library;
|
||||||
|
|
||||||
|
class libtiff extends MacOSLibraryBase
|
||||||
|
{
|
||||||
|
use \SPC\builder\unix\library\libtiff;
|
||||||
|
|
||||||
|
public const NAME = 'libtiff';
|
||||||
|
}
|
||||||
30
src/SPC/builder/unix/library/libtiff.php
Normal file
30
src/SPC/builder/unix/library/libtiff.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\unix\library;
|
||||||
|
|
||||||
|
use SPC\exception\FileSystemException;
|
||||||
|
use SPC\exception\RuntimeException;
|
||||||
|
|
||||||
|
trait libtiff
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @throws FileSystemException
|
||||||
|
* @throws RuntimeException
|
||||||
|
*/
|
||||||
|
protected function build(): void
|
||||||
|
{
|
||||||
|
shell()->cd($this->source_dir)
|
||||||
|
->exec(
|
||||||
|
'./configure ' .
|
||||||
|
'--enable-static --disable-shared ' .
|
||||||
|
'--disable-cxx ' .
|
||||||
|
'--prefix='
|
||||||
|
)
|
||||||
|
->exec('make clean')
|
||||||
|
->exec("make -j{$this->builder->concurrency}")
|
||||||
|
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
|
||||||
|
$this->patchPkgconfPrefix(['libtiff-4.pc']);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -37,12 +37,8 @@ class BuildCliCommand extends BuildCommand
|
|||||||
$this->addOption('with-suggested-exts', 'E', null, 'Build with suggested extensions for selected exts');
|
$this->addOption('with-suggested-exts', 'E', null, 'Build with suggested extensions for selected exts');
|
||||||
$this->addOption('with-added-patch', 'P', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Inject patch script outside');
|
$this->addOption('with-added-patch', 'P', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Inject patch script outside');
|
||||||
$this->addOption('without-micro-ext-test', null, null, 'Disable phpmicro with extension test code');
|
$this->addOption('without-micro-ext-test', null, null, 'Disable phpmicro with extension test code');
|
||||||
|
|
||||||
$this->addOption('with-upx-pack', null, null, 'Compress / pack binary using UPX tool (linux/windows only)');
|
$this->addOption('with-upx-pack', null, null, 'Compress / pack binary using UPX tool (linux/windows only)');
|
||||||
|
$this->addOption('with-micro-logo', null, InputOption::VALUE_REQUIRED, 'Use custom .ico for micro.sfx (windows only)');
|
||||||
if (PHP_OS_FAMILY === 'Windows') {
|
|
||||||
$this->addOption('with-micro-logo', null, InputOption::VALUE_REQUIRED, 'Use custom .ico for micro.sfx');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handle(): int
|
public function handle(): int
|
||||||
|
|||||||
@ -13,13 +13,13 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
// If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
|
// If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
|
||||||
$extensions = match (PHP_OS_FAMILY) {
|
$extensions = match (PHP_OS_FAMILY) {
|
||||||
'Linux', 'Darwin' => 'pgsql,pdo_pgsql',
|
'Linux', 'Darwin' => 'imagick,zstd,bz2,zip,xml,dom',
|
||||||
'Windows' => 'mbstring,pdo_sqlite,mbregex,ffi',
|
'Windows' => 'mbstring,pdo_sqlite,mbregex,ffi',
|
||||||
};
|
};
|
||||||
|
|
||||||
// If you want to test lib-suggests feature with extension, add them below (comma separated, example `libwebp,libavif`).
|
// If you want to test lib-suggests feature with extension, add them below (comma separated, example `libwebp,libavif`).
|
||||||
$with_libs = match (PHP_OS_FAMILY) {
|
$with_libs = match (PHP_OS_FAMILY) {
|
||||||
'Linux', 'Darwin' => '',
|
'Linux', 'Darwin' => 'xz',
|
||||||
'Windows' => '',
|
'Windows' => '',
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ $with_libs = match (PHP_OS_FAMILY) {
|
|||||||
// You can use `common`, `bulk`, `minimal` or `none`.
|
// You can use `common`, `bulk`, `minimal` or `none`.
|
||||||
// note: combination is only available for *nix platform. Windows must use `none` combination
|
// note: combination is only available for *nix platform. Windows must use `none` combination
|
||||||
$base_combination = match (PHP_OS_FAMILY) {
|
$base_combination = match (PHP_OS_FAMILY) {
|
||||||
'Linux', 'Darwin' => 'common',
|
'Linux', 'Darwin' => 'minimal',
|
||||||
'Windows' => 'none',
|
'Windows' => 'none',
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -62,6 +62,7 @@ $final_libs = trim($with_libs, $trim_value);
|
|||||||
|
|
||||||
if (PHP_OS_FAMILY === 'Windows') {
|
if (PHP_OS_FAMILY === 'Windows') {
|
||||||
$final_extensions_cmd = '"' . $final_extensions . '"';
|
$final_extensions_cmd = '"' . $final_extensions . '"';
|
||||||
|
$final_libs = $final_libs === '' ? '' : ('"' . $final_libs . '"');
|
||||||
} else {
|
} else {
|
||||||
$final_extensions_cmd = $final_extensions;
|
$final_extensions_cmd = $final_extensions;
|
||||||
}
|
}
|
||||||
@ -69,7 +70,7 @@ if (PHP_OS_FAMILY === 'Windows') {
|
|||||||
echo match ($argv[1]) {
|
echo match ($argv[1]) {
|
||||||
'extensions' => $final_extensions,
|
'extensions' => $final_extensions,
|
||||||
'libs' => $final_libs,
|
'libs' => $final_libs,
|
||||||
'libs_cmd' => ($final_libs === '' ? '' : (' --with-libs="' . $final_libs . '"')),
|
'libs_cmd' => ($final_libs === '' ? '' : (' --with-libs=' . $final_libs)),
|
||||||
'cmd' => $final_extensions_cmd . ($final_libs === '' ? '' : (' --with-libs="' . $final_libs . '"')),
|
'cmd' => $final_extensions_cmd . ($final_libs === '' ? '' : (' --with-libs=' . $final_libs)),
|
||||||
default => '',
|
default => '',
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user