c2c552e7a9
Numpy requires severals requirements: - It absolutely requires unittest, that was deleted before (reduce-python.sh) - It requires future_builtins (ModuleSetup) - Deduplication of symbols now can merge multiple .a for easier management in Xcode (tools/environments.sh) - Avoid passing specific linker parameters to ar (-Wl ignored in tools/liblink). Numpy itself have few patch for: - force endianess to be little, using directly endian.h leads to detection error during the build process. - force not BLAS to be built, Accelerate framework already have it - rework the dependencies relation for lapack_lite and _umath_linalg, to prevent duplicate symbols and force compilation of necessary module / missing symbols.
79 lines
1.4 KiB
Python
Executable file
79 lines
1.4 KiB
Python
Executable file
#!/usr/bin/env python
|
|
|
|
import sys
|
|
import subprocess
|
|
from os import environ
|
|
|
|
libs = [ ]
|
|
objects = [ ]
|
|
output = None
|
|
|
|
|
|
i = 1
|
|
while i < len(sys.argv):
|
|
opt = sys.argv[i]
|
|
i += 1
|
|
|
|
if opt == "-o":
|
|
output = sys.argv[i]
|
|
i += 1
|
|
continue
|
|
|
|
if opt.startswith("-l") or opt.startswith("-L"):
|
|
libs.append(opt)
|
|
continue
|
|
|
|
if opt in ("-r", "-pipe", "-no-cpp-precomp"):
|
|
continue
|
|
|
|
if opt in ("--sysroot", "-isysroot", "-framework", "-undefined",
|
|
"-macosx_version_min"):
|
|
i += 1
|
|
continue
|
|
|
|
if opt.startswith("-I"):
|
|
continue
|
|
|
|
if opt.startswith("-m"):
|
|
continue
|
|
|
|
if opt.startswith("-f"):
|
|
continue
|
|
|
|
if opt.startswith("-O"):
|
|
continue
|
|
|
|
if opt.startswith("-g"):
|
|
continue
|
|
|
|
if opt.startswith("-D"):
|
|
continue
|
|
|
|
if opt.startswith('-arch'):
|
|
continue
|
|
|
|
if opt.startswith("-Wl,"):
|
|
continue
|
|
|
|
if opt.startswith("-"):
|
|
print(sys.argv)
|
|
print("Unknown option: ", opt)
|
|
sys.exit(1)
|
|
|
|
if not opt.endswith('.o'):
|
|
continue
|
|
|
|
objects.append(opt)
|
|
|
|
|
|
f = open(output, "w")
|
|
f.close()
|
|
|
|
f = open(output + ".libs", "w")
|
|
f.write(" ".join(libs))
|
|
f.close()
|
|
|
|
print('Liblink redirect linking with', objects)
|
|
subprocess.call([
|
|
environ.get('ARM_LD'), '-r',
|
|
'-o', output + '.o', '-arch', 'armv7'] + objects)
|