[DEV] better remove of libc++

This commit is contained in:
Edouard DUPIN 2016-01-11 21:30:50 +01:00
parent 9b9c65d036
commit d21217bfc4
11 changed files with 116 additions and 53 deletions

View File

@ -97,6 +97,15 @@ def warning(input, force=False):
print(color_purple + "[WARNING] " + input + color_default) print(color_purple + "[WARNING] " + input + color_default)
debugLock.release() debugLock.release()
def todo(input, force=False):
global debugLock
global debugLevel
if debugLevel >= 3 \
or force == True:
debugLock.acquire()
print(color_purple + "[TODO] " + input + color_default)
debugLock.release()
def error(input, threadID=-1, force=False, crash=True): def error(input, threadID=-1, force=False, crash=True):
global debugLock global debugLock
global debugLevel global debugLevel

View File

@ -76,38 +76,42 @@ def print_pretty(my_string, force=False):
baseElementList = [] baseElementList = []
if end_with(cmdApplication, ["javac"]) == True: if end_with(cmdApplication, ["javac"]) == True:
baseElementList = [ baseElementList = [
"-d", "-d",
"-D", "-D",
"-classpath", "-classpath",
"-sourcepath" "-sourcepath"
] ]
elif end_with(cmdApplication, ["jar"]) == True: elif end_with(cmdApplication, ["jar"]) == True:
baseElementList = [ baseElementList = [
"cf", "cf",
"-C" "-C"
] ]
elif end_with(cmdApplication, ["aapt"]) == True: elif end_with(cmdApplication, ["aapt"]) == True:
baseElementList = [ baseElementList = [
"-M", "-M",
"-F", "-F",
"-I", "-I",
"-S", "-S",
"-J" "-J"
] ]
elif end_with(cmdApplication, ["g++", "gcc", "clang", "clang++", "ar", "ld", "ranlib"]) == True: elif end_with(cmdApplication, ["g++", "gcc", "clang", "clang++", "ar", "ld", "ranlib"]) == True:
baseElementList = [ baseElementList = [
"-o", "-o",
"-D", "-D",
"-I", "-I",
"-L", "-L",
"-framework", "-framework",
"-isysroot", "-isysroot",
"-arch", "-arch",
"-keystore", "-keystore",
"-sigalg", "-sigalg",
"-digestalg", "-digestalg",
"-target", "-target",
"-gcc-toolchain"] "-gcc-toolchain",
"-current_version",
"-compatibility_version"
]
for element in baseElementList: for element in baseElementList:
tmpcmdLine = tmpcmdLine.replace(element+'\n\t', element+' ') tmpcmdLine = tmpcmdLine.replace(element+'\n\t', element+' ')
for element in ["<", "<<", ">", ">>"]: for element in ["<", "<<", ">", ">>"]:

View File

@ -711,6 +711,7 @@ class Module:
tools.list_append_to_2(self.flags["export"], type, list) tools.list_append_to_2(self.flags["export"], type, list)
# add the link flag at the module # add the link flag at the module
# TODO : Rename this in add_flag
def compile_flags(self, type, list): def compile_flags(self, type, list):
tools.list_append_to_2(self.flags["local"], type, list) tools.list_append_to_2(self.flags["local"], type, list)

View File

@ -217,6 +217,16 @@ class Target:
self.dlltool = self.cross + "dlltool" self.dlltool = self.cross + "dlltool"
self.update_path_tree() self.update_path_tree()
#some static libraries that is sometime needed when not use stdlib ...
ret = multiprocess.run_command_direct(self.xx + " -print-file-name=libgcc.a");
if ret == False:
debug.error("Can not get the g++/clang++ libgcc.a ...")
self.stdlib_name_libgcc = ret;
ret = multiprocess.run_command_direct(self.xx + " -print-file-name=libsupc++.a");
if ret == False:
debug.error("Can not get the g++/clang++ libsupc++.a ...")
self.stdlib_name_libsupc = ret;
def get_build_mode(self): def get_build_mode(self):
return self.config["mode"] return self.config["mode"]

View File

@ -62,9 +62,14 @@ def link(file, binary, target, depancy, flags, name, basic_path, static = False)
if lib_name not in depancy.src['dynamic']: if lib_name not in depancy.src['dynamic']:
list_static.append(elem) list_static.append(elem)
#create comand line: #create comand line:
cmd = [ cmd = []
target.xx # a specific case to not depend on the libstdc++ automaticly added by the G++ or clang++ compilator ==> then need to compile with GCC or CLANG if use libcxx from llvm or other ...
] if "need-libstdc++" in depancy.flags \
and depancy.flags["need-libstdc++"] == True:
cmd.append(target.xx)
else:
cmd.append(target.cc)
try: try:
cmd.append(target.arch) cmd.append(target.arch)
except: except:

View File

@ -59,10 +59,15 @@ def link(file, binary, target, depancy, flags, name, basic_path, static=False):
if lib_name not in depancy.src['dynamic']: if lib_name not in depancy.src['dynamic']:
list_static.append(elem) list_static.append(elem)
#create command Line #create command Line
cmd = [ cmd = []
target.xx, # a specific case to not depend on the libstdc++ automaticly added by the G++ or clang++ compilator ==> then need to compile with GCC or CLANG if use libcxx from llvm or other ...
"-o", file_dst if "need-libstdc++" in depancy.flags \
] and depancy.flags["need-libstdc++"] == True:
cmd.append(target.xx)
else:
cmd.append(target.cc)
cmd.append(["-o", file_dst])
try: try:
cmd.append(target.global_sysroot) cmd.append(target.global_sysroot)
except: except:
@ -76,6 +81,22 @@ def link(file, binary, target, depancy, flags, name, basic_path, static=False):
cmd.append(file_src) cmd.append(file_src)
except: except:
pass pass
for view in ["local", "export"]:
for type in ["link", "link-dynamic"]:
try:
cmd.append(flags[view][type])
except:
pass
for type in ["link", "link-dynamic"]:
try:
cmd.append(depancy.flags[type])
except:
pass
for type in ["link", "link-dynamic"]:
try:
cmd.append(target.global_flags[type])
except:
pass
try: try:
# keep only compilated files ... # keep only compilated files ...
cmd.append(tools.filter_extention(depancy.src['src'], get_input_type())) cmd.append(tools.filter_extention(depancy.src['src'], get_input_type()))
@ -97,22 +118,6 @@ def link(file, binary, target, depancy, flags, name, basic_path, static=False):
cmd.append("-Wl,-R$ORIGIN/../lib/") cmd.append("-Wl,-R$ORIGIN/../lib/")
except: except:
pass pass
try:
cmd.append(flags["local"]["link"])
except:
pass
try:
cmd.append(flags["export"]["link"])
except:
pass
try:
cmd.append(depancy.flags["link"])
except:
pass
try:
cmd.append(target.global_flags["link"])
except:
pass
cmdLine=tools.list_to_str(cmd) cmdLine=tools.list_to_str(cmd)
# check the dependency for this file : # check the dependency for this file :
if depend.need_re_package(file_dst, file_src, True, file_cmd, cmdLine) == False \ if depend.need_re_package(file_dst, file_src, True, file_cmd, cmdLine) == False \

View File

@ -19,7 +19,8 @@ class System(system.System):
self.help = "CXX: Generic C++ library" self.help = "CXX: Generic C++ library"
self.valid = True self.valid = True
# no check needed ==> just add this: # no check needed ==> just add this:
self.add_export_flag("c++","-D__STDCPP_LLVM__") self.add_export_flag("c++", "-D__STDCPP_LLVM__")
self.add_export_flag("c++-remove","-nostdlib") self.add_export_flag("c++-remove", "-nostdlib")
self.add_export_flag("need-libstdc++", True)

View File

@ -19,7 +19,8 @@ class System(system.System):
self.help = "CXX: Generic C++ library" self.help = "CXX: Generic C++ library"
self.valid = True self.valid = True
# no check needed ==> just add this: # no check needed ==> just add this:
self.add_export_flag("c++","-D__STDCPP_GNU__") self.add_export_flag("c++", "-D__STDCPP_GNU__")
self.add_export_flag("c++-remove","-nostdlib") self.add_export_flag("c++-remove", "-nostdlib")
self.add_export_flag("need-libstdc++", True)

View File

@ -0,0 +1,25 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
from lutin import debug
from lutin import system
from lutin import tools
import os
class System(system.System):
def __init__(self, target):
system.System.__init__(self)
# create some HELP:
self.help="M : m library \n base of std libs (availlagle in GNU C lib and bionic"
# No check ==> on the basic std libs:
self.valid = True
# todo : create a searcher of the presence of the library:
self.add_export_flag("link", "-lm")

View File

@ -21,5 +21,6 @@ class System(system.System):
# no check needed ==> just add this: # no check needed ==> just add this:
self.add_export_flag("c++","-D__STDCPP_LLVM__") self.add_export_flag("c++","-D__STDCPP_LLVM__")
self.add_export_flag("c++-remove","-nostdlib") self.add_export_flag("c++-remove","-nostdlib")
self.add_export_flag("need-libstdc++", True)

View File

@ -27,5 +27,6 @@ class System(system.System):
"-static-libstdc++", "-static-libstdc++",
"-static" "-static"
]) ])
self.add_export_flag("need-libstdc++", True)