commit 4027860f6a5384fe60181d79337862bf53116bec
parent 5998352d2d2e6e37531548f8e986abae5ff8ef02
Author: Laslo Hunhold <dev@frign.de>
Date: Tue, 25 Oct 2022 15:35:30 +0200
Install a simple pkg-config-file if desired
This was requested by a few packagers and it doesn't hurt to add a bit
of metadata.
Signed-off-by: Laslo Hunhold <dev@frign.de>
Diffstat:
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
@@ -325,6 +325,7 @@ install: all
if [ "$(SOSYMLINK)" = "true" ]; then ln -sf "$(SONAME)" "$(DESTDIR)$(LIBPREFIX)/libgrapheme.so"; fi
cp -f grapheme.h "$(DESTDIR)$(INCPREFIX)"
if ! [ -z "$(LDCONFIG)" ]; then $(SHELL) -c "$(LDCONFIG)"; fi
+ if ! [ -z "$(PCPREFIX)" ]; then mkdir -p "$(DESTDIR)$(PCPREFIX)"; printf "Name: libgrapheme\nDescription: Unicode string library\nURL: https://libs.suckless.org/libgrapheme/\nVersion: $(VERSION)\nCflags: -I$(INCPREFIX)\nLibs: -L$(LIBPREFIX) -lgrapheme\n" > "$(DESTDIR)$(PCPREFIX)/libgrapheme.pc"; fi
uninstall:
for m in $(MAN3:=.3); do rm -f "$(DESTDIR)$(MANPREFIX)/man3/`basename $$m`"; done
@@ -336,6 +337,7 @@ uninstall:
if [ "$(SOSYMLINK)" = "true" ]; then rm -f "$(DESTDIR)$(LIBPREFIX)/libgrapheme.so"; fi
rm -f "$(DESTDIR)$(INCPREFIX)/grapheme.h"
if ! [ -z "$(LDCONFIG)" ]; then $(SHELL) -c "$(LDCONFIG)"; fi
+ if ! [ -z "$(PCPREFIX)" ]; then rm -f "$(DESTDIR)$(PCPREFIX)/libgrapheme.pc"; fi
clean:
rm -f $(BENCHMARK:=.o) benchmark/util.o $(BENCHMARK) $(GEN:=.h) $(GEN:=.o) gen/util.o $(GEN) $(SRC:=.o) src/util.o $(TEST:=.o) test/util.o $(TEST) libgrapheme.a $(SONAME) $(MAN3:=.3) $(MAN7:=.7)
diff --git a/config.mk b/config.mk
@@ -1,10 +1,12 @@
# Customize below to fit your system (run ./configure for automatic presets)
# paths
-PREFIX = /usr/local
+DESTDIR =
+PREFIX = /usr/local
INCPREFIX = $(PREFIX)/include
LIBPREFIX = $(PREFIX)/lib
MANPREFIX = $(PREFIX)/share/man
+PCPREFIX = $(LIBPREFIX)/pkgconfig # unset to not install a pkg-config-file
# flags
CPPFLAGS = -D_DEFAULT_SOURCE