diff --git a/README.md b/README.md index e043afd..266902b 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,8 @@ _Original version of this plugin created by [@Stratus3D](https://github.com/Stratus3D)_ +### This repository forked from [asdf-php community](https://github.com/asdf-community/asdf-php) repository due to unmaintained plugin. + ## Build History [![Build history](https://buildstats.info/github/chart/asdf-community/asdf-php?branch=master)](https://github.com/asdf-community/asdf-php/actions) diff --git a/bin/install b/bin/install index c40be12..663096a 100755 --- a/bin/install +++ b/bin/install @@ -15,7 +15,7 @@ install_php() { echo "Determining configuration options..." local source_path=$(get_download_file_path $install_type $version $tmp_download_dir) - local configure_options="$(construct_configure_options $install_path)" + local configure_options="$(construct_configure_options $install_path $version)" local make_flags="-j$ASDF_CONCURRENCY" local operating_system=$(uname -a) @@ -111,6 +111,7 @@ install_composer() { construct_configure_options() { local install_path=$1 + local version=$2 # many options included below are not applicable to newer PHP versions # including these will trigger a build warning, but will not b @@ -149,6 +150,7 @@ construct_configure_options() { --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ --with-xmlrpc \ + --with-xsl \ --with-zip \ --with-zlib \ --without-snmp" @@ -191,6 +193,12 @@ construct_configure_options() { configure_options="$configure_options --without-pcre-jit" fi + version_builtin_opcache="5.5.0" + + if [ $(echo "$version,$version_builtin_opcache" | tr "," "\n" | sort -V -r | head -1) = "$version" ]; then + configure_options="$configure_options --with-opcache" + fi + echo "$configure_options" } @@ -206,11 +214,15 @@ homebrew_package_path() { exit_if_homebrew_not_installed() { if [ "$(brew --version 2>/dev/null)" = "" ]; then - echo "ERROR: Please install homebrew for OSX" - exit 1 + echo "homebrew is not intalled, installing..." + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" fi } +install_dependencies_osx() { + brew install bison icu4c krb5 libedit libxml2 libpq bzip2 freetype gettext libiconv jpeg libpng libzip readline webp zlib gmp libsodium libiconv gmp imagemagick autoconf re2c pkg-config gd openssl@1.1 +} + os_based_configure_options() { local operating_system=$(uname -a) local configure_options="" @@ -219,6 +231,10 @@ os_based_configure_options() { exit_if_homebrew_not_installed + echo "gathering compile dependencies..." + + install_dependencies_osx + local bison_path=$(homebrew_package_path bison) local bzip2_path=$(homebrew_package_path bzip2) local freetype_path=$(homebrew_package_path freetype) @@ -342,6 +358,8 @@ os_based_configure_options() { else local jpeg_path=$(locate libjpeg.so | awk '{ print length(), $0 | "sort -n" }' | cut -d" " -f2- | head -n 1) local libpng_path=$(locate libpng.so | awk '{ print length(), $0 | "sort -n" }' | cut -d" " -f2- | head -n 1) + local libgmp_path=$(dirname $(locate libgmp.so | awk '{ print length(), $0 | "sort -n" }' | cut -d" " -f2- | head -n 1)) + local libsodium_path=$(dirname $(locate libsodium.so | awk '{ print length(), $0 | "sort -n" }' | cut -d" " -f2- | head -n 1)) configure_options="--with-openssl --with-curl --with-zlib --with-readline --with-gettext" if [ "$jpeg_path" = "" ]; then @@ -355,6 +373,18 @@ os_based_configure_options() { else configure_options="$configure_options --with-png-dir=$libpng_path --with-png" fi + + if [ "$libgmp_path" = "" ]; then + export ASDF_PKG_MISSING="$ASDF_PKG_MISSING gmp" + else + configure_options="$configure_options --with-gmp" + fi + + if [ "$libsodium_path" = "" ]; then + export ASDF_PKG_MISSING="$ASDF_PKG_MISSING sodium" + else + configure_options="$configure_options --with-sodium" + fi fi echo $configure_options diff --git a/bin/list-all b/bin/list-all index 3c5c3e0..5e8b4b0 100755 --- a/bin/list-all +++ b/bin/list-all @@ -2,17 +2,14 @@ set -eo pipefail -sort_versions() { - sed 'h; s/[+-]/./g; s/.p\([[:digit:]]\)/.z\1/; s/$/.z/; G; s/\n/ /' | - LC_ALL=C sort -t. -k 1,1 -k 2,2n -k 3,3n -k 4,4n -k 5,5n | awk '{print $2}' -} - versions=$( git ls-remote --tags https://github.com/php/php-src.git | grep 'php-' | - awk '!/({})/ {print $2}' | + grep -E -v '\^\{\}' | + cut -f2 | sed 's/refs\/tags\/php-//' | - sort_versions | + grep -E -v -i "rc|alpha|beta|dev|pre" | + sort -V | xargs )