mirror of
https://github.com/jlengrand/asdf-php.git
synced 2026-03-10 08:01:22 +00:00
Improvements to installation script
* More status updates * Output ./configure options for easy debugging * Support sodium and gmp extensions
This commit is contained in:
40
bin/install
40
bin/install
@@ -13,6 +13,7 @@ install_php() {
|
||||
local tmp_download_dir=${TMPDIR%/}
|
||||
fi
|
||||
|
||||
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 make_flags="-j$ASDF_CONCURRENCY"
|
||||
@@ -66,11 +67,13 @@ install_php() {
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Downloading source code..."
|
||||
download_source $install_type $version $source_path
|
||||
|
||||
# Running this in a subshell because we don't to disturb the current
|
||||
# working directory.
|
||||
(
|
||||
echo "Extracting source code..."
|
||||
cd $(dirname $source_path)
|
||||
tar -zxf $source_path || exit 1
|
||||
|
||||
@@ -80,12 +83,20 @@ install_php() {
|
||||
# target=$(get_target)
|
||||
|
||||
# Build PHP
|
||||
echo "Running buildconfig..."
|
||||
./buildconf --force || exit 1
|
||||
echo "Running ./configure $configure_options"
|
||||
./configure $configure_options || exit 1
|
||||
echo "Running make \"$make_flags\""
|
||||
make "$make_flags" || exit 1
|
||||
echo "Running make install..."
|
||||
# make "$make_flags" test || exit 1
|
||||
make "$make_flags" install || exit 1
|
||||
)
|
||||
|
||||
# it's not obvious where php.ini should be placed, let us make it easy for the user
|
||||
mkdir $install_path/conf.d/
|
||||
echo "# add system-wide php configuration options here" > $install_path/conf.d/php.ini
|
||||
}
|
||||
|
||||
install_composer() {
|
||||
@@ -101,6 +112,8 @@ install_composer() {
|
||||
construct_configure_options() {
|
||||
local install_path=$1
|
||||
|
||||
# many options included below are not applicable to newer PHP versions
|
||||
# including these will trigger a build warning, but will not b
|
||||
global_config="--prefix=$install_path \
|
||||
--enable-bcmath \
|
||||
--enable-calendar \
|
||||
@@ -146,12 +159,6 @@ construct_configure_options() {
|
||||
local configure_options="$PHP_CONFIGURE_OPTIONS $global_config"
|
||||
fi
|
||||
|
||||
if [ "${PHP_WITH_GMP:-no}" != "no" ]; then
|
||||
configure_options="$configure_options --with-gmp"
|
||||
else
|
||||
configure_options="$configure_options --without-gmp"
|
||||
fi
|
||||
|
||||
if [ "${PHP_WITHOUT_PEAR:-no}" != "no" ]; then
|
||||
configure_options="$configure_options --without-pear"
|
||||
else
|
||||
@@ -208,8 +215,25 @@ os_based_configure_options() {
|
||||
local webp_path=$(homebrew_package_path webp)
|
||||
local zlib_path=$(homebrew_package_path zlib)
|
||||
|
||||
# optional
|
||||
# if these packages exist they are included in the php compilation
|
||||
local gmp_path=$(homebrew_package_path gmp)
|
||||
local sodium_path=$(homebrew_package_path libsodium)
|
||||
|
||||
if [ -n "$gmp_path" ]; then
|
||||
configure_options="--with-gmp=$gmp_path"
|
||||
else
|
||||
echo "gmp not found, not including in installation"
|
||||
fi
|
||||
|
||||
if [ -n "$sodium_path" ]; then
|
||||
configure_options="$configure_options --with-sodium=$sodium_path"
|
||||
else
|
||||
echo "sodium not found, not including in installation"
|
||||
fi
|
||||
|
||||
if [ -n "$freetype_path" ]; then
|
||||
configure_options="--with-freetype-dir=$freetype_path"
|
||||
configure_options="$configure_options --with-freetype-dir=$freetype_path"
|
||||
else
|
||||
export ASDF_PKG_MISSING="freetype"
|
||||
fi
|
||||
@@ -366,4 +390,4 @@ get_php_version() {
|
||||
}
|
||||
|
||||
install_php $ASDF_INSTALL_TYPE $ASDF_INSTALL_VERSION $ASDF_INSTALL_PATH
|
||||
install_composer $ASDF_INSTALL_PATH
|
||||
install_composer ${ASDF_INSTALL_PATH}
|
||||
|
||||
Reference in New Issue
Block a user