Subject: [alpine-aports] [PATCH 2/2] community/nodejs-current: fix build on mips{el} (-latomic), disable on mips64*

From: alpine-mips-patches <[email-masked]>
Date: Mon, 3 Dec 2018 10:26:31 +0000

---
 community/nodejs-current/APKBUILD             | 14 ++++++++--
 .../link-with-libatomic-on-mips32.patch       | 28 +++++++++++++++++++
 2 files changed, 39 insertions(+), 3 deletions(-)
 create mode 100644 community/nodejs-current/link-with-libatomic-on-mips32.patch

diff --git a/community/nodejs-current/APKBUILD b/community/nodejs-current/APKBUILD
index b6e78ca6ab..ee83f1c755 100644
--- a/community/nodejs-current/APKBUILD
+++ b/community/nodejs-current/APKBUILD
@@ -16,7 +16,7 @@ pkgver=11.3.0
 pkgrel=0
 pkgdesc="JavaScript runtime built on V8 engine - current stable version"
 url="https://nodejs.org/"
-arch="all"
+arch="all !mips64 !mips64el"
 license="MIT"
 depends="ca-certificates"
 depends_dev="libuv"
@@ -27,7 +27,9 @@ subpackages="$pkgname-dev $pkgname-doc"
 provides="nodejs"
 replaces="nodejs nodejs-lts"  # nodejs-lts for backward compatibility
 source="https://nodejs.org/dist/v$pkgver/node-v$pkgver.tar.gz
-	dont-run-gyp-files-for-bundled-deps.patch"
+	dont-run-gyp-files-for-bundled-deps.patch
+	link-with-libatomic-on-mips32.patch
+	"
 builddir="$srcdir/node-v$pkgver"
 
 prepare() {
@@ -40,7 +42,12 @@ prepare() {
 build() {
 	cd "$builddir"
 
+	case "$CARCH" in
+	mips*) _carchflags="--with-mips-arch-variant=r1 --with-mips-float-abi=soft";;
+	esac
+
 	./configure --prefix=/usr \
+		$_carchflags \
 		--shared-zlib \
 		--shared-libuv \
 		--shared-openssl \
@@ -79,4 +86,5 @@ package() {
 }
 
 sha512sums="dd1475bd61dbc2aac563e12ced0b9423bf1f5fc421d0699526799b60254d89cbb8d01530f2f029fe146777aecadc4aa54ad62d7b33fb9195f16d8a54b1278588  node-v11.3.0.tar.gz
-9145a28bc3c2ebfc5e29e7416f8387a68808607eea4d87830a14a27c80628177a02ef4ed54b0efe2384c39fedf7356d12c267567d06d53d669c55d6211bfcf8a  dont-run-gyp-files-for-bundled-deps.patch"
+9145a28bc3c2ebfc5e29e7416f8387a68808607eea4d87830a14a27c80628177a02ef4ed54b0efe2384c39fedf7356d12c267567d06d53d669c55d6211bfcf8a  dont-run-gyp-files-for-bundled-deps.patch
+97b4e5aabcb8c6ad93c3194826325f00d56942fbfa3934565baa51a1a047288a06066c838f34233c38a351e8d8c287601ae08b2b6b6e8dbc5aa44cbb088f24eb  link-with-libatomic-on-mips32.patch"
diff --git a/community/nodejs-current/link-with-libatomic-on-mips32.patch b/community/nodejs-current/link-with-libatomic-on-mips32.patch
new file mode 100644
index 0000000000..62fb6fec13
--- /dev/null
+++ b/community/nodejs-current/link-with-libatomic-on-mips32.patch
@@ -0,0 +1,28 @@
+--- a/deps/v8/gypfiles/v8.gyp
++++ b/deps/v8/gypfiles/v8.gyp
+@@ -2012,6 +2012,11 @@
+         }],
+       ],
+       'conditions': [
++        [ '(target_arch=="mips" or target_arch=="mipsel") and mips_arch_variant!="r6"', {
++          'link_settings': {
++            'libraries': [ '-latomic' ],
++          },
++        }],
+         ['component=="shared_library"', {
+           'defines': [
+             'BUILDING_V8_BASE_SHARED',
+--- a/node.gyp
++++ b/node.gyp
+@@ -479,6 +479,11 @@
+       'msvs_disabled_warnings!': [4244],
+ 
+       'conditions': [
++        [ '(target_arch=="mips" or target_arch=="mipsel") and mips_arch_variant!="r6"', {
++          'link_settings': {
++            'libraries': [ '-latomic' ],
++          },
++        }],
+         [ 'node_code_cache_path!=""', {
+           'sources': [ '<(node_code_cache_path)' ]
+         }, {
-- 
2.19.2

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---