2010-03-13 09:10:05 +00:00
|
|
|
require 'formula'
|
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Ledger < Formula
|
2012-02-24 22:51:33 +00:00
|
|
|
homepage 'http://ledger-cli.org'
|
2014-06-05 20:57:58 +00:00
|
|
|
url 'https://github.com/ledger/ledger/archive/v3.0.2.tar.gz'
|
|
|
|
sha1 '0a204c3ec95fdaf4a0e45c4fcfd77a0ec6fd4ac4'
|
2014-03-10 13:27:18 +00:00
|
|
|
head 'https://github.com/ledger/ledger.git', :branch => 'master'
|
2012-02-24 22:51:33 +00:00
|
|
|
|
2014-03-27 11:05:06 +00:00
|
|
|
bottle do
|
|
|
|
sha1 "700ac683623689a4086afaa64340609a8fdd53d1" => :mavericks
|
|
|
|
sha1 "c9dd5c87767ed914f1631c4d3095d97a91a005a6" => :mountain_lion
|
|
|
|
sha1 "4e0ec05ccbf893ea1e1d482253c972e0472267e4" => :lion
|
|
|
|
end
|
|
|
|
|
2014-03-10 13:27:18 +00:00
|
|
|
resource 'utfcpp' do
|
|
|
|
url "http://downloads.sourceforge.net/project/utfcpp/utf8cpp_2x/Release%202.3.4/utf8_v2_3_4.zip"
|
|
|
|
sha1 "638910adb69e4336f5a69c338abeeea88e9211ca"
|
2013-09-22 01:47:07 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
option 'debug', 'Build with debugging symbols enabled'
|
|
|
|
|
2014-06-05 22:35:30 +00:00
|
|
|
depends_on "cmake" => :build
|
|
|
|
depends_on "ninja" => :build
|
|
|
|
depends_on "mpfr"
|
|
|
|
depends_on "gmp"
|
2013-09-22 01:47:07 +00:00
|
|
|
depends_on :python => :optional
|
2014-06-05 22:35:30 +00:00
|
|
|
|
|
|
|
if build.with? "python"
|
|
|
|
depends_on "boost" => "with-python"
|
|
|
|
else
|
|
|
|
depends_on "boost"
|
|
|
|
end
|
2013-09-22 01:47:07 +00:00
|
|
|
|
2014-06-05 20:57:58 +00:00
|
|
|
needs :cxx11
|
|
|
|
|
2010-03-13 09:10:05 +00:00
|
|
|
def install
|
2014-06-05 20:57:58 +00:00
|
|
|
ENV.cxx11
|
|
|
|
|
2014-03-10 13:27:18 +00:00
|
|
|
(buildpath/'lib/utfcpp').install resource('utfcpp')
|
|
|
|
|
2014-06-05 21:36:23 +00:00
|
|
|
flavor = build.include?("debug") ? "debug" : "opt"
|
|
|
|
|
|
|
|
args = %W[
|
|
|
|
--prefix=#{prefix}
|
|
|
|
#{flavor} make install -N -j#{ENV.make_jobs}
|
|
|
|
--output=build
|
|
|
|
--boost=#{Formula["boost"].opt_prefix}
|
|
|
|
]
|
2014-03-10 13:27:18 +00:00
|
|
|
|
|
|
|
if build.with? 'python'
|
|
|
|
# Per #25118, CMake does a poor job of detecting a brewed Python.
|
|
|
|
# We need to tell CMake explicitly where our default python lives.
|
|
|
|
# Inspired by
|
|
|
|
# https://github.com/Homebrew/homebrew/blob/51d054c/Library/Formula/opencv.rb
|
2014-06-05 22:35:30 +00:00
|
|
|
args << "--python" << "--"
|
2014-03-10 13:27:18 +00:00
|
|
|
python_prefix = `python-config --prefix`.strip
|
2014-06-05 22:35:30 +00:00
|
|
|
args << "-DPYTHON_LIBRARY=#{python_prefix}/Python"
|
|
|
|
args << "-DPYTHON_INCLUDE_DIR=#{python_prefix}/Headers"
|
2014-03-10 13:27:18 +00:00
|
|
|
end
|
2014-02-28 16:49:38 +00:00
|
|
|
|
2014-06-05 21:36:23 +00:00
|
|
|
system "./acprep", *args
|
2014-03-10 13:27:18 +00:00
|
|
|
(share+'ledger/examples').install Dir['test/input/*.dat']
|
|
|
|
(share+'ledger').install 'contrib'
|
2014-06-05 22:35:30 +00:00
|
|
|
(share+"ledger").install "python/demo.py" if build.with? "python"
|
2014-01-30 08:43:15 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
2014-03-10 13:27:18 +00:00
|
|
|
output = `#{bin}/ledger --file #{share}/ledger/examples/sample.dat balance --collapse equity`
|
2014-01-30 08:43:15 +00:00
|
|
|
assert_equal ' $-2,500.00 Equity', output.split(/\n/)[0]
|
|
|
|
assert_equal 0, $?.exitstatus
|
|
|
|
|
2014-03-10 13:27:18 +00:00
|
|
|
if build.with? 'python'
|
2014-01-30 08:43:15 +00:00
|
|
|
system "python", "#{share}/ledger/demo.py"
|
2010-03-13 09:10:05 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|