From e488b31597ac0624eda3de9360e61be2c1bf3075 Mon Sep 17 00:00:00 2001 From: Yamashita Yuu Date: Mon, 3 Mar 2014 11:22:39 +0900 Subject: [PATCH] Import recent changes from ruby-build 20140225 --- plugins/python-build/bin/python-build | 64 ++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 12 deletions(-) diff --git a/plugins/python-build/bin/python-build b/plugins/python-build/bin/python-build index 4f5871aa..8561bfca 100755 --- a/plugins/python-build/bin/python-build +++ b/plugins/python-build/bin/python-build @@ -1,6 +1,6 @@ #!/usr/bin/env bash -PYTHON_BUILD_VERSION="20140204" +PYTHON_BUILD_VERSION="20140225" set -E 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" } +colorize() { + if [ -t 1 ]; then printf "\e[%sm%s\e[m" "$1" "$2" + else echo -n "$2" + fi +} + build_failed() { { echo echo "BUILD FAILED" @@ -666,15 +672,35 @@ build_package_jruby() { build_package_copy cd "${PREFIX_PATH}/bin" ln -fs jruby ruby + chmod +x ruby install_jruby_launcher remove_windows_files 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() { - cd "${PREFIX_PATH}/bin" - { ./ruby gem install jruby-launcher - } >&4 2>&1 + # If this version of JRuby has been modified for Graal, don't overwrite the + # launcher scripts + 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() { @@ -806,19 +832,29 @@ fix_rbx_irb() { 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() { local gcc="$(locate_gcc || true)" if [ -z "$gcc" ]; then - local esc=$'\033' { 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 "and try again." echo 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 "\`llvm-gcc\`, a modified version of GCC which outputs LLVM bytecode." echo @@ -828,14 +864,18 @@ require_gcc() { echo "GCC compiler installed on your system." echo + colorize 1 "TO FIX THE PROBLEM" if type brew &>/dev/null; then - echo "${esc}[1mTO FIX THE PROBLEM${esc}[0m: Install Homebrew's apple-gcc42 package with this" - echo "command: ${esc}[4mbrew tap homebrew/dupes ; brew install apple-gcc42${esc}[0m" + echo ": Install Homebrew's apple-gcc42 package with this" + echo -n "command: " + colorize 4 "brew tap homebrew/dupes ; brew install apple-gcc42" else - echo "${esc}[1mTO FIX THE PROBLEM${esc}[0m: Install the official GCC compiler using these" - echo "packages: ${esc}[4mhttps://github.com/kennethreitz/osx-gcc-installer/downloads${esc}[0m" + echo ": Install the official GCC compiler using these" + echo -n "packages: " + colorize 4 "https://github.com/kennethreitz/osx-gcc-installer/downloads" fi + echo echo 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" @@ -1299,7 +1339,7 @@ done DEFINITION_PATH="${ARGUMENTS[0]}" if [ -z "$DEFINITION_PATH" ]; then usage -elif [ ! -e "$DEFINITION_PATH" ]; then +elif [ ! -f "$DEFINITION_PATH" ]; then BUILTIN_DEFINITION_PATH="${PYTHON_BUILD_ROOT}/share/python-build/${DEFINITION_PATH}" if [ -e "$BUILTIN_DEFINITION_PATH" ]; then DEFINITION_PATH="$BUILTIN_DEFINITION_PATH"