summaryrefslogtreecommitdiff
path: root/extra/nss/PKGBUILD
blob: 0dd8f4f2ddaa592dfd3f572db777712b91e99ccc (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
# $Id: PKGBUILD 145700 2011-12-28 10:05:27Z jgc $
# Maintainer: Jan de Groot <jgc@archlinux.org>

pkgname=nss
pkgver=3.13.1
pkgrel=2
pkgdesc="Mozilla Network Security Services"
arch=(i686 x86_64)
url="http://www.mozilla.org/projects/security/pki/nss/"
license=('MPL' 'GPL')
_nsprver=4.8.9
depends=("nspr>=${_nsprver}" 'sqlite3' 'zlib' 'sh')
makedepends=('perl')
replaces=('nss-nspr')
options=('!strip')
source=(ftp://ftp.mozilla.org/pub/security/nss/releases/NSS_${pkgver//./_}_WITH_CKBI_1_88_RTM/src/${pkgname}-${pkgver}.with.ckbi.1.88.tar.gz
        bug702090.patch
        nss-no-rpath.patch
        nss.pc.in
        nss-config.in
        add_spi+cacert_ca_certs.patch
        ssl-renegotiate-transitional.patch)
sha1sums=('ebc0258c8d1a3c2fe80941bd991b766552464fc6'
          '057dd510ba567d344e705062436a786beb5592b6'
          'c8fcdb153af9d39689243119adb475905a657284'
          'aa5b2c0aa38d3c1066d511336cf28d1333e3aebd'
          'cb744cc3e56b604e4754bc3c7d9f25bb9a0a136c'
          '11e4980911a1fe7142264e9b783b89abdc750c5d'
          '8a964a744ba098711b80c0d279a2993524e8eb92')

build() {
  cd "${srcdir}/${pkgname}-${pkgver}/mozilla"
  patch -Np2 -i "${srcdir}/bug702090.patch"
  # Adds the SPI Inc. and CAcert.org CA certificates - patch from Debian, modified to apply on certdata.txt only
  patch -Np2 -i "${srcdir}/add_spi+cacert_ca_certs.patch"
  # Adds transitional SSL renegotiate support - patch from Debian
  patch -Np2 -i "${srcdir}/ssl-renegotiate-transitional.patch"
  # Removes rpath
  patch -Np2 -i "${srcdir}/nss-no-rpath.patch"

  # Respect LDFLAGS
  sed -e 's/\$(MKSHLIB) -o/\$(MKSHLIB) \$(LDFLAGS) -o/g' \
      -i security/coreconf/rules.mk

  # Generate certdata.c from certdata.txt
  cd security/nss/lib/ckfw/builtins
  make generate

  cd "${srcdir}/${pkgname}-${pkgver}"
  export BUILD_OPT=1
  export PKG_CONFIG_ALLOW_SYSTEM_LIBS=1
  export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1
  export NSS_USE_SYSTEM_SQLITE=1
  export NSPR_INCLUDE_DIR=`pkg-config --cflags-only-I nspr | sed 's/-I//'`
  export NSPR_LIB_DIR=`pkg-config --libs-only-L nspr | sed 's/-L.//'`
  export XCFLAGS="${CFLAGS}"

  [ "$CARCH" = "x86_64" ] && export USE_64=1

  make -j 1 -C mozilla/security/coreconf
  make -j 1 -C mozilla/security/dbm
  make -j 1 -C mozilla/security/nss
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  install -m755 -d "${pkgdir}/usr/lib/pkgconfig"
  install -m755 -d "${pkgdir}/usr/bin"
  install -m755 -d "${pkgdir}/usr/include/nss"

  NSS_VMAJOR=`grep "#define.*NSS_VMAJOR" mozilla/security/nss/lib/nss/nss.h | awk '{print $3}'`
  NSS_VMINOR=`grep "#define.*NSS_VMINOR" mozilla/security/nss/lib/nss/nss.h | awk '{print $3}'`
  NSS_VPATCH=`grep "#define.*NSS_VPATCH" mozilla/security/nss/lib/nss/nss.h | awk '{print $3}'`

  sed "${srcdir}/nss.pc.in" -e "s,%libdir%,/usr/lib,g" \
  				-e "s,%prefix%,/usr,g" \
				-e "s,%exec_prefix%,/usr/bin,g" \
				-e "s,%includedir%,/usr/include/nss,g" \
				-e "s,%NSPR_VERSION%,${pkgver},g" \
				-e "s,%NSS_VERSION%,${pkgver},g" > \
			"${pkgdir}/usr/lib/pkgconfig/nss.pc"
  ln -sf nss.pc "${pkgdir}/usr/lib/pkgconfig/mozilla-nss.pc"
  chmod 644 ${pkgdir}/usr/lib/pkgconfig/*.pc

  sed "${srcdir}/nss-config.in" -e "s,@libdir@,/usr/lib,g" \
  				    -e "s,@prefix@,/usr/bin,g" \
				    -e "s,@exec_prefix@,/usr/bin,g" \
				    -e "s,@includedir@,/usr/include/nss,g" \
				    -e "s,@MOD_MAJOR_VERSION@,${NSS_VMAJOR},g" \
				    -e "s,@MOD_MINOR_VERSION@,${NSS_VMINOR},g" \
				    -e "s,@MOD_PATCH_VERSION@,${NSS_VPATCH},g" \
			    > "${pkgdir}/usr/bin/nss-config"
  chmod 755 "${pkgdir}/usr/bin/nss-config"

  for file in libsoftokn3.so libfreebl3.so libnss3.so libnssutil3.so \
              libssl3.so libsmime3.so libnssckbi.so libnssdbm3.so
  do
    install -m755 mozilla/dist/*.OBJ/lib/${file} "${pkgdir}/usr/lib/"
  done

  install -m644 mozilla/dist/*.OBJ/lib/libcrmf.a "${pkgdir}/usr/lib/"
  install -m644 mozilla/dist/*.OBJ/lib/*.chk "${pkgdir}/usr/lib/"

  for file in certutil cmsutil crlutil modutil pk12util shlibsign signtool signver ssltap; do
    install -m755 mozilla/dist/*.OBJ/bin/${file} "${pkgdir}/usr/bin/"
  done

  install -m644 mozilla/dist/public/nss/*.h "${pkgdir}/usr/include/nss/"
}