Deprecate macOS versions below Mavericks

And remove all dead/unneeded code.
This commit is contained in:
Mike McQuaid 2019-01-26 17:13:14 +00:00
parent 38cce518e0
commit 1aa8ad09e2
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70
50 changed files with 157 additions and 830 deletions

View File

@ -93,23 +93,14 @@ then
# Don't change this from Mac OS X to match what macOS itself does in Safari on 10.12
HOMEBREW_OS_USER_AGENT_VERSION="Mac OS X $HOMEBREW_MACOS_VERSION"
# The system Curl is too old for some modern HTTPS certificates on
# older macOS versions.
#
# Intentionally set this variable by exploding another.
# shellcheck disable=SC2086,SC2183
printf -v HOMEBREW_MACOS_VERSION_NUMERIC "%02d%02d%02d" ${HOMEBREW_MACOS_VERSION//./ }
if [[ "$HOMEBREW_MACOS_VERSION_NUMERIC" -lt "101000" ]]
then
HOMEBREW_SYSTEM_CURL_TOO_OLD="1"
HOMEBREW_FORCE_BREWED_CURL="1"
fi
# Announce pre-Mavericks deprecation now
# Refuse to run on pre-Mavericks
if [[ "$HOMEBREW_MACOS_VERSION_NUMERIC" -lt "100900" ]]
then
printf "WARNING: Your version of macOS (%s) will not be able to run Homebrew when\n" "$HOMEBREW_MACOS_VERSION" >&2
printf " version 2.0.0 is released (Q1 2019)!\n" >&2
printf "ERROR: Your version of macOS (%s) is too old to run Homebrew!" "$HOMEBREW_MACOS_VERSION" >&2
if [[ "$HOMEBREW_MACOS_VERSION_NUMERIC" -lt "100700" ]]
then
printf " For 10.4 - 10.6 support see: https://github.com/mistydemeo/tigerbrew\n" >&2
@ -117,6 +108,15 @@ then
printf "\n" >&2
fi
# The system Curl is too old for some modern HTTPS certificates on
# older macOS versions.
#
if [[ "$HOMEBREW_MACOS_VERSION_NUMERIC" -lt "101000" ]]
then
HOMEBREW_SYSTEM_CURL_TOO_OLD="1"
HOMEBREW_FORCE_BREWED_CURL="1"
fi
# The system Git on macOS versions before Sierra is too old for some Homebrew functionality we rely on.
HOMEBREW_MINIMUM_GIT_VERSION="2.14.3"
if [[ "$HOMEBREW_MACOS_VERSION_NUMERIC" -lt "101200" ]]

View File

@ -4,7 +4,6 @@ module CompilerConstants
GNU_GCC_REGEXP = /^gcc-(4\.9|[5-8])$/.freeze
COMPILER_SYMBOL_MAP = {
"gcc" => :gcc,
"gcc-4.2" => :gcc_4_2,
"clang" => :clang,
"llvm_clang" => :llvm_clang,
}.freeze
@ -19,9 +18,11 @@ class CompilerFailure
def version(val = nil)
if val
@version = Version.parse(val.to_s)
else
@version
if name.to_s == "clang" && val.to_i < 600
odisabled "'fails_with :clang' with 'build' < 600"
end
end
@version
end
# Allows Apple compiler `fails_with` statements to keep using `build`
@ -66,14 +67,6 @@ class CompilerFailure
end
COLLECTIONS = {
cxx11: [
create(:gcc_4_2),
create(:clang) { build 425 },
],
cxx14: [
create(:clang) { build 600 },
create(:gcc_4_2),
],
openmp: [
create(:clang),
],
@ -86,9 +79,8 @@ class CompilerSelector
Compiler = Struct.new(:name, :version)
COMPILER_PRIORITY = {
clang: [:clang, :gcc_4_2, :gnu, :llvm_clang],
gcc_4_2: [:gcc_4_2, :gnu, :clang],
gcc: [:gnu, :gcc, :llvm_clang, :clang, :gcc_4_2],
clang: [:clang, :gnu, :llvm_clang],
gcc: [:gnu, :gcc, :llvm_clang, :clang],
}.freeze
def self.select_for(formula, compilers = self.compilers)

View File

@ -37,18 +37,6 @@ class DevelopmentTools
:clang
end
def gcc_4_2_build_version
@gcc_4_2_build_version ||= begin
if (gcc = locate("gcc-4.2")) &&
!gcc.realpath.basename.to_s.start_with?("llvm") &&
build_version = `#{gcc} --version 2>/dev/null`[/build (\d{4,})/, 1]
Version.new build_version
else
Version::NULL
end
end
end
def clang_version
@clang_version ||= begin
if (path = locate("clang")) &&
@ -98,7 +86,6 @@ class DevelopmentTools
end
def clear_version_cache
@gcc_4_2_build_version = nil
@clang_version = @clang_build_version = nil
@non_apple_gcc_version = {}
end

View File

@ -190,8 +190,6 @@ module Homebrew
# Static libs which are generally OK should be added to this list,
# with a short description of the software they come with.
white_list = [
"libsecurity_agent_client.a", # OS X 10.8.2 Supplemental Update
"libsecurity_agent_server.a", # OS X 10.8.2 Supplemental Update
"libntfs-3g.a", # NTFS-3G
"libntfs.a", # NTFS-3G
"libublio.a", # NTFS-3G

View File

@ -7,8 +7,5 @@ module Emoji
def enabled?
!ENV["HOMEBREW_NO_EMOJI"]
end
alias generic_enabled? enabled?
end
end
require "extend/os/emoji"

View File

@ -316,18 +316,6 @@ module SharedEnvExtension
%w[clang llvm_clang].include?(cc.to_s)
end
# @private
def compiler_with_cxx11_support?(cc)
return if compiler_any_clang?(cc)
version = if cc == :gcc
DevelopmentTools.non_apple_gcc_version "gcc"
else
cc[/^gcc-(\d+(?:\.\d+)?)$/, 1]
end
version && Version.create(version) >= Version.create("4.8")
end
private
def cc=(val)

View File

@ -100,11 +100,6 @@ module Stdenv
dir/base.to_s.sub("gcc", "g++").sub("clang", "clang++")
end
def gcc_4_2
super
set_cpu_cflags
end
GNU_GCC_VERSIONS.each do |n|
define_method(:"gcc-#{n}") do
super()
@ -145,14 +140,8 @@ module Stdenv
end
def cxx11
if compiler == :clang
append "CXX", "-std=c++11"
append "CXX", "-stdlib=libc++"
elsif compiler_with_cxx11_support?(compiler)
append "CXX", "-std=c++11"
else
raise "The selected compiler doesn't support C++11: #{compiler}"
end
append "CXX", "-std=c++11"
libcxx
end
def libcxx

View File

@ -77,7 +77,7 @@ module Superenv
# K - Don't strip -arch <arch>, -m32, or -m64
# w - Pass -no_weak_imports to the linker
#
# On 10.8 and newer, these flags will also be present:
# These flags will also be present:
# s - apply fix for sed's Unicode support
# a - apply fix for apr-1-config path
end
@ -109,13 +109,8 @@ module Superenv
path.append(homebrew_extra_paths)
path.append("/usr/bin", "/bin", "/usr/sbin", "/sbin")
# Homebrew's apple-gcc42 will be outside the PATH in superenv,
# so xcrun may not be able to find it
begin
case homebrew_cc
when "gcc-4.2"
path.append(Formulary.factory("apple-gcc42").opt_bin)
when GNU_GCC_REGEXP
if homebrew_cc =~ GNU_GCC_REGEXP
path.append(gcc_version_formula($&).opt_bin)
end
rescue FormulaUnavailableError
@ -279,14 +274,8 @@ module Superenv
end
def cxx11
if homebrew_cc == "clang"
append_to_cccfg "x"
append_to_cccfg "g"
elsif compiler_with_cxx11_support?(homebrew_cc)
append_to_cccfg "x"
else
raise "The selected compiler doesn't support C++11: #{homebrew_cc}"
end
append_to_cccfg "x"
append_to_cccfg "g" if homebrew_cc == "clang"
end
def libcxx

View File

@ -1 +0,0 @@
require "extend/os/mac/emoji" if OS.mac?

View File

@ -2,25 +2,15 @@ class DependencyCollector
undef git_dep_if_needed, subversion_dep_if_needed, cvs_dep_if_needed,
xz_dep_if_needed, unzip_dep_if_needed, bzip2_dep_if_needed
def git_dep_if_needed(tags)
return if MacOS.version >= :lion
Dependency.new("git", tags)
end
def git_dep_if_needed(tags); end
def subversion_dep_if_needed(tags); end
def cvs_dep_if_needed(tags)
return if MacOS.version < :lion
Dependency.new("cvs", tags)
end
def xz_dep_if_needed(tags)
return if MacOS.version >= :mavericks
Dependency.new("xz", tags)
end
def xz_dep_if_needed(tags); end
def unzip_dep_if_needed(tags); end

View File

@ -26,17 +26,7 @@ class DevelopmentTools
end
def default_compiler
case default_cc
when /^gcc/ then :gcc_4_2
when "clang" then :clang
else
# guess :(
if MacOS::Xcode.version >= "4.3"
:clang
else
:gcc_4_2
end
end
:clang
end
def curl_handles_most_https_certificates?
@ -52,23 +42,10 @@ class DevelopmentTools
end
def installation_instructions
if MacOS.version >= "10.9"
<<~EOS
Install the Command Line Tools:
xcode-select --install
EOS
elsif MacOS.version == "10.8" || MacOS.version == "10.7"
<<~EOS
Install the Command Line Tools from
https://developer.apple.com/download/more/
or via Xcode's preferences.
EOS
else
<<~EOS
Install Xcode from
https://developer.apple.com/download/more/
EOS
end
<<~EOS
Install the Command Line Tools:
xcode-select --install
EOS
end
def custom_installation_instructions

View File

@ -1,7 +0,0 @@
module Emoji
class << self
def enabled?
generic_enabled? && MacOS.version >= :lion
end
end
end

View File

@ -27,36 +27,24 @@ module Stdenv
append_path "ACLOCAL_PATH", "#{MacOS::X11.share}/aclocal"
if MacOS::XQuartz.provided_by_apple? && MacOS.sdk_path_if_needed
append_path "CMAKE_PREFIX_PATH", "#{MacOS.sdk_path_if_needed}/usr/X11"
end
append "CFLAGS", "-I#{MacOS::X11.include}" unless MacOS::CLT.installed?
end
def setup_build_environment(formula = nil)
generic_setup_build_environment formula
if MacOS.version >= :mountain_lion
# Mountain Lion's sed is stricter, and errors out when
# it encounters files with mixed character sets
delete("LC_ALL")
self["LC_CTYPE"] = "C"
end
# sed is strict, and errors out when it encounters files with
# mixed character sets
delete("LC_ALL")
self["LC_CTYPE"] = "C"
# Add lib and include etc. from the current macosxsdk to compiler flags:
macosxsdk MacOS.version
if MacOS::Xcode.without_clt?
append_path "PATH", "#{MacOS::Xcode.prefix}/usr/bin"
append_path "PATH", "#{MacOS::Xcode.toolchain_path}/usr/bin"
end
return unless MacOS::Xcode.without_clt?
# Leopard's ld needs some convincing that it's building 64-bit
# See: https://github.com/mistydemeo/tigerbrew/issues/59
return unless MacOS.version == :leopard
append "LDFLAGS", "-arch #{Hardware::CPU.arch_64_bit}"
append_path "PATH", "#{MacOS::Xcode.prefix}/usr/bin"
append_path "PATH", "#{MacOS::Xcode.toolchain_path}/usr/bin"
end
def remove_macosxsdk(version = MacOS.version)

View File

@ -22,13 +22,6 @@ module Superenv
def homebrew_extra_paths
paths = []
# On 10.9, there are shims for all tools in /usr/bin.
# On 10.7 and 10.8 we need to add these directories ourselves.
if MacOS::Xcode.without_clt? && MacOS.version <= "10.8"
paths << "#{MacOS::Xcode.prefix}/usr/bin"
paths << "#{MacOS::Xcode.toolchain_path}/usr/bin"
end
paths << MacOS::X11.bin.to_s if x11?
paths
end
@ -96,9 +89,9 @@ module Superenv
def determine_cccfg
s = ""
# Fix issue with sed barfing on unicode characters on Mountain Lion
s << "s" if MacOS.version >= :mountain_lion
# Fix issue with >= 10.8 apr-1-config having broken paths
s << "a" if MacOS.version >= :mountain_lion
s << "s"
# Fix issue with >= Mountain Lion apr-1-config having broken paths
s << "a"
s
end
@ -133,9 +126,9 @@ module Superenv
ENV["ac_have_clock_syscall"] = "no"
end
# On 10.9, the tools in /usr/bin proxy to the active developer directory.
# The tools in /usr/bin proxy to the active developer directory.
# This means we can use them for any combination of CLT and Xcode.
self["HOMEBREW_PREFER_CLT_PROXIES"] = "1" if MacOS.version >= "10.9"
self["HOMEBREW_PREFER_CLT_PROXIES"] = "1"
end
def no_weak_imports

View File

@ -1,20 +1,7 @@
module Hardware
class CPU
class << self
undef optimization_flags, type, family, universal_archs, can_run?,
features, sse4?
PPC_OPTIMIZATION_FLAGS = {
g3: "-mcpu=750",
g4: "-mcpu=7400",
g4e: "-mcpu=7450",
g5: "-mcpu=970",
g5_64: "-mcpu=970 -arch ppc64",
}.freeze
def optimization_flags
OPTIMIZATION_FLAGS.merge(PPC_OPTIMIZATION_FLAGS)
end
undef type, family, universal_archs, features, sse4?
# These methods use info spewed out by sysctl.
# Look in <mach/machine.h> for decoding info.
@ -22,54 +9,37 @@ module Hardware
case sysctl_int("hw.cputype")
when 7
:intel
when 18
:ppc
else
:dunno
end
end
def family
if intel?
case sysctl_int("hw.cpufamily")
when 0x73d67300 # Yonah: Core Solo/Duo
:core
when 0x426f69ef # Merom: Core 2 Duo
:core2
when 0x78ea4fbc # Penryn
:penryn
when 0x6b5a4cd2 # Nehalem
:nehalem
when 0x573B5EEC # Arrandale
:arrandale
when 0x5490B78C # Sandy Bridge
:sandybridge
when 0x1F65E835 # Ivy Bridge
:ivybridge
when 0x10B282DC # Haswell
:haswell
when 0x582ed09c # Broadwell
:broadwell
when 0x37fc219f # Skylake
:skylake
when 0x0f817246 # Kaby Lake
:kabylake
else
:dunno
end
elsif ppc?
case sysctl_int("hw.cpusubtype")
when 9
:g3 # PowerPC 750
when 10
:g4 # PowerPC 7400
when 11
:g4e # PowerPC 7450
when 100
:g5_64 # PowerPC 970
else
:dunno
end
case sysctl_int("hw.cpufamily")
when 0x73d67300 # Yonah: Core Solo/Duo
:core
when 0x426f69ef # Merom: Core 2 Duo
:core2
when 0x78ea4fbc # Penryn
:penryn
when 0x6b5a4cd2 # Nehalem
:nehalem
when 0x573B5EEC # Arrandale
:arrandale
when 0x5490B78C # Sandy Bridge
:sandybridge
when 0x1F65E835 # Ivy Bridge
:ivybridge
when 0x10B282DC # Haswell
:haswell
when 0x582ed09c # Broadwell
:broadwell
when 0x37fc219f # Skylake
:skylake
when 0x0f817246 # Kaby Lake
:kabylake
else
:dunno
end
end
@ -83,20 +53,6 @@ module Hardware
[arch_64_bit, arch_32_bit].extend ArchitectureListExtension
end
# Determines whether the current CPU and macOS combination
# can run an executable of the specified architecture.
# `arch` is a symbol in the same format returned by
# {Hardware::CPU.family}.
def can_run?(arch)
if Hardware::CPU.intel?
intel_can_run? arch
elsif Hardware::CPU.ppc?
ppc_can_run? arch
else
false
end
end
def features
@features ||= sysctl_n(
"machdep.cpu.features",
@ -156,35 +112,6 @@ module Hardware
@properties[keys] = Utils.popen_read("/usr/sbin/sysctl", "-n", *keys)
end
end
def intel_can_run?(arch)
case arch
when *PPC_32BIT_ARCHS
# Rosetta is still available
MacOS.version < :lion
when *PPC_64BIT_ARCHS
# Rosetta never supported PPC64
false
when *INTEL_64BIT_ARCHS
Hardware::CPU.is_64_bit?
when *INTEL_32BIT_ARCHS
true
else # dunno
false
end
end
def ppc_can_run?(arch)
case arch
when *PPC_32BIT_ARCHS
true
when *PPC_64BIT_ARCHS
Hardware::CPU.is_64_bit?
else
# Intel is never supported
false
end
end
end
end
end

View File

@ -4,15 +4,9 @@ module Homebrew
def blacklisted_reason(name)
case name.downcase
when "xcode"
if MacOS.version >= :lion
<<~EOS
Xcode can be installed from the App Store.
EOS
else
<<~EOS
Xcode can be installed from #{Formatter.url("https://developer.apple.com/download/more/")}.
EOS
end
<<~EOS
Xcode can be installed from the App Store.
EOS
else
generic_blacklisted_reason(name)
end

View File

@ -36,7 +36,7 @@ class SystemConfig
end
def clt
@clt ||= if MacOS::CLT.installed? && MacOS::Xcode.version >= "4.3"
@clt ||= if MacOS::CLT.installed?
MacOS::CLT.version
end
end
@ -59,7 +59,7 @@ class SystemConfig
f.puts "CLT: #{clt || "N/A"}"
f.puts "Xcode: #{xcode || "N/A"}"
f.puts "CLT headers: #{clt_headers}" if MacOS::CLT.separate_header_package? && clt_headers
f.puts "XQuartz: #{xquartz}" if !MacOS::XQuartz.provided_by_apple? && xquartz
f.puts "XQuartz: #{xquartz}" if xquartz
end
end
end

View File

@ -4,13 +4,7 @@ module Utils
undef tag
def tag
if MacOS.version >= :lion
MacOS.cat
elsif MacOS.version == :snow_leopard
Hardware::CPU.is_64_bit? ? :snow_leopard : :snow_leopard_32
else
"#{MacOS.cat}_64".to_sym
end
MacOS.cat
end
end

View File

@ -1034,7 +1034,7 @@ class Formula
# called or when brewing a formula.
# This is optional. You can use all the vars like #{version} here.
# EOS
# s += "Some issue only on older systems" if MacOS.version < :mountain_lion
# s += "Some issue only on older systems" if MacOS.version < :el_capitan
# s
# end</pre>
def caveats
@ -2350,12 +2350,9 @@ class Formula
# <pre># Optional and enforce that boost is built with `--with-c++11`.
# depends_on "boost" => [:optional, "with-c++11"]</pre>
# <pre># If a dependency is only needed in certain cases:
# depends_on "sqlite" if MacOS.version == :leopard
# depends_on "sqlite" if MacOS.version == :mavericks
# depends_on :xcode # If the formula really needs full Xcode.
# depends_on :macos => :lion # Needs at least OS X Lion (10.7).
# depends_on :arch => :intel # If this formula only builds on Intel architecture.
# depends_on :arch => :x86_64 # If this formula only builds on Intel x86 64-bit.
# depends_on :arch => :ppc # Only builds on PowerPC?
# depends_on :macos => :mojave # Needs at least OS X Lion (10.14).
# depends_on :x11 => :optional # X11/XQuartz components.
# depends_on :osxfuse # Permits the use of the upstream signed binary or our source package.
# depends_on :tuntap # Does the same thing as above. This is vital for Yosemite and above.</pre>
@ -2366,8 +2363,6 @@ class Formula
# depends_on "python3" => :optional</pre>
# <pre># Python 2.7:
# depends_on "python@2"</pre>
# <pre># Python 2.7 but use system Python where possible
# depends_on "python@2" if MacOS.version <= :snow_leopard</pre>
def depends_on(dep)
specs.each { |spec| spec.depends_on(dep) }
end
@ -2511,10 +2506,14 @@ class Formula
# end</pre>
def fails_with(compiler, &block)
odisabled "fails_with :gcc_4_0" if compiler == :gcc_4_0
odisabled "fails_with :gcc_4_2" if compiler == :gcc_4_2
odisabled "fails_with :gcc" if compiler == :gcc && !block_given?
specs.each { |spec| spec.fails_with(compiler, &block) }
end
def needs(*standards)
odisabled "needs :cxx11" if standards.include?(:cxx11)
odisabled "needs :cxx14" if standards.include?(:cxx14)
specs.each { |spec| spec.needs(*standards) }
end

View File

@ -117,18 +117,6 @@ module Hardware
def feature?(name)
features.include?(name)
end
def can_run?(arch)
if is_32_bit?
arch_32_bit == arch
elsif intel?
(INTEL_32BIT_ARCHS + INTEL_64BIT_ARCHS).include?(arch)
elsif ppc?
(PPC_32BIT_ARCHS + PPC_64BIT_ARCHS).include?(arch)
else
false
end
end
end
end

View File

@ -1,11 +1,6 @@
module Language
module Haskell
module Cabal
def self.included(base)
# use llvm-gcc on Lion or below, as when building GHC)
base.fails_with(:clang) if MacOS.version <= :lion
end
def cabal_sandbox(options = {})
pwd = Pathname.pwd
home = options[:home] || pwd

View File

@ -167,30 +167,6 @@ module OS
end
STANDARD_COMPILERS = {
"3.1.4" => { gcc_4_2_build: 5577 },
"3.2.6" => { gcc_4_2_build: 5666, clang: "1.7", clang_build: 77 },
"4.0" => { gcc_4_2_build: 5666, clang: "2.0", clang_build: 137 },
"4.0.1" => { gcc_4_2_build: 5666, clang: "2.0", clang_build: 137 },
"4.0.2" => { gcc_4_2_build: 5666, clang: "2.0", clang_build: 137 },
"4.2" => { clang: "3.0", clang_build: 211 },
"4.3" => { clang: "3.1", clang_build: 318 },
"4.3.1" => { clang: "3.1", clang_build: 318 },
"4.3.2" => { clang: "3.1", clang_build: 318 },
"4.3.3" => { clang: "3.1", clang_build: 318 },
"4.4" => { clang: "4.0", clang_build: 421 },
"4.4.1" => { clang: "4.0", clang_build: 421 },
"4.5" => { clang: "4.1", clang_build: 421 },
"4.5.1" => { clang: "4.1", clang_build: 421 },
"4.5.2" => { clang: "4.1", clang_build: 421 },
"4.6" => { clang: "4.2", clang_build: 425 },
"4.6.1" => { clang: "4.2", clang_build: 425 },
"4.6.2" => { clang: "4.2", clang_build: 425 },
"4.6.3" => { clang: "4.2", clang_build: 425 },
"5.0" => { clang: "5.0", clang_build: 500 },
"5.0.1" => { clang: "5.0", clang_build: 500 },
"5.0.2" => { clang: "5.0", clang_build: 500 },
"5.1" => { clang: "5.1", clang_build: 503 },
"5.1.1" => { clang: "5.1", clang_build: 503 },
"6.0" => { clang: "6.0", clang_build: 600 },
"6.0.1" => { clang: "6.0", clang_build: 600 },
"6.1" => { clang: "6.0", clang_build: 600 },

View File

@ -1,49 +1,15 @@
require "hardware"
module ArchitectureListExtension
# @private
def fat?
length > 1
end
# @private
def intel_universal?
intersects_all?(Hardware::CPU::INTEL_32BIT_ARCHS, Hardware::CPU::INTEL_64BIT_ARCHS)
end
# @private
def ppc_universal?
intersects_all?(Hardware::CPU::PPC_32BIT_ARCHS, Hardware::CPU::PPC_64BIT_ARCHS)
end
# Old-style 32-bit PPC/Intel universal, e.g. ppc7400 and i386
# @private
def cross_universal?
intersects_all?(Hardware::CPU::PPC_32BIT_ARCHS, Hardware::CPU::INTEL_32BIT_ARCHS)
end
# @private
def universal?
intel_universal? || ppc_universal? || cross_universal?
end
def ppc?
(Hardware::CPU::PPC_32BIT_ARCHS + Hardware::CPU::PPC_64BIT_ARCHS).any? { |a| include? a }
end
# @private
def remove_ppc!
(Hardware::CPU::PPC_32BIT_ARCHS + Hardware::CPU::PPC_64BIT_ARCHS).each { |a| delete a }
intersects_all?(Hardware::CPU::INTEL_32BIT_ARCHS, Hardware::CPU::INTEL_64BIT_ARCHS)
end
def as_arch_flags
map { |a| "-arch #{a}" }.join(" ")
end
def as_cmake_arch_flags
join(";")
end
protected
def intersects_all?(*set)

View File

@ -84,8 +84,6 @@ module OS
@sdk_prefix ||= begin
# Xcode.prefix is pretty smart, so let's look inside to find the sdk
sdk_prefix = "#{Xcode.prefix}/Platforms/MacOSX.platform/Developer/SDKs"
# Xcode < 4.3 style
sdk_prefix = "/Developer/SDKs" unless File.directory? sdk_prefix
# Finally query Xcode itself (this is slow, so check it last)
sdk_platform_path = Utils.popen_read(DevelopmentTools.locate("xcrun"), "--show-sdk-platform-path").chomp
sdk_prefix = File.join(sdk_platform_path, "Developer", "SDKs") unless File.directory? sdk_prefix

View File

@ -4,17 +4,12 @@ module OS
module Mac
class Version < ::Version
SYMBOLS = {
mojave: "10.14",
high_sierra: "10.13",
sierra: "10.12",
el_capitan: "10.11",
yosemite: "10.10",
mavericks: "10.9",
mountain_lion: "10.8",
lion: "10.7",
snow_leopard: "10.6",
leopard_64: "10.5",
leopard: "10.5",
mojave: "10.14",
high_sierra: "10.13",
sierra: "10.12",
el_capitan: "10.11",
yosemite: "10.10",
mavericks: "10.9",
}.freeze
def self.from_symbol(sym)

View File

@ -9,10 +9,6 @@ module OS
def latest_version
case MacOS.version
when "10.5" then "3.1.4"
when "10.6" then "3.2.6"
when "10.7" then "4.6.3"
when "10.8" then "5.1.1"
when "10.9" then "6.2"
when "10.10" then "7.2.1"
when "10.11" then "8.2.1"
@ -59,7 +55,7 @@ module OS
end
def without_clt?
version >= "4.3" && !MacOS::CLT.installed?
!MacOS::CLT.installed?
end
# Returns a Pathname object corresponding to Xcode.app's Developer
@ -80,8 +76,6 @@ module OS
end
def toolchain_path
return if version < "4.3"
Pathname.new("#{prefix}/Toolchains/XcodeDefault.xctoolchain")
end
@ -110,14 +104,14 @@ module OS
end
def update_instructions
if MacOS.version >= "10.9" && !OS::Mac.prerelease?
if OS::Mac.prerelease?
<<~EOS
Xcode can be updated from the App Store.
Xcode can be updated from:
https://developer.apple.com/download/more/
EOS
else
<<~EOS
Xcode can be updated from
https://developer.apple.com/download/more/
Xcode can be updated from the App Store.
EOS
end
end
@ -169,18 +163,6 @@ module OS
# comparable version.
case (DevelopmentTools.clang_version.to_f * 10).to_i
when 0 then "dunno"
when 1..14 then "3.2.2"
when 15 then "3.2.4"
when 16 then "3.2.5"
when 17..20 then "4.0"
when 21 then "4.1"
when 22..30 then "4.2"
when 31 then "4.3"
when 40 then "4.4"
when 41 then "4.5"
when 42 then "4.6"
when 50 then "5.0"
when 51 then "5.1"
when 60 then "6.0"
when 61 then "6.1"
when 70 then "7.0"
@ -194,24 +176,14 @@ module OS
end
end
def provides_gcc?
version < "4.3"
end
def default_prefix?
if version < "4.3"
prefix.to_s.start_with? "/Developer"
else
prefix.to_s == "/Applications/Xcode.app/Contents/Developer"
end
prefix.to_s == "/Applications/Xcode.app/Contents/Developer"
end
end
module CLT
module_function
STANDALONE_PKG_ID = "com.apple.pkg.DeveloperToolsCLILeo".freeze
FROM_XCODE_PKG_ID = "com.apple.pkg.DeveloperToolsCLI".freeze
# The original Mavericks CLT package ID
EXECUTABLE_PKG_ID = "com.apple.pkg.CLTools_Executables".freeze
MAVERICKS_NEW_PKG_ID = "com.apple.pkg.CLTools_Base".freeze # obsolete
@ -220,8 +192,7 @@ module OS
"/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_:macos_version.pkg".freeze
HEADER_PKG_ID = "com.apple.pkg.macOS_SDK_headers_for_macOS_10.14".freeze
# Returns true even if outdated tools are installed, e.g.
# tools from Xcode 4.x on 10.9
# Returns true even if outdated tools are installed
def installed?
!version.null?
end
@ -257,16 +228,10 @@ module OS
<<~EOS
Update them from Software Update in System Preferences.
EOS
elsif MacOS.version >= "10.9"
else
<<~EOS
Update them from Software Update in the App Store.
EOS
elsif MacOS.version == "10.8" || MacOS.version == "10.7"
<<~EOS
The standalone package can be obtained from
https://developer.apple.com/download/more/
or it can be installed via Xcode's preferences.
EOS
end
end
@ -280,9 +245,7 @@ module OS
when "10.12" then "900.0.39.2"
when "10.11" then "800.0.42.1"
when "10.10" then "700.1.81"
when "10.9" then "600.0.57"
when "10.8" then "503.0.40"
else "425.0.28"
else "600.0.57"
end
end
@ -296,8 +259,6 @@ module OS
end
def below_minimum_version?
# Lion was the first version of OS X to ship with a CLT
return false if MacOS.version < :lion
return false unless installed?
version < minimum_version
@ -311,9 +272,6 @@ module OS
end
def detect_clang_version
# Lion was the first version of OS X to ship with a CLT
return if MacOS.version < :lion
path = if MacOS.version >= :mavericks
"#{PKG_PATH}/usr/bin/clang"
else
@ -349,17 +307,9 @@ module OS
end
def detect_version
# CLT isn't a distinct entity pre-4.3, and pkgutil doesn't exist
# at all on Tiger, so just count it as installed if Xcode is installed
if MacOS::Xcode.installed? && MacOS::Xcode.version < "3.0"
return MacOS::Xcode.version
end
version = nil
[EXECUTABLE_PKG_ID, MAVERICKS_NEW_PKG_ID, STANDALONE_PKG_ID, FROM_XCODE_PKG_ID].each do |id|
if MacOS.version >= :mavericks
next unless File.exist?("#{PKG_PATH}/usr/bin/clang")
end
[EXECUTABLE_PKG_ID, MAVERICKS_NEW_PKG_ID].each do |id|
next unless File.exist?("#{PKG_PATH}/usr/bin/clang")
version = MacOS.pkgutil_info(id)[/version: (.+)$/, 1]
break if version
end

View File

@ -7,7 +7,6 @@ module OS
DEFAULT_BUNDLE_PATH = Pathname.new("Applications/Utilities/XQuartz.app").freeze
FORGE_BUNDLE_ID = "org.macosforge.xquartz.X11".freeze
APPLE_BUNDLE_ID = "org.x.X11".freeze
FORGE_PKG_ID = "org.macosforge.xquartz.pkg".freeze
PKGINFO_VERSION_MAP = {
@ -44,17 +43,12 @@ module OS
def detect_version
if (path = bundle_path) && path.exist? && (version = version_from_mdls(path))
version
elsif prefix.to_s == "/usr/X11" || prefix.to_s == "/usr/X11R6"
guess_system_version
else
version_from_pkgutil
end
end
def minimum_version
version = guess_system_version
return version unless version == "dunno"
# Update this a little later than latest_version to give people
# time to upgrade.
"2.7.11"
@ -63,12 +57,7 @@ module OS
# - https://xquartz.macosforge.org/trac/wiki
# - https://xquartz.macosforge.org/trac/wiki/Releases
def latest_version
case MacOS.version
when "10.5"
"2.6.3"
else
"2.7.11"
end
"2.7.11"
end
def bundle_path
@ -77,7 +66,7 @@ module OS
# Ask Spotlight where XQuartz is. If the user didn't install XQuartz
# in the conventional place, this is our only option.
MacOS.app_with_bundle_id(FORGE_BUNDLE_ID, APPLE_BUNDLE_ID)
MacOS.app_with_bundle_id(FORGE_BUNDLE_ID)
end
def version_from_mdls(path)
@ -87,18 +76,6 @@ module OS
version unless version.empty?
end
# The XQuartz that Apple shipped in OS X through 10.7 does not have a
# pkg-util entry, so if Spotlight indexing is disabled we must make an
# educated guess as to what version is installed.
def guess_system_version
case MacOS.version
when "10.5" then "2.1.6"
when "10.6" then "2.3.6"
when "10.7" then "2.6.3"
else "dunno"
end
end
# Upstream XQuartz *does* have a pkg-info entry, so if we can't get it
# from mdls, we can try pkgutil. This is very slow.
def version_from_pkgutil
@ -106,23 +83,12 @@ module OS
PKGINFO_VERSION_MAP.fetch(str, str)
end
def provided_by_apple?
[FORGE_BUNDLE_ID, APPLE_BUNDLE_ID].find do |id|
MacOS.app_with_bundle_id(id)
end == APPLE_BUNDLE_ID
end
# This should really be private, but for compatibility reasons it must
# remain public. New code should use `MacOS::X11.bin`, `MacOS::X11.lib` and
# `MacOS::X11.include` instead, as that accounts for Xcode-only systems.
def prefix
@prefix ||= if Pathname.new("/opt/X11/lib/libpng.dylib").exist?
Pathname.new("/opt/X11")
elsif Pathname.new("/usr/X11/lib/libpng.dylib").exist?
Pathname.new("/usr/X11")
# X11 doesn't include libpng on Tiger
elsif Pathname.new("/usr/X11R6/lib/libX11.dylib").exist?
Pathname.new("/usr/X11R6")
end
end
@ -132,34 +98,20 @@ module OS
def outdated?
return false unless installed?
return false if provided_by_apple?
version < latest_version
end
# If XQuartz and/or the CLT are installed, headers will be found under
# `/opt/X11/include` or `/usr/X11/include`. For Xcode-only systems, they are
# found in the SDK, so we use {.sdk_path} for both the headers and libraries.
# Confusingly, executables (e.g. config scripts) are only found under
# `/opt/X11/bin` or `/usr/X11/bin` in all cases.
def effective_prefix
if provided_by_apple? && Xcode.without_clt?
Pathname.new("#{OS::Mac.sdk_path}/usr/X11")
else
prefix
end
end
def bin
prefix/"bin"
end
def include
effective_prefix/"include"
prefix/"include"
end
def lib
effective_prefix/"lib"
prefix/"lib"
end
def share

View File

@ -28,13 +28,9 @@ class XcodeRequirement < Requirement
Xcode#{version} cannot be installed on macOS #{MacOS.version}.
You must upgrade your version of macOS.
EOS
elsif MacOS.version >= :lion
message + <<~EOS
Xcode can be installed from the App Store.
EOS
else
message + <<~EOS
Xcode can be installed from #{Formatter.url("https://developer.apple.com/download/more/")}.
Xcode can be installed from the App Store.
EOS
end
end

View File

@ -362,13 +362,6 @@ module RuboCop
problem "`depends_on` can take requirement classes instead of instances"
end
os = [:leopard?, :snow_leopard?, :lion?, :mountain_lion?]
os.each do |version|
find_instance_method_call(body_node, "MacOS", version) do |method|
problem "\"#{method.source}\" is deprecated, use a comparison to MacOS.version instead"
end
end
find_instance_method_call(body_node, "Dir", :[]) do |method|
next unless parameters(method).size == 1

View File

@ -5,7 +5,7 @@ class Sandbox
SANDBOX_EXEC = "/usr/bin/sandbox-exec".freeze
def self.available?
OS.mac? && OS::Mac.version >= "10.6" && File.executable?(SANDBOX_EXEC)
OS.mac? && File.executable?(SANDBOX_EXEC)
end
def self.formula?(_formula)

View File

@ -209,10 +209,14 @@ class SoftwareSpec
def fails_with(compiler, &block)
odisabled "fails_with :gcc_4_0" if compiler == :gcc_4_0
odisabled "fails_with :gcc_4_2" if compiler == :gcc_4_2
odisabled "fails_with :gcc" if compiler == :gcc && !block_given?
compiler_failures << CompilerFailure.create(compiler, &block)
end
def needs(*standards)
odisabled "needs :cxx11" if standards.include?(:cxx11)
odisabled "needs :cxx14" if standards.include?(:cxx14)
standards.each do |standard|
compiler_failures.concat CompilerFailure.for_standard(standard)
end

View File

@ -126,10 +126,8 @@ shared_examples EnvActivation do
describe "#compiler" do
it "allows switching compilers" do
[:clang, :gcc_4_2].each do |compiler|
subject.public_send(compiler)
expect(subject.compiler).to eq(compiler)
end
subject.public_send("gcc-6")
expect(subject.compiler).to eq("gcc-6")
end
end
@ -162,12 +160,6 @@ shared_examples EnvActivation do
expect(subject.compiler_any_clang?(:llvm_clang)).to be true
end
end
describe "#compiler_with_cxx11_support?" do
it "returns true for gcc-4.9" do
expect(subject.compiler_with_cxx11_support?("gcc-4.9")).to be true
end
end
end
describe Stdenv do
@ -183,17 +175,6 @@ describe Superenv do
end
describe "#cxx11" do
it "raises an error when the compiler isn't supported" do
%w[gcc gcc-4.7].each do |compiler|
subject["HOMEBREW_CC"] = compiler
expect { subject.cxx11 }
.to raise_error(/The selected compiler doesn't support C\+\+11:/)
expect(subject["HOMEBREW_CCCFG"]).to be nil
end
end
it "supports gcc-5" do
subject["HOMEBREW_CC"] = "gcc-5"
subject.cxx11

View File

@ -6,18 +6,17 @@ describe CompilerFailure do
describe "::create" do
it "creates a failure when given a symbol" do
failure = described_class.create(:clang)
expect(failure).to fail_with(double("Compiler", name: :clang, version: 425))
expect(failure).to fail_with(double("Compiler", name: :clang, version: 600))
end
it "can be given a build number in a block" do
failure = described_class.create(:clang) { build 211 }
expect(failure).to fail_with(double("Compiler", name: :clang, version: 210))
expect(failure).not_to fail_with(double("Compiler", name: :clang, version: 318))
failure = described_class.create(:clang) { build 700 }
expect(failure).to fail_with(double("Compiler", name: :clang, version: 700))
end
it "can be given an empty block" do
failure = described_class.create(:clang) {}
expect(failure).to fail_with(double("Compiler", name: :clang, version: 425))
expect(failure).to fail_with(double("Compiler", name: :clang, version: 600))
end
it "creates a failure when given a hash" do

View File

@ -4,14 +4,13 @@ require "software_spec"
describe CompilerSelector do
subject { described_class.new(software_spec, versions, compilers) }
let(:compilers) { [:clang, :gcc_4_2, :gnu] }
let(:compilers) { [:clang, :gnu] }
let(:software_spec) { SoftwareSpec.new }
let(:cc) { :clang }
let(:versions) do
double(
gcc_4_2_build_version: Version.create("5666"),
llvm_build_version: Version::NULL,
clang_build_version: Version.create("425"),
llvm_build_version: Version::NULL,
clang_build_version: Version.create("600"),
)
end
@ -37,36 +36,10 @@ describe CompilerSelector do
it "still returns gcc-7 if it fails with gcc without a specific version" do
software_spec.fails_with(:clang)
software_spec.fails_with(:gcc_4_2)
expect(subject.compiler).to eq("gcc-7")
end
it "returns gcc if it fails with clang and llvm" do
software_spec.fails_with(:clang)
expect(subject.compiler).to eq(:gcc_4_2)
end
it "returns clang if it fails with gcc and llvm" do
software_spec.fails_with(:gcc_4_2)
expect(subject.compiler).to eq(:clang)
end
example "returns gcc if it fails with a specific gcc version" do
software_spec.fails_with(:clang)
software_spec.fails_with(gcc: "7")
expect(subject.compiler).to eq(:gcc_4_2)
end
example "returns a lower version of gcc if it fails with the highest version" do
software_spec.fails_with(:clang)
software_spec.fails_with(:gcc_4_2)
software_spec.fails_with(gcc: "7")
expect(subject.compiler).to eq("gcc-6")
end
it "raises an error when gcc or llvm is missing" do
allow(versions).to receive(:gcc_4_2_build_version).and_return(Version::NULL)
software_spec.fails_with(:clang)
software_spec.fails_with(gcc: "7")
software_spec.fails_with(gcc: "6")

View File

@ -3,21 +3,13 @@ require "cxxstdlib"
describe CxxStdlib do
let(:clang) { described_class.create(:libstdcxx, :clang) }
let(:gcc) { described_class.create(:libstdcxx, :gcc) }
let(:gcc42) { described_class.create(:libstdcxx, :gcc_4_2) }
let(:gcc6) { described_class.create(:libstdcxx, "gcc-6") }
let(:gcc7) { described_class.create(:libstdcxx, "gcc-7") }
let(:lcxx) { described_class.create(:libcxx, :clang) }
let(:purec) { described_class.create(nil, :clang) }
describe "#compatible_with?" do
specify "Apple libstdcxx intercompatibility" do
expect(clang).to be_compatible_with(gcc)
expect(clang).to be_compatible_with(gcc42)
end
specify "compatibility with itself" do
expect(gcc).to be_compatible_with(gcc)
expect(gcc7).to be_compatible_with(gcc7)
expect(clang).to be_compatible_with(clang)
end
@ -49,8 +41,6 @@ describe CxxStdlib do
describe "#apple_compiler?" do
it "returns true for Apple compilers" do
expect(clang).to be_an_apple_compiler
expect(gcc).to be_an_apple_compiler
expect(gcc42).to be_an_apple_compiler
end
it "returns false for non-Apple compilers" do

View File

@ -5,7 +5,6 @@ describe Hardware::CPU do
let(:cpu_types) {
[
:intel,
:ppc,
:dunno,
]
}
@ -37,78 +36,4 @@ describe Hardware::CPU do
expect(cpu_families).to include described_class.family
end
end
describe "::can_run?" do
subject { described_class }
matcher :be_able_to_run do |arch|
match do |expected|
allow(expected).to receive(:type).and_return type
allow(expected).to receive(:bits).and_return bits
expect(expected.can_run?(arch)).to be true
end
end
let(:type) { described_class.type }
let(:bits) { described_class.bits }
before do
allow(described_class).to receive(:type).and_return type
allow(described_class).to receive(:bits).and_return bits
end
context "when on an 32-bit Intel machine" do
let(:type) { :intel }
let(:bits) { 32 }
it { is_expected.to be_able_to_run :i386 }
it { is_expected.not_to be_able_to_run :x86_64 }
it { is_expected.not_to be_able_to_run :ppc32 }
it { is_expected.not_to be_able_to_run :ppc64 }
end
context "when on an 64-bit Intel machine" do
let(:type) { :intel }
let(:bits) { 64 }
it { is_expected.to be_able_to_run :i386 }
it { is_expected.to be_able_to_run :x86_64 }
it { is_expected.not_to be_able_to_run :ppc32 }
it { is_expected.not_to be_able_to_run :ppc64 }
end
context "when on a 32-bit PowerPC machine" do
let(:type) { :ppc }
let(:bits) { 32 }
it { is_expected.not_to be_able_to_run :i386 }
it { is_expected.not_to be_able_to_run :x86_64 }
it { is_expected.to be_able_to_run :ppc32 }
it { is_expected.not_to be_able_to_run :ppc64 }
end
context "when on a 64-bit PowerPC machine" do
let(:type) { :ppc }
let(:bits) { 64 }
it { is_expected.not_to be_able_to_run :i386 }
it { is_expected.not_to be_able_to_run :x86_64 }
it { is_expected.to be_able_to_run :ppc32 }
it { is_expected.to be_able_to_run :ppc64 }
end
context "when the CPU type is unknown" do
let(:type) { :dunno }
it { is_expected.not_to be_able_to_run :i386 }
it { is_expected.not_to be_able_to_run :x86_64 }
it { is_expected.not_to be_able_to_run :ppc32 }
it { is_expected.not_to be_able_to_run :ppc64 }
end
context "when the architecture is unknown" do
it { is_expected.not_to be_able_to_run :blah }
end
end
end

View File

@ -7,20 +7,7 @@ describe DependencyCollector do
described_class.clear_cache
end
specify "#tar_needs_xz_dependency?" do
allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.9"))
expect(described_class).not_to need_tar_xz_dependency
end
specify "Resource xz pre-Mavericks dependency" do
allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.8"))
resource = Resource.new
resource.url("https://brew.sh/foo.tar.xz")
expect(subject.add(resource)).to eq(Dependency.new("xz", [:build]))
end
specify "Resource xz Mavericks or newer dependency" do
allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.9"))
specify "Resource dependency from a '.xz' URL" do
resource = Resource.new
resource.url("https://brew.sh/foo.tar.xz")
expect(subject.add(resource)).to be nil

View File

@ -1,56 +0,0 @@
require "hardware"
require "extend/os/mac/hardware/cpu"
describe Hardware::CPU do
describe "::can_run?" do
it "reports that Intel Macs can run Intel executables" do
allow(described_class).to receive(:type).and_return :intel
allow(described_class).to receive(:bits).and_return 64
expect(described_class.can_run?(:i386)).to be true
expect(described_class.can_run?(:x86_64)).to be true
end
it "reports that PowerPC Macs can run PowerPC executables" do
allow(described_class).to receive(:type).and_return :ppc
allow(described_class).to receive(:bits).and_return 64
expect(described_class.can_run?(:ppc)).to be true
expect(described_class.can_run?(:ppc64)).to be true
end
it "reports that 32-bit Intel Macs can't run x86_64 executables" do
allow(described_class).to receive(:type).and_return :intel
allow(described_class).to receive(:bits).and_return 32
expect(described_class.can_run?(:x86_64)).to be false
end
it "reports that 32-bit PowerPC Macs can't run ppc64 executables" do
allow(described_class).to receive(:type).and_return :ppc
allow(described_class).to receive(:bits).and_return 32
expect(described_class.can_run?(:ppc64)).to be false
end
it "reports that Intel Macs can only run 32-bit PowerPC executables on 10.6 and older" do
allow(described_class).to receive(:type).and_return :intel
allow(OS::Mac).to receive(:version).and_return OS::Mac::Version.new "10.6"
expect(described_class.can_run?(:ppc)).to be true
allow(OS::Mac).to receive(:version).and_return OS::Mac::Version.new "10.7"
expect(described_class.can_run?(:ppc)).to be false
end
it "reports that PowerPC Macs can't run Intel executables" do
allow(described_class).to receive(:type).and_return :ppc
expect(described_class.can_run?(:i386)).to be false
expect(described_class.can_run?(:x86_64)).to be false
end
it "returns false for unknown CPU types" do
allow(described_class).to receive(:type).and_return :dunno
expect(described_class.can_run?(:i386)).to be false
end
it "returns false for unknown arches" do
expect(described_class.can_run?(:blah)).to be false
end
end
end

View File

@ -110,42 +110,18 @@ describe ArchitectureListExtension do
specify "universal checks" do
expect(archs).to be_universal
expect(archs).to be_intel_universal
expect(archs).to be_ppc_universal
expect(archs).to be_cross_universal
expect(archs).to be_fat
non_universal = [:i386].extend(described_class)
expect(non_universal).not_to be_universal
intel_only = [:i386, :x86_64].extend(described_class)
expect(intel_only).to be_universal
expect(intel_only).not_to be_ppc_universal
expect(intel_only).not_to be_cross_universal
ppc_only = [:ppc970, :ppc64].extend(described_class)
expect(ppc_only).to be_universal
expect(ppc_only).not_to be_intel_universal
expect(ppc_only).not_to be_cross_universal
cross = [:ppc7400, :i386].extend(described_class)
expect(cross).to be_universal
expect(cross).not_to be_intel_universal
expect(cross).not_to be_ppc_universal
end
specify "messaging flags" do
archs.remove_ppc!
expect(archs.length).to eq(2)
expect(archs.as_arch_flags).to match(/-arch i386/)
expect(archs.as_arch_flags).to match(/-arch x86_64/)
end
specify "architecture flags" do
pn = dylib_path("fat")
expect(pn.archs).to be_intel_universal
expect(pn.archs).to be_universal
expect(pn.archs.as_arch_flags).to eq("-arch x86_64 -arch i386")
expect(pn.archs.as_cmake_arch_flags).to eq("x86_64;i386")
end
end

View File

@ -2,13 +2,13 @@ require "version"
require "os/mac/version"
describe OS::Mac::Version do
subject { described_class.new("10.7") }
subject { described_class.new("10.10") }
specify "comparison with Symbol" do
expect(subject).to be > :snow_leopard
expect(subject).to be == :lion
expect(subject).to be === :lion # rubocop:disable Style/CaseEquality
expect(subject).to be < :mountain_lion
expect(subject).to be > :mavericks
expect(subject).to be == :yosemite
expect(subject).to be === :yosemite # rubocop:disable Style/CaseEquality
expect(subject).to be < :el_capitan
end
specify "comparison with Fixnum" do
@ -17,35 +17,33 @@ describe OS::Mac::Version do
end
specify "comparison with Float" do
expect(subject).to be > 10.6
expect(subject).to be == 10.7
expect(subject).to be === 10.7 # rubocop:disable Style/CaseEquality
expect(subject).to be < 10.8
expect(subject).to be > 10.9
expect(subject).to be < 10.11
end
specify "comparison with String" do
expect(subject).to be > "10.6"
expect(subject).to be == "10.7"
expect(subject).to be === "10.7" # rubocop:disable Style/CaseEquality
expect(subject).to be < "10.8"
expect(subject).to be > "10.9"
expect(subject).to be == "10.10"
expect(subject).to be === "10.10" # rubocop:disable Style/CaseEquality
expect(subject).to be < "10.11"
end
specify "comparison with Version" do
expect(subject).to be > Version.create("10.6")
expect(subject).to be == Version.create("10.7")
expect(subject).to be === Version.create("10.7") # rubocop:disable Style/CaseEquality
expect(subject).to be < Version.create("10.8")
expect(subject).to be > Version.create("10.9")
expect(subject).to be == Version.create("10.10")
expect(subject).to be === Version.create("10.10") # rubocop:disable Style/CaseEquality
expect(subject).to be < Version.create("10.11")
end
specify "#from_symbol" do
expect(described_class.from_symbol(:lion)).to eq(subject)
expect(described_class.from_symbol(:yosemite)).to eq(subject)
expect { described_class.from_symbol(:foo) }
.to raise_error(ArgumentError)
end
specify "#pretty_name" do
expect(described_class.new("10.11").pretty_name).to eq("El Capitan")
expect(described_class.new("10.8").pretty_name).to eq("Mountain Lion")
expect(described_class.new("10.14").pretty_name).to eq("Mojave")
expect(described_class.new("10.10").pretty_name).to eq("Yosemite")
end
end

View File

@ -483,17 +483,6 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
RUBY
end
it "old style OS check" do
expect_offense(<<~RUBY)
class Foo < Formula
desc "foo"
url 'https://brew.sh/foo-1.0.tgz'
depends_on :foo if MacOS.snow_leopard?
^^^^^^^^^^^^^^^^^^^ \"MacOS.snow_leopard?\" is deprecated, use a comparison to MacOS.version instead
end
RUBY
end
it "non glob DIR usage" do
expect_offense(<<~RUBY)
class Foo < Formula

View File

@ -6,7 +6,7 @@ cask 'with-depends-on-macos-array' do
homepage 'https://brew.sh/with-depends-on-macos-array'
# since all OS releases are included, this should always pass
depends_on macos: ['10.5', '10.6', '10.7', '10.8', '10.9', '10.10', MacOS.version.to_s]
depends_on macos: ['10.9', '10.10', MacOS.version.to_s]
app 'Caffeine.app'
end

View File

@ -5,7 +5,7 @@ cask 'with-depends-on-macos-comparison' do
url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
homepage 'https://brew.sh/with-depends-on-macos-comparison'
depends_on macos: '>= 10.5'
depends_on macos: '>= 10.9'
app 'Caffeine.app'
end

View File

@ -6,7 +6,7 @@ cask 'with-depends-on-macos-failure' do
homepage 'https://brew.sh/with-depends-on-macos-failure'
# guarantee a mismatched release
depends_on macos: MacOS.version.to_s == '10.5' ? '10.6' : '10.5'
depends_on macos: MacOS.version.to_s == '10.9' ? '10.10' : '10.9'
app 'Caffeine.app'
end

View File

@ -2,26 +2,9 @@ require "utils/bottles"
describe Utils::Bottles do
describe "#tag", :needs_macos do
it "returns :leopard_64 on Leopard Intel 64-bit" do
allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.5"))
allow(Hardware::CPU).to receive(:type).and_return(:intel)
expect(described_class.tag).to eq(:leopard_64)
end
it "returns :snow_leopard on Snow Leopard 64-bit" do
allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.6"))
allow(Hardware::CPU).to receive(:is_64_bit?).and_return(true)
expect(described_class.tag).to eq(:snow_leopard)
end
it "returns :lion on Lion" do
allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.7"))
expect(described_class.tag).to eq(:lion)
end
it "returns :mountain_lion on Mountain Lion" do
allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.8"))
expect(described_class.tag).to eq(:mountain_lion)
it "returns :mavericks on Mavericks" do
allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.9"))
expect(described_class.tag).to eq(:mavericks)
end
end
end

View File

@ -3,9 +3,9 @@ require "utils/bottles"
describe Utils::Bottles::Collector do
describe "#fetch_checksum_for" do
it "returns passed tags" do
subject[:lion] = "foo"
subject[:mountain_lion] = "bar"
expect(subject.fetch_checksum_for(:mountain_lion)).to eq(["bar", :mountain_lion])
subject[:yosemite] = "foo"
subject[:el_captain] = "bar"
expect(subject.fetch_checksum_for(:el_captain)).to eq(["bar", :el_captain])
end
it "returns nil if empty" do
@ -13,14 +13,14 @@ describe Utils::Bottles::Collector do
end
it "returns nil when there is no match" do
subject[:lion] = "foo"
subject[:yosemite] = "foo"
expect(subject.fetch_checksum_for(:foo)).to be nil
end
it "uses older tags when needed", :needs_macos do
subject[:lion] = "foo"
expect(subject.fetch_checksum_for(:mountain_lion)).to eq(["foo", :lion])
expect(subject.fetch_checksum_for(:snow_leopard)).to be nil
subject[:yosemite] = "foo"
expect(subject.fetch_checksum_for(:yosemite)).to eq(["foo", :yosemite])
expect(subject.fetch_checksum_for(:mavericks)).to be nil
end
end
end

View File

@ -4,7 +4,6 @@ This is a list of commonly encountered problems, known issues, and their solutio
### `brew` complains about absence of "Command Line Tools"
You need to have the Xcode Command Line Utilities installed (and updated): run `xcode-select --install` in the terminal.
(In OS X prior to 10.9, the "Command Line Tools" package can alternatively be installed from within Xcode. `⌘,` will get you to preferences. Visit the "Downloads" tab and hit the install button next to "Command Line Tools".)
### Ruby: `bad interpreter: /usr/bin/ruby^M: no such file or directory`
You cloned with `git`, and your Git configuration is set to use Windows line endings. See this page: <https://help.github.com/articles/dealing-with-line-endings>
@ -29,28 +28,6 @@ cd $(brew --repository)/Library
git clean -fd
```
### Ruby: `invalid multibyte escape: /^\037\213/`
You see an error similar to:
```
Error: /usr/local/Library/Homebrew/download_strategy.rb:84: invalid multibyte escape: /^\037\213/
invalid multibyte escape: /^\037\235/
```
In the past, Homebrew assumed that `/usr/bin/ruby` was Ruby 1.8. On OS X 10.9, it is now Ruby 2.0. There are various incompatibilities between the two versions, so if you upgrade to OS X 10.9 while using a sufficiently old version of Homebrew, you will encounter errors.
The incompatibilities have been addressed in more recent versions of Homebrew, and instead of making assumptions about `/usr/bin/ruby`, it uses the executable inside macOS's Ruby framework or a vendored Ruby.
To recover from this situation, do the following:
```sh
cd $(brew --prefix)
git fetch origin
git reset --hard FETCH_HEAD
brew update
```
### `launchctl` refuses to load launchd plist files
When trying to load a plist file into launchctl, you receive an error that resembles

View File

@ -7,8 +7,8 @@ add-ons available to all users:
* `/Library/Python`
* `/Library/Perl`
Starting with OS X Lion (10.7), you need `sudo` to install to these like
so: `sudo gem install`, `sudo easy_install` or `sudo cpan -i`.
You need `sudo` to install to these like so: `sudo gem install`,
`sudo easy_install` or `sudo cpan -i`.
An option to avoid sudo is to use an access control list. For example:

View File

@ -10,6 +10,7 @@ installed to `/usr/local` already. It tells you exactly what it will do before
it does it too. You have to confirm everything it will do before it starts.
## macOS Requirements
* An 64-bit Intel CPU <sup>[1](#1)</sup>
* macOS 10.12 (or higher) <sup>[2](#2)</sup>
* Command Line Tools (CLT) for Xcode: `xcode-select --install`,
@ -24,6 +25,7 @@ it does it too. You have to confirm everything it will do before it starts.
Check out [the Linuxbrew installation documentation](Linuxbrew.md).
### Untar anywhere
Just extract (or `git clone`) Homebrew wherever you want. Just avoid:
* Directories with names that contain spaces. Homebrew itself can handle spaces, but many build scripts cannot.
@ -40,9 +42,11 @@ mkdir homebrew && curl -L https://github.com/Homebrew/brew/tarball/master | tar
```
### Multiple installations
Create a Homebrew installation wherever you extract the tarball. Whichever `brew` command is called is where the packages will be installed. You can use this as you see fit, e.g. a system set of libs in `/usr/local` and tweaked formulae for development in `~/homebrew`.
## Uninstallation
Uninstallation is documented in the [FAQ](FAQ.md).
<a name="1"><sup>1</sup></a> For 32-bit or PPC support see

View File

@ -18,13 +18,7 @@ Applications should unconditionally bundle all of their Python-language dependen
Formulae for apps that require Python 3 **should** declare an unconditional dependency on `"python"`. These apps **must** work with the current Homebrew Python 3.x formula.
Applications that are compatible with Python 2 **should** use the Apple-provided system Python in `/usr/bin` on systems that provide Python 2.7. To do this, declare:
```ruby
depends_on "python@2" if MacOS.version <= :snow_leopard
```
No explicit Python dependency is needed on recent OS versions since `/usr/bin` is always in `PATH` for Homebrew formulae; on Leopard and older, the `python` in `PATH` is used if it's at least version 2.7, or else Homebrew's Python 2.7.x is installed.
Applications that are compatible with Python 2 **should** use the Apple-provided system Python in `/usr/bin` on systems that provide Python 2.7. No explicit Python dependency is needed since `/usr/bin` is always in `PATH` for Homebrew formulae.
### Installing