homebrew-core/Formula/ledger.rb

75 lines
2.5 KiB
Ruby

class Ledger < Formula
desc "Command-line, double-entry accounting tool"
homepage "https://ledger-cli.org/"
url "https://github.com/ledger/ledger/archive/v3.2.1.tar.gz"
sha256 "92bf09bc385b171987f456fe3ee9fa998ed5e40b97b3acdd562b663aa364384a"
license "BSD-3-Clause"
revision 6
head "https://github.com/ledger/ledger.git"
livecheck do
url :stable
regex(/^v?(\d+(?:\.\d+)+)$/i)
end
bottle do
sha256 cellar: :any, arm64_big_sur: "7c4c05ee4ba9fa1eb98e13dd8fdb08204847051d60235d7ed41acb511bc59e88"
sha256 cellar: :any, big_sur: "b38e4088c5c4639db36583dee90969851ce3a6dd697542f40c35c4fd4a26ba63"
sha256 cellar: :any, catalina: "4bf9603c5db081f8264ab20d48f5b3b7c00760032a69da857be8412c8fc7f538"
sha256 cellar: :any, mojave: "73e2a88b71ad45ce03bb552889c615f552415332e5602711608a0a3aead94c8e"
sha256 cellar: :any_skip_relocation, x86_64_linux: "2900cd872e239fe43409bbe4e07546897f1785e56f91059edfafcbef118c2c07"
end
depends_on "cmake" => :build
depends_on "boost"
depends_on "gmp"
depends_on "mpfr"
depends_on "python@3.9"
uses_from_macos "groff"
# Compatibility with Boost 1.76
# https://github.com/ledger/ledger/issues/2030
# https://github.com/ledger/ledger/pull/2036
patch do
url "https://github.com/ledger/ledger/commit/e60717ccd78077fe4635315cb2657d1a7f539fca.patch?full_index=1"
sha256 "edba1dd7bde707f510450db3197922a77102d5361ed7a5283eb546fbf2221495"
end
def install
ENV.cxx11
ENV.prepend_path "PATH", Formula["python@3.9"].opt_libexec/"bin"
args = %W[
--jobs=#{ENV.make_jobs}
--output=build
--prefix=#{prefix}
--boost=#{Formula["boost"].opt_prefix}
--
-DBUILD_DOCS=1
-DBUILD_WEB_DOCS=1
-DBoost_NO_BOOST_CMAKE=ON
-DPython_FIND_VERSION_MAJOR=3
] + std_cmake_args
system "./acprep", "opt", "make", *args
system "./acprep", "opt", "make", "doc", *args
system "./acprep", "opt", "make", "install", *args
(pkgshare/"examples").install Dir["test/input/*.dat"]
pkgshare.install "contrib"
elisp.install Dir["lisp/*.el", "lisp/*.elc"]
bash_completion.install pkgshare/"contrib/ledger-completion.bash"
end
test do
balance = testpath/"output"
system bin/"ledger",
"--args-only",
"--file", "#{pkgshare}/examples/sample.dat",
"--output", balance,
"balance", "--collapse", "equity"
assert_equal " $-2,500.00 Equity", balance.read.chomp
assert_equal 0, $CHILD_STATUS.exitstatus
end
end