Skip to content

Commit

Permalink
optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
matyhtf committed Feb 17, 2023
1 parent b3c3ded commit d274ce0
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 44 deletions.
8 changes: 4 additions & 4 deletions conf.d/bz2.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
$p->addLibrary(
(new Library('bzip2'))
->withUrl('https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz')
->withPrefix('/usr/bzip2')
->withMakeOptions('PREFIX=/usr/bzip2')
->withMakeInstallOptions('PREFIX=/usr/bzip2')
->withPrefix(BZIP2_PREFIX)
->withMakeOptions('PREFIX=' . BZIP2_PREFIX)
->withMakeInstallOptions('PREFIX=' . BZIP2_PREFIX)
->withHomePage('https://www.sourceware.org/bzip2/')
->withLicense('https://www.sourceware.org/bzip2/', Library::LICENSE_BSD)
);
$p->addExtension((new Extension('bz2'))->withOptions('--with-bz2=/usr/bzip2')->depends('bzip2'));
$p->addExtension((new Extension('bz2'))->withOptions('--with-bz2=' . BZIP2_PREFIX)->depends('bzip2'));
};
39 changes: 19 additions & 20 deletions conf.d/gd.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
->withLicense('http://www.libpng.org/pub/png/src/libpng-LICENSE.txt', Library::LICENSE_SPEC)
->withPrefix(PNG_PREFIX)
->withConfigure(
'./configure --prefix=' . PNG_PREFIX . '--enable-static --disable-shared ' .
'--with-zlib-prefix=/usr/zlib --with-binconfigs'
'./configure --prefix=' . PNG_PREFIX . ' --enable-static --disable-shared ' .
'--with-zlib-prefix=' . ZLIB_PREFIX . ' --with-binconfigs'
)
->withPkgName('libpng16')
->depends('zlib')
Expand All @@ -40,14 +40,13 @@
(new Library('libgif'))
->withUrl('https://nchc.dl.sourceforge.net/project/giflib/giflib-5.2.1.tar.gz')
->withLicense('https://giflib.sourceforge.net/intro.html', Library::LICENSE_SPEC)
->withPrefix('libgif')
->withPrefix(GIF_PREFIX)
->withMakeOptions('libgif.a')
->withMakeInstallCommand('')
->withScriptBeforeInstall('
test -d ' . GIF_PREFIX . ' && rm -rf /usr/libgif/
mkdir -p ' . GIF_PREFIX . '/lib
mkdir -p ' . GIF_PREFIX . '/include
')
->withScriptBeforeInstall('test -d ' . GIF_PREFIX . ' && rm -rf ' . GIF_PREFIX .
'mkdir -p ' . GIF_PREFIX . '/lib
mkdir -p ' . GIF_PREFIX . '/include'
)
->withScriptAfterInstall('cp libgif.a ' . GIF_PREFIX . '/lib && cp gif_lib.h ' . GIF_PREFIX . '/include')
->withLdflags('-L' . GIF_PREFIX . '/lib')
->withPkgName('')
Expand All @@ -60,7 +59,7 @@
->withHomePage('https://github.com/webmproject/libwebp')
->withLicense('https://github.com/webmproject/libwebp/blob/main/COPYING', Library::LICENSE_SPEC)
->withPrefix(WEBP_PREFIX)
->withConfigure('./autogen.sh && ./configure --prefix=' . PNG_PREFIX . ' --enable-static --disable-shared' .
->withConfigure('./autogen.sh && ./configure --prefix=' . WEBP_PREFIX . ' --enable-static --disable-shared ' .
'--enable-libwebpdecoder ' .
'--enable-libwebpextras ' .
'--with-pngincludedir=' . PNG_PREFIX . '/include ' .
Expand All @@ -78,17 +77,17 @@
->withPrefix(FREETYPE_PREFIX)
->withUrl('https://download.savannah.gnu.org/releases/freetype/freetype-2.10.4.tar.gz')
->withLicense('https://gitlab.freedesktop.org/freetype/freetype/-/blob/master/docs/FTL.TXT', Library::LICENSE_SPEC)
->withConfigure(
'export BZIP2_CFLAGS=-I/usr/bzip2/include \ ' . PHP_EOL .
'export BZIP2_LIBS=-L/usr/bzip2/lib -lbz2 \ ' . PHP_EOL .
'./configure --prefix=' . FREETYPE_PREFIX . ' \ ' . PHP_EOL .
'--enable-static \ ' . PHP_EOL .
'--disable-shared \ ' . PHP_EOL .
'--with-zlib=yes \ ' . PHP_EOL .
'--with-bzip2=yes \ ' . PHP_EOL .
'--with-png=yes \ ' . PHP_EOL .
'--with-harfbuzz=no \ ' . PHP_EOL .
'--with-brotli=no \ ' . PHP_EOL
->withConfigure('BZIP2_CFLAGS="-I/usr/bzip2/include" & \\' .
'BZIP2_LIBS="-L/usr/bzip2/lib -lbz2" & \\' .
'PATH="' . PNG_PREFIX .'/bin:$PATH" & \\' .
'./configure --prefix=' . FREETYPE_PREFIX . ' \\' . PHP_EOL .
'--enable-static \\' . PHP_EOL .
'--disable-shared \\' . PHP_EOL .
'--with-zlib=yes \\' . PHP_EOL .
'--with-bzip2=yes \\' . PHP_EOL .
'--with-png=yes \\' . PHP_EOL .
'--with-harfbuzz=no \\' . PHP_EOL .
'--with-brotli=no' . PHP_EOL
)
->withHomePage('https://freetype.org/')
->withPkgName('freetype2')
Expand Down
6 changes: 3 additions & 3 deletions conf.d/gmp.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
$p->addLibrary(
(new Library('gmp'))
->withUrl('https://gmplib.org/download/gmp/gmp-6.2.1.tar.lz')
->withPrefix('/usr/gmp')
->withConfigure('./configure --prefix=/usr/gmp --enable-static --disable-shared')
->withPrefix(GMP_PREFIX)
->withConfigure('./configure --prefix=' . GMP_PREFIX . ' --enable-static --disable-shared')
->withLicense('https://www.gnu.org/licenses/old-licenses/gpl-2.0.html', Library::LICENSE_GPL)
->withPkgName('gmp')
);
$p->addExtension((new Extension('gmp'))->withOptions('--with-gmp=/usr/gmp')->depends('gmp'));
$p->addExtension((new Extension('gmp'))->withOptions('--with-gmp='. GMP_PREFIX)->depends('gmp'));
};
6 changes: 3 additions & 3 deletions conf.d/iconv.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
$p->addLibrary(
(new Library('libiconv'))
->withUrl('https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz')
->withPrefix('/usr/libiconv')
->withPrefix(ICONV_PREFIX)
->withPkgConfig('')
->withConfigure('./configure --prefix=/usr/libiconv enable_static=yes enable_shared=no')
->withConfigure('./configure --prefix=' . ICONV_PREFIX . ' enable_static=yes enable_shared=no')
->withLicense('https://www.gnu.org/licenses/old-licenses/gpl-2.0.html', Library::LICENSE_GPL)
);
$p->addExtension((new Extension('iconv'))->withOptions('--with-iconv=/usr/libiconv'));
$p->addExtension((new Extension('iconv'))->withOptions('--with-iconv=' . ICONV_PREFIX));
};
9 changes: 5 additions & 4 deletions conf.d/imagick.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
use SwooleCli\Extension;

return function (Preprocessor $p) {
$imagemagick_prefix = IMAGEMAGICK_PREFIX;
$p->addLibrary(
(new Library('imagemagick' ))
(new Library('imagemagick'))
->withUrl('https://github.com/ImageMagick/ImageMagick/archive/refs/tags/7.1.0-62.tar.gz')
->withPrefix('/usr/imagemagick')
->withPrefix(IMAGEMAGICK_PREFIX)
->withConfigure(<<<EOF
./configure \
--prefix=/usr/imagemagick \
--prefix={$imagemagick_prefix} \
--enable-static\
--disable-shared \
--with-zip=yes \
Expand All @@ -34,7 +35,7 @@
->depends('libxml2', 'zip', 'zlib', 'libjpeg', 'freetype', 'libwebp', 'libpng', 'libgif')
);
$p->addExtension((new Extension('imagick'))
->withOptions('--with-imagick=/usr/imagemagick')
->withOptions('--with-imagick=' . IMAGEMAGICK_PREFIX)
->withPeclVersion('3.6.0')
->withHomePage('https://github.com/Imagick/imagick')
->withLicense('https://github.com/Imagick/imagick/blob/master/LICENSE', Extension::LICENSE_PHP)
Expand Down
15 changes: 7 additions & 8 deletions conf.d/zip.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use SwooleCli\Extension;

return function (Preprocessor $p) {
// MUST be in the /usr directory
$p->addLibrary(
(new Library('zip'))
->withUrl('https://libzip.org/download/libzip-1.8.0.tar.gz')
Expand All @@ -22,14 +21,14 @@
-DENABLE_MBEDTLS=OFF \
-DENABLE_OPENSSL=ON \
-DOPENSSL_USE_STATIC_LIBS=TRUE \
-DOPENSSL_LIBRARIES=/usr/openssl/lib \
-DOPENSSL_INCLUDE_DIR=/usr/openssl/include \
-DZLIB_LIBRARY=/usr/zlib/lib \
-DZLIB_INCLUDE_DIR=/usr/zlib/include \
-DOPENSSL_LIBRARIES=' . OPENSSL_PREFIX . '/lib \
-DOPENSSL_INCLUDE_DIR=' . OPENSSL_PREFIX . '/include \
-DZLIB_LIBRARY=' . ZLIB_PREFIX . '/lib \
-DZLIB_INCLUDE_DIR=' . ZLIB_PREFIX . '/include \
-DENABLE_BZIP2=ON \
-DBZIP2_LIBRARIES=/usr/bzip2/lib \
-DBZIP2_LIBRARY=/usr/bzip2/lib \
-DBZIP2_INCLUDE_DIR=/usr/bzip2/include \
-DBZIP2_LIBRARIES=' . BZIP2_PREFIX . '/lib \
-DBZIP2_LIBRARY=' . BZIP2_PREFIX . '/lib \
-DBZIP2_INCLUDE_DIR=' . BZIP2_PREFIX . '/include \
-DBZIP2_NEED_PREFIX=ON \
-DENABLE_LZMA=OFF \
-DENABLE_ZSTD=OFF
Expand Down
4 changes: 2 additions & 2 deletions conf.d/zlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
$p->addLibrary(
(new Library('zlib'))
->withUrl('https://udomain.dl.sourceforge.net/project/libpng/zlib/1.2.11/zlib-1.2.11.tar.gz')
->withPrefix('/usr/zlib')
->withConfigure('./configure --prefix=/usr/zlib --static')
->withPrefix(ZLIB_PREFIX)
->withConfigure('./configure --prefix=' . ZLIB_PREFIX . ' --static')
->withHomePage('https://zlib.net/')
->withLicense('https://zlib.net/zlib_license.html', Library::LICENSE_SPEC)
->withPkgName('zlib')
Expand Down
6 changes: 6 additions & 0 deletions sapi/constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@
const CURL_PREFIX = '/usr/curl';
const CARES_PREFIX = '/usr/cares';
const OPENSSL_PREFIX = '/usr/openssl';
const ZLIB_PREFIX = '/usr/zlib';
const BZIP2_PREFIX = '/usr/bzip2';
const GMP_PREFIX = '/usr/gmp';
const ICONV_PREFIX = '/usr/libiconv';
const IMAGEMAGICK_PREFIX = '/usr/imagemagick';
const OPENSSL_PREFIX = '/usr/openssl';

0 comments on commit d274ce0

Please sign in to comment.