diff options
Diffstat (limited to 'src/lib/libssl/generate_pkgconfig.sh')
| -rw-r--r-- | src/lib/libssl/generate_pkgconfig.sh | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/src/lib/libssl/generate_pkgconfig.sh b/src/lib/libssl/generate_pkgconfig.sh new file mode 100644 index 0000000000..04bc77e38d --- /dev/null +++ b/src/lib/libssl/generate_pkgconfig.sh | |||
| @@ -0,0 +1,106 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # | ||
| 3 | # $OpenBSD: generate_pkgconfig.sh,v 1.7 2011/05/05 20:58:15 jasper Exp $ | ||
| 4 | # | ||
| 5 | # Copyright (c) 2010,2011 Jasper Lievisse Adriaanse <jasper@openbsd.org> | ||
| 6 | # | ||
| 7 | # Permission to use, copy, modify, and distribute this software for any | ||
| 8 | # purpose with or without fee is hereby granted, provided that the above | ||
| 9 | # copyright notice and this permission notice appear in all copies. | ||
| 10 | # | ||
| 11 | # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 12 | # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 13 | # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 14 | # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 15 | # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 16 | # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 17 | # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 18 | # | ||
| 19 | # Generate pkg-config files for OpenSSL. | ||
| 20 | |||
| 21 | usage() { | ||
| 22 | echo "usage: ${0##*/} -c current_directory -o obj_directory" | ||
| 23 | exit 1 | ||
| 24 | } | ||
| 25 | |||
| 26 | curdir= | ||
| 27 | objdir= | ||
| 28 | while getopts "c:o:" flag; do | ||
| 29 | case "$flag" in | ||
| 30 | c) | ||
| 31 | curdir=$OPTARG | ||
| 32 | ;; | ||
| 33 | o) | ||
| 34 | objdir=$OPTARG | ||
| 35 | ;; | ||
| 36 | *) | ||
| 37 | usage | ||
| 38 | ;; | ||
| 39 | esac | ||
| 40 | done | ||
| 41 | |||
| 42 | [ -n "${curdir}" ] || usage | ||
| 43 | if [ ! -d "${curdir}" ]; then | ||
| 44 | echo "${0##*/}: ${curdir}: not found" | ||
| 45 | exit 1 | ||
| 46 | fi | ||
| 47 | [ -n "${objdir}" ] || usage | ||
| 48 | if [ ! -w "${objdir}" ]; then | ||
| 49 | echo "${0##*/}: ${objdir}: not found or not writable" | ||
| 50 | exit 1 | ||
| 51 | fi | ||
| 52 | |||
| 53 | version_re="s/^#define[[:blank:]]+SHLIB_VERSION_NUMBER[[:blank:]]+\"(.*)\".*/\1/p" | ||
| 54 | version_file=${curdir}/src/crypto/opensslv.h | ||
| 55 | lib_version=$(sed -nE ${version_re} ${version_file}) | ||
| 56 | |||
| 57 | # Put -I${includedir} into Cflags so configure script tests like | ||
| 58 | # test -n "`pkg-config --cflags openssl`" | ||
| 59 | # don't assume that OpenSSL isn't available. | ||
| 60 | |||
| 61 | pc_file="${objdir}/libcrypto.pc" | ||
| 62 | cat > ${pc_file} << __EOF__ | ||
| 63 | prefix=/usr | ||
| 64 | exec_prefix=\${prefix} | ||
| 65 | libdir=\${exec_prefix}/lib | ||
| 66 | includedir=\${prefix}/include | ||
| 67 | |||
| 68 | Name: OpenSSL-libcrypto | ||
| 69 | Description: OpenSSL cryptography library | ||
| 70 | Version: ${lib_version} | ||
| 71 | Requires: | ||
| 72 | Libs: -L\${libdir} -lcrypto | ||
| 73 | Cflags: -I\${includedir} | ||
| 74 | __EOF__ | ||
| 75 | |||
| 76 | |||
| 77 | pc_file="${objdir}/libssl.pc" | ||
| 78 | cat > ${pc_file} << __EOF__ | ||
| 79 | prefix=/usr | ||
| 80 | exec_prefix=\${prefix} | ||
| 81 | libdir=\${exec_prefix}/lib | ||
| 82 | includedir=\${prefix}/include | ||
| 83 | |||
| 84 | Name: OpenSSL | ||
| 85 | Description: Secure Sockets Layer and cryptography libraries | ||
| 86 | Version: ${lib_version} | ||
| 87 | Requires: | ||
| 88 | Libs: -L\${libdir} -lssl -lcrypto | ||
| 89 | Cflags: -I\${includedir} | ||
| 90 | __EOF__ | ||
| 91 | |||
| 92 | |||
| 93 | pc_file="${objdir}/openssl.pc" | ||
| 94 | cat > ${pc_file} << __EOF__ | ||
| 95 | prefix=/usr | ||
| 96 | exec_prefix=\${prefix} | ||
| 97 | libdir=\${exec_prefix}/lib | ||
| 98 | includedir=\${prefix}/include | ||
| 99 | |||
| 100 | Name: OpenSSL | ||
| 101 | Description: Secure Sockets Layer and cryptography libraries and tools | ||
| 102 | Version: ${lib_version} | ||
| 103 | Requires: | ||
| 104 | Libs: -L\${libdir} -lssl -lcrypto | ||
| 105 | Cflags: -I\${includedir} | ||
| 106 | __EOF__ | ||
