commit:     597ca18b003883f95d900778e9e1e191f425fcec
Author:     Erik Mackdanz <stasibear <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 25 17:39:28 2025 +0000
Commit:     Erik Mackdanz <stasibear <AT> gentoo <DOT> org>
CommitDate: Thu Dec 25 18:32:04 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=597ca18b

app-office/ledger: add 3.4.1

Signed-off-by: Erik Mackdanz <stasibear <AT> gentoo.org>

 app-office/ledger/Manifest            |   1 +
 app-office/ledger/files/cmake.patch   |  27 +++++++
 app-office/ledger/ledger-3.4.1.ebuild | 134 ++++++++++++++++++++++++++++++++++
 app-office/ledger/metadata.xml        |   3 +
 4 files changed, 165 insertions(+)

diff --git a/app-office/ledger/Manifest b/app-office/ledger/Manifest
index f9cd92662768..e4ffa5857e73 100644
--- a/app-office/ledger/Manifest
+++ b/app-office/ledger/Manifest
@@ -1 +1,2 @@
 DIST ledger-3.3.2.tar.gz 825274 BLAKE2B 
ee0901eaba234688cc36e399bd86118269d8691162feacf25e70ffaf28e8d572f47a62fb014126f5dce65c73135f21ad4364a642637a80d2577bf20b657fc9a4
 SHA512 
d5d7058f0e9a02ad1d46e6780675d446070824b321f0f4c1ea6ac0c3dd4f11f259113bc36cbc796e4bb6d0a7898d6a68a25cce639e27a2b2434eec11a612ecb0
+DIST ledger-3.4.1.tar.gz 817104 BLAKE2B 
3e895591b084a27b635fd5386d08d8b253d7215e7bab82ebf8ede2668b9994d3494458e703d671ec1125932398f1a8100df1d76fa41f0e058e079f86aca99d0c
 SHA512 
e6e3565e422d720d6d35cae17f334e9f66a969be96a8e6e99afcae31d25f34bfce6d55c516267d1d1d459f00b492cc606d7cd8493f9c5e8520cb460d45ac9fab

diff --git a/app-office/ledger/files/cmake.patch 
b/app-office/ledger/files/cmake.patch
new file mode 100644
index 000000000000..1c03cd373203
--- /dev/null
+++ b/app-office/ledger/files/cmake.patch
@@ -0,0 +1,27 @@
+--- a/CMakeLists.txt   2025-12-25 00:32:05.240264435 -0600
++++ b/CMakeLists.txt   2025-12-25 00:34:43.827778509 -0600
+@@ -232,14 +232,9 @@
+ 
+ find_req_library_and_header(GMP_PATH gmp.h GMP_LIB gmp)
+ if(GMP_PATH AND EXISTS "${GMP_PATH}/gmp.h")
+-  file(STRINGS "${GMP_PATH}/gmp.h" gmp_header_str REGEX "^#define[\t 
]+__GNU_MP_VERSION(_MINOR|_PATCHLEVEL)?[\t ]+[0-9]+")
+-  string(REGEX REPLACE ".*#define __GNU_MP_VERSION[\t ]+([0-9]+).*" "\\1" 
GMP_VERSION_MAJOR "${gmp_header_str}")
+-  string(REGEX REPLACE ".*#define __GNU_MP_VERSION_MINOR[\t ]+([0-9]+).*" 
"\\1" GMP_VERSION_MINOR "${gmp_header_str}")
+-  string(REGEX REPLACE ".*#define __GNU_MP_VERSION_PATCHLEVEL[\t 
]+([0-9]+).*" "\\1" GMP_VERSION_PATCH "${gmp_header_str}")
+-  unset(gmp_header_str)
+-  set(GMP_VERSION_STRING 
"${GMP_VERSION_MAJOR}.${GMP_VERSION_MINOR}.${GMP_VERSION_PATCH}")
++  execute_process(COMMAND pkg-config gmp --modversion OUTPUT_VARIABLE 
GMP_VERSION_STRING)
+   if("${GMP_VERSION_STRING}" VERSION_LESS ${Required_Gmp_Version})
+-    message(FATAL_ERROR "Ledger requires GMP version ${Expected_Gmp_Version} 
or greater, but only GMP version ${GMP_VERSION_STRING} was found")
++    message(FATAL_ERROR "Ledger requires GMP version ${Required_Gmp_Version} 
or greater, but only GMP version ${GMP_VERSION_STRING} was found")
+   endif()
+ endif()
+ 
+@@ -252,6 +247,6 @@
+   unset(mpfr_header_str)
+   set(MPFR_VERSION_STRING 
"${MPFR_VERSION_MAJOR}.${MPFR_VERSION_MINOR}.${MPFR_VERSION_PATCH}")
+   if("${MPFR_VERSION_STRING}" VERSION_LESS ${Required_Mpfr_Version})
+-    message(FATAL_ERROR "Ledger requires MPFR version 
${Expected_Mpfr_Version} or greater, but only MPFR version 
${MPFR_VERSION_STRING} was found")
++    message(FATAL_ERROR "Ledger requires MPFR version 
${Required_Mpfr_Version} or greater, but only MPFR version 
${MPFR_VERSION_STRING} was found")
+   endif()
+ endif()

diff --git a/app-office/ledger/ledger-3.4.1.ebuild 
b/app-office/ledger/ledger-3.4.1.ebuild
new file mode 100644
index 000000000000..e02a54ba77e6
--- /dev/null
+++ b/app-office/ledger/ledger-3.4.1.ebuild
@@ -0,0 +1,134 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{11,12,13,14} )
+CMAKE_REMOVE_MODULES_LIST=( FindPython Support )
+inherit bash-completion-r1 check-reqs cmake optfeature python-single-r1
+
+DESCRIPTION="Double-entry accounting system with a command-line reporting 
interface"
+HOMEPAGE="https://www.ledger-cli.org/";
+SRC_URI="https://github.com/${PN}/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86"
+IUSE="debug doc gpg python"
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+RESTRICT="test"
+
+CHECKREQS_MEMORY=8G
+
+RDEPEND="
+       dev-libs/boost:=[icu,python?]
+       dev-libs/gmp:0=
+       gpg? (
+               dev-cpp/gpgmepp
+       )
+       dev-libs/mpfr:0=
+       python? (
+               $(python_gen_cond_dep '
+                       dev-libs/boost:=[${PYTHON_USEDEP}]
+                       dev-python/cheetah3:=[${PYTHON_USEDEP}]
+               ')
+               ${PYTHON_DEPS}
+       )
+"
+DEPEND="${RDEPEND}
+       dev-libs/utfcpp
+       doc? (
+               app-text/texlive[extra]
+               sys-apps/texinfo
+               virtual/texi2dvi
+       )
+"
+
+pkg_pretend() {
+       if use python; then
+               check-reqs_pkg_pretend
+       fi
+}
+
+pkg_setup() {
+       if use python; then
+               check-reqs_pkg_setup
+               python-single-r1_pkg_setup
+       fi
+}
+
+src_prepare() {
+       # use system utfcpp
+       rm -r lib/utfcpp || die
+
+       # Fix a test of gmp's version
+       eapply "${FILESDIR}/cmake.patch"
+
+       cmake_src_prepare
+
+       # Want to type "info ledger" not "info ledger3"
+       sed -i -e 's/ledger3/ledger/g' \
+               doc/{CMakeLists.txt,ledger.1,ledger3.texi} test/CheckTexinfo.py 
\
+               tools/{cleanup.sh,gendocs.sh,prepare-commit-msg,spellcheck.sh} \
+               || die "Failed to update info file name in file contents"
+       mv doc/ledger{3,}.texi || die "Failed to rename info file name"
+
+       # Avoid conflicting ledger.html outputs when doc and python are enabled
+       sed -i -e 's/\${file_base}.html/\${file_base}.info.html/g' \
+               doc/CMakeLists.txt \
+               || die "Failed to update info HTML file name in file contents"
+
+       eapply_user
+}
+
+src_configure() {
+       local mycmakeargs=(
+               -DBUILD_DOCS="$(usex doc)"
+               -DBUILD_WEB_DOCS="$(usex doc)"
+               -DUSE_GPGME="$(usex gpg)"
+               -DUSE_PYTHON="$(usex python)"
+               -DCMAKE_INSTALL_DOCDIR="/usr/share/doc/${PF}"
+               -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON
+               -DCMAKE_BUILD_TYPE="$(usex debug Debug Release)"
+               -DUTFCPP_PATH="${ESYSROOT}/usr/include/utf8cpp"
+       )
+       if use python; then
+               mycmakeargs+=(
+                       -DPython_EXECUTABLE="${PYTHON}"
+                       -DPython_INCLUDE_DIR="$(python_get_includedir)"
+               )
+       fi
+
+       cmake_src_configure
+}
+
+src_compile() {
+       cmake_src_compile
+
+       use doc && cmake_src_compile doc
+}
+
+src_install() {
+       cmake_src_install
+
+       # Requires gnuplot
+       exeinto /usr/bin
+       doexe contrib/report
+
+       newbashcomp contrib/${PN}-completion.bash ${PN}
+}
+
+pkg_postinst() {
+       elog
+       elog "Vim support is released separately. See"
+       elog "https://github.com/ledger/vim-ledger";
+       optfeature_header \
+               "Install the following packages for additional features:"
+       optfeature "Emacs support" "app-emacs/ledger-mode"
+       optfeature "Plot visualization" "sci-visualization/gnuplot"
+       optfeature "Graph visualization" "media-gfx/graphviz"
+}
+
+# rainy day TODO:
+# - IUSE test

diff --git a/app-office/ledger/metadata.xml b/app-office/ledger/metadata.xml
index 03dba8c85241..a0b7ea2f6d91 100644
--- a/app-office/ledger/metadata.xml
+++ b/app-office/ledger/metadata.xml
@@ -4,6 +4,9 @@
   <maintainer type="person">
     <email>[email protected]</email>
   </maintainer>
+  <use>
+    <flag name="gpg">Enable support for encrypted journals</flag>
+  </use>
   <upstream>
     <remote-id type="github">ledger/ledger</remote-id>
   </upstream>

Reply via email to