Sync usage with man page.
[netbsd-mini2440.git] / crypto / external / bsd / openssl / dist / util / cygwin.sh
bloba4f2e740b42cae3c3599df25a7d0394f107cdd13
1 #!/bin/bash
3 # This script configures, builds and packs the binary package for
4 # the Cygwin net distribution version of OpenSSL
7 # Uncomment when debugging
8 #set -x
10 CONFIG_OPTIONS="--prefix=/usr shared zlib no-idea no-rc5"
11 INSTALL_PREFIX=/tmp/install
13 VERSION=
14 SUBVERSION=$1
16 function cleanup()
18 rm -rf ${INSTALL_PREFIX}/etc
19 rm -rf ${INSTALL_PREFIX}/usr
22 function get_openssl_version()
24 eval `grep '^VERSION=' Makefile`
25 if [ -z "${VERSION}" ]
26 then
27 echo "Error: Couldn't retrieve OpenSSL version from Makefile."
28 echo " Check value of variable VERSION in Makefile."
29 exit 1
33 function base_install()
35 mkdir -p ${INSTALL_PREFIX}
36 cleanup
37 make install INSTALL_PREFIX="${INSTALL_PREFIX}"
40 function doc_install()
42 DOC_DIR=${INSTALL_PREFIX}/usr/share/doc/openssl
44 mkdir -p ${DOC_DIR}
45 cp CHANGES CHANGES.SSLeay INSTALL LICENSE NEWS README ${DOC_DIR}
47 create_cygwin_readme
50 function certs_install()
52 CERTS_DIR=${INSTALL_PREFIX}/usr/ssl/certs
54 mkdir -p ${CERTS_DIR}
55 cp -rp certs/* ${CERTS_DIR}
58 function create_cygwin_readme()
60 README_DIR=${INSTALL_PREFIX}/usr/share/doc/Cygwin
61 README_FILE=${README_DIR}/openssl-${VERSION}.README
63 mkdir -p ${README_DIR}
64 cat > ${README_FILE} <<- EOF
65 The Cygwin version has been built using the following configure:
67 ./config ${CONFIG_OPTIONS}
69 The IDEA and RC5 algorithms are disabled due to patent and/or
70 licensing issues.
71 EOF
74 function create_profile_files()
76 PROFILE_DIR=${INSTALL_PREFIX}/etc/profile.d
78 mkdir -p $PROFILE_DIR
79 cat > ${PROFILE_DIR}/openssl.sh <<- "EOF"
80 export MANPATH="${MANPATH}:/usr/ssl/man"
81 EOF
82 cat > ${PROFILE_DIR}/openssl.csh <<- "EOF"
83 if ( $?MANPATH ) then
84 setenv MANPATH "${MANPATH}:/usr/ssl/man"
85 else
86 setenv MANPATH ":/usr/ssl/man"
87 endif
88 EOF
91 if [ -z "${SUBVERSION}" ]
92 then
93 echo "Usage: $0 subversion"
94 exit 1
97 if [ ! -f config ]
98 then
99 echo "You must start this script in the OpenSSL toplevel source dir."
100 exit 1
103 ./config ${CONFIG_OPTIONS}
105 get_openssl_version
107 make depend || exit 1
109 make || exit 1
111 base_install
113 doc_install
115 certs_install
117 create_cygwin_readme
119 create_profile_files
121 cd ${INSTALL_PREFIX}
122 chmod u+w usr/lib/engines/*.so
123 strip usr/bin/*.exe usr/bin/*.dll usr/lib/engines/*.so
124 chmod u-w usr/lib/engines/*.so
126 # Runtime package
127 find etc usr/bin usr/lib/engines usr/share/doc usr/ssl/certs \
128 usr/ssl/man/man[157] usr/ssl/misc usr/ssl/openssl.cnf usr/ssl/private \
129 -empty -o \! -type d |
130 tar cjfT openssl-${VERSION}-${SUBVERSION}.tar.bz2 -
131 # Development package
132 find usr/include usr/lib/*.a usr/lib/pkgconfig usr/ssl/man/man3 \
133 -empty -o \! -type d |
134 tar cjfT openssl-devel-${VERSION}-${SUBVERSION}.tar.bz2 -
136 ls -l openssl-${VERSION}-${SUBVERSION}.tar.bz2
137 ls -l openssl-devel-${VERSION}-${SUBVERSION}.tar.bz2
139 cleanup
141 exit 0