aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/ledger.rb
blob: 56d51ad9bdce45eb8390ae11af8ee181a65bf23a (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
require 'formula'

class Ledger < Formula
  homepage 'http://ledger-cli.org'
  url 'http://ftp.newartisans.com/pub/ledger/ledger-2.6.3.tar.gz'
  sha1 '5b8e7d8199acb116f13720a5a469fff1f14b4041'

  head 'https://github.com/jwiegley/ledger.git', :branch => 'next'

  option 'debug', 'Build with debugging symbols enabled'
  option 'python', 'Enable Python support'

  depends_on 'gettext'
  depends_on 'boost'
  depends_on 'mpfr'
  depends_on 'gmp'
  depends_on 'pcre'
  depends_on 'expat'
  depends_on 'cmake' if build.head?
  depends_on 'libofx' => :optional unless build.head?

  def install
    # find Homebrew's libpcre
    ENV.append 'LDFLAGS', "-L#{HOMEBREW_PREFIX}/lib"

    if build.head?
      args = [((build.include? 'debug') ? 'debug' : 'opt'), "make", "-j#{ENV.make_jobs}", "--output=build"]
      args << '--python' if build.include? 'python'
      system "./acprep", *args
      system "cmake", "-D", "CMAKE_INSTALL_PREFIX=#{prefix}", "-P", "build/cmake_install.cmake"
    else
      args = []
      if build.with? 'libofx'
        args << "--enable-ofx"
        # the libofx.h appears to have moved to a subdirectory
        ENV.append 'CXXFLAGS', "-I#{Formula.factory('libofx').opt_prefix}/include/libofx"
      end
      system "./configure", "--disable-debug", "--disable-dependency-tracking",
                            "--prefix=#{prefix}", *args
      system 'make'
      ENV.deparallelize
      system 'make install'
    end
  end
end