kivy-ios/biglink
Mathieu Virbel de94011871 wip
2011-12-05 10:09:35 +01:00

50 lines
990 B
Python
Executable file

#!/usr/bin/env python
import os
import sys
import subprocess
sofiles = [ ]
for dir in sys.argv[1:]:
for fn in os.listdir(dir):
fn = os.path.join(dir, fn)
if not fn.endswith(".so"):
continue
if not os.path.exists(fn + ".o"):
continue
if not os.path.exists(fn + ".libs"):
continue
sofiles.append(fn)
# The raw argument list.
args = [ ]
for fn in sofiles:
afn = fn + ".o"
libsfn = fn + ".libs"
args.append(afn)
args.extend(file(libsfn).read().split(" "))
unique_args = [ ]
while args:
a = args.pop()
if a not in unique_args:
unique_args.insert(0, a)
#args = os.environ["CC"].split() + \
# [ '-shared', "-O3", "-o", "libpymodules.so" ] + \
# unique_args
#subprocess.call(args)
print unique_args
unique_args = ' '.join([ x for x in unique_args if x.endswith('.so.o') ])
print unique_args
subprocess.Popen("ar -q kivy.a " + unique_args, shell=True).communicate()