source: npl/overig/mozilla_nss/mozilla-nss.SlackBuild.orig

Last change on this file was 9e573a2, checked in by Edwin Eefting <edwin@datux.nl>, 3 years ago

fix network checks and log issue when hostname has -

  • Property mode set to 100644
File size: 6.1 KB
Line 
1#!/bin/bash
2# Copyright 2005, 2006, 2008, 2009, 2010, 2012  Eric Hameleers, Eindhoven, NL
3# Copyright 2013, 2014, 2015, 2017, 2018, 2019  Patrick J. Volkerding, Sebeka, MN, USA
4# All rights reserved.
5#
6#   Permission to use, copy, modify, and distribute this software for
7#   any purpose with or without fee is hereby granted, provided that
8#   the above copyright notice and this permission notice appear in all
9#   copies.
10#
11#   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
12#   WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
13#   MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
14#   IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
15#   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
16#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
17#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
18#   USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
19#   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
20#   OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
21#   OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
22#   SUCH DAMAGE.
23# -----------------------------------------------------------------------------
24
25cd $(dirname $0) ; CWD=$(pwd)
26
27PKGNAM=mozilla-nss
28SRCNAM=nss
29VERSION=${VERSION:-3.50}
30NSPR=${NSPR:-4.25}
31BUILD=${BUILD:-1}
32
33# Automatically determine the architecture we're building on:
34MARCH=$( uname -m )
35if [ -z "$ARCH" ]; then
36  case "$MARCH" in
37    i?86)    export ARCH=i586 ;;
38    armv7hl) export ARCH=$MARCH ;;
39    arm*)    export ARCH=arm ;;
40    # Unless $ARCH is already set, use uname -m for all other archs:
41    *)       export ARCH=$MARCH ;;
42  esac
43fi
44
45# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
46# the name of the created package would be, and then exit. This information
47# could be useful to other scripts.
48if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
49  echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
50  exit 0
51fi
52
53if [ "$ARCH" = "i586" ]; then
54  SLKCFLAGS="-O2 -march=i586 -mtune=i686"
55  LIBDIRSUFFIX=""
56elif [ "$ARCH" = "x86_64" ]; then
57  SLKCFLAGS="-O2 -fPIC"
58  LIBDIRSUFFIX="64"
59  export USE_64=1
60elif [ "$ARCH" = "armv7hl" ]; then
61  SLKCFLAGS="-O2 -march=armv7-a -mfpu=vfpv3-d16"
62  LIBDIRSUFFIX=""
63else
64  SLKCFLAGS="-O2"
65  LIBDIRSUFFIX=""
66fi
67
68TMP=${TMP:-/tmp}
69PKG=$TMP/package-$PKGNAM
70
71# Seems parallel build does not work with this.
72#NUMJOBS=${NUMJOBS:-" -j$(expr $(nproc) + 1) "}
73
74rm -rf $PKG
75mkdir -p $TMP $PKG
76
77cd $TMP
78rm -rf nss-${VERSION}
79rm -rf nspr-${NSPR}
80tar xvf $CWD/nss-$VERSION.tar.?z || exit 1
81cd nss-$VERSION
82tar xvf $CWD/nspr-$NSPR.tar.?z || exit 1
83mv nspr*/nspr .
84
85# -Werror is problematic with gcc7:
86sed -i "s|\ -Werror| |" nss/coreconf/Werror.mk || exit 1
87
88# Make sure ownerships and permissions are sane:
89chown -R root:root .
90find . \
91  \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
92  -exec chmod 755 {} \+ -o \
93  \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
94  -exec chmod 644 {} \+
95
96echo Building ...
97export LDFLAGS="-lz"
98export CFLAGS="$SLKCFLAGS"
99export CXXFLAGS="$SLKCFLAGS"
100export BUILD_OPT=1
101export NSDISTMODE="copy"
102export NSS_USE_SYSTEM_SQLITE=1
103export NSS_ENABLE_ECC=1
104cd nss
105  # Seems parallel build does not work with this.
106  #make $NUMJOBS nss_build_all export || exit 1
107  make nss_build_all export || exit 1
108cd -
109
110# Install all the needed stuff to the package dir:
111mkdir -p $PKG/usr/{bin,lib${LIBDIRSUFFIX},include/{nss,nspr}}
112cd dist/$(uname -s)*
113  cp -pL bin/{certutil,cmsutil,crlutil,modutil,pk12util,shlibsign,signtool,signver,ssltap} $PKG/usr/bin/
114  cp -pL lib/* $PKG/usr/lib${LIBDIRSUFFIX}/
115  chmod 755 $PKG/usr/lib${LIBDIRSUFFIX}/*.so*
116  cp -rL include/* $PKG/usr/include/nspr/
117  cp -rpL ../public/nss/*.h $PKG/usr/include/nss/
118  # Remove some things we do not need:
119  rm -f $PKG/usr/bin/*.so
120  rm -f $PKG/usr/lib${LIBDIRSUFFIX}/*.a
121  rm -rf $PKG/usr/include/nspr/md
122  cp -L lib/libcrmf.a $PKG/usr/lib${LIBDIRSUFFIX}/ # yes, put this one back
123cd -
124
125cd nss/cmd/smimetools
126  cp -a smime $PKG/usr/bin/
127  chmod 0755 $PKG/usr/bin/smime
128  sed -i -e 's#/usr/local/bin#/usr/bin#g' $PKG/usr/bin/smime
129cd -
130
131# Install nspr-config:
132cat nspr/$(uname -s)*/config/nspr-config | sed -e "s,prefix=/usr/local,prefix=/usr,g" | sed -e "s,libdir=\${exec_prefix}/lib,libdir=\${exec_prefix}/lib${LIBDIRSUFFIX},g" > $PKG/usr/bin/nspr-config
133chmod 755 $PKG/usr/bin/nspr-config
134
135# Install nss-config:
136#sed -e "s,@prefix@,/usr,g" \
137#    -e "s,@MOD_MAJOR_VERSION@,$(printf $VERSION | cut -d. -f1),g" \
138#    -e "s,@MOD_MINOR_VERSION@,$(printf $VERSION | cut -d. -f2),g" \
139#    -e "s,@MOD_PATCH_VERSION@,$(printf $VERSION | cut -d. -f3),g" \
140#    $CWD/nss-config.in > $PKG/usr/bin/nss-config
141#chmod 755 $PKG/usr/bin/nss-config
142
143# Provide pkg-config files:
144mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/pkgconfig
145cat <<EOT > $PKG/usr/lib${LIBDIRSUFFIX}/pkgconfig/mozilla-nss.pc
146prefix=/usr
147exec_prefix=\${prefix}
148libdir=/usr/lib${LIBDIRSUFFIX}
149includedir=\${prefix}/include/nss
150
151Name: NSS
152Description: Network Security Services
153Version: $VERSION
154Requires: nspr >= $NSPR sqlite3
155Libs: -L\${libdir} -lnss3 -lsmime3 -lssl3 -lsoftokn3  -lnssutil3
156Cflags: -I\${includedir}
157EOT
158cat <<EOT > $PKG/usr/lib${LIBDIRSUFFIX}/pkgconfig/mozilla-nspr.pc
159prefix=/usr
160exec_prefix=\${prefix}
161libdir=/usr/lib${LIBDIRSUFFIX}
162includedir=\${prefix}/include/nspr
163
164Name: NSPR
165Description: The Netscape Portable Runtime
166Version: $NSPR
167Libs: -L\${libdir} -lplds4 -lplc4 -lnspr4
168Cflags: -I\${includedir}
169EOT
170
171( cd $PKG/usr/lib${LIBDIRSUFFIX}/pkgconfig
172  ln -s mozilla-nspr.pc nspr.pc
173  ln -s mozilla-nss.pc nss.pc
174)
175
176# Add documentation:
177#mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION
178#cp -a \
179#  $CWD/MPL-1.1.txt $CWD/gpl-2.0.txt $CWD/lgpl-2.1.txt \
180#  $CWD/faq.html \
181#  $PKG/usr/doc/$PKGNAM-$VERSION
182#chown -R root:root $PKG/usr/doc/$PKGNAM-$VERSION
183
184# Strip binaries:
185find $PKG | xargs file | grep -e "executable" -e "shared object" \
186  | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
187
188# Add a package description:
189mkdir -p $PKG/install
190cat $CWD/slack-desc > $PKG/install/slack-desc
191
192# Build the package:
193cd $PKG
194/sbin/makepkg -l y -c n $TMP/${PKGNAM}-${VERSION}-${ARCH}-${BUILD}.txz
195
Note: See TracBrowser for help on using the repository browser.