Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add extension ardillo support #318

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions config/ext.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
"type": "external",
"source": "apcu"
},
"ardillo": {
"type": "external",
"source": "ardillo",
"arg-type": "enable",
"lib-depends": [
"libui-ng"
]
},
"bcmath": {
"type": "builtin"
},
Expand Down
11 changes: 11 additions & 0 deletions config/lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,17 @@
"zlib"
]
},
"libui-ng": {
"source": "ardillo",
"static-libs-unix": [
"libui.a",
"libcmocka.a"
],
"frameworks": [
"CoreFoundation",
"AppKit"
]
},
"libuv": {
"source": "libuv",
"static-libs-unix": [
Expand Down
9 changes: 9 additions & 0 deletions config/source.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@
"path": "LICENSE"
}
},
"ardillo": {
"type": "git",
"rev": "master",
"url": "https://github.com/ardillo-php/ext.git",
"license": {
"type": "text",
"text": "NO LICENSE FILE"
}
},
"brotli": {
"type": "ghtar",
"repo": "google/brotli",
Expand Down
31 changes: 31 additions & 0 deletions src/SPC/builder/extension/ardillo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

namespace SPC\builder\extension;

use SPC\builder\Extension;
use SPC\store\FileSystem;
use SPC\util\CustomExt;

#[CustomExt('ardillo')]
class ardillo extends Extension
{
public function patchBeforeBuildconf(): bool
{
if (!is_dir(SOURCE_PATH . '/php-src/ext/ardillo')) {
FileSystem::copyDir(SOURCE_PATH . '/ardillo', SOURCE_PATH . '/php-src/ext/ardillo');
}
FileSystem::replaceFileStr(
SOURCE_PATH . '/php-src/ext/ardillo/config.m4',
'ARDILLO_CFLAGS="-Wl,--verbose -I$ARDILLO_DIR/libui-ng"',
'ARDILLO_CFLAGS="-Wl,--verbose -I$ARDILLO_DIR/../../../../buildroot/include"'
);
FileSystem::replaceFileStr(
SOURCE_PATH . '/php-src/ext/ardillo/config.m4',
'UI_LIB="-L$CURRENT_DIR/libui-ng/build/meson-out -Wl,-Bstatic -lui"',
'UI_LIB="-L$CURRENT_DIR/../../buildroot/lib -Wl,-Bstatic -lui"'
);
return true;
}
}
15 changes: 15 additions & 0 deletions src/SPC/builder/macos/library/libui_ng.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

declare(strict_types=1);

namespace SPC\builder\macos\library;

/**
* is a template library class for unix
*/
class libui_ng extends MacOSLibraryBase
{
use \SPC\builder\unix\library\libui_ng;

public const NAME = 'libui-ng';
}
15 changes: 15 additions & 0 deletions src/SPC/builder/unix/library/libui_ng.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

declare(strict_types=1);

namespace SPC\builder\unix\library;

trait libui_ng
{
public function build(): void
{
shell()->cd(SOURCE_PATH . '/ardillo/libui-ng')
->exec('meson setup --default-library=static --prefix=' . BUILD_ROOT_PATH . ' build')
->exec('ninja -C build install');
}
}
6 changes: 3 additions & 3 deletions src/SPC/doctor/item/LinuxToolCheckList.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,23 @@ class LinuxToolCheckList
'tar', 'unzip', 'gzip',
'bzip2', 'cmake', 'gcc',
'g++', 'patch', 'binutils-gold',
'libtoolize',
'libtoolize', 'meson',
];

public const TOOLS_DEBIAN = [
'make', 'bison', 'flex',
'git', 'autoconf', 'automake',
'tar', 'unzip', 'gzip',
'bzip2', 'cmake', 'patch',
'xz', 'libtoolize',
'xz', 'libtoolize', 'meson',
];

public const TOOLS_RHEL = [
'perl', 'make', 'bison', 'flex',
'git', 'autoconf', 'automake',
'tar', 'unzip', 'gzip', 'gcc',
'bzip2', 'cmake', 'patch',
'xz',
'xz', 'meson',
];

/** @noinspection PhpUnused */
Expand Down
1 change: 1 addition & 0 deletions src/SPC/doctor/item/MacOSToolCheckList.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class MacOSToolCheckList
'gzip',
'bzip2',
'cmake',
'meson',
];

#[AsCheckItem('if homebrew has installed', limit_os: 'Darwin', level: 998)]
Expand Down
2 changes: 1 addition & 1 deletion src/SPC/doctor/item/OSCheckList.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ public function checkOS(): ?CheckResult
}
$distro = PHP_OS_FAMILY === 'Linux' ? (' ' . SystemUtil::getOSRelease()['dist']) : '';
$known_distro = PHP_OS_FAMILY === 'Linux' && in_array(SystemUtil::getOSRelease()['dist'], SystemUtil::getSupportedDistros());
return CheckResult::ok(PHP_OS_FAMILY . ' ' . php_uname('m') . $distro . ', supported' . ($known_distro ? '' : ' (but not tested on this distro)'));
return CheckResult::ok(PHP_OS_FAMILY . ' ' . php_uname('m') . $distro . ', supported' . ($known_distro && PHP_OS_FAMILY === 'Linux' ? '' : ' (but not tested on this distro)'));
}
}
5 changes: 3 additions & 2 deletions src/globals/test-extensions.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

// If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
$extensions = match (PHP_OS_FAMILY) {
'Linux', 'Darwin' => '',
'Linux' => '',
'Darwin' => 'ardillo',
'Windows' => 'mbstring,openssl',
};

Expand All @@ -27,7 +28,7 @@
// You can use `common`, `bulk`, `minimal` or `none`.
// note: combination is only available for *nix platform. Windows must use `none` combination
$base_combination = match (PHP_OS_FAMILY) {
'Linux', 'Darwin' => 'bulk',
'Linux', 'Darwin' => 'common',
'Windows' => 'none',
};

Expand Down
Loading