Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
ananthakumaran committed Aug 26, 2024
1 parent a4f52d7 commit 4ea4cb6
Showing 1 changed file with 39 additions and 9 deletions.
48 changes: 39 additions & 9 deletions ledger.rb
Original file line number Diff line number Diff line change
@@ -1,34 +1,54 @@
class Ledger < Formula
desc "Command-line, double-entry accounting tool"
homepage "https://ledger-cli.org/"
url "https://github.com/ledger/ledger/archive/v3.3.2.tar.gz"
sha256 "555296ee1e870ff04e2356676977dcf55ebab5ad79126667bc56464cb1142035"
license "BSD-3-Clause"
revision 1
revision 6
head "https://github.com/ledger/ledger.git", branch: "master"

stable do
url "https://github.com/ledger/ledger/archive/refs/tags/v3.3.2.tar.gz"
sha256 "555296ee1e870ff04e2356676977dcf55ebab5ad79126667bc56464cb1142035"

# Support building with mandoc
# Remove with v3.4.x
patch do
url "https://github.com/ledger/ledger/commit/f40cee6c3af4c9cec05adf520fc7077a45060434.patch?full_index=1"
sha256 "d5be89dbadff7e564a750c10cdb04b83e875452071a2115dd70aae6e7a8ee76c"
end
patch do
url "https://github.com/ledger/ledger/commit/14b90d8d952b40e0a474223e7f74a1e6505d5450.patch?full_index=1"
sha256 "d250557e385163e3ad3002117ebe985af040d915aab49ae1ea342db82398aeda"
end

# Backport fix to build with `boost` 1.85.0
patch do
url "https://github.com/ledger/ledger/commit/46207852174feb5c76c7ab894bc13b4f388bf501.patch?full_index=1"
sha256 "8aaf8daf4748f359946c64488c96345f4a4bdf928f6ec7a1003610174428599f"
end
end

livecheck do
url :stable
regex(/^v?(\d+(?:\.\d+)+)$/i)
end

depends_on "boost"
depends_on "boost@1.85"
depends_on "gmp"
depends_on "mpfr"
depends_on "python@3.11" => :build
depends_on "python@3.12" => :build
depends_on "cmake" => :build

patch :DATA

def install
ENV.cxx11
ENV.prepend_path "PATH", Formula["python@3.11"].opt_libexec/"bin"
ENV.prepend_path "PATH", Formula["python@3.12"].opt_libexec/"bin"

args = %W[
--jobs=#{ENV.make_jobs}
--output=build
--prefix=#{prefix}
--boost=#{Formula["boost"].opt_prefix}
--boost=#{Formula["boost@1.85"].opt_prefix}
--
-DCMAKE_FIND_LIBRARY_SUFFIXES=.a
-DBUILD_SHARED_LIBS:BOOL=OFF
Expand All @@ -39,9 +59,19 @@ def install
-DBUILD_LIBRARY:BOOL=OFF
-DBoost_USE_STATIC_LIBS:BOOL=ON
] + std_cmake_args
system "./acprep", "make", *args
system "./acprep", "make", "install", *args

system "./acprep", "opt", "make", *args
system "./acprep", "opt", "make", "install", *args
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
end
end

Expand Down

0 comments on commit 4ea4cb6

Please sign in to comment.