2013-11-30 22:52:21 -06:00
|
|
|
# xfail-license
|
|
|
|
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
import subprocess
|
|
|
|
|
2013-12-16 23:35:22 -06:00
|
|
|
f = open(sys.argv[1], 'wb')
|
2013-11-30 22:52:21 -06:00
|
|
|
|
2013-12-16 23:35:22 -06:00
|
|
|
components = sys.argv[2].split(' ')
|
|
|
|
|
|
|
|
f.write("""// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
2013-11-30 22:52:21 -06:00
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
|
|
|
// WARNING: THIS IS A GENERATED FILE, DO NOT MODIFY
|
|
|
|
// take a look at src/etc/mklldeps.py if you're interested
|
2013-12-16 23:35:22 -06:00
|
|
|
""")
|
2013-11-30 22:52:21 -06:00
|
|
|
|
2013-12-16 23:35:22 -06:00
|
|
|
for llconfig in sys.argv[3:]:
|
|
|
|
f.write("\n")
|
2013-11-30 22:52:21 -06:00
|
|
|
|
|
|
|
proc = subprocess.Popen([llconfig, '--host-target'], stdout = subprocess.PIPE)
|
|
|
|
out, err = proc.communicate()
|
|
|
|
arch, os = out.split('-', 1)
|
|
|
|
arch = 'x86' if arch == 'i686' or arch == 'i386' else arch
|
|
|
|
if 'darwin' in os:
|
|
|
|
os = 'macos'
|
|
|
|
elif 'linux' in os:
|
|
|
|
os = 'linux'
|
|
|
|
elif 'freebsd' in os:
|
|
|
|
os = 'freebsd'
|
|
|
|
elif 'android' in os:
|
|
|
|
os = 'android'
|
|
|
|
elif 'win' in os or 'mingw' in os:
|
|
|
|
os = 'win32'
|
|
|
|
cfg = [
|
|
|
|
"target_arch = \"" + arch + "\"",
|
|
|
|
"target_os = \"" + os + "\"",
|
|
|
|
]
|
|
|
|
|
2013-12-16 23:35:22 -06:00
|
|
|
f.write("#[cfg(" + ', '.join(cfg) + ")]\n")
|
2013-11-30 22:52:21 -06:00
|
|
|
|
|
|
|
args = [llconfig, '--libs']
|
|
|
|
args.extend(components)
|
|
|
|
proc = subprocess.Popen(args, stdout = subprocess.PIPE)
|
|
|
|
out, err = proc.communicate()
|
|
|
|
|
|
|
|
for lib in out.strip().split(' '):
|
|
|
|
lib = lib[2:] # chop of the leading '-l'
|
2013-12-16 23:35:22 -06:00
|
|
|
f.write("#[link(name = \"" + lib + "\", kind = \"static\")]\n")
|
2013-11-30 22:52:21 -06:00
|
|
|
if os == 'win32':
|
2013-12-16 23:35:22 -06:00
|
|
|
f.write("#[link(name = \"imagehlp\")]\n")
|
|
|
|
f.write("extern {}\n")
|