Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / patches / nss-pkgconfig.patch
CommitLineData
1aaaff1a
SB
1Description: Create nss.pc and nss-config
2Author: Lars Wendler <polynomial-c@gentoo.org>
3Source: http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-libs/nss/files/nss-3.17.1-gentoo-fixups.patch
4
5Modifications:
6 Change libdir from ${prefix}/lib64 to ${prefix}/lib/nss.
7 Remove optional patching in nss/Makefile.
a24175ac 8 Include -L$libdir in output from "nss-config --libs".
1aaaff1a 9
bea25ae8
MW
10Later adapted to apply cleanly to nss-3.21.
11
12--- nss-3.21/nss/config/Makefile
13+++ nss-3.21/nss/config/Makefile
1aaaff1a
SB
14@@ -0,0 +1,40 @@
15+CORE_DEPTH = ..
16+DEPTH = ..
17+
18+include $(CORE_DEPTH)/coreconf/config.mk
19+
20+NSS_MAJOR_VERSION = `grep "NSS_VMAJOR" ../lib/nss/nss.h | awk '{print $$3}'`
21+NSS_MINOR_VERSION = `grep "NSS_VMINOR" ../lib/nss/nss.h | awk '{print $$3}'`
22+NSS_PATCH_VERSION = `grep "NSS_VPATCH" ../lib/nss/nss.h | awk '{print $$3}'`
23+PREFIX = /usr
24+
25+all: export libs
26+
27+export:
28+ # Create the nss.pc file
29+ mkdir -p $(DIST)/lib/pkgconfig
30+ sed -e "s,@prefix@,$(PREFIX)," \
31+ -e "s,@exec_prefix@,\$${prefix}," \
32+ -e "s,@libdir@,\$${prefix}/lib/nss," \
33+ -e "s,@includedir@,\$${prefix}/include/nss," \
34+ -e "s,@NSS_MAJOR_VERSION@,$(NSS_MAJOR_VERSION),g" \
35+ -e "s,@NSS_MINOR_VERSION@,$(NSS_MINOR_VERSION)," \
36+ -e "s,@NSS_PATCH_VERSION@,$(NSS_PATCH_VERSION)," \
37+ nss.pc.in > nss.pc
38+ chmod 0644 nss.pc
39+ cp nss.pc $(DIST)/lib/pkgconfig
40+
41+ # Create the nss-config script
42+ mkdir -p $(DIST)/bin
43+ sed -e "s,@prefix@,$(PREFIX)," \
44+ -e "s,@NSS_MAJOR_VERSION@,$(NSS_MAJOR_VERSION)," \
45+ -e "s,@NSS_MINOR_VERSION@,$(NSS_MINOR_VERSION)," \
46+ -e "s,@NSS_PATCH_VERSION@,$(NSS_PATCH_VERSION)," \
47+ nss-config.in > nss-config
48+ chmod 0755 nss-config
49+ cp nss-config $(DIST)/bin
50+
51+libs:
52+
53+dummy: all export libs
54+
bea25ae8
MW
55--- nss-3.21/nss/config/nss-config.in
56+++ nss-3.21/nss/config/nss-config.in
1aaaff1a
SB
57@@ -0,0 +1,145 @@
58+#!/bin/sh
59+
60+prefix=@prefix@
61+
62+major_version=@NSS_MAJOR_VERSION@
63+minor_version=@NSS_MINOR_VERSION@
64+patch_version=@NSS_PATCH_VERSION@
65+
66+usage()
67+{
68+ cat <<EOF
69+Usage: nss-config [OPTIONS] [LIBRARIES]
70+Options:
71+ [--prefix[=DIR]]
72+ [--exec-prefix[=DIR]]
73+ [--includedir[=DIR]]
74+ [--libdir[=DIR]]
75+ [--version]
76+ [--libs]
77+ [--cflags]
78+Dynamic Libraries:
79+ nss
80+ ssl
81+ smime
82+ nssutil
83+EOF
84+ exit $1
85+}
86+
87+if test $# -eq 0; then
88+ usage 1 1>&2
89+fi
90+
91+lib_ssl=yes
92+lib_smime=yes
93+lib_nss=yes
94+lib_nssutil=yes
95+
96+while test $# -gt 0; do
97+ case "$1" in
98+ -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
99+ *) optarg= ;;
100+ esac
101+
102+ case $1 in
103+ --prefix=*)
104+ prefix=$optarg
105+ ;;
106+ --prefix)
107+ echo_prefix=yes
108+ ;;
109+ --exec-prefix=*)
110+ exec_prefix=$optarg
111+ ;;
112+ --exec-prefix)
113+ echo_exec_prefix=yes
114+ ;;
115+ --includedir=*)
116+ includedir=$optarg
117+ ;;
118+ --includedir)
119+ echo_includedir=yes
120+ ;;
121+ --libdir=*)
122+ libdir=$optarg
123+ ;;
124+ --libdir)
125+ echo_libdir=yes
126+ ;;
127+ --version)
128+ echo ${major_version}.${minor_version}.${patch_version}
129+ ;;
130+ --cflags)
131+ echo_cflags=yes
132+ ;;
133+ --libs)
134+ echo_libs=yes
135+ ;;
136+ ssl)
137+ lib_ssl=yes
138+ ;;
139+ smime)
140+ lib_smime=yes
141+ ;;
142+ nss)
143+ lib_nss=yes
144+ ;;
145+ nssutil)
146+ lib_nssutil=yes
147+ ;;
148+ *)
149+ usage 1 1>&2
150+ ;;
151+ esac
152+ shift
153+done
154+
155+# Set variables that may be dependent upon other variables
156+if test -z "$exec_prefix"; then
157+ exec_prefix=`pkg-config --variable=exec_prefix nss`
158+fi
159+if test -z "$includedir"; then
160+ includedir=`pkg-config --variable=includedir nss`
161+fi
162+if test -z "$libdir"; then
163+ libdir=`pkg-config --variable=libdir nss`
164+fi
165+
166+if test "$echo_prefix" = "yes"; then
167+ echo $prefix
168+fi
169+
170+if test "$echo_exec_prefix" = "yes"; then
171+ echo $exec_prefix
172+fi
173+
174+if test "$echo_includedir" = "yes"; then
175+ echo $includedir
176+fi
177+
178+if test "$echo_libdir" = "yes"; then
179+ echo $libdir
180+fi
181+
182+if test "$echo_cflags" = "yes"; then
183+ echo -I$includedir
184+fi
185+
186+if test "$echo_libs" = "yes"; then
a24175ac 187+ libdirs=-L$libdir
1aaaff1a
SB
188+ if test -n "$lib_ssl"; then
189+ libdirs="$libdirs -lssl${major_version}"
190+ fi
191+ if test -n "$lib_smime"; then
192+ libdirs="$libdirs -lsmime${major_version}"
193+ fi
194+ if test -n "$lib_nss"; then
195+ libdirs="$libdirs -lnss${major_version}"
196+ fi
197+ if test -n "$lib_nssutil"; then
198+ libdirs="$libdirs -lnssutil${major_version}"
199+ fi
200+ echo $libdirs
201+fi
202+
bea25ae8
MW
203--- nss-3.21/nss/config/nss.pc.in
204+++ nss-3.21/nss/config/nss.pc.in
1aaaff1a
SB
205@@ -0,0 +1,12 @@
206+prefix=@prefix@
207+exec_prefix=@exec_prefix@
208+libdir=@libdir@
209+includedir=@includedir@
210+
211+Name: NSS
212+Description: Network Security Services
213+Version: @NSS_MAJOR_VERSION@.@NSS_MINOR_VERSION@.@NSS_PATCH_VERSION@
214+Requires: nspr >= 4.8
215+Libs: -L${libdir} -lssl3 -lsmime3 -lnss3 -lnssutil3
216+Cflags: -I${includedir}
217+
bea25ae8
MW
218--- nss-3.21/nss/manifest.mn
219+++ nss-3.21/nss/manifest.mn
220@@ -10,4 +10,4 @@
1aaaff1a
SB
221
222 RELEASE = nss
223
bea25ae8
MW
224-DIRS = coreconf lib cmd external_tests
225+DIRS = coreconf lib cmd external_tests config