please please...?

This commit is contained in:
DubbleClick
2025-07-25 17:52:33 +07:00
parent da8c38575e
commit d627363132
2 changed files with 12 additions and 4 deletions

View File

@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace SPC\store\pkg; namespace SPC\store\pkg;
use SPC\builder\linux\SystemUtil;
use SPC\store\Downloader; use SPC\store\Downloader;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\store\LockFile; use SPC\store\LockFile;
@@ -77,19 +78,25 @@ class GoXcaddy extends CustomPackage
$lock = json_decode(FileSystem::readFile(LockFile::LOCK_FILE), true); $lock = json_decode(FileSystem::readFile(LockFile::LOCK_FILE), true);
$source_type = $lock[$name]['source_type']; $source_type = $lock[$name]['source_type'];
$filename = DOWNLOAD_PATH . '/' . ($lock[$name]['filename'] ?? $lock[$name]['dirname']); $filename = DOWNLOAD_PATH . '/' . ($lock[$name]['filename'] ?? $lock[$name]['dirname']);
$extract = $lock[$name]['move_path'] === null ? "{$pkgroot}/{$name}" : $lock[$name]['move_path']; $extract = $lock[$name]['move_path'] ?? "{$pkgroot}/{$name}";
FileSystem::extractPackage($name, $source_type, $filename, $extract); FileSystem::extractPackage($name, $source_type, $filename, $extract);
// install xcaddy $sanitizedPath = getenv('PATH');
if (PHP_OS_FAMILY === 'Linux' && !SystemUtil::isMuslDist()) {
$sanitizedPath = preg_replace('#(:?/?[^:]*musl[^:]*)#', '', $sanitizedPath);
$sanitizedPath = preg_replace('#^:|:$|::#', ':', $sanitizedPath); // clean up colons
}
// install xcaddy without using musl tools, xcaddy build requires dynamic linking
shell() shell()
->appendEnv([ ->appendEnv([
'PATH' => "{$pkgroot}/{$name}/bin:" . getenv('PATH'), 'PATH' => "{$pkgroot}/{$name}/bin:" . $sanitizedPath,
'GOROOT' => "{$pkgroot}/{$name}", 'GOROOT' => "{$pkgroot}/{$name}",
'GOBIN' => "{$pkgroot}/{$name}/bin", 'GOBIN' => "{$pkgroot}/{$name}/bin",
'GOPATH' => "{$pkgroot}/go", 'GOPATH' => "{$pkgroot}/go",
]) ])
->exec("CC=/usr/bin/cc CXX=/usr/bin/c++ LD=/usr/bin/ld AR=/usr/bin/ar {$go_exec} install github.com/caddyserver/xcaddy/cmd/xcaddy@latest"); ->exec('CC=cc go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest');
} }
public static function getEnvironment(): array public static function getEnvironment(): array

View File

@@ -205,6 +205,7 @@ echo match ($argv[1]) {
switch ($argv[1] ?? null) { switch ($argv[1] ?? null) {
case 'download_cmd': case 'download_cmd':
passthru("{$prefix}install-pkg go-xcaddy --debug", $retcode); # test
passthru($prefix . $down_cmd, $retcode); passthru($prefix . $down_cmd, $retcode);
break; break;
case 'build_cmd': case 'build_cmd':