Lutz Jänicke | 8b2f9cd | 2002-04-21 17:54:03 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # This script configures, builds and packs the binary package for |
| 4 | # the Cygwin net distribution version of OpenSSL |
| 5 | # |
| 6 | |
| 7 | # Uncomment when debugging |
| 8 | #set -x |
| 9 | |
| 10 | CONFIG_OPTIONS="--prefix=/usr shared no-idea no-rc5 no-mdc2" |
| 11 | INSTALL_PREFIX=/tmp/install |
| 12 | |
| 13 | VERSION= |
| 14 | SUBVERSION=$1 |
| 15 | |
| 16 | function cleanup() |
| 17 | { |
| 18 | rm -rf ${INSTALL_PREFIX}/etc |
| 19 | rm -rf ${INSTALL_PREFIX}/usr |
| 20 | } |
| 21 | |
| 22 | function get_openssl_version() |
| 23 | { |
| 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 |
| 30 | fi |
| 31 | } |
| 32 | |
| 33 | function base_install() |
| 34 | { |
| 35 | mkdir -p ${INSTALL_PREFIX} |
| 36 | cleanup |
| 37 | make install INSTALL_PREFIX="${INSTALL_PREFIX}" |
| 38 | } |
| 39 | |
| 40 | function doc_install() |
| 41 | { |
Richard Levitte | d1360f6 | 2004-09-28 13:10:16 +0000 | [diff] [blame^] | 42 | DOC_DIR=${INSTALL_PREFIX}/usr/share/doc/openssl |
Lutz Jänicke | 8b2f9cd | 2002-04-21 17:54:03 +0000 | [diff] [blame] | 43 | |
| 44 | mkdir -p ${DOC_DIR} |
| 45 | cp CHANGES CHANGES.SSLeay INSTALL LICENSE NEWS README ${DOC_DIR} |
| 46 | |
| 47 | create_cygwin_readme |
| 48 | } |
| 49 | |
| 50 | function create_cygwin_readme() |
| 51 | { |
Richard Levitte | d1360f6 | 2004-09-28 13:10:16 +0000 | [diff] [blame^] | 52 | README_DIR=${INSTALL_PREFIX}/usr/share/doc/Cygwin |
Lutz Jänicke | 8b2f9cd | 2002-04-21 17:54:03 +0000 | [diff] [blame] | 53 | README_FILE=${README_DIR}/openssl-${VERSION}.README |
| 54 | |
| 55 | mkdir -p ${README_DIR} |
| 56 | cat > ${README_FILE} <<- EOF |
| 57 | The Cygwin version has been built using the following configure: |
| 58 | |
| 59 | ./config ${CONFIG_OPTIONS} |
| 60 | |
| 61 | The IDEA, RC5 and MDC2 algorithms are disabled due to patent and/or |
| 62 | licensing issues. |
| 63 | EOF |
| 64 | } |
| 65 | |
| 66 | function create_profile_files() |
| 67 | { |
| 68 | PROFILE_DIR=${INSTALL_PREFIX}/etc/profile.d |
| 69 | |
| 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 |
| 81 | } |
| 82 | |
| 83 | if [ -z "${SUBVERSION}" ] |
| 84 | then |
| 85 | echo "Usage: $0 subversion" |
| 86 | exit 1 |
| 87 | fi |
| 88 | |
| 89 | if [ ! -f config ] |
| 90 | then |
| 91 | echo "You must start this script in the OpenSSL toplevel source dir." |
| 92 | exit 1 |
| 93 | fi |
| 94 | |
| 95 | ./config ${CONFIG_OPTIONS} |
| 96 | |
| 97 | get_openssl_version |
| 98 | |
Richard Levitte | e20afbb | 2002-11-14 12:39:39 +0000 | [diff] [blame] | 99 | make depend || exit 1 |
| 100 | |
Lutz Jänicke | 8b2f9cd | 2002-04-21 17:54:03 +0000 | [diff] [blame] | 101 | make || exit 1 |
| 102 | |
| 103 | base_install |
| 104 | |
| 105 | doc_install |
| 106 | |
| 107 | create_cygwin_readme |
| 108 | |
| 109 | create_profile_files |
| 110 | |
| 111 | cd ${INSTALL_PREFIX} |
| 112 | strip usr/bin/*.exe usr/bin/*.dll |
| 113 | |
| 114 | # Runtime package |
Richard Levitte | d1360f6 | 2004-09-28 13:10:16 +0000 | [diff] [blame^] | 115 | find etc usr/bin usr/share/doc usr/ssl/certs usr/ssl/man/man[157] \ |
| 116 | usr/ssl/misc usr/ssl/openssl.cnf usr/ssl/private -empty -o \! -type d | |
Richard Levitte | 62be003 | 2003-01-13 14:47:52 +0000 | [diff] [blame] | 117 | tar cjfT openssl-${VERSION}-${SUBVERSION}.tar.bz2 - |
Lutz Jänicke | 8b2f9cd | 2002-04-21 17:54:03 +0000 | [diff] [blame] | 118 | # Development package |
| 119 | find usr/include usr/lib usr/ssl/man/man3 -empty -o \! -type d | |
Richard Levitte | 62be003 | 2003-01-13 14:47:52 +0000 | [diff] [blame] | 120 | tar cjfT openssl-devel-${VERSION}-${SUBVERSION}.tar.bz2 - |
Lutz Jänicke | 8b2f9cd | 2002-04-21 17:54:03 +0000 | [diff] [blame] | 121 | |
Richard Levitte | 62be003 | 2003-01-13 14:47:52 +0000 | [diff] [blame] | 122 | ls -l openssl-${VERSION}-${SUBVERSION}.tar.bz2 |
| 123 | ls -l openssl-devel-${VERSION}-${SUBVERSION}.tar.bz2 |
Lutz Jänicke | 8b2f9cd | 2002-04-21 17:54:03 +0000 | [diff] [blame] | 124 | |
| 125 | cleanup |
| 126 | |
| 127 | exit 0 |