diff --git a/.github/workflows/build-php.yml b/.github/workflows/build-php.yml deleted file mode 100644 index d0389cf2..00000000 --- a/.github/workflows/build-php.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: Build PHP - -on: - push: - branches: [ master ] - paths: - - ".github/workflows/**.yml" - - "docker/**" - -jobs: - integration: - name: Build PHP ${{ matrix.php-versions }} for ${{ matrix.arch }} - runs-on: ubuntu-latest - strategy: - matrix: - php-versions: [ "7.4.30", "8.0.23", "8.1.10", "8.2.0" ] - arch: [ "x86_64", "aarch64", "armv7l" ] - steps: - - uses: actions/checkout@v2 - - name: Check Dockerfile to ${{ matrix.arch }} - run: | - cd docker/ - if [[ "${{ matrix.arch }}" != "x86_64" ]]; then - if [[ "${{ matrix.arch }}" = "armv7l" ]]; then - sed -ie 's/alpine:latest/multiarch\/alpine:armv7-latest-stable/g' Dockerfile - else - sed -ie 's/alpine:latest/multiarch\/alpine:${{ matrix.arch }}-v3.16/g' Dockerfile - fi - docker run --rm --privileged multiarch/qemu-user-static:register --reset - fi - - name: Build micro and PHP distribution ${{ matrix.php-versions }} for ${{ matrix.arch }} - id: buildphp - run: | - cd docker/ && docker build . --tag static-php --build-arg USE_BACKUP_ADDRESS=yes && \ - mkdir ../dist && \ - docker run --rm -v $(pwd)/../dist:/dist/ static-php build-php original ${{ matrix.php-versions }} all /dist/ - - name: Fail if anything failed - if: steps.buildphp == 'failure' - run: | - false - - name: Upload Artifacts - uses: actions/upload-artifact@v3 - with: - name: static-php-cli_${{ matrix.php-versions }}_${{ matrix.arch }} - path: | - dist - - name: Pack PHP ${{ matrix.php-versions }} to archive - run: | - cd dist - tar -zcvf "php-${{ matrix.php-versions }}-static-bin-${{ matrix.arch }}.tar.gz" ./php && rm ./php - if [ -f "./micro.sfx" ]; then - tar -zcvf "micro-${{ matrix.php-versions }}-${{ matrix.arch }}.tar.gz" ./micro.sfx && rm ./micro.sfx - fi - - name: Deploy to Zhamao Server - uses: easingthemes/ssh-deploy@main - env: - SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_SERVER_SECRET_KEY }} - ARGS: "-rltgoDzvO" - SOURCE: "dist/" - REMOTE_HOST: ${{ secrets.DEPLOY_SERVER_HOST }} - REMOTE_PORT: ${{ secrets.DEPLOY_SERVER_PORT }} - REMOTE_USER: ${{ secrets.DEPLOY_SERVER_USER }} - TARGET: ${{ secrets.DEPLOY_SERVER_TARGET }} - - name: Remove dist directory - run: | - rm -rf dist/ - docker images | grep -v REPOSITORY | awk '{print $3}' | xargs docker rmi --force diff --git a/docker/Dockerfile b/docker/Dockerfile deleted file mode 100755 index 343d9988..00000000 --- a/docker/Dockerfile +++ /dev/null @@ -1,89 +0,0 @@ -FROM alpine:3.16 - -# define script basic information -# Version of this Dockerfile -ENV SCRIPT_VERSION=1.5.1 -# Download address uses backup address - -ARG USE_BACKUP_ADDRESS - -# (if downloading slowly, consider set it to yes) -ENV USE_BACKUP="${USE_BACKUP_ADDRESS}" - - -# APK repositories mirror address, if u r not in China, consider set USE_BACKUP=yes to boost -ENV LINK_APK_REPO='mirrors.ustc.edu.cn' -ENV LINK_APK_REPO_BAK='dl-cdn.alpinelinux.org' - -RUN if [ "${USE_BACKUP}" = "" ]; then \ - export USE_BACKUP="no" ; \ - fi - -RUN sed -i.backup 's/dl-cdn.alpinelinux.org/'${LINK_APK_REPO}'/g' /etc/apk/repositories ; - -RUN if [ "${USE_BACKUP}" = "no" ]; then cp -f /etc/apk/repositories.backup /etc/apk/repositories; fi -RUN cat /etc/apk/repositories -# build requirements -RUN apk add bash file wget cmake gcc g++ jq autoconf git libstdc++ linux-headers make m4 libgcc binutils ncurses dialog > /dev/null -# php zlib dependencies -RUN apk add zlib-dev zlib-static > /dev/null -# php mbstring dependencies -RUN apk add oniguruma-dev > /dev/null -# php openssl dependencies -RUN apk add openssl-libs-static openssl-dev openssl > /dev/null -# php gd dependencies -RUN apk add libpng-dev libpng-static > /dev/null -# curl c-ares dependencies -RUN apk add c-ares-static c-ares-dev > /dev/null -# php event dependencies -RUN apk add libevent libevent-dev libevent-static > /dev/null -# php sqlite3 dependencies -RUN apk add sqlite sqlite-dev sqlite-libs sqlite-static > /dev/null -# php libzip dependencies -RUN apk add bzip2-dev bzip2-static bzip2 > /dev/null -# php micro ffi dependencies -RUN apk add libffi libffi-dev > /dev/null -# php gd event parent dependencies -RUN apk add zstd-static > /dev/null -# php readline dependencies -RUN apk add readline-static ncurses-static readline-dev > /dev/null -RUN apk add aria2 - -RUN mkdir /app - -WORKDIR /app - -ADD ./ /app/ - -# RUN chmod +x /app/*.sh - -# use proxy -# ENV http_proxy=http://192.168.3.26:8015 -# ENV https_proxy=http://192.168.3.26:8015 - -# 提前下载好,就可以跳过两步 -# (容器外提前执行 下面两个命令) -RUN sh ./download-library-batch-aria2.sh -RUN sh ./download-extension-batch-aria2.sh - -#ENV http_proxy='' -#ENV https_proxy='' -RUN ls -lh source/libraries -RUN ls -lh source/extensions -# quick test complie -# RUN bash ./compile-deps.sh - -RUN sh ./download.sh swoole ${USE_BACKUP} && \ - sh ./download.sh inotify ${USE_BACKUP} && \ - sh ./download.sh mongodb ${USE_BACKUP} && \ - sh ./download.sh event ${USE_BACKUP} && \ - sh ./download.sh redis ${USE_BACKUP} && \ - sh ./download.sh libxml2 ${USE_BACKUP} && \ - sh ./download.sh xz ${USE_BACKUP} && \ - sh ./download.sh curl ${USE_BACKUP} && \ - sh ./download.sh libzip ${USE_BACKUP} && \ - sh ./download.sh libiconv ${USE_BACKUP} && \ - sh ./download-git.sh dixyes/phpmicro phpmicro ${USE_BACKUP} - -RUN bash ./compile-deps.sh -RUN echo -e "#!/usr/bin/env bash\n/app/compile-php.sh \$@" > /bin/build-php && chmod +x /bin/build-php diff --git a/docker/ac_override_1 b/docker/ac_override_1 deleted file mode 100755 index 277c0239..00000000 --- a/docker/ac_override_1 +++ /dev/null @@ -1,3 +0,0 @@ -AC_DEFUN([PHP_CHECK_LIBRARY], [ - $3 -]) diff --git a/docker/ac_override_2 b/docker/ac_override_2 deleted file mode 100755 index 4652826c..00000000 --- a/docker/ac_override_2 +++ /dev/null @@ -1,18 +0,0 @@ -AC_DEFUN([PHP_CHECK_LIBRARY], [ - save_old_LDFLAGS=$LDFLAGS - ac_stuff="$5" - - save_ext_shared=$ext_shared - ext_shared=yes - PHP_EVAL_LIBLINE([$]ac_stuff, LDFLAGS) - AC_CHECK_LIB([$1],[$2],[ - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - $3 - ],[ - LDFLAGS=$save_old_LDFLAGS - ext_shared=$save_ext_shared - unset ac_cv_lib_$1[]_$2 - $4 - ])dnl -]) diff --git a/docker/check-extensions.sh b/docker/check-extensions.sh deleted file mode 100755 index ded8c0c9..00000000 --- a/docker/check-extensions.sh +++ /dev/null @@ -1,200 +0,0 @@ -#!/bin/sh - -# Here are 3 steps in configuration of extensions -# before_configure -# in_configure -# after_configure - -self_dir=$(cd "$(dirname "$0")";pwd) -php_dir=$(find $self_dir/source -name "php-*" -type d | tail -n1) -test -f "$self_dir/extensions_install.txt" && EXT_LIST_FILE="$self_dir/extensions_install.txt" || EXT_LIST_FILE="$self_dir/extensions.txt" - - -function do_copy_extension() { - ext_dir=$(find $self_dir/source -name "*$1-*" -type d | tail -n1) - mv $ext_dir $php_dir/ext/$1 - if [ $? != 0 ]; then - echo "Compile error! ext: $1, ext_dir=$ext_dir" - exit 1 - fi -} - -function check_before_configure() { - list=$(cat "$EXT_LIST_FILE" | grep -v "^#" | grep -v "^$" | grep -v "^\^") - xml_sign="no" - for loop in $list - do - case $loop in - bcmath) ;; - calendar) ;; - ctype) ;; - exif) ;; - filter) ;; - fileinfo) ;; - gd) ;; - hash) ;; - iconv) ;; - json) ;; - mbstring) ;; - mysqlnd) ;; - openssl) ;; - pcntl) ;; - pdo) ;; - pdo_mysql) ;; - pdo_sqlite) ;; - phar) ;; - posix) ;; - protobuf) - do_copy_extension protobuf - echo '#ifndef PHP_PROTOBUF_H' >> $php_dir/ext/protobuf/php_protobuf.h && \ - echo '# define PHP_PROTOBUF_H' >> $php_dir/ext/protobuf/php_protobuf.h && \ - echo '#ifdef HAVE_CONFIG_H' >> $php_dir/ext/protobuf/php_protobuf.h && \ - echo '# include "config.h"' >> $php_dir/ext/protobuf/php_protobuf.h && \ - echo '#endif' >> $php_dir/ext/protobuf/php_protobuf.h && \ - echo 'extern zend_module_entry protobuf_module_entry;' >> $php_dir/ext/protobuf/php_protobuf.h && \ - echo '# define phpext_protobuf_ptr &protobuf_module_entry' >> $php_dir/ext/protobuf/php_protobuf.h && \ - echo '#endif' >> $php_dir/ext/protobuf/php_protobuf.h - ;; - readline) - if [ ! -d "/nom" ]; then - mkdir /nom - fi - mv /usr/lib/libreadline.so* /nom/ && \ - mv /usr/lib/libncurses*.so* /nom - ;; - shmop) ;; - sockets) ;; - sqlite3) ;; - tokenizer) ;; - zlib) ;; - zip) ;; - curl) cat "$self_dir/ac_override_1" "$php_dir/ext/curl/config.m4" "$self_dir/ac_override_2" > /tmp/aa && mv /tmp/aa "$php_dir/ext/curl/config.m4" ;; - dom|xml|libxml|xmlreader|xmlwriter|simplexml|soap) ;; - inotify) do_copy_extension inotify ;; - redis) do_copy_extension redis ;; - swoole) do_copy_extension swoole ;; - mongodb) do_copy_extension mongodb ;; - event) do_copy_extension event ;; - esac - done - case $1 in - 8.*) - mv $self_dir/source/phpmicro $php_dir/sapi/micro && \ - sed -ie 's/#include "php.h"/#include "php.h"\n#define PHP_MICRO_FAKE_CLI 1/g' $php_dir/sapi/micro/php_micro.c - ;; - esac -} - -function check_in_configure() { - php_configure="" - list=$(cat "$EXT_LIST_FILE" | sed 's/#.*//g' | sed 's/\^.*//g' | sed -e 's/[ ]*$//g' | grep -v "^\s*$") - for loop in $list - do - case $loop in - bcmath) php_configure="$php_configure --enable-bcmath" ;; - calendar) php_configure="$php_configure --enable-calendar" ;; - ctype) php_configure="$php_configure --enable-ctype" ;; - curl) php_configure="$php_configure --with-curl" ;; - dom) php_configure="$php_configure --enable-dom" ;; - exif) php_configure="$php_configure --enable-exif" ;; - event) php_configure="$php_configure --with-event-libevent-dir=/usr --with-event-core --with-event-extra --with-event-openssl" ;; - filter) php_configure="$php_configure --enable-filter" ;; - fileinfo) php_configure="$php_configure --enable-fileinfo" ;; - gd) - case $1 in - 7.3.*|7.2.*) php_configure="$php_configure --with-gd" ;; - 7.4.*|8.*) php_configure="$php_configure --enable-gd" ;; - esac - ;; - hash) - case $1 in - 7.3.*|7.2.*) php_configure="$php_configure --enable-hash" ;; - esac - ;; - iconv) php_configure="$php_configure --with-iconv=/usr" ;; - inotify) php_configure="$php_configure --enable-inotify" ;; - json) - case $1 in - 7.*) php_configure="$php_configure --enable-json" ;; - esac - ;; - libxml) - case $1 in - 7.3.*|7.2.*) php_configure="$php_configure --enable-libxml" ;; - 7.4.*|8.*) php_configure="$php_configure --with-libxml" ;; - esac - ;; - mbstring) php_configure="$php_configure --enable-mbstring" ;; - mongodb) php_configure="$php_configure --enable-mongodb" ;; - mysqlnd) php_configure="$php_configure --enable-mysqlnd" ;; - openssl) php_configure="$php_configure --with-openssl --with-openssl-dir=/usr" ;; - pcntl) php_configure="$php_configure --enable-pcntl" ;; - pdo) php_configure="$php_configure --enable-pdo" ;; - pdo_mysql) php_configure="$php_configure --with-pdo-mysql=mysqlnd" ;; - phar) php_configure="$php_configure --enable-phar" ;; - posix) php_configure="$php_configure --enable-posix" ;; - protobuf) php_configure="$php_configure --enable-protobuf" ;; - readline) php_configure="$php_configure --with-readline" ;; - redis) php_configure="$php_configure --enable-redis --disable-redis-session" ;; - shmop) php_configure="$php_configure --enable-shmop" ;; - simplexml) php_configure="$php_configure --enable-simplexml" ;; - sockets) php_configure="$php_configure --enable-sockets" ;; - soap) php_configure="$php_configure --enable-soap" ;; - sqlite3) php_configure="$php_configure --with-sqlite3" ;; - pdo_sqlite) php_configure="$php_configure --with-pdo-sqlite" ;; - - swoole) - php_configure="$php_configure --enable-swoole" - have_openssl=$(echo $list | grep openssl) - if [ "$have_openssl" != "" ]; then - php_configure="$php_configure --enable-openssl --with-openssl --with-openssl-dir=/usr" - fi - have_hash=$(echo $list | grep hash) - if [ "$have_hash" = "" ]; then - case $1 in - 7.3.*|7.2.*) php_configure="$php_configure --enable-hash" ;; - esac - fi - ;; - tokenizer) php_configure="$php_configure --enable-tokenizer" ;; - xml) php_configure="$php_configure --enable-xml" ;; - xmlreader) php_configure="$php_configure --enable-xmlreader" ;; - xmlwriter) php_configure="$php_configure --enable-xmlwriter" ;; - zlib) php_configure="$php_configure --with-zlib" ;; - zip) php_configure="$php_configure --with-zip" ;; - *) - echo "Unsupported extension '$loop' !" >&2 - exit 1 - ;; - esac - done - case $1 in - 8.*) php_configure="$php_configure --with-ffi --enable-micro=all-static" ;; - esac - echo $php_configure -} - -function check_after_configure() { - list=$(cat "$EXT_LIST_FILE" | grep -v "^#" | grep -v "^$") - for loop in $list - do - case $loop in - swoole) - sed -ie 's/swoole_clock_gettime(CLOCK_REALTIME/clock_gettime(CLOCK_REALTIME/g' "$php_dir/ext/swoole/include/swoole.h" - sed -ie 's/strcmp("cli", sapi_module.name) == 0/strcmp("cli", sapi_module.name) == 0 || strcmp("micro", sapi_module.name) == 0/g' "$php_dir/ext/swoole/ext-src/php_swoole.cc" - ;; - esac - done - case $1 in - 8.*) sed -ie 's/$(EXTRA_LIBS:-lresolv=-Wl,-Bstatic,-lresolv,-Bdynamic)/$(EXTRA_LIBS)/g' "$php_dir/Makefile" ;; - esac -} - -function finish_compile() { - if [ -d "/nom" ]; then - mv /nom/* /usr/lib/ || echo "Empty directory" - rm -rf /nom/ - fi -} - -$1 $2 diff --git a/docker/compile-deps.sh b/docker/compile-deps.sh deleted file mode 100755 index b2730441..00000000 --- a/docker/compile-deps.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env bash - -self_dir=$(cd "$(dirname "$0")";pwd) - -function do_xml_compiler() { - cd $self_dir/source/xz-* && \ - ./configure --enable-static=yes && \ - make -j$(cat /proc/cpuinfo | grep processor | wc -l) && \ - make install && \ - echo "xz compiled!" && \ - cd ../libxml2-* && \ - ./configure --prefix=/usr --with-lzma --without-python && \ - make -j$(cat /proc/cpuinfo | grep processor | wc -l) && \ - make install && \ - echo "libxml2 compiled!" -} - -function do_libzip_compiler() { - cd $self_dir/source/libzip-* && \ - mkdir build && \ - cd build && \ - cmake -DBUILD_SHARED_LIBS=no .. -Wno-dev -DENABLE_BZIP2=no -DENABLE_LZMA=no && \ - make LDFLAGS="-llzma -lbz2" -j$(cat /proc/cpuinfo | grep processor | wc -l) && \ - make install && \ - echo "libzip compiled!" -} - -function do_curl_compiler() { - cd $self_dir/source/curl-* && \ - CC=gcc CXX=g++ CFLAGS=-fPIC CPPFLAGS=-fPIC ./configure \ - --without-nghttp2 \ - --with-ssl=/usr \ - --with-pic=pic \ - --enable-ipv6 \ - --enable-shared=no \ - --without-libidn2 \ - --disable-ldap \ - --without-libpsl \ - --without-lber \ - --enable-ares && \ - make -j$(cat /proc/cpuinfo | grep processor | wc -l) && \ - make install && \ - echo "curl compiled!" -} - -function do_iconv_compiler() { - cd $self_dir/source/libiconv-* && \ - ./configure --enable-static=yes --prefix=/usr && \ - make -j$(cat /proc/cpuinfo | grep processor | wc -l) && \ - make install && \ - echo "libiconv compiled!" -} - -if [ ! -f "$self_dir/source/.deps-compiled" ]; then - source ${self_dir}/deps-modules/libmcrypt.sh - source ${self_dir}/deps-modules/gmp.sh - do_xml_compiler && \ - do_curl_compiler && \ - do_libzip_compiler && \ - do_iconv_compiler && \ - touch "$self_dir/source/.deps-compiled" -else - echo "Skip compilation for dependencies" -fi diff --git a/docker/compile-php.sh b/docker/compile-php.sh deleted file mode 100755 index 07e18168..00000000 --- a/docker/compile-php.sh +++ /dev/null @@ -1,125 +0,0 @@ -#!/usr/bin/env bash - -self_dir=$(cd "$(dirname "$0")";pwd) - -# 通过 extensions.txt 生成一个 dialog 命令 -function generate_ext_dialog_cmd() { - list=$(cat "$self_dir/extensions.txt" | grep -v "^#" | grep -v "^$") - echo -n "dialog --backtitle \"static-php-cli Compile Options\" --checklist \"Please select the extension you don't want to compile.\n\nNOTE: Use to select or deselect items\n\n** Default is compiling all **\" 24 60 20 " > $self_dir/.ask_cmd.sh - for loop in $list - do - case $loop in - ^*) - loop=$(echo ${loop:1} | xargs) - echo -n "$loop '$loop Extension' off " >> $self_dir/.ask_cmd.sh - ;; - *) echo -n "$loop '$loop Extension' on " >> $self_dir/.ask_cmd.sh ;; - esac - done - echo "2>$self_dir/extensions_install.txt" >> $self_dir/.ask_cmd.sh -} - -# PHP 编译参数生成 -function php_compile_args() { - _php_arg="--prefix=$self_dir/php-dist" - _php_arg="$_php_arg --disable-all" - _php_arg="$_php_arg --enable-shared=no" - _php_arg="$_php_arg --enable-static=yes" - _php_arg="$_php_arg --enable-inline-optimization" - _php_arg="$_php_arg --with-layout=GNU" - _php_arg="$_php_arg --with-pear=no" - _php_arg="$_php_arg --disable-cgi" - _php_arg="$_php_arg --disable-phpdbg" - _php_arg="$_php_arg --with-config-file-path=/etc" - _php_arg="$_php_arg $($self_dir/check-extensions.sh check_in_configure $1)" - echo $_php_arg -} - -# 第一个参数用于使用镜像地址还是原地址(mirror为镜像地址,original为原地址) -if [ "$1" = "" ]; then - dialog --backtitle "static-php-cli Compile Options" --yesno ": Use mirror download address, mainland China users recommended.\n\n: Use original address, global users recommended." 10 50 - test $? == 0 && USE_BACKUP="no" || USE_BACKUP="yes" -else - test "$1" != "mirror" && USE_BACKUP="yes" || USE_BACKUP="no" -fi - -# 第二个参数用于规定编译的 PHP 版本 -if [ "$2" = "" ]; then - dialog --backtitle "static-php-cli Compile Options" --inputbox "Please input your PHP version to compile" 10 50 "8.1.7" 2>$self_dir/.phpver - if [ $? != 0 ]; then - clear - echo "canceled Compiling PHP." && rm -f $self_dir/.phpver - exit 1 - else - VER_PHP=$(cat $self_dir/.phpver) - rm -f $self_dir/.phpver - fi -else - VER_PHP=$2 -fi - -# 第三个参数用于是否直接安装,如果留空则询问编译的扩展,如果填入 all,则直接编译所有的扩展 -if [ "$3" != "all" ]; then - generate_ext_dialog_cmd && cat $self_dir/.ask_cmd.sh && chmod +x $self_dir/.ask_cmd.sh && $self_dir/.ask_cmd.sh - if [ $? != 0 ]; then - clear - echo "canceled Compiling PHP while selecting extensions." && rm -rf $self_dir/.ask_cmd.sh - exit 1 - fi - rm -f $self_dir/.ask_cmd.sh -else - cp $self_dir/extensions.txt $self_dir/extensions_install.txt -fi - -# 第四个参数用于输出 PHP 和 micro 二进制文件的位置 -if [ "$4" = "" ]; then - dialog --backtitle "static-php-cli Compile Options" --inputbox "Please input compiled output directory" 10 50 "/dist/" 2>$self_dir/.outdir - if [ $? != 0 ]; then - clear - echo "canceled setting output dir, compiling PHP stopped." && rm -f $self_dir/.outdir - exit 1 - else - OUT_DIR=$(cat $self_dir/.outdir) - rm -f $self_dir/.outdir - fi -else - OUT_DIR=$4 -fi - -if [ ! -d "$OUT_DIR" ]; then - mkdir -p "$OUT_DIR" -fi - -# 下载 PHP - - -echo "All done. Downloading PHP ..." -if [ -d "$self_dir/source/php-$VER_PHP" ]; then - rm -rf "$self_dir/source/php-$VER_PHP" -fi -$self_dir/download.sh php ${USE_BACKUP} ${VER_PHP} || { echo "Download PHP failed!" && exit 1 ; } -# 选择性编译依赖的库、移动需要安装的扩展到 PHP 目录 -$self_dir/check-extensions.sh check_before_configure ${VER_PHP} || { echo "Install required library failed!" && exit 1 ; } -# 编译 PHP -echo "Compiling PHP ..." -php_dir=$(find $self_dir/source -name "php-$VER_PHP" -type d | tail -n1) -cd $php_dir && \ - ./buildconf --force && \ - ./configure LDFLAGS=-static $(php_compile_args $VER_PHP) && \ - $self_dir/check-extensions.sh check_after_configure ${VER_PHP} && \ - sed -ie 's/-export-dynamic//g' "Makefile" && \ - sed -ie 's/-o $(SAPI_CLI_PATH)/-all-static -o $(SAPI_CLI_PATH)/g' "Makefile" && \ - #sed -ie 's/$(PHP_GLOBAL_OBJS) $(PHP_BINARY_OBJS) $(PHP_MICRO_OBJS)/$(PHP_GLOBAL_OBJS:.lo=.o) $(PHP_BINARY_OBJS:.lo=.o) $(PHP_MICRO_OBJS:.lo=.o)/g' "Makefile" && \ - make LDFLAGS="-ldl" -j$(cat /proc/cpuinfo | grep processor | wc -l) && \ - make install-cli && \ - $self_dir/check-extensions.sh finish_compile && \ - strip $self_dir/php-dist/bin/php -if [ $? != 0 ]; then - exit 1 -fi -# 将 PHP 和 micro 输出到指定目录 -echo "Copying php binary to $OUT_DIR ..." && \ - cp $self_dir/php-dist/bin/php $OUT_DIR/ && \ - test -f $php_dir/sapi/micro/micro.sfx && \ - echo "Copying micro.sfx binary to $OUT_DIR ..." && \ - cp $php_dir/sapi/micro/micro.sfx $OUT_DIR/ || { exit 0 ; } diff --git a/docker/config.json b/docker/config.json deleted file mode 100755 index e0b5702f..00000000 --- a/docker/config.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "php": { - "link": "http://mirrors.zhamao.xin/php/php-{version}.tar.gz", - "link_2": "https://www.php.net/distributions/php-{version}.tar.gz" - }, - "protobuf": { - "version": "3.21.2", - "link": "http://mirrors.zhamao.xin/pecl/protobuf-{version}.tgz", - "link_2": "https://pecl.php.net/get/protobuf-{version}.tgz" - }, - "swoole": { - "version": "4.8.10", - "link": "http://mirrors.zhamao.xin/pecl/swoole-{version}.tgz", - "link_2": "https://pecl.php.net/get/swoole-{version}.tgz" - }, - "mongodb": { - "version": "1.13.0", - "link": "http://mirrors.zhamao.xin/pecl/mongodb-{version}.tgz", - "link_2": "https://pecl.php.net/get/mongodb-{version}.tgz" - }, - "inotify": { - "version": "3.0.0", - "link": "http://mirrors.zhamao.xin/pecl/inotify-{version}.tgz", - "link_2": "https://pecl.php.net/get/inotify-{version}.tgz" - }, - "event": { - "version": "3.0.8", - "link": "https://mirrors.zhamao.xin/library/php-event/event-{version}.tar.gz", - "link_2": "https://bitbucket.org/osmanov/pecl-event/get/{version}.tar.gz" - }, - "redis": { - "version": "5.3.7", - "link": "http://mirrors.zhamao.xin/pecl/redis-{version}.tgz", - "link_2": "https://pecl.php.net/get/redis-{version}.tgz" - }, - "libxml2": { - "version": "2.9.12", - "link": "http://mirrors.zhamao.xin/library/libxml2/libxml2-{version}.tar.gz", - "link_2": "http://xmlsoft.org/sources/libxml2-{version}.tar.gz" - }, - "curl": { - "version": "7.83.1", - "link": "https://mirrors.zhamao.xin/library/curl/curl-{version}.tar.gz", - "link_2": "https://curl.haxx.se/download/curl-{version}.tar.gz" - }, - "xz": { - "version": "5.2.5", - "link": "https://mirrors.zhamao.xin/library/xz/xz-{version}.tar.gz", - "link_2": "https://tukaani.org/xz/xz-{version}.tar.gz" - }, - "libzip": { - "version": "1.9.2", - "link": "https://mirrors.zhamao.xin/library/libzip/libzip-{version}.tar.gz", - "link_2": "https://libzip.org/download/libzip-{version}.tar.gz" - }, - "libiconv": { - "version": "1.17", - "link": "https://mirrors.zhamao.xin/library/libiconv/libiconv-{version}.tar.gz", - "link_2": "https://ftp.gnu.org/gnu/libiconv/libiconv-{version}.tar.gz" - } -} diff --git a/docker/deps-modules/gmp.sh b/docker/deps-modules/gmp.sh deleted file mode 100644 index 5c01902b..00000000 --- a/docker/deps-modules/gmp.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -if [ -n "$__MODULE_SH__" ]; then - return -fi -__MODULE_SH__='gmp.sh' - -set -exu -__DIR__=$( - cd "$(dirname "$0")" - pwd -) -cd ${__DIR__} - -# cpu 核数 ,前面为linux 后面为macos -cpu_nums=`nproc 2> /dev/null || sysctl -n hw.ncpu` -# cpu_nums=`grep "processor" /proc/cpuinfo | sort -u | wc -l` - -function do_gmp_compiler() { - pwd - mkdir -p /app/source/builder_dir/gmp - tar --strip-components=1 -C ${__DIR__}/source/builder_dir/gmp -xf ${__DIR__}/source/libraries/gmp-6.2.1.tar.lz - cd ${__DIR__}/source/builder_dir/gmp - - ./configure --prefix=/usr/gmp --enable-static --disable-shared - make -j $cpu_nums - echo "gmp compiled!" && \ - make install && \ - echo "gmp compiled!" - return $? -} - -do_gmp_compiler \ No newline at end of file diff --git a/docker/deps-modules/libmcrypt.sh b/docker/deps-modules/libmcrypt.sh deleted file mode 100644 index 9f69723d..00000000 --- a/docker/deps-modules/libmcrypt.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -if [ -n "$__MODULE_SH__" ]; then - return -fi -__MODULE_SH__='libmcrypt.sh' - -set -exu -__DIR__=$( - cd "$(dirname "$0")" - pwd -) -cd ${__DIR__} - -# cpu 核数 ,前面为linux 后面为macos -cpu_nums=`nproc 2> /dev/null || sysctl -n hw.ncpu` -# cpu_nums=`grep "processor" /proc/cpuinfo | sort -u | wc -l` - - -function do_libmcrypt_compiler() { - pwd - mkdir -p /app/source/builder_dir/libmcrypt - tar --strip-components=1 -C ${__DIR__}/source/builder_dir/libmcrypt -xf ${__DIR__}/source/libraries/libmcrypt-2.5.8-3.4.tar.gz - cd ${__DIR__}/source/builder_dir/libmcrypt - - chmod a+x ./install-sh - sh ./configure --prefix=/usr/libmcrypt \ - --enable-static=yes \ - --enable-shared=no - make -j $cpu_nums - echo "libmcrypt compiled!" && \ - make install && \ - echo "libmcrypt compiled!" - return $? -} -do_libmcrypt_compiler \ No newline at end of file diff --git a/docker/download-extension-batch-aria2.sh b/docker/download-extension-batch-aria2.sh deleted file mode 100755 index b4802c16..00000000 --- a/docker/download-extension-batch-aria2.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -set -exu -__DIR__=$( - cd "$(dirname "$0")" - pwd -) - -cd ${__DIR__} - -# https://aria2.github.io/manual/en/html/aria2c.html#http-ftp-segmented-downloads -# https://aria2.github.io/manual/en/html/aria2c.html -# -with-config-file-path=/usr/local/php/etc -# -U, --user-agent -# aria2c -h -# aria2c --conf-path=/etc/aria2/aria2.conf - -:< --x, --max-connection-per-server= --k, --min-split-size= --j, --max-concurrent-downloads= --i, --input-file= -EOF - -user_agent='Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36' - - -test -f download_extension_urls.txt && aria2c -c -j 10 -s 10 -x 8 -k 10M --allow-overwrite=true --max-tries=30 --retry-wait=15 --user-agent=$user_agent \ - -d extensions --input-file=download_extension_urls.txt - -mkdir -p source/extensions -awk 'BEGIN { cmd="cp -ri extensions/* source/extensions/" ; print "n" |cmd; }' \ No newline at end of file diff --git a/docker/download-git.sh b/docker/download-git.sh deleted file mode 100755 index 9ad5d241..00000000 --- a/docker/download-git.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash - -self_dir=$(cd "$(dirname "$0")";pwd) - -test -d "$self_dir/source/cache/" || mkdir -p "$self_dir/source/cache" - -test "$3" != "yes" && GITHUB_ADDR="https://gh.api.99988866.xyz/" || GITHUB_ADDR="" - -if [ -d "$self_dir/source/cache/$2" ]; then - echo "Using cache for $2" - cp -r "$self_dir/source/cache/$2" "$self_dir/source/" -else - wget -O $self_dir/source/master.zip "$GITHUB_ADDR""https://github.com/$1/archive/master.zip" && \ - cd $self_dir/source/ && \ - unzip master.zip && \ - mv $2-master/ cache/$2 && \ - cp -r cache/$2 ./ -fi - -# git clone https://$GITHUB_ADDR/$1.git --depth=1 $self_dir/source/$2 diff --git a/docker/download-library-batch-aria2.sh b/docker/download-library-batch-aria2.sh deleted file mode 100755 index a6e5de3e..00000000 --- a/docker/download-library-batch-aria2.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -set -exu -__DIR__=$( - cd "$(dirname "$0")" - pwd -) - -cd ${__DIR__} - -# https://aria2.github.io/manual/en/html/aria2c.html#http-ftp-segmented-downloads -# https://aria2.github.io/manual/en/html/aria2c.html -# -with-config-file-path=/usr/local/php/etc -# -U, --user-agent -# aria2c -h -# aria2c --conf-path=/etc/aria2/aria2.conf - -:< --x, --max-connection-per-server= --k, --min-split-size= --j, --max-concurrent-downloads= --i, --input-file= -EOF - -user_agent='Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36' - - -test -f download_library_urls.txt && aria2c -c -j 10 -s 10 -x 8 -k 10M --allow-overwrite=true --max-tries=30 --retry-wait=15 --user-agent=$user_agent \ - -d libraries --input-file=download_library_urls.txt - -mkdir -p source/libraries -awk 'BEGIN { cmd="cp -ri libraries/* source/libraries/" ; print "n" |cmd; }' \ No newline at end of file diff --git a/docker/download.sh b/docker/download.sh deleted file mode 100755 index 0b1d15e2..00000000 --- a/docker/download.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/sh - -_use_backup="$2" - -SELF_DIR=$(cd "$(dirname "$0")";pwd) - -if [ ! -d "source" ]; then - mkdir source -fi - -if [ ! -d "source/cache" ]; then - mkdir source/cache -fi - -function readconf() { - cat $SELF_DIR/config.json | jq $@ | sed 's/\"//g' -} - -cd source - -if [ "$_use_backup" = "yes" ]; then - _use_backup="_2" -else - _use_backup="" -fi - -archive_find_tar=$(find cache/ -name "$1.*" | grep -E ".tgz" | tail -n1) -archive_find_zip=$(find cache/ -name "$1.*" | grep -E ".zip" | tail -n1) - -if [ "$archive_find_tar" != "" ]; then - echo "Using cache for $1 ($archive_find_tar)" - tar -zxf "$archive_find_tar" -elif [ "$archive_find_zip" != "" ]; then - echo "Using cache for $1 ($archive_find_zip)" - unzip $archive_find_zip -d "$SELF_DIR/source" > /dev/null -else - if [ "$3" != "" ]; then - wget -q "$(readconf ".$1.link$_use_backup" | sed 's/{version}/'$3'/g')" - else - echo "Downloading $1" - wget -q "$(readconf ".$1.link$_use_backup" | sed 's/{version}/'$(readconf ".$1.version")'/g')" - fi - - if [ $? == 0 ]; then - archive_file_tar=$(find . -name "*.*" -maxdepth 1 | grep -E ".tar|.gz|.tgz" | tail -n1) - archive_file_zip=$(find . -name "*.zip" -maxdepth 1 | tail -n1) - if [ "$archive_file_tar" != "" ]; then - tar -zxf $archive_file_tar && mv $archive_file_tar $SELF_DIR/source/cache/$1.tgz - elif [ "$archive_file_zip" != "" ]; then - unzip $archive_file_zip && mv $archive_file_zip $SELF_DIR/source/cache/$1.zip > /dev/null - else - find . -name "*$1*.*" - echo "Unable to find downloaded file, only support '.tar.gz', '.tgz', '.zip' file!" - exit 1 - fi - else - echo "Download $1 failed! (at $?)" - exit 1 - fi -fi diff --git a/docker/download_extension_urls.bak.txt b/docker/download_extension_urls.bak.txt deleted file mode 100644 index fe8ae32c..00000000 --- a/docker/download_extension_urls.bak.txt +++ /dev/null @@ -1,22 +0,0 @@ -https://pecl.php.net/get/redis-5.3.7.tgz - out=redis-5.3.7.tgz -https://pecl.php.net/get/yaml-2.2.2.tgz - out=yaml-2.2.2.tgz -https://pecl.php.net/get/imagick-3.6.0.tgz - out=imagick-3.6.0.tgz -https://pecl.php.net/get/mongodb-1.14.2.tgz - out=mongodb-1.14.2.tgz -https://pecl.php.net/get/apcu-5.1.22.tgz - out=apcu-5.1.22.tgz -https://pecl.php.net/get/ds-1.4.0.tgz - out=ds-1.4.0.tgz -https://pecl.php.net/get/inotify-3.0.0.tgz - out=inotify-3.0.0.tgz -https://pecl.php.net/get/xlswriter-1.5.2.tgz - out=xlswriter-1.5.2.tgz -https://pecl.php.net/get/zstd-0.12.1.tgz - out=zstd-0.12.1.tgz -https://pecl.php.net/get/event-3.0.8.tgz - out=event-3.0.8.tgz -https://pecl.php.net/get/mcrypt-1.0.5.tgz - out=mcrypt-1.0.5.tgz \ No newline at end of file diff --git a/docker/download_extension_urls.txt b/docker/download_extension_urls.txt deleted file mode 100644 index 7aace7bf..00000000 --- a/docker/download_extension_urls.txt +++ /dev/null @@ -1,4 +0,0 @@ -https://pecl.php.net/get/mcrypt-1.0.5.tgz - out=mcrypt-1.0.5.tgz -https://pecl.php.net/get/apcu-5.1.22.tgz - out=apcu-5.1.22.tgz \ No newline at end of file diff --git a/docker/download_library_urls.bak.txt b/docker/download_library_urls.bak.txt deleted file mode 100644 index 67fa5bc2..00000000 --- a/docker/download_library_urls.bak.txt +++ /dev/null @@ -1,72 +0,0 @@ -https://www.openssl.org/source/openssl-1.1.1p.tar.gz - out=openssl-1.1.1p.tar.gz -https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz - out=libiconv-1.16.tar.gz -https://gitlab.gnome.org/GNOME/libxml2/-/archive/v2.9.10/libxml2-v2.9.10.tar.gz - out=libxml2-v2.9.10.tar.gz -https://gitlab.gnome.org/GNOME/libxslt/-/archive/v1.1.34/libxslt-v1.1.34.tar.gz - out=libxslt-v1.1.34.tar.gz -https://github.com/google/brotli/archive/refs/tags/v1.0.9.tar.gz - out=brotli-1.0.9.tar.gz -https://c-ares.org/download/c-ares-1.19.0.tar.gz - out=c-ares-1.19.0.tar.gz -https://gmplib.org/download/gmp/gmp-6.2.1.tar.lz - out=gmp-6.2.1.tar.lz -https://mirrors.tuna.tsinghua.edu.cn/gnu/ncurses/ncurses-6.3.tar.gz https://mirrors.ustc.edu.cn/gnu/ncurses/ncurses-6.3.tar.gz https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.3.tar.gz - out=ncurses-6.3.tar.gz -https://mirrors.tuna.tsinghua.edu.cn/gnu/readline/readline-8.2.tar.gz https://mirrors.ustc.edu.cn/gnu/readline/readline-8.2.tar.gz https://ftp.gnu.org/gnu/readline/readline-8.2.tar.gz - out=readline-8.2.tar.gz -https://pyyaml.org/download/libyaml/yaml-0.2.5.tar.gz - out=yaml-0.2.5.tar.gz -https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz - out=libsodium-1.0.18.tar.gz -https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz - out=bzip2-1.0.8.tar.gz -https://udomain.dl.sourceforge.net/project/libpng/zlib/1.2.11/zlib-1.2.11.tar.gz - out=zlib-1.2.11.tar.gz -https://github.com/lz4/lz4/archive/refs/tags/v1.9.4.tar.gz - out=lz4-v1.9.4.tar.gz -https://github.com/tukaani-project/xz/releases/download/v5.4.1/xz-5.4.1.tar.gz - out=xz-5.4.1.tar.gz -https://github.com/facebook/zstd/releases/download/v1.5.2/zstd-1.5.2.tar.gz - out=zstd-1.5.2.tar.gz -https://libzip.org/download/libzip-1.9.2.tar.gz - out=libzip-1.9.2.tar.gz -https://www.sqlite.org/2021/sqlite-autoconf-3370000.tar.gz - out=sqlite-autoconf-3370000.tar.gz -https://github.com/unicode-org/icu/releases/download/release-60-3/icu4c-60_3-src.tgz - out=icu4c-60_3-src.tgz -https://codeload.github.com/kkos/oniguruma/tar.gz/refs/tags/v6.9.7 - out=oniguruma-6.9.7.tar.gz -https://github.com/microsoft/mimalloc/archive/refs/tags/v2.0.7.tar.gz - out=mimalloc-2.0.7.tar.gz -https://codeload.github.com/libjpeg-turbo/libjpeg-turbo/tar.gz/refs/tags/2.1.2 - out=libjpeg-turbo-2.1.2.tar.gz -https://nchc.dl.sourceforge.net/project/giflib/giflib-5.2.1.tar.gz - out=giflib-5.2.1.tar.gz -https://nchc.dl.sourceforge.net/project/libpng/libpng16/1.6.37/libpng-1.6.37.tar.gz - out=libpng-1.6.37.tar.gz -https://codeload.github.com/webmproject/libwebp/tar.gz/refs/tags/v1.2.1 - out=libwebp-1.2.1.tar.gz -https://download.savannah.gnu.org/releases/freetype/freetype-2.10.4.tar.gz - out=freetype-2.10.4.tar.gz -https://github.com/ImageMagick/ImageMagick/archive/refs/tags/7.1.0-62.tar.gz - out=ImageMagick-v7.1.0-62.tar.gz -https://ftp.gnu.org/gnu/libidn/libidn2-2.3.4.tar.gz - out=libidn2-2.3.4.tar.gz -https://curl.se/download/curl-7.88.0.tar.gz - out=curl-7.88.0.tar.gz -https://ftp.postgresql.org/pub/source/v15.1/postgresql-15.1.tar.gz - out=postgresql-15.1.tar.gz -https://github.com/libffi/libffi/releases/download/v3.4.4/libffi-3.4.4.tar.gz - out=libffi-3.4.4.tar.gz -https://github.com/winlibs/libmcrypt/archive/refs/tags/libmcrypt-2.5.8-3.4.tar.gz - out=libmcrypt-2.5.8-3.4.tar.gz -https://github.com/jmcnamara/libxlsxwriter/archive/refs/tags/RELEASE_1.1.5.tar.gz - out=libxlsxwriter-1.1.5.tar.gz -https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz - out=libevent-2.1.12-stable.tar.gz -https://github.com/libuv/libuv/archive/refs/tags/v1.44.2.tar.gz - out=libuv-v1.44.2.tar.gz -https://github.com/php/php-src/archive/refs/tags/php-8.1.12.tar.gz - out=php-8.1.12.tar.gz \ No newline at end of file diff --git a/docker/download_library_urls.txt b/docker/download_library_urls.txt deleted file mode 100644 index afdcb4dd..00000000 --- a/docker/download_library_urls.txt +++ /dev/null @@ -1,4 +0,0 @@ -https://github.com/winlibs/libmcrypt/archive/refs/tags/libmcrypt-2.5.8-3.4.tar.gz - out=libmcrypt-2.5.8-3.4.tar.gz -https://gmplib.org/download/gmp/gmp-6.2.1.tar.lz - out=gmp-6.2.1.tar.lz \ No newline at end of file diff --git a/docker/extensions.txt b/docker/extensions.txt deleted file mode 100755 index d170233f..00000000 --- a/docker/extensions.txt +++ /dev/null @@ -1,44 +0,0 @@ -# Start with '#' is comments -# Start with '^' is deselecting extensions, which is not installed as default -# Each line just leave the extension name or ^ character - -bcmath -calendar -ctype -curl -dom -event -exif -fileinfo -filter -gd -hash -iconv -inotify -json -libxml -mbstring -mongodb -mysqlnd -openssl -pcntl -pdo -pdo_mysql -pdo_sqlite -phar -posix -^protobuf -^readline -redis -shmop -simplexml -soap -sockets -sqlite3 -swoole -tokenizer -xml -xmlreader -xmlwriter -zlib -zip diff --git a/docker/fast-compiler.sh b/docker/fast-compiler.sh deleted file mode 100755 index cb1b0167..00000000 --- a/docker/fast-compiler.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/sh - -# This script needs alpine linux system. - -self_dir=$(cd "$(dirname "$0")";pwd) - -test "$VER_PHP" = "" && VER_PHP="8.1.7" -test "$USE_BACKUP" = "" && USE_BACKUP="no" -test "$ALL_EXTENSIONS" = "" && ALL_EXTENSIONS="all" - -LINK_APK_REPO='mirrors.ustc.edu.cn' -LINK_APK_REPO_BAK='dl-cdn.alpinelinux.org' - -if [ "${USE_BACKUP}" = "yes" ]; then \ - echo "Using backup address..." && sleep 1s - LINK_APK_REPO=${LINK_APK_REPO_BAK} -else - echo "Using original address..." && sleep 1s -fi - -sed -i 's/dl-cdn.alpinelinux.org/'${LINK_APK_REPO}'/g' /etc/apk/repositories - -# build requirements -apk add bash file wget cmake gcc g++ jq autoconf git libstdc++ linux-headers make m4 libgcc binutils ncurses dialog -# php zlib dependencies -apk add zlib-dev zlib-static -# php mbstring dependencies -apk add oniguruma-dev -# php openssl dependencies -apk add openssl-libs-static openssl-dev openssl -# php gd dependencies -apk add libpng-dev libpng-static -# curl c-ares dependencies -apk add c-ares-static c-ares-dev -# php event dependencies -apk add libevent libevent-dev libevent-static -# php sqlite3 dependencies -apk add sqlite sqlite-dev sqlite-libs sqlite-static -# php libzip dependencies -apk add bzip2-dev bzip2-static bzip2 -# php micro ffi dependencies -apk add libffi libffi-dev -# php gd event parent dependencies -apk add zstd-static -# php readline dependencies -apk add readline-static ncurses-static readline-dev - -test "$USE_BACKUP" = "no" && PROMPT_1="mirror" || PROMPT_1="original" - -$self_dir/download.sh swoole ${USE_BACKUP} && \ - $self_dir/download.sh inotify ${USE_BACKUP} && \ - $self_dir/download.sh mongodb ${USE_BACKUP} && \ - $self_dir/download.sh event ${USE_BACKUP} && \ - $self_dir/download.sh redis ${USE_BACKUP} && \ - $self_dir/download.sh libxml2 ${USE_BACKUP} && \ - $self_dir/download.sh xz ${USE_BACKUP} && \ - $self_dir/download.sh protobuf ${USE_BACKUP} && \ - $self_dir/download.sh curl ${USE_BACKUP} && \ - $self_dir/download.sh libzip ${USE_BACKUP} && \ - $self_dir/download.sh libiconv ${USE_BACKUP} && \ - $self_dir/download-git.sh dixyes/phpmicro phpmicro ${USE_BACKUP} && \ - $self_dir/compile-deps.sh && \ - $self_dir/compile-php.sh $PROMPT_1 $VER_PHP $ALL_EXTENSIONS /dist/