Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added more support on default extensions #179

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
36 changes: 33 additions & 3 deletions bin/install
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -149,6 +150,7 @@ construct_configure_options() {
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-xmlrpc \
--with-xsl \
--with-zip \
--with-zlib \
--without-snmp"
Expand Down Expand Up @@ -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"
}

Expand All @@ -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 [email protected]
}

os_based_configure_options() {
local operating_system=$(uname -a)
local configure_options=""
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
11 changes: 4 additions & 7 deletions bin/list-all
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down
Loading