core/nspr to 4.35-2

This commit is contained in:
Kevin Mihelich 2023-12-14 16:35:10 +00:00
parent 8ebeac32b4
commit 83dbb2a32c
4 changed files with 172 additions and 15 deletions

19
core/nspr/.SRCINFO Normal file
View file

@ -0,0 +1,19 @@
pkgbase = nspr
pkgdesc = Netscape Portable Runtime
pkgver = 4.35
pkgrel = 2
url = https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSPR
arch = x86_64
license = MPL-2.0
makedepends = mercurial
makedepends = zip
depends = glibc
depends = sh
source = hg+https://hg.mozilla.org/projects/nspr#revision=b563bfc16c887c48b038b7b441fcc4e40a126d3b
source = 0001-linux-prefer-GCC-provided-atomics-to-asssembly-imple.patch
source = 0002-configure.in-Remove-assembly-files-from-build.patch
b2sums = SKIP
b2sums = fe81bbb23478958438e385ec5563842cdaf7400021def0d2f2184c0c38389e75f28ed7a4f3b52cada4d76c6318c104dda661f1d4efaa224bc832a989729ef852
b2sums = 1fd6e9b1f3111a29a052b6034f796e4e9577a3dbb2d0e96798ce1f47b74f515c882c9f595198fa1646648611525b48857b33ed62e713991e2f28850690e99060
pkgname = nspr

View file

@ -0,0 +1,78 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Daiki Ueno <dueno@redhat.com>
Date: Thu, 4 Oct 2018 15:55:32 +0200
Subject: [PATCH] linux: prefer GCC-provided atomics to asssembly
implementation
---
pr/include/md/_linux.h | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/pr/include/md/_linux.h b/pr/include/md/_linux.h
index ad57d083301c..57877b86fd84 100644
--- a/pr/include/md/_linux.h
+++ b/pr/include/md/_linux.h
@@ -105,43 +105,63 @@
#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(__loongarch__)
#if defined(__GNUC__)

View file

@ -0,0 +1,39 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <heftig@archlinux.org>
Date: Sun, 10 Dec 2023 16:11:13 +0100
Subject: [PATCH] configure.in: Remove assembly files from build
---
configure.in | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/configure.in b/configure.in
index 7d4446689a82..9d14d1b4ab91 100644
--- a/configure.in
+++ b/configure.in
@@ -1683,21 +1683,21 @@ tools are selected during the Xcode/Developer Tools installation.])
;;
i*86)
AC_DEFINE(i386)
- PR_MD_ASFILES=os_Linux_x86.s
+ PR_MD_ASFILES=
;;
ia64)
PR_MD_ASFILES=os_Linux_ia64.s
;;
x86_64)
if test -n "$USE_64"; then
- PR_MD_ASFILES=os_Linux_x86_64.s
+ PR_MD_ASFILES=
elif test -n "$USE_X32"; then
- PR_MD_ASFILES=os_Linux_x86_64.s
+ PR_MD_ASFILES=
CC="$CC -mx32"
CXX="$CXX -mx32"
else
AC_DEFINE(i386)
- PR_MD_ASFILES=os_Linux_x86.s
+ PR_MD_ASFILES=
CC="$CC -m32"
CXX="$CXX -m32"
fi

View file

@ -7,17 +7,28 @@
pkgname=nspr
pkgver=4.35
pkgrel=1
pkgrel=2
pkgdesc="Netscape Portable Runtime"
url="https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSPR"
arch=(x86_64)
license=(MPL GPL)
depends=(glibc sh)
makedepends=(zip mercurial)
options=(debug)
license=(MPL-2.0)
depends=(
glibc
sh
)
makedepends=(
mercurial
zip
)
_revision=b563bfc16c887c48b038b7b441fcc4e40a126d3b
source=("hg+https://hg.mozilla.org/projects/nspr#revision=$_revision")
sha256sums=('SKIP')
source=(
"hg+https://hg.mozilla.org/projects/nspr#revision=$_revision"
0001-linux-prefer-GCC-provided-atomics-to-asssembly-imple.patch
0002-configure.in-Remove-assembly-files-from-build.patch
)
b2sums=('SKIP'
'fe81bbb23478958438e385ec5563842cdaf7400021def0d2f2184c0c38389e75f28ed7a4f3b52cada4d76c6318c104dda661f1d4efaa224bc832a989729ef852'
'1fd6e9b1f3111a29a052b6034f796e4e9577a3dbb2d0e96798ce1f47b74f515c882c9f595198fa1646648611525b48857b33ed62e713991e2f28850690e99060')
pkgver() {
cd nspr
@ -26,17 +37,27 @@ pkgver() {
prepare() {
cd nspr
# https://bugzilla.mozilla.org/show_bug.cgi?id=1496426
# https://gitlab.archlinux.org/archlinux/packaging/packages/nspr/-/merge_requests/1
patch -Np1 -i ../0001-linux-prefer-GCC-provided-atomics-to-asssembly-imple.patch
patch -Np1 -i ../0002-configure.in-Remove-assembly-files-from-build.patch
autoreconf -fvi
}
build() {
cd nspr
./configure \
--prefix=/usr \
--libdir=/usr/lib \
--includedir=/usr/include/nspr \
--enable-optimize \
local configure_options=(
--prefix=/usr
--libdir=/usr/lib
--includedir=/usr/include/nspr
--enable-optimize
--disable-debug \
$([[ $CARCH == x86_64 || $CARCH == aarch64 ]] && echo --enable-64bit)
$([[ $CARCH == aarch64 ]] && echo --enable-64bit)
)
cd nspr
./configure "${configure_options[@]}"
make ${SOURCE_DATE_EPOCH:+
SH_NOW="${SOURCE_DATE_EPOCH}000000"
SH_DATE="$(date --utc --date="@$SOURCE_DATE_EPOCH" '+%Y-%m-%d %T')"
@ -52,4 +73,4 @@ package() {
rm "$pkgdir"/usr/bin/{compile-et.pl,prerr.properties}
}
# vim:set sw=2 et:
# vim:set sw=2 sts=-1 et: