static-php-cli/multi-version-build.sh

23 lines
735 B
Bash
Raw Normal View History

2021-04-28 01:32:52 +08:00
#!/bin/sh
_main_dir="$(pwd)/"
_build_dir="$_main_dir/build"
mkdir "$_build_dir" > /dev/null 2>&1
2021-04-28 16:25:04 +08:00
for loop in "7.3.28" "7.4.18" "8.0.5"
2021-04-28 01:32:52 +08:00
do
2021-04-28 16:25:04 +08:00
sed -i 's/phpver"|"php") echo ".*/phpver"|"php") echo "'$loop'" ;;/g' "$_main_dir""static-compile-php.sh" && \
2021-04-28 01:32:52 +08:00
rm -rf "$_main_dir""source/php.tar.gz" "$_main_dir""source/php-*" "$_main_dir""php-dist" && \
"$_main_dir""static-compile-php.sh" && \
cp "$_main_dir""php-dist/bin/php" "$_build_dir/" && \
cd "$_build_dir/" && \
2021-04-28 15:38:43 +08:00
tar -zcvf "php-$loop-static-bin-"$(uname -m)".tar.gz" "./php" && \
2021-04-28 01:32:52 +08:00
mv "./php" "./php-$loop" && \
cd "$_main_dir"
if [ $? -ne 0 ]; then
echo "Compile static php-$loop failed!"
exit 1
fi
2021-04-28 16:25:04 +08:00
done