[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)
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):
global debugLock
global debugLevel

View File

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

View File

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

View File

@ -216,6 +216,16 @@ class Target:
self.strip = self.cross + "strip"
self.dlltool = self.cross + "dlltool"
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):
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']:
list_static.append(elem)
#create comand line:
cmd = [
target.xx
]
cmd = []
# 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:
cmd.append(target.arch)
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']:
list_static.append(elem)
#create command Line
cmd = [
target.xx,
"-o", file_dst
]
cmd = []
# 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)
cmd.append(["-o", file_dst])
try:
cmd.append(target.global_sysroot)
except:
@ -76,6 +81,22 @@ def link(file, binary, target, depancy, flags, name, basic_path, static=False):
cmd.append(file_src)
except:
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:
# keep only compilated files ...
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/")
except:
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)
# check the dependency for this file :
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.valid = True
# no check needed ==> just add this:
self.add_export_flag("c++","-D__STDCPP_LLVM__")
self.add_export_flag("c++-remove","-nostdlib")
self.add_export_flag("c++", "-D__STDCPP_LLVM__")
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.valid = True
# no check needed ==> just add this:
self.add_export_flag("c++","-D__STDCPP_GNU__")
self.add_export_flag("c++-remove","-nostdlib")
self.add_export_flag("c++", "-D__STDCPP_GNU__")
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:
self.add_export_flag("c++","-D__STDCPP_LLVM__")
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"
])
self.add_export_flag("need-libstdc++", True)