summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <mdrake.unique@gmail.com>2018-11-01 21:09:16 +0000
committerSteven G. Johnson <stevenj@mit.edu>2018-11-01 17:09:16 -0400
commit5dcd38217a7d4351b6dbf18d1aa8aa21d7e5bec3 (patch)
tree167dd95adca6831da972ace2837e1a05be68604f
parentf17497653257858941d044ff3bbadbc9b095aa0c (diff)
downloadlibutf8proc-5dcd38217a7d4351b6dbf18d1aa8aa21d7e5bec3.tar.gz
libutf8proc-5dcd38217a7d4351b6dbf18d1aa8aa21d7e5bec3.tar.bz2
Generate and install a pkg-config file. (#142)
* Generate and install a pkg-config file. * Use Makefile libdir and includedir for pkg-config. This splits the prefix out from these variables, so that the same variables can be used to construct the pkg-config file. * Update the manifest for installation of pkg-config file. * Revert "Use Makefile libdir and includedir for pkg-config." This reverts commit a4cd6dc64a357dd5b91781045b3ac1c4679af97f. * Use Makefile libdir and includedir for pkg-config. This splits the prefix out from these variables, so that the same variables can be used to construct the pkg-config file.
-rw-r--r--MANIFEST2
-rw-r--r--Makefile17
-rw-r--r--libutf8proc.pc.in10
3 files changed, 28 insertions, 1 deletions
diff --git a/MANIFEST b/MANIFEST
index 9396825..cb9bf82 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -5,3 +5,5 @@ lib/libutf8proc.a
lib/libutf8proc.so -> libutf8proc.so.2.2.0
lib/libutf8proc.so.2 -> libutf8proc.so.2.2.0
lib/libutf8proc.so.2.2.0
+lib/pkgconfig/
+lib/pkgconfig/libutf8proc.pc
diff --git a/Makefile b/Makefile
index b03d94f..639ff1f 100644
--- a/Makefile
+++ b/Makefile
@@ -36,6 +36,10 @@ endif
prefix=/usr/local
libdir=$(prefix)/lib
includedir=$(prefix)/include
+pkgconfigdir=$(libdir)/pkgconfig
+
+pkglibdir=$(libdir:$(prefix)/%=%)
+pkgincludedir=$(includedir:$(prefix)/%=%)
# meta targets
@@ -45,6 +49,7 @@ all: libutf8proc.a libutf8proc.$(SHLIB_EXT)
clean:
rm -f utf8proc.o libutf8proc.a libutf8proc.$(SHLIB_VERS_EXT) libutf8proc.$(SHLIB_EXT)
+ rm -f libutf8proc.pc
ifneq ($(OS),Darwin)
rm -f libutf8proc.so.$(MAJOR)
endif
@@ -86,12 +91,22 @@ libutf8proc.$(MAJOR).dylib: utf8proc.o
libutf8proc.dylib: libutf8proc.$(MAJOR).dylib
ln -f -s libutf8proc.$(MAJOR).dylib $@
-install: libutf8proc.a libutf8proc.$(SHLIB_EXT) libutf8proc.$(SHLIB_VERS_EXT)
+libutf8proc.pc: libutf8proc.pc.in
+ sed \
+ -e 's#PREFIX#$(prefix)#' \
+ -e 's#LIBDIR#$(pkglibdir)#' \
+ -e 's#INCLUDEDIR#$(pkgincludedir)#' \
+ -e 's#VERSION#$(MAJOR).$(MINOR).$(PATCH)#' \
+ libutf8proc.pc.in > libutf8proc.pc
+
+install: libutf8proc.a libutf8proc.$(SHLIB_EXT) libutf8proc.$(SHLIB_VERS_EXT) libutf8proc.pc
mkdir -m 755 -p $(DESTDIR)$(includedir)
$(INSTALL) -m 644 utf8proc.h $(DESTDIR)$(includedir)
mkdir -m 755 -p $(DESTDIR)$(libdir)
$(INSTALL) -m 644 libutf8proc.a $(DESTDIR)$(libdir)
$(INSTALL) -m 755 libutf8proc.$(SHLIB_VERS_EXT) $(DESTDIR)$(libdir)
+ mkdir -m 755 -p $(DESTDIR)$(pkgconfigdir)
+ $(INSTALL) -m 644 libutf8proc.pc $(DESTDIR)$(pkgconfigdir)/libutf8proc.pc
ln -f -s libutf8proc.$(SHLIB_VERS_EXT) $(DESTDIR)$(libdir)/libutf8proc.$(SHLIB_EXT)
ifneq ($(OS),Darwin)
ln -f -s libutf8proc.$(SHLIB_VERS_EXT) $(DESTDIR)$(libdir)/libutf8proc.so.$(MAJOR)
diff --git a/libutf8proc.pc.in b/libutf8proc.pc.in
new file mode 100644
index 0000000..820b43f
--- /dev/null
+++ b/libutf8proc.pc.in
@@ -0,0 +1,10 @@
+prefix=PREFIX
+exec_prefix=${prefix}
+libdir=${prefix}/LIBDIR
+includedir=${prefix}/INCLUDEDIR
+
+Name: libutf8proc
+Description: UTF8 processing
+Version: VERSION
+Libs: -L${libdir} -lutf8proc
+Cflags: -I${includedir} -DUTF8PROC_EXPORTS