etc/services - sync with NetBSD-8
[minix.git] / crypto / external / bsd / openssl / dist / util / cygwin.sh
blobcfdb04d2a4820320297fec3a0db341771d2e6d4f
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/INSTALL
13 VERSION=
14 SHLIB_VERSION_NUMBER=
15 SUBVERSION=$1
17 function cleanup()
19 rm -rf ${INSTALL_PREFIX}/etc
20 rm -rf ${INSTALL_PREFIX}/usr
23 function get_openssl_version()
25 eval `grep '^VERSION=' Makefile`
26 if [ -z "${VERSION}" ]
27 then
28 echo "Error: Couldn't retrieve OpenSSL version from Makefile."
29 echo " Check value of variable VERSION in Makefile."
30 exit 1
32 eval `grep '^SHLIB_VERSION_NUMBER=' Makefile`
33 if [ -z "${SHLIB_VERSION_NUMBER}" ]
34 then
35 echo "Error: Couldn't retrieve OpenSSL shared lib version from Makefile."
36 echo " Check value of variable SHLIB_VERSION_NUMBER in Makefile."
37 exit 1
41 function base_install()
43 mkdir -p ${INSTALL_PREFIX}
44 cleanup
45 make install INSTALL_PREFIX="${INSTALL_PREFIX}"
48 function doc_install()
50 DOC_DIR=${INSTALL_PREFIX}/usr/share/doc/openssl
52 mkdir -p ${DOC_DIR}
53 cp CHANGES CHANGES.SSLeay INSTALL LICENSE NEWS README ${DOC_DIR}
55 create_cygwin_readme
58 function certs_install()
60 CERTS_DIR=${INSTALL_PREFIX}/usr/ssl/certs
62 mkdir -p ${CERTS_DIR}
63 cp -rp certs/* ${CERTS_DIR}
66 function create_cygwin_readme()
68 README_DIR=${INSTALL_PREFIX}/usr/share/doc/Cygwin
69 README_FILE=${README_DIR}/openssl-${VERSION}.README
71 mkdir -p ${README_DIR}
72 cat > ${README_FILE} <<- EOF
73 The Cygwin version has been built using the following configure:
75 ./config ${CONFIG_OPTIONS}
77 The IDEA and RC5 algorithms are disabled due to patent and/or
78 licensing issues.
79 EOF
82 function create_profile_files()
84 PROFILE_DIR=${INSTALL_PREFIX}/etc/profile.d
86 mkdir -p $PROFILE_DIR
87 cat > ${PROFILE_DIR}/openssl.sh <<- "EOF"
88 export MANPATH="${MANPATH}:/usr/ssl/man"
89 EOF
90 cat > ${PROFILE_DIR}/openssl.csh <<- "EOF"
91 if ( $?MANPATH ) then
92 setenv MANPATH "${MANPATH}:/usr/ssl/man"
93 else
94 setenv MANPATH ":/usr/ssl/man"
95 endif
96 EOF
99 if [ -z "${SUBVERSION}" ]
100 then
101 echo "Usage: $0 subversion"
102 exit 1
105 if [ ! -f config ]
106 then
107 echo "You must start this script in the OpenSSL toplevel source dir."
108 exit 1
111 ./config ${CONFIG_OPTIONS}
113 get_openssl_version
115 make depend || exit 1
117 make || exit 1
119 base_install
121 doc_install
123 certs_install
125 create_cygwin_readme
127 create_profile_files
129 cd ${INSTALL_PREFIX}
130 chmod u+w usr/lib/engines/*.so
131 strip usr/bin/*.exe usr/bin/*.dll usr/lib/engines/*.so
132 chmod u-w usr/lib/engines/*.so
134 # Runtime package
135 tar cjf libopenssl${SHLIB_VERSION_NUMBER//[!0-9]/}-${VERSION}-${SUBVERSION}.tar.bz2 \
136 usr/bin/cyg*dll
137 # Base package
138 find etc usr/bin/openssl.exe usr/bin/c_rehash usr/lib/engines usr/share/doc \
139 usr/ssl/certs usr/ssl/man/man[157] usr/ssl/misc usr/ssl/openssl.cnf \
140 usr/ssl/private \
141 -empty -o \! -type d |
142 tar cjfT openssl-${VERSION}-${SUBVERSION}.tar.bz2 -
143 # Development package
144 find usr/include usr/lib/*.a usr/lib/pkgconfig usr/ssl/man/man3 \
145 -empty -o \! -type d |
146 tar cjfT openssl-devel-${VERSION}-${SUBVERSION}.tar.bz2 -
148 ls -l openssl-${VERSION}-${SUBVERSION}.tar.bz2
149 ls -l openssl-devel-${VERSION}-${SUBVERSION}.tar.bz2
150 ls -l libopenssl${SHLIB_VERSION_NUMBER//[!0-9]/}-${VERSION}-${SUBVERSION}.tar.bz2
152 cleanup
154 exit 0