Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Clean up MacOS version method usage

The MacOS.version? family of methods (other than "leopard?") are poorly
defined and lead to confusing code. Replace them in formulae with more
explicit comparisons.

"MacOS.version" is a special version object that can be compared to
numerics, symbols, and strings using the standard Ruby comparison
methods.

The old methods were moved to compat when the version comparison code
was merged, and they must remain there "forever", but they should not be
used in new code.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
  • Loading branch information...
commit 6b8d25f2d21a3c19ecb0809d619999137cb94565 1 parent db74b9b
@jacknagel jacknagel authored
Showing with 94 additions and 90 deletions.
  1. +1 −1  Library/Formula/abyss.rb
  2. +1 −1  Library/Formula/alpine.rb
  3. +1 −1  Library/Formula/aria2.rb
  4. +1 −1  Library/Formula/avidemux.rb
  5. +2 −2 Library/Formula/bind.rb
  6. +1 −1  Library/Formula/cairo.rb
  7. +1 −1  Library/Formula/clisp.rb
  8. +1 −1  Library/Formula/collectd.rb
  9. +1 −1  Library/Formula/couchdb.rb
  10. +1 −1  Library/Formula/disco.rb
  11. +1 −1  Library/Formula/e2fsprogs.rb
  12. +2 −2 Library/Formula/ejabberd.rb
  13. +1 −1  Library/Formula/erlang.rb
  14. +1 −1  Library/Formula/ffmbc.rb
  15. +2 −2 Library/Formula/ffmpeg.rb
  16. +1 −1  Library/Formula/fontforge.rb
  17. +1 −1  Library/Formula/ghc.rb
  18. +1 −1  Library/Formula/git.rb
  19. +1 −1  Library/Formula/gnunet.rb
  20. +1 −1  Library/Formula/google-js-test.rb
  21. +1 −1  Library/Formula/graphicsmagick.rb
  22. +3 −3 Library/Formula/grass.rb
  23. +1 −1  Library/Formula/imap-uw.rb
  24. +1 −1  Library/Formula/iodine.rb
  25. +1 −1  Library/Formula/jstalk.rb
  26. +1 −1  Library/Formula/lftp.rb
  27. +1 −1  Library/Formula/libagg.rb
  28. +1 −1  Library/Formula/libmemcached.rb
  29. +1 −1  Library/Formula/libmms.rb
  30. +1 −1  Library/Formula/librasterlite.rb
  31. +1 −1  Library/Formula/librets.rb
  32. +1 −1  Library/Formula/libvirt.rb
  33. +1 −1  Library/Formula/libxml++.rb
  34. +1 −1  Library/Formula/macvim.rb
  35. +2 −2 Library/Formula/mapserver.rb
  36. +1 −1  Library/Formula/md.rb
  37. +1 −1  Library/Formula/mpd.rb
  38. +2 −2 Library/Formula/mysql.rb
  39. +2 −2 Library/Formula/nmap.rb
  40. +1 −1  Library/Formula/node.rb
  41. +1 −1  Library/Formula/nspr.rb
  42. +1 −1  Library/Formula/nu.rb
  43. +8 −5 Library/Formula/octave.rb
  44. +1 −1  Library/Formula/open-scene-graph.rb
  45. +1 −1  Library/Formula/opencolorio.rb
  46. +1 −1  Library/Formula/phantomjs.rb
  47. +1 −1  Library/Formula/portaudio.rb
  48. +2 −2 Library/Formula/postgresql.rb
  49. +1 −1  Library/Formula/povray.rb
  50. +5 −5 Library/Formula/qt.rb
  51. +1 −1  Library/Formula/rabbitmq.rb
  52. +1 −1  Library/Formula/recode.rb
  53. +1 −1  Library/Formula/rtmpdump.rb
  54. +1 −1  Library/Formula/rtorrent.rb
  55. +1 −1  Library/Formula/sdl.rb
  56. +1 −1  Library/Formula/spidermonkey.rb
  57. +1 −1  Library/Formula/stormfs.rb
  58. +1 −1  Library/Formula/subversion.rb
  59. +1 −1  Library/Formula/swi-prolog.rb
  60. +1 −1  Library/Formula/tcpflow.rb
  61. +1 −1  Library/Formula/texi2html.rb
  62. +1 −1  Library/Formula/trafshow.rb
  63. +1 −1  Library/Formula/vpnc.rb
  64. +1 −1  Library/Formula/wget.rb
  65. +1 −1  Library/Formula/wine.rb
  66. +1 −3 Library/Formula/xmlrpc-c.rb
  67. +1 −1  Library/Formula/ykpers.rb
  68. +1 −0  Library/Homebrew/compat/compatibility.rb
  69. +3 −1 Library/Homebrew/macos.rb
  70. +3 −3 Library/Homebrew/superenv.rb
View
2  Library/Formula/abyss.rb
@@ -11,7 +11,7 @@ class Abyss < Formula
depends_on 'google-sparsehash' => :build
# Snow Leopard comes with mpi but Lion does not
- depends_on 'open-mpi' if MacOS.lion?
+ depends_on 'open-mpi' if MacOS.version >= :lion
# strip breaks the ability to read compressed files.
skip_clean 'bin'
View
2  Library/Formula/alpine.rb
@@ -10,7 +10,7 @@ class Alpine < Formula
# http://trac.macports.org/ticket/20971
def patches
"https://trac.macports.org/export/89747/trunk/dports/mail/alpine/files/alpine-osx-10.6.patch"
- end if MacOS.snow_leopard?
+ end if MacOS.version >= :snow_leopard
def install
ENV.j1
View
2  Library/Formula/aria2.rb
@@ -8,7 +8,7 @@ class Aria2 < Formula
depends_on 'pkg-config' => :build
# Leopard's libxml2 is too old.
- depends_on 'libxml2' if MacOS.leopard?
+ depends_on 'libxml2' if MacOS.version == :leopard
def install
system "./configure", "--disable-dependency-tracking",
View
2  Library/Formula/avidemux.rb
@@ -63,7 +63,7 @@ def install
# For 32-bit compilation under gcc 4.2, see:
# http://trac.macports.org/ticket/20938#comment:22
- if MacOS.leopard? or Hardware.is_32_bit?
+ if MacOS.version == :leopard or Hardware.is_32_bit?
inreplace 'cmake/admFFmpegBuild.cmake',
'${CMAKE_INSTALL_PREFIX})',
'${CMAKE_INSTALL_PREFIX} --extra-cflags=-mdynamic-no-pic)'
View
4 Library/Formula/bind.rb
@@ -6,7 +6,7 @@ class Bind < Formula
version '9.9.1-p2'
sha1 '449b12c32682b5bef64c7b53cd0fc0c6b731c8a7'
- depends_on "openssl" if MacOS.leopard?
+ depends_on "openssl" if MacOS.version == :leopard
def install
ENV.libxml2
@@ -23,7 +23,7 @@ def install
# For Xcode-only systems we help a bit to find openssl.
# If CLT.installed?, it evaluates to "/usr", which works.
- args << "--with-openssl=#{MacOS.sdk_path.to_s}/usr" unless MacOS.leopard?
+ args << "--with-openssl=#{MacOS.sdk_path.to_s}/usr" unless MacOS.version == :leopard
system "./configure", *args
View
2  Library/Formula/cairo.rb
@@ -29,7 +29,7 @@ def install
]
args << '--with-x' unless build.include? 'without-x'
- args << '--enable-xcb=no' if MacOS.leopard?
+ args << '--enable-xcb=no' if MacOS.version == :leopard
system "./configure", *args
system "make install"
View
2  Library/Formula/clisp.rb
@@ -42,7 +42,7 @@ def install
# The ulimit must be set, otherwise `make` will fail and tell you to do so
system "ulimit -s 16384 && make"
- if MacOS.lion?
+ if MacOS.version >= :lion
opoo "`make check` fails on Lion, so we are skipping it."
puts "But it probably means there will be other issues too."
puts "Please take them upstream to the clisp project itself."
View
2  Library/Formula/collectd.rb
@@ -27,7 +27,7 @@ def install
--localstatedir=#{var}
--with-python=/usr/bin]
- args << "--disable-embedded-perl" if MacOS.leopard?
+ args << "--disable-embedded-perl" if MacOS.version == :leopard
system "./configure", *args
system "make install"
View
2  Library/Formula/couchdb.rb
@@ -11,7 +11,7 @@ class Couchdb < Formula
depends_on 'spidermonkey'
depends_on 'icu4c'
depends_on 'erlang'
- depends_on 'curl' if MacOS.leopard?
+ depends_on 'curl' if MacOS.version == :leopard
def install
system "./bootstrap" if File.exists? "bootstrap"
View
2  Library/Formula/disco.rb
@@ -9,7 +9,7 @@ class Disco < Formula
head 'https://github.com/tuulos/disco.git'
depends_on 'erlang'
- depends_on 'simplejson' => :python if MacOS.leopard?
+ depends_on 'simplejson' => :python if MacOS.version == :leopard
depends_on 'libcmph'
def install
View
2  Library/Formula/e2fsprogs.rb
@@ -18,7 +18,7 @@ def patches
]}
# MacPorts patch to allow compilation on Leopard.
- if MacOS.leopard?
+ if MacOS.version == :leopard
p[:p0] << "https://trac.macports.org/export/92117/trunk/dports/sysutils/e2fsprogs/files/patch-lib-ext2fs-inline.c.diff"
end
View
4 Library/Formula/ejabberd.rb
@@ -5,7 +5,7 @@ class Ejabberd < Formula
url "http://www.process-one.net/downloads/ejabberd/2.1.11/ejabberd-2.1.11.tgz"
sha1 'ae2c521d5e93fbd5bc826052c5524b5222dcfae6'
- depends_on "openssl" if MacOS.leopard?
+ depends_on "openssl" if MacOS.version == :leopard
depends_on "erlang"
option "32-bit"
@@ -28,7 +28,7 @@ def install
"--sysconfdir=#{etc}",
"--localstatedir=#{var}"]
- if MacOS.leopard?
+ if MacOS.version == :leopard
openssl = Formula.factory('openssl')
args << "--with-openssl=#{openssl.prefix}"
end
View
2  Library/Formula/erlang.rb
@@ -76,7 +76,7 @@ def install
"--enable-shared-zlib",
"--enable-smp-support"]
- args << "--with-dynamic-trace=dtrace" unless MacOS.leopard?
+ args << "--with-dynamic-trace=dtrace" unless MacOS.version == :leopard
unless build.include? 'disable-hipe'
# HIPE doesn't strike me as that reliable on OS X
View
2  Library/Formula/ffmbc.rb
@@ -17,7 +17,7 @@ class Ffmbc < Formula
option "with-libvpx", "Enable VP8 video format"
# manpages won't be built without texi2html
- depends_on 'texi2html' => :build if MacOS.mountain_lion?
+ depends_on 'texi2html' => :build if MacOS.version >= :mountain_lion
depends_on 'yasm' => :build
depends_on 'x264' unless build.include? 'without-x264'
View
4 Library/Formula/ffmpeg.rb
@@ -26,7 +26,7 @@ class Ffmpeg < Formula
option 'with-tools', 'Enable additional FFmpeg tools'
# manpages won't be built without texi2html
- depends_on 'texi2html' => :build if MacOS.mountain_lion?
+ depends_on 'texi2html' => :build if MacOS.version >= :mountain_lion
depends_on 'yasm' => :build
depends_on 'x264' unless build.include? 'without-x264'
@@ -79,7 +79,7 @@ def install
# For 32-bit compilation under gcc 4.2, see:
# http://trac.macports.org/ticket/20938#comment:22
- ENV.append_to_cflags "-mdynamic-no-pic" if MacOS.leopard? or Hardware.is_32_bit?
+ ENV.append_to_cflags "-mdynamic-no-pic" if MacOS.version == :leopard or Hardware.is_32_bit?
system "./configure", *args
View
2  Library/Formula/fontforge.rb
@@ -31,7 +31,7 @@ def install
# MACOSX_DEPLOYMENT_TARGET fixes ensuing Python 10.7 vs 10.8 clash.
# Discussed: https://github.com/mxcl/homebrew/pull/14097
# Reported: Not yet.
- if MacOS.mountain_lion?
+ if MacOS.version >= :mountain_lion
ENV.macosxsdk("10.7")
ENV.append "CFLAGS", "-isysroot #{MacOS.sdk_path(10.7)}"
ENV["MACOSX_DEPLOYMENT_TARGET"] = "10.8"
View
2  Library/Formula/ghc.rb
@@ -2,7 +2,7 @@
class NeedsSnowLeopard < Requirement
def satisfied?
- MacOS.snow_leopard?
+ MacOS.version >= :snow_leopard
end
def message; <<-EOS.undent
View
2  Library/Formula/git.rb
@@ -33,7 +33,7 @@ def install
ENV['PYTHON_PATH'] = which 'python' # python can be brewed or unbrewed
# Clean XCode 4.x installs don't include Perl MakeMaker
- ENV['NO_PERL_MAKEMAKER'] = '1' if MacOS.lion?
+ ENV['NO_PERL_MAKEMAKER'] = '1' if MacOS.version >= :lion
ENV['BLK_SHA1'] = '1' if build.include? 'with-blk-sha1'
View
2  Library/Formula/gnunet.rb
@@ -8,7 +8,7 @@ class Gnunet < Formula
depends_on 'libgcrypt'
depends_on 'libextractor'
- depends_on 'curl' unless MacOS.lion? # needs >= v7.20.1
+ depends_on 'curl' if MacOS.version < :lion # needs >= v7.20.1
def install
system "./configure", "--disable-debug",
View
2  Library/Formula/google-js-test.rb
@@ -6,7 +6,7 @@ def message
end
def satisfied?
- MacOS.snow_leopard?
+ MacOS.version >= :snow_leopard
end
end
View
2  Library/Formula/graphicsmagick.rb
@@ -56,7 +56,7 @@ def install
"--prefix=#{prefix}",
"--enable-shared", "--disable-static"]
args << "--without-magick-plus-plus" if build.include? 'without-magick-plus-plus'
- args << "--disable-openmp" if MacOS.leopard? or ENV.compiler == :clang # libgomp unavailable
+ args << "--disable-openmp" if MacOS.version == :leopard or ENV.compiler == :clang # libgomp unavailable
args << "--with-gslib" if ghostscript_srsly?
args << "--with-gs-font-dir=#{HOMEBREW_PREFIX}/share/ghostscript/fonts" \
unless ghostscript_fonts?
View
6 Library/Formula/grass.rb
@@ -14,7 +14,7 @@ def headless?
#
# This restriction can be lifted once WxMac hits a stable release that is
# 64-bit capable.
- ARGV.include? '--without-gui' or MacOS.lion?
+ ARGV.include? '--without-gui' or MacOS.version >= :lion
end
class Grass < Formula
@@ -31,7 +31,7 @@ class Grass < Formula
depends_on "libtiff"
depends_on "unixodbc"
depends_on "fftw"
- depends_on "cairo" if MacOS.leopard?
+ depends_on "cairo" if MacOS.version == :leopard
depends_on :x11
# Patches ensure 32 bit system python is used for wxWidgets and that files
@@ -101,7 +101,7 @@ def install
end
# Deal with Cairo support
- if MacOS.leopard?
+ if MacOS.version == :leopard
cairo = Formula.factory('cairo')
args << "--with-cairo-includes=#{cairo.include}/cairo"
args << "--with-cairo-libs=#{cairo.lib}"
View
2  Library/Formula/imap-uw.rb
@@ -6,7 +6,7 @@ class ImapUw < Formula
sha1 '7a82ebd5aae57a5dede96ac4923b63f850ff4fa7'
def patches
- if MacOS.snow_leopard?
+ if MacOS.version >= :snow_leopard
{ :p0 =>
'https://trac.macports.org/export/63088/trunk/dports/mail/imap-uw/files/patch-snowleopard.diff'
}
View
2  Library/Formula/iodine.rb
@@ -6,7 +6,7 @@ class Iodine < Formula
sha1 '4fa9a248b8a84df8a727a5d749e669e58136edca'
def install
- unless MacOS.leopard?
+ unless MacOS.version == :leopard
inreplace ["src/common.c", "src/dns.c", "src/iodine.c", "src/iodined.c"],
"arpa/nameser8_compat", "arpa/nameser_compat"
end
View
2  Library/Formula/jstalk.rb
@@ -2,7 +2,7 @@
class NeedsSnowLeopard < Requirement
def satisfied?
- MacOS.snow_leopard?
+ MacOS.version >= :snow_leopard
end
def message
View
2  Library/Formula/lftp.rb
@@ -11,7 +11,7 @@ class Lftp < Formula
def install
# Bus error
- ENV.no_optimization if MacOS.leopard?
+ ENV.no_optimization if MacOS.version == :leopard
system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}"
system "make install"
View
2  Library/Formula/libagg.rb
@@ -11,7 +11,7 @@ class Libagg < Formula
depends_on 'pkg-config' => :build
depends_on 'sdl'
depends_on :freetype => :optional if build.include? "with-freetype"
- depends_on :libtool unless MacOS.mountain_lion?
+ depends_on :libtool unless MacOS.version >= :mountain_lion
fails_with :clang do
build 421
View
2  Library/Formula/libmemcached.rb
@@ -8,7 +8,7 @@ class Libmemcached < Formula
depends_on 'memcached'
def install
- ENV.append_to_cflags "-undefined dynamic_lookup" if MacOS.leopard?
+ ENV.append_to_cflags "-undefined dynamic_lookup" if MacOS.version == :leopard
system "./configure", "--prefix=#{prefix}"
system "make install"
View
2  Library/Formula/libmms.rb
@@ -10,7 +10,7 @@ class Libmms < Formula
def patches
# see https://trac.macports.org/ticket/27988
- if MacOS.leopard?
+ if MacOS.version == :leopard
{ :p0 => "https://trac.macports.org/export/87883/trunk/dports/multimedia/libmms/files/src_mms-common.h.patch" }
end
end
View
2  Library/Formula/librasterlite.rb
@@ -5,7 +5,7 @@ class Librasterlite < Formula
url 'http://www.gaia-gis.it/gaia-sins/librasterlite-sources/librasterlite-1.1c.tar.gz'
sha1 'c54f38ef2974bc92410e2c2196088af14bd9c21a'
- depends_on "pkg-config" => :build unless MacOS.mountain_lion?
+ depends_on "pkg-config" => :build unless MacOS.version >= :mountain_lion
depends_on :libpng
depends_on "libgeotiff"
depends_on "libspatialite"
View
2  Library/Formula/librets.rb
@@ -6,7 +6,7 @@ class Librets < Formula
sha1 '2de4d9e9cb26533eb0a9a090b3354a70ed3c41ec'
depends_on 'boost'
- depends_on 'swig' if MacOS.lion?
+ depends_on 'swig' if MacOS.version >= :lion
def install
system "./configure", "--disable-debug",
View
2  Library/Formula/libvirt.rb
@@ -16,7 +16,7 @@ class Libvirt < Formula
depends_on "gnutls"
depends_on "yajl"
- if MacOS.leopard?
+ if MacOS.version == :leopard
# Definitely needed on Leopard, but not on Snow Leopard.
depends_on "readline"
depends_on "libxml2"
View
2  Library/Formula/libxml++.rb
@@ -7,7 +7,7 @@ class Libxmlxx < Formula
depends_on 'glibmm'
# LibXML++ can't compile agains the version of LibXML shipped with Leopard
- depends_on 'libxml2' if MacOS.leopard?
+ depends_on 'libxml2' if MacOS.version == :leopard
def install
system "./configure", "--disable-dependency-tracking",
View
2  Library/Formula/macvim.rb
@@ -25,7 +25,7 @@ def install
# If building for 10.8, make sure that CC is set to "clang".
# Reference: https://github.com/b4winckler/macvim/wiki/building
- ENV['CC'] = "clang" if MacOS.mountain_lion?
+ ENV['CC'] = "clang" if MacOS.version >= :mountain_lion
args = %W[
--with-features=huge
View
4 Library/Formula/mapserver.rb
@@ -18,7 +18,7 @@ class Mapserver < Formula
depends_on 'gdal'
depends_on 'geos' if build.include? 'with-geos'
- depends_on 'postgresql' if build.include? 'with-postgresql' and not MacOS.lion?
+ depends_on 'postgresql' if build.include? 'with-postgresql' and not MacOS.version >= :lion
depends_on 'fcgi' if build.include? 'with-fastcgi'
def patches
@@ -41,7 +41,7 @@ def install
args << "--with-php=/usr/include/php" if build.include? 'with-php'
if build.include? 'with-postgresql'
- if MacOS.lion? # Lion ships with PostgreSQL libs
+ if MacOS.version >= :lion # Lion ships with PostgreSQL libs
args << "--with-postgis"
else
args << "--with-postgis=#{HOMEBREW_PREFIX}/bin/pg_config"
View
2  Library/Formula/md.rb
@@ -6,7 +6,7 @@ class Md < Formula
sha1 '0128de65a4da2ef9655f3b1e6a94d2f8ae292414'
# OS X up to and including Lion 10.7 includes 'md'
- keg_only :provided_by_osx unless MacOS.mountain_lion?
+ keg_only :provided_by_osx unless MacOS.version >= :mountain_lion
def install
cd 'md' do
View
2  Library/Formula/mpd.rb
@@ -36,7 +36,7 @@ def install
"--enable-fluidsynth",
"--enable-zip",
"--enable-lame-encoder"]
- args << "--disable-curl" if MacOS.leopard?
+ args << "--disable-curl" if MacOS.version == :leopard
args << "--enable-lastfm" if build.include?("lastfm")
system "./configure", *args
View
4 Library/Formula/mysql.rb
@@ -13,7 +13,7 @@ class Mysql < Formula
end
depends_on 'cmake' => :build
- depends_on 'pidof' unless MacOS.mountain_lion?
+ depends_on 'pidof' unless MacOS.version >= :mountain_lion
option :universal
option 'with-tests', 'Build with unit tests'
@@ -99,7 +99,7 @@ def install
inreplace "#{prefix}/support-files/mysql.server" do |s|
s.gsub!(/^(PATH=".*)(")/, "\\1:#{HOMEBREW_PREFIX}/bin\\2")
# pidof can be replaced with pgrep from proctools on Mountain Lion
- s.gsub!(/pidof/, 'pgrep') if MacOS.mountain_lion?
+ s.gsub!(/pidof/, 'pgrep') if MacOS.version >= :mountain_lion
end
ln_s "#{prefix}/support-files/mysql.server", bin
end
View
4 Library/Formula/nmap.rb
@@ -8,7 +8,7 @@ class Nmap < Formula
head 'https://guest:@svn.nmap.org/nmap/', :using => :svn
# Leopard's version of OpenSSL isn't new enough
- depends_on "openssl" if MacOS.leopard?
+ depends_on "openssl" if MacOS.version == :leopard
fails_with :llvm do
build 2334
@@ -23,7 +23,7 @@ def install
--without-zenmap
--disable-universal]
- if MacOS.leopard?
+ if MacOS.version == :leopard
openssl = Formula.factory('openssl')
args << "--with-openssl=#{openssl.prefix}"
end
View
2  Library/Formula/node.rb
@@ -50,7 +50,7 @@ class Node < Formula
head 'https://github.com/joyent/node.git'
# Leopard OpenSSL is not new enough, so use our keg-only one
- depends_on 'openssl' if MacOS.leopard?
+ depends_on 'openssl' if MacOS.version == :leopard
depends_on NpmNotInstalled.new unless build.include? 'without-npm'
depends_on PythonVersion.new
View
2  Library/Formula/nspr.rb
@@ -10,7 +10,7 @@ def install
cd "mozilla/nsprpub" do
# Fixes a bug with linking against CoreFoundation, needed to work with SpiderMonkey
# See: http://openradar.appspot.com/7209349
- target_frameworks = (Hardware.is_32_bit? or MacOS.leopard?) ? "-framework Carbon" : ""
+ target_frameworks = (Hardware.is_32_bit? or MacOS.version == :leopard) ? "-framework Carbon" : ""
inreplace "pr/src/Makefile.in", "-framework CoreServices -framework CoreFoundation", target_frameworks
args = ["--prefix=#{prefix}", "--disable-debug", "--enable-strip", "--enable-optimize"]
View
2  Library/Formula/nu.rb
@@ -2,7 +2,7 @@
class NeedsLion < Requirement
def satisfied?
- MacOS.lion?
+ MacOS.version >= :lion
end
def message
"Nu requires Mac OS X 10.7 or newer"
View
13 Library/Formula/octave.rb
@@ -1,6 +1,9 @@
require 'formula'
-def snow_leopard_64?
+# Leading underscore because this method is defined differently
+# in compat, and anything that loads this file would end up with
+# this definition instead!
+def _snow_leopard_64?
# 64 bit builds on 10.6 require some special handling.
MacOS.version == :snow_leopard and MacOS.prefer_64_bit?
end
@@ -28,10 +31,10 @@ class Octave < Formula
# http://www.macresearch.org/lapackblas-fortran-106
#
# We can work around the issues using dotwrp.
- depends_on 'dotwrp' if snow_leopard_64?
+ depends_on 'dotwrp' if _snow_leopard_64?
# octave refuses to work with BSD readline, so it's either this or --disable-readline
depends_on 'readline'
- depends_on 'curl' if MacOS.leopard? # Leopard's libcurl is too old
+ depends_on 'curl' if MacOS.version == :leopard # Leopard's libcurl is too old
# additional features
depends_on 'suite-sparse'
@@ -63,11 +66,11 @@ def install
"--prefix=#{prefix}",
# Cant use `-framework Accelerate` because `mkoctfile`, the tool used to
# compile extension packages, can't parse `-framework` flags.
- "--with-blas=#{'-ldotwrp ' if snow_leopard_64?}-Wl,-framework -Wl,Accelerate",
+ "--with-blas=#{'-ldotwrp ' if _snow_leopard_64?}-Wl,-framework -Wl,Accelerate",
# SuiteSparse-4.x.x fix, see http://savannah.gnu.org/bugs/?37031
"--with-umfpack=-lumfpack -lsuitesparseconfig",
]
- args << "--without-framework-carbon" if MacOS.lion?
+ args << "--without-framework-carbon" if MacOS.version >= :lion
# avoid spurious 'invalid assignment to cs-list' erorrs on 32 bit installs:
args << 'CXXFLAGS=-O0' unless MacOS.prefer_64_bit?
View
2  Library/Formula/open-scene-graph.rb
@@ -41,7 +41,7 @@ def install
args = std_cmake_args
args << '-DBUILD_DOCUMENTATION=' + ((build.include? 'docs') ? 'ON' : 'OFF')
- if snow_leopard_64?
+ if MacOS.prefer_64_bit?
args << "-DCMAKE_OSX_ARCHITECTURES=x86_64"
args << "-DOSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX=imageio"
args << "-DOSG_WINDOWING_SYSTEM=Cocoa"
View
2  Library/Formula/opencolorio.rb
@@ -36,7 +36,7 @@ def install
# /usr/include
# So we just set the sysroot to /
- args << "-DCMAKE_OSX_SYSROOT=/" if ENV.compiler == :llvm and MacOS.lion?
+ args << "-DCMAKE_OSX_SYSROOT=/" if ENV.compiler == :llvm and MacOS.version >= :lion
View
2  Library/Formula/phantomjs.rb
@@ -2,7 +2,7 @@
class SnowLeopardOrNewer < Requirement
def satisfied?
- MacOS.snow_leopard?
+ MacOS.version >= :snow_leopard
end
def message
View
2  Library/Formula/portaudio.rb
@@ -18,7 +18,7 @@ def patches
{ :p0 =>
"https://trac.macports.org/export/94150/trunk/dports/audio/portaudio/files/patch-include__pa_mac_core.h.diff"
}
- end if MacOS.lion?
+ end if MacOS.version >= :lion
def install
ENV.universal_binary if build.universal?
View
4 Library/Formula/postgresql.rb
@@ -6,7 +6,7 @@ class Postgresql < Formula
sha1 '8411f39e7cff8d691d908de7823b72426433faa2'
depends_on 'readline'
- depends_on 'libxml2' if MacOS.leopard? # Leopard libxml is too old
+ depends_on 'libxml2' if MacOS.version == :leopard # Leopard libxml is too old
depends_on 'ossp-uuid' unless build.include? 'without-ossp-uuid'
option '32-bit'
@@ -24,7 +24,7 @@ def patches
end
def install
- ENV.libxml2 if MacOS.snow_leopard?
+ ENV.libxml2 if MacOS.version >= :snow_leopard
args = ["--disable-debug",
"--prefix=#{prefix}",
View
2  Library/Formula/povray.rb
@@ -11,7 +11,7 @@ class Povray < Formula
# TODO give this a build number (2326?)
fails_with :llvm do
cause "povray fails with 'terminate called after throwing an instance of int'"
- end if MacOS.leopard?
+ end if MacOS.version == :leopard
def install
system "./configure", "--disable-debug", "--disable-dependency-tracking",
View
10 Library/Formula/qt.rb
@@ -22,7 +22,7 @@ class Qt < Formula
option 'developer', 'Compile and link Qt with developer options'
depends_on "d-bus" if build.include? 'with-qtdbus'
- depends_on 'sqlite' if MacOS.leopard?
+ depends_on 'sqlite' if MacOS.version == :leopard
fails_with :clang do
build 421
@@ -31,11 +31,11 @@ class Qt < Formula
def patches
# fixes conflict on osx 10.5. See qt bug:
# https://bugreports.qt-project.org/browse/QTBUG-23258
- if MacOS.leopard?
+ if MacOS.version == :leopard
"http://bugreports.qt-project.org/secure/attachment/26712/Patch-Qt-4.8-for-10.5"
# add support for Mountain Lion
# should be unneeded for 4.8.3
- elsif MacOS.mountain_lion?
+ elsif MacOS.version >= :mountain_lion
[ "https://qt.gitorious.org/qt/qt/commit/422f1b?format=patch",
"https://qt.gitorious.org/qt/qt/commit/665355?format=patch",
"https://raw.github.com/gist/3187034/893252db0ae3bb9bb5fa3ff7c530c7978399b101/0001-Fix-WebKit-on-OS-X-Mountain-Lion.patch" ]
@@ -46,7 +46,7 @@ def patches
def install
# Apply binary git patch; normal patch ignores this.
# TODO: Autodetect binary patches and apply them correctly.
- system "git apply --exclude=*/QtWebKit.pro 002-homebrew.diff" if MacOS.mountain_lion?
+ system "git apply --exclude=*/QtWebKit.pro 002-homebrew.diff" if MacOS.version >= :mountain_lion
ENV.append "CXXFLAGS", "-fvisibility=hidden"
args = ["-prefix", prefix,
@@ -55,7 +55,7 @@ def install
"-cocoa", "-fast" ]
# See: https://github.com/mxcl/homebrew/issues/issue/744
- args << "-system-sqlite" if MacOS.leopard?
+ args << "-system-sqlite" if MacOS.version == :leopard
args << "-plugin-sql-mysql" if (HOMEBREW_CELLAR+"mysql").directory?
View
2  Library/Formula/rabbitmq.rb
@@ -6,7 +6,7 @@ class Rabbitmq < Formula
sha1 '50ad453ae6a293c7b314dd2dd24a29648f1acc11'
depends_on 'erlang'
- depends_on 'simplejson' => :python if MacOS.leopard?
+ depends_on 'simplejson' => :python if MacOS.version == :leopard
def install
# Install the base files
View
2  Library/Formula/recode.rb
@@ -19,7 +19,7 @@ def copy_libtool_files!
s = Formula.factory('libtool').share
d = "#{s}/libtool/config"
cp ["#{d}/config.guess", "#{d}/config.sub"], "."
- elsif MacOS.leopard?
+ elsif MacOS.version == :leopard
cp Dir["#{MacOS::Xcode.prefix}/usr/share/libtool/config.*"], "."
else
cp Dir["#{MacOS::Xcode.prefix}/usr/share/libtool/config/config.*"], "."
View
2  Library/Formula/rtmpdump.rb
@@ -7,7 +7,7 @@ class Rtmpdump < Formula
head 'git://git.ffmpeg.org/rtmpdump'
- depends_on 'openssl' if MacOS.leopard?
+ depends_on 'openssl' if MacOS.version == :leopard
fails_with :llvm do
build '2336'
View
2  Library/Formula/rtorrent.rb
@@ -13,7 +13,7 @@ class Rtorrent < Formula
def install
args = ["--disable-debug", "--disable-dependency-tracking", "--prefix=#{prefix}"]
args << "--with-xmlrpc-c" if Formula.factory("xmlrpc-c").installed?
- if MacOS.leopard?
+ if MacOS.version == :leopard
inreplace 'configure' do |s|
s.gsub! ' pkg_cv_libcurl_LIBS=`$PKG_CONFIG --libs "libcurl >= 7.15.4" 2>/dev/null`',
' pkg_cv_libcurl_LIBS=`$PKG_CONFIG --libs "libcurl >= 7.15.4" | sed -e "s/-arch [^-]*/-arch $(uname -m) /" 2>/dev/null`'
View
2  Library/Formula/sdl.rb
@@ -25,7 +25,7 @@ def install
system "./autogen.sh" if build.head?
args = %W[--prefix=#{prefix}]
- args << "--disable-nasm" unless MacOS.mountain_lion? # might work with earlier, might only work with new clang
+ args << "--disable-nasm" unless MacOS.version >= :mountain_lion # might work with earlier, might only work with new clang
# LLVM-based compilers choke on the assembly code packaged with SDL.
args << '--disable-assembly' if ENV.compiler == :llvm or ENV.compiler == :clang and MacOS.clang_build_version < 421
args << '--without-x'
View
2  Library/Formula/spidermonkey.rb
@@ -24,7 +24,7 @@ class Spidermonkey < Formula
def install
# aparently this flag causes the build to fail for ivanvc on 10.5 with a
# penryn (core 2 duo) CPU. So lets be cautious here and remove it.
- ENV['CFLAGS'] = ENV['CFLAGS'].gsub(/-msse[^\s]+/, '') if MacOS.leopard?
+ ENV['CFLAGS'] = ENV['CFLAGS'].gsub(/-msse[^\s]+/, '') if MacOS.version == :leopard
# For some reason SpiderMonkey requires Autoconf-2.13
ac213_prefix = buildpath/'ac213'
View
2  Library/Formula/stormfs.rb
@@ -8,7 +8,7 @@ class Stormfs < Formula
depends_on 'pkg-config' => :build
depends_on 'glib'
depends_on 'fuse4x'
- depends_on 'curl' if MacOS.leopard?
+ depends_on 'curl' if MacOS.version == :leopard
def install
system "./configure", "--disable-debug", "--disable-dependency-tracking",
View
2  Library/Formula/subversion.rb
@@ -165,7 +165,7 @@ def install
# Remove hard-coded ppc target, add appropriate ones
if build.universal?
arches = "-arch x86_64 -arch i386"
- elsif MacOS.leopard?
+ elsif MacOS.version == :leopard
arches = "-arch i386"
else
arches = "-arch x86_64"
View
2  Library/Formula/swi-prolog.rb
@@ -21,7 +21,7 @@ class SwiProlog < Formula
end
# 10.5 versions of these are too old
- if MacOS.leopard?
+ if MacOS.version == :leopard
depends_on 'fontconfig'
depends_on 'expat'
end
View
2  Library/Formula/tcpflow.rb
@@ -12,7 +12,7 @@ def copy_libtool_files!
s = Formula.factory('libtool').share
d = "#{s}/libtool/config"
cp ["#{d}/config.guess", "#{d}/config.sub"], "."
- elsif MacOS.leopard?
+ elsif MacOS.version == :leopard
cp Dir["#{MacOS::Xcode.prefix}/usr/share/libtool/config.*"], "."
else
cp Dir["#{MacOS::Xcode.prefix}/usr/share/libtool/config/config.*"], "."
View
2  Library/Formula/texi2html.rb
@@ -5,7 +5,7 @@ class Texi2html < Formula
url 'http://download.savannah.gnu.org/releases/texi2html/texi2html-1.70.tar.gz'
sha1 'b3472fb5ef80824177a56a1a37983c13497b23be'
- keg_only :provided_by_osx unless MacOS.mountain_lion?
+ keg_only :provided_by_osx unless MacOS.version >= :mountain_lion
def install
system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}",
View
2  Library/Formula/trafshow.rb
@@ -20,7 +20,7 @@ def copy_libtool_files!
s = Formula.factory('libtool').share
d = "#{s}/libtool/config"
cp ["#{d}/config.guess", "#{d}/config.sub"], "."
- elsif MacOS.leopard?
+ elsif MacOS.version == :leopard
cp Dir["#{MacOS::Xcode.prefix}/usr/share/libtool/config.*"], "."
else
cp Dir["#{MacOS::Xcode.prefix}/usr/share/libtool/config/config.*"], "."
View
2  Library/Formula/vpnc.rb
@@ -16,7 +16,7 @@ class Vpnc < Formula
# Patch from user @Imagesafari to enable compilation on Lion
def patches
- DATA if MacOS.lion?
+ DATA if MacOS.version >= :lion
end
def install
View
2  Library/Formula/wget.rb
@@ -14,7 +14,7 @@ class Wget < Formula
option "enable-iri", "Enable iri support"
option "enable-debug", "Build with debug support"
- depends_on "openssl" if MacOS.leopard?
+ depends_on "openssl" if MacOS.version == :leopard
depends_on "libidn" if build.include? "enable-iri"
if build.head?
View
2  Library/Formula/wine.rb
@@ -72,7 +72,7 @@ def install
"--with-x",
"--with-coreaudio",
"--with-opengl"]
- args << "--disable-win16" if MacOS.leopard? or ENV.compiler == :clang
+ args << "--disable-win16" if MacOS.version == :leopard or ENV.compiler == :clang
# 64-bit builds of mpg123 are incompatible with 32-bit builds of Wine
args << "--without-mpg123" if Hardware.is_64_bit?
View
4 Library/Formula/xmlrpc-c.rb
@@ -9,9 +9,7 @@ def patches
# Backport patch for deprecated curl/types.h include, which is gone on 10.8
# On 10.6 and 10.7 it's empty, so could probably patch unconditionally
# see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=636457#10
- if MacOS.mountain_lion?
- DATA
- end
+ DATA if MacOS.version >= :mountain_lion
end
def install
View
2  Library/Formula/ykpers.rb
@@ -12,7 +12,7 @@ class Ykpers < Formula
def patches
{:p0 =>
"https://trac.macports.org/export/96037/trunk/dports/security/ykpers/files/patch-pre-Lion-strnlen.diff"
- } unless MacOS.lion?
+ } unless MacOS.version >= :lion
end
def install
View
1  Library/Homebrew/compat/compatibility.rb
@@ -165,6 +165,7 @@ def handle_failure
end
end
+# TODO eventually some of these should print deprecation warnings
module MacOS extend self
def xcode_folder
Xcode.folder
View
4 Library/Homebrew/macos.rb
@@ -1,5 +1,7 @@
module MacOS extend self
+ # This can be compared to numerics, strings, or symbols
+ # using the standard Ruby Comparable methods.
def version
require 'version'
MacOSVersion.new(MACOS_VERSION.to_s)
@@ -221,7 +223,7 @@ def pkgutil_info id
def bottles_supported?
# We support bottles on all versions of OS X except 32-bit Snow Leopard.
- (Hardware.is_64_bit? or not MacOS.snow_leopard?) \
+ (Hardware.is_64_bit? or not MacOS.version >= :snow_leopard) \
and HOMEBREW_PREFIX.to_s == '/usr/local' \
and HOMEBREW_CELLAR.to_s == '/usr/local/Cellar' \
end
View
6 Library/Homebrew/superenv.rb
@@ -119,7 +119,7 @@ def determine_pkg_config_path
# we put our paths before X because we dupe some of the X libraries
paths << "#{MacSystem.x11_prefix}/lib/pkgconfig" << "#{MacSystem.x11_prefix}/share/pkgconfig" if x11?
# Mountain Lion no longer ships some .pcs; ensure we pick up our versions
- paths << "#{HOMEBREW_REPOSITORY}/Library/Homebrew/pkgconfig" if MacOS.mountain_lion?
+ paths << "#{HOMEBREW_REPOSITORY}/Library/Homebrew/pkgconfig" if MacOS.version >= :mountain_lion
paths.to_path_s
end
@@ -173,9 +173,9 @@ def determine_cccfg
s = ""
s << 'b' if ARGV.build_bottle?
# Fix issue with sed barfing on unicode characters on Mountain Lion
- s << 's' if MacOS.mountain_lion?
+ s << 's' if MacOS.version >= :mountain_lion
# Fix issue with 10.8 apr-1-config having broken paths
- s << 'a' if MacOS.cat == :mountainlion
+ s << 'a' if MacOS.version == :mountain_lion
s
end
Please sign in to comment.
Something went wrong with that request. Please try again.