diff --git a/nspr-4.32.tar.gz b/nspr-4.32.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..1f9373c517687d3eb725c84b242ccc1156e7d1c6 Binary files /dev/null and b/nspr-4.32.tar.gz differ diff --git a/nspr-config-pc.patch b/nspr-config-pc.patch new file mode 100644 index 0000000000000000000000000000000000000000..2c1fe8770593666d28209276a4ff6573828a3f43 --- /dev/null +++ b/nspr-config-pc.patch @@ -0,0 +1,37 @@ +diff -up nspr/config/nspr-config.in.flags nspr/config/nspr-config.in +--- nspr/config/nspr-config.in.flags 2013-05-29 13:46:34.147971410 -0700 ++++ nspr/config/nspr-config.in 2013-05-29 14:17:10.990838914 -0700 +@@ -102,7 +102,7 @@ if test -z "$includedir"; then + includedir=@includedir@ + fi + if test -z "$libdir"; then +- libdir=@libdir@ ++ libdir=`pkg-config --variable=libdir nspr` + fi + + if test "$echo_prefix" = "yes"; then +@@ -136,12 +136,12 @@ if test "$echo_libs" = "yes"; then + if test -n "$lib_nspr"; then + libdirs="$libdirs -lnspr${major_version}" + fi +- os_ldflags="@LDFLAGS@" ++ os_ldflags=`pkg-config --variable=ldflags nspr` + for i in $os_ldflags ; do + if echo $i | grep \^-L >/dev/null; then + libdirs="$libdirs $i" + fi + done +- echo $libdirs @OS_LIBS@ ++ echo $libdirs `pkg-config --variable=os_libs nspr` + fi + +diff -up nspr/config/nspr.pc.in.flags nspr/config/nspr.pc.in +--- nspr/config/nspr.pc.in.flags 2013-05-29 13:48:15.026643570 -0700 ++++ nspr/config/nspr.pc.in 2013-05-29 13:49:47.795202949 -0700 +@@ -6,5 +6,5 @@ includedir=@includedir@ + Name: NSPR + Description: The Netscape Portable Runtime + Version: @MOD_MAJOR_VERSION@.@MOD_MINOR_VERSION@.@MOD_PATCH_VERSION@ +-Libs: -L@libdir@ -lplds@MOD_MAJOR_VERSION@ -lplc@MOD_MAJOR_VERSION@ -lnspr@MOD_MAJOR_VERSION@ ++Libs: -L@libdir@ -lplds@MOD_MAJOR_VERSION@ -lplc@MOD_MAJOR_VERSION@ -lnspr@MOD_MAJOR_VERSION@ @OS_LIBS@ + Cflags: -I@includedir@ diff --git a/nspr-config.xml b/nspr-config.xml new file mode 100644 index 0000000000000000000000000000000000000000..9e3f99c6ff222de67535d7bfe6b50816f72cca87 --- /dev/null +++ b/nspr-config.xml @@ -0,0 +1,127 @@ + + + +]> + + + + + &date; + Netscape Portable Runtime + nspr + &version; + + + + nspr-config + 1 + + + + nspr-config + Return meta information about nspr libraries + + + + + nspr-config + + + + + + + + + + + + Description + nspr-config is a shell script which can be used to obtain gcc options for building client pacakges of nspr. + + + + Options + + + + + Returns the top level system directory under which the nspr libraries are installed. + + + + + Returns the top level system directory under which any nspr binaries would be installed. + + + + count + Returns the path to the directory were the nspr headers are installed. + + + + + Returns the upstream version of nspr in the form major_version-minor_version-patch_version. + + + + + Returns the compiler linking flags. + + + + + Returns the compiler include flags. + + + + + Returns the path to the directory were the nspr libraries are installed. + + + + + + + Examples + + The following example will query for both include path and linkage flags: + + /usr/bin/nspr-config --cflags --libs + + + + + + + + Files + + /usr/bin/nspr-config + + + + + See also + pkg-config(1) + + + + Authors + The NSPR liraries were written and maintained by developers with Netscape, Red Hat, Sun, Oracle, Mozilla, and Google. + + Authors: Elio Maldonado <emaldona@redhat.com>. + + + + + + LICENSE + Licensed under the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + + + + + diff --git a/nspr-gcc-atomics.patch b/nspr-gcc-atomics.patch new file mode 100644 index 0000000000000000000000000000000000000000..b94e840e7a3fee61f045b58c48df1d2e303dc1f5 --- /dev/null +++ b/nspr-gcc-atomics.patch @@ -0,0 +1,77 @@ +diff --git a/pr/include/md/_linux.h b/pr/include/md/_linux.h +--- a/pr/include/md/_linux.h ++++ b/pr/include/md/_linux.h +@@ -82,53 +82,73 @@ + #define NO_DLOPEN_NULL + #endif + + #if defined(__FreeBSD_kernel__) || defined(__GNU__) + #define _PR_HAVE_SOCKADDR_LEN + #endif + + #if defined(__i386__) ++#if defined(__GNUC__) ++/* Use GCC built-in functions */ ++#define _PR_HAVE_ATOMIC_OPS ++#define _MD_INIT_ATOMIC() ++#define _MD_ATOMIC_INCREMENT(ptr) __sync_add_and_fetch(ptr, 1) ++#define _MD_ATOMIC_DECREMENT(ptr) __sync_sub_and_fetch(ptr, 1) ++#define _MD_ATOMIC_ADD(ptr, i) __sync_add_and_fetch(ptr, i) ++#define _MD_ATOMIC_SET(ptr, nv) __sync_lock_test_and_set(ptr, nv) ++#else + #define _PR_HAVE_ATOMIC_OPS + #define _MD_INIT_ATOMIC() + extern PRInt32 _PR_x86_AtomicIncrement(PRInt32 *val); + #define _MD_ATOMIC_INCREMENT _PR_x86_AtomicIncrement + extern PRInt32 _PR_x86_AtomicDecrement(PRInt32 *val); + #define _MD_ATOMIC_DECREMENT _PR_x86_AtomicDecrement + extern PRInt32 _PR_x86_AtomicAdd(PRInt32 *ptr, PRInt32 val); + #define _MD_ATOMIC_ADD _PR_x86_AtomicAdd + extern PRInt32 _PR_x86_AtomicSet(PRInt32 *val, PRInt32 newval); + #define _MD_ATOMIC_SET _PR_x86_AtomicSet + #endif ++#endif + + #if defined(__ia64__) + #define _PR_HAVE_ATOMIC_OPS + #define _MD_INIT_ATOMIC() + extern PRInt32 _PR_ia64_AtomicIncrement(PRInt32 *val); + #define _MD_ATOMIC_INCREMENT _PR_ia64_AtomicIncrement + extern PRInt32 _PR_ia64_AtomicDecrement(PRInt32 *val); + #define _MD_ATOMIC_DECREMENT _PR_ia64_AtomicDecrement + extern PRInt32 _PR_ia64_AtomicAdd(PRInt32 *ptr, PRInt32 val); + #define _MD_ATOMIC_ADD _PR_ia64_AtomicAdd + extern PRInt32 _PR_ia64_AtomicSet(PRInt32 *val, PRInt32 newval); + #define _MD_ATOMIC_SET _PR_ia64_AtomicSet + #endif + + #if defined(__x86_64__) ++#if defined(__GNUC__) ++/* Use GCC built-in functions */ ++#define _PR_HAVE_ATOMIC_OPS ++#define _MD_INIT_ATOMIC() ++#define _MD_ATOMIC_INCREMENT(ptr) __sync_add_and_fetch(ptr, 1) ++#define _MD_ATOMIC_DECREMENT(ptr) __sync_sub_and_fetch(ptr, 1) ++#define _MD_ATOMIC_ADD(ptr, i) __sync_add_and_fetch(ptr, i) ++#define _MD_ATOMIC_SET(ptr, nv) __sync_lock_test_and_set(ptr, nv) ++#else + #define _PR_HAVE_ATOMIC_OPS + #define _MD_INIT_ATOMIC() + extern PRInt32 _PR_x86_64_AtomicIncrement(PRInt32 *val); + #define _MD_ATOMIC_INCREMENT _PR_x86_64_AtomicIncrement + extern PRInt32 _PR_x86_64_AtomicDecrement(PRInt32 *val); + #define _MD_ATOMIC_DECREMENT _PR_x86_64_AtomicDecrement + extern PRInt32 _PR_x86_64_AtomicAdd(PRInt32 *ptr, PRInt32 val); + #define _MD_ATOMIC_ADD _PR_x86_64_AtomicAdd + extern PRInt32 _PR_x86_64_AtomicSet(PRInt32 *val, PRInt32 newval); + #define _MD_ATOMIC_SET _PR_x86_64_AtomicSet + #endif ++#endif + + #if defined(__or1k__) + #if defined(__GNUC__) + /* Use GCC built-in functions */ + #define _PR_HAVE_ATOMIC_OPS + #define _MD_INIT_ATOMIC() + #define _MD_ATOMIC_INCREMENT(ptr) __sync_add_and_fetch(ptr, 1) + #define _MD_ATOMIC_DECREMENT(ptr) __sync_sub_and_fetch(ptr, 1) diff --git a/nspr.spec b/nspr.spec new file mode 100644 index 0000000000000000000000000000000000000000..da6f2d2fe57f359f727843b83bff014704521917 --- /dev/null +++ b/nspr.spec @@ -0,0 +1,148 @@ +%define anolis_release 1 +%global nspr_version 4.32.0 + +# The upstream omits the trailing ".0", while we need it for +# consistency with the pkg-config version: +# https://bugzilla.redhat.com/show_bug.cgi?id=1578106 +%{lua: +rpm.define(string.format("nspr_archive_version %s", + string.gsub(rpm.expand("%nspr_version"), "(.*)%.0$", "%1"))) +} + +Summary: Netscape Portable Runtime +Name: nspr +Version: %{nspr_version} +Release: 1.%{anolis_release}%{?dist} +License: MPLv2.0 +URL: http://ftp.mozilla.org/pub/nspr/releases/v${nspr_archive_version}/src +Conflicts: filesystem < 3 +BuildRequires: gcc + +# Sources available at ftp://ftp.mozilla.org/pub/mozilla.org/nspr/releases/ +# When hg tag based snapshots are being used, refer to hg documentation on +# mozilla.org and check out subdirectory mozilla/nsprpub. +Source0: %{name}-%{nspr_archive_version}.tar.gz +Source1: nspr-config.xml + +Patch1: nspr-config-pc.patch +Patch2: nspr-gcc-atomics.patch + +%description +NSPR provides platform independence for non-GUI operating system +facilities. These facilities include threads, thread synchronization, +normal file and network I/O, interval timing and calendar time, basic +memory management (malloc and free) and shared library linking. + +%package devel +Summary: Development libraries for the Netscape Portable Runtime +Requires: nspr = %{version}-%{release} +Requires: pkgconfig +BuildRequires: xmlto +Conflicts: filesystem < 3 + +%description devel +Header files for doing development with the Netscape Portable Runtime. + +%prep + +%setup -q -n %{name}-%{nspr_archive_version} + +# Original nspr-config is not suitable for our distribution, +# because on different platforms it contains different dynamic content. +# Therefore we produce an adjusted copy of nspr-config that will be +# identical on all platforms. +# However, we need to use original nspr-config to produce some variables +# that go into nspr.pc for pkg-config. + +cp ./nspr/config/nspr-config.in ./nspr/config/nspr-config-pc.in +%patch1 -p0 -b .flags +pushd nspr +%patch2 -p1 -b .gcc-atomics +popd + +%build +%define _configure ./nspr/configure +%configure \ + --prefix=%{_prefix} \ + --libdir=%{_libdir} \ + --includedir=%{_includedir}/nspr4 \ + --enable-64bit \ + --enable-optimize="$RPM_OPT_FLAGS" \ + --disable-debug + +# The assembly files are only for legacy atomics, to which we prefer GCC atomics +sed -i '/^PR_MD_ASFILES/d' config/autoconf.mk +make + +date +"%e %B %Y" | tr -d '\n' > date.xml +echo -n %{version} > version.xml + +for m in %{SOURCE1}; do + cp ${m} . +done +for m in nspr-config.xml; do + xmlto man ${m} +done + +%check + +# Run test suite. +perl ./nspr/pr/tests/runtests.pl 2>&1 | tee output.log + +TEST_FAILURES=`grep -c FAILED ./output.log` || : +if [ $TEST_FAILURES -ne 0 ]; then + echo "error: test suite returned failure(s)" + exit 1 +fi +echo "test suite completed" + +%install + +%{__rm} -Rf $RPM_BUILD_ROOT + +DESTDIR=$RPM_BUILD_ROOT \ + make install + +mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1 + +NSPR_LIBS=`./config/nspr-config --libs` +NSPR_CFLAGS=`./config/nspr-config --cflags` +NSPR_VERSION=`./config/nspr-config --version` +%{__mkdir_p} $RPM_BUILD_ROOT/%{_libdir}/pkgconfig + +# Get rid of the things we don't want installed (per upstream) +%{__rm} -rf \ + $RPM_BUILD_ROOT/%{_bindir}/compile-et.pl \ + $RPM_BUILD_ROOT/%{_bindir}/prerr.properties \ + $RPM_BUILD_ROOT/%{_libdir}/libnspr4.a \ + $RPM_BUILD_ROOT/%{_libdir}/libplc4.a \ + $RPM_BUILD_ROOT/%{_libdir}/libplds4.a \ + $RPM_BUILD_ROOT/%{_datadir}/aclocal/nspr.m4 \ + $RPM_BUILD_ROOT/%{_includedir}/nspr4/md + +for f in nspr-config; do + install -c -m 644 ${f}.1 $RPM_BUILD_ROOT%{_mandir}/man1/${f}.1 +done + +%ldconfig_scriptlets + +%files +%{!?_licensedir:%global license %%doc} +%license nspr/LICENSE +%{_libdir}/libnspr4.so +%{_libdir}/libplc4.so +%{_libdir}/libplds4.so + +%files devel +%{_includedir}/nspr4 +%{_libdir}/pkgconfig/nspr.pc +%{_bindir}/nspr-config +%{_mandir}/man*/* + +%changelog +* Wed Mar 02 2022 mgb01105731 - 4.32.0-1.1 +- Modify for Anolis OS 23 + +* Tue Aug 10 2021 Bob Relyea - 4.32.0-1 +- Update to NSPR 4.32 +