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-03-10 13:27:18 +00:00
|
|
|
url 'https://github.com/ledger/ledger/archive/v3.0.1.tar.gz'
|
|
|
|
sha1 'cb0891f4770a33ba5cdbd6693b400ec0ff0b81da'
|
|
|
|
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-03-10 13:27:18 +00:00
|
|
|
depends_on 'gettext'
|
2013-09-22 01:47:07 +00:00
|
|
|
depends_on 'boost'
|
2014-03-10 13:27:18 +00:00
|
|
|
depends_on 'mpfr'
|
2013-09-22 01:47:07 +00:00
|
|
|
depends_on 'gmp'
|
|
|
|
depends_on :python => :optional
|
2014-03-10 13:27:18 +00:00
|
|
|
depends_on 'cmake' => :build
|
|
|
|
depends_on 'ninja' => :build
|
2013-09-22 01:47:07 +00:00
|
|
|
|
2010-03-13 09:10:05 +00:00
|
|
|
def install
|
2014-03-10 13:27:18 +00:00
|
|
|
(buildpath/'lib/utfcpp').install resource('utfcpp')
|
|
|
|
|
|
|
|
# Support homebrew not at /usr/local. Also support Xcode-only setups:
|
|
|
|
inreplace 'acprep', 'search_prefixes = [', "search_prefixes = ['#{HOMEBREW_PREFIX}','#{MacOS.sdk_path}/usr',"
|
|
|
|
args = [((build.include? 'debug') ? 'debug' : 'opt'), "make", "install", "-N", "-j#{ENV.make_jobs}", "--output=build"]
|
|
|
|
|
|
|
|
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
|
|
|
|
args << '--python' << '--'
|
|
|
|
|
|
|
|
python_prefix = `python-config --prefix`.strip
|
|
|
|
args << "-DPYTHON_LIBRARY='#{python_prefix}/Python'"
|
|
|
|
args << "-DPYTHON_INCLUDE_DIR='#{python_prefix}/Headers'"
|
|
|
|
end
|
2014-02-28 16:49:38 +00:00
|
|
|
|
2014-03-10 13:27:18 +00:00
|
|
|
system "./acprep", "--prefix=#{prefix}", *args
|
|
|
|
(share+'ledger/examples').install Dir['test/input/*.dat']
|
|
|
|
(share+'ledger').install 'contrib'
|
|
|
|
if build.with? 'python'
|
|
|
|
(share+'ledger').install 'python/demo.py'
|
2014-01-30 08:43:15 +00:00
|
|
|
end
|
|
|
|
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
|