aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/imapfilter.rb
blob: 3c65ea5d9a027b2a875426951c368db354a2d410 (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
class Imapfilter < Formula
  homepage "https://github.com/lefcha/imapfilter/"
  url "https://github.com/lefcha/imapfilter/archive/v2.5.7.tar.gz"
  sha1 "216ec7b8563729cf446e9b2839bdcdf3eae351ed"

  bottle do
    sha1 "55091d5ccf77951f94489c712c092f7d9b3c8c9a" => :yosemite
    sha1 "76bb5a5670eae9fbbdbfdc7903107724507abcbb" => :mavericks
    sha1 "92993d2acab4990578eccd43dc8cfed4ed37f6f5" => :mountain_lion
  end

  depends_on "lua"
  depends_on "pcre"
  depends_on "openssl"

  def install
    inreplace "src/Makefile" do |s|
      s.change_make_var! "CFLAGS", "#{s.get_make_var "CFLAGS"} #{ENV.cflags}"
    end

    # find Homebrew's libpcre and lua
    ENV.append "LDFLAGS", "-L#{HOMEBREW_PREFIX}/lib"
    ENV.append "LDFLAGS", "-liconv"
    system "make", "PREFIX=#{prefix}", "MANDIR=#{man}", "LDFLAGS=#{ENV.ldflags}"
    system "make", "PREFIX=#{prefix}", "MANDIR=#{man}", "install"

    prefix.install "samples"
  end

  def caveats; <<-EOS.undent
    You will need to create a ~/.imapfilter/config.lua file.
    Samples can be found in:
      #{prefix}/samples
    EOS
  end

  test do
    system "#{bin}/imapfilter", "-V"
  end
end