diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh index a1fa743417..25ac493ffe 100644 --- a/Library/Homebrew/brew.sh +++ b/Library/Homebrew/brew.sh @@ -410,6 +410,7 @@ Your Git executable: $(unset git && type -p $HOMEBREW_GIT)" fi fi + HOMEBREW_LINUX_MINIMUM_GLIBC_VERSION="2.13" unset HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH fi @@ -447,6 +448,7 @@ export HOMEBREW_SYSTEM_CURL_TOO_OLD export HOMEBREW_GIT export HOMEBREW_GIT_WARNING export HOMEBREW_MINIMUM_GIT_VERSION +export HOMEBREW_LINUX_MINIMUM_GLIBC_VERSION export HOMEBREW_PROCESSOR export HOMEBREW_PRODUCT export HOMEBREW_OS_VERSION diff --git a/Library/Homebrew/cmd/vendor-install.sh b/Library/Homebrew/cmd/vendor-install.sh index 18e98e51a1..36257eda40 100644 --- a/Library/Homebrew/cmd/vendor-install.sh +++ b/Library/Homebrew/cmd/vendor-install.sh @@ -32,19 +32,27 @@ then esac fi -check_ldd_version() { - local ldd_version - local ldd_version_major - local ldd_version_minor +check_linux_glibc_version() { + if [[ -z $HOMEBREW_LINUX || -z $HOMEBREW_LINUX_MINIMUM_GLIBC_VERSION ]] + then + return 0 + fi + + local glibc_version + local glibc_version_major + local glibc_version_minor + + local minimum_required_major=${HOMEBREW_LINUX_MINIMUM_GLIBC_VERSION%.*} + local minimum_required_minor=${HOMEBREW_LINUX_MINIMUM_GLIBC_VERSION#*.} if [[ $(/usr/bin/ldd --version) =~ \ [0-9]\.[0-9]+ ]] then - ldd_version=${BASH_REMATCH[0]// /} - ldd_version_major=${ldd_version%.*} - ldd_version_minor=${ldd_version#*.} - if (( ldd_version_major < 2 || ldd_version_minor < 13 )) + glibc_version=${BASH_REMATCH[0]// /} + glibc_version_major=${glibc_version%.*} + glibc_version_minor=${glibc_version#*.} + if (( glibc_version_major < minimum_required_major || glibc_version_minor < minimum_required_minor )) then - odie "Vendored tools require system Glibc 2.13 or later." + odie "Vendored tools require system Glibc $HOMEBREW_LINUX_MINIMUM_GLIBC_VERSION or later (yours is $glibc_version)." fi else odie "Failed to detect system Glibc version." @@ -239,7 +247,7 @@ homebrew-vendor-install() { [[ -z "$VENDOR_NAME" ]] && odie "This command requires a vendor target!" [[ -n "$HOMEBREW_DEBUG" ]] && set -x - [[ -n "$HOMEBREW_LINUX" ]] && check_ldd_version + check_linux_glibc_version url_var="${VENDOR_NAME}_URL" url2_var="${VENDOR_NAME}_URL2" diff --git a/Library/Homebrew/os/linux/glibc.rb b/Library/Homebrew/os/linux/glibc.rb index 77b06fa757..1070d4dd90 100644 --- a/Library/Homebrew/os/linux/glibc.rb +++ b/Library/Homebrew/os/linux/glibc.rb @@ -22,7 +22,7 @@ module OS sig { returns(Version) } def minimum_version - Version.new "2.13" + Version.new ENV["HOMEBREW_LINUX_MINIMUM_GLIBC_VERSION"] end def below_minimum_version?