commit:     a6e1b412888cee4ff5b0a04211f8f87277468664
Author:     Florian Schmaus <flow <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 28 19:13:14 2024 +0000
Commit:     Florian Schmaus <flow <AT> gentoo <DOT> org>
CommitDate: Wed Feb 28 19:24:48 2024 +0000
URL:        https://gitweb.gentoo.org/proj/tex-overlay.git/commit/?id=a6e1b412

dev-texlive/texlive-humanities: conditionally make and patch to respect flags

Closes: https://bugs.gentoo.org/925704
Closes: https://bugs.gentoo.org/925710
Closes: https://bugs.gentoo.org/925711
Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>

 ...bible-improve-Makefile-respect-user-flags.patch | 60 ++++++++++++++++++++++
 .../texlive-humanities-2023_p68465.ebuild          | 17 +++++-
 2 files changed, 75 insertions(+), 2 deletions(-)

diff --git 
a/dev-texlive/texlive-humanities/files/texlive-humanities-2023-opbible-improve-Makefile-respect-user-flags.patch
 
b/dev-texlive/texlive-humanities/files/texlive-humanities-2023-opbible-improve-Makefile-respect-user-flags.patch
new file mode 100644
index 0000000..462965d
--- /dev/null
+++ 
b/dev-texlive/texlive-humanities/files/texlive-humanities-2023-opbible-improve-Makefile-respect-user-flags.patch
@@ -0,0 +1,60 @@
+From 34552399a8de874344ae095cd5533232449ccc0a Mon Sep 17 00:00:00 2001
+From: Florian Schmaus <[email protected]>
+Date: Wed, 28 Feb 2024 20:03:49 +0100
+Subject: [PATCH] opbible: improve Makefile, respect user's CXX, C(P|XX)FLAGS,
+ and LDFLAGS
+
+Make the Makefile respect the user's CXX, C(P|XX)FLAGS, and LDFLAGS by
+either using GNU Make's implicit rules or by appending instead of
+overriding the CXXFLAGS variable. This also has the nice advantage
+that the Makefile becomes more idiomatic and shorter.
+
+The Makefile not respecting user variables was initially report by
+Gentoo's CI and the following two downstream bugs:
+- https://bugs.gentoo.org/925710
+- https://bugs.gentoo.org/925711
+--- a/texmf-dist/doc/luatex/opbible/txs-gen/Makefile
++++ b/texmf-dist/doc/luatex/opbible/txs-gen/Makefile
+@@ -5,35 +5,19 @@
+ 
+ ## definitions
+ 
+-CXX = g++
+-LD = g++
+-LIBS = -lsword
+-LDFLAGS = $(LIBS)
+-CXXFLAGS = -I/usr/include/sword
++LDLIBS = -lsword
+ 
+-target = mod2tex
+-objects = mod2tex.o
++CXXFLAGS += -I/usr/include/sword
+ 
+ ## static rules
+ 
+ .PHONY : all
+ 
+-all : $(target)
+-
+-$(target) : $(objects)
+-      $(LD) -o $@ $< $(LDFLAGS)
+-
+-$(objects) : %.o: %.cpp
+-      $(CXX) -c $(CXXFLAGS) -o $@ $<
++all : mod2tex
+ 
+ .PHONY : clean
+ 
+ clean :
+-      -rm -f *~ $(objects) $(target)
+-
+-## pattern rules
+-
+-%.o : %.cpp
+-      $(CXX) -c $(CFLAGS) $(CXXFLAGS) -o $@ $<
++      -rm -f *~ mod2tex
+ 
+ ### Makefile ends here
+-- 
+2.43.0
+

diff --git 
a/dev-texlive/texlive-humanities/texlive-humanities-2023_p68465.ebuild 
b/dev-texlive/texlive-humanities/texlive-humanities-2023_p68465.ebuild
index 57857b8..34caf32 100644
--- a/dev-texlive/texlive-humanities/texlive-humanities-2023_p68465.ebuild
+++ b/dev-texlive/texlive-humanities/texlive-humanities-2023_p68465.ebuild
@@ -156,7 +156,7 @@ SLOT="0"
 KEYWORDS="~amd64 ~arm64 ~ppc ~riscv ~x86"
 COMMON_DEPEND="
        >=dev-texlive/texlive-latex-2023
-       app-text/sword
+       doc? ( app-text/sword )
 "
 RDEPEND="
        ${COMMON_DEPEND}
@@ -169,8 +169,21 @@ TEXLIVE_MODULE_BINSCRIPTS="
        texmf-dist/scripts/diadia/diadia.lua
 "
 
+src_prepare() {
+       default
+
+       if use doc; then
+               # https://github.com/olsak/OpBible/pull/1
+               eapply 
"${FILESDIR}"/${PN}-2023-opbible-improve-Makefile-respect-user-flags.patch
+               # Remove the binary, so that it is rebuild.
+               rm texmf-dist/doc/luatex/opbible/txs-gen/mod2tex || die
+       fi
+}
+
 src_compile() {
-       emake -C texmf-dist/doc/luatex/opbible/txs-gen
+       if use doc; then
+               emake -C texmf-dist/doc/luatex/opbible/txs-gen
+       fi
 
        texlive-module_src_compile
 }

Reply via email to