APKBUILD 5.36 KB
Newer Older
1
# Contributor: Łukasz Jendrysik <scadu@yandex.com>
Natanael Copa's avatar
Natanael Copa committed
2 3
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=nss
J0WI's avatar
J0WI committed
4
pkgver=3.45
5
_ver=${pkgver//./_}
J0WI's avatar
J0WI committed
6
pkgrel=0
Natanael Copa's avatar
Natanael Copa committed
7
pkgdesc="Mozilla Network Security Services"
8
url="https://developer.mozilla.org/docs/Mozilla/Projects/NSS"
9
arch="all"
Natanael Copa's avatar
Natanael Copa committed
10
license="MPL GPL"
11
options="!check" # failing tests
Natanael Copa's avatar
Natanael Copa committed
12
depends=
13
depends_dev="nspr-dev"
14
makedepends="nspr-dev sqlite-dev zlib-dev perl bsd-compat-headers linux-headers"
15
subpackages="$pkgname-static $pkgname-dev $pkgname-tools"
16
source="https://ftp.mozilla.org/pub/security/$pkgname/releases/NSS_${pkgver//./_}_RTM/src/$pkgname-$pkgver.tar.gz
Natanael Copa's avatar
Natanael Copa committed
17
	nss.pc.in
18 19
	nss-util.pc.in
	nss-softokn.pc.in
Natanael Copa's avatar
Natanael Copa committed
20 21
	nss-config.in
	add_spi+cacert_ca_certs.patch
22
	"
23
builddir="$srcdir/$pkgname-$pkgver"
Natanael Copa's avatar
Natanael Copa committed
24

25
# secfixes:
Tim Brust's avatar
Tim Brust committed
26 27
#   3.41-r0:
#   - CVE-2018-12404
28 29 30
#   3.39-r0:
#   - CVE-2018-12384

31
prepare() {
TBK's avatar
TBK committed
32
	default_prepare
Natanael Copa's avatar
Natanael Copa committed
33 34 35

	# Respect LDFLAGS
	sed -i -e 's/\$(MKSHLIB) -o/\$(MKSHLIB) \$(LDFLAGS) -o/g' \
36
		"$builddir"/nss/coreconf/rules.mk
Natanael Copa's avatar
Natanael Copa committed
37 38
}

39
build() {
40
	cd "$builddir"
Natanael Copa's avatar
Natanael Copa committed
41 42 43 44 45
	unset CFLAGS
	unset CXXFLAGS
	export BUILD_OPT=1
	export PKG_CONFIG_ALLOW_SYSTEM_LIBS=1
	export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1
46
	export FREEBL_NO_DEPEND=0
47
	export NSS_USE_SYSTEM_SQLITE=1
48
	export NSS_ENABLE_WERROR=0
Natanael Copa's avatar
Natanael Copa committed
49 50
	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.//'`
51
	case "$CARCH" in
52
		*64* | s390x) export USE_64=1;;
53
	esac
TBK's avatar
TBK committed
54 55 56
	make -j 1 -C nss/coreconf
	make -j 1 -C nss/lib/dbm
	make -j 1 -C nss
Natanael Copa's avatar
Natanael Copa committed
57 58
}

59 60 61 62
check() {
	HOST=localhost DOMSUF=localdomain sh "$builddir/nss/tests/all.sh"
}

Natanael Copa's avatar
Natanael Copa committed
63
package() {
64
	replaces="nss-dev libnss"
65

66
	cd "$builddir"
67

Natanael Copa's avatar
Natanael Copa committed
68 69
	install -m755 -d "$pkgdir"/usr/lib/pkgconfig
	install -m755 -d "$pkgdir"/usr/bin
70
	install -m755 -d "$pkgdir"/usr/include/nss/private
Natanael Copa's avatar
Natanael Copa committed
71

72
	NSS_VMAJOR=`awk '/#define.*NSS_VMAJOR/ {print $3}' nss/lib/nss/nss.h `
Natanael Copa's avatar
Natanael Copa committed
73
	msg "DEBUG: $NSS_VMAJOR"
74
	NSS_VMINOR=`awk '/#define.*NSS_VMINOR/ {print $3}' nss/lib/nss/nss.h`
75
	NSS_VPATCH=`awk '/#define.*NSS_VPATCH/ {print $3}' nss/lib/nss/nss.h`
Natanael Copa's avatar
Natanael Copa committed
76 77

	# pkgconfig files
78 79 80 81 82 83 84 85 86 87
	local _pc; for _pc in nss.pc nss-util.pc nss-softokn.pc; do
		sed "$srcdir"/${_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,%SOFTOKEN_VERSION%,$pkgver,g" \
			-e "s,%NSPR_VERSION%,$pkgver,g" \
			-e "s,%NSS_VERSION%,$pkgver,g" \
			-e "s,%NSSUTIL_VERSION%,$pkgver,g" \
TBK's avatar
TBK committed
88
			> "$pkgdir"/usr/lib/pkgconfig/${_pc}
89
	done
TBK's avatar
TBK committed
90 91
	ln -sf nss.pc "$pkgdir"/usr/lib/pkgconfig/mozilla-nss.pc
	chmod 644 "$pkgdir"/usr/lib/pkgconfig/*.pc
Natanael Copa's avatar
Natanael Copa committed
92 93 94 95 96 97 98 99 100 101

	# 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" \
TBK's avatar
TBK committed
102 103
		> "$pkgdir"/usr/bin/nss-config
	chmod 755 "$pkgdir"/usr/bin/nss-config
104
	local minor=${pkgver#*.}
Natanael Copa's avatar
Natanael Copa committed
105
	minor=${minor%.*}
106 107
	for file in $(find dist/*.OBJ/lib -name "*.so"); do
		install -m755 $file \
TBK's avatar
TBK committed
108
			"$pkgdir"/usr/lib/${file##*/}.$minor
109
		ln -s ${file##*/}.$minor "$pkgdir"/usr/lib/${file##*/}
Natanael Copa's avatar
Natanael Copa committed
110
	done
TBK's avatar
TBK committed
111 112
	install -m644 dist/*.OBJ/lib/*.a "$pkgdir"/usr/lib/
	install -m644 dist/*.OBJ/lib/*.chk "$pkgdir"/usr/lib/
113

Natanael Copa's avatar
Natanael Copa committed
114 115
	for file in certutil cmsutil crlutil modutil pk12util shlibsign \
			signtool signver ssltap; do
TBK's avatar
TBK committed
116
		install -m755 dist/*.OBJ/bin/${file} "$pkgdir"/usr/bin/
Natanael Copa's avatar
Natanael Copa committed
117
	done
TBK's avatar
TBK committed
118 119
	install -m644 dist/public/nss/*.h "$pkgdir"/usr/include/nss/
	install -m644 dist/private/nss/blapi.h dist/private/nss/alghmac.h "$pkgdir"/usr/include/nss/private/
Natanael Copa's avatar
Natanael Copa committed
120 121
}

122 123 124 125
static() {
	pkgdesc="Static libraries for nss"
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/*.a "$subpkgdir"/usr/lib/
126 127 128

	# remove libssl.a which conflicts with libressl
	rm "$subpkgdir"/usr/lib/libssl.a
129
}
130

131
dev() {
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
	# we cannot use default_dev because we need the .so symlinks in main package
	local i= j=
	pkgdesc="Development files for nss"
	depends="$pkgname $depends_dev"

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

	cd "$pkgdir"
	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 || true
		fi
	done
149 150
	mv "$pkgdir"/usr/lib/libgtest1.* "$pkgdir"/usr/lib/libnsssysinit.* \
		"$subpkgdir"/usr/lib
151 152
}

153 154 155
tools() {
	pkgdesc="Tools for the Network Security Services"
	replaces="nss"
Natanael Copa's avatar
Natanael Copa committed
156
	mkdir -p "$subpkgdir"/usr/
157
	mv "$pkgdir"/usr/bin "$subpkgdir"/usr/
Natanael Copa's avatar
Natanael Copa committed
158 159
}

J0WI's avatar
J0WI committed
160
sha512sums="33360a1bb4e0a0a974070c354ee82c515d5cfa2a12c9c96817a9fdb3e4ca1ad62eb95886b9b0d60e2f69efda964376d0671c1e3c920b2ea614aeecb719c6ff29  nss-3.45.tar.gz
161
75dbd648a461940647ff373389cc73bc8ec609139cd46c91bcce866af02be6bcbb0524eb3dfb721fbd5b0bc68c20081ed6f7debf6b24317f2a7ba823e8d3c531  nss.pc.in
Timo Teräs's avatar
Timo Teräs committed
162 163
0f2efa8563b11da68669d281b4459289a56f5a3a906eb60382126f3adcfe47420cdcedc6ab57727a3afeeffa2bbb4c750b43bef8b5f343a75c968411dfa30e09  nss-util.pc.in
09c69d4cc39ec9deebc88696a80d0f15eb2d8c94d9daa234a2adfec941b63805eb4ce7f2e1943857b938bddcaee1beac246a0ec627b71563d9f846e6119a4a15  nss-softokn.pc.in
164
2971669e128f06a9af40a5ba88218fa7c9eecfeeae8b0cf42e14f31ed12bf6fa4c5ce60289e078f50e2669a9376b56b45d7c29d726a7eac69ebe1d1e22dc710b  nss-config.in
165
6e04556858499aec465d6670818465327ba2cb099061c2afee4b5cac8aa61938e0095906acfb38df6a1b70a6bde6dd69f08bb4c00a9d188e4cb3131b26c1bc16  add_spi+cacert_ca_certs.patch"