1111use StaticPHP \Exception \WrongUsageException ;
1212use StaticPHP \Runtime \Shell \Shell ;
1313use StaticPHP \Runtime \SystemTarget ;
14+ use StaticPHP \Toolchain \Interface \ToolchainInterface ;
15+ use StaticPHP \Toolchain \ZigToolchain ;
1416use StaticPHP \Util \FileSystem ;
1517use StaticPHP \Util \GlobalPathTrait ;
1618use StaticPHP \Util \InteractiveTerm ;
@@ -178,7 +180,7 @@ public function extractDebugInfo(string $binary_path): string
178180 if (SystemTarget::getTargetOS () === 'Darwin ' ) {
179181 shell ()->exec ("dsymutil -f {$ binary_path } -o {$ debug_file }" );
180182 } elseif (SystemTarget::getTargetOS () === 'Linux ' ) {
181- $ objcopy = getenv ('OBJCOPY ' );
183+ $ objcopy = getenv ('OBJCOPY ' ) ?: ' objcopy ' ;
182184 if ($ eu_strip = LinuxUtil::findCommand ('eu-strip ' )) {
183185 shell ()
184186 ->exec ("{$ eu_strip } -f {$ debug_file } {$ binary_path }" )
@@ -200,7 +202,9 @@ public function extractDebugInfo(string $binary_path): string
200202 */
201203 public function stripBinary (string $ binary_path ): void
202204 {
203- $ strip = PKG_ROOT_PATH . '/llvm-tools/bin/llvm-strip ' ;
205+ $ strip = ApplicationContext::tryGet (ToolchainInterface::class) instanceof ZigToolchain
206+ ? PKG_ROOT_PATH . '/llvm-tools/bin/llvm-strip '
207+ : 'strip ' ;
204208 shell ()->exec (match (SystemTarget::getTargetOS ()) {
205209 'Darwin ' => "{$ strip } -S {$ binary_path }" ,
206210 'Linux ' => "{$ strip } --strip-unneeded {$ binary_path }" ,
0 commit comments