fix micro error bug

This commit is contained in:
crazywhalecc 2022-05-16 15:51:11 +08:00
parent 347419ee53
commit f7162cbc79
3 changed files with 10 additions and 8 deletions

View File

@ -21,7 +21,7 @@ ENV ENABLE_MICRO="${COMPILE_MICRO}"
ENV LINK_APK_REPO='mirrors.ustc.edu.cn'
ENV LINK_APK_REPO_BAK='dl-cdn.alpinelinux.org'
RUN if [ "${USE_BACKUP}" = "yes" ]; then \
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 \
@ -89,7 +89,7 @@ RUN ./check-extensions.sh check_before_configure > /dev/null
RUN echo "Compiling PHP ..."
RUN if [ "${ENABLE_MICRO}" = "yes" ]; then \
./compile-micro.sh ${VER_PHP} ; \
./compile-micro.sh ${VER_PHP} ${USE_BACKUP} ; \
else \
./compile-php.sh ${VER_PHP} > /dev/null 2>&1 ; \
fi

View File

@ -1,6 +1,7 @@
#!/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)
@ -23,16 +24,18 @@ function php_compile_args() {
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.com/dixyes/phpmicro.git --depth=1 sapi/micro && \
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/-o $(SAPI_MICRO_PATH)/-all-static -o $(SAPI_MICRO_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/$(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 micro LDFLAGS="-static" -j$(cat /proc/cpuinfo | grep processor | wc -l)
#make install
make LDFLAGS="-ldl -static" micro -j$(cat /proc/cpuinfo | grep processor | wc -l)
#make install
#strip $self_dir/php-dist/bin/php

View File

@ -51,5 +51,4 @@ chmod +x download.sh check-extensions.sh compile-php.sh compile-micro.sh
./download.sh libzip ${USE_BACKUP} && \
./download.sh php ${USE_BACKUP} ${VER_PHP} && \
./check-extensions.sh check_before_configure && \
./compile-micro.sh ${VER_PHP}
./compile-php.sh ${VER_PHP}