blob: 8a2c9d6f480f95ffdbc9bfb94debd87a5c437339 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001Submitted By: DJ Lucas <dj_AT_linuxfromscratch_DOT_org>
2Date: 2016-12-27
3Initial Package Version: 3.12.4
4Upstream Status: Not applicable
5Origin: Self, rediffed for nss-3.28.
6Description: Adds auto-generated nss.pc and nss-config script, and
7 allows building without nspr in the source tree.
8 For 3.40.1, Requires: updated to nspr >= 4.20.
9 For 3.46.1, Requires: updated to nspr >= 4.21.
10 For 3.48, Requires: updated to nspr >= 4.24.
11 For 3.51.1, Requires: updated to nspr >= 4.25.
12
13--- a/nss/Makefile
14+++ b/nss/Makefile
15@@ -48,7 +48,6 @@ include $(CORE_DEPTH)/coreconf/rules.mk
16 #######################################################################
17
18 nss_build_all:
19- $(MAKE) build_nspr
20 $(MAKE) all
21 $(MAKE) latest
22
23--- /dev/null
24+++ b/nss/config/Makefile
25@@ -0,0 +1,40 @@
26+CORE_DEPTH = ..
27+DEPTH = ..
28+
29+include $(CORE_DEPTH)/coreconf/config.mk
30+
31+NSS_MAJOR_VERSION = `grep "NSS_VMAJOR" ../lib/nss/nss.h | awk '{print $$3}'`
32+NSS_MINOR_VERSION = `grep "NSS_VMINOR" ../lib/nss/nss.h | awk '{print $$3}'`
33+NSS_PATCH_VERSION = `grep "NSS_VPATCH" ../lib/nss/nss.h | awk '{print $$3}'`
34+PREFIX = /usr
35+
36+all: export libs
37+
38+export:
39+ # Create the nss.pc file
40+ mkdir -p $(DIST)/lib/pkgconfig
41+ sed -e "s,@prefix@,$(PREFIX)," \
42+ -e "s,@exec_prefix@,\$${prefix}," \
43+ -e "s,@libdir@,\$${prefix}/lib," \
44+ -e "s,@includedir@,\$${prefix}/include/nss," \
45+ -e "s,@NSS_MAJOR_VERSION@,$(NSS_MAJOR_VERSION),g" \
46+ -e "s,@NSS_MINOR_VERSION@,$(NSS_MINOR_VERSION)," \
47+ -e "s,@NSS_PATCH_VERSION@,$(NSS_PATCH_VERSION)," \
48+ nss.pc.in > nss.pc
49+ chmod 0644 nss.pc
50+ ln -sf ../../../../nss/config/nss.pc $(DIST)/lib/pkgconfig
51+
52+ # Create the nss-config script
53+ mkdir -p $(DIST)/bin
54+ sed -e "s,@prefix@,$(PREFIX)," \
55+ -e "s,@NSS_MAJOR_VERSION@,$(NSS_MAJOR_VERSION)," \
56+ -e "s,@NSS_MINOR_VERSION@,$(NSS_MINOR_VERSION)," \
57+ -e "s,@NSS_PATCH_VERSION@,$(NSS_PATCH_VERSION)," \
58+ nss-config.in > nss-config
59+ chmod 0755 nss-config
60+ ln -sf ../../../nss/config/nss-config $(DIST)/bin
61+
62+libs:
63+
64+dummy: all export libs
65+
66--- /dev/null
67+++ b/nss/config/nss-config.in
68@@ -0,0 +1,153 @@
69+#!/bin/sh
70+
71+prefix=@prefix@
72+
73+major_version=@NSS_MAJOR_VERSION@
74+minor_version=@NSS_MINOR_VERSION@
75+patch_version=@NSS_PATCH_VERSION@
76+
77+usage()
78+{
79+ cat <<EOF
80+Usage: nss-config [OPTIONS] [LIBRARIES]
81+Options:
82+ [--prefix[=DIR]]
83+ [--exec-prefix[=DIR]]
84+ [--includedir[=DIR]]
85+ [--libdir[=DIR]]
86+ [--version]
87+ [--libs]
88+ [--cflags]
89+Dynamic Libraries:
90+ nss
91+ nssutil
92+ smime
93+ ssl
94+ softokn
95+EOF
96+ exit $1
97+}
98+
99+if test $# -eq 0; then
100+ usage 1 1>&2
101+fi
102+
103+lib_nss=yes
104+lib_nssutil=yes
105+lib_smime=yes
106+lib_ssl=yes
107+lib_softokn=yes
108+
109+while test $# -gt 0; do
110+ case "$1" in
111+ -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
112+ *) optarg= ;;
113+ esac
114+
115+ case $1 in
116+ --prefix=*)
117+ prefix=$optarg
118+ ;;
119+ --prefix)
120+ echo_prefix=yes
121+ ;;
122+ --exec-prefix=*)
123+ exec_prefix=$optarg
124+ ;;
125+ --exec-prefix)
126+ echo_exec_prefix=yes
127+ ;;
128+ --includedir=*)
129+ includedir=$optarg
130+ ;;
131+ --includedir)
132+ echo_includedir=yes
133+ ;;
134+ --libdir=*)
135+ libdir=$optarg
136+ ;;
137+ --libdir)
138+ echo_libdir=yes
139+ ;;
140+ --version)
141+ echo ${major_version}.${minor_version}.${patch_version}
142+ ;;
143+ --cflags)
144+ echo_cflags=yes
145+ ;;
146+ --libs)
147+ echo_libs=yes
148+ ;;
149+ nss)
150+ lib_nss=yes
151+ ;;
152+ nssutil)
153+ lib_nssutil=yes
154+ ;;
155+ smime)
156+ lib_smime=yes
157+ ;;
158+ ssl)
159+ lib_ssl=yes
160+ ;;
161+ softokn)
162+ lib_softokn=yes
163+ ;;
164+ *)
165+ usage 1 1>&2
166+ ;;
167+ esac
168+ shift
169+done
170+
171+# Set variables that may be dependent upon other variables
172+if test -z "$exec_prefix"; then
173+ exec_prefix=`pkg-config --variable=exec_prefix nss`
174+fi
175+if test -z "$includedir"; then
176+ includedir=`pkg-config --variable=includedir nss`
177+fi
178+if test -z "$libdir"; then
179+ libdir=`pkg-config --variable=libdir nss`
180+fi
181+
182+if test "$echo_prefix" = "yes"; then
183+ echo $prefix
184+fi
185+
186+if test "$echo_exec_prefix" = "yes"; then
187+ echo $exec_prefix
188+fi
189+
190+if test "$echo_includedir" = "yes"; then
191+ echo $includedir
192+fi
193+
194+if test "$echo_libdir" = "yes"; then
195+ echo $libdir
196+fi
197+
198+if test "$echo_cflags" = "yes"; then
199+ echo -I$includedir
200+fi
201+
202+if test "$echo_libs" = "yes"; then
203+ libdirs="-L$libdir"
204+ if test -n "$lib_nss"; then
205+ libdirs="$libdirs -lnss${major_version}"
206+ fi
207+ if test -n "$lib_nssutil"; then
208+ libdirs="$libdirs -lnssutil${major_version}"
209+ fi
210+ if test -n "$lib_smime"; then
211+ libdirs="$libdirs -lsmime${major_version}"
212+ fi
213+ if test -n "$lib_ssl"; then
214+ libdirs="$libdirs -lssl${major_version}"
215+ fi
216+ if test -n "$lib_softokn"; then
217+ libdirs="$libdirs -lsoftokn${major_version}"
218+ fi
219+ echo $libdirs
220+fi
221+
222--- /dev/null
223+++ b/nss/config/nss.pc.in
224@@ -0,0 +1,12 @@
225+prefix=@prefix@
226+exec_prefix=@exec_prefix@
227+libdir=@libdir@
228+includedir=@includedir@
229+
230+Name: NSS
231+Description: Network Security Services
232+Version: @NSS_MAJOR_VERSION@.@NSS_MINOR_VERSION@.@NSS_PATCH_VERSION@
233+Requires: nspr >= 4.25
234+Libs: -L@libdir@ -lnss@NSS_MAJOR_VERSION@ -lnssutil@NSS_MAJOR_VERSION@ -lsmime@NSS_MAJOR_VERSION@ -lssl@NSS_MAJOR_VERSION@ -lsoftokn@NSS_MAJOR_VERSION@
235+Cflags: -I${includedir}
236+
237--- a/nss/manifest.mn
238+++ b/nss/manifest.mn
239@@ -10,7 +10,7 @@ IMPORTS = nspr20/v4.8 \
240
241 RELEASE = nss
242
243-DIRS = coreconf lib cmd cpputil gtests
244+DIRS = coreconf lib cmd cpputil config
245
246 HAVE_ALL_TARGET := 1
247