aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/mu.rb
blob: d586aca607132f1e543421826642d9aed998bb8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
require "formula"

class Emacs23Installed < Requirement
  fatal true
  env :userpaths
  default_formula "emacs"

  satisfy do
    `emacs --version 2>/dev/null` =~ /^GNU Emacs (\d{2})/
    $1.to_i >= 23
  end
end

class Mu < Formula
  homepage "http://www.djcbsoftware.nl/code/mu/"
  url "https://github.com/djcb/mu/archive/v0.9.10.tar.gz"
  sha1 "5c21aeed9471f2d0aaa76307a3ec70fc86f0817b"

  head "https://github.com/djcb/mu.git"

  option "with-emacs", "Build with emacs support"

  depends_on "autoconf" => :build
  depends_on "automake" => :build
  depends_on "libtool" => :build
  depends_on "pkg-config" => :build
  depends_on "gettext"
  depends_on "glib"
  depends_on "gmime"
  depends_on "xapian"
  depends_on Emacs23Installed if build.with? "emacs"

  env :std if build.with? "emacs"

  def install
    # Explicitly tell the build not to include emacs support as the version
    # shipped by default with Mac OS X is too old.
    ENV["EMACS"] = "no" if build.without? "emacs"

    # I dunno.
    # https://github.com/djcb/mu/issues/332
    # https://github.com/Homebrew/homebrew/issues/25524
    ENV.delete "MACOSX_DEPLOYMENT_TARGET"

    system "autoreconf", "-ivf"
    system "./configure", "--disable-dependency-tracking",
                          "--prefix=#{prefix}",
                          "--with-gui=none"
    system "make"
    system "make test"
    system "make install"
  end

  def caveats; <<-EOS.undent
    Existing mu users are recommended to run the following after upgrading:

      mu index --rebuild
    EOS
  end
end