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

gcc484perl-5.22
Last change on this file since a1525ed was a1525ed, checked in by Edwin Eefting <edwin@datux.nl>, 7 years ago

openssl 1.0.2o

  • Property mode set to 100644
File size: 9.0 KB
RevLine 
[a1525ed]1#!/bin/bash
[c5c522c]2
3# Copyright 2000 BSDi, Inc. Concord, CA, USA
4# Copyright 2001, 2002 Slackware Linux, Inc.  Concord, CA, USA
[a1525ed]5# Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2018  Patrick J. Volkerding, Sebeka, MN, USA
[c5c522c]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# Set initial variables:
[a1525ed]26cd $(dirname $0) ; CWD=$(pwd)
[c5c522c]27TMP=${TMP:-/tmp}
28
[a1525ed]29PKGNAM=openssl
[c5c522c]30VERSION=${VERSION:-$(echo openssl-*.tar.gz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
[a1525ed]31BUILD=${BUILD:-2}
[c5c522c]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
[a1525ed]48# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
49# the name of the created package would be, and then exit. This information
50# could be useful to other scripts.
51if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
52  echo "${NAME1}.txz"
53  echo "${NAME2}.txz"
54  exit 0
55fi
56
[c5c522c]57# Parallel build doesn't link properly.
58#NUMJOBS=${NUMJOBS:--j6}
59
60# So that ls has the right field counts for parsing...
61export LC_ALL=C
62
63cd $TMP
64rm -rf $PKG1 $PKG2 openssl-$VERSION
65
66tar xvf $CWD/openssl-$VERSION.tar.gz || exit 1
67cd openssl-$VERSION
68
69# Fix pod syntax errors which are fatal wih a newer perl:
70find . -name "*.pod" -exec sed -i "s/^\=item \([0-9]\)\(\ \|$\)/\=item C<\1>/g" {} \;
71
72# Use .so.1, not .so.1.0.0:
[a1525ed]73sed -i "s/soname=\$\$SHLIB\$\$SHLIB_SOVER\$\$SHLIB_SUFFIX/soname=\$\$SHLIB.1/g" Makefile.shared
74
[c5c522c]75if [ "$ARCH" = "i586" ]; then
76  # Build with -march=i586 -mtune=i686:
[a1525ed]77  sed -i "/linux-elf/s/fomit-frame-pointer/fomit-frame-pointer -march=i586 -mtune=i686/g" Configure
78  LIBDIRSUFFIX=""
79elif [ "$ARCH" = "i686" ]; then
80  # Build with -march=i686 -mtune=i686:
81  sed -i "/linux-elf/s/fomit-frame-pointer/fomit-frame-pointer -march=i686 -mtune=i686/g" Configure
[c5c522c]82  LIBDIRSUFFIX=""
83elif [ "$ARCH" = "x86_64" ]; then
84  LIBDIRSUFFIX="64"
85fi
86
87# OpenSSL has a (nasty?) habit of bumping the internal version number with
88# every release.  This wouldn't be so bad, but some applications are so
89# paranoid that they won't run against a different OpenSSL version than
90# what they were compiled against, whether or not the ABI has changed.
91#
[a1525ed]92# So, we will use the OPENSSL_VERSION_NUMBER from openssl-1.0.2e unless ABI
[c5c522c]93# breakage forces it to change.  Yes, we're finally using this old trick.  :)
[a1525ed]94sed -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
[c5c522c]95
96chown -R root:root .
97mkdir -p $PKG1/usr/doc/openssl-$VERSION
98cp -a CHANGES CHANGES.SSLeay FAQ INSTALL INSTALL.MacOS INSTALL.VMS INSTALL.W32 \
99  LICENSE NEWS README README.ENGINE doc $PKG1/usr/doc/openssl-$VERSION
100find $PKG1/usr/doc/openssl-$VERSION -type d -exec chmod 755 {} \;
101find $PKG1/usr/doc/openssl-$VERSION -type f -exec chmod 644 {} \;
102
103# If there's a CHANGES file, installing at least part of the recent history
104# is useful, but don't let it get totally out of control:
105if [ -r CHANGES ]; then
106  DOCSDIR=$(echo $PKG1/usr/doc/*-$VERSION)
107  cat CHANGES | head -n 2000 > $DOCSDIR/CHANGES
108  touch -r CHANGES $DOCSDIR/CHANGES
109fi
110
111# These are the known patent issues with OpenSSL:
112# name   #         expires
[a1525ed]113# MDC-2: 4,908,861  2007-03-13, not included.
[c5c522c]114# IDEA:  5,214,703  2010-05-25, not included.
115# RC5:   5,724,428  2015-03-03, not included.
[a1525ed]116#
117# Although all of the above are expired, it's still probably
118# not a good idea to include them as there are better
119# algorithms to use.
[c5c522c]120
121./config \
122 --prefix=/usr \
123 --openssldir=/etc/ssl \
[a1525ed]124 no-mdc2 \
[c5c522c]125 no-idea \
126 no-rc5 \
127 no-sse2 \
[a1525ed]128 no-ssl2 \
129 no-weak-ssl-ciphers \
[c5c522c]130 shared
131
[a1525ed]132make $NUMJOBS depend || make depend || exit 1
[c5c522c]133
[a1525ed]134make $NUMJOBS || make || exit 1
135
136make test -j1 || exit 1
[c5c522c]137
138make install INSTALL_PREFIX=$PKG1 || exit 1
139
140# Make the .so.? library symlinks:
141( cd $PKG1/usr/lib${LIBDIRSUFFIX} ; ldconfig -l lib*.so.* )
142
143# Move libraries, as they might be needed by programs that bring a network
144# mounted /usr online:
145
146mkdir $PKG1/lib${LIBDIRSUFFIX}
147( cd $PKG1/usr/lib${LIBDIRSUFFIX}
148  for file in lib*.so.?.* ; do
149    mv $file ../../lib${LIBDIRSUFFIX}
150    ln -sf ../../lib${LIBDIRSUFFIX}/$file .
151  done
152  cp -a lib*.so.? ../../lib${LIBDIRSUFFIX}
153)
154
155# Add a cron script to warn root if a certificate is going to expire soon:
156mkdir -p $PKG1/etc/cron.daily
157zcat $CWD/certwatch.gz > $PKG1/etc/cron.daily/certwatch.new
158chmod 755 $PKG1/etc/cron.daily/certwatch.new
159
160mv $PKG1/etc/ssl/openssl.cnf $PKG1/etc/ssl/openssl.cnf.new
161
162( cd $PKG1
163  find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
164  find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
165)
166
167mv $PKG1/etc/ssl/man $PKG1/usr
[a1525ed]168# Fix manpage name collisions, and relink anything that linked to the old name:
169( cd $PKG1/usr/man/man1
170  mv passwd.1 ssl_passwd.1
171  for file in *.1 ; do
172    if [ -L $file ]; then
173      if [ "$(readlink $file)" = "passwd.1" ]; then
174        rm -f $file
175        ln -sf ssl_passwd.1 $file
176      fi
177    fi
178  done )
179( cd $PKG1/usr/man/man3
180  mv rand.3 ssl_rand.3
181  for file in *.3 ; do
182    if [ -L $file ]; then
183      if [ "$(readlink $file)" = "rand.3" ]; then
184        rm -f $file
185        ln -sf ssl_rand.3 $file
186      fi
187    fi
188  done )
189( cd $PKG1/usr/man/man3
190  mv err.3 ssl_err.3
191  for file in *.3 ; do
192    if [ -L $file ]; then
193      if [ "$(readlink $file)" = "err.3" ]; then
194        rm -f $file
195        ln -sf ssl_err.3 $file
196      fi
197    fi
198  done )
199
[c5c522c]200# Compress and symlink the man pages:
201if [ -d $PKG1/usr/man ]; then
202  ( cd $PKG1/usr/man
203    for manpagedir in $(find . -type d -name "man*") ; do
204      ( cd $manpagedir
205        for eachpage in $( find . -type l -maxdepth 1) ; do
206          ln -s $( readlink $eachpage ).gz $eachpage.gz
207          rm $eachpage
208        done
209        gzip -9 *.?
210      )
211    done
212  )
213fi
214
215# If there's an openssl0 directory, then build openssl-0 shared libraries for
216# compatibility with programs linked to those:
217if [ -d $CWD/openssl0 ]; then
218  ( cd $CWD/openssl0
219    ./openssl0.build || exit 1
220  ) || exit 1
221  # Don't put these in the openssl package...  openssl-solibs is enough.
222  #mkdir -p $PKG1/lib${LIBDIRSUFFIX}
223  #cp -a $TMP/package-openssl0/usr/lib/lib*.so.?.?.? $PKG1/lib${LIBDIRSUFFIX}
224  #( cd $PKG1/lib${LIBDIRSUFFIX} ; ldconfig -l lib*.so.?.?.? )
225  mkdir -p $PKG2/lib${LIBDIRSUFFIX}
226  cp -a $TMP/package-openssl0/usr/lib/lib*.so.?.?.? $PKG2/lib${LIBDIRSUFFIX}
227  ( cd $PKG2/lib${LIBDIRSUFFIX} ; ldconfig -l lib*.so.?.?.? )
228fi
229
230cd $PKG1
231chmod 755 usr/lib${LIBDIRSUFFIX}/pkgconfig
232sed -i -e "s#lib\$#lib${LIBDIRSUFFIX}#" usr/lib${LIBDIRSUFFIX}/pkgconfig/*.pc
233mkdir -p install
234zcat $CWD/doinst.sh-openssl.gz > install/doinst.sh
235cat $CWD/slack-desc.openssl > install/slack-desc
236/sbin/makepkg -l y -c n $TMP/${NAME1}.txz
237
238# Make runtime package:
239mkdir -p $PKG2/lib${LIBDIRSUFFIX}
240( cd lib${LIBDIRSUFFIX} ; cp -a lib*.so.* $PKG2/lib${LIBDIRSUFFIX} )
241( cd $PKG2/lib${LIBDIRSUFFIX} ; ldconfig -l * )
242mkdir -p $PKG2/etc
243( cd $PKG2/etc ; cp -a $PKG1/etc/ssl . )
244mkdir -p $PKG2/usr/doc/openssl-$VERSION
245( cd $TMP/openssl-$VERSION
246  cp -a CHANGES CHANGES.SSLeay FAQ INSTALL INSTALL.MacOS INSTALL.VMS INSTALL.W32 \
247  LICENSE NEWS README README.ENGINE $PKG2/usr/doc/openssl-$VERSION
248  # If there's a CHANGES file, installing at least part of the recent history
249  # is useful, but don't let it get totally out of control:
250  if [ -r CHANGES ]; then
251    DOCSDIR=$(echo $PKG2/usr/doc/*-$VERSION)
252    cat CHANGES | head -n 2000 > $DOCSDIR/CHANGES
253    touch -r CHANGES $DOCSDIR/CHANGES
254  fi
255)
256
257find $PKG2/usr/doc/openssl-$VERSION -type d -exec chmod 755 {} \;
258find $PKG2/usr/doc/openssl-$VERSION -type f -exec chmod 644 {} \;
259cd $PKG2
260mkdir -p install
261zcat $CWD/doinst.sh-openssl-solibs.gz > install/doinst.sh
262cat $CWD/slack-desc.openssl-solibs > install/slack-desc
263/sbin/makepkg -l y -c n $TMP/${NAME2}.txz
Note: See TracBrowser for help on using the repository browser.