add freetype support for gd

This commit is contained in:
crazywhalecc 2023-03-18 21:40:07 +08:00
parent 9ce92e39d5
commit 3daafa0b0e
No known key found for this signature in database
GPG Key ID: 1F4BDD59391F2680
5 changed files with 64 additions and 2 deletions

View File

@ -75,11 +75,11 @@
"libwebp",
"libjpeg",
"xpm",
"libfreetype"
"freetype"
],
"lib-depends-windows": [
"libiconv",
"libfreetype",
"freetype",
"libjpeg",
"zlib",
"libpng",

View File

@ -215,6 +215,16 @@
"libmcrypt.a"
]
},
"freetype": {
"source": "freetype",
"static-libs-unix": [
"libfreetype.a"
],
"headers-unix": [
"freetype2/freetype/freetype.h",
"freetype2/ft2build.h"
]
},
"nghttp2": {
"source": "nghttp2",
"static-libs-unix": [

View File

@ -35,6 +35,15 @@
"path": "LICENSE"
}
},
"freetype": {
"type": "filelist",
"url": "https://download.savannah.gnu.org/releases/freetype/",
"regex": "/href=\"(?<file>freetype-(?<version>[^\"]+)\\.tar\\.xz)\"/",
"license": {
"type": "file",
"path": "LICENSE.TXT"
}
},
"gmp": {
"type": "filelist",
"url": "https://gmplib.org/download/gmp/",

View File

@ -216,6 +216,11 @@ class Extension
'CURL_LIBS="' . $this->getLibFilesString() . '" ';
break;
case 'gd':
if ($this->builder->getLib('freetype')) {
$arg .= ' --with-freetype ' .
'FREETYPE2_CFLAGS=-I"' . BUILD_INCLUDE_PATH . '/freetype2" ' .
'FREETYPE2_LIBS="' . $this->getLibFilesString() . '" ';
}
$arg .= ' ' .
'PNG_CFLAGS=-I"' . BUILD_INCLUDE_PATH . '" ' .
'PNG_LIBS="' . $this->getLibFilesString() . '" ';

View File

@ -0,0 +1,38 @@
<?php
declare(strict_types=1);
namespace SPC\builder\macos\library;
/**
* is a template library class for unix
*/
class freetype extends MacOSLibraryBase
{
public const NAME = 'freetype';
protected function build()
{
[,,$destdir] = SEPARATED_PATH;
$suggested = '';
$suggested .= ($this->builder->getLib('libpng') instanceof MacOSLibraryBase) ? ('--with-png=' . BUILD_ROOT_PATH) : '--without-png';
$suggested .= ' ';
$suggested .= ($this->builder->getLib('bzip2') instanceof MacOSLibraryBase) ? ('--with-bzip2=' . BUILD_ROOT_PATH) : '--without-bzip2';
$suggested .= ' ';
$suggested .= ($this->builder->getLib('brotli') instanceof MacOSLibraryBase) ? ('--with-brotli=' . BUILD_ROOT_PATH) : '--without-brotli';
$suggested .= ' ';
f_passthru(
$this->builder->set_x . ' && ' .
"cd {$this->source_dir} && " .
"{$this->builder->configure_env} ./configure " .
'--enable-static --disable-shared --without-harfbuzz ' .
$suggested .
'--prefix= && ' . // use prefix=/
'make clean && ' .
"make -j{$this->builder->concurrency} && " .
'make install DESTDIR=' . $destdir
);
}
}