Skip to content

Commit 69d0f9b

Browse files
committed
remove SPC_ARCH
1 parent d846db2 commit 69d0f9b

4 files changed

Lines changed: 7 additions & 11 deletions

File tree

src/Package/Library/libffi.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use StaticPHP\Attribute\Package\Library;
99
use StaticPHP\Package\LibraryPackage;
1010
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
11+
use StaticPHP\Runtime\SystemTarget;
1112

1213
#[Library('libffi')]
1314
class libffi extends LibraryPackage
@@ -28,7 +29,7 @@ public function buildLinux(): void
2829
#[BuildFor('Darwin')]
2930
public function buildDarwin(): void
3031
{
31-
$arch = getenv('SPC_ARCH');
32+
$arch = SystemTarget::getTargetArch();
3233
UnixAutoconfExecutor::create($this)
3334
->configure(
3435
"--host={$arch}-apple-darwin",

src/Package/Library/libpng.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use StaticPHP\Package\LibraryPackage;
1010
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
1111
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
12+
use StaticPHP\Runtime\SystemTarget;
1213
use StaticPHP\Util\FileSystem;
1314

1415
#[Library('libpng')]
@@ -24,7 +25,7 @@ public function buildUnix(LibraryPackage $lib): void
2425
];
2526

2627
// Enable architecture-specific optimizations
27-
match (getenv('SPC_ARCH')) {
28+
match (SystemTarget::getTargetArch()) {
2829
'x86_64' => $args[] = '--enable-intel-sse',
2930
'aarch64' => $args[] = '--enable-arm-neon',
3031
default => null,

src/Package/Library/openssl.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function buildWin(LibraryPackage $lib, PackageBuilder $builder): void
7676
public function buildForDarwin(LibraryPackage $pkg): void
7777
{
7878
$zlib_libs = $pkg->getInstaller()->getLibraryPackage('zlib')->getStaticLibFiles();
79-
$arch = getenv('SPC_ARCH');
79+
$arch = SystemTarget::getTargetArch();
8080

8181
shell()->cd($pkg->getSourceDir())->initializeEnv($pkg)
8282
->exec(
@@ -95,12 +95,7 @@ public function buildForDarwin(LibraryPackage $pkg): void
9595
#[BuildFor('Linux')]
9696
public function build(LibraryPackage $lib): void
9797
{
98-
$arch = getenv('SPC_ARCH');
99-
100-
$env = "CC='" . getenv('CC') . ' -idirafter ' . BUILD_INCLUDE_PATH .
101-
' -idirafter /usr/include/ ' .
102-
' -idirafter /usr/include/' . getenv('SPC_ARCH') . '-linux-gnu/ ' .
103-
"' ";
98+
$arch = SystemTarget::getTargetArch();
10499

105100
$ex_lib = trim($lib->getInstaller()->getLibraryPackage('zlib')->getStaticLibFiles()) . ' -ldl -pthread';
106101
$zlib_extra =
@@ -119,7 +114,7 @@ public function build(LibraryPackage $lib): void
119114

120115
shell()->cd($lib->getSourceDir())->initializeEnv($lib)
121116
->exec(
122-
"{$env} ./Configure no-shared zlib " .
117+
'./Configure no-shared zlib ' .
123118
"--prefix={$lib->getBuildRootPath()} " .
124119
"--libdir={$lib->getLibDir()} " .
125120
"--openssldir={$openssl_dir} " .

src/globals/internal-env.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@
7272
putenv('SOURCE_PATH=' . SOURCE_PATH);
7373
putenv('DOWNLOAD_PATH=' . DOWNLOAD_PATH);
7474
putenv('CPU_COUNT=' . CPU_COUNT);
75-
putenv('SPC_ARCH=' . php_uname('m'));
7675
putenv('GNU_ARCH=' . GNU_ARCH);
7776
putenv('MAC_ARCH=' . MAC_ARCH);
7877

0 commit comments

Comments
 (0)