This commit is contained in:
joborun linux 2023-12-11 00:33:08 +02:00
parent f6ef541b57
commit acef1baec4
6 changed files with 178 additions and 25 deletions

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,15 +7,16 @@
pkgname=nspr
pkgver=4.35
pkgrel=01
pkgrel=02
pkgdesc="Netscape Portable Runtime"
url="https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSPR"
arch=(x86_64)
depends=(glibc sh)
#options=(debug) # uncomment this line to produce the debug pkg
makedepends=(zip mercurial)
_revision=b563bfc16c887c48b038b7b441fcc4e40a126d3b
source=("hg+https://hg.mozilla.org/projects/nspr#revision=$_revision")
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)
pkgver() {
cd nspr
@ -24,6 +25,13 @@ 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() {
@ -50,9 +58,15 @@ package() {
rm "$pkgdir"/usr/bin/{compile-et.pl,prerr.properties}
}
#---- license gpg-key sha256sums ----
#---- arch license gpg-key & sha256sums ----
license=(MPL GPL)
arch=(x86_64)
sha256sums=(SKIP)
license=(MPL-2.0)
sha256sums=(SKIP
289aa19bc09e1af9db51109c57f83e2052d348444445fefd4be7c51a5f24b755 # 0001-linux-prefer-GCC-provided-atomics-to-asssembly-imple.patch
6f1603791f8fbf05afbfa1272c65dc7ebacc9453d234010d1dd105bf96e9efe4) # 0002-configure.in-Remove-assembly-files-from-build.patch
## d6cc856fcedbb6237bae22c6b783e4fa7fcfb5627bd367dc2774e09b4aae385f nspr-4.35-02-x86_64.pkg.tar.lz

View File

@ -4,17 +4,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
@ -23,17 +34,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 \
--disable-debug \
local configure_options=(
--prefix=/usr
--libdir=/usr/lib
--includedir=/usr/include/nspr
--enable-optimize
--disable-debug
--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')"
@ -49,4 +70,4 @@ package() {
rm "$pkgdir"/usr/bin/{compile-et.pl,prerr.properties}
}
# vim:set sw=2 et:
# vim:set sw=2 sts=-1 et:

View File

@ -1,5 +1,6 @@
zip
mercurial
autoconf
automake

View File

@ -1,6 +1,6 @@
real 0m42.201s
user 0m18.540s
sys 0m1.935s
real 0m18.583s
user 0m14.296s
sys 0m2.087s