Tomato 1.28
[tomato.git] / release / src / router / openssl / util / cygwin.sh
blobb607399b0289ef3507757dc8c96ad86b6301dd99
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 no-idea no-rc5 no-mdc2"
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.ssl`
25 if [ -z "${VERSION}" ]
26 then
27 echo "Error: Couldn't retrieve OpenSSL version from Makefile.ssl."
28 echo " Check value of variable VERSION in Makefile.ssl."
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/doc/openssl
44 mkdir -p ${DOC_DIR}
45 cp CHANGES CHANGES.SSLeay INSTALL LICENSE NEWS README ${DOC_DIR}
47 create_cygwin_readme
50 function create_cygwin_readme()
52 README_DIR=${INSTALL_PREFIX}/usr/doc/Cygwin
53 README_FILE=${README_DIR}/openssl-${VERSION}.README
55 mkdir -p ${README_DIR}
56 cat > ${README_FILE} <<- EOF
57 The Cygwin version has been built using the following configure:
59 ./config ${CONFIG_OPTIONS}
61 The IDEA, RC5 and MDC2 algorithms are disabled due to patent and/or
62 licensing issues.
63 EOF
66 function create_profile_files()
68 PROFILE_DIR=${INSTALL_PREFIX}/etc/profile.d
70 mkdir -p $PROFILE_DIR
71 cat > ${PROFILE_DIR}/openssl.sh <<- "EOF"
72 export MANPATH="${MANPATH}:/usr/ssl/man"
73 EOF
74 cat > ${PROFILE_DIR}/openssl.csh <<- "EOF"
75 if ( $?MANPATH ) then
76 setenv MANPATH "${MANPATH}:/usr/ssl/man"
77 else
78 setenv MANPATH ":/usr/ssl/man"
79 endif
80 EOF
83 if [ -z "${SUBVERSION}" ]
84 then
85 echo "Usage: $0 subversion"
86 exit 1
89 if [ ! -f config ]
90 then
91 echo "You must start this script in the OpenSSL toplevel source dir."
92 exit 1
95 ./config ${CONFIG_OPTIONS}
97 get_openssl_version
99 make || exit 1
101 base_install
103 doc_install
105 create_cygwin_readme
107 create_profile_files
109 cd ${INSTALL_PREFIX}
110 strip usr/bin/*.exe usr/bin/*.dll
112 # Runtime package
113 find etc usr/bin usr/doc usr/ssl/certs usr/ssl/man/man[157] usr/ssl/misc \
114 usr/ssl/openssl.cnf usr/ssl/private -empty -o \! -type d |
115 tar cjfT openssl-${VERSION}-${SUBVERSION}.tar.bz2 -
116 # Development package
117 find usr/include usr/lib usr/ssl/man/man3 -empty -o \! -type d |
118 tar cjfT openssl-devel-${VERSION}-${SUBVERSION}.tar.bz2 -
120 ls -l openssl-${VERSION}-${SUBVERSION}.tar.bz2
121 ls -l openssl-devel-${VERSION}-${SUBVERSION}.tar.bz2
123 cleanup
125 exit 0