aboutsummaryrefslogtreecommitdiff
path: root/network/libressl/libressl.SlackBuild
blob: 6242e41b1ec8d2aa7e2b49dd8934d0ad735137f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/bin/bash

# slackbuild script for libressl by D Woodfall
#
# WTFPL licence

cd $(dirname $0) ; CWD=$(pwd)

PRGNAM=libressl
VERSION=${VERSION:-3.7.0}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}

if [ -z "$ARCH" ]; then
  case "$( uname -m )" in
    i?86) ARCH=i586 ;;
    arm*) ARCH=arm ;;
       *) ARCH=$( uname -m ) ;;
  esac
fi

if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  exit 0
fi

TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

if [ "$ARCH" = "i586" ]; then
  SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
  SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2 -fPIC"
  LIBDIRSUFFIX="64"
else
  SLKCFLAGS="-O2"
  LIBDIRSUFFIX=""
fi

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
find . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} + \
 -o \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} +

if [ "${MANPAGES:-no}" = no ]; then
  sed -i '/man\/Makefile/d' configure.ac
  autoreconf -f
  sed -i "s, man , ,g; s, install-man , ,g" Makefile.in
fi

PREFIX=/opt/$PRGNAM

CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
  --enable-nc \
  --disable-tests \
  --disable-static \
  --prefix=$PREFIX \
  --libdir=$PREFIX/lib${LIBDIRSUFFIX} \
  --sysconfdir=$PREFIX/etc \
  --mandir=$PREFIX/man \
  --docdir=/usr/doc/$PRGNAM-$VERSION \
  --build=$ARCH-slackware-linux

make
make install DESTDIR=$PKG

rm -f $PKG$PREFIX/{,usr/}lib${LIBDIRSUFFIX}/*.la

mkdir -p $PKG/usr/bin
( cd $PKG/usr/bin ; ln -sf ../..$PREFIX/bin/nc nc-tls )
( cd $PKG/usr/bin ; ln -sf ../..$PREFIX/bin/openssl libre-openssl )
( cd $PKG/usr/bin ; ln -sf ../..$PREFIX/bin/ocspcheck libre-ocspcheck )

mv $PKG$PREFIX/man/man1/nc.1 $PKG$PREFIX/man/man1/nc-tls.1
mv $PKG$PREFIX/man/man1/openssl.1 $PKG$PREFIX/man/man1/libre-openssl.1
mv $PKG$PREFIX/man/man8/ocspcheck.8 $PKG$PREFIX/man/man8/libre-ocspcheck.8

find $PKG$PREFIX/man -type f -exec gzip -9 {} \;
for i in $( find $PKG$PREFIX/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done

mkdir -p $PKG/etc/ld.so.conf.d/
echo $PREFIX/lib${LIBDIRSUFFIX} > $PKG/etc/ld.so.conf.d/$PRGNAM.conf

find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a \
  COPYING ChangeLog README.md \
  $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/README > $PKG/usr/doc/$PRGNAM-$VERSION/README
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
cat $CWD/$PRGNAM-$VERSION-relnotes.txt > \
  $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM-$VERSION-relnotes.txt

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh
cat $CWD/douninst.sh > $PKG/install/douninst.sh

cd $PKG
find . -type l \
  -printf '( cd %h ; rm -rf %f )\n( cd %h ; ln -sf %l %f )\n' -delete | \
  sed 's,cd \./,cd ,' >> $PKG/install/doinst.sh
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE