Skip to content

Commit 028aa45

Browse files
committed
Merge remote-tracking branch 'origin/v3-refactor/win-exts' into v3-refactor/win-exts
# Conflicts: # src/Package/Target/php/windows.php
2 parents 85b9f5e + e5e6e26 commit 028aa45

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

src/Package/Library/ngtcp2.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function buildWin(LibraryPackage $lib): void
2424
'-DBUILD_SHARED_LIBS=OFF',
2525
'-DENABLE_STATIC_CRT=ON',
2626
'-DENABLE_LIB_ONLY=ON',
27-
'-DENABLE_OPENSSL=ON',
27+
'-DENABLE_OPENSSL=OFF',
2828
)
2929
->build();
3030
}

src/Package/Target/php/windows.php

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function patchCLITarget(TargetPackage $package): void
105105
throw new PatchException('Windows Makefile patching for php.exe target', 'Cannot patch windows CLI Makefile, Makefile does not contain "$(BUILD_DIR)\php.exe:" line');
106106
}
107107
$lines[$line_num] = '$(BUILD_DIR)\php.exe: generated_files $(DEPS_CLI) $(PHP_GLOBAL_OBJS) $(CLI_GLOBAL_OBJS) $(STATIC_EXT_OBJS) $(ASM_OBJS) $(BUILD_DIR)\php.exe.res $(BUILD_DIR)\php.exe.manifest';
108-
$lines[$line_num + 1] = "\t" . '"$(LINK) /nologo $(PHP_GLOBAL_OBJS_RESP) $(CLI_GLOBAL_OBJS_RESP) $(STATIC_EXT_OBJS_RESP) $(STATIC_EXT_LIBS) $(ASM_OBJS) $(LIBS) $(LIBS_CLI) $(BUILD_DIR)\php.exe.res /out:$(BUILD_DIR)\php.exe $(LDFLAGS) $(LDFLAGS_CLI) /ltcg /nodefaultlib:msvcrt /nodefaultlib:msvcrtd /ignore:4286';
108+
$lines[$line_num + 1] = "\t" . '"$(LINK)" /nologo $(PHP_GLOBAL_OBJS_RESP) $(CLI_GLOBAL_OBJS_RESP) $(STATIC_EXT_OBJS_RESP) $(STATIC_EXT_LIBS) $(ASM_OBJS) $(LIBS) $(LIBS_CLI) $(BUILD_DIR)\php.exe.res /out:$(BUILD_DIR)\php.exe $(LDFLAGS) $(LDFLAGS_CLI) /ltcg /nodefaultlib:msvcrt /nodefaultlib:msvcrtd /ignore:4286';
109109
FileSystem::writeFile("{$package->getSourceDir()}\\Makefile", implode("\r\n", $lines));
110110
}
111111

@@ -171,7 +171,7 @@ public function patchCGITarget(TargetPackage $package): void
171171
throw new PatchException('Windows Makefile patching for php-cgi.exe target', 'Cannot patch windows CGI Makefile, Makefile does not contain "$(BUILD_DIR)\php-cgi.exe:" line');
172172
}
173173
$lines[$line_num] = '$(BUILD_DIR)\php-cgi.exe: $(DEPS_CGI) $(CGI_GLOBAL_OBJS) $(PHP_GLOBAL_OBJS) $(STATIC_EXT_OBJS) $(ASM_OBJS) $(BUILD_DIR)\php-cgi.exe.res $(BUILD_DIR)\php-cgi.exe.manifest';
174-
$lines[$line_num + 1] = "\t" . '@"$(LINK) /nologo $(PHP_GLOBAL_OBJS_RESP) $(CGI_GLOBAL_OBJS_RESP) $(STATIC_EXT_OBJS_RESP) $(STATIC_EXT_LIBS) $(ASM_OBJS) $(LIBS) $(LIBS_CGI) $(BUILD_DIR)\php-cgi.exe.res /out:$(BUILD_DIR)\php-cgi.exe $(LDFLAGS) $(LDFLAGS_CGI) /ltcg /nodefaultlib:msvcrt /nodefaultlib:msvcrtd /ignore:4286';
174+
$lines[$line_num + 1] = "\t" . '@"$(LINK)" /nologo $(PHP_GLOBAL_OBJS_RESP) $(CGI_GLOBAL_OBJS_RESP) $(STATIC_EXT_OBJS_RESP) $(STATIC_EXT_LIBS) $(ASM_OBJS) $(LIBS) $(LIBS_CGI) $(BUILD_DIR)\php-cgi.exe.res /out:$(BUILD_DIR)\php-cgi.exe $(LDFLAGS) $(LDFLAGS_CGI) /ltcg /nodefaultlib:msvcrt /nodefaultlib:msvcrtd /ignore:4286';
175175
FileSystem::writeFile("{$package->getSourceDir()}\\Makefile", implode("\r\n", $lines));
176176

177177
// Patch cgi-static, comment ZEND_TSRMLS_CACHE_DEFINE()
@@ -689,18 +689,21 @@ protected function deployWindowsBinary(PackageBuilder $builder, TargetPackage $p
689689

690690
$builder->deployBinary($src_file, $dst_file);
691691

692+
$output_label = match ($sapi) {
693+
'php-cli' => 'Binary path for cli SAPI',
694+
'php-cgi' => 'Binary path for cgi SAPI',
695+
'php-micro' => 'Binary path for micro SAPI',
696+
default => null,
697+
};
698+
if ($output_label) {
699+
$package->setOutput($output_label, $dst_file);
700+
}
701+
692702
// copy .pdb debug info file
693703
if ($builder->getOption('no-strip', false) && file_exists("{$src[0]}\\{$src[2]}")) {
694704
FileSystem::createDir($debug_dir);
695705
FileSystem::copy("{$src[0]}\\{$src[2]}", "{$debug_dir}\\{$src[2]}");
696706
}
697-
698-
// with-upx-pack for cli, cgi and micro
699-
if ($builder->getOption('with-upx-pack', false)) {
700-
if (in_array($sapi, ['php-cli', 'php-cgi', 'php-micro'], true)) {
701-
cmd()->exec(getenv('UPX_EXEC') . ' --best ' . escapeshellarg($dst_file));
702-
}
703-
}
704707
}
705708

706709
/**

src/StaticPHP/Package/PackageBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public function deployBinary(string $src, string $dst, bool $executable = true):
145145
shell()->exec(getenv('UPX_EXEC') . " --best {$dst}");
146146
} elseif ($upx_option && SystemTarget::getTargetOS() === 'Windows' && $executable) {
147147
logger()->info("Compressing {$dst} with UPX");
148-
shell()->exec(getenv('UPX_EXEC') . ' --best ' . escapeshellarg($dst));
148+
cmd()->exec(getenv('UPX_EXEC') . ' --best ' . escapeshellarg($dst));
149149
}
150150

151151
return $dst;

0 commit comments

Comments
 (0)