Make code simple and consistent with other places

Signed-off-by: Sora Morimoto <sora@morimoto.io>
This commit is contained in:
Sora Morimoto
2020-12-15 14:34:58 +09:00
parent 14aeb2f897
commit ae28370d9a

View File

@@ -29,46 +29,40 @@ install_php() {
local libxml2_path=$(homebrew_package_path libxml2)
local openssl_path=$(homebrew_package_path openssl)
if [ -n "${bison_path}" ]; then
if [ -n "$bison_path" ]; then
export "PATH=${bison_path}/bin:${PATH}"
else
echo "bison not installed" 1>&2
return 1
export ASDF_PKG_MISSING="$ASDF_PKG_MISSING bison"
fi
if [ -n "${icu4c_path}" ]; then
if [ -n "$icu4c_path" ]; then
export "PKG_CONFIG_PATH=${icu4c_path}/lib/pkgconfig:${PKG_CONFIG_PATH}"
else
echo "icu4c not installed" 1>&2
return 1
export ASDF_PKG_MISSING="$ASDF_PKG_MISSING icu4c"
fi
if [ -n "${krb5_path}" ]; then
if [ -n "$krb5_path" ]; then
export "PKG_CONFIG_PATH=${krb5_path}/lib/pkgconfig:${PKG_CONFIG_PATH}"
else
echo "krb5 not installed" 1>&2
return 1
export ASDF_PKG_MISSING="$ASDF_PKG_MISSING krb5"
fi
if [ -n "${libedit_path}" ]; then
if [ -n "$libedit_path" ]; then
export "PKG_CONFIG_PATH=${libedit_path}/lib/pkgconfig:${PKG_CONFIG_PATH}"
else
echo "libedit not installed" 1>&2
return 1
export ASDF_PKG_MISSING="$ASDF_PKG_MISSING libedit"
fi
if [ -n "${libxml2_path}" ]; then
if [ -n "$libxml2_path" ]; then
export "PKG_CONFIG_PATH=${libxml2_path}/lib/pkgconfig:${PKG_CONFIG_PATH}"
else
echo "libxml2 not installed" 1>&2
return 1
export ASDF_PKG_MISSING="$ASDF_PKG_MISSING libxml2"
fi
if [ -n "${openssl_path}" ]; then
if [ -n "$openssl_path" ]; then
export "PKG_CONFIG_PATH=${openssl_path}/lib/pkgconfig:${PKG_CONFIG_PATH}"
else
echo "openssl not installed" 1>&2
return 1
export ASDF_PKG_MISSING="$ASDF_PKG_MISSING openssl"
fi
fi
@@ -193,100 +187,108 @@ os_based_configure_options() {
exit_if_homebrew_not_installed
local freetype_path=$(homebrew_package_path freetype)
local bison_path=$(homebrew_package_path bison)
local gettext_path=$(homebrew_package_path gettext)
local icu4c_path=$(homebrew_package_path icu4c)
local webp_path=$(homebrew_package_path webp)
local jpeg_path=$(homebrew_package_path jpeg)
local libpng_path=$(homebrew_package_path libpng)
local openssl_path=$(homebrew_package_path openssl)
local libxml2_path=$(homebrew_package_path libxml2)
local zlib_path=$(homebrew_package_path zlib)
local readline_path=$(homebrew_package_path readline)
local libedit_path=$(homebrew_package_path libedit)
local iconv_path=$(homebrew_package_path libiconv)
local bzip2_path=$(homebrew_package_path bzip2)
local freetype_path=$(homebrew_package_path freetype)
local gettext_path=$(homebrew_package_path gettext)
local iconv_path=$(homebrew_package_path libiconv)
local icu4c_path=$(homebrew_package_path icu4c)
local jpeg_path=$(homebrew_package_path jpeg)
local libedit_path=$(homebrew_package_path libedit)
local libpng_path=$(homebrew_package_path libpng)
local libxml2_path=$(homebrew_package_path libxml2)
local libzip_path=$(homebrew_package_path libzip)
local openssl_path=$(homebrew_package_path openssl)
local readline_path=$(homebrew_package_path readline)
local webp_path=$(homebrew_package_path webp)
local zlib_path=$(homebrew_package_path zlib)
if [ "$freetype_path" = "" ]; then
export ASDF_PKG_MISSING="freetype"
else
if [ -n "$freetype_path" ]; then
configure_options="--with-freetype-dir=$freetype_path"
else
export ASDF_PKG_MISSING="freetype"
fi
if [ "$bison_path" = "" ]; then
if [ -n "$bison_path" ]; then
export ASDF_PKG_MISSING="$ASDF_PKG_MISSING bison"
fi
if [ "$gettext_path" = "" ]; then
export ASDF_PKG_MISSING="$ASDF_PKG_MISSING gettext"
else
if [ -n "$gettext_path" ]; then
configure_options="$configure_options --with-gettext=$gettext_path"
else
export ASDF_PKG_MISSING="$ASDF_PKG_MISSING gettext"
fi
if [ "$icu4c_path" = "" ]; then
export ASDF_PKG_MISSING="$ASDF_PKG_MISSING icu4c"
else
if [ -n "$icu4c_path" ]; then
configure_options="$configure_options --with-icu-dir=$icu4c_path"
else
export ASDF_PKG_MISSING="$ASDF_PKG_MISSING icu4c"
fi
if [ "$jpeg_path" = "" ]; then
export ASDF_PKG_MISSING="$ASDF_PKG_MISSING jpeg"
else
if [ -n "$jpeg_path" ]; then
configure_options="$configure_options --with-jpeg-dir=$jpeg_path"
else
export ASDF_PKG_MISSING="$ASDF_PKG_MISSING jpeg"
fi
if [ "$webp_path" = "" ]; then
export ASDF_PKG_MISSING="$ASDF_PKG_MISSING webp"
else
if [ -n "$webp_path" ]; then
configure_options="$configure_options --with-webp-dir=$webp_path"
else
export ASDF_PKG_MISSING="$ASDF_PKG_MISSING webp"
fi
if [ "$libpng_path" = "" ]; then
export ASDF_PKG_MISSING="$ASDF_PKG_MISSING libpng"
else
if [ -n "$libpng_path" ]; then
configure_options="$configure_options --with-png-dir=$libpng_path"
else
export ASDF_PKG_MISSING="$ASDF_PKG_MISSING libpng"
fi
if [ "$openssl_path" = "" ]; then
export ASDF_PKG_MISSING="$ASDF_PKG_MISSING openssl"
else
if [ -n "$openssl_path" ]; then
configure_options="$configure_options --with-openssl=$openssl_path"
else
export ASDF_PKG_MISSING="$ASDF_PKG_MISSING openssl"
fi
if [ "$libxml2_path" = "" ]; then
export ASDF_PKG_MISSING="$ASDF_PKG_MISSING libxml2"
else
if [ -n "$libxml2_path" ]; then
configure_options="$configure_options --with-libxml-dir=$libxml2_path"
fi
if [ "$zlib_path" = "" ]; then
export ASDF_PKG_MISSING="$ASDF_PKG_MISSING zlib"
else
export ASDF_PKG_MISSING="$ASDF_PKG_MISSING libxml2"
fi
if [ -n "$zlib_path" ]; then
configure_options="$configure_options --with-zlib-dir=$zlib_path"
else
export ASDF_PKG_MISSING="$ASDF_PKG_MISSING zlib"
fi
if [ "$libzip_path" != "" ]; then
if [ -n "$libzip_path" ]; then
configure_options="$configure_options --with-libzip=$libzip_path"
else
export ASDF_PKG_MISSING="$ASDF_PKG_MISSING libzip"
fi
if [ "$readline_path" != "" ]; then
if [ -n "$readline_path" ]; then
configure_options="$configure_options --with-readline=$readline_path"
else
export ASDF_PKG_MISSING="$ASDF_PKG_MISSING readline"
fi
if [ "$libedit_path" != "" ]; then
if [ -n "$libedit_path" ]; then
configure_options="$configure_options --with-libedit=$libedit_path"
else
export ASDF_PKG_MISSING="$ASDF_PKG_MISSING libedit"
fi
if [ "$bzip2_path" != "" ]; then
if [ -n "$bzip2_path" ]; then
configure_options="$configure_options --with-bz2=$bzip2_path"
else
export ASDF_PKG_MISSING="$ASDF_PKG_MISSING bzip2"
fi
if [ "$iconv_path" != "" ]; then
if [ -n "$iconv_path" ]; then
configure_options="$configure_options --with-iconv=$iconv_path"
else
configure_options="$configure_options --without-iconv"
export ASDF_PKG_MISSING="$ASDF_PKG_MISSING libiconv"
fi
else
local jpeg_path=$(locate libjpeg.so | awk '{ print length(), $0 | "sort -n" }' | cut -d" " -f2- | head -n 1)