Skip to content

Commit 146a4d3

Browse files
authored
Build freetype using CMake instead (#658)
1 parent d86b7c4 commit 146a4d3

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

src/SPC/builder/unix/library/freetype.php

+12-11
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,21 @@ trait freetype
1818
*/
1919
protected function build(): void
2020
{
21-
$extra_libs = $this->builder->getLib('libpng') ? '--with-png' : '--without-png';
22-
$extra_libs .= ' ';
23-
$extra_libs .= $this->builder->getLib('bzip2') ? ('--with-bzip2=' . BUILD_ROOT_PATH) : '--without-bzip2';
24-
$extra_libs .= ' ';
25-
$extra_libs .= $this->builder->getLib('brotli') ? ('--with-brotli=' . BUILD_ROOT_PATH) : '--without-brotli';
26-
$extra_libs .= ' ';
27-
28-
shell()->cd($this->source_dir)
21+
$extra_libs = $this->builder->getLib('libpng') ? '-DFT_DISABLE_PNG=OFF ' : '-DFT_DISABLE_PNG=ON ';
22+
$extra_libs .= $this->builder->getLib('bzip2') ? '-DFT_DISABLE_BZIP2=OFF ' : '-DFT_DISABLE_BZIP2=ON ';
23+
$extra_libs .= $this->builder->getLib('brotli') ? '-DFT_DISABLE_BROTLI=OFF ' : '-DFT_DISABLE_BROTLI=ON ';
24+
FileSystem::resetDir($this->source_dir . '/build');
25+
shell()->cd($this->source_dir . '/build')
2926
->setEnv(['CFLAGS' => $this->getLibExtraCFlags(), 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs()])
30-
->execWithEnv('./autogen.sh')
31-
->execWithEnv('./configure --without-harfbuzz --prefix= ' . $extra_libs)
27+
->execWithEnv(
28+
"cmake {$this->builder->makeCmakeArgs()} -DFT_DISABLE_HARFBUZZ=ON " .
29+
'-DBUILD_SHARED_LIBS=OFF ' .
30+
"{$extra_libs}.."
31+
)
3232
->execWithEnv('make clean')
3333
->execWithEnv("make -j{$this->builder->concurrency}")
34-
->execWithEnv('make install DESTDIR=' . BUILD_ROOT_PATH);
34+
->execWithEnv('make install');
35+
3536
$this->patchPkgconfPrefix(['freetype2.pc']);
3637
FileSystem::replaceFileStr(
3738
BUILD_ROOT_PATH . '/lib/pkgconfig/freetype2.pc',

src/globals/test-extensions.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,25 @@
3636
$upx = false;
3737

3838
// prefer downloading pre-built packages to speed up the build process
39-
$prefer_pre_built = true;
39+
$prefer_pre_built = false;
4040

4141
// If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
4242
$extensions = match (PHP_OS_FAMILY) {
43-
'Linux', 'Darwin' => 'grpc',
43+
'Linux', 'Darwin' => 'gd',
4444
'Windows' => 'bcmath',
4545
};
4646

4747
// If you want to test lib-suggests feature with extension, add them below (comma separated, example `libwebp,libavif`).
4848
$with_libs = match (PHP_OS_FAMILY) {
49-
'Linux', 'Darwin' => '',
49+
'Linux', 'Darwin' => 'freetype',
5050
'Windows' => '',
5151
};
5252

5353
// Please change your test base combination. We recommend testing with `common`.
5454
// You can use `common`, `bulk`, `minimal` or `none`.
5555
// note: combination is only available for *nix platform. Windows must use `none` combination
5656
$base_combination = match (PHP_OS_FAMILY) {
57-
'Linux', 'Darwin' => 'none',
57+
'Linux', 'Darwin' => 'minimal',
5858
'Windows' => 'none',
5959
};
6060

0 commit comments

Comments
 (0)