summaryrefslogtreecommitdiffstats
path: root/main/nss/APKBUILD
blob: c795669ea79b60f859a9d4f29673d117f883559f (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
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=nss
pkgver=3.12.6
_ver=3_12_6
pkgrel=0
pkgdesc="Mozilla Network Security Services"
url="http://www.mozilla.org/projects/security/pki/nss/"
license="MPL GPL"
depends=
makedepends="nspr-dev sqlite-dev zlib-dev perl"
subpackages="$pkgname-dev libnss"
source="ftp://ftp.mozilla.org/pub/security/$pkgname/releases/NSS_${_ver}_RTM/src/$pkgname-$pkgver.tar.gz
	nss-nolocalsql.patch
	nss-no-rpath.patch
	nss.pc.in
	nss-config.in
	add_spi+cacert_ca_certs.patch
	ssl-renegotiate-transitional.patch"
depends_dev="nspr-dev"

_builddir="$srcdir"/$pkgname-$pkgver
prepare() { 
	cd "$_builddir"
	patch -Np1 -i ""$srcdir"/add_spi+cacert_ca_certs.patch" || return 1
	patch -Np1 -i ""$srcdir"/ssl-renegotiate-transitional.patch" || return 1
	patch -Np0 -i ""$srcdir"/nss-nolocalsql.patch" || return 1
	patch -Np0 -i ""$srcdir"/nss-no-rpath.patch" || return 1

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

}

build() { 
	cd "$_builddir"
	unset CFLAGS
	unset CXXFLAGS
	export BUILD_OPT=1
	export PKG_CONFIG_ALLOW_SYSTEM_LIBS=1
	export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=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}"
	make -j 1 -C mozilla/security/coreconf || return 1
	make -j 1 -C mozilla/security/dbm || return 1
	make -j 1 -C mozilla/security/nss || return 1
}

package() {
	cd "$_builddir"
	install -m755 -d "$pkgdir"/usr/lib/pkgconfig
	install -m755 -d "$pkgdir"/usr/bin
	install -m755 -d "$pkgdir"/usr/include/nss

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

	# pkgconfig files
	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 \
		|| return 1
	ln -sf nss.pc "$pkgdir"/usr/lib/pkgconfig/mozilla-nss.pc || return 1
	chmod 644 "$pkgdir"/usr/lib/pkgconfig/*.pc || return 1

	# nss-config
	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 || return 1
	chmod 755 "$pkgdir"/usr/bin/nss-config || return 1
	local minor=${pkgver#*.}
	minor=${minor%.*}
	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/${file}.$minor || return 1
		ln -s $file.$minor "$pkgdir"/usr/lib/$file
	done
	install -m644 mozilla/dist/*.OBJ/lib/libcrmf.a "$pkgdir"/usr/lib/ \
		|| return 1
	install -m644 mozilla/dist/*.OBJ/lib/*.chk "$pkgdir"/usr/lib/ \
		|| return 1
	
	for file in certutil cmsutil crlutil modutil pk12util shlibsign \
			signtool signver ssltap; do
		install -m755 mozilla/dist/*.OBJ/bin/${file} "$pkgdir"/usr/bin/\
			|| return 1
	done
	install -m644 mozilla/dist/public/nss/*.h "$pkgdir"/usr/include/nss/ \
		|| return 1
}

libnss() {
	pkgdesc="Mozilla Network Security Service libraries"
	mkdir -p "$subpkgdir"/usr/
	mv "$pkgdir"/usr/lib "$subpkgdir"/usr
}

md5sums="da42596665f226de5eb3ecfc1ec57cd1  nss-3.12.6.tar.gz
1d8305dc458d28c6f32746d9132b9873  nss-nolocalsql.patch
e5c97db0c884d5f4cfda21e562dc9bba  nss-no-rpath.patch
c547b030c57fe1ed8b77c73bf52b3ded  nss.pc.in
46bee81908f1e5b26d6a7a2e14c64d9f  nss-config.in
a744b499e7da252acd9ac8ff09af3d48  add_spi+cacert_ca_certs.patch
d83c7b61abb7e9f8f7bcd157183d1ade  ssl-renegotiate-transitional.patch"