Commits

flie...@gmail.com@3b770cb8-f9e6-11dd-ac5b-dfceb64ead24  committed 0513220

issue #106 check arm platform with os.name()

  • Participants
  • Parent commits 78c58de

Comments (0)

Files changed (1)

     if is_freebsd:
         libraries += ["execinfo"]
 
-    if hasattr(os, 'uname') and os.uname()[-1] == 'x86_64':
-        extra_link_args += ["-fPIC"]
-        macros += [("V8_TARGET_ARCH_X64", None)]
+    if hasattr(os, 'uname'):
+        if os.uname()[-1] in ('x86_64', 'amd64'):
+            extra_link_args += ["-fPIC"]
+            macros += [("V8_TARGET_ARCH_X64", None)]
+        elif os.uname()[-1].startswith('arm'):
+            macros += [("V8_TARGET_ARCH_ARM", None)]
     else:
         macros += [("V8_TARGET_ARCH_IA32", None)]
 
         with open(scons, 'r') as f:
             build_script = f.read()
 
-        x64 = [k for k, v in macros if k == 'V8_TARGET_ARCH_X64']
+        is_x64 = [k for k, v in macros if k == 'V8_TARGET_ARCH_X64']
+        is_arm = [k for k, v in macros if k == 'V8_TARGET_ARCH_ARM']
         
         fixed_build_script = build_script.replace('-fno-rtti', '') \
                                          .replace('-fno-exceptions', '') \
                                          .replace('-Werror', '') \
                                          .replace('/WX', '').replace('/GR-', '')
 
-        if x64 and os.name != 'nt':
+        if is_x64 and os.name != 'nt':
             fixed_build_script = fixed_build_script.replace("['$DIALECTFLAGS', '$WARNINGFLAGS']", "['$DIALECTFLAGS', '$WARNINGFLAGS', '-fPIC']")
 
         if build_script == fixed_build_script:
 
         options = {
             'mode': 'debug' if DEBUG else 'release',
-            'arch': 'x64' if x64 else 'ia32',
+            'arch': 'x64' if is_x64 else 'arm' if is_arm else 'ia32',
             'regexp': 'native' if V8_NATIVE_REGEXP else 'interpreted',
             'snapshot': 'on' if V8_SNAPSHOT_ENABLED else 'off',
             'vmstate': 'on' if V8_VMSTATE_TRACKING else 'off',