mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
14 lines
44 KiB
JavaScript
14 lines
44 KiB
JavaScript
|
|
import{d as fe,x as w,h as k,z as ae,c as g,o as x,j as e,e as W,ai as m,t as l,G as V,H as T,aj as S,ak as te,al as de,am as le,n as I,_ as ze}from"./framework.Bhsyh9kO.js";const ke={support:{BSD:"wip"},type:"external","arg-type":"custom",source:"amqp","lib-depends":["librabbitmq"],"ext-depends-windows":["openssl"]},Se={type:"external",source:"apcu"},De={type:"external",source:"ast"},Be={type:"builtin"},Ce={type:"external",source:"ext-brotli","arg-type":"enable","lib-depends":["brotli"]},qe={type:"builtin","arg-type-unix":"with-path","arg-type-windows":"with","lib-depends":["bzip2"]},Ee={type:"builtin"},We={support:{BSD:"no",Linux:"no",Darwin:"no"},type:"builtin"},$e={type:"builtin"},Pe={notes:!0,type:"builtin","arg-type":"with","lib-depends":["curl"],"ext-depends-windows":["zlib","openssl"]},Ie={type:"builtin","arg-type":"custom","lib-suggests":["qdbm"]},Le={support:{BSD:"wip"},type:"external",source:"dio"},Ue={support:{BSD:"wip"},type:"builtin","arg-type":"custom","arg-type-windows":"with","lib-depends":["libxml2","zlib"],"ext-depends-windows":["xml"]},je={type:"external",source:"ext-ds"},Ae={support:{Windows:"wip",BSD:"wip",Darwin:"wip",Linux:"wip"},type:"wip"},Ne={type:"external",source:"ev","arg-type-windows":"with","ext-depends":["sockets"]},Oe={support:{Windows:"wip",BSD:"wip"},notes:!0,type:"external",source:"ext-event","arg-type":"custom","lib-depends":["libevent"],"ext-depends":["openssl"],"ext-suggests":["sockets"]},Ve={support:{Windows:"wip",BSD:"wip"},type:"external",source:"ext-excimer"},Te={type:"builtin"},Me={support:{Linux:"partial",BSD:"wip"},notes:!0,"arg-type":"custom",type:"builtin","lib-depends-unix":["libffi"],"lib-depends-windows":["libffi-win"]},Ge={type:"builtin"},Xe={type:"builtin"},He={type:"builtin","lib-suggests":["openssl"]},Re={support:{BSD:"wip"},notes:!0,type:"builtin","arg-type":"custom","arg-type-windows":"with","lib-depends":["zlib","libpng"],"ext-depends":["zlib"],"lib-suggests":["libavif","libwebp","libjpeg","freetype"]},Fe={support:{Windows:"wip",BSD:"wip"},type:"builtin","arg-type":"with-path","lib-depends":["gettext"]},Ze={support:{Windows:"wip",BSD:"no",Linux:"no"},notes:!0,type:"external","arg-type":"custom",source:"ext-glfw","lib-depends":["glfw"],"lib-depends-windows":[]},Qe={support:{Windows:"wip",BSD:"wip"},type:"builtin","arg-type":"with-path","lib-depends":["gmp"]},Ke={support:{BSD:"wip"},type:"external",source:"ext-gmssl","lib-depends":["gmssl"]},Ye={support:{Windows:"wip",BSD:"wip"},type:"external",source:"ext-grpc","arg-type-unix":"enable-path","cpp-extension":!0,"lib-depends":["grpc","zlib","openssl","libcares"]},Je={support:{BSD:"wip"},type:"builtin","arg-type":"with-path","arg-type-windows":"with","lib-depends-unix":["libiconv"],"lib-depends-windows":["libiconv-win"]},_e={support:{BSD:"wip"},type:"external",source:"igbinary","ext-suggests":["session","apcu"]},ei={support:{Windows:"wip",BSD:"wip"},notes:!0,type:"external",source:"ext-imagick","arg-type":"custom","lib-depends":["imagemagick"]},ii={support:{Windows:"wip",BSD:"wip"},notes:!0,type:"external",source:"ext-imap","arg-type":"custom","lib-depends":["imap"],"ext-suggests":["openssl"]},si={support:{Windows:"no",BSD:"wip",Darwin:"no"},type:"external",source:"inotify"},ti={support:{BSD:"wip"},type:"builtin","lib-depends-unix":["icu"],"lib-depends-windows":["icu-static-win"]},li={support:{Windows:"wip",BSD:"wip"},type:"builtin","arg-type":"with-path","lib-depends":["ldap"],"lib-suggests":["gmp","libsodium"],"ext-suggests":["openssl"]},ni={support:{BSD:"wip"},type:"builtin","arg-type":"none","ext-depends":["xml"],"build-with-php":!0,target:["static"]},oi={support:{Windows:"wip",BSD:"wip"},type:"external",source:"ext-lz4","arg-type":"custom","lib-depends":["liblz4"]},ai={support:{BSD:"wip",Windows:"wip"},type:"external",source:"ext-maxminddb","arg-type":"with","lib-depends":["libmaxminddb"]},di={type:"builtin","arg-type":"custom",target:["static"],"ext-depends":["mbstring"],"lib-depends":["onig"]},pi={type:"builtin","arg-type":"custom"},ui={type:"wip",support:{Windows:"no",BSD:"no",Darwin:"no",Linux:"no"},notes:!0
|
|||
|
|
`).filter(s=>s.indexOf("=")>=1);return t.length>0?" "+t.map(s=>`-I "${s}"`).join(" "):""}),K=k(()=>`${N.value} download --all --with-php=${L.value}${$.value?" --prefer-pre-built":""}${B.value?" --debug":""}`),Y=k(()=>`${N.value} download --with-php=${L.value} --for-extensions "${F.value}"${$.value?" --prefer-pre-built":""}${B.value?" --debug":""}`),J=k(()=>`${N.value} install-pkg upx${B.value?" --debug":""}`),_=k(()=>`${N.value} doctor --auto-fix${B.value?" --debug":""}`),ee=k(()=>`${N.value} build ${ne.value} "${F.value}"${Z.value}${B.value?" --debug":""}${U.value?" --enable-zts":""}${E.value?" --with-upx-pack":""}${we.value}`),ie=k(()=>{let a=`php-version: ${L.value}
|
|||
|
|
`;return a+=`extensions: "${F.value}"
|
|||
|
|
`,z.value.join(",")==="all"?a+="sapi: "+["cli","fpm","micro","embed","frankenphp"].join(",")+`
|
|||
|
|
`:a+=`sapi: ${z.value.join(",")}
|
|||
|
|
`,Z.value&&(a+=`libs: ${Z.value.replace('--with-libs="',"").replace('"',"").trim()}
|
|||
|
|
`),B.value&&(a+=`debug: true
|
|||
|
|
`),$.value&&(a+=`download-options:
|
|||
|
|
`,a+=` prefer-pre-built: true
|
|||
|
|
`),a+="{{position_hold}}",E.value&&(a+=` with-upx-pack: true
|
|||
|
|
`),U.value&&(a+=` enable-zts: true
|
|||
|
|
`),a.endsWith("{{position_hold}}")?a=a.replace("{{position_hold}}",""):a=a.replace("{{position_hold}}",`build-options:
|
|||
|
|
`),a}),ge=(a,t)=>{const s=o.get(t),b=p.value[a]?.support?.[s]??"yes";return b==="yes"||b==="partial"},xe=()=>{y.value=["apcu","bcmath","calendar","ctype","curl","dba","dom","exif","filter","fileinfo","gd","iconv","intl","mbstring","mbregex","mysqli","mysqlnd","openssl","opcache","pcntl","pdo","pdo_mysql","pdo_sqlite","pdo_pgsql","pgsql","phar","posix","readline","redis","session","simplexml","sockets","sodium","sqlite3","tokenizer","xml","xmlreader","xmlwriter","xsl","zip","zlib"]},me=()=>{y.value=[...oe.value]},he=a=>{if(a.target.value==="all")z.value=["all"];else{const s=z.value.indexOf("all");s!==-1&&z.value.splice(s,1)}ne.value=z.value.map(s=>`--build-${s}`).join(" ")},se=(a,t)=>{if(!C.value||!a.includes(C.value))return t===0?a:"";const s=a.indexOf(C.value);switch(t){case 0:return a.substring(0,s);case 1:return C.value;case 2:return a.substring(s+C.value.length);default:return""}},P=async a=>{try{await navigator.clipboard.writeText(a);const s={[Q.value]:"spcDownload",[Y.value]:"downloadExt",[K.value]:"downloadAll",[J.value]:"downloadPkg",[_.value]:"doctor",[ee.value]:"build",[ie.value]:"craft"}[a];s&&(v.value[s]=!0,setTimeout(()=>{v.value[s]=!1},2e3))}catch(t){console.error("Failed to copy text: ",t);const s=document.createElement("textarea");s.value=a,document.body.appendChild(s),s.select(),document.execCommand("copy"),document.body.removeChild(s)}},ye=a=>{const t=new Set,s=b=>{let c=[];r.value==="linux"?c=p.value[b]?.["ext-depends-linux"]??p.value[b]?.["ext-depends-unix"]??p.value[b]?.["ext-depends"]??[]:r.value==="macos"?c=p.value[b]?.["ext-depends-macos"]??p.value[b]?.["ext-depends-unix"]??p.value[b]?.["ext-depends"]??[]:r.value==="windows"&&(c=p.value[b]?.["ext-depends-windows"]??p.value[b]?.["ext-depends"]??[]),c.length!==0&&c.forEach(f=>{t.add(f),s(f)})};return a.forEach(s),Array.from(t)},ve=a=>{const t=new Set,s=c=>{let f=[];r.value==="linux"?f=h.value[c]?.["lib-depends-linux"]??h.value[c]?.["lib-depends-unix"]??h.value[c]?.["lib-depends"]??[]:r.value==="macos"?f=h.value[c]?.["lib-depends-macos"]??h.value[c]?.["lib-depends-unix"]??h.value[c]?.["lib-depends"]??[]:r.value==="windows"&&(f=h.value[c]?.["lib-depends-windows"]??h.value[c]?.["lib-depends"]??[]),f.length!==0&&f.forEach(O=>{t.add(O),s(O)})},b=c=>{let f=[];r.value==="linux"?f=p.value[c]?.["lib-depends-linux"]??p.value[c]?.["lib-depends-unix"]??p.value[c]?.["lib-depends"]??[]:r.value==="macos"?f=p.value[c]?.["lib-depends-macos"]??p.value[c]?.["lib-depends-unix"]??p.value[c]?.["lib-depends"]??[]:r.value==="windows"&&(f=p.value[c]?.["lib-depends-windows"]??p.value[c]?.["lib-depends"]??[]),f.length!==0&&f.forEach(O=>{t.add(O),s(O)})};return a.forEach(b),Array.from(t)};ae(r,()=>{r.value==="windows"&&(X.value="x86_64"),y.value=[],E.value=0}),ae(y,a=>{H.value=ye(a),H.value.forEach(s=>{y.value.indexOf(s)===-1&&y.value.push(s)}),y.value.sort();const t=Zt({ext:p.value,lib:h.value,os:r.value},y.value);D.value=t.libs.sort(),q.value=[],M.value=ve(t.exts),M.value.forEach(s=>{q.value.indexOf(s)===-1&&q.value.push(s)})},{deep:!0});const n={zh:{selectExt:"选择扩展",buildTarget:"选择编译目标",buildOptions:"编译选项",buildEnvironment:"编译环境",buildEnvNative:"本地构建(Git 源码)",buildEnvSpc:"本地构建(独立 spc 二进制)",buildEnvDocker:"Alpine Docker 构建",useDebug:"是否开启调试输出",yes:"是",no:"否",resultShow:"结果展示",selectCommon:"选择常用扩展",selectAll:"选择全部",selectNone:"全部取消选择",useZTS:"是否编译线程安全版",hardcodedINI:"硬编码 INI 选项",hardcodedINIPlacehoder:"如需要硬编码 ini,每行写一个,例如:memory_limit=2G",resultShowDownload:"是否展示仅下载对应扩展依赖的命令",downloadExtOnlyCommand:"只下载对应扩展的依赖包命令",downloadAllCommand:"下载所有依赖包命令",downloadUPXCommand:"下载 UPX 命令",compileCommand:"编译命令",downloadPhpVersion:"下载 PHP 版本",downloadSPCBinaryCommand:"下载 spc 二进制命令",selectedArch:"选择系统架构",selectedSystem:"选择操作系统",buildLibs:"要构建的库",depTip
|