Mika Laitio | 10 Sep 01:54 2011

fixes for libnss-static-devel and libnspr-static-devel rpm in 2010.2

Hi

Attached patches fixes couple of problems from nss and nspr-static-devel 
packages. I have tested them with mandriva 2010.2
but propably similar types of problem is also in 2011. (thought have not 
checked). Hopefully they could still be added to updates version folder 
of 2010.2.

I have tested these patches by building the static version
of qemu 0.15. Without these patches the static build of qemu 0.15 will fail:

# ./configure --prefix=/usr --interp-prefix=/usr/share/qemu/qemu-i386 
--disable-system --enable-linux-user --static --enable-guest-base 
--disable-werror
# make
...
   LINK  i386-linux-user/qemu-i386
/usr/bin/ld: cannot find -lssl3
/usr/bin/ld: cannot find -lsmime3
/usr/bin/ld: cannot find -lnss3
/usr/bin/ld: cannot find -lsoftokn3
/usr/bin/ld: cannot find -lnssutil3
/usr/bin/ld: cannot find -lplds4
/usr/bin/ld: cannot find -lplc4
/usr/bin/ld: cannot find -lnspr4

In addition same problem could happen for some other apps
which if they call "pkg-config --libs --static nss" or "pkg-config 
--libs --static nspr" commands because the result of those commands
will list the static libraries major number included in their names.

Belowe is the description of the patches and what they fix.

1) libnspr-static-devel package was not available at all.
add_libnspr-static-devel.patch adds the support for creating 
libnspr-static-devel package during the build of nspr.

This solves these three libs:
+%{_libdir}/libnspr4.a
+%{_libdir}/libplc4.a
+%{_libdir}/libplds4.a

2) libsoftokn.a/libsoftokn3.a libraries were missing from the original
    libnss-static-devel rpm package. In addition all other static
    libraries were installed only without version number.
    (ie only libss.a for example but not the libssl3.a that the
     pkg-config --libs --static reports for example)

    add_missing_libs_to_libnss-static-devel-rpm.patch fixes this
    by installing those missing libs with major version number included.
    For backward compatibility also the previous libnames without major
    number are created as a symlinks. (for example /usr/lib/libssl.a -> 
libssl3.a)

I have tested that after these patches the static version of qemu worked 
ok. Static version is needed when using osc build system for
building the apps for example for arm.

Mika
--- nss.spec_orig	2011-09-09 13:28:30.973996909 +0300
+++ nss.spec	2011-09-10 02:35:38.983244723 +0300
 <at>  <at>  -14,7 +14,7  <at>  <at> 
 %define release %mkrel 3
 %else
 # Old distros
-%define subrel 4
+%define subrel 5
 %define release %mkrel 0
 %endif

 <at>  <at>  -238,14 +238,7  <at>  <at> 
 %{__mkdir_p} %{buildroot}%{_includedir}/nss
 %{__cp} -aL ../public/nss/* %{buildroot}%{_includedir}/nss

-%{__cp} -aL lib/libcrmf.a \
-            lib/libnss.a \
-            lib/libnssb.a \
-            lib/libnssckbi.so \
-            lib/libnssckfw.a \
-	    lib/libnssutil.a \
-            lib/libsmime.a \
-            lib/libssl.a \
+%{__cp} -aL lib/libnssckbi.so \
             %{buildroot}%{_libdir}

 # Copy the binary libraries we want
 <at>  <at>  -256,6 +249,15  <at>  <at> 
   ln -sf ../../%{_lib}/$file %{buildroot}%{_libdir}/$file
 done

+# create %{major} version symlinks versions from the static libraries for the devel packages
+# as pkg-config --static --libs will show them...
+for file in libcrmf libnss libnssb libnssckfw libnssutil \
+            libsmime libsoftokn libssl
+do
+  %{__install} -m 755 lib/"$file".a %{buildroot}/%{_libdir}/"$file"%{major}.a
+  ln -s "$file"%{major}.a %{buildroot}%{_libdir}/"$file".a
+done
+
 # These ghost files will be generated in the post step
 # Make sure chk files can be found in both places
 for file in libsoftokn3.chk libfreebl3.chk
 <at>  <at>  -536,11 +538,26  <at>  <at> 
 %{_libdir}/libnssb.a
 %{_libdir}/libnssckfw.a
 %{_libdir}/libsmime.a
+%{_libdir}/libsoftokn.a
 %{_libdir}/libssl.a
+%{_libdir}/libcrmf%{major}.a
+%{_libdir}/libnss%{major}.a
+%{_libdir}/libnssutil%{major}.a
+%{_libdir}/libnssb%{major}.a
+%{_libdir}/libnssckfw%{major}.a
+%{_libdir}/libsmime%{major}.a
+%{_libdir}/libsoftokn%{major}.a
+%{_libdir}/libssl%{major}.a
 %endif

 
 %changelog
+* Sat Sep 10 2011 Mika Laitio <lamikr <at> pilppa.org> 2:3.12.11-0.5mdv2010.2
+- fixes for nss-static-devel rpm package by adding files to match
+  the reporting of 'pkg-config --libs --static nss'.
+  Added also libsoftokn.a/libsoftokn4.a as it is needed for example 
+  when building qemu with --static flag.
+
 * Wed Sep 07 2011 Oden Eriksson <oeriksson <at> mandriva.com> 2:3.12.11-0.4mdv2010.2
 - built for updates

--- nspr.spec_orig	2011-09-09 13:28:42.937247882 +0300
+++ nspr.spec	2011-09-10 02:12:47.669247529 +0300
 <at>  <at>  -2,13 +2,14  <at>  <at> 
 %define epoch_nspr 2
 %define libname %mklibname nspr %{major_nspr}
 %define develname %mklibname nspr -d
+%define sdevelname %mklibname -d -s %{name}

 %if %mandriva_branch == Cooker
 # Cooker
 %define release %mkrel 1
 %else
 # Old distros
-%define subrel 2
+%define subrel 3
 %define release %mkrel 0
 %endif

 <at>  <at>  -56,6 +57,20  <at>  <at> 
 %description -n %{develname}
 Header files for doing development with the Netscape Portable Runtime.

+%package -n %{sdevelname}
+Summary:	Static development libraries for the Netscape Portable Runtime
+Group:		Development/C++
+Requires:	%{libname} = %{epoch_nspr}:%{version}-%{release}
+Requires:	%{develname} = %{epoch_nspr}:%{version}-%{release}
+Provides:	%{libname}-static-devel = %{epoch_nspr}:%{version}-%{release}
+Provides:	nspr-static-devel = %{epoch_nspr}:%{version}-%{release}
+Obsoletes:	%{libname}-static-devel
+Obsoletes:	nspr-static-devel
+Conflicts:	%{libname} < 2:4.7.3-3
+
+%description -n %{sdevelname}
+Header files for doing development with the Netscape Portable Runtime.
+
 %prep
 %setup -q

 <at>  <at>  -123,9 +138,6  <at>  <at> 
 %{__rm} -rf \
    %{buildroot}%{_bindir}/compile-et.pl \
    %{buildroot}%{_bindir}/prerr.properties \
-   %{buildroot}%{_libdir}/libnspr4.a \
-   %{buildroot}%{_libdir}/libplc4.a \
-   %{buildroot}%{_libdir}/libplds4.a \
    %{buildroot}%{_datadir}/aclocal/nspr.m4 \
    %{buildroot}%{_includedir}/nspr4/md

 <at>  <at>  -161,8 +173,17  <at>  <at> 
 %{_libdir}/pkgconfig/nspr.pc
 %{_bindir}/nspr-config

+%files -n %{sdevelname}
+%defattr(0644,root,root,0755)
+%{_libdir}/libnspr4.a
+%{_libdir}/libplc4.a
+%{_libdir}/libplds4.a

 %changelog
+* Sat Sep 10 2011 Mika Laitio <lamikr <at> pilppa.org> 2:4.8.9-0.3mdv2010.2
+- added nspr-static-devel rpm package. (static library files required 
+  for example when building qemu with --static flag)
+
 * Thu Sep 01 2011 Oden Eriksson <oeriksson <at> mandriva.com> 2:4.8.9-0.2mdv2010.2
 - built for updates


Gmane