summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJulian Taylor <jtaylor.debian@googlemail.com>2014-06-04 21:06:12 +0200
committerJulian Taylor <jtaylor.debian@googlemail.com>2014-06-04 21:06:12 +0200
commit3cca518407b638d4e901241c8dc75e480a5652a2 (patch)
tree45361d474035fecd61c05dcfb5c56d0f6570e6e6 /tools
parentd856a7f8a1fdca371fe090d2eaf731d69f26e1dd (diff)
downloadnumpy-3cca518407b638d4e901241c8dc75e480a5652a2.tar.gz
BLD: add a simple python file to build cpucaps.dll
using scons seems to fail with wine 1.6, but one only needs to run three commands so its simpler to just put these into a script instead of trying to debug scons.
Diffstat (limited to 'tools')
-rw-r--r--tools/win32build/README.txt2
-rw-r--r--tools/win32build/build-cpucaps.py15
2 files changed, 17 insertions, 0 deletions
diff --git a/tools/win32build/README.txt b/tools/win32build/README.txt
index fe8522c19..0aba2045e 100644
--- a/tools/win32build/README.txt
+++ b/tools/win32build/README.txt
@@ -48,6 +48,8 @@ cpuid. To build it, you have two options:
- with scons: if you have scons, just do scons install. It will build
and put the CpuCaps.dll in the plugins directory of nsis (if you
install nsis in the default path).
+ - run build-cpucaps.py with a windows python, e.g.
+ wine "C:\Python27\python" build-cpucaps.py
build.py:
---------
diff --git a/tools/win32build/build-cpucaps.py b/tools/win32build/build-cpucaps.py
new file mode 100644
index 000000000..d6a9dabc2
--- /dev/null
+++ b/tools/win32build/build-cpucaps.py
@@ -0,0 +1,15 @@
+import os
+import subprocess
+# build cpucaps.dll
+# needs to be run in tools/win32build folder under wine
+# e.g. wine "C:\Python27\python" build-cpucaps.py
+cc = os.environ.get('CC', 'gcc')
+fmt = (cc, os.getcwd())
+cmd = '"{0}" -o cpucaps_main.o -c -W -Wall "-I{1}/cpuid" "-I{1}/cpucaps" cpucaps/cpucaps_main.c'.format(*fmt)
+subprocess.check_call(cmd, shell=True)
+cmd = '"{0}" -o cpuid.o -c -W -Wall "-I{1}/cpuid" cpuid/cpuid.c'.format(*fmt)
+subprocess.check_call(cmd, shell=True)
+cmd = '"{0}" -shared -Wl,--out-implib,libcpucaps.a -o cpucaps.dll cpuid.o cpucaps_main.o'.format(*fmt)
+subprocess.check_call(cmd, shell=True)
+os.remove('cpuid.o')
+os.remove('cpucaps_main.o')