2
2
<div >
3
3
<h2 >{{ I18N[lang].selectedSystem }}</h2 >
4
4
<div class =" option-line" >
5
- <span v-for =" (item, index) in osList" :key =" index" style =" margin-right : 4 px " >
5
+ <span v-for =" (item, index) in osList" :key =" index" style =" margin-right : 8 px " >
6
6
<input type =" radio" :id =" 'os-' + item.os" :value =" item.os" :disabled =" item.disabled === true" v-model =" selectedSystem" />
7
7
<label :for =" 'os-' + item.os" >{{ item.label }}</label >
8
8
</span >
9
9
</div >
10
+ <div class =" option-line" >
11
+ <select v-model =" selectedArch" >
12
+ <option value =" x86_64" >x86_64</option >
13
+ <option value =" aarch64" :disabled =" selectedSystem === 'windows'" >aarch64</option >
14
+ </select >
15
+ </div >
10
16
<h2 >{{ I18N[lang].selectExt }}{{ checkedExts.length > 0 ? (' (' + checkedExts.length + ')') : '' }}</h2 >
11
17
<div class =" box" >
12
- <div v-for =" (item, index) in ext" class =" ext-item" >
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 >
18
+ <input class =" input" v-model =" filterText" placeholder =" Highlight search..." />
19
+ <br >
20
+ <div v-for =" item in extFilter" class =" ext-item" >
21
+ <span >
22
+ <input type =" checkbox" :id =" item" :value =" item" v-model =" checkedExts" :disabled =" extDisableList.indexOf(item) !== -1" >
23
+ <label :for =" item" >
24
+ <span >{{ highlightItem(item, 0) }}</span >
25
+ <span style =" color : orangered ; font-weight : bolder " >{{ highlightItem(item, 1) }}</span >
26
+ <span >{{ highlightItem(item, 2) }}</span >
27
+ </label >
16
28
</span >
17
29
18
30
</div >
19
31
</div >
20
32
<div class =" my-btn" v-if =" selectedSystem !== 'windows'" @click =" selectCommon" >{{ I18N[lang].selectCommon }}</div >
21
33
<div class =" my-btn" @click =" checkedExts = []" >{{ I18N[lang].selectNone }}</div >
22
34
23
- <details class =" details custom-block" >
35
+ <details class =" details custom-block" open >
24
36
<summary >{{ I18N[lang].buildLibs }}{{ checkedLibs.length > 0 ? (' (' + checkedLibs.length + ')') : '' }}</summary >
25
37
<div class =" box" >
26
38
<div v-for =" (item, index) in libContain" class =" ext-item" >
135
147
<div class =" warning custom-block" >
136
148
<p class =" custom-block-title" >WARNING</p >
137
149
<p >{{ I18N[lang].windowsDownSPCWarning }}</p >
150
+ <a href =" https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-windows-x64.exe" target =" _blank" >https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-windows-x64.exe</a >
138
151
</div >
139
152
</div >
140
153
</div >
141
154
<div v-if =" downloadByExt" class =" command-container" >
142
155
<b >{{ I18N[lang].downloadExtOnlyCommand }}</b >
143
- <div class =" command-preview" >{{ spcCommand }} download --with-php={{ selectedPhpVersion }} --for-extensions "{{ extList }}"{{ preBuilt ? ' --prefer-pre-built' : '' }}{{ debug ? ' --debug' : '' }}</div >
156
+ <div id =" download-ext-cmd" class =" command-preview" >
157
+ {{ downloadExtCommand }}
158
+ </div >
144
159
</div >
145
160
<div v-else class =" command-container" >
146
161
<b >{{ I18N[lang].downloadAllCommand }}</b >
147
- <div class =" command-preview" >{{ spcCommand }} download --all --with-php={{ selectedPhpVersion }}{{ preBuilt ? ' --prefer-pre-built' : '' }}{{ debug ? ' --debug' : '' }}</div >
162
+ <div id =" download-all-cmd" class =" command-preview" >
163
+ {{ downloadAllCommand }}
164
+ </div >
148
165
</div >
149
166
<div class =" command-container" v-if =" enableUPX" >
150
167
<b >{{ I18N[lang].downloadUPXCommand }}</b >
151
- <div class =" command-preview" >{{ spcCommand }} install-pkg upx{{ debug ? ' --debug' : '' }}</div >
168
+ <div id =" download-pkg-cmd" class =" command-preview" >
169
+ {{ downloadPkgCommand }}
170
+ </div >
152
171
</div >
153
172
<div class =" command-container" >
154
173
<b >{{ I18N[lang].compileCommand }}</b >
155
- <div class =" command-preview" >{{ spcCommand }} build {{ buildCommand }} "{{ extList }}"{{ additionalLibs }}{{ debug ? ' --debug' : '' }}{{ zts ? ' --enable-zts' : '' }}{{ enableUPX ? ' --with-upx-pack' : '' }}{{ displayINI }}</div >
174
+ <div id =" build-cmd" class =" command-preview" >
175
+ {{ buildCommandString }}
176
+ </div >
156
177
</div >
157
178
</div >
158
179
</template >
@@ -170,6 +191,15 @@ import libData from '../config/lib.json';
170
191
import { getAllExtLibsByDeps } from ' ./DependencyUtil.js' ;
171
192
172
193
const ext = ref (extData );
194
+ const extFilter = computed (() => {
195
+ const ls = [];
196
+ for (const [name, item] of Object .entries (ext .value )) {
197
+ if (isSupported (name , selectedSystem .value )) {
198
+ ls .push (name );
199
+ }
200
+ }
201
+ return ls ;
202
+ });
173
203
const lib = ref (libData );
174
204
const libContain = ref ([]);
175
205
@@ -234,7 +264,7 @@ const I18N = {
234
264
microUnavailable: ' micro 不支持 PHP 7.4 及更早版本!' ,
235
265
windowsSAPIUnavailable: ' Windows 目前不支持 fpm、embed 构建!' ,
236
266
useUPX: ' 是否开启 UPX 压缩(减小二进制体积)' ,
237
- windowsDownSPCWarning: ' Windows 下请手动下载 spc.exe 二进制文件并解压到当前目录 !' ,
267
+ windowsDownSPCWarning: ' Windows 下请手动下载 spc.exe 二进制文件,解压到当前目录并重命名为 spc.exe !' ,
238
268
usePreBuilt: ' 如果可能,下载预编译的依赖库(减少编译时间)' ,
239
269
},
240
270
en: {
@@ -268,7 +298,7 @@ const I18N = {
268
298
microUnavailable: ' Micro does not support PHP 7.4 and earlier versions!' ,
269
299
windowsSAPIUnavailable: ' Windows does not support fpm and embed build!' ,
270
300
useUPX: ' Enable UPX compression (reduce binary size)' ,
271
- windowsDownSPCWarning: ' Please download the spc.exe binary file manually and extract it to the current directory on Windows!' ,
301
+ windowsDownSPCWarning: ' Please download the binary file manually, extract it to the current directory and rename to spc.exe on Windows!' ,
272
302
usePreBuilt: ' Download pre-built dependencies if possible (reduce compile time)' ,
273
303
}
274
304
};
@@ -325,7 +355,7 @@ const libDisableList = ref([]);
325
355
const checkedTargets = ref ([' cli' ]);
326
356
327
357
// chosen env
328
- const selectedEnv = ref (' native ' );
358
+ const selectedEnv = ref (' spc ' );
329
359
330
360
// chosen php version
331
361
const selectedPhpVersion = ref (' 8.2' );
@@ -348,6 +378,13 @@ const enableUPX = ref(0);
348
378
const hardcodedINIData = ref (' ' );
349
379
350
380
const selectedSystem = ref (' linux' );
381
+
382
+ watch (selectedSystem , () => {
383
+ if (selectedSystem .value === ' windows' ) {
384
+ selectedArch .value = ' x86_64' ;
385
+ }
386
+ });
387
+
351
388
const selectedArch = ref (' x86_64' );
352
389
353
390
// spc command string, alt: spc-alpine-docker, spc
@@ -381,6 +418,25 @@ const displayINI = computed(() => {
381
418
return ' ' + str .map ((x ) => ' -I "' + x + ' "' ).join (' ' );
382
419
});
383
420
421
+ const filterText = ref (' ' );
422
+
423
+ const highlightItem = (item , step ) => {
424
+ if (item .includes (filterText .value )) {
425
+ if (step === 0 ) {
426
+ return item .substring (0 , item .indexOf (filterText .value ));
427
+ } else if (step === 1 ) {
428
+ return filterText .value ;
429
+ } else {
430
+ return item .substring (item .indexOf (filterText .value ) + filterText .value .length );
431
+ }
432
+ } else {
433
+ if (step === 0 ) {
434
+ return item ;
435
+ }
436
+ return ' ' ;
437
+ }
438
+ };
439
+
384
440
const onTargetChange = (event ) => {
385
441
let id;
386
442
if (checkedTargets .value .indexOf (' all' ) !== - 1 && event .target .value === ' all' ) {
@@ -427,6 +483,22 @@ const calculateExtDepends = (input) => {
427
483
return Array .from (result );
428
484
};
429
485
486
+ const downloadAllCommand = computed (() => {
487
+ return ` ${spcCommand .value } download --all --with-php=${selectedPhpVersion .value }${preBuilt .value ? ' --prefer-pre-built' : ' ' }${debug .value ? ' --debug' : ' ' } ` ;
488
+ });
489
+
490
+ const downloadExtCommand = computed (() => {
491
+ return ` ${spcCommand .value } download --with-php=${selectedPhpVersion .value } --for-extensions "${extList .value }"${preBuilt .value ? ' --prefer-pre-built' : ' ' }${debug .value ? ' --debug' : ' ' } ` ;
492
+ });
493
+
494
+ const downloadPkgCommand = computed (() => {
495
+ return ` ${spcCommand .value } install-pkg upx${debug .value ? ' --debug' : ' ' } ` ;
496
+ });
497
+
498
+ const buildCommandString = computed (() => {
499
+ return ` ${spcCommand .value } build ${buildCommand .value } "${extList .value }"${additionalLibs .value }${debug .value ? ' --debug' : ' ' }${zts .value ? ' --enable-zts' : ' ' }${enableUPX .value ? ' --with-upx-pack' : ' ' }${displayINI .value } ` ;
500
+ });
501
+
430
502
const calculateExtLibDepends = (input ) => {
431
503
const result = new Set ();
432
504
@@ -539,9 +611,12 @@ h2 {
539
611
.command-preview {
540
612
padding : 1.2rem ;
541
613
background : var (--vp-c-divider );
614
+ border-radius : 8px ;
615
+ word-break : break-all ;
542
616
font-family : monospace ;
543
617
overflow-wrap : break-word ;
544
618
}
619
+
545
620
.option-line {
546
621
padding : 4px 8px ;
547
622
}
@@ -582,12 +657,38 @@ select {
582
657
background-color : var (--vp-button-alt-active-bg );
583
658
}
584
659
.textarea {
585
- border : 1px solid var (--vp-button-alt-border );
586
- padding : 0 4px ;
587
- min-width : 300px ;
660
+ border : 1px solid var (--vp-c-divider );
661
+ border-radius : 4px ;
662
+ width : calc (100% - 12px );
663
+ padding : 4px 8px ;
664
+ }
665
+
666
+ .input {
667
+ display : block ;
668
+ border : 1px solid var (--vp-c-divider );
669
+ border-radius : 4px ;
670
+ width : 100% ;
671
+ padding : 4px 8px ;
588
672
}
589
673
590
674
.command-container {
591
675
margin-bottom : 24px ;
592
676
}
677
+ .modal-button {
678
+ padding : 4px 8px ;
679
+ border-radius : 4px ;
680
+ border-color : var (--vp-button-alt-border );
681
+ color : var (--vp-button-alt-text );
682
+ background-color : var (--vp-button-alt-bg );
683
+ }
684
+ .modal-button :hover {
685
+ border-color : var (--vp-button-alt-hover-border );
686
+ color : var (--vp-button-alt-hover-text );
687
+ background-color : var (--vp-button-alt-hover-bg )
688
+ }
689
+ .modal-button :active {
690
+ border-color : var (--vp-button-alt-active-border );
691
+ color : var (--vp-button-alt-active-text );
692
+ background-color : var (--vp-button-alt-active-bg )
693
+ }
593
694
</style >
0 commit comments