Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

build: fix host/target arch detection

Setting the target_arch without setting the host_arch as well was
effectively broken.
  • Loading branch information...
commit 9cd9bd33b47530e191bdee39bb6a9e5d33ee6053 1 parent 9aab5d4
@bnoordhuis bnoordhuis authored
Showing with 13 additions and 1 deletion.
  1. +13 −1 gyp_uv
View
14 gyp_uv
@@ -1,6 +1,7 @@
#!/usr/bin/env python
import glob
+import platform
import os
import subprocess
import sys
@@ -18,6 +19,14 @@ except ImportError:
sys.exit(42)
+def host_arch():
+ machine = platform.machine()
+ if machine == 'i386': return 'ia32'
+ if machine == 'x86_64': return 'x64'
+ if machine.startswith('arm'): return 'arm'
+ return machine # Return as-is and hope for the best.
+
+
def compiler_version():
proc = subprocess.Popen(CC.split() + ['--version'], stdout=subprocess.PIPE)
is_clang = 'clang' in proc.communicate()[0].split('\n')[0]
@@ -72,8 +81,11 @@ if __name__ == '__main__':
args.append('-Dgcc_version=%d' % (10 * major + minor))
args.append('-Dclang=%d' % int(is_clang))
+ if not any(a.startswith('-Dhost_arch=') for a in args):
+ args.append('-Dhost_arch=%s' % host_arch())
+
if not any(a.startswith('-Dtarget_arch=') for a in args):
- args.append('-Dtarget_arch=ia32')
+ args.append('-Dtarget_arch=%s' % host_arch())
if not any(a.startswith('-Dlibrary=') for a in args):
args.append('-Dlibrary=static_library')
Please sign in to comment.
Something went wrong with that request. Please try again.