mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05:00
Imported recent changes from the latest https://github.com/rbenv/ruby-build as of Oct 31, 2017 (#1025)
This commit is contained in:
parent
2f396596d7
commit
4521552662
1 changed files with 81 additions and 23 deletions
|
@ -709,7 +709,7 @@ build_package_warn_unsupported() {
|
||||||
} >&3
|
} >&3
|
||||||
}
|
}
|
||||||
|
|
||||||
build_package_standard() {
|
build_package_standard_build() {
|
||||||
local package_name="$1"
|
local package_name="$1"
|
||||||
|
|
||||||
if [ "${MAKEOPTS+defined}" ]; then
|
if [ "${MAKEOPTS+defined}" ]; then
|
||||||
|
@ -726,12 +726,11 @@ build_package_standard() {
|
||||||
local PACKAGE_CONFIGURE_OPTS_ARRAY="${package_var_name}_CONFIGURE_OPTS_ARRAY[@]"
|
local PACKAGE_CONFIGURE_OPTS_ARRAY="${package_var_name}_CONFIGURE_OPTS_ARRAY[@]"
|
||||||
local PACKAGE_MAKE_OPTS="${package_var_name}_MAKE_OPTS"
|
local PACKAGE_MAKE_OPTS="${package_var_name}_MAKE_OPTS"
|
||||||
local PACKAGE_MAKE_OPTS_ARRAY="${package_var_name}_MAKE_OPTS_ARRAY[@]"
|
local PACKAGE_MAKE_OPTS_ARRAY="${package_var_name}_MAKE_OPTS_ARRAY[@]"
|
||||||
local PACKAGE_MAKE_INSTALL_OPTS="${package_var_name}_MAKE_INSTALL_OPTS"
|
|
||||||
local PACKAGE_MAKE_INSTALL_OPTS_ARRAY="${package_var_name}_MAKE_INSTALL_OPTS_ARRAY[@]"
|
|
||||||
local PACKAGE_MAKE_INSTALL_TARGET="${package_var_name}_MAKE_INSTALL_TARGET"
|
|
||||||
local PACKAGE_CFLAGS="${package_var_name}_CFLAGS"
|
local PACKAGE_CFLAGS="${package_var_name}_CFLAGS"
|
||||||
|
|
||||||
[ "$package_var_name" = "PYTHON" ] && use_homebrew_readline || true
|
if [ "$package_var_name" = "PYTHON" ]; then
|
||||||
|
use_homebrew_readline || use_freebsd_pkg ||true
|
||||||
|
fi
|
||||||
|
|
||||||
( if [ "${CFLAGS+defined}" ] || [ "${!PACKAGE_CFLAGS+defined}" ]; then
|
( if [ "${CFLAGS+defined}" ] || [ "${!PACKAGE_CFLAGS+defined}" ]; then
|
||||||
export CFLAGS="$CFLAGS ${!PACKAGE_CFLAGS}"
|
export CFLAGS="$CFLAGS ${!PACKAGE_CFLAGS}"
|
||||||
|
@ -744,10 +743,34 @@ build_package_standard() {
|
||||||
) >&4 2>&1
|
) >&4 2>&1
|
||||||
|
|
||||||
{ "$MAKE" $MAKE_OPTS ${!PACKAGE_MAKE_OPTS} "${!PACKAGE_MAKE_OPTS_ARRAY}"
|
{ "$MAKE" $MAKE_OPTS ${!PACKAGE_MAKE_OPTS} "${!PACKAGE_MAKE_OPTS_ARRAY}"
|
||||||
"$MAKE" "${!PACKAGE_MAKE_INSTALL_TARGET:-install}" $MAKE_INSTALL_OPTS ${!PACKAGE_MAKE_INSTALL_OPTS} "${!PACKAGE_MAKE_INSTALL_OPTS_ARRAY}"
|
|
||||||
} >&4 2>&1
|
} >&4 2>&1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
build_package_standard_install() {
|
||||||
|
local package_name="$1"
|
||||||
|
local package_var_name="$(capitalize "${package_name%%-*}")"
|
||||||
|
|
||||||
|
local PACKAGE_MAKE_INSTALL_OPTS="${package_var_name}_MAKE_INSTALL_OPTS"
|
||||||
|
local PACKAGE_MAKE_INSTALL_OPTS_ARRAY="${package_var_name}_MAKE_INSTALL_OPTS_ARRAY[@]"
|
||||||
|
|
||||||
|
{ "$MAKE" "${!PACKAGE_MAKE_INSTALL_TARGET:-install}" $MAKE_INSTALL_OPTS ${!PACKAGE_MAKE_INSTALL_OPTS} "${!PACKAGE_MAKE_INSTALL_OPTS_ARRAY}"
|
||||||
|
} >&4 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
build_package_standard_install_with_bundled_gems() {
|
||||||
|
{ "$MAKE" update-gems
|
||||||
|
"$MAKE" extract-gems
|
||||||
|
} >&4 2>&1
|
||||||
|
|
||||||
|
build_package_standard_install "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Backword Compatibility for standard function
|
||||||
|
build_package_standard() {
|
||||||
|
build_package_standard_build "$@"
|
||||||
|
build_package_standard_install "$@"
|
||||||
|
}
|
||||||
|
|
||||||
build_package_autoconf() {
|
build_package_autoconf() {
|
||||||
{ autoconf
|
{ autoconf
|
||||||
} >&4 2>&1
|
} >&4 2>&1
|
||||||
|
@ -806,7 +829,7 @@ build_package_rbx() {
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
RUBYOPT="-rubygems $RUBYOPT" ./configure --prefix="$PREFIX_PATH" $RUBY_CONFIGURE_OPTS "${configure_opts[@]}"
|
RUBYOPT="-rrubygems $RUBYOPT" ./configure --prefix="$PREFIX_PATH" $RUBY_CONFIGURE_OPTS "${configure_opts[@]}"
|
||||||
rake install
|
rake install
|
||||||
fix_rbx_gem_binstubs "$PREFIX_PATH"
|
fix_rbx_gem_binstubs "$PREFIX_PATH"
|
||||||
fix_rbx_irb "$PREFIX_PATH"
|
fix_rbx_irb "$PREFIX_PATH"
|
||||||
|
@ -1245,20 +1268,21 @@ require_llvm() {
|
||||||
3.2 )
|
3.2 )
|
||||||
package_option python configure --prebuilt-name="llvm-3.2-x86_64-apple-darwin13.tar.bz2"
|
package_option python configure --prebuilt-name="llvm-3.2-x86_64-apple-darwin13.tar.bz2"
|
||||||
;;
|
;;
|
||||||
3.5 )
|
3.[56] )
|
||||||
local llvm_config="$(locate_llvm "$llvm_version")"
|
local llvm_config="$(locate_llvm "$llvm_version")"
|
||||||
if [ -n "$llvm_config" ]; then
|
if [ -n "$llvm_config" ]; then
|
||||||
package_option python configure --llvm-config="$llvm_config"
|
package_option python configure --llvm-config="$llvm_config"
|
||||||
else
|
else
|
||||||
|
local homebrew_package="llvm@$llvm_version"
|
||||||
{ echo
|
{ echo
|
||||||
colorize 1 "ERROR"
|
colorize 1 "ERROR"
|
||||||
echo ": Rubinius will not be able to compile using Apple's LLVM-based "
|
echo ": Rubinius will not be able to compile using Apple's LLVM-based "
|
||||||
echo "build tools on OS X. You will need to install LLVM 3.5 first."
|
echo "build tools on OS X. You will need to install LLVM $llvm_version first."
|
||||||
echo
|
echo
|
||||||
colorize 1 "TO FIX THE PROBLEM"
|
colorize 1 "TO FIX THE PROBLEM"
|
||||||
echo ": Install Homebrew's llvm package with this"
|
echo ": Install Homebrew's llvm package with this"
|
||||||
echo -n "command: "
|
echo -n "command: "
|
||||||
colorize 4 "brew tap homebrew/versions ; brew install llvm35"
|
colorize 4 "brew install $homebrew_package"
|
||||||
echo
|
echo
|
||||||
} >&3
|
} >&3
|
||||||
return 1
|
return 1
|
||||||
|
@ -1357,6 +1381,7 @@ needs_yaml() {
|
||||||
use_homebrew_yaml() {
|
use_homebrew_yaml() {
|
||||||
local libdir="$(brew --prefix libyaml 2>/dev/null || true)"
|
local libdir="$(brew --prefix libyaml 2>/dev/null || true)"
|
||||||
if [ -d "$libdir" ]; then
|
if [ -d "$libdir" ]; then
|
||||||
|
echo "python-build: use libyaml from homebrew"
|
||||||
export CPPFLAGS="-I$libdir/include ${CPPFLAGS}"
|
export CPPFLAGS="-I$libdir/include ${CPPFLAGS}"
|
||||||
export LDFLAGS="-L$libdir/lib ${LDFLAGS}"
|
export LDFLAGS="-L$libdir/lib ${LDFLAGS}"
|
||||||
else
|
else
|
||||||
|
@ -1364,6 +1389,30 @@ use_homebrew_yaml() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
use_freebsd_pkg() {
|
||||||
|
# check if FreeBSD
|
||||||
|
if [ "FreeBSD" = "$(uname -s)" ]; then
|
||||||
|
# use openssl if installed from Ports Collection
|
||||||
|
if [ -f /usr/local/include/openssl/ssl.h ]; then
|
||||||
|
package_option ruby configure --with-openssl-dir="/usr/local"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check if 11-R or later
|
||||||
|
release="$(uname -r)"
|
||||||
|
if [ "${release%%.*}" -ge 11 ]; then
|
||||||
|
# prefers readline to compile most of ruby versions
|
||||||
|
if pkg info -e readline > /dev/null; then
|
||||||
|
# use readline from Ports Collection
|
||||||
|
package_option ruby configure --with-readline-dir="/usr/local"
|
||||||
|
elif pkg info -e libedit > /dev/null; then
|
||||||
|
# use libedit from Ports Collection
|
||||||
|
package_option ruby configure --enable-libedit
|
||||||
|
package_option ruby configure --with-libedit-dir="/usr/local"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
has_broken_mac_readline() {
|
has_broken_mac_readline() {
|
||||||
# Mac OS X 10.4 has broken readline.
|
# Mac OS X 10.4 has broken readline.
|
||||||
# https://github.com/pyenv/pyenv/issues/23
|
# https://github.com/pyenv/pyenv/issues/23
|
||||||
|
@ -1376,6 +1425,7 @@ use_homebrew_readline() {
|
||||||
if ! configured_with_package_dir "python" "readline/rlconf.h"; then
|
if ! configured_with_package_dir "python" "readline/rlconf.h"; then
|
||||||
local libdir="$(brew --prefix readline 2>/dev/null || true)"
|
local libdir="$(brew --prefix readline 2>/dev/null || true)"
|
||||||
if [ -d "$libdir" ]; then
|
if [ -d "$libdir" ]; then
|
||||||
|
echo "python-build: use readline from homebrew"
|
||||||
export CPPFLAGS="-I$libdir/include ${CPPFLAGS}"
|
export CPPFLAGS="-I$libdir/include ${CPPFLAGS}"
|
||||||
export LDFLAGS="-L$libdir/lib ${LDFLAGS}"
|
export LDFLAGS="-L$libdir/lib ${LDFLAGS}"
|
||||||
else
|
else
|
||||||
|
@ -1394,6 +1444,7 @@ has_broken_mac_openssl() {
|
||||||
use_homebrew_openssl() {
|
use_homebrew_openssl() {
|
||||||
local ssldir="$(brew --prefix openssl 2>/dev/null || true)"
|
local ssldir="$(brew --prefix openssl 2>/dev/null || true)"
|
||||||
if [ -d "$ssldir" ]; then
|
if [ -d "$ssldir" ]; then
|
||||||
|
echo "python-build: use openssl from homebrew"
|
||||||
export CPPFLAGS="-I$ssldir/include ${CPPFLAGS}"
|
export CPPFLAGS="-I$ssldir/include ${CPPFLAGS}"
|
||||||
export LDFLAGS="-L$ssldir/lib ${LDFLAGS}"
|
export LDFLAGS="-L$ssldir/lib ${LDFLAGS}"
|
||||||
else
|
else
|
||||||
|
@ -1459,6 +1510,10 @@ build_package_ldflags_dirs() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
build_package_enable_shared() {
|
||||||
|
package_option python configure --enable-shared
|
||||||
|
}
|
||||||
|
|
||||||
build_package_auto_tcltk() {
|
build_package_auto_tcltk() {
|
||||||
if is_mac && [ ! -d /usr/include/X11 ]; then
|
if is_mac && [ ! -d /usr/include/X11 ]; then
|
||||||
if [ -d /opt/X11/include ]; then
|
if [ -d /opt/X11/include ]; then
|
||||||
|
@ -1768,7 +1823,7 @@ list_definitions() {
|
||||||
}
|
}
|
||||||
|
|
||||||
sort_versions() {
|
sort_versions() {
|
||||||
sed 'h; s/[+-]/./g; s/.p\([[:digit:]]\)/.z\1/; s/$/.z/; G; s/\n/ /' | \
|
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}'
|
LC_ALL=C sort -t. -k 1,1 -k 2,2n -k 3,3n -k 4,4n -k 5,5n | awk '{print $2}'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1877,27 +1932,30 @@ if [ -n "$noexec" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Work around warnings building Ruby 2.0 on Clang 2.x:
|
## Apply following work around, if gcc is not installed.
|
||||||
# pass -Wno-error=shorten-64-to-32 if the compiler accepts it.
|
#if [ -z "$(locate_gcc)" ]; then
|
||||||
#
|
# # Work around warnings building Ruby 2.0 on Clang 2.x:
|
||||||
# When we set CFLAGS, Ruby won't apply its default flags, though. Since clang
|
# # pass -Wno-error=shorten-64-to-32 if the compiler accepts it.
|
||||||
# builds 1.9.x and 2.x only, where -O3 is default, we can safely set that flag.
|
# #
|
||||||
# Ensure it's the first flag since later flags take precedence.
|
# # When we set CFLAGS, Ruby won't apply its default flags, though. Since clang
|
||||||
|
# # builds 1.9.x and 2.x only, where -O3 is default, we can safely set that flag.
|
||||||
|
# # Ensure it's the first flag since later flags take precedence.
|
||||||
# if "${CC:-cc}" -x c /dev/null -E -Wno-error=shorten-64-to-32 &>/dev/null; then
|
# if "${CC:-cc}" -x c /dev/null -E -Wno-error=shorten-64-to-32 &>/dev/null; then
|
||||||
# PYTHON_CFLAGS="-O3 -Wno-error=shorten-64-to-32 $PYTHON_CFLAGS"
|
# RUBY_CFLAGS="-O3 -Wno-error=shorten-64-to-32 $RUBY_CFLAGS"
|
||||||
|
# fi
|
||||||
#fi
|
#fi
|
||||||
|
|
||||||
if [ -z "$MAKE" ]; then
|
if [ -z "$MAKE" ]; then
|
||||||
if [ "FreeBSD" = "$(uname -s)" ]; then
|
if [ "FreeBSD" = "$(uname -s)" ]; then
|
||||||
# if [ $(echo $1 | sed 's/-.*$//') = "jruby" ]; then
|
if [ "$(echo $1 | sed 's/-.*$//')" = "jruby" ]; then
|
||||||
# export MAKE="gmake"
|
export MAKE="gmake"
|
||||||
# else
|
else
|
||||||
if [ "$(uname -r | sed 's/[^[:digit:]].*//')" -lt 10 ]; then
|
if [ "$(uname -r | sed 's/[^[:digit:]].*//')" -lt 10 ]; then
|
||||||
export MAKE="gmake"
|
export MAKE="gmake"
|
||||||
else
|
else
|
||||||
export MAKE="make"
|
export MAKE="make"
|
||||||
fi
|
fi
|
||||||
# fi
|
fi
|
||||||
else
|
else
|
||||||
export MAKE="make"
|
export MAKE="make"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue