diff options
| author | Mike McQuaid | 2016-09-24 20:48:03 +0100 |
|---|---|---|
| committer | Mike McQuaid | 2016-09-24 20:48:03 +0100 |
| commit | e767fd3df9d179fca0445cc0bc0fdc061ad857d6 (patch) | |
| tree | 93e9db33313b36eebe7d7fb3aedf0f92cc2c3918 /Library/Homebrew/extend | |
| parent | 7fc241765e3654718235791c32e5638bf7f8e15a (diff) | |
| parent | 232078df57418004bb9bf7abef877e734fcf7005 (diff) | |
| download | brew-e767fd3df9d179fca0445cc0bc0fdc061ad857d6.tar.bz2 | |
Merge branch 'master' into mkdir_with_intermediates
Diffstat (limited to 'Library/Homebrew/extend')
30 files changed, 133 insertions, 182 deletions
diff --git a/Library/Homebrew/extend/ARGV.rb b/Library/Homebrew/extend/ARGV.rb index d9f599877..c217ed8a5 100644 --- a/Library/Homebrew/extend/ARGV.rb +++ b/Library/Homebrew/extend/ARGV.rb @@ -30,7 +30,7 @@ module HomebrewArgvExtension if f.any_version_installed? tab = Tab.for_formula(f) resolved_spec = spec(nil) || tab.spec - f.set_active_spec(resolved_spec) if f.send(resolved_spec) + f.active_spec = resolved_spec if f.send(resolved_spec) f.build = tab if f.head? && tab.tabfile k = Keg.new(tab.tabfile.parent) @@ -88,11 +88,11 @@ module HomebrewArgvExtension Formulary.from_rack(rack) end - if (prefix = f.installed_prefix).directory? - Keg.new(prefix) - else + unless (prefix = f.installed_prefix).directory? raise MultipleVersionsInstalledError, rack.basename end + + Keg.new(prefix) end rescue FormulaUnavailableError raise <<-EOS.undent @@ -216,7 +216,7 @@ module HomebrewArgvExtension end def build_all_from_source? - !!ENV["HOMEBREW_BUILD_FROM_SOURCE"] + !ENV["HOMEBREW_BUILD_FROM_SOURCE"].nil? end # Whether a given formula should be built from source during the current diff --git a/Library/Homebrew/extend/ENV/shared.rb b/Library/Homebrew/extend/ENV/shared.rb index 447e4dd29..909dc4f94 100644 --- a/Library/Homebrew/extend/ENV/shared.rb +++ b/Library/Homebrew/extend/ENV/shared.rb @@ -289,12 +289,11 @@ module SharedEnvExtension EOS end - unless gcc_formula.opt_prefix.exist? - raise <<-EOS.undent - The requested Homebrew GCC was not installed. You must: - brew install #{gcc_formula.full_name} - EOS - end + return if gcc_formula.opt_prefix.exist? + raise <<-EOS.undent + The requested Homebrew GCC was not installed. You must: + brew install #{gcc_formula.full_name} + EOS end def permit_arch_flags; end @@ -328,9 +327,8 @@ module SharedEnvExtension end def check_for_compiler_universal_support - if homebrew_cc =~ GNU_GCC_REGEXP - raise "Non-Apple GCC can't build universal binaries" - end + return unless homebrew_cc =~ GNU_GCC_REGEXP + raise "Non-Apple GCC can't build universal binaries" end def gcc_with_cxx11_support?(cc) diff --git a/Library/Homebrew/extend/ENV/std.rb b/Library/Homebrew/extend/ENV/std.rb index a9b2358b1..27dc95d29 100644 --- a/Library/Homebrew/extend/ENV/std.rb +++ b/Library/Homebrew/extend/ENV/std.rb @@ -42,18 +42,17 @@ module Stdenv end # Os is the default Apple uses for all its stuff so let's trust them - set_cflags "-Os #{SAFE_CFLAGS_FLAGS}" + define_cflags "-Os #{SAFE_CFLAGS_FLAGS}" append "LDFLAGS", "-Wl,-headerpad_max_install_names" send(compiler) - if cc =~ GNU_GCC_REGEXP - gcc_formula = gcc_version_formula($&) - append_path "PATH", gcc_formula.opt_bin.to_s - end + return unless cc =~ GNU_GCC_REGEXP + gcc_formula = gcc_version_formula($&) + append_path "PATH", gcc_formula.opt_bin.to_s end - alias_method :generic_setup_build_environment, :setup_build_environment + alias generic_setup_build_environment setup_build_environment def homebrew_extra_pkg_config_paths [] @@ -84,7 +83,7 @@ module Stdenv old end - alias_method :j1, :deparallelize + alias j1 deparallelize # These methods are no-ops for compatibility. %w[fast O4 Og].each { |opt| define_method(opt) {} } @@ -112,13 +111,13 @@ module Stdenv super set_cpu_cflags "-march=nocona -mssse3" end - alias_method :gcc_4_0_1, :gcc_4_0 + alias gcc_4_0_1 gcc_4_0 def gcc super set_cpu_cflags end - alias_method :gcc_4_2, :gcc + alias gcc_4_2 gcc GNU_GCC_VERSIONS.each do |n| define_method(:"gcc-#{n}") do @@ -137,21 +136,21 @@ module Stdenv end def minimal_optimization - set_cflags "-Os #{SAFE_CFLAGS_FLAGS}" + define_cflags "-Os #{SAFE_CFLAGS_FLAGS}" end - alias_method :generic_minimal_optimization, :minimal_optimization + alias generic_minimal_optimization minimal_optimization def no_optimization - set_cflags SAFE_CFLAGS_FLAGS + define_cflags SAFE_CFLAGS_FLAGS end - alias_method :generic_no_optimization, :no_optimization + alias generic_no_optimization no_optimization def libxml2 end def x11 end - alias_method :libpng, :x11 + alias libpng x11 # we've seen some packages fail to build when warnings are disabled! def enable_warnings @@ -174,10 +173,10 @@ module Stdenv append_to_cflags Hardware::CPU.universal_archs.as_arch_flags append "LDFLAGS", Hardware::CPU.universal_archs.as_arch_flags - if compiler != :clang && Hardware.is_32_bit? - # Can't mix "-march" for a 32-bit CPU with "-arch x86_64" - replace_in_cflags(/-march=\S*/, "-Xarch_#{Hardware::CPU.arch_32_bit} \\0") - end + return if compiler == :clang + return unless Hardware.is_32_bit? + # Can't mix "-march" for a 32-bit CPU with "-arch x86_64" + replace_in_cflags(/-march=\S*/, "-Xarch_#{Hardware::CPU.arch_32_bit} \\0") end def cxx11 @@ -192,15 +191,11 @@ module Stdenv end def libcxx - if compiler == :clang - append "CXX", "-stdlib=libc++" - end + append "CXX", "-stdlib=libc++" if compiler == :clang end def libstdcxx - if compiler == :clang - append "CXX", "-stdlib=libstdc++" - end + append "CXX", "-stdlib=libstdc++" if compiler == :clang end # @private @@ -211,7 +206,7 @@ module Stdenv end # Convenience method to set all C compiler flags in one shot. - def set_cflags(val) + def define_cflags(val) CC_FLAG_VARS.each { |key| self[key] = val } end @@ -228,7 +223,7 @@ module Stdenv append flags, xarch unless xarch.empty? append flags, map.fetch(effective_arch, default) end - alias_method :generic_set_cpu_flags, :set_cpu_flags + alias generic_set_cpu_flags set_cpu_flags # @private def effective_arch diff --git a/Library/Homebrew/extend/ENV/super.rb b/Library/Homebrew/extend/ENV/super.rb index 4169905df..a3837c695 100644 --- a/Library/Homebrew/extend/ENV/super.rb +++ b/Library/Homebrew/extend/ENV/super.rb @@ -18,7 +18,7 @@ module Superenv attr_accessor :keg_only_deps, :deps attr_accessor :x11 - alias_method :x11?, :x11 + alias x11? x11 def self.extended(base) base.keg_only_deps = [] @@ -64,9 +64,7 @@ module Superenv self["HOMEBREW_INCLUDE_PATHS"] = determine_include_paths self["HOMEBREW_LIBRARY_PATHS"] = determine_library_paths self["HOMEBREW_DEPENDENCIES"] = determine_dependencies - unless formula.nil? - self["HOMEBREW_FORMULA_PREFIX"] = formula.prefix - end + self["HOMEBREW_FORMULA_PREFIX"] = formula.prefix unless formula.nil? # The HOMEBREW_CCCFG ENV variable is used by the ENV/cc tool to control # compiler flag stripping. It consists of a string of characters which act @@ -84,7 +82,7 @@ module Superenv # s - apply fix for sed's Unicode support # a - apply fix for apr-1-config path end - alias_method :generic_setup_build_environment, :setup_build_environment + alias generic_setup_build_environment setup_build_environment private @@ -265,7 +263,7 @@ module Superenv old end - alias_method :j1, :deparallelize + alias j1 deparallelize def make_jobs self["MAKEFLAGS"] =~ /-\w*j(\d+)/ @@ -278,12 +276,12 @@ module Superenv self["HOMEBREW_ARCHFLAGS"] = Hardware::CPU.universal_archs.as_arch_flags # GCC doesn't accept "-march" for a 32-bit CPU with "-arch x86_64" - if compiler != :clang && Hardware::CPU.is_32_bit? - self["HOMEBREW_OPTFLAGS"] = self["HOMEBREW_OPTFLAGS"].sub( - /-march=\S*/, - "-Xarch_#{Hardware::CPU.arch_32_bit} \\0" - ) - end + return if compiler == :clang + return unless Hardware::CPU.is_32_bit? + self["HOMEBREW_OPTFLAGS"] = self["HOMEBREW_OPTFLAGS"].sub( + /-march=\S*/, + "-Xarch_#{Hardware::CPU.arch_32_bit} \\0" + ) end def permit_arch_flags @@ -336,18 +334,18 @@ module Superenv # These methods are no longer necessary under superenv, but are needed to # maintain an interface compatible with stdenv. - alias_method :fast, :noop - alias_method :O4, :noop - alias_method :Og, :noop - alias_method :libxml2, :noop - alias_method :set_cpu_flags, :noop + alias fast noop + alias O4 noop + alias Og noop + alias libxml2 noop + alias set_cpu_flags noop # These methods provide functionality that has not yet been ported to # superenv. - alias_method :gcc_4_0_1, :noop - alias_method :minimal_optimization, :noop - alias_method :no_optimization, :noop - alias_method :enable_warnings, :noop + alias gcc_4_0_1 noop + alias minimal_optimization noop + alias no_optimization noop + alias enable_warnings noop end class Array diff --git a/Library/Homebrew/extend/fileutils.rb b/Library/Homebrew/extend/fileutils.rb index 3a2b32481..4f20d36a3 100644 --- a/Library/Homebrew/extend/fileutils.rb +++ b/Library/Homebrew/extend/fileutils.rb @@ -84,15 +84,14 @@ module FileUtils end # @private - alias_method :old_mkdir, :mkdir + alias old_mkdir mkdir # A version of mkdir that also changes to that folder in a block. def mkdir(name, &_block) mkdir_p(name) - if block_given? - chdir name do - yield - end + return unless block_given? + chdir name do + yield end end module_function :mkdir @@ -122,7 +121,7 @@ module FileUtils if method_defined?(:ruby) # @private - alias_method :old_ruby, :ruby + alias old_ruby ruby end # Run the `ruby` Homebrew is using rather than whatever is in the `PATH`. diff --git a/Library/Homebrew/extend/os/blacklist.rb b/Library/Homebrew/extend/os/blacklist.rb index f72c7c643..932040f82 100644 --- a/Library/Homebrew/extend/os/blacklist.rb +++ b/Library/Homebrew/extend/os/blacklist.rb @@ -1,5 +1,2 @@ require "blacklist" - -if OS.mac? - require "extend/os/mac/blacklist" -end +require "extend/os/mac/blacklist" if OS.mac? diff --git a/Library/Homebrew/extend/os/bottles.rb b/Library/Homebrew/extend/os/bottles.rb index aff9300de..146b807a4 100644 --- a/Library/Homebrew/extend/os/bottles.rb +++ b/Library/Homebrew/extend/os/bottles.rb @@ -1,5 +1,2 @@ require "utils/bottles" - -if OS.mac? - require "extend/os/mac/utils/bottles" -end +require "extend/os/mac/utils/bottles" if OS.mac? diff --git a/Library/Homebrew/extend/os/cleaner.rb b/Library/Homebrew/extend/os/cleaner.rb index 868ff2d33..6b94cdf5a 100644 --- a/Library/Homebrew/extend/os/cleaner.rb +++ b/Library/Homebrew/extend/os/cleaner.rb @@ -1,5 +1,2 @@ require "cleaner" - -if OS.mac? - require "extend/os/mac/cleaner" -end +require "extend/os/mac/cleaner" if OS.mac? diff --git a/Library/Homebrew/extend/os/dependency_collector.rb b/Library/Homebrew/extend/os/dependency_collector.rb new file mode 100644 index 000000000..56fcad31d --- /dev/null +++ b/Library/Homebrew/extend/os/dependency_collector.rb @@ -0,0 +1,2 @@ +require "dependency_collector" +require "extend/os/mac/dependency_collector" if OS.mac? diff --git a/Library/Homebrew/extend/os/development_tools.rb b/Library/Homebrew/extend/os/development_tools.rb index 7b590dc8b..5bd5cb81a 100644 --- a/Library/Homebrew/extend/os/development_tools.rb +++ b/Library/Homebrew/extend/os/development_tools.rb @@ -1,5 +1,2 @@ require "development_tools" - -if OS.mac? - require "extend/os/mac/development_tools" -end +require "extend/os/mac/development_tools" if OS.mac? diff --git a/Library/Homebrew/extend/os/diagnostic.rb b/Library/Homebrew/extend/os/diagnostic.rb index 0c844743b..f8f53b1f4 100644 --- a/Library/Homebrew/extend/os/diagnostic.rb +++ b/Library/Homebrew/extend/os/diagnostic.rb @@ -1,5 +1,2 @@ require "diagnostic" - -if OS.mac? - require "extend/os/mac/diagnostic" -end +require "extend/os/mac/diagnostic" if OS.mac? diff --git a/Library/Homebrew/extend/os/emoji.rb b/Library/Homebrew/extend/os/emoji.rb index fe3e7f44e..8fd99e1d3 100644 --- a/Library/Homebrew/extend/os/emoji.rb +++ b/Library/Homebrew/extend/os/emoji.rb @@ -1,6 +1,3 @@ require "os" require "emoji" - -if OS.mac? - require "extend/os/mac/emoji" -end +require "extend/os/mac/emoji" if OS.mac? diff --git a/Library/Homebrew/extend/os/extend/ENV/shared.rb b/Library/Homebrew/extend/os/extend/ENV/shared.rb index 676159b37..e9574eb58 100644 --- a/Library/Homebrew/extend/os/extend/ENV/shared.rb +++ b/Library/Homebrew/extend/os/extend/ENV/shared.rb @@ -1,5 +1,2 @@ require "extend/ENV/shared" - -if OS.mac? - require "extend/os/mac/extend/ENV/shared" -end +require "extend/os/mac/extend/ENV/shared" if OS.mac? diff --git a/Library/Homebrew/extend/os/extend/ENV/std.rb b/Library/Homebrew/extend/os/extend/ENV/std.rb index 320f9981f..8e6b13a61 100644 --- a/Library/Homebrew/extend/os/extend/ENV/std.rb +++ b/Library/Homebrew/extend/os/extend/ENV/std.rb @@ -1,5 +1,2 @@ require "extend/ENV/std" - -if OS.mac? - require "extend/os/mac/extend/ENV/std" -end +require "extend/os/mac/extend/ENV/std" if OS.mac? diff --git a/Library/Homebrew/extend/os/extend/ENV/super.rb b/Library/Homebrew/extend/os/extend/ENV/super.rb index fd4e93c22..27c49eb84 100644 --- a/Library/Homebrew/extend/os/extend/ENV/super.rb +++ b/Library/Homebrew/extend/os/extend/ENV/super.rb @@ -1,5 +1,2 @@ require "extend/ENV/super" - -if OS.mac? - require "extend/os/mac/extend/ENV/super" -end +require "extend/os/mac/extend/ENV/super" if OS.mac? diff --git a/Library/Homebrew/extend/os/formula_cellar_checks.rb b/Library/Homebrew/extend/os/formula_cellar_checks.rb index 4e30cd791..66b5b80d3 100644 --- a/Library/Homebrew/extend/os/formula_cellar_checks.rb +++ b/Library/Homebrew/extend/os/formula_cellar_checks.rb @@ -1,5 +1,2 @@ require "formula_cellar_checks" - -if OS.mac? - require "extend/os/mac/formula_cellar_checks" -end +require "extend/os/mac/formula_cellar_checks" if OS.mac? diff --git a/Library/Homebrew/extend/os/keg_relocate.rb b/Library/Homebrew/extend/os/keg_relocate.rb index 2fde45d93..25a74286a 100644 --- a/Library/Homebrew/extend/os/keg_relocate.rb +++ b/Library/Homebrew/extend/os/keg_relocate.rb @@ -1,5 +1,2 @@ require "keg_relocate" - -if OS.mac? - require "extend/os/mac/keg_relocate" -end +require "extend/os/mac/keg_relocate" if OS.mac? diff --git a/Library/Homebrew/extend/os/linux/hardware/cpu.rb b/Library/Homebrew/extend/os/linux/hardware/cpu.rb index 2e5b3d07d..2472c60ed 100644 --- a/Library/Homebrew/extend/os/linux/hardware/cpu.rb +++ b/Library/Homebrew/extend/os/linux/hardware/cpu.rb @@ -81,7 +81,7 @@ module Hardware %w[aes altivec avx avx2 lm sse3 ssse3 sse4 sse4_2].each do |flag| define_method(flag + "?") { flags.include? flag } end - alias_method :is_64_bit?, :lm? + alias is_64_bit? lm? def bits is_64_bit? ? 64 : 32 diff --git a/Library/Homebrew/extend/os/mac/dependency_collector.rb b/Library/Homebrew/extend/os/mac/dependency_collector.rb new file mode 100644 index 000000000..ee98045b6 --- /dev/null +++ b/Library/Homebrew/extend/os/mac/dependency_collector.rb @@ -0,0 +1,6 @@ +class DependencyCollector + def ant_dep(spec, tags) + return if MacOS.version < :mavericks + Dependency.new(spec.to_s, tags) + end +end diff --git a/Library/Homebrew/extend/os/mac/development_tools.rb b/Library/Homebrew/extend/os/mac/development_tools.rb index b9c9d8e43..381b26e66 100644 --- a/Library/Homebrew/extend/os/mac/development_tools.rb +++ b/Library/Homebrew/extend/os/mac/development_tools.rb @@ -3,7 +3,7 @@ require "os/mac/xcode" # @private class DevelopmentTools class << self - alias_method :original_locate, :locate + alias original_locate locate def locate(tool) (@locate ||= {}).fetch(tool) do |key| @locate[key] = if (located_tool = original_locate(tool)) diff --git a/Library/Homebrew/extend/os/mac/diagnostic.rb b/Library/Homebrew/extend/os/mac/diagnostic.rb index 15dd3328f..063558f19 100644 --- a/Library/Homebrew/extend/os/mac/diagnostic.rb +++ b/Library/Homebrew/extend/os/mac/diagnostic.rb @@ -14,7 +14,7 @@ module Homebrew end def fatal_development_tools_checks - if MacOS.prerelease? + if MacOS.version >= :sierra && ENV["CI"].nil? %w[ check_xcode_up_to_date check_clt_up_to_date diff --git a/Library/Homebrew/extend/os/mac/extend/ENV/shared.rb b/Library/Homebrew/extend/os/mac/extend/ENV/shared.rb index 866204024..67a3944c3 100644 --- a/Library/Homebrew/extend/os/mac/extend/ENV/shared.rb +++ b/Library/Homebrew/extend/os/mac/extend/ENV/shared.rb @@ -2,13 +2,8 @@ module SharedEnvExtension def no_weak_imports_support? return false unless compiler == :clang - if MacOS::Xcode.version && MacOS::Xcode.version < "8.0" - return false - end - - if MacOS::CLT.version && MacOS::CLT.version < "8.0" - return false - end + return false if MacOS::Xcode.version && MacOS::Xcode.version < "8.0" + return false if MacOS::CLT.version && MacOS::CLT.version < "8.0" true end diff --git a/Library/Homebrew/extend/os/mac/extend/ENV/std.rb b/Library/Homebrew/extend/os/mac/extend/ENV/std.rb index 8efbd3bc9..4853ecf0c 100644 --- a/Library/Homebrew/extend/os/mac/extend/ENV/std.rb +++ b/Library/Homebrew/extend/os/mac/extend/ENV/std.rb @@ -20,14 +20,13 @@ module Stdenv # Leopard's ld needs some convincing that it's building 64-bit # See: https://github.com/mistydemeo/tigerbrew/issues/59 - if MacOS.version == :leopard && MacOS.prefer_64_bit? - append "LDFLAGS", "-arch #{Hardware::CPU.arch_64_bit}" + return unless MacOS.version == :leopard && MacOS.prefer_64_bit? + append "LDFLAGS", "-arch #{Hardware::CPU.arch_64_bit}" - # Many, many builds are broken thanks to Leopard's buggy ld. - # Our ld64 fixes many of those builds, though of course we can't - # depend on it already being installed to build itself. - ld64 if Formula["ld64"].installed? - end + # Many, many builds are broken thanks to Leopard's buggy ld. + # Our ld64 fixes many of those builds, though of course we can't + # depend on it already being installed to build itself. + ld64 if Formula["ld64"].installed? end def homebrew_extra_pkg_config_paths @@ -65,19 +64,18 @@ module Stdenv delete("CPATH") remove "LDFLAGS", "-L#{HOMEBREW_PREFIX}/lib" - if (sdk = MacOS.sdk_path(version)) && !MacOS::CLT.installed? - delete("SDKROOT") - remove_from_cflags "-isysroot #{sdk}" - remove "CPPFLAGS", "-isysroot #{sdk}" - remove "LDFLAGS", "-isysroot #{sdk}" - if HOMEBREW_PREFIX.to_s == "/usr/local" - delete("CMAKE_PREFIX_PATH") - else - # It was set in setup_build_environment, so we have to restore it here. - self["CMAKE_PREFIX_PATH"] = HOMEBREW_PREFIX.to_s - end - remove "CMAKE_FRAMEWORK_PATH", "#{sdk}/System/Library/Frameworks" + return unless (sdk = MacOS.sdk_path(version)) && !MacOS::CLT.installed? + delete("SDKROOT") + remove_from_cflags "-isysroot #{sdk}" + remove "CPPFLAGS", "-isysroot #{sdk}" + remove "LDFLAGS", "-isysroot #{sdk}" + if HOMEBREW_PREFIX.to_s == "/usr/local" + delete("CMAKE_PREFIX_PATH") + else + # It was set in setup_build_environment, so we have to restore it here. + self["CMAKE_PREFIX_PATH"] = HOMEBREW_PREFIX.to_s end + remove "CMAKE_FRAMEWORK_PATH", "#{sdk}/System/Library/Frameworks" end def macosxsdk(version = MacOS.version) @@ -89,20 +87,19 @@ module Stdenv self["CPATH"] = "#{HOMEBREW_PREFIX}/include" prepend "LDFLAGS", "-L#{HOMEBREW_PREFIX}/lib" - if (sdk = MacOS.sdk_path(version)) && !MacOS::CLT.installed? - # Extra setup to support Xcode 4.3+ without CLT. - self["SDKROOT"] = sdk - # Tell clang/gcc where system include's are: - append_path "CPATH", "#{sdk}/usr/include" - # The -isysroot is needed, too, because of the Frameworks - append_to_cflags "-isysroot #{sdk}" - append "CPPFLAGS", "-isysroot #{sdk}" - # And the linker needs to find sdk/usr/lib - append "LDFLAGS", "-isysroot #{sdk}" - # Needed to build cmake itself and perhaps some cmake projects: - append_path "CMAKE_PREFIX_PATH", "#{sdk}/usr" - append_path "CMAKE_FRAMEWORK_PATH", "#{sdk}/System/Library/Frameworks" - end + return unless (sdk = MacOS.sdk_path(version)) && !MacOS::CLT.installed? + # Extra setup to support Xcode 4.3+ without CLT. + self["SDKROOT"] = sdk + # Tell clang/gcc where system include's are: + append_path "CPATH", "#{sdk}/usr/include" + # The -isysroot is needed, too, because of the Frameworks + append_to_cflags "-isysroot #{sdk}" + append "CPPFLAGS", "-isysroot #{sdk}" + # And the linker needs to find sdk/usr/lib + append "LDFLAGS", "-isysroot #{sdk}" + # Needed to build cmake itself and perhaps some cmake projects: + append_path "CMAKE_PREFIX_PATH", "#{sdk}/usr" + append_path "CMAKE_FRAMEWORK_PATH", "#{sdk}/System/Library/Frameworks" end # Some configure scripts won't find libxml2 without help diff --git a/Library/Homebrew/extend/os/mac/extend/ENV/super.rb b/Library/Homebrew/extend/os/mac/extend/ENV/super.rb index 78e36251c..38a81488f 100644 --- a/Library/Homebrew/extend/os/mac/extend/ENV/super.rb +++ b/Library/Homebrew/extend/os/mac/extend/ENV/super.rb @@ -118,6 +118,6 @@ module Superenv # These methods are no longer necessary under superenv, but are needed to # maintain an interface compatible with stdenv. - alias_method :macosxsdk, :noop - alias_method :remove_macosxsdk, :noop + alias macosxsdk noop + alias remove_macosxsdk noop end diff --git a/Library/Homebrew/extend/os/mac/formula_cellar_checks.rb b/Library/Homebrew/extend/os/mac/formula_cellar_checks.rb index b3f8250ee..8bc42ad35 100644 --- a/Library/Homebrew/extend/os/mac/formula_cellar_checks.rb +++ b/Library/Homebrew/extend/os/mac/formula_cellar_checks.rb @@ -64,13 +64,12 @@ module FormulaCellarChecks keg = Keg.new(formula.prefix) checker = LinkageChecker.new(keg, formula) - if checker.broken_dylibs? - audit_check_output <<-EOS.undent - The installation was broken. - Broken dylib links found: - #{checker.broken_dylibs.to_a * "\n "} - EOS - end + return unless checker.broken_dylibs? + audit_check_output <<-EOS.undent + The installation was broken. + Broken dylib links found: + #{checker.broken_dylibs.to_a * "\n "} + EOS end def audit_installed diff --git a/Library/Homebrew/extend/os/mac/keg_relocate.rb b/Library/Homebrew/extend/os/mac/keg_relocate.rb index 61d54ba97..33ee149ce 100644 --- a/Library/Homebrew/extend/os/mac/keg_relocate.rb +++ b/Library/Homebrew/extend/os/mac/keg_relocate.rb @@ -124,7 +124,7 @@ class Keg end def self.file_linked_libraries(file, string) - # Check dynamic library linkage. Importantly, do not run otool on static + # Check dynamic library linkage. Importantly, do not perform for static # libraries, which will falsely report "linkage" to themselves. if file.mach_o_executable? || file.dylib? || file.mach_o_bundle? file.dynamically_linked_libraries.select { |lib| lib.include? string } diff --git a/Library/Homebrew/extend/os/mac/utils/bottles.rb b/Library/Homebrew/extend/os/mac/utils/bottles.rb index 6b83ad6c4..0dd7341ea 100644 --- a/Library/Homebrew/extend/os/mac/utils/bottles.rb +++ b/Library/Homebrew/extend/os/mac/utils/bottles.rb @@ -21,7 +21,7 @@ module Utils class Collector private - alias_method :original_find_matching_tag, :find_matching_tag + alias original_find_matching_tag find_matching_tag def find_matching_tag(tag) original_find_matching_tag(tag) || find_altivec_tag(tag) || find_or_later_tag(tag) end @@ -31,10 +31,9 @@ module Utils # sometimes a formula has just :tiger_altivec, other times it has # :tiger_g4, :tiger_g5, etc. def find_altivec_tag(tag) - if tag.to_s =~ /(\w+)_(g4|g4e|g5)$/ - altivec_tag = "#{$1}_altivec".to_sym - altivec_tag if key?(altivec_tag) - end + return unless tag.to_s =~ /(\w+)_(g4|g4e|g5)$/ + altivec_tag = "#{$1}_altivec".to_sym + altivec_tag if key?(altivec_tag) end # Allows a bottle tag to specify a specific OS or later, diff --git a/Library/Homebrew/extend/os/system_config.rb b/Library/Homebrew/extend/os/system_config.rb index cf7b69cb6..edc007166 100644 --- a/Library/Homebrew/extend/os/system_config.rb +++ b/Library/Homebrew/extend/os/system_config.rb @@ -1,5 +1,2 @@ require "system_config" - -if OS.mac? - require "extend/os/mac/system_config" -end +require "extend/os/mac/system_config" if OS.mac? diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb index 5dce906b9..3f73b6a1c 100644 --- a/Library/Homebrew/extend/pathname.rb +++ b/Library/Homebrew/extend/pathname.rb @@ -71,13 +71,13 @@ class Pathname when Array if src.empty? opoo "tried to install empty array to #{self}" - return + break end src.each { |s| install_p(s, File.basename(s)) } when Hash if src.empty? opoo "tried to install empty hash to #{self}" - return + break end src.each { |s, new_basename| install_p(s, new_basename) } else @@ -132,7 +132,7 @@ class Pathname if method_defined?(:write) # @private - alias_method :old_write, :write + alias old_write write end # we assume this pathname object is a file obviously @@ -212,7 +212,7 @@ class Pathname end # @private - alias_method :extname_old, :extname + alias extname_old extname # extended to support common double extensions def extname(path = to_s) @@ -322,7 +322,7 @@ class Pathname end # FIXME: eliminate the places where we rely on this method - alias_method :to_str, :to_s unless method_defined?(:to_str) + alias to_str to_s unless method_defined?(:to_str) def cd Dir.chdir(self) { yield } diff --git a/Library/Homebrew/extend/string.rb b/Library/Homebrew/extend/string.rb index 1d9c2e036..162666d2d 100644 --- a/Library/Homebrew/extend/string.rb +++ b/Library/Homebrew/extend/string.rb @@ -13,7 +13,7 @@ class String # sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt # mollit anim id est laborum. # EOS - alias_method :undent_________________________________________________________72, :undent + alias undent_________________________________________________________72 undent # String.chomp, but if result is empty: returns nil instead. # Allows `chuzzle || foo` short-circuits. @@ -59,9 +59,8 @@ module StringInreplaceExtension # Looks for Makefile style variable defintions and replaces the # value with "new_value", or removes the definition entirely. def change_make_var!(flag, new_value) - unless gsub!(/^#{Regexp.escape(flag)}[ \t]*=[ \t]*(.*)$/, "#{flag}=#{new_value}", false) - errors << "expected to change #{flag.inspect} to #{new_value.inspect}" - end + return if gsub!(/^#{Regexp.escape(flag)}[ \t]*=[ \t]*(.*)$/, "#{flag}=#{new_value}", false) + errors << "expected to change #{flag.inspect} to #{new_value.inspect}" end # Removes variable assignments completely. |
