Update to 1.6.0 version (dialog selection and multiarch micro)

This commit is contained in:
crazywhalecc 2022-06-11 01:09:45 +08:00
parent 4b750825e9
commit a72ed9ca16
9 changed files with 209 additions and 239 deletions

View File

@ -28,26 +28,17 @@ jobs:
fi
docker run --rm --privileged multiarch/qemu-user-static:register --reset
fi
- name: Build micro PHP distribution ${{ matrix.php-versions }} for ${{ matrix.arch }}
- name: Build micro and PHP distribution ${{ matrix.php-versions }} for ${{ matrix.arch }}
run: |
if [[ "${{ matrix.arch }}" = "x86_64" ]]; then
MAIN_VERSION=$(echo "${{ matrix.php-versions }}" | awk -F. '{print $1}')
if [[ "$MAIN_VERSION" = "8" ]]; then
cd docker/ && docker build . --file Dockerfile --tag static-micro --build-arg USE_BACKUP_ADDRESS=yes --build-arg COMPILE_PHP_VERSION=${{ matrix.php-versions }} --build-arg COMPILE_MICRO=yes
fi
fi
- name: Build PHP ${{ matrix.php-versions }} for ${{ matrix.arch }}
run: cd docker/ && docker build . --file Dockerfile --tag static-php --build-arg USE_BACKUP_ADDRESS=yes --build-arg COMPILE_PHP_VERSION=${{ matrix.php-versions }}
- name: Push PHP ${{ matrix.php-versions }} to dist
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: Pack PHP ${{ matrix.php-versions }} to archive
run: |
mkdir dist && docker run --rm -v $(pwd)/dist:/dist/ static-php cp php-dist/bin/php /dist/
cd dist && tar -zcvf "php-${{ matrix.php-versions }}-static-bin-${{ matrix.arch }}.tar.gz" ./php && rm ./php && cd ..
if [[ "${{ matrix.arch }}" = "x86_64" ]]; then
MAIN_VERSION=$(echo "${{ matrix.php-versions }}" | awk -F. '{print $1}')
if [[ "$MAIN_VERSION" = "8" ]]; then
docker run --rm -v $(pwd)/dist:/dist static-micro cp /app/source/php-"${{ matrix.php-versions }}"/sapi/micro/micro.sfx /dist/
cd dist && tar -zcvf "micro-${{ matrix.php-versions }}-${{ matrix.arch }}.tar.gz" ./micro.sfx && rm ./micro.sfx && cd ..
fi
cd dist
tar -zcvf "php-${{ matrix.php-versions }}-static-bin-${{ matrix.arch }}.tar.gz" ./php && rm ./php
if [ -f "./micro.sfx" ]; then
tar -zcvf "php-${{ matrix.php-versions }}-${{ matrix.arch }}.tar.gz" ./micro.sfx && rm ./micro.sfx
fi
- name: Deploy to Zhamao Server
uses: easingthemes/ssh-deploy@main

View File

@ -6,31 +6,28 @@ ENV SCRIPT_VERSION=1.5.0
# Download address uses backup address
ARG USE_BACKUP_ADDRESS
ARG COMPILE_PHP_VERSION
ARG COMPILE_MICRO
# (if downloading slowly, consider set it to yes)
ENV USE_BACKUP="${USE_BACKUP_ADDRESS}"
# Version of some manually-installed package
ENV VER_PHP="${COMPILE_PHP_VERSION}"
ENV ENABLE_MICRO="${COMPILE_MICRO}"
# 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}" = "no" ]; then \
echo "Using backup address..." && sleep 3s; \
sed -i 's/dl-cdn.alpinelinux.org/'${LINK_APK_REPO}'/g' /etc/apk/repositories ; \
else \
echo "Using original address..." && sleep 3s; \
RUN if [ "${USE_BACKUP}" = "" ]; then \
export USE_BACKUP="no" ; \
fi
RUN if [ "${USE_BACKUP}" = "yes" ]; then \
echo "Using backup original address..." ; \
else \
echo "Using mirror address..." && \
sed -i 's/dl-cdn.alpinelinux.org/'${LINK_APK_REPO}'/g' /etc/apk/repositories ; \
fi
# build requirements
RUN apk add bash file wget cmake gcc g++ jq autoconf git libstdc++ linux-headers make m4 libgcc binutils ncurses > /dev/null
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
@ -54,42 +51,20 @@ RUN mkdir /app
WORKDIR /app
COPY ac_override_1 /app/
COPY ac_override_2 /app/
COPY download.sh /app/
COPY config.json /app/
COPY ./* /app/
RUN chmod +x /app/download.sh
RUN chmod +x /app/*.sh
RUN echo "Downloading Extensions ..."
RUN ./download.sh swoole ${USE_BACKUP} > /dev/null && \
./download.sh inotify ${USE_BACKUP} > /dev/null && \
./download.sh mongodb ${USE_BACKUP} > /dev/null && \
./download.sh event ${USE_BACKUP} > /dev/null && \
./download.sh redis ${USE_BACKUP} > /dev/null && \
./download.sh libxml2 ${USE_BACKUP} > /dev/null && \
./download.sh xz ${USE_BACKUP} > /dev/null && \
./download.sh curl ${USE_BACKUP} > /dev/null && \
./download.sh libzip ${USE_BACKUP} > /dev/null
RUN ./download.sh swoole ${USE_BACKUP} && \
./download.sh inotify ${USE_BACKUP} && \
./download.sh mongodb ${USE_BACKUP} && \
./download.sh event ${USE_BACKUP} && \
./download.sh redis ${USE_BACKUP} && \
./download.sh libxml2 ${USE_BACKUP} && \
./download.sh xz ${USE_BACKUP} && \
./download.sh curl ${USE_BACKUP} && \
./download.sh libzip ${USE_BACKUP} && \
./download-git.sh dixyes/phpmicro micro ${USE_BACKUP}
RUN echo "Downloading PHP ${VER_PHP} ..."
RUN ./download.sh php ${USE_BACKUP} ${VER_PHP} > /dev/null
COPY extensions.txt /app/
COPY check-extensions.sh /app/
COPY compile-php.sh /app/
COPY compile-micro.sh /app/
RUN chmod +x ./check-extensions.sh && \
chmod +x ./compile-php.sh && \
chmod +x ./compile-micro.sh
RUN echo "Checking and Compiling Dependencies ..."
RUN ./check-extensions.sh check_before_configure > /dev/null
RUN echo "Compiling PHP ..."
RUN if [ "${ENABLE_MICRO}" = "yes" ]; then \
./compile-micro.sh ${VER_PHP} ${USE_BACKUP} ; \
else \
./compile-php.sh ${VER_PHP} > /dev/null 2>&1 ; \
fi
RUN ./compile-deps.sh
RUN echo -e "#!/usr/bin/env bash\n/app/compile-php.sh \$@" > /bin/build-php && chmod +x /bin/build-php

View File

@ -7,18 +7,19 @@
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_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!" && sleep 2s && \
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!" && sleep 2s
echo "libxml2 compiled!"
}
function do_libzip_compiler() {
@ -28,7 +29,7 @@ function do_libzip_compiler() {
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!" && sleep 2s
echo "libzip compiled!"
}
function do_curl_compiler() {
@ -47,8 +48,7 @@ function do_curl_compiler() {
make -j$(cat /proc/cpuinfo | grep processor | wc -l) && \
make install && \
echo "curl compiled!" && \
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"
}
function do_copy_extension() {
@ -61,7 +61,7 @@ function do_copy_extension() {
}
function check_before_configure() {
list=$(cat "$self_dir/extensions.txt" | grep -v "^#" | grep -v "^$")
list=$(cat "$EXT_LIST_FILE" | grep -v "^#" | grep -v "^$")
xml_sign="no"
for loop in $list
do
@ -90,39 +90,9 @@ function check_before_configure() {
sqlite3) ;;
tokenizer) ;;
zlib) ;;
zip)
if [ ! -f "$self_dir/source/.libzip_compiled" ]; then
do_libzip_compiler
touch "$self_dir/source/.libzip_compiled"
fi
if [ $? != 0 ]; then
echo "Compile libzip error!"
exit 1
fi
;;
curl)
if [ ! -f "$self_dir/source/.curl_compiled" ]; then
do_curl_compiler
touch "$self_dir/source/.curl_compiled"
fi
if [ $? != 0 ]; then
echo "Compile curl error!"
exit 1
fi
;;
dom|xml|libxml|xmlreader|xmlwriter|simplexml|soap)
if [ "$xml_sign" = "no" ]; then
if [ ! -f "$self_dir/source/.xml_compiled" ]; then
do_xml_compiler
touch "$self_dir/source/.xml_compiled"
fi
if [ $? != 0 ]; then
echo "Compile xml error!"
exit 1
fi
xml_sign="yes"
fi
;;
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 ;;
@ -130,11 +100,17 @@ function check_before_configure() {
event) do_copy_extension event ;;
esac
done
case $1 in
8.*)
mv $self_dir/source/micro $php_dir/sapi/ && \
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 "$self_dir/extensions.txt" | sed 's/#.*//g' | sed -e 's/[ ]*$//g' | grep -v "^\s*$")
list=$(cat "$EXT_LIST_FILE" | sed 's/#.*//g' | sed -e 's/[ ]*$//g' | grep -v "^\s*$")
for loop in $list
do
case $loop in
@ -213,11 +189,14 @@ function check_in_configure() {
;;
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 "$self_dir/extensions.txt" | grep -v "^#" | grep -v "^$")
list=$(cat "$EXT_LIST_FILE" | grep -v "^#" | grep -v "^$")
for loop in $list
do
case $loop in
@ -227,6 +206,9 @@ function check_after_configure() {
;;
esac
done
case $1 in
8.*) sed -ie 's/$(EXTRA_LIBS:-lresolv=-Wl,-Bstatic,-lresolv,-Bdynamic)/$(EXTRA_LIBS)/g' "$php_dir/Makefile" ;;
esac
}
$1 $2

46
docker/compile-deps.sh Executable file
View File

@ -0,0 +1,46 @@
#!/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!"
}
do_xml_compiler && do_curl_compiler && do_libzip_compiler

View File

@ -1,40 +0,0 @@
#!/bin/sh
VER_PHP="$1"
USE_BACKUP="$2"
self_dir=$(cd "$(dirname "$0")";pwd)
php_dir=$(find $self_dir/source -name "php-$VER_PHP" -type d | tail -n1)
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-ffi"
_php_arg="$_php_arg --enable-micro=all-static"
_php_arg="$_php_arg $($self_dir/check-extensions.sh check_in_configure $1)"
echo $_php_arg
}
php_compile_args && sleep 1s
test "$USE_BACKUP" = "no" && GITHUB_ADDR="fgit.zhamao.me" || GITHUB_ADDR="github.com"
cd $php_dir && \
git clone https://$GITHUB_ADDR/dixyes/phpmicro.git --depth=1 sapi/micro && \
./buildconf --force && \
./configure LDFLAGS=-static $(php_compile_args $VER_PHP) && \
$self_dir/check-extensions.sh check_after_configure && \
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" && \
sed -ie 's/$(EXTRA_LIBS:-lresolv=-Wl,-Bstatic,-lresolv,-Bdynamic)/$(EXTRA_LIBS)/g' "Makefile" && \
make LDFLAGS="-ldl" micro -j$(cat /proc/cpuinfo | grep processor | wc -l)
#make install
#strip $self_dir/php-dist/bin/php

View File

@ -1,10 +1,19 @@
#!/bin/sh
VER_PHP="$1"
#!/usr/bin/env bash
self_dir=$(cd "$(dirname "$0")";pwd)
php_dir=$(find $self_dir/source -name "php-$VER_PHP" -type d | tail -n1)
# 通过 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 <space> to select or deselect items\n\n** Default is compiling all **\" 24 60 20 " > $self_dir/.ask_cmd.sh
for loop in $list
do
echo -n "$loop '$loop Extension' on " >> $self_dir/.ask_cmd.sh
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"
@ -19,14 +28,81 @@ function php_compile_args() {
echo $_php_arg
}
php_compile_args && sleep 1s
# 第一个参数用于使用镜像地址还是原地址mirror为镜像地址original为原地址
if [ "$1" = "" ]; then
dialog --backtitle "static-php-cli Compile Options" --yesno "<Yes>: Use mirror download address, mainland China users recommended.\n\n<No>: 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 ..."
$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 && \
$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" && \
make LDFLAGS="-ldl -llzma -lbz2" -j$(cat /proc/cpuinfo | grep processor | wc -l) && \
make install && \
strip $self_dir/php-dist/bin/php
#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 && \
strip $self_dir/php-dist/bin/php && \
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 ; }

7
docker/download-git.sh Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
self_dir=$(cd "$(dirname "$0")";pwd)
test "$3" != "yes" && GITHUB_ADDR="hub.fastgit.xyz" || GITHUB_ADDR="github.com"
git clone https://$GITHUB_ADDR/$1.git --depth=1 $self_dir/source/$2

View File

@ -2,8 +2,11 @@
# 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="no"
LINK_APK_REPO='mirrors.ustc.edu.cn'
LINK_APK_REPO_BAK='dl-cdn.alpinelinux.org'
@ -38,17 +41,17 @@ apk add bzip2-dev bzip2-static bzip2
# php micro ffi dependencies
apk add libffi libffi-dev
chmod +x download.sh check-extensions.sh compile-php.sh compile-micro.sh
test "$USE_BACKUP" = "no" && PROMPT_1="mirror" || PROMPT_1="original"
./download.sh swoole ${USE_BACKUP} && \
./download.sh inotify ${USE_BACKUP} && \
./download.sh mongodb ${USE_BACKUP} && \
./download.sh event ${USE_BACKUP} && \
./download.sh redis ${USE_BACKUP} && \
./download.sh libxml2 ${USE_BACKUP} && \
./download.sh xz ${USE_BACKUP} && \
./download.sh curl ${USE_BACKUP} && \
./download.sh libzip ${USE_BACKUP} && \
./download.sh php ${USE_BACKUP} ${VER_PHP} && \
./check-extensions.sh check_before_configure && \
./compile-php.sh ${VER_PHP}
$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 curl ${USE_BACKUP} && \
$self_dir/download.sh libzip ${USE_BACKUP} && \
$self_dir/download-git.sh dixyes/phpmicro micro ${USE_BACKUP} && \
$self_dir/compile-deps.sh && \
$self_dir/compile-php.sh $PROMPT_1 $VER_PHP $ALL_EXTENSIONS /dist/

View File

@ -1,70 +0,0 @@
#!/bin/sh
test "$USE_BACKUP" = "" && USE_BACKUP="no"
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
# 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
chmod +x download.sh check-extensions.sh compile-php.sh
./download.sh swoole ${USE_BACKUP} && \
./download.sh inotify ${USE_BACKUP} && \
./download.sh mongodb ${USE_BACKUP} && \
./download.sh event ${USE_BACKUP} && \
./download.sh redis ${USE_BACKUP} && \
./download.sh libxml2 ${USE_BACKUP} && \
./download.sh xz ${USE_BACKUP} && \
./download.sh curl ${USE_BACKUP} && \
./download.sh libzip ${USE_BACKUP}
if [ ! -d "multi-build" ]; then
mkdir ./multi-build
fi
for VER_PHP in "7.2.34" "7.3.33" "7.4.29" "8.0.18" "8.1.5"
do
./download.sh swoole ${USE_BACKUP} && \
./download.sh inotify ${USE_BACKUP} && \
./download.sh mongodb ${USE_BACKUP} && \
./download.sh event ${USE_BACKUP} && \
./download.sh redis ${USE_BACKUP} && \
./download.sh libxml2 ${USE_BACKUP} && \
./download.sh xz ${USE_BACKUP} && \
./download.sh curl ${USE_BACKUP} && \
./download.sh libzip ${USE_BACKUP} && \
./download.sh php ${USE_BACKUP} ${VER_PHP} && \
./check-extensions.sh check_before_configure && \
./compile-php.sh ${VER_PHP} && \
cp ./php-dist/bin/php ./multi-build/php-${VER_PHP} && \
rm -rf ./source
done