|
5 | 5 | namespace SPC\builder\unix; |
6 | 6 |
|
7 | 7 | use SPC\builder\BuilderBase; |
| 8 | +use SPC\builder\freebsd\library\BSDLibraryBase; |
| 9 | +use SPC\builder\linux\library\LinuxLibraryBase; |
8 | 10 | use SPC\builder\linux\LinuxBuilder; |
| 11 | +use SPC\builder\macos\library\MacOSLibraryBase; |
9 | 12 | use SPC\exception\FileSystemException; |
10 | 13 | use SPC\exception\RuntimeException; |
11 | 14 | use SPC\exception\WrongUsageException; |
@@ -90,6 +93,35 @@ public function makeAutoconfFlags(int $flag = AUTOCONF_ALL): string |
90 | 93 | return $extra; |
91 | 94 | } |
92 | 95 |
|
| 96 | + /** |
| 97 | + * @throws FileSystemException |
| 98 | + * @throws RuntimeException |
| 99 | + * @throws WrongUsageException |
| 100 | + */ |
| 101 | + public function makeAutoconfArgs(string $name, array $libSpecs): string |
| 102 | + { |
| 103 | + $ret = ''; |
| 104 | + foreach ($libSpecs as $libName => $arr) { |
| 105 | + $lib = $this->getLib($libName); |
| 106 | + if ($lib === null && str_starts_with($libName, 'lib')) { |
| 107 | + $lib = $this->getLib(substr($libName, 3)); |
| 108 | + } |
| 109 | + |
| 110 | + $arr = $arr ?? []; |
| 111 | + |
| 112 | + $disableArgs = $arr[0] ?? null; |
| 113 | + $prefix = $arr[1] ?? null; |
| 114 | + if ($lib instanceof LinuxLibraryBase || $lib instanceof MacOSLibraryBase || $lib instanceof BSDLibraryBase) { |
| 115 | + logger()->info("{$name} \033[32;1mwith\033[0;1m {$libName} support"); |
| 116 | + $ret .= "--with-{$libName}=yes " . $lib->makeAutoconfEnv($prefix) . ' '; |
| 117 | + } else { |
| 118 | + logger()->info("{$name} \033[31;1mwithout\033[0;1m {$libName} support"); |
| 119 | + $ret .= ($disableArgs ?? "--with-{$libName}=no") . ' '; |
| 120 | + } |
| 121 | + } |
| 122 | + return rtrim($ret); |
| 123 | + } |
| 124 | + |
93 | 125 | public function proveLibs(array $sorted_libraries): void |
94 | 126 | { |
95 | 127 | // search all supported libs |
|
0 commit comments