Import recent changes from ruby-build 20140225

This commit is contained in:
Yamashita Yuu 2014-03-03 11:22:39 +09:00
parent 5bbfcf75f6
commit e488b31597

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
PYTHON_BUILD_VERSION="20140204" PYTHON_BUILD_VERSION="20140225"
set -E set -E
exec 3<&2 # preserve original stderr at fd 3 exec 3<&2 # preserve original stderr at fd 3
@ -65,6 +65,12 @@ sanitize() {
printf "%s" "$1" | sed "s/[^A-Za-z0-9.-]/_/g; s/__*/_/g" printf "%s" "$1" | sed "s/[^A-Za-z0-9.-]/_/g; s/__*/_/g"
} }
colorize() {
if [ -t 1 ]; then printf "\e[%sm%s\e[m" "$1" "$2"
else echo -n "$2"
fi
}
build_failed() { build_failed() {
{ echo { echo
echo "BUILD FAILED" echo "BUILD FAILED"
@ -666,15 +672,35 @@ build_package_jruby() {
build_package_copy build_package_copy
cd "${PREFIX_PATH}/bin" cd "${PREFIX_PATH}/bin"
ln -fs jruby ruby ln -fs jruby ruby
chmod +x ruby
install_jruby_launcher install_jruby_launcher
remove_windows_files remove_windows_files
fix_jruby_shebangs fix_jruby_shebangs
} }
graal_architecture() {
if [ "$(uname -m)" != "x86_64" ]; then
echo "no nightly builds available" >&2
exit 1
fi
case "$(uname -s)" in
"Darwin") echo "macosx-x86_64";;
"Linux") echo "linux-x86_64";;
*)
echo "no nightly builds available" >&2
exit 1;;
esac
}
install_jruby_launcher() { install_jruby_launcher() {
cd "${PREFIX_PATH}/bin" # If this version of JRuby has been modified for Graal, don't overwrite the
{ ./ruby gem install jruby-launcher # launcher scripts
} >&4 2>&1 if ! grep -q graalvm "${PREFIX_PATH}/bin/jruby"; then
cd "${PREFIX_PATH}/bin"
{ ./ruby gem install jruby-launcher
} >&4 2>&1
fi
} }
fix_jruby_shebangs() { fix_jruby_shebangs() {
@ -806,19 +832,29 @@ fix_rbx_irb() {
true true
} }
require_java7() {
local version="$(java -version 2>&1 | head -1)"
if [[ $version != *1.[789]* ]]; then
colorize 1 "ERROR" >&3
echo ": Java 7 required. Please install a 1.7-compatible JRE." >&3
return 1
fi
}
require_gcc() { require_gcc() {
local gcc="$(locate_gcc || true)" local gcc="$(locate_gcc || true)"
if [ -z "$gcc" ]; then if [ -z "$gcc" ]; then
local esc=$'\033'
{ echo { echo
echo "${esc}[1mERROR${esc}[0m: This package must be compiled with GCC, but python-build couldn't" colorize 1 "ERROR"
echo ": This package must be compiled with GCC, but python-build couldn't"
echo "find a suitable \`gcc\` executable on your system. Please install GCC" echo "find a suitable \`gcc\` executable on your system. Please install GCC"
echo "and try again." echo "and try again."
echo echo
if [ "$(uname -s)" = "Darwin" ]; then if [ "$(uname -s)" = "Darwin" ]; then
echo "${esc}[1mDETAILS${esc}[0m: Apple no longer includes the official GCC compiler with Xcode" colorize 1 "DETAILS"
echo ": Apple no longer includes the official GCC compiler with Xcode"
echo "as of version 4.2. Instead, the \`gcc\` executable is a symlink to" echo "as of version 4.2. Instead, the \`gcc\` executable is a symlink to"
echo "\`llvm-gcc\`, a modified version of GCC which outputs LLVM bytecode." echo "\`llvm-gcc\`, a modified version of GCC which outputs LLVM bytecode."
echo echo
@ -828,14 +864,18 @@ require_gcc() {
echo "GCC compiler installed on your system." echo "GCC compiler installed on your system."
echo echo
colorize 1 "TO FIX THE PROBLEM"
if type brew &>/dev/null; then if type brew &>/dev/null; then
echo "${esc}[1mTO FIX THE PROBLEM${esc}[0m: Install Homebrew's apple-gcc42 package with this" echo ": Install Homebrew's apple-gcc42 package with this"
echo "command: ${esc}[4mbrew tap homebrew/dupes ; brew install apple-gcc42${esc}[0m" echo -n "command: "
colorize 4 "brew tap homebrew/dupes ; brew install apple-gcc42"
else else
echo "${esc}[1mTO FIX THE PROBLEM${esc}[0m: Install the official GCC compiler using these" echo ": Install the official GCC compiler using these"
echo "packages: ${esc}[4mhttps://github.com/kennethreitz/osx-gcc-installer/downloads${esc}[0m" echo -n "packages: "
colorize 4 "https://github.com/kennethreitz/osx-gcc-installer/downloads"
fi fi
echo
echo echo
echo "You will need to install the official GCC compiler to build newer" echo "You will need to install the official GCC compiler to build newer"
echo "versions of CPython even if you have installed Apple's Command Line Tools" echo "versions of CPython even if you have installed Apple's Command Line Tools"
@ -1299,7 +1339,7 @@ done
DEFINITION_PATH="${ARGUMENTS[0]}" DEFINITION_PATH="${ARGUMENTS[0]}"
if [ -z "$DEFINITION_PATH" ]; then if [ -z "$DEFINITION_PATH" ]; then
usage usage
elif [ ! -e "$DEFINITION_PATH" ]; then elif [ ! -f "$DEFINITION_PATH" ]; then
BUILTIN_DEFINITION_PATH="${PYTHON_BUILD_ROOT}/share/python-build/${DEFINITION_PATH}" BUILTIN_DEFINITION_PATH="${PYTHON_BUILD_ROOT}/share/python-build/${DEFINITION_PATH}"
if [ -e "$BUILTIN_DEFINITION_PATH" ]; then if [ -e "$BUILTIN_DEFINITION_PATH" ]; then
DEFINITION_PATH="$BUILTIN_DEFINITION_PATH" DEFINITION_PATH="$BUILTIN_DEFINITION_PATH"