Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/extra/nodejs
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2023-05-22 20:18:50 +0200
committerErich Eckner <git@eckner.net>2023-05-22 20:18:50 +0200
commite74cde76c104df82b120a7b13964cb786da8f565 (patch)
tree39967e24037929c04aaf79922aa260b437a60a5e /extra/nodejs
parent73e1d3b448cc583ab38cae4d61a26f313fad946b (diff)
community -> extra
Diffstat (limited to 'extra/nodejs')
-rw-r--r--extra/nodejs/PKGBUILD35
-rw-r--r--extra/nodejs/node-17.1.0-atomic.patch40
2 files changed, 75 insertions, 0 deletions
diff --git a/extra/nodejs/PKGBUILD b/extra/nodejs/PKGBUILD
new file mode 100644
index 00000000..0a1713cb
--- /dev/null
+++ b/extra/nodejs/PKGBUILD
@@ -0,0 +1,35 @@
+# actually build a 32-bit version
+eval "$(
+ declare -f build | \
+ sed '
+ s|./configure|./configure --dest-cpu x86|g
+ '
+)"
+
+# linker runs out of memory on 32-bit
+eval "$(
+ declare -f build | \
+ sed '
+ 3 i LDFLAGS+=" -Wl,--no-keep-memory"
+ 3 i CFLAGS+=" -g1"
+ 3 i CXXFLAGS+=" -g1"
+ '
+)"
+
+# add -latomic where needed (i486)
+if [ "$CARCH" = 'i486' ]; then
+ source+=('node-17.1.0-atomic.patch')
+ sha512sums+=('a2acca076dc0f65e17ffb5ac0bbf4dc9b8be845a400b66b5f83f5efbfca16e01ecc675a307eb0c28527874dea6464699f3969c3ee9a94226af568fb18feca331')
+ eval "$(
+ declare -f prepare | \
+ sed '
+ $i patch -Np1 -i "../node-17.1.0-atomic.patch"
+ '
+ )"
+ eval "$(
+ declare -f build | \
+ sed '
+ 3 i LDFLAGS+=" -latomic"
+ '
+ )"
+fi
diff --git a/extra/nodejs/node-17.1.0-atomic.patch b/extra/nodejs/node-17.1.0-atomic.patch
new file mode 100644
index 00000000..fce9e21f
--- /dev/null
+++ b/extra/nodejs/node-17.1.0-atomic.patch
@@ -0,0 +1,40 @@
+diff -rauN node-17.1.0/node.gyp node-17.1.0-atomic-patch/node.gyp
+--- node-17.1.0/node.gyp 2021-11-08 16:40:59.000000000 +0100
++++ node-17.1.0-atomic-patch/node.gyp 2021-12-09 09:16:58.041503560 +0100
+@@ -116,6 +116,11 @@
+ '-Wl,-bnoerrmsg',
+ ],
+ }],
++ [ 'target_arch=="ia32"', {
++ 'link_settings': {
++ 'libraries': [ '-latomic' ],
++ },
++ }],
+ ['OS == "linux" and llvm_version != "0.0"', {
+ 'libraries': ['-latomic'],
+ }],
+diff -rauN node-17.1.0/tools/v8_gypfiles/toolchain.gypi node-17.1.0-atomic-patch/tools/v8_gypfiles/toolchain.gypi
+--- node-17.1.0/tools/v8_gypfiles/toolchain.gypi 2021-11-08 16:40:59.000000000 +0100
++++ node-17.1.0-atomic-patch/tools/v8_gypfiles/toolchain.gypi 2021-12-09 09:14:54.281212315 +0100
+@@ -1030,9 +1030,6 @@
+ or OS=="netbsd" or OS=="mac" or OS=="android" or OS=="qnx") and \
+ v8_target_arch=="ia32"', {
+ 'cflags': [
+- '-msse2',
+- '-mfpmath=sse',
+- '-mmmx', # Allows mmintrin.h for MMX intrinsics.
+ ],
+ }],
+ ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
+diff -rauN node-17.1.0/tools/v8_gypfiles/v8.gyp node-17.1.0-atomic-patch/tools/v8_gypfiles/v8.gyp
+--- node-17.1.0/tools/v8_gypfiles/v8.gyp 2021-11-08 16:40:59.000000000 +0100
++++ node-17.1.0-atomic-patch/tools/v8_gypfiles/v8.gyp 2021-12-09 09:10:15.947439079 +0100
+@@ -965,7 +965,7 @@
+ }],
+ # Platforms that don't have Compare-And-Swap (CAS) support need to link atomic library
+ # to implement atomic memory access
+- ['v8_current_cpu in ["mips", "mipsel", "mips64", "mips64el", "ppc", "arm", "riscv64"]', {
++ ['v8_current_cpu in ["mips", "mipsel", "mips64", "mips64el", "ppc", "arm", "riscv64", "x86"]', {
+ 'link_settings': {
+ 'libraries': ['-latomic', ],
+ },