Skip to content

Commit 4531c9f

Browse files
committed
add option to allow linking musl dynamically on alpine
1 parent 223dd10 commit 4531c9f

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

config/env.ini

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,10 @@ SPC_MICRO_PATCHES=static_extensions_win32,cli_checks,disable_huge_page,vcruntime
7575
; - musl-native: used for alpine linux, can build `musl` and `musl -dynamic` target.
7676
; - gnu-native: used for general linux distros, can build gnu target for the installed glibc version only.
7777

78-
; LEGACY option to specify the target
78+
; option to specify the target, superceded by SPC_TARGET if set
7979
SPC_LIBC=musl
80+
; uncomment to link libc dynamically on musl
81+
; SPC_MUSL_DYNAMIC=true
8082

8183
; Recommended: specify your target here. Zig toolchain will be used.
8284
; examples:

src/SPC/util/SPCTarget.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ public static function isStatic(): bool
2727
return true;
2828
}
2929
if (ToolchainManager::getToolchainClass() === GccNativeToolchain::class) {
30-
return PHP_OS_FAMILY === 'Linux' && SystemUtil::isMuslDist();
30+
return PHP_OS_FAMILY === 'Linux' && SystemUtil::isMuslDist() && !getenv('SPC_MUSL_DYNAMIC');
3131
}
3232
if (ToolchainManager::getToolchainClass() === ClangNativeToolchain::class) {
33-
return PHP_OS_FAMILY === 'Linux' && SystemUtil::isMuslDist();
33+
return PHP_OS_FAMILY === 'Linux' && SystemUtil::isMuslDist() && !getenv('SPC_MUSL_DYNAMIC');
3434
}
3535
// if SPC_LIBC is set, it means the target is static, remove it when 3.0 is released
3636
if ($target = getenv('SPC_TARGET')) {

0 commit comments

Comments
 (0)