Fix node problems 73/307373/2
authorDaniil Ruban <intx82@gmail.com>
Wed, 6 Mar 2024 05:39:33 +0000 (06:39 +0100)
committerBot Blink <blinkbot@samsung.com>
Fri, 8 Mar 2024 00:33:35 +0000 (00:33 +0000)
* Rebuild node.js 16.13.2 into static binary to avoid dll-hell
* Fix behavior with missing target.txt
* x86_64 will use node from `third_party/node/linux/node-linux-x64/bin/node`
* other architectures will use `third_party/node/tizen/node`

Change-Id: I9f0c8c03ef4953e0b35c018749ca82c934bc687c
Signed-off-by: Daniil Ruban <intx82@gmail.com>
third_party/node/node.py
third_party/node/tizen/node
tizen_src/build/gn_chromiumefl.sh

index 6409844..3158a01 100755 (executable)
@@ -9,16 +9,24 @@ import subprocess
 import sys
 import os
 
+# node should be build as statically linked application
+# to do this read: https://github.com/nodejs/node/issues/41497
+# or use:
+# ./configure --fully-static --enable-static --download=all --with-intl=full-icu;
+# for i in out/tools/v8_gypfiles/gen-regexp-special-case.target.mk \
+# out/test_crypto_engine.target.mk; do sed -i 's/\-static//g' $i || echo "nevermind"; done
+# make -j$(nproc)
 
 def GetBinaryPath():
-  f = open(os_path.dirname(__file__)+"/target.txt",'r')
-  str = f.read().strip()
-  if (str  == "tizen") :
-      return os_path.join(os_path.dirname(__file__),"tizen/","node")
-  else :
-      darwin_name = ('node-darwin-arm64' if platform.machine() == 'arm64' else
-                 'node-darwin-x64')
-      return os_path.join(os_path.dirname(__file__), *{
+  if os.path.exists(os_path.dirname(__file__)+"/target.txt"):
+    f = open(os_path.dirname(__file__)+"/target.txt",'r')
+    str = f.read().strip()
+    if (str  == "tizen") :
+        return os_path.join(os_path.dirname(__file__),"tizen/","node")
+
+  darwin_name = ('node-darwin-arm64' if platform.machine() == 'arm64' else
+                'node-darwin-x64')
+  return os_path.join(os_path.dirname(__file__), *{
     'Darwin': ('mac', darwin_name, 'bin', 'node'),
     'Linux': ('linux', 'node-linux-x64', 'bin', 'node'),
     'Windows': ('win', 'node.exe'),
index 2cabe59..06b056a 100755 (executable)
Binary files a/third_party/node/tizen/node and b/third_party/node/tizen/node differ
index 002f126..4dd81c6 100755 (executable)
@@ -370,8 +370,10 @@ if [ "$target" == "tizen" ]; then
   echo $BUILD_ARCH > host_arch.txt
 fi
 
-echo $target > target.txt
-echo $target > third_party/node/target.txt
+if [ "$BUILD_ARCH" != "x86_64" ]; then
+  echo $target > target.txt
+  echo $target > third_party/node/target.txt
+fi
 
 printf "GN_ARGUMENTS:\n"
 for arg in $_GN_ARGS; do