Skip to content

Commit 9d508f1

Browse files
committed
forward port v2 pgo changes
1 parent a23ad55 commit 9d508f1

5 files changed

Lines changed: 50 additions & 16 deletions

File tree

config/pkg/ext/ext-fastchart.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
ext-fastchart:
2+
type: php-extension
3+
artifact:
4+
source:
5+
type: ghtar
6+
repo: iliaal/fastchart
7+
extract: php-src/ext/fastchart
8+
prefer-stable: true
9+
metadata:
10+
license-files: [LICENSE]
11+
depends:
12+
- freetype
13+
suggests:
14+
- libpng
15+
- libjpeg
16+
- libwebp
17+
php-extension:
18+
os:
19+
- Linux
20+
- Darwin

config/pkg/ext/ext-fastjson.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
ext-fastjson:
2+
type: php-extension
3+
artifact:
4+
source:
5+
type: ghtar
6+
repo: iliaal/fastjson
7+
extract: php-src/ext/fastjson
8+
prefer-stable: true
9+
metadata:
10+
license-files: [LICENSE]
11+
php-extension:
12+
os:
13+
- Linux
14+
- Darwin

src/Package/Extension/clickhouse.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,14 @@
44

55
namespace Package\Extension;
66

7-
use Package\Target\php;
8-
use StaticPHP\Attribute\Package\BeforeStage;
97
use StaticPHP\Attribute\Package\CustomPhpConfigureArg;
108
use StaticPHP\Attribute\Package\Extension;
11-
use StaticPHP\Attribute\PatchDescription;
129
use StaticPHP\Package\PackageInstaller;
1310
use StaticPHP\Package\PhpExtensionPackage;
14-
use StaticPHP\Util\FileSystem;
1511

1612
#[Extension('clickhouse')]
1713
class clickhouse extends PhpExtensionPackage
1814
{
19-
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-clickhouse')]
20-
#[PatchDescription('Replace THIS_DIR=`dirname $0` with PHP_EXT_SRCDIR() in config.m4 so include paths resolve to the ext source dir during PHP main configure (dirname $0 returns "." when run from php-src root).')]
21-
public function patchBeforeBuildconfUnix(): void
22-
{
23-
FileSystem::replaceFileRegex(
24-
"{$this->getSourceDir()}/config.m4",
25-
'/^(\s*)THIS_DIR=.*/m',
26-
'$1THIS_DIR=PHP_EXT_SRCDIR()',
27-
);
28-
}
29-
3015
#[CustomPhpConfigureArg('Darwin')]
3116
#[CustomPhpConfigureArg('Linux')]
3217
public function getUnixConfigureArg(bool $shared, PackageInstaller $installer): string

src/Package/Library/imagemagick.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ public function buildUnix(LibraryPackage $lib, ToolchainInterface $toolchain): v
4242
->addConfigureArgs(
4343
'--disable-openmp',
4444
'--without-x',
45+
// implicit --with-gcc-arch
46+
// bleeds host cpu features into built binaries
47+
'--without-gcc-arch',
4548
);
4649

4750
// special: linux-static target needs `-static`

src/Package/Library/libaom.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@
99
use StaticPHP\Package\LibraryPackage;
1010
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
1111
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
12+
use StaticPHP\Runtime\SystemTarget;
1213
use StaticPHP\Toolchain\Interface\ToolchainInterface;
1314
use StaticPHP\Toolchain\ZigToolchain;
15+
use StaticPHP\Util\System\UnixUtil;
1416

1517
#[Library('libaom')]
1618
class libaom extends LibraryPackage
@@ -39,9 +41,19 @@ public function buildUnix(ToolchainInterface $toolchain): void
3941
$new = trim($extra . ' -D_GNU_SOURCE');
4042
f_putenv("SPC_COMPILER_EXTRA={$new}");
4143
}
44+
$targetCpu = SystemTarget::getTargetArch();
45+
if (str_starts_with($targetCpu, 'aarch')) {
46+
$targetCpu = str_replace('aarch', 'arm', $targetCpu);
47+
}
48+
if (!UnixUtil::findCommand('nasm') && !UnixUtil::findCommand('yasm')) {
49+
$targetCpu = 'generic';
50+
}
4251
UnixCMakeExecutor::create($this)
4352
->setBuildDir("{$this->getSourceDir()}/builddir")
44-
->addConfigureArgs('-DAOM_TARGET_CPU=generic')
53+
->addConfigureArgs(
54+
"-DAOM_TARGET_CPU={$targetCpu}",
55+
'-DCONFIG_RUNTIME_CPU_DETECT=1',
56+
)
4557
->build();
4658
f_putenv("SPC_COMPILER_EXTRA={$extra}");
4759
$this->patchPkgconfPrefix(['aom.pc']);

0 commit comments

Comments
 (0)