aboutsummaryrefslogtreecommitdiffstats
path: root/main/nss/APKBUILD
blob: 05bdc307482ebaa6b059862d4419a9e4fef2b5eb (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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# Contributor: Łukasz Jendrysik <scadu@yandex.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=nss
pkgver=3.19.2
_ver=${pkgver//./_}
pkgrel=0
pkgdesc="Mozilla Network Security Services"
url="http://www.mozilla.org/projects/security/pki/nss/"
arch="all"
license="MPL GPL"
depends=
makedepends="nspr-dev sqlite-dev zlib-dev perl bsd-compat-headers"
subpackages="$pkgname-dev $pkgname-tools"
source="ftp://ftp.mozilla.org/pub/security/$pkgname/releases/NSS_${_ver}_RTM/src/$pkgname-$pkgver.tar.gz
	nss.pc.in
	nss-config.in
	add_spi+cacert_ca_certs.patch
	ssl-renegotiate-transitional.patch
	fix-cdefs_h.patch
	"
depends_dev="nspr-dev"

_builddir="$srcdir"/$pkgname-$pkgver
prepare() {
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done

	# Respect LDFLAGS
	sed -i -e 's/\$(MKSHLIB) -o/\$(MKSHLIB) \$(LDFLAGS) -o/g' \
		nss/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 FREEBL_NO_DEPEND=0
	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.//'`
	if [ "$CARCH" = "x86_64" ]; then
		export USE_64=1
	fi
	make -j 1 -C nss/coreconf || return 1
	make -j 1 -C nss/lib/dbm || return 1
	make -j 1 -C nss || return 1
}

package() {
	replaces="nss-dev libnss"

	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}' nss/lib/nss/nss.h `
	msg "DEBUG: $NSS_VMAJOR"
	NSS_VMINOR=`awk '/#define.*NSS_VMINOR/ {print $3}' nss/lib/nss/nss.h`
	NSS_VPATCH=`awk '/#define.*NSS_VPATCH/ {print $3}' 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 dist/*.OBJ/lib/${file} \
			"$pkgdir"/usr/lib/${file}.$minor || return 1
		ln -s $file.$minor "$pkgdir"/usr/lib/$file
	done
	install -m644 dist/*.OBJ/lib/libcrmf.a "$pkgdir"/usr/lib/ \
		|| return 1
	install -m644 dist/*.OBJ/lib/*.chk "$pkgdir"/usr/lib/ \
		|| return 1

	for file in certutil cmsutil crlutil modutil pk12util shlibsign \
			signtool signver ssltap; do
		install -m755 dist/*.OBJ/bin/${file} "$pkgdir"/usr/bin/\
			|| return 1
	done
	install -m644 dist/public/nss/*.h "$pkgdir"/usr/include/nss/ \
		|| return 1
}

dev() {
        local i= j=
        depends="$pkgname $depends_dev"

	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/nss-config "$subpkgdir"/usr/bin

        cd "$pkgdir" || return 0
        for i in usr/include usr/lib/pkgconfig usr/lib/*.a; do
                if [ -e "$pkgdir/$i" ] || [ -L "$pkgdir/$i" ]; then
                        d="$subpkgdir/${i%/*}"  # dirname $i
                        mkdir -p "$d"
                        mv "$pkgdir/$i" "$d"
                        rmdir "$pkgdir/${i%/*}" 2>/dev/null
                fi
        done

        return 0
}

tools() {
	pkgdesc="Tools for the Network Security Services"
	replaces="nss"
	mkdir -p "$subpkgdir"/usr/
	mv "$pkgdir"/usr/bin "$subpkgdir"/usr/
}

md5sums="b02ffd1e8e8ef5f8512fa02d8ca9db3d  nss-3.19.2.tar.gz
c547b030c57fe1ed8b77c73bf52b3ded  nss.pc.in
46bee81908f1e5b26d6a7a2e14c64d9f  nss-config.in
981e0df9e9cb7a9426b316f68911fb17  add_spi+cacert_ca_certs.patch
2412ff2e97b3ec452cb016f2506a0e08  ssl-renegotiate-transitional.patch
1f83bc41ffe34190bcc27d146c479772  fix-cdefs_h.patch"
sha256sums="1306663e8f61d8449ad8cbcffab743a604dcd9f6f34232c210847c51dce2c9ae  nss-3.19.2.tar.gz
b9f1428ca2305bf30b109507ff335fa00bce5a7ce0434b50acd26ad7c47dd5bd  nss.pc.in
e44ac5095b4d88f24ec7b2e6a9f1581560bd3ad41a3d198596d67ef22f67adb9  nss-config.in
592aa85184c5edb076c3355f85e50373a59dfcd06a4f4a79621f43df19404c1e  add_spi+cacert_ca_certs.patch
1a49be9d7f835be737825252f50e4ee2869228eb303a087dde7fb81794b92ebd  ssl-renegotiate-transitional.patch
41866089e3d085f05bc4a7e337f2f5740da4eef9021366a450a8fd111f24975c  fix-cdefs_h.patch"
sha512sums="d3c45010f8dace58f9da9efe0f9792f8b8a69384e100663f33c949685cdd1ce70e5131f279bc82336622841c41dbc0a4d70a7cc6839a1782dbe8b3c3fd8bc59d  nss-3.19.2.tar.gz
75dbd648a461940647ff373389cc73bc8ec609139cd46c91bcce866af02be6bcbb0524eb3dfb721fbd5b0bc68c20081ed6f7debf6b24317f2a7ba823e8d3c531  nss.pc.in
2971669e128f06a9af40a5ba88218fa7c9eecfeeae8b0cf42e14f31ed12bf6fa4c5ce60289e078f50e2669a9376b56b45d7c29d726a7eac69ebe1d1e22dc710b  nss-config.in
6e04556858499aec465d6670818465327ba2cb099061c2afee4b5cac8aa61938e0095906acfb38df6a1b70a6bde6dd69f08bb4c00a9d188e4cb3131b26c1bc16  add_spi+cacert_ca_certs.patch
c21a82247d87d74cb27575efc517a6771476320ce412cd444e83d0782e29f82552676247da093518b07d3eb7dc67c53cd1901ee8d6f59b342d02e47784c39192  ssl-renegotiate-transitional.patch
54080ed5e66185bfb9fae6518b8f898213a00a2803900ee13a958664a7e60aee60b51f0c27176344ebf49e9c671f1f62f56280ab9e8c7f206c5df143c3a7d24c  fix-cdefs_h.patch"