forked from kivy/python-for-android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbiglink
executable file
·52 lines (38 loc) · 1014 Bytes
/
biglink
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env python
from __future__ import print_function
import os
import sys
import subprocess
sofiles = [ ]
for directory in sys.argv[2:]:
for fn in os.listdir(directory):
fn = os.path.join(directory, fn)
if not fn.endswith(".so.o"):
continue
if not os.path.exists(fn[:-2] + ".libs"):
continue
sofiles.append(fn[:-2])
# The raw argument list.
args = [ ]
for fn in sofiles:
afn = fn + ".o"
libsfn = fn + ".libs"
args.append(afn)
with open(libsfn) as fd:
data = fd.read()
args.extend(data.split(" "))
unique_args = [ ]
while args:
a = args.pop()
if a in ('-L', ):
continue
if a not in unique_args:
unique_args.insert(0, a)
print('Biglink create %s library' % sys.argv[1])
print('Biglink arguments:')
for arg in unique_args:
print(' %s' % arg)
args = os.environ['CC'].split() + \
['-shared', '-O3', '-o', sys.argv[1]] + \
unique_args
sys.exit(subprocess.call(args))