Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Commit

Permalink
Normalize use of MACOS_VERSION
Browse files Browse the repository at this point in the history
  • Loading branch information
adamv committed Apr 9, 2011
1 parent b5b6da2 commit b782d9d
Show file tree
Hide file tree
Showing 43 changed files with 97 additions and 92 deletions.
13 changes: 7 additions & 6 deletions Library/Formula/alpine.rb
Expand Up @@ -5,16 +5,17 @@ class Alpine < Formula
homepage 'http://www.washington.edu/alpine/'
md5 '0f4757167baf5c73aa44f2ffa4860093'

def install
system "./configure", "--prefix=#{prefix}", "--disable-debug", "--with-ssl-include-dir=/usr/include/openssl"
def patches
DATA unless MacOS.snow_leopard?
end

def install
ENV.j1
system "./configure", "--disable-debug",
"--prefix=#{prefix}",
"--with-ssl-include-dir=/usr/include/openssl"
system "make install"
end

def patches
DATA if MACOS_VERSION >= 10.6
end
end

__END__
Expand Down
11 changes: 5 additions & 6 deletions Library/Formula/bdw-gc.rb
Expand Up @@ -8,13 +8,12 @@ class BdwGc < Formula
fails_with_llvm "LLVM gives an unsupported inline asm error"

def install
if 10.6 <= MACOS_VERSION
# ucontext has been deprecated in 10.6
# use this flag to force the header to compile
ENV.append 'CPPFLAGS', "-D_XOPEN_SOURCE"
end
# ucontext has been deprecated in 10.6
# use this flag to force the header to compile
ENV.append 'CPPFLAGS', "-D_XOPEN_SOURCE" if MacOS.snow_leopard?

system "./configure", "--prefix=#{prefix}", "--disable-debug", "--disable-dependency-tracking"
system "./configure", "--disable-debug", "--disable-dependency-tracking",
"--prefix=#{prefix}"
system "make install"
end
end
7 changes: 4 additions & 3 deletions Library/Formula/cairomm.rb
Expand Up @@ -5,14 +5,16 @@ class Cairomm < Formula
homepage 'http://cairographics.org/cairomm/'
md5 '559afbc47484ba3fad265e38a3dafe90'

# patch for universal compilation from:
# http://trac.macports.org/browser/trunk/dports/graphics/cairomm/files/patch-quartz-lp64.diff
def patches
{ :p0 => DATA }
end

depends_on 'pkg-config' => :build
depends_on 'libsigc++'
# cairo is available on 10.6 via X11 but not on 10.5
depends_on 'cairo' if MACOS_VERSION == 10.5
depends_on 'cairo' if MacOS.leopard?

def install
system "./configure", "--disable-dependency-tracking",
Expand All @@ -25,8 +27,7 @@ def install
end
end

# patch for universal compilation from:
# http://trac.macports.org/browser/trunk/dports/graphics/cairomm/files/patch-quartz-lp64.diff

__END__
diff -urN cairomm/quartz_font.cc cairomm-1.8.2/cairomm/quartz_font.cc
--- cairomm/quartz_font.cc 2008-12-20 18:37:46.000000000 +0100
Expand Down
2 changes: 1 addition & 1 deletion Library/Formula/collectd.rb
Expand Up @@ -15,7 +15,7 @@ def install
"--with-python=/usr/bin",
"--prefix=#{prefix}",
"--localstatedir=#{var}"]
args << "--disable-embedded-perl" if MACOS_VERSION < 10.6
args << "--disable-embedded-perl" if MacOS.leopard?

system "./configure", *args
system "make install"
Expand Down
2 changes: 1 addition & 1 deletion Library/Formula/couchdb.rb
Expand Up @@ -8,7 +8,7 @@ class Couchdb < Formula
depends_on 'spidermonkey'
depends_on 'icu4c'
depends_on 'erlang'
depends_on 'curl' if MACOS_VERSION < 10.6
depends_on 'curl' if MacOS.leopard?

def install
system "./bootstrap" if File.exists? "bootstrap"
Expand Down
2 changes: 1 addition & 1 deletion Library/Formula/disco.rb
Expand Up @@ -9,7 +9,7 @@ class Disco < Formula
head 'git://github.com/tuulos/disco.git'

depends_on 'erlang'
depends_on 'simplejson' => :python if MACOS_VERSION < 10.6
depends_on 'simplejson' => :python if MacOS.leopard?
depends_on 'libcmph'

def install
Expand Down
4 changes: 2 additions & 2 deletions Library/Formula/ejabberd.rb
Expand Up @@ -5,7 +5,7 @@ class Ejabberd < Formula
homepage 'http://www.ejabberd.im'
md5 '2029ceca45584d704ca821a771d6d928'

depends_on "openssl" if MACOS_VERSION < 10.6
depends_on "openssl" if MacOS.leopard?
depends_on "erlang"

def install
Expand All @@ -18,7 +18,7 @@ def install
"--sysconfdir=#{etc}",
"--localstatedir=#{var}"]

if MACOS_VERSION < 10.6
if MacOS.leopard?
openssl = Formula.factory('openssl')
args << "--with-openssl=#{openssl.prefix}"
end
Expand Down
2 changes: 1 addition & 1 deletion Library/Formula/erlang.rb
Expand Up @@ -67,7 +67,7 @@ def install
args << "--enable-darwin-64bit" if MacOS.prefer_64_bit?

system "./configure", *args
system "touch lib/wx/SKIP" if MACOS_VERSION >= 10.6
system "touch lib/wx/SKIP" if MacOS.snow_leopard?
system "make"
system "make install"

Expand Down
2 changes: 1 addition & 1 deletion Library/Formula/ffmpeg.rb
Expand Up @@ -40,7 +40,7 @@ def install

# For 32-bit compilation under gcc 4.2, see:
# http://trac.macports.org/ticket/20938#comment:22
if MACOS_VERSION >= 10.6 and Hardware.is_32_bit?
if MacOS.snow_leopard? and Hardware.is_32_bit?
ENV.append_to_cflags "-mdynamic-no-pic"
end

Expand Down
2 changes: 1 addition & 1 deletion Library/Formula/gerbv.rb
Expand Up @@ -7,7 +7,7 @@ class Gerbv < Formula

depends_on 'pkg-config' => :build
depends_on 'gtk+'
depends_on 'cairo' if MACOS_VERSION < 10.6
depends_on 'cairo' if MacOS.leopard?

def install
system "./configure", "--disable-debug", "--disable-dependency-tracking",
Expand Down
3 changes: 1 addition & 2 deletions Library/Formula/gfortran.rb
Expand Up @@ -15,8 +15,7 @@ def stage
end

class Gfortran < Formula
if MACOS_VERSION < 10.6
# Leopard
if MacOS.leopard?
url 'http://r.research.att.com/gfortran-42-5577.pkg'
md5 '30fb495c93cf514003cdfcb7846dc701'
version "4.2.4-5577"
Expand Down
2 changes: 1 addition & 1 deletion Library/Formula/graphicsmagick.rb
Expand Up @@ -51,7 +51,7 @@ def install
"--prefix=#{prefix}",
"--enable-shared", "--disable-static"]
args << "--without-magick-plus-plus" unless ARGV.include? '--with-magick-plus-plus'
args << "--disable-openmp" if MACOS_VERSION < 10.6 # libgomp unavailable
args << "--disable-openmp" if MacOS.leopard? # libgomp unavailable
args << "--with-gslib" if ghostscript_srsly?
args << "--with-gs-font-dir=#{HOMEBREW_PREFIX}/share/ghostscript/fonts" \
unless ghostscript_fonts?
Expand Down
2 changes: 1 addition & 1 deletion Library/Formula/graphviz.rb
Expand Up @@ -9,7 +9,7 @@ class Graphviz < Formula

if ARGV.include? '--with-pdf'
depends_on 'pango'
depends_on 'cairo' if MACOS_VERSION < 10.6
depends_on 'cairo' if MacOS.leopard?
end

def options
Expand Down
36 changes: 18 additions & 18 deletions Library/Formula/grass.rb
Expand Up @@ -21,7 +21,7 @@ class Grass < Formula
depends_on "unixodbc"
depends_on "fftw"

depends_on "cairo" if MACOS_VERSION < 10.6
depends_on "cairo" if MacOS.leopard?

def patches
DATA
Expand All @@ -38,9 +38,8 @@ def install
readline = Formula.factory( 'readline' )
gettext = Formula.factory( 'gettext' )

configure_args = [
"--disable-debug",
"--disable-dependency-tracking",
args = [
"--disable-debug", "--disable-dependency-tracking",
"--with-libs=/usr/X11/lib #{HOMEBREW_PREFIX}/lib",
"--with-includes=#{HOMEBREW_PREFIX}/include",
"--enable-largefile",
Expand Down Expand Up @@ -70,32 +69,33 @@ def install
]

if MacOS.prefer_64_bit?
configure_args << "--enable-64bit"
configure_args << "--with-macosx-archs=x86_64"
args << "--enable-64bit"
args << "--with-macosx-archs=x86_64"
else
configure_args << "--with-macosx-archs=i386"
args << "--with-macosx-archs=i386"
end

# Deal with Cairo support
if MACOS_VERSION >= 10.6
configure_args << "--with-cairo-includes=/usr/X11/include /usr/X11/include/cairo"
else
if MacOS.leopard?
cairo = Formula.factory('cairo')
configure_args << "--with-cairo-includes=#{cairo.include + 'cairo'}"
configure_args << "--with-cairo-libs=#{cairo.lib}"
args << "--with-cairo-includes=#{cairo.include}/cairo"
args << "--with-cairo-libs=#{cairo.lib}"
else
args << "--with-cairo-includes=/usr/X11/include /usr/X11/include/cairo"
end
configure_args << "--with-cairo"

args << "--with-cairo"

# Database support
configure_args << "--with-postgres" if postgres?
args << "--with-postgres" if postgres?
if mysql?
mysql = Formula.factory('mysql')
configure_args << "--with-mysql-includes=#{mysql.include + 'mysql'}"
configure_args << "--with-mysql-libs=#{mysql.lib + 'mysql'}"
configure_args << "--with-mysql"
args << "--with-mysql-includes=#{mysql.include + 'mysql'}"
args << "--with-mysql-libs=#{mysql.lib + 'mysql'}"
args << "--with-mysql"
end

system "./configure", "--prefix=#{prefix}", *configure_args
system "./configure", "--prefix=#{prefix}", *args
system "make" # make and make install must be seperate steps.
system "make install"
end
Expand Down
2 changes: 1 addition & 1 deletion Library/Formula/gtk+.rb
Expand Up @@ -13,7 +13,7 @@ class Gtkx < Formula

# Used by pango, but keg-only, so needs to be added to
# the flags for gtk+ explicitly.
depends_on 'cairo' if MACOS_VERSION < 10.6
depends_on 'cairo' if MacOS.leopard?

depends_on 'pango'
depends_on 'jasper' => :optional
Expand Down
2 changes: 1 addition & 1 deletion Library/Formula/imagemagick.rb
Expand Up @@ -74,7 +74,7 @@ def install
"--disable-static",
"--with-modules"]

args << "--disable-openmp" if MACOS_VERSION < 10.6 or disable_openmp?
args << "--disable-openmp" if MacOS.leopard? or disable_openmp?
args << "--without-gslib" unless ghostscript_srsly?
args << "--with-gs-font-dir=#{HOMEBREW_PREFIX}/share/ghostscript/fonts" \
unless ghostscript_srsly? or ghostscript_fonts?
Expand Down
2 changes: 1 addition & 1 deletion Library/Formula/iodine.rb
Expand Up @@ -6,7 +6,7 @@ class Iodine < Formula
md5 'a15bb4faba020d217016fde6e231074a'

def install
if MACOS_VERSION >= 10.6
unless MacOS.leopard?
inreplace ["src/common.c", "src/dns.c", "src/iodine.c", "src/iodined.c"],
"arpa/nameser8_compat", "arpa/nameser_compat"
end
Expand Down
2 changes: 1 addition & 1 deletion Library/Formula/jstalk.rb
Expand Up @@ -6,7 +6,7 @@ class Jstalk < Formula
version '1.0.1'

def install
if MACOS_VERSION < 10.6
if MacOS.leopard?
onoe "jstalk requires Mac OS X 10.6+"
exit 1
end
Expand Down
2 changes: 1 addition & 1 deletion Library/Formula/lftp.rb
Expand Up @@ -11,7 +11,7 @@ class Lftp < Formula

def install
# Bus error
ENV.no_optimization if MACOS_VERSION == 10.5
ENV.no_optimization if MacOS.leopard?

system "./configure", "--prefix=#{prefix}", "--disable-dependency-tracking"
system "make install"
Expand Down
4 changes: 1 addition & 3 deletions Library/Formula/libmemcached.rb
Expand Up @@ -8,9 +8,7 @@ class Libmemcached < Formula
depends_on 'memcached'

def install
if MACOS_VERSION < 10.6
ENV.append_to_cflags "-undefined dynamic_lookup"
end
ENV.append_to_cflags "-undefined dynamic_lookup" if MacOS.leopard?

system "./configure", "--prefix=#{prefix}"
system "make install"
Expand Down
2 changes: 1 addition & 1 deletion Library/Formula/libnet.rb
Expand Up @@ -11,7 +11,7 @@ def install
inreplace "autogen.sh", "libtoolize", "glibtoolize"
system "./autogen.sh"

if MACOS_VERSION >= 10.6
unless MacOS.leopard?
cp "/usr/share/libtool/config/config.guess", "."
cp "/usr/share/libtool/config/config.sub", "."
end
Expand Down
2 changes: 1 addition & 1 deletion Library/Formula/libsvg-cairo.rb
Expand Up @@ -8,7 +8,7 @@ class LibsvgCairo < Formula

depends_on 'pkg-config' => :build
depends_on 'libsvg'
depends_on 'cairo' if MACOS_VERSION < 10.6
depends_on 'cairo' if MacOS.leopard?

def install
system "./configure", "--disable-dependency-tracking", "--disable-debug", "--prefix=#{prefix}"
Expand Down
2 changes: 1 addition & 1 deletion Library/Formula/libvirt.rb
Expand Up @@ -13,7 +13,7 @@ class Libvirt < Formula
depends_on "gnutls"
depends_on "yajl"

if MACOS_VERSION < 10.6
if MacOS.leopard?
# Definitely needed on Leopard, but not on Snow Leopard.
depends_on "readline"
depends_on "libxml2"
Expand Down
2 changes: 1 addition & 1 deletion Library/Formula/madplay.rb
Expand Up @@ -18,7 +18,7 @@ def patches
def install
configure_flags = ["--prefix=#{prefix}", "--disable-debug", "--disable-dependency-tracking"]
# Avoid "error: CPU you selected does not support x86-64 instruction set"
configure_flags << "--build=x86_64" if Hardware.is_64_bit? and MACOS_VERSION >= 10.6
configure_flags << "--build=x86_64" if MacOS.prefer_64_bit?
system "./configure", *configure_flags
system "make install"
end
Expand Down
2 changes: 1 addition & 1 deletion Library/Formula/mpd.rb
Expand Up @@ -34,7 +34,7 @@ def install
"--enable-fluidsynth",
"--enable-zip",
"--enable-lame-encoder"]
args << "--disable-curl" if MACOS_VERSION <= 10.5
args << "--disable-curl" if MacOS.leopard?
args << "--enable-lastfm" if ARGV.include?("--lastfm")

system "./configure", *args
Expand Down
4 changes: 2 additions & 2 deletions Library/Formula/nmap.rb
Expand Up @@ -6,7 +6,7 @@ class Nmap < Formula
md5 '0b80d2cb92ace5ebba8095a4c2850275'

# namp needs newer version of openssl on Leopard
depends_on "openssl" if MACOS_VERSION < 10.6
depends_on "openssl" if MacOS.leopard?

fails_with_llvm

Expand All @@ -15,7 +15,7 @@ def install

args = ["--prefix=#{prefix}", "--without-zenmap"]

if MACOS_VERSION < 10.6
if MacOS.leopard?
openssl = Formula.factory('openssl')
args << "--with-openssl=#{openssl.prefix}"
end
Expand Down
2 changes: 1 addition & 1 deletion Library/Formula/nspr.rb
Expand Up @@ -10,7 +10,7 @@ def install
Dir.chdir "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_VERSION == 10.5) ? "-framework Carbon" : ""
target_frameworks = (Hardware.is_32_bit? or MacOS.leopard?) ? "-framework Carbon" : ""
inreplace "pr/src/Makefile.in", "-framework CoreServices -framework CoreFoundation", target_frameworks

args = ["--prefix=#{prefix}", "--disable-debug", "--enable-strip", "--enable-optimize"]
Expand Down
2 changes: 1 addition & 1 deletion Library/Formula/pango.rb
Expand Up @@ -10,7 +10,7 @@ class Pango < Formula

fails_with_llvm "Undefined symbols when linking", :build => "2326"

if MACOS_VERSION < 10.6
if MacOS.leopard?
depends_on 'fontconfig' # Leopard's fontconfig is too old.
depends_on 'cairo' # Leopard doesn't come with Cairo.
end
Expand Down
2 changes: 1 addition & 1 deletion Library/Formula/pbrt.rb
Expand Up @@ -27,7 +27,7 @@ def install
s.change_make_var! "EXR_LIBDIR", "-L#{openexr.lib} -L#{ilmbase.lib}"

# Change settings if we are using a 32bit system
if MACOS_VERSION < 10.6 or Hardware.is_32_bit?
if MacOS.leopard? or Hardware.is_32_bit?
s.change_make_var! "MARCH", "-m32 -msse2 -mfpmath=sse"
end
end
Expand Down

4 comments on commit b782d9d

@camillol
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit confusing that leopard? means "exactly 10.5" (but in practice is used for "before 10.6") while snow_leopard? means "10.6 or later". When things start depending on Lion and we have to special-case earlier versions, are we going to redefine snow_leopard? to mean "10.6 or earlier"?
It would be better if all methods of that family had a consistent meaning ("version X or later" would be most useful). Then snow_leopard? means "10.6 or later", lion? means "10.7 or later", and leopard? can be replaced with not snow_leopard?
However, I think using an explicit comparison as we did before would be clearer still.

@adamv
Copy link
Contributor Author

@adamv adamv commented on b782d9d Jun 7, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, it's confusing, but we'll take the pain when we have to start special-casing Lion stuff.

@MikeMcQuaid
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, as far as I've understood so far, we'll only support 10.6 and 10.7 when 10.7 is out and deprecate 10.5.

@camillol
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we're still supporting 10.5, 10.6 and 10.7. At least, I see "leopard?", "snow_leopard?" and "lion?" in formulas, and every time I have to go check utils.rb to see which ones are == and which ones are >=. I think I'm just going to run a script through all formulas to replace "lion?" "snow_leopard?" and "leopard?" with explicit version comparisons. Ok?

Please sign in to comment.