mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
Add readline support
This commit is contained in:
parent
1dd4ad9cc1
commit
ed2b320271
@ -43,9 +43,13 @@ 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
|
||||
RUN apk add bzip2-dev bzip2-static bzip2 > /dev/null
|
||||
# php micro ffi dependencies
|
||||
RUN apk add libffi libffi-dev
|
||||
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 mkdir /app
|
||||
|
||||
@ -64,7 +68,7 @@ RUN ./download.sh swoole ${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}
|
||||
./download-git.sh dixyes/phpmicro phpmicro ${USE_BACKUP}
|
||||
|
||||
RUN ./compile-deps.sh
|
||||
RUN echo -e "#!/usr/bin/env bash\n/app/compile-php.sh \$@" > /bin/build-php && chmod +x /bin/build-php
|
||||
|
||||
@ -9,46 +9,6 @@ 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!" && \
|
||||
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_copy_extension() {
|
||||
ext_dir=$(find $self_dir/source -name "*$1-*" -type d | tail -n1)
|
||||
@ -84,6 +44,13 @@ function check_before_configure() {
|
||||
pdo_sqlite) ;;
|
||||
phar) ;;
|
||||
posix) ;;
|
||||
readline)
|
||||
if [ ! -d "/nom" ]; then
|
||||
mkdir /nom
|
||||
fi
|
||||
mv /usr/lib/libreadline.so* /nom/ && \
|
||||
mv /usr/lib/libncurses*.so* /nom
|
||||
;;
|
||||
shmop) ;;
|
||||
sockets) ;;
|
||||
sqlite3) ;;
|
||||
@ -119,7 +86,7 @@ function check_in_configure() {
|
||||
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-core --with-event-extra --with-event-openssl" ;;
|
||||
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)
|
||||
@ -155,6 +122,7 @@ function check_in_configure() {
|
||||
pdo_mysql) php_configure="$php_configure --with-pdo-mysql=mysqlnd" ;;
|
||||
phar) php_configure="$php_configure --enable-phar" ;;
|
||||
posix) php_configure="$php_configure --enable-posix" ;;
|
||||
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" ;;
|
||||
@ -210,4 +178,11 @@ function check_after_configure() {
|
||||
esac
|
||||
}
|
||||
|
||||
function finish_compile() {
|
||||
if [ -d "/nom" ]; then
|
||||
mv /nom/* /usr/lib/ || echo "Empty directory"
|
||||
rm -rf /nom/
|
||||
fi
|
||||
}
|
||||
|
||||
$1 $2
|
||||
|
||||
@ -84,7 +84,12 @@ if [ ! -d "$OUT_DIR" ]; then
|
||||
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 ; }
|
||||
@ -100,6 +105,7 @@ cd $php_dir && \
|
||||
#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 && \
|
||||
echo "Copying php binary to $OUT_DIR ..." && \
|
||||
cp $self_dir/php-dist/bin/php $OUT_DIR/ && \
|
||||
|
||||
@ -13,7 +13,7 @@ else
|
||||
curl -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/ && \
|
||||
mv $2-master/ cache/$2 && \
|
||||
cp -r cache/$2 ./
|
||||
fi
|
||||
|
||||
|
||||
@ -23,6 +23,7 @@ pdo_mysql
|
||||
pdo_sqlite
|
||||
phar
|
||||
posix
|
||||
readline
|
||||
redis
|
||||
shmop
|
||||
simplexml
|
||||
|
||||
@ -6,7 +6,7 @@ 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"
|
||||
test "$ALL_EXTENSIONS" = "" && ALL_EXTENSIONS="all"
|
||||
|
||||
LINK_APK_REPO='mirrors.ustc.edu.cn'
|
||||
LINK_APK_REPO_BAK='dl-cdn.alpinelinux.org'
|
||||
@ -21,7 +21,7 @@ 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
|
||||
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
|
||||
@ -40,6 +40,10 @@ apk add sqlite sqlite-dev sqlite-libs sqlite-static
|
||||
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"
|
||||
|
||||
@ -52,6 +56,6 @@ $self_dir/download.sh swoole ${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/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/
|
||||
$self_dir/compile-php.sh $PROMPT_1 $VER_PHP $ALL_EXTENSIONS /dist/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user