diff --git a/mod_php_install.sh b/mod_php_install.sh index 15f2147..6ffee88 100755 --- a/mod_php_install.sh +++ b/mod_php_install.sh @@ -557,114 +557,54 @@ IFS='.' read -r major minor patch <<< "$VERSION" declare -i PHP_VERSION_NUM=$((10#$major * 10000 + 10#$minor * 100 + 10#$patch)) declare -i PHP_MAIN_VERSION_NUM=$((10#$major * 10000 + 10#$minor * 100)) -# version helper scripts -# +# ============================= +# Version Helper Funktionen +# ============================= + +# ---------------------------- +# Vollversion → numerische Zahl +# ---------------------------- version_to_number() { - local a b c - IFS='.' read -r a b c <<< "$1" - echo $((10#$a * 10000 + 10#$b * 100 + 10#${c:-0})) + local ver=${1:-$VERSION} + local a b c + IFS='.' read -r a b c <<< "$ver" + echo $((10#$a * 10000 + 10#$b * 100 + 10#${c:-0})) } -version_eq() { - local v1=$(version_to_number "$1") - local v2=$(version_to_number "$2") - (( v1 == v2 )) -} +# Vergleichsfunktionen für volle Versionen +version_eq() { local ref=$1; (( $(version_to_number "$VERSION") == $(version_to_number "$ref") )); } +version_lt() { local ref=$1; (( $(version_to_number "$VERSION") < $(version_to_number "$ref") )); } +version_le() { local ref=$1; (( $(version_to_number "$VERSION") <= $(version_to_number "$ref") )); } +version_gt() { local ref=$1; (( $(version_to_number "$VERSION") > $(version_to_number "$ref") )); } +version_ge() { local ref=$1; (( $(version_to_number "$VERSION") >= $(version_to_number "$ref") )); } -version_lt() { - local v1=$(version_to_number "$1") - local v2=$(version_to_number "$2") - (( v1 < v2 )) -} +version_num() { version_to_number "${1:-$VERSION}"; } -version_le() { - local v1=$(version_to_number "$1") - local v2=$(version_to_number "$2") - (( v1 <= v2 )) -} -version_gt() { - local v1=$(version_to_number "$1") - local v2=$(version_to_number "$2") - (( v1 > v2 )) -} - -version_ge() { - local v1=$(version_to_number "$1") - local v2=$(version_to_number "$2") - (( v1 >= v2 )) -} - -main_version_eq() { - local a b x y - IFS='.' read -r a b _ <<< "$1" - IFS='.' read -r x y _ <<< "$2" - - local v1=$((10#$a * 100 + 10#$b)) - local v2=$((10#$x * 100 + 10#$y)) - - (( v1 == v2 )) -} - -main_version_lt() { - local a b x y - IFS='.' read -r a b _ <<< "$1" - IFS='.' read -r x y _ <<< "$2" - - local v1=$((10#$a * 100 + 10#$b)) - local v2=$((10#$x * 100 + 10#$y)) - (( v1 < v2 )) -} - -main_version_le() { - local a b x y - IFS='.' read -r a b _ <<< "$1" - IFS='.' read -r x y _ <<< "$2" - - local v1=$((10#$a * 100 + 10#$b)) - local v2=$((10#$x * 100 + 10#$y)) - - (( v1 <= v2 )) -} - -main_version_gt() { - local a b x y - IFS='.' read -r a b _ <<< "$1" - IFS='.' read -r x y _ <<< "$2" - - local v1=$((10#$a * 100 + 10#$b)) - local v2=$((10#$x * 100 + 10#$y)) - (( v1 > v2 )) -} - -main_version_ge() { - local a b x y - IFS='.' read -r a b _ <<< "$1" - IFS='.' read -r x y _ <<< "$2" - - local v1=$((10#$a * 100 + 10#$b)) - local v2=$((10#$x * 100 + 10#$y)) - - (( v1 <= v2 )) -} - -# --- Hauptversion in numerischer Form (Major*100 + Minor) -main_version_num() { - local a b - IFS='.' read -r a b _ <<< "$1" +# ---------------------------- +# Main-Version → numerische Zahl (Major*100 + Minor) +# ---------------------------- +main_version_to_number() { + local ver=${1:-$PHP_MAIN_VERSION} + IFS='.' read -r a b _ <<< "$ver" echo $((10#$a * 100 + 10#$b)) } -# --- Vollständige Version in numerischer Form (Major*10000 + Minor*100 + Patch) -version_num() { - version_to_number "$1" -} +# Vergleichsfunktionen für Main-Versionen +main_version_eq() { local ref=$1; (( $(main_version_to_number "$PHP_MAIN_VERSION") == $(main_version_to_number "$ref") )); } +main_version_lt() { local ref=$1; (( $(main_version_to_number "$PHP_MAIN_VERSION") < $(main_version_to_number "$ref") )); } +main_version_le() { local ref=$1; (( $(main_version_to_number "$PHP_MAIN_VERSION") <= $(main_version_to_number "$ref") )); } +main_version_gt() { local ref=$1; (( $(main_version_to_number "$PHP_MAIN_VERSION") > $(main_version_to_number "$ref") )); } +main_version_ge() { local ref=$1; (( $(main_version_to_number "$PHP_MAIN_VERSION") >= $(main_version_to_number "$ref") )); } + +main_version_num() { main_version_to_number "${1:-$PHP_MAIN_VERSION}"; } + # Since version 7.4 package 'libsqlite3-dev' is needed # Since version 7.4 package 'libonig-dev' is needed # #if (( PHP_MAIN_VERSION_NUM >= 70400 )); then -if version_ge "$VERSION" "7.4.0"; then +if version_ge "7.4.0"; then needed_debian_packages="$needed_debian_packages libsqlite3-dev libonig-dev" @@ -673,18 +613,18 @@ fi # - A hack, because configure don't work with systemd on version 5.4.x ## - #if (( PHP_MAIN_VERSION_NUM == 50400 )) ; then -if main_version_eq "${VERSION}" "5.4"; then +if main_version_eq "5.4"; then SYSTEMD_EXISTS=false fi ## - Let make use multiple cores (-j) ## - -if ! main_version_eq "$VERSION" "5.4"; then +if ! main_version_eq "5.4"; then export MAKEFLAGS=-j$(expr `grep "^processor" /proc/cpuinfo | sort -u | wc -l` + 1) else unset MAKEFLAGS fi -if main_version_eq "$VERSION" "5.6" && +if main_version_eq "5.6" && (( os_version >= 13 )) && [[ "$os_dist" == "debian" ]] ; then @@ -701,7 +641,7 @@ if main_version_eq "$VERSION" "5.6" && \t cyrus-sasl compiled against openssl 1.1 \t openldap compiled against cyrus-sasl" -elif main_version_eq "$VERSION" "5.6" && +elif main_version_eq "5.6" && (( os_version >= 12 )) && [[ "$os_dist" == "debian" ]] ; then @@ -712,7 +652,7 @@ elif main_version_eq "$VERSION" "5.6" && \t icu4c (libicu) \t openssl v 1.1.1" -elif main_version_eq "$VERSION" "5.6" && +elif main_version_eq "5.6" && (( os_version >= 10 )) && [[ "$os_dist" == "debian" ]] ; then @@ -6067,7 +6007,7 @@ fi _patch_file="php-5.6-zlib-1.2.11.patch" echononl "\tApply ${_patch_file}" -if main_version_le "$VERSION" "7.3" && (( os_version >= 13 )); then +if main_version_le "7.3" && (( os_version >= 13 )); then if [[ -f "${_srcdir}/${_patch_file}" ]] ; then patch -d $_builddir -p0 < ${_srcdir}/${_patch_file} > $tmp_err_msg 2>&1 if [[ $? -eq 0 ]]; then @@ -6108,7 +6048,7 @@ fi _patch_file="php-5.6-libmagic.patch" echononl "\tApply ${_patch_file}" -if main_version_le "$VERSION" "7.3" && (( os_version >= 13 )); then +if main_version_le "7.3" && (( os_version >= 13 )); then if [[ -f "${_srcdir}/${_patch_file}" ]] ; then patch -d $_builddir -p0 < ${_srcdir}/${_patch_file} > $tmp_err_msg 2>&1 if [[ $? -eq 0 ]]; then @@ -6149,7 +6089,7 @@ fi _patch_file="php-5.6-mbfl_encoding.patch" echononl "\tApply ${_patch_file}" -if main_version_le "$VERSION" "7.3" && (( os_version >= 13 )); then +if main_version_le "7.3" && (( os_version >= 13 )); then if [[ -f "${_srcdir}/${_patch_file}" ]] ; then patch -d $_builddir -p0 < ${_srcdir}/${_patch_file} > $tmp_err_msg 2>&1 if [[ $? -eq 0 ]]; then @@ -6190,7 +6130,7 @@ fi _patch_file="php-5.6-mbfl_put_invalid_char.patch" echononl "\tApply ${_patch_file}" -if main_version_le "$VERSION" "7.3" && (( os_version >= 13 )); then +if main_version_le "7.3" && (( os_version >= 13 )); then if [[ -f "${_srcdir}/${_patch_file}" ]] ; then patch -d $_builddir -p0 < ${_srcdir}/${_patch_file} > $tmp_err_msg 2>&1 if [[ $? -eq 0 ]]; then @@ -6231,7 +6171,7 @@ fi _patch_file="php-5.6-session.patch" echononl "\tApply ${_patch_file}" -if main_version_le "$VERSION" "7.3" && (( os_version >= 13 )); then +if main_version_le "7.3" && (( os_version >= 13 )); then if [[ -f "${_srcdir}/${_patch_file}" ]] ; then patch -d $_builddir -p0 < ${_srcdir}/${_patch_file} > $tmp_err_msg 2>&1 if [[ $? -eq 0 ]]; then @@ -6272,7 +6212,7 @@ fi _patch_file="php-5.6-wddx.patch" echononl "\tApply ${_patch_file}" -if main_version_le "$VERSION" "7.3" && (( os_version >= 13 )); then +if main_version_le "7.3" && (( os_version >= 13 )); then if [[ -f "${_srcdir}/${_patch_file}" ]] ; then patch -d $_builddir -p0 < ${_srcdir}/${_patch_file} > $tmp_err_msg 2>&1 if [[ $? -eq 0 ]]; then @@ -6313,7 +6253,7 @@ fi _patch_file="php-5.6-mkstemp.patch" echononl "\tApply ${_patch_file}" -if main_version_le "$VERSION" "7.3" && (( os_version >= 13 )); then +if main_version_le "7.3" && (( os_version >= 13 )); then if [[ -f "${_srcdir}/${_patch_file}" ]] ; then patch -d $_builddir -p0 < ${_srcdir}/${_patch_file} > $tmp_err_msg 2>&1 if [[ $? -eq 0 ]]; then @@ -6354,7 +6294,7 @@ fi _patch_file="php-5.6-reentrancy.patch" echononl "\tApply ${_patch_file}" -if main_version_le "$VERSION" "7.3" && (( os_version >= 13 )); then +if main_version_le "7.3" && (( os_version >= 13 )); then if [[ -f "${_srcdir}/${_patch_file}" ]] ; then patch -d $_builddir -p0 < ${_srcdir}/${_patch_file} > $tmp_err_msg 2>&1 if [[ $? -eq 0 ]]; then @@ -6395,7 +6335,7 @@ fi _patch_file="php-5.6-cast.patch" echononl "\tApply ${_patch_file}" -if main_version_le "$VERSION" "7.3" && (( os_version >= 13 )); then +if main_version_le "7.3" && (( os_version >= 13 )); then if [[ -f "${_srcdir}/${_patch_file}" ]] ; then patch -d $_builddir -p0 < ${_srcdir}/${_patch_file} > $tmp_err_msg 2>&1 if [[ $? -eq 0 ]]; then @@ -6465,7 +6405,7 @@ echononl "\tGoing to configure.." ## CPP="/usr/bin/cpp-3.4" \ ## CFLAGS="$_cflags" LDFLAGS="-s" \ -#if main_version_le "$VERSION" "7.3" && (( os_version >= 13 )); then +#if main_version_le "7.3" && (( os_version >= 13 )); then # export CFLAGS="-O2 -fno-strict-aliasing -Wno-error=incompatible-pointer-types" #fi if $_install_openldap ; then @@ -6475,6 +6415,10 @@ if $_install_openldap ; then -L/usr/local/cyrus-sasl/lib -Wl,-rpath,/usr/local/cyrus-sasl/lib \ -L/usr/local/openssl/lib -Wl,-rpath,/usr/local/openssl/lib" fi +if main_version_eq "7.4" ; then + export CXXFLAGS="-O2 -pipe -std=gnu++17" + export CFLAGS="-O2 -pipe" +fi config_params=" --prefix=$PREFIX_PHP @@ -6551,7 +6495,7 @@ else --with-curl" fi -if main_version_le "$VERSION" "7.3" && (( os_version >= 13 )); then +if main_version_le "7.3" && (( os_version >= 13 )); then if $_install_openldap ; then config_params="${config_params} --with-ldap" @@ -6565,9 +6509,29 @@ fi #if ([[ "$PHP_MAJOR_VERSION" -eq 8 ]] && [[ "$PHP_MINOR_VERSION" -lt 4 ]]) \ # || [[ "$PHP_MAJOR_VERSION" -lt 8 ]] ; then -if [[ "$os_dist" = "debian" ]] && [[ "$os_version" -lt 13 ]] \ - && ( [[ "$PHP_MAJOR_VERSION" -lt 8 ]] \ - || ( [[ "$PHP_MAJOR_VERSION" -eq 8 ]] && [[ "$PHP_MINOR_VERSION" -lt 4 ]] ) ) ; then +#if [[ "$os_dist" = "debian" ]] && [[ "$os_version" -lt 13 ]] \ +# && ( [[ "$PHP_MAJOR_VERSION" -lt 8 ]] \ +# || ( [[ "$PHP_MAJOR_VERSION" -eq 8 ]] && [[ "$PHP_MINOR_VERSION" -lt 4 ]] ) ) ; then +# +# config_params="$config_params +# --with-imap +# --with-imap-ssl +#" +#fi + +#if [[ "$os_family" == "debian" ]] && (( os_version < 13 )) && main_version_lt "8.4"; then +# +# config_params="$config_params +# --with-imap +# --with-imap-ssl +#" +#fi + +if main_version_le "8.3" && \ + ( dpkg -s libc-client-dev >/dev/null 2>&1 \ + || dpkg -s libc-client2007e-dev >/dev/null 2>&1 \ + || dpkg -s libc-client2007f-dev >/dev/null 2>&1 \ + || dpkg -s uw-imap-dev >/dev/null 2>&1 ); then config_params="$config_params --with-imap @@ -9454,9 +9418,8 @@ echo "" >> ${_logdir}/pecl_install.log echononl "\tInstall 'imap' via pecl.." -if ([[ "$PHP_MAJOR_VERSION" -eq 8 ]] && [[ "$PHP_MINOR_VERSION" -ge 4 ]]) \ - || [[ "$PHP_MAJOR_VERSION" -gt 8 ]] \ - || ([[ "$os_dist" = "debian" ]] && [[ "$os_version" -ge 13 ]]) ; then +if main_version_ge "8.3" && \ + ( main_version_ge "8.4" || ([[ "$os_family" == "debian" ]] && (( os_version >= 13 ))) ); then if dpkg -s libc-client-dev > /dev/null 2>&1 \ || dpkg -s libc-client2007e-dev > /dev/null 2>&1 \ @@ -9465,7 +9428,7 @@ if ([[ "$PHP_MAJOR_VERSION" -eq 8 ]] && [[ "$PHP_MINOR_VERSION" -ge 4 ]]) \ export CPPFLAGS="-I/usr/include" export LDFLAGS="-L/usr/lib" - printf "no\nyes\n" | pecl install imap >> "${_logdir}/pecl_install.log" 2>&1 + printf "no\nyes\n" | ${PREFIX_PHP}/bin/pecl install imap >> "${_logdir}/pecl_install.log" 2>&1 if [ "$?" = "0" ]; then echo_ok