~sircmpwn/gmni-devel

gmni: Patches to make a Gentoo packager's life easier v1 PROPOSED

For now I included these patches in my Gentoo ebuild tree, but maybe
you're interested in upstreaming them. If not ddevault, maybe the next
maintainer.

Midgard (2):
  Add option to enable or disable man explicitly
  Honour DESTDIR for packagers

 Makefile  | 36 ++++++++++++++++++------------------
 config.sh | 24 +++++++++++++++++++-----
 2 files changed, 37 insertions(+), 23 deletions(-)

-- 
2.38.5
Important: please disregard these lines:

+		*)
+			echo "Unrecognized argument '$arg'"
+			exit 1
+			;;

They ended up in the patch by accident.
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/gmni-devel/patches/44301/mbox | git am -3
Learn more about email & git

[PATCH gmni 1/2] Add option to enable or disable man explicitly Export this patch

From: Midgard <midgard@git.sr.ht>

This is desired for packaging in Gentoo.
---
Rationale: for packaging, it's not desirable to rely on autodetection of
installed tools. We want the "man" USE flag to reliably control whether
man pages are built or not. The USE flag also controls whether the
package depends on scdoc at built-time or not.

 config.sh | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/config.sh b/config.sh
index 8c3ac4b..a952ff1 100644
--- a/config.sh
+++ b/config.sh
@@ -6,6 +6,7 @@ CC=${CC:-cc}
CFLAGS=${CFLAGS:-}
LD=${LD:-ld}
SCDOC=${SCDOC:-scdoc}
man=auto

for arg
do
@@ -22,6 +23,13 @@ do
		--prefix=*)
			PREFIX=${arg#*=}
			;;
		--man=enable|--man=disable|--man=auto)
			man=${arg#*=}
			;;
		*)
			echo "Unrecognized argument '$arg'"
			exit 1
			;;
	esac
done

@@ -121,7 +129,9 @@ run_configure() {
	LIBS="$LIBS -lbearssl"

	printf "Checking for scdoc... "
	if scdoc -v >/dev/null 2>&1
	if [ $man = disable ]; then
		echo disabled
	elif scdoc -v >/dev/null 2>&1
	then
		echo yes
		all="$all docs"
@@ -131,6 +141,10 @@ run_configure() {
	install -m644 doc/gmnlm.1 \$(MANDIR)/man1/gmnlm.1"
	else
		echo no
		if [ $man = enable ]; then
			echo "--enable-man but scdoc not found"
			exit 1
		fi
	fi

	printf "Creating $outdir/config.mk... "
-- 
2.38.5

[PATCH gmni 2/2] Honour DESTDIR for packagers Export this patch

From: Midgard <midgard@git.sr.ht>

---
Rationale: DESTDIR was malfunctioning during packaging.

 Makefile  | 36 ++++++++++++++++++------------------
 config.sh |  8 ++++----
 2 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/Makefile b/Makefile
index f9e3fe5..8138562 100644
--- a/Makefile
+++ b/Makefile
@@ -55,25 +55,25 @@ distclean: clean
	@rm -rf "$(OUTDIR)"

install: all install_docs
	mkdir -p $(BINDIR)
	mkdir -p $(LIBDIR)
	mkdir -p $(INCLUDEDIR)/gmni
	mkdir -p $(LIBDIR)/pkgconfig
	install -m755 gmni $(BINDIR)/gmni
	install -m755 gmnlm $(BINDIR)/gmnlm
	install -m644 libgmni.a $(LIBDIR)/libgmni.a
	install -m644 include/gmni/gmni.h $(INCLUDEDIR)/gmni/gmni.h
	install -m644 include/gmni/tofu.h $(INCLUDEDIR)/gmni/tofu.h
	install -m644 include/gmni/url.h $(INCLUDEDIR)/gmni/url.h
	install -m644 libgmni.pc $(LIBDIR)/pkgconfig/libgmni.pc
	mkdir -p $(DESTDIR)$(BINDIR)
	mkdir -p $(DESTDIR)$(LIBDIR)
	mkdir -p $(DESTDIR)$(INCLUDEDIR)/gmni
	mkdir -p $(DESTDIR)$(LIBDIR)/pkgconfig
	install -m755 gmni $(DESTDIR)$(BINDIR)/gmni
	install -m755 gmnlm $(DESTDIR)$(BINDIR)/gmnlm
	install -m644 libgmni.a $(DESTDIR)$(LIBDIR)/libgmni.a
	install -m644 include/gmni/gmni.h $(DESTDIR)$(INCLUDEDIR)/gmni/gmni.h
	install -m644 include/gmni/tofu.h $(DESTDIR)$(INCLUDEDIR)/gmni/tofu.h
	install -m644 include/gmni/url.h $(DESTDIR)$(INCLUDEDIR)/gmni/url.h
	install -m644 libgmni.pc $(DESTDIR)$(LIBDIR)/pkgconfig/libgmni.pc

uninstall:
	rm -f $(BINDIR)/gmni
	rm -f $(BINDIR)/gmnlm
	rm -f $(LIBDIR)/libgmni.a
	rm -rf $(INCLUDEDIR)/gmni
	rm -f $(LIBDIR)/pkgconfig/libgmni.pc
	rm -f $(MANDIR)/man1/gmni.1
	rm -f $(MANDIR)/man1/gmnlm.1
	rm -f $(DESTDIR)$(BINDIR)/gmni
	rm -f $(DESTDIR)$(BINDIR)/gmnlm
	rm -f $(DESTDIR)$(LIBDIR)/libgmni.a
	rm -rf $(DESTDIR)$(INCLUDEDIR)/gmni
	rm -f $(DESTDIR)$(LIBDIR)/pkgconfig/libgmni.pc
	rm -f $(DESTDIR)$(MANDIR)/man1/gmni.1
	rm -f $(DESTDIR)$(MANDIR)/man1/gmnlm.1

.PHONY: clean distclean docs install
diff --git a/config.sh b/config.sh
index a952ff1..6b82985 100644
--- a/config.sh
+++ b/config.sh
@@ -136,9 +136,9 @@ run_configure() {
		echo yes
		all="$all docs"
		install_docs="
	mkdir -p \$(MANDIR)/man1
	install -m644 doc/gmni.1 \$(MANDIR)/man1/gmni.1
	install -m644 doc/gmnlm.1 \$(MANDIR)/man1/gmnlm.1"
	mkdir -p \$(DESTDIR)\$(MANDIR)/man1
	install -m644 doc/gmni.1 \$(DESTDIR)\$(MANDIR)/man1/gmni.1
	install -m644 doc/gmnlm.1 \$(DESTDIR)\$(MANDIR)/man1/gmnlm.1"
	else
		echo no
		if [ $man = enable ]; then
@@ -154,7 +154,7 @@ run_configure() {
	LIBS=$LIBS
	PREFIX=${PREFIX:-/usr/local}
	OUTDIR=${outdir}
	_INSTDIR=\$(DESTDIR)\$(PREFIX)
	_INSTDIR=\$(PREFIX)
	BINDIR?=${BINDIR:-\$(_INSTDIR)/bin}
	LIBDIR?=${LIBDIR:-\$(_INSTDIR)/lib}
	INCLUDEDIR?=${INCLUDEDIR:-\$(_INSTDIR)/include}
-- 
2.38.5
Important: please disregard these lines:

+		*)
+			echo "Unrecognized argument '$arg'"
+			exit 1
+			;;

They ended up in the patch by accident.