Below is a first sketch for a patch (= works for me).
I’ve tried to solve it with an additional patch in debian/patches. The
library path, and the library name, description, and version are still
hard-coded in milter.pc, they would need to be substituted in from
somewhere. Perhaps it would be better to add a milter.pc.in in debian/
and process it with autoconf? But then how to include it in the sendmail
build?
This is swimming in deep water and I can’t swim. I have no experience
with Debian packaging (nor with the sendmail build system) and would
need guidance to proceed further with this.
diff --git a/debian/libmilter-dev.install b/debian/libmilter-dev.install
index d447297..5cad8e0 100644
--- a/debian/libmilter-dev.install
+++ b/debian/libmilter-dev.install
@@ -1,3 +1,4 @@
usr/include/libmilter/*.h
usr/lib/*/*.a
usr/lib/*/libmilter.so
+usr/lib/*/pkgconfig/milter.pc
diff --git a/debian/patches/pkgconfig.patch b/debian/patches/pkgconfig.patch
new file mode 100644
index 0000000..43b5e94
--- /dev/null
+++ b/debian/patches/pkgconfig.patch
@@ -0,0 +1,40 @@
+libmilter pkg-config metadata
+
+--- a/libmilter/Makefile.m4
++++ b/libmilter/Makefile.m4
+@@ -17,6 +17,7 @@ APPENDDEF(`confENVDEF', `-DNOT_SENDMAIL -Dsm_snprintf=snprintf')
+ define(`bldSOURCES', `main.c engine.c listener.c worker.c handler.c comm.c smfi.c signal.c sm_gethost.c monitor.c LIBMILTER_EXTRAS ')
+ define(`confBEFORE', `LIBMILTER_EXTRAS')
+ bldPUSH_INSTALL_TARGET(`install-mfapi')
++bldPUSH_INSTALL_TARGET(`install-pcfile')
+ bldPRODUCT_END
+
+ PUSHDIVERT(3)
+@@ -58,6 +59,11 @@ install-mfapi: ${MFAPI}
+ if [ ! -d ${DESTDIR}${INCLUDEDIR}/libmilter ]; then mkdir -p ${DESTDIR}${INCLUDEDIR}/libmilter; else :; fi
+ ${INSTALL} -c -o ${INCOWN} -g ${INCGRP} -m ${INCMODE} ${MFAPI} ${DESTDIR}${INCLUDEDIR}/libmilter/mfapi.h
+ ${INSTALL} -c -o ${INCOWN} -g ${INCGRP} -m ${INCMODE} ${MFDEF} ${DESTDIR}${INCLUDEDIR}/libmilter/mfdef.h
++# Install the pkg-config metadata file
++PCFILE= ${SRCDIR}/milter.pc
++install-pcfile: ${PCFILE}
++ if [ ! -d ${DESTDIR}${LIBDIR}/pkgconfig ]; then mkdir -p ${DESTDIR}${LIBDIR}/pkgconfig; else :; fi
++ ${INSTALL} -c -o ${INCOWN} -g ${INCGRP} -m ${INCMODE} ${PCFILE} ${DESTDIR}${LIBDIR}/pkgconfig/milter.pc
+ divert(0)
+
+ bldFINISH
+diff --git a/milter.pc b/milter.pc
+new file mode 100644
+index 0000000..59454fa
+--- /dev/null
++++ b/milter.pc
+@@ -0,0 +1,10 @@
++prefix=/usr
++exec_prefix=${prefix}
++libdir=${prefix}/lib/x86_64-linux-gnu
++includedir=${prefix}/include
++
++Name: milter
++Description: Sendmail Mail Filter API (Milter)
++Version: 1.0.1
++Libs: -L${libdir} -lmilter
++Cflags: -I${includedir}
diff --git a/debian/patches/series b/debian/patches/series
index 1042264..2d806b9 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -23,3 +23,4 @@ typos.patch
format-security.patch
openssl-1.1.0.patch
connect-from-null.patch
+pkgconfig.patch
Attachment:
signature.asc
Description: PGP signature