diff options
author | jasper <> | 2010-12-28 14:30:50 +0000 |
---|---|---|
committer | jasper <> | 2010-12-28 14:30:50 +0000 |
commit | 0ea551d84cefb476f864a1a524c19ff0ef57e15a (patch) | |
tree | ac55d329957c192fe02230bfadf3015095ca40fa /src/lib/libssl/generate_pkgconfig.sh | |
parent | c5b4a3ff6bcf1a9bbdad0dbd296b2a6ff9522165 (diff) | |
download | openbsd-0ea551d84cefb476f864a1a524c19ff0ef57e15a.tar.gz openbsd-0ea551d84cefb476f864a1a524c19ff0ef57e15a.tar.bz2 openbsd-0ea551d84cefb476f864a1a524c19ff0ef57e15a.zip |
- 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 'src/lib/libssl/generate_pkgconfig.sh')
-rw-r--r-- | src/lib/libssl/generate_pkgconfig.sh | 103 |
1 files changed, 103 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..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} | ||