File tree Expand file tree Collapse file tree 2 files changed +19
-22
lines changed
Expand file tree Collapse file tree 2 files changed +19
-22
lines changed Original file line number Diff line number Diff line change @@ -94,5 +94,4 @@ public static function getEnvironment(): array
9494 'GOPATH ' => "{$ pkgroot }/go " ,
9595 ];
9696 }
97-
9897}
Original file line number Diff line number Diff line change @@ -104,15 +104,32 @@ public function extract(string $name): void
104104 $ filename = DOWNLOAD_PATH . '/ ' . ($ lock [$ name ]['filename ' ] ?? $ lock [$ name ]['dirname ' ]);
105105 $ extract = "{$ pkgroot }/ {$ name }" ;
106106
107-
108107 FileSystem::extractPackage ($ name , $ source_type , $ filename , $ extract );
109108
110109 $ this ->createZigCcScript ($ zig_bin_dir );
111110 }
112111
113- private function createZigCcScript ( string $ bin_dir ): void
112+ public static function getEnvironment ( ): array
114113 {
114+ $ arch = arch2gnu (php_uname ('m ' ));
115+ $ os = match (PHP_OS_FAMILY ) {
116+ 'Linux ' => 'linux ' ,
117+ 'Windows ' => 'win ' ,
118+ 'Darwin ' => 'macos ' ,
119+ 'BSD ' => 'freebsd ' ,
120+ default => 'linux ' ,
121+ };
115122
123+ $ packageName = "zig- {$ arch }- {$ os }" ;
124+ $ path = PKG_ROOT_PATH . "/ {$ packageName }" ;
125+
126+ return [
127+ 'PATH ' => $ path ,
128+ ];
129+ }
130+
131+ private function createZigCcScript (string $ bin_dir ): void
132+ {
116133 $ script_content = <<<'EOF'
117134#!/usr/bin/env bash
118135
@@ -202,23 +219,4 @@ private function createZigCcScript(string $bin_dir): void
202219 file_put_contents ("{$ bin_dir }/zig-c++ " , $ script_content );
203220 chmod ("{$ bin_dir }/zig-c++ " , 0755 );
204221 }
205-
206- public static function getEnvironment (): array
207- {
208- $ arch = arch2gnu (php_uname ('m ' ));
209- $ os = match (PHP_OS_FAMILY ) {
210- 'Linux ' => 'linux ' ,
211- 'Windows ' => 'win ' ,
212- 'Darwin ' => 'macos ' ,
213- 'BSD ' => 'freebsd ' ,
214- default => 'linux ' ,
215- };
216-
217- $ packageName = "zig- {$ arch }- {$ os }" ;
218- $ path = PKG_ROOT_PATH . "/ {$ packageName }" ;
219-
220- return [
221- 'PATH ' => $ path
222- ];
223- }
224222}
You can’t perform that action at this time.
0 commit comments