|
10 | 10 | <h2>{{ I18N[lang].selectExt }}{{ checkedExts.length > 0 ? (' (' + checkedExts.length + ')') : '' }}</h2> |
11 | 11 | <div class="box"> |
12 | 12 | <div v-for="(item, index) in ext" class="ext-item"> |
13 | | - <input type="checkbox" :id="index" :value="index" v-model="checkedExts" :disabled="extDisableList.indexOf(index) !== -1"> |
14 | | - <label :for="index">{{ index }}</label> |
| 13 | + <span v-if="isSupported(index, selectedSystem)"> |
| 14 | + <input type="checkbox" :id="index" :value="index" v-model="checkedExts" :disabled="extDisableList.indexOf(index) !== -1"> |
| 15 | + <label :for="index">{{ index }}</label> |
| 16 | + </span> |
| 17 | + |
15 | 18 | </div> |
16 | 19 | </div> |
17 | 20 | <div class="my-btn" v-if="selectedSystem !== 'windows'" @click="selectCommon">{{ I18N[lang].selectCommon }}</div> |
|
46 | 49 | <p>{{ I18N[lang].windowsSAPIUnavailable }}</p> |
47 | 50 | </div> |
48 | 51 | <h2>{{ I18N[lang].buildOptions }}</h2> |
49 | | - <div class="option-line"> |
50 | | - <span class="option-title">{{ I18N[lang].buildEnvironment }}</span> |
51 | | - <select v-model="selectedEnv"> |
52 | | - <option value="native">{{ I18N[lang].buildEnvNative }}</option> |
53 | | - <option value="spc">{{ I18N[lang].buildEnvSpc }}</option> |
54 | | - <option value="docker" v-if="selectedSystem !== 'windows'">{{ I18N[lang].buildEnvDocker }}</option> |
55 | | - </select> |
56 | | - </div> |
57 | | - <div v-if="selectedEnv === 'spc'" class="option-line"> |
58 | | - <span class="option-title">{{ I18N[lang].selectedArch }}</span> |
59 | | - <select v-model="selectedArch"> |
60 | | - <option value="x86_64">x86_64 (amd64)</option> |
61 | | - <option value="aarch64" v-if="selectedSystem !== 'windows'">aarch64 (arm64)</option> |
62 | | - </select> |
63 | | - </div> |
64 | | - <div class="option-line"> |
65 | | - <span class="option-title">{{ I18N[lang].downloadPhpVersion }}</span> |
66 | | - <select v-model="selectedPhpVersion"> |
67 | | - <option v-for="item in availablePhpVersions" :value="item">{{ item }}</option> |
68 | | - </select> |
69 | | - </div> |
70 | | - <div class="option-line"> |
71 | | - <span class="option-title">{{ I18N[lang].useDebug }}</span> |
72 | | - <input type="radio" id="debug-yes" :value="1" v-model="debug" /> |
73 | | - <label for="debug-yes">{{ I18N[lang].yes }}</label> |
74 | | - |
75 | | - <input type="radio" id="debug-no" :value="0" v-model="debug" /> |
76 | | - <label for="debug-no">{{ I18N[lang].no }}</label> |
77 | | - </div> |
78 | | - <div class="option-line"> |
79 | | - <span class="option-title">{{ I18N[lang].useZTS }}</span> |
80 | | - <input type="radio" id="zts-yes" :value="1" v-model="zts" /> |
81 | | - <label for="zts-yes">{{ I18N[lang].yes }}</label> |
| 52 | + <!-- Refactor all build options in table --> |
| 53 | + <table> |
| 54 | + <!-- buildEnvironment --> |
| 55 | + <tr> |
| 56 | + <td>{{ I18N[lang].buildEnvironment }}</td> |
| 57 | + <td> |
| 58 | + <select v-model="selectedEnv"> |
| 59 | + <option value="native">{{ I18N[lang].buildEnvNative }}</option> |
| 60 | + <option value="spc">{{ I18N[lang].buildEnvSpc }}</option> |
| 61 | + <option value="docker" v-if="selectedSystem !== 'windows'">{{ I18N[lang].buildEnvDocker }}</option> |
| 62 | + </select> |
| 63 | + </td> |
| 64 | + </tr> |
| 65 | + <!-- Download PHP version --> |
| 66 | + <tr> |
| 67 | + <td>{{ I18N[lang].downloadPhpVersion }}</td> |
| 68 | + <td> |
| 69 | + <select v-model="selectedPhpVersion"> |
| 70 | + <option v-for="item in availablePhpVersions" :value="item">{{ item }}</option> |
| 71 | + </select> |
| 72 | + </td> |
| 73 | + </tr> |
| 74 | + <!-- Enable debug message --> |
| 75 | + <tr> |
| 76 | + <td>{{ I18N[lang].useDebug }}</td> |
| 77 | + <td> |
| 78 | + <input type="radio" id="debug-yes" :value="1" v-model="debug" /> |
| 79 | + <label for="debug-yes">{{ I18N[lang].yes }}</label> |
| 80 | + <input type="radio" id="debug-no" :value="0" v-model="debug" /> |
| 81 | + <label for="debug-no">{{ I18N[lang].no }}</label> |
| 82 | + </td> |
| 83 | + </tr> |
| 84 | + <!-- Enable ZTS --> |
| 85 | + <tr> |
| 86 | + <td>{{ I18N[lang].useZTS }}</td> |
| 87 | + <td> |
| 88 | + <input type="radio" id="zts-yes" :value="1" v-model="zts" /> |
| 89 | + <label for="zts-yes">{{ I18N[lang].yes }}</label> |
| 90 | + <input type="radio" id="zts-no" :value="0" v-model="zts" /> |
| 91 | + <label for="zts-no">{{ I18N[lang].no }}</label> |
| 92 | + </td> |
| 93 | + </tr> |
| 94 | + <!-- download corresponding extensions --> |
| 95 | + <tr> |
| 96 | + <td>{{ I18N[lang].resultShowDownload }}</td> |
| 97 | + <td> |
| 98 | + <input type="radio" id="show-download-yes" :value="1" v-model="downloadByExt" /> |
| 99 | + <label for="show-download-yes">{{ I18N[lang].yes }}</label> |
| 100 | + <input type="radio" id="show-download-no" :value="0" v-model="downloadByExt" /> |
| 101 | + <label for="show-download-no">{{ I18N[lang].no }}</label> |
| 102 | + </td> |
| 103 | + </tr> |
| 104 | + <!-- Download pre-built --> |
| 105 | + <tr> |
| 106 | + <td>{{ I18N[lang].usePreBuilt }}</td> |
| 107 | + <td> |
| 108 | + <input type="radio" id="pre-built-yes" :value="1" v-model="preBuilt" /> |
| 109 | + <label for="pre-built-yes">{{ I18N[lang].yes }}</label> |
| 110 | + <input type="radio" id="pre-built-no" :value="0" v-model="preBuilt" /> |
| 111 | + <label for="pre-built-no">{{ I18N[lang].no }}</label> |
| 112 | + </td> |
| 113 | + </tr> |
| 114 | + <!-- Enable UPX --> |
| 115 | + <tr v-if="selectedSystem !== 'macos'"> |
| 116 | + <td>{{ I18N[lang].useUPX }}</td> |
| 117 | + <td> |
| 118 | + <input type="radio" id="upx-yes" :value="1" v-model="enableUPX" /> |
| 119 | + <label for="upx-yes">{{ I18N[lang].yes }}</label> |
| 120 | + <input type="radio" id="upx-no" :value="0" v-model="enableUPX" /> |
| 121 | + <label for="upx-no">{{ I18N[lang].no }}</label> |
| 122 | + </td> |
| 123 | + </tr> |
| 124 | + </table> |
82 | 125 |
|
83 | | - <input type="radio" id="zts-no" :value="0" v-model="zts" /> |
84 | | - <label for="zts-no">{{ I18N[lang].no }}</label> |
85 | | - </div> |
86 | | - <div class="option-line"> |
87 | | - <span class="option-title">{{ I18N[lang].resultShowDownload }}</span> |
88 | | - <input type="radio" id="show-download-yes" :value="1" v-model="downloadByExt" /> |
89 | | - <label for="show-download-yes">{{ I18N[lang].yes }}</label> |
90 | | - |
91 | | - <input type="radio" id="show-download-no" :value="0" v-model="downloadByExt" /> |
92 | | - <label for="show-download-no">{{ I18N[lang].no }}</label> |
93 | | - </div> |
94 | | - <div class="option-line" v-if="selectedSystem !== 'macos'"> |
95 | | - <span class="option-title">{{ I18N[lang].useUPX }}</span> |
96 | | - <input type="radio" id="upx-yes" :value="1" v-model="enableUPX" /> |
97 | | - <label for="upx-yes">{{ I18N[lang].yes }}</label> |
98 | | - |
99 | | - <input type="radio" id="upx-no" :value="0" v-model="enableUPX" /> |
100 | | - <label for="upx-no">{{ I18N[lang].no }}</label> |
101 | | - </div> |
102 | 126 | <h2>{{ I18N[lang].hardcodedINI }}</h2> |
103 | 127 | <textarea class="textarea" :placeholder="I18N[lang].hardcodedINIPlacehoder" v-model="hardcodedINIData" rows="5" /> |
104 | 128 | <h2>{{ I18N[lang].resultShow }}</h2> |
|
116 | 140 | </div> |
117 | 141 | <div v-if="downloadByExt" class="command-container"> |
118 | 142 | <b>{{ I18N[lang].downloadExtOnlyCommand }}</b> |
119 | | - <div class="command-preview">{{ spcCommand }} download --with-php={{ selectedPhpVersion }} --for-extensions "{{ extList }}"{{ debug ? ' --debug' : '' }}</div> |
| 143 | + <div class="command-preview">{{ spcCommand }} download --with-php={{ selectedPhpVersion }} --for-extensions "{{ extList }}"{{ preBuilt ? ' --prefer-pre-built' : '' }}{{ debug ? ' --debug' : '' }}</div> |
120 | 144 | </div> |
121 | 145 | <div v-else class="command-container"> |
122 | 146 | <b>{{ I18N[lang].downloadAllCommand }}</b> |
123 | | - <div class="command-preview">{{ spcCommand }} download --all --with-php={{ selectedPhpVersion }}{{ debug ? ' --debug' : '' }}</div> |
| 147 | + <div class="command-preview">{{ spcCommand }} download --all --with-php={{ selectedPhpVersion }}{{ preBuilt ? ' --prefer-pre-built' : '' }}{{ debug ? ' --debug' : '' }}</div> |
124 | 148 | </div> |
125 | 149 | <div class="command-container" v-if="enableUPX"> |
126 | 150 | <b>{{ I18N[lang].downloadUPXCommand }}</b> |
@@ -162,6 +186,14 @@ const osList = [ |
162 | 186 | { os: 'windows', label: 'Windows', disabled: false }, |
163 | 187 | ]; |
164 | 188 |
|
| 189 | +const isSupported = (extName, os) => { |
| 190 | + // Convert os to target: linux->Linux, macos->Darwin, windows->Windows (using map) |
| 191 | + const a = new Map([['linux', 'Linux'], ['macos', 'Darwin'], ['windows', 'Windows']]); |
| 192 | + const osName = a.get(os); |
| 193 | + const osSupport = ext.value[extName]?.support?.[osName] ?? 'yes'; |
| 194 | + return osSupport === 'yes' || osSupport === 'partial'; |
| 195 | +}; |
| 196 | +
|
165 | 197 | const availablePhpVersions = [ |
166 | 198 | '7.4', |
167 | 199 | '8.0', |
@@ -201,8 +233,9 @@ const I18N = { |
201 | 233 | depTips: '选择扩展后,不可选中的项目为必需的依赖,编译的依赖库列表中可选的为现有扩展和依赖库的可选依赖。选择可选依赖后,将生成 --with-libs 参数。', |
202 | 234 | microUnavailable: 'micro 不支持 PHP 7.4 及更早版本!', |
203 | 235 | windowsSAPIUnavailable: 'Windows 目前不支持 fpm、embed 构建!', |
204 | | - useUPX: '是否开启 UPX 压缩(减小二进制体积,但很少见的情况下 micro SAPI 无法使用)', |
| 236 | + useUPX: '是否开启 UPX 压缩(减小二进制体积)', |
205 | 237 | windowsDownSPCWarning: 'Windows 下请手动下载 spc.exe 二进制文件并解压到当前目录!', |
| 238 | + usePreBuilt: '如果可能,下载预编译的依赖库(减少编译时间)', |
206 | 239 | }, |
207 | 240 | en: { |
208 | 241 | selectExt: 'Select Extensions', |
@@ -234,8 +267,9 @@ const I18N = { |
234 | 267 | depTips: 'After selecting the extensions, the unselectable items are essential dependencies. In the compiled dependencies list, optional dependencies consist of existing extensions and optional dependencies of libraries. Optional dependencies will be added in --with-libs parameter.', |
235 | 268 | microUnavailable: 'Micro does not support PHP 7.4 and earlier versions!', |
236 | 269 | windowsSAPIUnavailable: 'Windows does not support fpm and embed build!', |
237 | | - useUPX: 'Enable UPX compression (reduce binary size, but in rare cases micro SAPI doesn\'t work with UPX)', |
| 270 | + useUPX: 'Enable UPX compression (reduce binary size)', |
238 | 271 | windowsDownSPCWarning: 'Please download the spc.exe binary file manually and extract it to the current directory on Windows!', |
| 272 | + usePreBuilt: 'Download pre-built dependencies if possible (reduce compile time)', |
239 | 273 | } |
240 | 274 | }; |
241 | 275 |
|
@@ -305,6 +339,9 @@ const zts = ref(0); |
305 | 339 | // chosen download by extensions |
306 | 340 | const downloadByExt = ref(1); |
307 | 341 |
|
| 342 | +// use pre-built |
| 343 | +const preBuilt = ref(1); |
| 344 | +
|
308 | 345 | // chosen upx |
309 | 346 | const enableUPX = ref(0); |
310 | 347 |
|
|
0 commit comments