homebrew-core/Formula/notmuch.rb
Jack Nagel ec11577107 Switch compilers when no build is specified
Given the current state of OS X compilers, the original fails_with
behavior is becoming less useful, mostly resulting in build failures
each time the compiler is updated. So make the following changes:

When a build is specified, we retain the old behavior: switch compilers
if the available compiler is <= the build, don't switch if it is > the
build.

When no build is specified, unconditionally switch compilers, and don't
output the advice message. This allows us to mark formulae as
perpetually failing, avoiding the need to update formulae each time a
new compiler build is made available.

As a bonus, this makes the logic much easier to reason about.

Closes Homebrew/homebrew#18175.
2013-03-12 13:55:15 -05:00

44 lines
1,006 B
Ruby

require 'formula'
class NewEnoughEmacs < Requirement
fatal true
def satisfied?
`emacs --version`.split("\n")[0] =~ /GNU Emacs (\d+)\./
major_version = ($1 || 0).to_i
major_version >= 23
end
def message
"Emacs support requires at least Emacs 23."
end
end
class Notmuch < Formula
homepage 'http://notmuchmail.org'
url 'http://notmuchmail.org/releases/notmuch-0.14.tar.gz'
sha1 'ad1ef9c2d29cfb0faab7837968d11325dee404bd'
option "emacs", "Install emacs support."
depends_on NewEnoughEmacs if build.include? "emacs"
depends_on 'pkg-config' => :build
depends_on 'xapian'
depends_on 'talloc'
depends_on 'gmime'
fails_with :clang do
cause "./lib/notmuch-private.h:478:8: error: visibility does not match previous declaration"
end
def install
args = ["--prefix=#{prefix}"]
if build.include? "emacs"
args << "--with-emacs"
else
args << "--without-emacs"
end
system "./configure", *args
system "make install"
end
end