diff options
author | Jasper Lievisse Adriaanse <jasper@cvs.openbsd.org> | 2010-12-28 14:30:51 +0000 |
---|---|---|
committer | Jasper Lievisse Adriaanse <jasper@cvs.openbsd.org> | 2010-12-28 14:30:51 +0000 |
commit | d96b0da289c78c8b6b24e771209044704022fb5d (patch) | |
tree | 02414c5c86817501ffbb168751a98623499ac8df /lib | |
parent | 7ce29d86a7d4bde6aae613fe7f81e74c885ab37a (diff) |
- generate and install pkg-config files for openssl, which more and more
projects depend on being present (e.g. various ports).
as discussed with various porters in a hungarian spa
help/feedback from ingo@ and also OK halex@
no objections from djm@
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libssl/Makefile | 20 | ||||
-rw-r--r-- | lib/libssl/generate_pkgconfig.sh | 103 |
2 files changed, 122 insertions, 1 deletions
diff --git a/lib/libssl/Makefile b/lib/libssl/Makefile index f3564729771..510bb0547f3 100644 --- a/lib/libssl/Makefile +++ b/lib/libssl/Makefile @@ -1,6 +1,11 @@ -# $OpenBSD: Makefile,v 1.14 2005/04/01 05:31:40 beck Exp $ +# $OpenBSD: Makefile,v 1.15 2010/12/28 14:30:50 jasper Exp $ + +.include <bsd.own.mk> # for KERBEROS5 SUBDIR=crypto ssl man +PC_FILES=openssl.pc libssl.pc libcrypto.pc + +CLEANFILES=${PC_FILES} distribution: ${INSTALL} ${INSTALL_COPY} -g ${BINGRP} -m 444 \ @@ -10,4 +15,17 @@ distribution: ${INSTALL} ${INSTALL_COPY} -g ${BINGRP} -m 444 \ ${.CURDIR}/x509v3.cnf ${DESTDIR}/etc/ssl/x509v3.cnf +beforeinstall: +.if (${KERBEROS5:L} == "yes") + /bin/sh ${.CURDIR}/generate_pkgconfig.sh -c ${.CURDIR} -o ${.OBJDIR} -k +.else + /bin/sh ${.CURDIR}/generate_pkgconfig.sh -c ${.CURDIR} -o ${.OBJDIR} +.endif + +.for p in ${PC_FILES} + ${INSTALL} ${INSTALL_COPY} -o root -g ${SHAREGRP} \ + -m ${SHAREMODE} ${.OBJDIR}/$p ${DESTDIR}/usr/lib/pkgconfig/ +.endfor + +.include <bsd.prog.mk> .include <bsd.subdir.mk> diff --git a/lib/libssl/generate_pkgconfig.sh b/lib/libssl/generate_pkgconfig.sh new file mode 100644 index 00000000000..912943dd551 --- /dev/null +++ b/lib/libssl/generate_pkgconfig.sh @@ -0,0 +1,103 @@ +#!/bin/sh +# +# $OpenBSD: generate_pkgconfig.sh,v 1.1 2010/12/28 14:30:50 jasper Exp $ +# +# Generate pkg-config files for OpenSSL. + +usage() { + echo "usage: ${0##*/} [-k] -c current_directory -o obj_directory" + exit 1 +} + +enable_krb5=false +curdir= +objdir= +while getopts "c:ko:" flag; do + case "$flag" in + c) + curdir=$OPTARG + ;; + k) + enable_krb5=true + ;; + o) + objdir=$OPTARG + ;; + *) + usage + ;; + esac +done + +[ -n "${curdir}" ] || usage +if [ ! -w "${curdir}" ]; then + echo "${0##*/}: ${curdir}: not found or not writable" + exit 1 +fi +[ -n "${objdir}" ] || usage +if [ ! -w "${objdir}" ]; then + echo "${0##*/}: ${objdir}: not found or not writable" + exit 1 +fi + +ssl_version=$(sed -nE 's/^#define[[:blank:]]+SHLIB_VERSION_NUMBER[[:blank:]]+"(.*)".*/\1/p' \ + ${curdir}/src/crypto/opensslv.h) + +pc_file="${objdir}/libcrypto.pc" +cat > ${pc_file} << __EOF__ +prefix=/usr +exec_prefix=\${prefix} +libdir=\${exec_prefix}/lib +includedir=\${prefix}/include + +Name: OpenSSL-libcrypto +Description: OpenSSL cryptography library +Version: ${ssl_version} +Requires: +__EOF__ +echo -n 'Libs: -L${libdir} -lcrypto ' >> ${pc_file} +${enable_krb5} && echo -n '-L/usr/kerberos/lib ' >> ${pc_file} +echo '-lz' >> ${pc_file} +echo -n 'Cflags: -I${includedir} ' >> ${pc_file} +${enable_krb5} && echo -n '-I/usr/kerberos/include' >> ${pc_file} +echo '' >> ${pc_file} + + +pc_file="${objdir}/libssl.pc" +cat > ${pc_file} << __EOF__ +prefix=/usr +exec_prefix=\${prefix} +libdir=\${exec_prefix}/lib +includedir=\${prefix}/include + +Name: OpenSSL +Description: Secure Sockets Layer and cryptography libraries +Version: ${ssl_version} +Requires: +__EOF__ +echo -n 'Libs: -L${libdir} -lssl -lcrypto ' >> ${pc_file} +${enable_krb5} && echo -n '-L/usr/kerberos/lib ' >> ${pc_file} +echo '-lz' >> ${pc_file} +echo -n 'Cflags: -I${includedir} ' >> ${pc_file} +${enable_krb5} && echo -n '-I/usr/kerberos/include' >> ${pc_file} +echo '' >> ${pc_file} + + +pc_file="${objdir}/openssl.pc" +cat > ${pc_file} << __EOF__ +prefix=/usr +exec_prefix=\${prefix} +libdir=\${exec_prefix}/lib +includedir=\${prefix}/include + +Name: OpenSSL +Description: Secure Sockets Layer and cryptography libraries and tools +Version: ${ssl_version} +Requires: +__EOF__ +echo -n 'Libs: -L${libdir} -lssl -lcrypto ' >> ${pc_file} +${enable_krb5} && echo -n '-L/usr/kerberos/lib ' >> ${pc_file} +echo '-lz' >> ${pc_file} +echo -n 'Cflags: -I${includedir} ' >> ${pc_file} +${enable_krb5} && echo -n '-I/usr/kerberos/include' >> ${pc_file} +echo '' >> ${pc_file} |