@@ -21,51 +21,32 @@ private function __construct()
2121 /** @return non-empty-list<non-empty-string> */
2222 public static function packageNames (TargetPlatform $ targetPlatform , Package $ package ): array
2323 {
24- return array_values (array_unique ([
25- strtolower (sprintf (
26- 'php_%s-%s_php%s-%s-%s-%s%s%s.zip ' ,
27- $ package ->extensionName ()->name (),
28- $ package ->version (),
29- $ targetPlatform ->phpBinaryPath ->majorMinorVersion (),
30- $ targetPlatform ->architecture ->name ,
31- $ targetPlatform ->operatingSystemFamily ->value ,
32- $ targetPlatform ->libcFlavour ()->value ,
33- $ targetPlatform ->phpBinaryPath ->debugMode () === DebugBuild::Debug ? '-debug ' : '' ,
34- $ targetPlatform ->threadSafety === ThreadSafetyMode::ThreadSafe ? '-zts ' : '' ,
35- )),
36- strtolower (sprintf (
37- 'php_%s-%s_php%s-%s-%s-%s%s%s.tgz ' ,
38- $ package ->extensionName ()->name (),
39- $ package ->version (),
40- $ targetPlatform ->phpBinaryPath ->majorMinorVersion (),
41- $ targetPlatform ->architecture ->name ,
42- $ targetPlatform ->operatingSystemFamily ->value ,
43- $ targetPlatform ->libcFlavour ()->value ,
44- $ targetPlatform ->phpBinaryPath ->debugMode () === DebugBuild::Debug ? '-debug ' : '' ,
45- $ targetPlatform ->threadSafety === ThreadSafetyMode::ThreadSafe ? '-zts ' : '' ,
46- )),
47- strtolower (sprintf (
48- 'php_%s-%s_php%s-%s-%s-%s%s%s.zip ' ,
49- $ package ->extensionName ()->name (),
50- $ package ->version (),
51- $ targetPlatform ->phpBinaryPath ->majorMinorVersion (),
52- $ targetPlatform ->architecture ->name ,
53- $ targetPlatform ->operatingSystemFamily ->value ,
54- $ targetPlatform ->libcFlavour ()->value ,
55- $ targetPlatform ->phpBinaryPath ->debugMode () === DebugBuild::Debug ? '-debug ' : '' ,
56- $ targetPlatform ->threadSafety === ThreadSafetyMode::ThreadSafe ? '-zts ' : '-nts ' ,
57- )),
58- strtolower (sprintf (
59- 'php_%s-%s_php%s-%s-%s-%s%s%s.tgz ' ,
60- $ package ->extensionName ()->name (),
61- $ package ->version (),
62- $ targetPlatform ->phpBinaryPath ->majorMinorVersion (),
63- $ targetPlatform ->architecture ->name ,
64- $ targetPlatform ->operatingSystemFamily ->value ,
65- $ targetPlatform ->libcFlavour ()->value ,
66- $ targetPlatform ->phpBinaryPath ->debugMode () === DebugBuild::Debug ? '-debug ' : '' ,
67- $ targetPlatform ->threadSafety === ThreadSafetyMode::ThreadSafe ? '-zts ' : '-nts ' ,
68- )),
69- ]));
24+ $ debug = $ targetPlatform ->phpBinaryPath ->debugMode () === DebugBuild::Debug ? '-debug ' : '' ;
25+ $ tsNoSuffix = $ targetPlatform ->threadSafety === ThreadSafetyMode::ThreadSafe ? '-zts ' : '' ;
26+ $ tsWithSuffix = $ targetPlatform ->threadSafety === ThreadSafetyMode::ThreadSafe ? '-zts ' : '-nts ' ;
27+ $ libc = $ targetPlatform ->libcFlavour ()->value ;
28+
29+ $ name = $ package ->extensionName ()->name ();
30+ $ version = $ package ->version ();
31+ $ phpVer = $ targetPlatform ->phpBinaryPath ->majorMinorVersion ();
32+ $ arch = $ targetPlatform ->architecture ->name ;
33+ $ os = $ targetPlatform ->operatingSystemFamily ->value ;
34+
35+ $ names = [
36+ strtolower (sprintf ('php_%s-%s_php%s-%s-%s-%s%s%s.zip ' , $ name , $ version , $ phpVer , $ arch , $ os , $ libc , $ debug , $ tsNoSuffix )),
37+ strtolower (sprintf ('php_%s-%s_php%s-%s-%s-%s%s%s.tgz ' , $ name , $ version , $ phpVer , $ arch , $ os , $ libc , $ debug , $ tsNoSuffix )),
38+ strtolower (sprintf ('php_%s-%s_php%s-%s-%s-%s%s%s.zip ' , $ name , $ version , $ phpVer , $ arch , $ os , $ libc , $ debug , $ tsWithSuffix )),
39+ strtolower (sprintf ('php_%s-%s_php%s-%s-%s-%s%s%s.tgz ' , $ name , $ version , $ phpVer , $ arch , $ os , $ libc , $ debug , $ tsWithSuffix )),
40+ ];
41+
42+ // Fallbacks with anylibc suffix, for unified binaries compatible with both glibc and musl (Linux only)
43+ if ($ targetPlatform ->operatingSystemFamily === OperatingSystemFamily::Linux) {
44+ $ names [] = strtolower (sprintf ('php_%s-%s_php%s-%s-%s-anylibc%s%s.zip ' , $ name , $ version , $ phpVer , $ arch , $ os , $ debug , $ tsNoSuffix ));
45+ $ names [] = strtolower (sprintf ('php_%s-%s_php%s-%s-%s-anylibc%s%s.tgz ' , $ name , $ version , $ phpVer , $ arch , $ os , $ debug , $ tsNoSuffix ));
46+ $ names [] = strtolower (sprintf ('php_%s-%s_php%s-%s-%s-anylibc%s%s.zip ' , $ name , $ version , $ phpVer , $ arch , $ os , $ debug , $ tsWithSuffix ));
47+ $ names [] = strtolower (sprintf ('php_%s-%s_php%s-%s-%s-anylibc%s%s.tgz ' , $ name , $ version , $ phpVer , $ arch , $ os , $ debug , $ tsWithSuffix ));
48+ }
49+
50+ return array_values (array_unique ($ names ));
7051 }
7152}
0 commit comments