Skip to content

Commit c330d02

Browse files
committed
update pkg paths to not double the $arch-$os
1 parent af6a230 commit c330d02

File tree

2 files changed

+11
-31
lines changed

2 files changed

+11
-31
lines changed

src/SPC/store/pkg/GoXcaddy.php

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,7 @@ class GoXcaddy extends CustomPackage
1313
{
1414
public static function isInstalled(): bool
1515
{
16-
$arch = arch2gnu(php_uname('m'));
17-
$os = match (PHP_OS_FAMILY) {
18-
'Windows' => 'win',
19-
'Darwin' => 'macos',
20-
'BSD' => 'freebsd',
21-
default => 'linux',
22-
};
23-
24-
$packageName = "go-xcaddy-{$arch}-{$os}";
25-
$pkgroot = PKG_ROOT_PATH;
26-
$folder = "{$pkgroot}/{$packageName}";
27-
16+
$folder = PKG_ROOT_PATH . '/go-xcaddy';
2817
return is_dir($folder) && is_file("{$folder}/bin/go") && is_file("{$folder}/bin/xcaddy");
2918
}
3019

@@ -59,7 +48,7 @@ public function fetch(string $name, bool $force = false, ?array $config = null):
5948
'macos' => 'darwin',
6049
default => throw new \InvalidArgumentException('Unsupported OS: ' . $name),
6150
};
62-
$go_version = '1.24.4';
51+
$go_version = '1.25.0';
6352
$config = [
6453
'type' => 'url',
6554
'url' => "https://go.dev/dl/go{$go_version}.{$os}-{$arch}.tar.gz",
@@ -70,15 +59,15 @@ public function fetch(string $name, bool $force = false, ?array $config = null):
7059
public function extract(string $name): void
7160
{
7261
$pkgroot = PKG_ROOT_PATH;
73-
$go_exec = "{$pkgroot}/{$name}/bin/go";
74-
$xcaddy_exec = "{$pkgroot}/{$name}/bin/xcaddy";
62+
$go_exec = "{$pkgroot}/go-xcaddy/bin/go";
63+
$xcaddy_exec = "{$pkgroot}/go-xcaddy/bin/xcaddy";
7564
if (file_exists($go_exec) && file_exists($xcaddy_exec)) {
7665
return;
7766
}
7867
$lock = json_decode(FileSystem::readFile(LockFile::LOCK_FILE), true);
7968
$source_type = $lock[$name]['source_type'];
8069
$filename = DOWNLOAD_PATH . '/' . ($lock[$name]['filename'] ?? $lock[$name]['dirname']);
81-
$extract = $lock[$name]['move_path'] ?? "{$pkgroot}/{$name}";
70+
$extract = $lock[$name]['move_path'] ?? "{$pkgroot}/go-xcaddy";
8271

8372
FileSystem::extractPackage($name, $source_type, $filename, $extract);
8473

@@ -91,9 +80,9 @@ public function extract(string $name): void
9180
// install xcaddy without using musl tools, xcaddy build requires dynamic linking
9281
shell()
9382
->appendEnv([
94-
'PATH' => "{$pkgroot}/{$name}/bin:" . $sanitizedPath,
95-
'GOROOT' => "{$pkgroot}/{$name}",
96-
'GOBIN' => "{$pkgroot}/{$name}/bin",
83+
'PATH' => "{$pkgroot}/go-xcaddy/bin:" . $sanitizedPath,
84+
'GOROOT' => "{$pkgroot}/go-xcaddy",
85+
'GOBIN' => "{$pkgroot}/go-xcaddy/bin",
9786
'GOPATH' => "{$pkgroot}/go",
9887
])
9988
->exec('CC=cc go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest');

src/SPC/store/pkg/Zig.php

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function fetch(string $name, bool $force = false, ?array $config = null):
103103
public function extract(string $name): void
104104
{
105105
$pkgroot = PKG_ROOT_PATH;
106-
$zig_bin_dir = "{$pkgroot}/{$name}";
106+
$zig_bin_dir = "{$pkgroot}/zig";
107107

108108
$files = ['zig', 'zig-cc', 'zig-c++', 'zig-ar', 'zig-ld.lld', 'zig-ranlib', 'zig-objcopy'];
109109
$all_exist = true;
@@ -120,7 +120,7 @@ public function extract(string $name): void
120120
$lock = json_decode(FileSystem::readFile(LockFile::LOCK_FILE), true);
121121
$source_type = $lock[$name]['source_type'];
122122
$filename = DOWNLOAD_PATH . '/' . ($lock[$name]['filename'] ?? $lock[$name]['dirname']);
123-
$extract = "{$pkgroot}/{$name}";
123+
$extract = "{$pkgroot}/zig";
124124

125125
FileSystem::extractPackage($name, $source_type, $filename, $extract);
126126

@@ -147,16 +147,7 @@ public static function getEnvironment(): array
147147

148148
private static function getPath(): string
149149
{
150-
$arch = arch2gnu(php_uname('m'));
151-
$os = match (PHP_OS_FAMILY) {
152-
'Windows' => 'win',
153-
'Darwin' => 'macos',
154-
'BSD' => 'freebsd',
155-
default => 'linux',
156-
};
157-
158-
$packageName = "zig-{$arch}-{$os}";
159-
return PKG_ROOT_PATH . "/{$packageName}";
150+
return PKG_ROOT_PATH . '/zig';
160151
}
161152

162153
private function createZigCcScript(string $bin_dir): void

0 commit comments

Comments
 (0)