tzdata: update to 2018g
[unleashed.git] / lib / libcrypto / generate_pkgconfig.sh
blob12dff506ff03f3c2e7949153ba1896a3542ed4e6
1 #!/bin/sh
3 # $OpenBSD: generate_pkgconfig.sh,v 1.2 2016/09/03 12:42:46 beck Exp $
5 # Copyright (c) 2010,2011 Jasper Lievisse Adriaanse <jasper@openbsd.org>
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.
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.
19 # Generate pkg-config files for OpenSSL.
21 usage() {
22 echo "usage: ${0##*/} -c current_directory -o obj_directory"
23 exit 1
26 curdir=
27 objdir=
28 while getopts "c:o:" flag; do
29 case "$flag" in
31 curdir=$OPTARG
34 objdir=$OPTARG
37 usage
39 esac
40 done
42 [ -n "${curdir}" ] || usage
43 if [ ! -d "${curdir}" ]; then
44 echo "${0##*/}: ${curdir}: not found"
45 exit 1
47 [ -n "${objdir}" ] || usage
48 if [ ! -w "${objdir}" ]; then
49 echo "${0##*/}: ${objdir}: not found or not writable"
50 exit 1
53 version_re="s/^#define[[:blank:]]+SHLIB_VERSION_NUMBER[[:blank:]]+\"(.*)\".*/\1/p"
54 #version_file=${curdir}/src/crypto/opensslv.h
55 version_file=${curdir}/opensslv.h
56 lib_version=$(sed -nE ${version_re} ${version_file})
58 # Put -I${includedir} into Cflags so configure script tests like
59 # test -n "`pkg-config --cflags openssl`"
60 # don't assume that OpenSSL isn't available.
62 pc_file="${objdir}/libcrypto.pc"
63 cat > ${pc_file} << __EOF__
64 prefix=/usr
65 exec_prefix=\${prefix}
66 libdir=\${exec_prefix}/lib
67 includedir=\${prefix}/include
69 Name: OpenSSL-libcrypto
70 Description: OpenSSL cryptography library
71 Version: ${lib_version}
72 Requires:
73 Libs: -L\${libdir} -lcrypto
74 Cflags: -I\${includedir}
75 __EOF__