aboutsummaryrefslogtreecommitdiff
path: root/www/deno/files/patch-cargo-crates_v8_build_toolchain_get__concurrent__links.py
blob: 63e6d5c964a325e0c90adbcac0520cfd0ec2a62d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
--- cargo-crates/v8-0.58.0/build/toolchain/get_concurrent_links.py.orig	2020-06-26 16:27:54 UTC
+++ cargo-crates/v8-0.58.0/build/toolchain/get_concurrent_links.py
@@ -48,6 +48,14 @@ def _GetTotalMemoryInBytes():
       return int(subprocess.check_output(['sysctl', '-n', 'hw.memsize']))
     except Exception:
       return 0
+  elif sys.platform.startswith('freebsd'):
+    try:
+      avail_bytes = int(subprocess.check_output(['sysctl', '-n', 'hw.physmem']))
+      # With -fuse-lld it doesn't take a lot of ram, feel free to change that
+      # 1 * ... to needed amount
+      return max(1, avail_bytes / (1 * (2 ** 30)))  # total / 4GB
+    except Exception:
+      return 1
   # TODO(scottmg): Implement this for other platforms.
   return 0