Merge pull request #226 from mlocati/pickle-unstable

Install pickle from master when required
pull/227/head
Michele Locati 2020-12-16 12:58:55 +01:00 committed by GitHub
commit 46ae7d7ec7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 63 additions and 23 deletions

View File

@ -287,7 +287,7 @@ buildRequiredPackageLists() {
case "$DISTRO_VERSION" in case "$DISTRO_VERSION" in
alpine@*) alpine@*)
if test $# -gt 1 || test "${1:-}" != '@composer'; then if test $# -gt 1 || test "${1:-}" != '@composer'; then
buildRequiredPackageLists_volatile="$PHPIZE_DEPS" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile $PHPIZE_DEPS"
fi fi
if test -z "$(apk info 2>/dev/null | grep -E ^libssl)"; then if test -z "$(apk info 2>/dev/null | grep -E ^libssl)"; then
buildRequiredPackageLists_libssl='libssl1.0' buildRequiredPackageLists_libssl='libssl1.0'
@ -304,6 +304,9 @@ buildRequiredPackageLists() {
buildRequiredPackageLists_libssldev='libssl([0-9]+(\.[0-9]+)*)?-dev$' buildRequiredPackageLists_libssldev='libssl([0-9]+(\.[0-9]+)*)?-dev$'
;; ;;
esac esac
if test $USE_PICKLE -gt 1; then
buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile git"
fi
while :; do while :; do
if test $# -lt 1; then if test $# -lt 1; then
break break
@ -1655,20 +1658,6 @@ installPECLModule() {
installPECLModule_version=2.9.8 installPECLModule_version=2.9.8
fi fi
fi fi
if test $PHP_MAJMIN_VERSION -ge 800; then
# Workaround for picke problem - see https://github.com/FriendsOfPHP/pickle/issues/188 and https://github.com/FriendsOfPHP/pickle/issues/191
if test -z "$installPECLModule_version"; then
installPECLModule_version=3.0.1
fi
installPECLModule_src="$(getPackageSource https://codeload.github.com/xdebug/xdebug/tar.gz/$installPECLModule_version)"
cd -- "$installPECLModule_src"
phpize
./configure --enable-xdebug
make -j$(getProcessorCount)
make install
cd - >/dev/null
installPECLModule_manuallyInstalled=1
fi
;; ;;
uopz) uopz)
if test -z "$installPECLModule_version"; then if test -z "$installPECLModule_version"; then
@ -1777,17 +1766,42 @@ configureInstaller() {
pecl channel-update pecl.php.net || true pecl channel-update pecl.php.net || true
return return
fi fi
curl -sSLf https://github.com/FriendsOfPHP/pickle/releases/latest/download/pickle.phar -o /tmp/pickle
chmod +x /tmp/pickle
if ! stringInList 'zip' "$PHP_PREINSTALLED_MODULES"; then if ! stringInList 'zip' "$PHP_PREINSTALLED_MODULES"; then
PHP_MODULES_TO_INSTALL="zip $(removeStringFromList 'zip' "$PHP_MODULES_TO_INSTALL")" PHP_MODULES_TO_INSTALL="zip $(removeStringFromList 'zip' "$PHP_MODULES_TO_INSTALL")"
fi fi
if anyStringInList 'xdebug' "$PHP_MODULES_TO_INSTALL"; then
USE_PICKLE=2
else
curl -sSLf https://github.com/FriendsOfPHP/pickle/releases/latest/download/pickle.phar -o /tmp/pickle
chmod +x /tmp/pickle
USE_PICKLE=1 USE_PICKLE=1
fi
return return
fi fi
done done
} }
buildPickle() {
printf '### BUILDING PICKLE ###\n'
buildPickle_tempDir="$(mktemp -p /tmp/src -d)"
cd -- "$buildPickle_tempDir"
printf 'Downloading... '
git clone --quiet --depth 1 https://github.com/FriendsOfPHP/pickle.git .
git tag 0.7.0
printf 'done.\n'
printf 'Installing composer... '
curl -sSLf https://getcomposer.org/installer | php -- --quiet --install-dir=. --filename=composer --1
printf 'done.\n'
printf 'Installing composer dependencies... '
./composer install --no-dev --no-progress --no-suggest --optimize-autoloader --ignore-platform-reqs --quiet
printf 'done.\n'
printf 'Building... '
php -d phar.readonly=0 box.phar build
mv pickle.phar /tmp/pickle
printf 'done.\n'
cd - >/dev/null
}
# Add a configure option for the pecl/pickle install command # Add a configure option for the pecl/pickle install command
# #
# Arguments: # Arguments:
@ -1807,17 +1821,22 @@ addConfigureOption() {
# $1: the package to be installed # $1: the package to be installed
# $2: the package version to be installed (optional) # $2: the package version to be installed (optional)
installPeclPackage() { installPeclPackage() {
if ! test -f "$CONFIGURE_FILE"; then
printf '\n' >"$CONFIGURE_FILE"
fi
if test $USE_PICKLE -eq 0; then
if test -z "${2:-}"; then if test -z "${2:-}"; then
installPeclPackage_fullname="$1" installPeclPackage_fullname="$1"
else else
installPeclPackage_fullname="$1-$2" installPeclPackage_fullname="$1-$2"
fi fi
if ! test -f "$CONFIGURE_FILE"; then
printf '\n' >"$CONFIGURE_FILE"
fi
if test $USE_PICKLE -eq 0; then
cat "$CONFIGURE_FILE" | MAKE="make -j$(getCompilationProcessorCount $1)" pecl install "$installPeclPackage_fullname" cat "$CONFIGURE_FILE" | MAKE="make -j$(getCompilationProcessorCount $1)" pecl install "$installPeclPackage_fullname"
else else
if test -z "${2:-}"; then
installPeclPackage_fullname="$1"
else
installPeclPackage_fullname="$1@$2"
fi
MAKE="make -j$(getCompilationProcessorCount $1)" /tmp/pickle install --tmp-dir=/tmp/pickle.tmp --no-interaction --with-configure-options "$CONFIGURE_FILE" -- "$installPeclPackage_fullname" MAKE="make -j$(getCompilationProcessorCount $1)" /tmp/pickle install --tmp-dir=/tmp/pickle.tmp --no-interaction --with-configure-options "$CONFIGURE_FILE" -- "$installPeclPackage_fullname"
fi fi
} }
@ -1840,6 +1859,24 @@ stringInList() {
return 1 return 1
} }
# Check if at least one item in a list is in another list
#
# Arguments:
# $1: the space-separated list of items to be searched
# $2: the space-separated list of reference items
#
# Return:
# 0 (true): at least one of the items in $1 is in $2
# 1 (false): otherwise
anyStringInList() {
for anyStringInList in $1; do
if stringInList "$1" "$2"; then
return 0
fi
done
return 1
}
# Remove a word from a space-separated list # Remove a word from a space-separated list
# #
# Arguments: # Arguments:
@ -1941,6 +1978,9 @@ fi
if test "$PHP_MODULES_TO_INSTALL" != '@composer'; then if test "$PHP_MODULES_TO_INSTALL" != '@composer'; then
setTargetTriplet setTargetTriplet
fi fi
if test $USE_PICKLE -gt 1; then
buildPickle
fi
for PHP_MODULE_TO_INSTALL in $PHP_MODULES_TO_INSTALL; do for PHP_MODULE_TO_INSTALL in $PHP_MODULES_TO_INSTALL; do
if test "$PHP_MODULE_TO_INSTALL" = '@composer'; then if test "$PHP_MODULE_TO_INSTALL" = '@composer'; then
installComposer installComposer