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/libssl/generate_pkgconfig.sh | |
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/libssl/generate_pkgconfig.sh')
-rw-r--r-- | lib/libssl/generate_pkgconfig.sh | 103 |
1 files changed, 103 insertions, 0 deletions
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} |