lbry-fdroid/p4a/pythonforandroid/bootstraps/pygame/build/tools/liblink-jb

44 lines
873 B
Text
Raw Normal View History

2017-08-13 03:24:00 +02:00
#!/usr/bin/env python
from __future__ import print_function
import sys
import subprocess
from os import environ
from os.path import basename, join
libs = [ ]
libdirs = [ ]
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"):
libs.append(opt[2:])
continue
if opt.startswith("-L"):
libdirs.append(opt[2:])
continue
output = join(environ.get('LIBLINK_PATH'), basename(output))
with open(output + ".libs", "w") as f:
f.write("\n".join(libs))
with open(output + ".libdirs", "w") as f:
f.write("\n".join(libdirs))
libargs = ' '.join(["'%s'" % arg for arg in sys.argv[1:]])
cmd = '%s -shared %s %s' % (environ['CC'], environ['LDFLAGS'], libargs)
sys.exit(subprocess.call(cmd, shell=True))