From 36b4ef306e7236cd3e65fa442e463bbe23aa36c9 Mon Sep 17 00:00:00 2001 From: Jerry Ma Date: Sat, 25 Jan 2025 17:15:53 +0900 Subject: [PATCH] Fix libtiff dependencies, avoid using system libraries (#588) * Remove tmate debugger * Bump version to 2.4.4 * Fix libtiff dependencies may wrongly added * Add matrix tests * Add tmate debug * Disable libdeflate for libtiff * Remove ssh debugger --- .github/workflows/build-unix.yml | 6 +++--- config/lib.json | 4 ++++ src/SPC/ConsoleApplication.php | 2 +- src/SPC/builder/unix/library/libtiff.php | 8 ++++++++ src/globals/test-extensions.php | 7 ++----- 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-unix.yml b/.github/workflows/build-unix.yml index 97fd4f43..a621baee 100644 --- a/.github/workflows/build-unix.yml +++ b/.github/workflows/build-unix.yml @@ -147,9 +147,9 @@ jobs: run: ${{ needs.define-build.outputs.download }} - name: "Build PHP" run: ${{ needs.define-build.outputs.build }} - - name: Setup tmate session - if: ${{ failure() }} - uses: mxschmitt/action-tmate@v3 + #- name: Setup tmate session + # if: ${{ failure() }} + # uses: mxschmitt/action-tmate@v3 # Upload cli executable - if: ${{ inputs.build-cli == true }} diff --git a/config/lib.json b/config/lib.json index 69f92737..43b2a3da 100644 --- a/config/lib.json +++ b/config/lib.json @@ -425,6 +425,10 @@ "source": "libtiff", "static-libs-unix": [ "libtiff.a" + ], + "lib-depends": [ + "zlib", + "libjpeg" ] }, "libuuid": { diff --git a/src/SPC/ConsoleApplication.php b/src/SPC/ConsoleApplication.php index 5ab8beca..2609d317 100644 --- a/src/SPC/ConsoleApplication.php +++ b/src/SPC/ConsoleApplication.php @@ -31,7 +31,7 @@ use Symfony\Component\Console\Application; */ final class ConsoleApplication extends Application { - public const VERSION = '2.4.3'; + public const VERSION = '2.4.4'; public function __construct() { diff --git a/src/SPC/builder/unix/library/libtiff.php b/src/SPC/builder/unix/library/libtiff.php index 4c93acea..9adcfab6 100644 --- a/src/SPC/builder/unix/library/libtiff.php +++ b/src/SPC/builder/unix/library/libtiff.php @@ -15,10 +15,18 @@ trait libtiff */ protected function build(): void { + // zlib + $extra_libs = '--enable-zlib --with-zlib-include-dir=' . BUILD_ROOT_PATH . '/include --with-zlib-lib-dir=' . BUILD_ROOT_PATH . '/lib'; + // libjpeg + $extra_libs .= ' --enable-jpeg --disable-old-jpeg --disable-jpeg12 --with-jpeg-include-dir=' . BUILD_ROOT_PATH . '/include --with-jpeg-lib-dir=' . BUILD_ROOT_PATH . '/lib'; + // We disabled lzma, zstd, webp, libdeflate by default to reduce the size of the binary + $extra_libs .= ' --disable-lzma --disable-zstd --disable-webp --disable-libdeflate'; + $shell = shell()->cd($this->source_dir) ->exec( './configure ' . '--enable-static --disable-shared ' . + "{$extra_libs} " . '--disable-cxx ' . '--prefix=' ); diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index aacd40c5..5653620d 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -13,8 +13,6 @@ declare(strict_types=1); // test php version $test_php_version = [ - '8.1', - '8.2', '8.3', '8.4', ]; @@ -22,9 +20,8 @@ $test_php_version = [ // test os (macos-13, macos-14, ubuntu-latest, windows-latest are available) $test_os = [ 'macos-14', - // 'macos-13', + 'macos-13', 'ubuntu-latest', - 'windows-latest', ]; // whether enable thread safe @@ -40,7 +37,7 @@ $prefer_pre_built = false; // If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`). $extensions = match (PHP_OS_FAMILY) { - 'Linux', 'Darwin' => 'ast', + 'Linux', 'Darwin' => 'imagick', 'Windows' => 'ast', };