diff options
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/libssl/Makefile | 20 | ||||
| -rw-r--r-- | src/lib/libssl/generate_pkgconfig.sh | 103 |
2 files changed, 122 insertions, 1 deletions
diff --git a/src/lib/libssl/Makefile b/src/lib/libssl/Makefile index f356472977..510bb0547f 100644 --- a/src/lib/libssl/Makefile +++ b/src/lib/libssl/Makefile | |||
| @@ -1,6 +1,11 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.14 2005/04/01 05:31:40 beck Exp $ | 1 | # $OpenBSD: Makefile,v 1.15 2010/12/28 14:30:50 jasper Exp $ |
| 2 | |||
| 3 | .include <bsd.own.mk> # for KERBEROS5 | ||
| 2 | 4 | ||
| 3 | SUBDIR=crypto ssl man | 5 | SUBDIR=crypto ssl man |
| 6 | PC_FILES=openssl.pc libssl.pc libcrypto.pc | ||
| 7 | |||
| 8 | CLEANFILES=${PC_FILES} | ||
| 4 | 9 | ||
| 5 | distribution: | 10 | distribution: |
| 6 | ${INSTALL} ${INSTALL_COPY} -g ${BINGRP} -m 444 \ | 11 | ${INSTALL} ${INSTALL_COPY} -g ${BINGRP} -m 444 \ |
| @@ -10,4 +15,17 @@ distribution: | |||
| 10 | ${INSTALL} ${INSTALL_COPY} -g ${BINGRP} -m 444 \ | 15 | ${INSTALL} ${INSTALL_COPY} -g ${BINGRP} -m 444 \ |
| 11 | ${.CURDIR}/x509v3.cnf ${DESTDIR}/etc/ssl/x509v3.cnf | 16 | ${.CURDIR}/x509v3.cnf ${DESTDIR}/etc/ssl/x509v3.cnf |
| 12 | 17 | ||
| 18 | beforeinstall: | ||
| 19 | .if (${KERBEROS5:L} == "yes") | ||
| 20 | /bin/sh ${.CURDIR}/generate_pkgconfig.sh -c ${.CURDIR} -o ${.OBJDIR} -k | ||
| 21 | .else | ||
| 22 | /bin/sh ${.CURDIR}/generate_pkgconfig.sh -c ${.CURDIR} -o ${.OBJDIR} | ||
| 23 | .endif | ||
| 24 | |||
| 25 | .for p in ${PC_FILES} | ||
| 26 | ${INSTALL} ${INSTALL_COPY} -o root -g ${SHAREGRP} \ | ||
| 27 | -m ${SHAREMODE} ${.OBJDIR}/$p ${DESTDIR}/usr/lib/pkgconfig/ | ||
| 28 | .endfor | ||
| 29 | |||
| 30 | .include <bsd.prog.mk> | ||
| 13 | .include <bsd.subdir.mk> | 31 | .include <bsd.subdir.mk> |
diff --git a/src/lib/libssl/generate_pkgconfig.sh b/src/lib/libssl/generate_pkgconfig.sh new file mode 100644 index 0000000000..912943dd55 --- /dev/null +++ b/src/lib/libssl/generate_pkgconfig.sh | |||
| @@ -0,0 +1,103 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # | ||
| 3 | # $OpenBSD: generate_pkgconfig.sh,v 1.1 2010/12/28 14:30:50 jasper Exp $ | ||
| 4 | # | ||
| 5 | # Generate pkg-config files for OpenSSL. | ||
| 6 | |||
| 7 | usage() { | ||
| 8 | echo "usage: ${0##*/} [-k] -c current_directory -o obj_directory" | ||
| 9 | exit 1 | ||
| 10 | } | ||
| 11 | |||
| 12 | enable_krb5=false | ||
| 13 | curdir= | ||
| 14 | objdir= | ||
| 15 | while getopts "c:ko:" flag; do | ||
| 16 | case "$flag" in | ||
| 17 | c) | ||
| 18 | curdir=$OPTARG | ||
| 19 | ;; | ||
| 20 | k) | ||
| 21 | enable_krb5=true | ||
| 22 | ;; | ||
| 23 | o) | ||
| 24 | objdir=$OPTARG | ||
| 25 | ;; | ||
| 26 | *) | ||
| 27 | usage | ||
| 28 | ;; | ||
| 29 | esac | ||
| 30 | done | ||
| 31 | |||
| 32 | [ -n "${curdir}" ] || usage | ||
| 33 | if [ ! -w "${curdir}" ]; then | ||
| 34 | echo "${0##*/}: ${curdir}: not found or not writable" | ||
| 35 | exit 1 | ||
| 36 | fi | ||
| 37 | [ -n "${objdir}" ] || usage | ||
| 38 | if [ ! -w "${objdir}" ]; then | ||
| 39 | echo "${0##*/}: ${objdir}: not found or not writable" | ||
| 40 | exit 1 | ||
| 41 | fi | ||
| 42 | |||
| 43 | ssl_version=$(sed -nE 's/^#define[[:blank:]]+SHLIB_VERSION_NUMBER[[:blank:]]+"(.*)".*/\1/p' \ | ||
| 44 | ${curdir}/src/crypto/opensslv.h) | ||
| 45 | |||
| 46 | pc_file="${objdir}/libcrypto.pc" | ||
| 47 | cat > ${pc_file} << __EOF__ | ||
| 48 | prefix=/usr | ||
| 49 | exec_prefix=\${prefix} | ||
| 50 | libdir=\${exec_prefix}/lib | ||
| 51 | includedir=\${prefix}/include | ||
| 52 | |||
| 53 | Name: OpenSSL-libcrypto | ||
| 54 | Description: OpenSSL cryptography library | ||
| 55 | Version: ${ssl_version} | ||
| 56 | Requires: | ||
| 57 | __EOF__ | ||
| 58 | echo -n 'Libs: -L${libdir} -lcrypto ' >> ${pc_file} | ||
| 59 | ${enable_krb5} && echo -n '-L/usr/kerberos/lib ' >> ${pc_file} | ||
| 60 | echo '-lz' >> ${pc_file} | ||
| 61 | echo -n 'Cflags: -I${includedir} ' >> ${pc_file} | ||
| 62 | ${enable_krb5} && echo -n '-I/usr/kerberos/include' >> ${pc_file} | ||
| 63 | echo '' >> ${pc_file} | ||
| 64 | |||
| 65 | |||
| 66 | pc_file="${objdir}/libssl.pc" | ||
| 67 | cat > ${pc_file} << __EOF__ | ||
| 68 | prefix=/usr | ||
| 69 | exec_prefix=\${prefix} | ||
| 70 | libdir=\${exec_prefix}/lib | ||
| 71 | includedir=\${prefix}/include | ||
| 72 | |||
| 73 | Name: OpenSSL | ||
| 74 | Description: Secure Sockets Layer and cryptography libraries | ||
| 75 | Version: ${ssl_version} | ||
| 76 | Requires: | ||
| 77 | __EOF__ | ||
| 78 | echo -n 'Libs: -L${libdir} -lssl -lcrypto ' >> ${pc_file} | ||
| 79 | ${enable_krb5} && echo -n '-L/usr/kerberos/lib ' >> ${pc_file} | ||
| 80 | echo '-lz' >> ${pc_file} | ||
| 81 | echo -n 'Cflags: -I${includedir} ' >> ${pc_file} | ||
| 82 | ${enable_krb5} && echo -n '-I/usr/kerberos/include' >> ${pc_file} | ||
| 83 | echo '' >> ${pc_file} | ||
| 84 | |||
| 85 | |||
| 86 | pc_file="${objdir}/openssl.pc" | ||
| 87 | cat > ${pc_file} << __EOF__ | ||
| 88 | prefix=/usr | ||
| 89 | exec_prefix=\${prefix} | ||
| 90 | libdir=\${exec_prefix}/lib | ||
| 91 | includedir=\${prefix}/include | ||
| 92 | |||
| 93 | Name: OpenSSL | ||
| 94 | Description: Secure Sockets Layer and cryptography libraries and tools | ||
| 95 | Version: ${ssl_version} | ||
| 96 | Requires: | ||
| 97 | __EOF__ | ||
| 98 | echo -n 'Libs: -L${libdir} -lssl -lcrypto ' >> ${pc_file} | ||
| 99 | ${enable_krb5} && echo -n '-L/usr/kerberos/lib ' >> ${pc_file} | ||
| 100 | echo '-lz' >> ${pc_file} | ||
| 101 | echo -n 'Cflags: -I${includedir} ' >> ${pc_file} | ||
| 102 | ${enable_krb5} && echo -n '-I/usr/kerberos/include' >> ${pc_file} | ||
| 103 | echo '' >> ${pc_file} | ||
