2011-12-05 10:09:35 +01:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
import subprocess
|
|
|
|
|
|
|
|
sofiles = [ ]
|
|
|
|
|
2011-12-06 10:49:14 +01:00
|
|
|
for dir in sys.argv[2:]:
|
2011-12-05 10:09:35 +01:00
|
|
|
|
|
|
|
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)
|
2014-02-03 06:53:30 +01:00
|
|
|
args.extend(open(libsfn).read().split(" "))
|
2011-12-05 10:09:35 +01:00
|
|
|
|
|
|
|
unique_args = [ ]
|
|
|
|
|
|
|
|
while args:
|
|
|
|
a = args.pop()
|
|
|
|
if a not in unique_args:
|
|
|
|
unique_args.insert(0, a)
|
|
|
|
|
|
|
|
|
|
|
|
unique_args = ' '.join([ x for x in unique_args if x.endswith('.so.o') ])
|
2014-02-03 06:53:30 +01:00
|
|
|
print('Biglink create %s library' % sys.argv[1])
|
2011-12-06 11:42:37 +01:00
|
|
|
subprocess.Popen(("ar -q %s " % sys.argv[1]) + unique_args, shell=True).communicate()
|