Skip to content

Commit

Permalink
Merge pull request #311 from jingjingxyk/experiment-webui
Browse files Browse the repository at this point in the history
启用libavif 设置为可选
  • Loading branch information
jingjingxyk authored Jul 31, 2023
2 parents 3d729a7 + 265466e commit 2dd4f87
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linux-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
# composer update --no-dev --optimize-autoloader
composer update --optimize-autoloader
php prepare.php +inotify +apcu +ds +xlswriter +ssh2 +pgsql +pdo_pgsql --with-swoole-pgsql=1 ${{ inputs.build_type }} ${{ inputs.build_options }} --with-install-library-cached=1
php prepare.php +inotify +apcu +ds +xlswriter +ssh2 +pgsql +pdo_pgsql --with-swoole-pgsql=1 ${{ inputs.build_type }} ${{ inputs.build_options }} --with-install-library-cached=1 --with-libavif=1
chmod a+x make.sh
head -n 20 make.sh
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
# composer update --no-dev --optimize-autoloader
composer update --optimize-autoloader
php prepare.php --without-docker=1 +ds +apcu +xlswriter +ssh2 +pgsql +pdo_pgsql --with-build-type=release --with-swoole-pgsql=1 --with-install-library-cached=1
php prepare.php --without-docker=1 +ds +apcu +xlswriter +ssh2 +pgsql +pdo_pgsql --with-build-type=release --with-swoole-pgsql=1 --with-install-library-cached=1 --with-libavif=1
- name: Cache all-library
uses: actions/cache@v3
Expand Down
8 changes: 8 additions & 0 deletions docs/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,11 @@ with-override-default-enabled-ext
```shell
php ./prepare.php +uuid --with-override-default-enabled-ext=1 --with-build-type=dev
```

with-libavif
---
GD 库支持 AVIF 图片

```shell
php ./prepare.php --with-libavif=1
```
19 changes: 13 additions & 6 deletions sapi/src/builder/extension/gd.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,17 @@
use SwooleCli\Extension;

return function (Preprocessor $p) {
$p->addExtension(
(new Extension('gd'))
->withHomePage('https://www.php.net/manual/zh/book.image.php')
->withOptions('--enable-gd --with-jpeg --with-freetype --with-webp --with-avif ')
->withDependentLibraries('libjpeg', 'freetype', 'libwebp', 'libpng', 'libgif', 'libavif')
);
$options = '--enable-gd --with-jpeg --with-freetype --with-webp ';
$depends = ['libjpeg', 'freetype', 'libwebp', 'libpng', 'libgif'];

if ($p->getInputOption('with-libavif')) {
$options .= ' --with-avif ';
$depends[] = 'libavif';
}

$ext = (new Extension('gd'))
->withHomePage('https://www.php.net/manual/zh/book.image.php')
->withOptions($options);
call_user_func_array([$ext, 'withDependentLibraries'], $depends);
$p->addExtension($ext);
};

0 comments on commit 2dd4f87

Please sign in to comment.