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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
|
# Maintainer: Ilya Basin <basinilya at gmail dot com>
# https://github.com/msys2/MINGW-packages/tree/master/mingw-w64-cyrus-sasl
# Contributor: Alexey Pavlov <alexpux@gmail.com>
# Contributor: Renato Silva <br.renatosilva@gmail.com>
_architectures='i686-w64-mingw32 x86_64-w64-mingw32'
MINGW_PACKAGE_PREFIX=mingw-w64
_adapt_msys2() {
MINGW_CHOST=${_arch:?}
MINGW_PREFIX=/usr/${_arch:?}
CARCH=${_arch%%-*}
}
_realname=nss
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=3.52.1
_nsprver=4.25
pkgrel=1
pkgdesc="Mozilla Network Security Services (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
url="https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS"
license=(MPL2)
depends=("${MINGW_PACKAGE_PREFIX}-nspr"
"${MINGW_PACKAGE_PREFIX}-sqlite3"
"${MINGW_PACKAGE_PREFIX}-zlib")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "zip" "perl")
options=('staticlibs' 'strip' '!emptydirs' !buildflags)
source=(https://ftp.mozilla.org/pub/security/nss/releases/NSS_${pkgver//./_}_RTM/src/${_realname}-${pkgver}.tar.gz
https://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/moztools-static.zip
nss.pc.in
nss-config.in
ssl-renegotiate-transitional.patch
nss-build.patch
manifest
blank-cert8.db
blank-key3.db
blank-secmod.db
nss-3.20.1-headers.patch)
sha256sums=('bcc81ac33aeb4ecad182dc21e34d2c97bcc148fd7b9e76f85bebb892405a9278'
'1894bc68a0badd6e6f68f66abc4c6cd8e222791dd194f6b631ce536011ab6707'
'b9f1428ca2305bf30b109507ff335fa00bce5a7ce0434b50acd26ad7c47dd5bd'
'e44ac5095b4d88f24ec7b2e6a9f1581560bd3ad41a3d198596d67ef22f67adb9'
'12df04bccbf674db1eef7a519a28987927b5e9c107b1dc386686f05e64f49a97'
'a6891594ca65fc2d5ba18e82e4b6364a96538974314942f45fbeb917b2948f57'
'838098b25a8044176b3139b4003594570c62a8d64f5470fbbd769f3bf44e0855'
'e45105a21696a26c834cfaa3f664c42426c99546094e22fbe3a5e1dd3fbc1f33'
'6115cab6d646a05dd6b63e21c488da6bc36975f6e5ad8d6371c30a166c41cddc'
'3790a5404f6b7edb652544eb75bfaa8f1c515f41ef14369248151d7c52cd249e'
'f9d9b858a87c49c3ba1f058279b885fe704e23d9bcaaba00f17e534f6a313822')
prepare() {
cd ${srcdir}/${_realname}-${pkgver}
# Adds transitional SSL renegotiate support - patch from Debian
# patch -Np3 -i ${srcdir}/ssl-renegotiate-transitional.patch
patch -Np1 -i ${srcdir}/nss-build.patch
patch -Np1 -i ${srcdir}/nss-3.20.1-headers.patch
# Respect LDFLAGS
sed -e 's/\$(MKSHLIB) -o/\$(MKSHLIB) \$(LDFLAGS) -o/' \
-i nss/coreconf/rules.mk
#cp ${srcdir}/moztools/bin/nsinstall.exe ${srcdir}/${_realname}-${pkgver}/
#cp ${srcdir}/manifest ${srcdir}/${_realname}-${pkgver}/nsinstall.exe.manifest
}
build() {
for _arch in ${_architectures}; do
_adapt_msys2
pushd .
(
. mingw-env ${_arch}
[[ -d "${srcdir}"/build-${CARCH} ]] && rm -rf "${srcdir}"/build-${CARCH}
mkdir -p "${srcdir}"/build-${CARCH} && cd "${srcdir}"/build-${CARCH}
cp -rf ${srcdir}/${_realname}-${pkgver}/* "${srcdir}"/build-${CARCH}
local conf64=
[[ "$CARCH" = "x86_64" ]] && {
conf64="USE_64=1"
}
mv nss/coreconf/config.mk nss/coreconf/config.mk.save
{
cat <<EOFCONF
BUILD_OPT=1
NSS_NO_SSL2_NO_EXPORT=1
NSS_USE_SYSTEM_SQLITE=1
IMPORT_LIB_SUFFIX=.dll.a
NSS_DISABLE_GTESTS=1
NSS_ENABLE_ECC=1
NSS_DISABLE_DBM=1
NSPR_INCLUDE_DIR = `${MINGW_PREFIX}/bin/nspr-config --includedir`
NSPR_LIB_DIR = `${MINGW_PREFIX}/bin/nspr-config --libdir`
SQLITE_LIB_DIR = ${MINGW_PREFIX}/lib
XCFLAGS = ${CFLAGS}
EXTRA_SHARED_LIBS= -lplc4 -lplds4 -lnspr4 -lz -lcrypt32 -lws2_32 -lssp
OS_TARGET=WINNT
OS_ARCH=WINNT
OS_RELEASE=5.0
XP_WIN=1
NS_USE_GCC=1
${conf64}
NSS_USE_SYSTEM_SQLITE=1
USE_SYSTEM_ZLIB=1
ZLIB_LIBS=${MINGW_PREFIX}/lib/libz.dll.a
CROSS_COMPILE=1
NATIVE_CC=gcc
NATIVE_FLAGS-D_XOPEN_SOURCE=500
EOFCONF
cat <<'EOFCONF'
ifdef CROSS_COMPILE
ifdef INTERNAL_TOOLS
CFLAGS=-D_XOPEN_SOURCE=500
LDFLAGS=
XLDFLAGS=
EXTRA_LIBS=
OS_LIBS=
EXTRA_SHARED_LIBS=
PROG_SUFFIX=
OS_TARGET=
OS_RELEASE=
XP_WIN=
endif
endif
EOFCONF
cat nss/coreconf/config.mk.save
cat <<EOFCONF
CC=${CC}
RC=${_arch}-windres
RANLIB=${_arch}-ranlib
EOFCONF
cat <<'EOFCONF'
NSINSTALL=$(NSINSTALL_DIR)/$(OBJDIR_NAME)/nsinstall
EOFCONF
} >nss/coreconf/config.mk
{
cat <<'EOFCONF'
OBJDIR_NAME=_.OBJ
ifndef CROSS_COMPILE
OS_ARCH=WINNT
endif
ifndef INTERNAL_TOOLS
OS_ARCH=WINNT
endif
EOFCONF
} >>nss/coreconf/arch.mk
sed -b -i 's/ifeq (,\$(filter-out OS2 WIN%,\$(OS_TARGET)))/ifeq (,$(CROSS_COMPILE)$(filter-out OS2 WIN%,$(OS_TARGET)))/' nss/coreconf/nsinstall/Makefile
make -j1 -C nss
)
popd
done
}
package() {
for _arch in ${_architectures}; do
_adapt_msys2
pushd .
(
cd "${srcdir}"/build-${CARCH}
install -d "${pkgdir}${MINGW_PREFIX}"/{bin,include/nss3,lib/{nss,pkgconfig}}
NSS_VMAJOR=$(grep '#define.*NSS_VMAJOR' nss/lib/nss/nss.h | awk '{print $3}')
NSS_VMINOR=$(grep '#define.*NSS_VMINOR' nss/lib/nss/nss.h | awk '{print $3}')
NSS_VPATCH=$(grep '#define.*NSS_VPATCH' nss/lib/nss/nss.h | awk '{print $3}')
sed ../nss.pc.in \
-e "s,%libdir%,${MINGW_PREFIX}/lib,g" \
-e "s,%prefix%,${MINGW_PREFIX},g" \
-e "s,%exec_prefix%,${MINGW_PREFIX}/bin,g" \
-e "s,%includedir%,${MINGW_PREFIX}/include/nss3,g" \
-e "s,%NSPR_VERSION%,${_nsprver},g" \
-e "s,%NSS_VERSION%,${pkgver},g" \
> "${pkgdir}${MINGW_PREFIX}/lib/pkgconfig/nss.pc"
cp -f ${pkgdir}${MINGW_PREFIX}/lib/pkgconfig/nss.pc ${pkgdir}${MINGW_PREFIX}/lib/pkgconfig/mozilla-nss.pc
sed ../nss-config.in \
-e "s,@libdir@,${MINGW_PREFIX}/lib,g" \
-e "s,@prefix@,${MINGW_PREFIX}/bin,g" \
-e "s,@exec_prefix@,${MINGW_PREFIX}/bin,g" \
-e "s,@includedir@,${MINGW_PREFIX}/include/nss3,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}${MINGW_PREFIX}/bin/nss-config"
chmod 755 ${pkgdir}${MINGW_PREFIX}/bin/nss-config
# Copy the binary libraries we want
for file in softokn nss nssutil ssl smime #nssdbm
do
install -m 755 dist/*.OBJ/lib/${file}3.dll ${pkgdir}${MINGW_PREFIX}/bin/
install -m 644 dist/*.OBJ/lib/lib${file}3.dll.a ${pkgdir}${MINGW_PREFIX}/lib/lib${file}3.dll.a
done
install -m 755 dist/*.OBJ/lib/nssckbi.dll ${pkgdir}${MINGW_PREFIX}/bin/
install -m 755 dist/*.OBJ/lib/freebl3.dll ${pkgdir}${MINGW_PREFIX}/bin/
# Install the empty NSS db files
mkdir -p ${pkgdir}${MINGW_PREFIX}/etc/pki/nssdb
install -m 644 ${srcdir}/blank-cert8.db ${pkgdir}${MINGW_PREFIX}/etc/pki/nssdb/cert8.db
install -m 644 ${srcdir}/blank-key3.db ${pkgdir}${MINGW_PREFIX}/etc/pki/nssdb/key3.db
install -m 644 ${srcdir}/blank-secmod.db ${pkgdir}${MINGW_PREFIX}/etc/pki/nssdb/secmod.db
# Copy the development libraries we want
for file in libcrmf.dll.a libnssb.dll.a libnssckfw.dll.a libfreebl.dll.a libcryptohi.dll.a libcerthi.dll.a libcertdb.dll.a libsoftokn.dll.a libpkixutil.dll.a
do
install -m 644 dist/*.OBJ/lib/${file} ${pkgdir}${MINGW_PREFIX}/lib/
done
# Copy the binaries we want
for file in certutil cmsutil crlutil modutil pk12util signtool signver ssltap
do
install -m 755 dist/*.OBJ/bin/${file}.exe ${pkgdir}${MINGW_PREFIX}/bin/
done
# Copy the binaries we ship as unsupported
for file in atob btoa derdump ocspclnt pp selfserv shlibsign strsclnt symkeyutil \
tstclnt vfyserv vfychain
do
install -m 755 dist/*.OBJ/bin/${file}.exe ${pkgdir}${MINGW_PREFIX}/lib/nss/
done
# Copy the include files we want
for file in dist/public/nss/*.h
do
install -m 644 ${file} ${pkgdir}${MINGW_PREFIX}/include/nss3
done
# License
install -Dm644 nss/COPYING ${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING
)
popd
done
}
|