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

perl-5.22
Last change on this file since cbeb6d3 was c5c522c, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

initial commit, transferred from cleaned syn3 svn tree

  • Property mode set to 100755
File size: 5.7 KB
Line 
1#!/bin/sh
2# Copyright 2005, 2006, 2008, 2009, 2010, 2012  Eric Hameleers, Eindhoven, NL
3# Copyright 2013, 2014, 2015  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
25PKGNAM=mozilla-nss
26SRCNAM=nss
27VERSION=${VERSION:-3.23}
28NSPR=${NSPR:-4.12}
29BUILD=${BUILD:-1}
30
31# Automatically determine the architecture we're building on:
32MARCH=$( uname -m )
33if [ -z "$ARCH" ]; then
34  case "$MARCH" in
35    i?86)    export ARCH=i586 ;;
36    armv7hl) export ARCH=$MARCH ;;
37    arm*)    export ARCH=arm ;;
38    # Unless $ARCH is already set, use uname -m for all other archs:
39    *)       export ARCH=$MARCH ;;
40  esac
41fi
42
43if [ "$ARCH" = "i586" ]; then
44  SLKCFLAGS="-O2 -march=i586 -mtune=i686"
45  LIBDIRSUFFIX=""
46elif [ "$ARCH" = "x86_64" ]; then
47  SLKCFLAGS="-O2 -fPIC"
48  LIBDIRSUFFIX="64"
49  export USE_64=1
50elif [ "$ARCH" = "armv7hl" ]; then
51  SLKCFLAGS="-O2 -march=armv7-a -mfpu=vfpv3-d16"
52  LIBDIRSUFFIX=""
53else
54  SLKCFLAGS="-O2"
55  LIBDIRSUFFIX=""
56fi
57
58CWD=$(pwd)
59TMP=${TMP:-/tmp}
60PKG=$TMP/package-$PKGNAM
61
62# Seems parallel build does not work with this.
63#NUMJOBS=${NUMJOBS:-" -j7 "}
64
65rm -rf $PKG
66mkdir -p $TMP $PKG
67
68cd $TMP
69rm -rf nss-${VERSION}
70rm -rf nspr-${NSPR}
71tar xvf $CWD/nss-$VERSION.tar.?z* || exit 1
72cd nss-$VERSION
73tar xvf $CWD/nspr-$NSPR.tar.?z* || exit 1
74mv nspr*/nspr .
75
76# Make sure ownerships and permissions are sane:
77chown -R root:root .
78find . \
79  \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
80  -exec chmod 755 {} \; -o \
81  \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
82  -exec chmod 644 {} \;
83
84echo Building ...
85export LDFLAGS="-lz"
86export CFLAGS="$SLKCFLAGS"
87export CXXFLAGS="$SLKCFLAGS"
88export BUILD_OPT=1
89export NSDISTMODE="copy"
90export NSS_USE_SYSTEM_SQLITE=1
91export NSS_ENABLE_ECC=1
92cd nss
93  # Seems parallel build does not work with this.
94  #make $NUMJOBS nss_build_all export
95  make nss_build_all export
96cd -
97
98# Install all the needed stuff to the package dir:
99mkdir -p $PKG/usr/{bin,lib${LIBDIRSUFFIX},include/{nss,nspr}}
100cd dist/$(uname -s)*
101  cp -pL bin/{certutil,cmsutil,crlutil,modutil,pk12util,shlibsign,signtool,signver,ssltap} $PKG/usr/bin/
102  cp -pL lib/* $PKG/usr/lib${LIBDIRSUFFIX}/
103  chmod 755 $PKG/usr/lib${LIBDIRSUFFIX}/*.so*
104  cp -rL include/* $PKG/usr/include/nspr/
105  cp -rpL ../public/nss/*.h $PKG/usr/include/nss/
106  # Remove some things we do not need:
107  rm -f $PKG/usr/bin/*.so
108  rm -f $PKG/usr/lib${LIBDIRSUFFIX}/*.a
109  rm -rf $PKG/usr/include/nspr/md
110  cp -L lib/libcrmf.a $PKG/usr/lib${LIBDIRSUFFIX}/ # yes, put this one back
111cd -
112
113cd nss/cmd/smimetools
114  cp -a smime $PKG/usr/bin/
115  chmod 0755 $PKG/usr/bin/smime
116  sed -i -e 's#/usr/local/bin#/usr/bin#g' $PKG/usr/bin/smime
117cd -
118
119# Install nspr-config:
120cat 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
121chmod 755 $PKG/usr/bin/nspr-config
122
123# Install nss-config:
124sed -e "s,@prefix@,/usr,g" \
125    -e "s,@MOD_MAJOR_VERSION@,$(printf $VERSION | cut -d. -f1),g" \
126    -e "s,@MOD_MINOR_VERSION@,$(printf $VERSION | cut -d. -f2),g" \
127    -e "s,@MOD_PATCH_VERSION@,$(printf $VERSION | cut -d. -f3),g" \
128    $CWD/nss-config.in > $PKG/usr/bin/nss-config
129chmod 755 $PKG/usr/bin/nss-config
130
131# Provide pkg-config files:
132mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/pkgconfig
133cat <<EOT > $PKG/usr/lib${LIBDIRSUFFIX}/pkgconfig/mozilla-nss.pc
134prefix=/usr
135exec_prefix=\${prefix}
136libdir=/usr/lib${LIBDIRSUFFIX}
137includedir=\${prefix}/include/nss
138
139Name: NSS
140Description: Network Security Services
141Version: $VERSION
142Requires: nspr >= $NSPR sqlite3
143Libs: -L\${libdir} -lnss3 -lsmime3 -lssl3 -lsoftokn3  -lnssutil3
144Cflags: -I\${includedir}
145EOT
146cat <<EOT > $PKG/usr/lib${LIBDIRSUFFIX}/pkgconfig/mozilla-nspr.pc
147prefix=/usr
148exec_prefix=\${prefix}
149libdir=/usr/lib${LIBDIRSUFFIX}
150includedir=\${prefix}/include/nspr
151
152Name: NSPR
153Description: The Netscape Portable Runtime
154Version: $NSPR
155Libs: -L\${libdir} -lplds4 -lplc4 -lnspr4
156Cflags: -I\${includedir}
157EOT
158
159( cd $PKG/usr/lib${LIBDIRSUFFIX}/pkgconfig
160  ln -s mozilla-nspr.pc nspr.pc
161  ln -s mozilla-nss.pc nss.pc
162)
163
164# Add documentation:
165mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION
166cp -a \
167  $CWD/MPL-1.1.txt $CWD/gpl-2.0.txt $CWD/lgpl-2.1.txt \
168  $CWD/faq.html \
169  $PKG/usr/doc/$PKGNAM-$VERSION
170chown -R root:root $PKG/usr/doc/$PKGNAM-$VERSION
171
172# Strip binaries:
173find $PKG | xargs file | grep -e "executable" -e "shared object" \
174  | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
175
176# Add a package description:
177mkdir -p $PKG/install
178cat $CWD/slack-desc > $PKG/install/slack-desc
179
180# Build the package:
181cd $PKG
182/sbin/makepkg -l y -c n $TMP/${PKGNAM}-${VERSION}-${ARCH}-${BUILD}.txz
183
Note: See TracBrowser for help on using the repository browser.