summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjasper <jasper@openbsd.org>2011-05-04 07:36:38 +0000
committerjasper <jasper@openbsd.org>2011-05-04 07:36:38 +0000
commitd63739902de54dbc9678324fa9ba54209e1b0c76 (patch)
tree27d160e021be66f17970d2a108c4f754d7b07ee9
parent- note that quotes may have to be escaped from the shell and add an example (diff)
downloadwireguard-openbsd-d63739902de54dbc9678324fa9ba54209e1b0c76.tar.xz
wireguard-openbsd-d63739902de54dbc9678324fa9ba54209e1b0c76.zip
Add a zlib.pc pkg-config file, based what newer zlibs ship.
tested by landry@ in a bulk. ok miod@ sthen@
-rw-r--r--lib/libz/Makefile12
-rw-r--r--lib/libz/generate_pkgconfig.sh54
2 files changed, 65 insertions, 1 deletions
diff --git a/lib/libz/Makefile b/lib/libz/Makefile
index a535babeb96..ef868e00d31 100644
--- a/lib/libz/Makefile
+++ b/lib/libz/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.14 2005/11/24 20:49:23 deraadt Exp $
+# $OpenBSD: Makefile,v 1.15 2011/05/04 07:36:38 jasper Exp $
LIB= z
WANTLINT=
@@ -38,6 +38,9 @@ MLINKS= compress.3 zlibVersion.3 compress.3 deflateInit.3 \
compress.3 crc32.3 compress.3 crc32_combine.3
CFLAGS+=-DHAVE_STRERROR -DHAVE_MEMCPY -DHAS_vsnprintf -DHAS_snprintf
+PC_FILES=zlib.pc
+CLEANFILES+=${PC_FILES}
+
includes:
@cd ${.CURDIR}; for i in $(HDRS); do \
j="cmp -s $$i ${DESTDIR}/usr/include/$$i || \
@@ -47,4 +50,11 @@ includes:
eval "$$j"; \
done
+beforeinstall:
+ /bin/sh ${.CURDIR}/generate_pkgconfig.sh -c ${.CURDIR} -o ${.OBJDIR}
+ [ -d ${DESTDIR}/usr/lib/pkgconfig/ ] || \
+ ${INSTALL} -o root -g ${SHAREGRP} -d ${DESTDIR}/usr/lib/pkgconfig/
+ ${INSTALL} ${INSTALL_COPY} -o root -g ${SHAREGRP} \
+ -m ${SHAREMODE} ${.OBJDIR}/${PC_FILES} ${DESTDIR}/usr/lib/pkgconfig/
+
.include <bsd.lib.mk>
diff --git a/lib/libz/generate_pkgconfig.sh b/lib/libz/generate_pkgconfig.sh
new file mode 100644
index 00000000000..1a50956094c
--- /dev/null
+++ b/lib/libz/generate_pkgconfig.sh
@@ -0,0 +1,54 @@
+#!/bin/sh
+#
+# $OpenBSD: generate_pkgconfig.sh,v 1.1 2011/05/04 07:36:38 jasper Exp $
+#
+# Generate pkg-config file for zlib.
+
+usage() {
+ echo "usage: ${0##*/} [-k] -c current_directory -o obj_directory"
+ exit 1
+}
+
+curdir=
+objdir=
+while getopts "c:ko:" flag; do
+ case "$flag" in
+ c)
+ curdir=$OPTARG
+ ;;
+ o)
+ objdir=$OPTARG
+ ;;
+ *)
+ usage
+ ;;
+ esac
+done
+
+[ -n "${curdir}" ] || usage
+if [ ! -d "${curdir}" ]; then
+ echo "${0##*/}: ${curdir}: not found"
+ exit 1
+fi
+[ -n "${objdir}" ] || usage
+if [ ! -w "${objdir}" ]; then
+ echo "${0##*/}: ${objdir}: not found or not writable"
+ exit 1
+fi
+
+zlib_version=$(sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < ${curdir}/zlib.h)
+
+pc_file="${objdir}/zlib.pc"
+cat > ${pc_file} << __EOF__
+prefix=/usr
+exec_prefix=\${prefix}
+libdir=\${exec_prefix}/lib
+includedir=\${prefix}/include
+
+Name: zlib
+Description: zlib compression library
+Version: ${zlib_version}
+Requires:
+Libs: -L\${libdir} -lz
+Cflags: -I\${includedir}
+__EOF__