source: npl/system/openssl/openssl.SlackBuild.orig @ ca72aba

Last change on this file since ca72aba was 4933918, checked in by Edwin Eefting <edwin@datux.nl>, 7 years ago

revert to latest open ssh 1.0 (1.0.2p). not all services support 1.1 yet

  • Property mode set to 100755
File size: 8.0 KB
Line 
1#!/bin/sh
2
3# Copyright 2000 BSDi, Inc. Concord, CA, USA
4# Copyright 2001, 2002 Slackware Linux, Inc.  Concord, CA, USA
5# Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015  Patrick J. Volkerding, Sebeka, MN, USA
6# All rights reserved.
7#
8# Redistribution and use of this script, with or without modification, is
9# permitted provided that the following conditions are met:
10#
11# 1. Redistributions of this script must retain the above copyright
12#    notice, this list of conditions and the following disclaimer.
13#
14#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
15#  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
17#  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
20#  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
21#  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
22#  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
23#  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
25
26# Set initial variables:
27CWD=$(pwd)
28TMP=${TMP:-/tmp}
29
30VERSION=${VERSION:-$(echo openssl-*.tar.gz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
31BUILD=${BUILD:-1_slack14.2}
32
33# Automatically determine the architecture we're building on:
34if [ -z "$ARCH" ]; then
35  case "$( uname -m )" in
36    i?86) export ARCH=i586 ;;
37    arm*) export ARCH=arm ;;
38    # Unless $ARCH is already set, use uname -m for all other archs:
39       *) export ARCH=$( uname -m ) ;;
40  esac
41fi
42
43PKG1=$TMP/package-openssl
44PKG2=$TMP/package-ossllibs
45NAME1=openssl-$VERSION-$ARCH-$BUILD
46NAME2=openssl-solibs-$VERSION-$ARCH-$BUILD
47
48# Parallel build doesn't link properly.
49#NUMJOBS=${NUMJOBS:--j6}
50
51# So that ls has the right field counts for parsing...
52export LC_ALL=C
53
54cd $TMP
55rm -rf $PKG1 $PKG2 openssl-$VERSION
56
57tar xvf $CWD/openssl-$VERSION.tar.gz || exit 1
58cd openssl-$VERSION
59
60# Fix pod syntax errors which are fatal wih a newer perl:
61find . -name "*.pod" -exec sed -i "s/^\=item \([0-9]\)\(\ \|$\)/\=item C<\1>/g" {} \;
62
63# Use .so.1, not .so.1.0.0:
64sed -i "s/soname=\$\$SHLIB\$\$SHLIB_SOVER\$\$SHLIB_SUFFIX/soname=\$\$SHLIB.1/g" Makefile.shared
65
66if [ "$ARCH" = "i586" ]; then
67  # Build with -march=i586 -mtune=i686:
68  sed -i "/linux-elf/s/fomit-frame-pointer/fomit-frame-pointer -march=i586 -mtune=i686/g" Configure
69  LIBDIRSUFFIX=""
70elif [ "$ARCH" = "i686" ]; then
71  # Build with -march=i686 -mtune=i686:
72  sed -i "/linux-elf/s/fomit-frame-pointer/fomit-frame-pointer -march=i686 -mtune=i686/g" Configure
73  LIBDIRSUFFIX=""
74elif [ "$ARCH" = "x86_64" ]; then
75  LIBDIRSUFFIX="64"
76fi
77
78# OpenSSL has a (nasty?) habit of bumping the internal version number with
79# every release.  This wouldn't be so bad, but some applications are so
80# paranoid that they won't run against a different OpenSSL version than
81# what they were compiled against, whether or not the ABI has changed.
82#
83# So, we will use the OPENSSL_VERSION_NUMBER from openssl-1.0.2e unless ABI
84# breakage forces it to change.  Yes, we're finally using this old trick.  :)
85sed -i "s/#define OPENSSL_VERSION_NUMBER.*/\/* Use 0x1000205fL (1.0.2e) below to avoid pointlessly breaking the ABI *\/\n#define OPENSSL_VERSION_NUMBER 0x1000205fL/g" crypto/opensslv.h || exit 1
86
87chown -R root:root .
88mkdir -p $PKG1/usr/doc/openssl-$VERSION
89cp -a CHANGES CHANGES.SSLeay FAQ INSTALL INSTALL.MacOS INSTALL.VMS INSTALL.W32 \
90  LICENSE NEWS README README.ENGINE doc $PKG1/usr/doc/openssl-$VERSION
91find $PKG1/usr/doc/openssl-$VERSION -type d -exec chmod 755 {} \;
92find $PKG1/usr/doc/openssl-$VERSION -type f -exec chmod 644 {} \;
93
94# If there's a CHANGES file, installing at least part of the recent history
95# is useful, but don't let it get totally out of control:
96if [ -r CHANGES ]; then
97  DOCSDIR=$(echo $PKG1/usr/doc/*-$VERSION)
98  cat CHANGES | head -n 2000 > $DOCSDIR/CHANGES
99  touch -r CHANGES $DOCSDIR/CHANGES
100fi
101
102# These are the known patent issues with OpenSSL:
103# name   #         expires
104# MDC-2: 4,908,861  2007-03-13, not included.
105# IDEA:  5,214,703  2010-05-25, not included.
106# RC5:   5,724,428  2015-03-03, not included.
107#
108# Although all of the above are expired, it's still probably
109# not a good idea to include them as there are better
110# algorithms to use.
111
112./config \
113 --prefix=/usr \
114 --openssldir=/etc/ssl \
115 no-mdc2 \
116 no-idea \
117 no-rc5 \
118 no-sse2 \
119 no-ssl2 \
120 no-weak-ssl-ciphers \
121 shared
122
123make $NUMJOBS depend || make depend || exit 1
124
125make $NUMJOBS || make || exit 1
126
127make install INSTALL_PREFIX=$PKG1 || exit 1
128
129# Make the .so.? library symlinks:
130( cd $PKG1/usr/lib${LIBDIRSUFFIX} ; ldconfig -l lib*.so.* )
131
132# Move libraries, as they might be needed by programs that bring a network
133# mounted /usr online:
134
135mkdir $PKG1/lib${LIBDIRSUFFIX}
136( cd $PKG1/usr/lib${LIBDIRSUFFIX}
137  for file in lib*.so.?.* ; do
138    mv $file ../../lib${LIBDIRSUFFIX}
139    ln -sf ../../lib${LIBDIRSUFFIX}/$file .
140  done
141  cp -a lib*.so.? ../../lib${LIBDIRSUFFIX}
142)
143
144# Add a cron script to warn root if a certificate is going to expire soon:
145mkdir -p $PKG1/etc/cron.daily
146zcat $CWD/certwatch.gz > $PKG1/etc/cron.daily/certwatch.new
147chmod 755 $PKG1/etc/cron.daily/certwatch.new
148
149mv $PKG1/etc/ssl/openssl.cnf $PKG1/etc/ssl/openssl.cnf.new
150
151( cd $PKG1
152  find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
153  find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
154)
155
156mv $PKG1/etc/ssl/man $PKG1/usr
157( cd $PKG1/usr/man/man1 ; mv passwd.1 ssl_passwd.1 )
158( cd $PKG1/usr/man/man3 ; mv rand.3 ssl_rand.3 )
159( cd $PKG1/usr/man/man3 ; mv err.3 ssl_err.3 )
160# Compress and symlink the man pages:
161if [ -d $PKG1/usr/man ]; then
162  ( cd $PKG1/usr/man
163    for manpagedir in $(find . -type d -name "man*") ; do
164      ( cd $manpagedir
165        for eachpage in $( find . -type l -maxdepth 1) ; do
166          ln -s $( readlink $eachpage ).gz $eachpage.gz
167          rm $eachpage
168        done
169        gzip -9 *.?
170      )
171    done
172  )
173fi
174
175# If there's an openssl0 directory, then build openssl-0 shared libraries for
176# compatibility with programs linked to those:
177if [ -d $CWD/openssl0 ]; then
178  ( cd $CWD/openssl0
179    ./openssl0.build || exit 1
180  ) || exit 1
181  # Don't put these in the openssl package...  openssl-solibs is enough.
182  #mkdir -p $PKG1/lib${LIBDIRSUFFIX}
183  #cp -a $TMP/package-openssl0/usr/lib/lib*.so.?.?.? $PKG1/lib${LIBDIRSUFFIX}
184  #( cd $PKG1/lib${LIBDIRSUFFIX} ; ldconfig -l lib*.so.?.?.? )
185  mkdir -p $PKG2/lib${LIBDIRSUFFIX}
186  cp -a $TMP/package-openssl0/usr/lib/lib*.so.?.?.? $PKG2/lib${LIBDIRSUFFIX}
187  ( cd $PKG2/lib${LIBDIRSUFFIX} ; ldconfig -l lib*.so.?.?.? )
188fi
189
190cd $PKG1
191chmod 755 usr/lib${LIBDIRSUFFIX}/pkgconfig
192sed -i -e "s#lib\$#lib${LIBDIRSUFFIX}#" usr/lib${LIBDIRSUFFIX}/pkgconfig/*.pc
193mkdir -p install
194zcat $CWD/doinst.sh-openssl.gz > install/doinst.sh
195cat $CWD/slack-desc.openssl > install/slack-desc
196/sbin/makepkg -l y -c n $TMP/${NAME1}.txz
197
198# Make runtime package:
199mkdir -p $PKG2/lib${LIBDIRSUFFIX}
200( cd lib${LIBDIRSUFFIX} ; cp -a lib*.so.* $PKG2/lib${LIBDIRSUFFIX} )
201( cd $PKG2/lib${LIBDIRSUFFIX} ; ldconfig -l * )
202mkdir -p $PKG2/etc
203( cd $PKG2/etc ; cp -a $PKG1/etc/ssl . )
204mkdir -p $PKG2/usr/doc/openssl-$VERSION
205( cd $TMP/openssl-$VERSION
206  cp -a CHANGES CHANGES.SSLeay FAQ INSTALL INSTALL.MacOS INSTALL.VMS INSTALL.W32 \
207  LICENSE NEWS README README.ENGINE $PKG2/usr/doc/openssl-$VERSION
208  # If there's a CHANGES file, installing at least part of the recent history
209  # is useful, but don't let it get totally out of control:
210  if [ -r CHANGES ]; then
211    DOCSDIR=$(echo $PKG2/usr/doc/*-$VERSION)
212    cat CHANGES | head -n 2000 > $DOCSDIR/CHANGES
213    touch -r CHANGES $DOCSDIR/CHANGES
214  fi
215)
216
217find $PKG2/usr/doc/openssl-$VERSION -type d -exec chmod 755 {} \;
218find $PKG2/usr/doc/openssl-$VERSION -type f -exec chmod 644 {} \;
219cd $PKG2
220mkdir -p install
221zcat $CWD/doinst.sh-openssl-solibs.gz > install/doinst.sh
222cat $CWD/slack-desc.openssl-solibs > install/slack-desc
223/sbin/makepkg -l y -c n $TMP/${NAME2}.txz
Note: See TracBrowser for help on using the repository browser.