Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
ca67cb4c26 | |||
836dee5cf8 | |||
d70b82683b | |||
93693ed0f0 | |||
eeb070e014 | |||
99927380d6 | |||
8fc81f1caa | |||
5f325c2d7e | |||
f65a5f58ee | |||
4020c70fc3 | |||
6cb2ef2bd2 | |||
aa120cde57 | |||
2604cd93be |
@@ -3,6 +3,9 @@ Lutin
|
|||||||
|
|
||||||
`lutin` is a generic builder and package maker is a FREE software tool.
|
`lutin` is a generic builder and package maker is a FREE software tool.
|
||||||
|
|
||||||
|
.. image:: https://badge.fury.io/py/lutin.png
|
||||||
|
:target: https://pypi.python.org/pypi/lutin
|
||||||
|
|
||||||
Instructions
|
Instructions
|
||||||
------------
|
------------
|
||||||
|
|
||||||
|
63
bin/lutin
63
bin/lutin
@@ -27,10 +27,12 @@ myArgs.add(arguments.ArgDefine("f", "force", desc="Force the rebuild without che
|
|||||||
myArgs.add(arguments.ArgDefine("P", "pretty", desc="print the debug has pretty display"))
|
myArgs.add(arguments.ArgDefine("P", "pretty", desc="print the debug has pretty display"))
|
||||||
myArgs.add(arguments.ArgDefine("j", "jobs", haveParam=True, desc="Specifies the number of jobs (commands) to run simultaneously"))
|
myArgs.add(arguments.ArgDefine("j", "jobs", haveParam=True, desc="Specifies the number of jobs (commands) to run simultaneously"))
|
||||||
myArgs.add(arguments.ArgDefine("s", "force-strip", desc="Force the stripping of the compile elements"))
|
myArgs.add(arguments.ArgDefine("s", "force-strip", desc="Force the stripping of the compile elements"))
|
||||||
|
myArgs.add(arguments.ArgDefine("w", "warning", desc="Store warning in a file build file"))
|
||||||
|
|
||||||
myArgs.add_section("properties", "keep in the sequency of the cible")
|
myArgs.add_section("properties", "keep in the sequency of the cible")
|
||||||
myArgs.add(arguments.ArgDefine("t", "target", haveParam=True, desc="Select a target (by default the platform is the computer that compile this) To know list : 'lutin.py --list-target'"))
|
myArgs.add(arguments.ArgDefine("t", "target", haveParam=True, desc="Select a target (by default the platform is the computer that compile this) To know list : 'lutin.py --list-target'"))
|
||||||
myArgs.add(arguments.ArgDefine("c", "compilator", list=[["clang",""],["gcc",""]], desc="Compile with clang or Gcc mode (by default gcc will be used)"))
|
myArgs.add(arguments.ArgDefine("c", "compilator", list=[["clang",""],["gcc",""]], desc="Compile with clang or Gcc mode (by default gcc will be used)"))
|
||||||
|
myArgs.add(arguments.ArgDefine("", "compilator-version", haveParam=True, desc="with travis we need to specify the name of the version if we want to compile with gcc 4.9 ==> --compilator-version=4.9"))
|
||||||
myArgs.add(arguments.ArgDefine("m", "mode", list=[["debug",""],["release",""]], desc="Compile in release or debug mode (default release)"))
|
myArgs.add(arguments.ArgDefine("m", "mode", list=[["debug",""],["release",""]], desc="Compile in release or debug mode (default release)"))
|
||||||
myArgs.add(arguments.ArgDefine("a", "arch", list=[["auto","Automatic choice"],["arm","Arm processer"],["x86","Generic PC : AMD/Intel"],["ppc","Power PC"]], desc="Architecture to compile"))
|
myArgs.add(arguments.ArgDefine("a", "arch", list=[["auto","Automatic choice"],["arm","Arm processer"],["x86","Generic PC : AMD/Intel"],["ppc","Power PC"]], desc="Architecture to compile"))
|
||||||
myArgs.add(arguments.ArgDefine("b", "bus", list=[["auto","Automatic choice"],["32","32 bits"],["64","64 bits"]], desc="Adressing size (Bus size)"))
|
myArgs.add(arguments.ArgDefine("b", "bus", list=[["auto","Automatic choice"],["32","32 bits"],["64","64 bits"]], desc="Adressing size (Bus size)"))
|
||||||
@@ -47,18 +49,21 @@ localArgument = myArgs.parse()
|
|||||||
display the help of this makefile
|
display the help of this makefile
|
||||||
"""
|
"""
|
||||||
def usage():
|
def usage():
|
||||||
|
color = debug.get_color_set()
|
||||||
# generic argument displayed :
|
# generic argument displayed :
|
||||||
myArgs.display()
|
myArgs.display()
|
||||||
print(" All target can finish with '?clean' '?dump' ... ?action")
|
print(" All target can finish with '?clean' '?dump' '?gcov' ... ?action")
|
||||||
print(" all")
|
print(" " + color['green'] + "all" + color['default'])
|
||||||
print(" build all (only for the current selected board) (bynary and packages)")
|
print(" build all (only for the current selected board) (bynary and packages)")
|
||||||
print(" clean")
|
print(" " + color['green'] + "clean" + color['default'])
|
||||||
print(" clean all (same as previous)")
|
print(" clean all (same as previous)")
|
||||||
print(" dump")
|
print(" " + color['green'] + "dump" + color['default'])
|
||||||
print(" Dump all the module dependency and properties")
|
print(" Dump all the module dependency and properties")
|
||||||
|
print(" " + color['green'] + "gcov" + color['default'])
|
||||||
|
print(" Parse all the code of the library with the gcov resolution")
|
||||||
listOfAllModule = module.list_all_module_with_desc()
|
listOfAllModule = module.list_all_module_with_desc()
|
||||||
for mod in listOfAllModule:
|
for mod in listOfAllModule:
|
||||||
print(" " + mod[0])
|
print(" " + color['green'] + mod[0] + color['default'])
|
||||||
if mod[1] != "":
|
if mod[1] != "":
|
||||||
print(" " + mod[1])
|
print(" " + mod[1])
|
||||||
print(" ex: " + sys.argv[0] + " all --target=Android all -t Windows -m debug all")
|
print(" ex: " + sys.argv[0] + " all --target=Android all -t Windows -m debug all")
|
||||||
@@ -66,12 +71,12 @@ def usage():
|
|||||||
|
|
||||||
# preparse the argument to get the verbose element for debug mode
|
# preparse the argument to get the verbose element for debug mode
|
||||||
def parseGenericArg(argument, active):
|
def parseGenericArg(argument, active):
|
||||||
if argument.get_option_nName() == "help":
|
if argument.get_option_name() == "help":
|
||||||
#display help
|
#display help
|
||||||
if active==False:
|
if active==False:
|
||||||
usage()
|
usage()
|
||||||
return True
|
return True
|
||||||
if argument.get_option_nName() == "list-module":
|
if argument.get_option_name() == "list-module":
|
||||||
if active==False:
|
if active==False:
|
||||||
listOfModule = module.list_all_module()
|
listOfModule = module.list_all_module()
|
||||||
retValue = ""
|
retValue = ""
|
||||||
@@ -82,7 +87,7 @@ def parseGenericArg(argument, active):
|
|||||||
print(retValue)
|
print(retValue)
|
||||||
exit(0)
|
exit(0)
|
||||||
return True
|
return True
|
||||||
if argument.get_option_nName() == "list-target":
|
if argument.get_option_name() == "list-target":
|
||||||
if active==False:
|
if active==False:
|
||||||
listOfTarget = target.list_all_target()
|
listOfTarget = target.list_all_target()
|
||||||
retValue = ""
|
retValue = ""
|
||||||
@@ -93,30 +98,34 @@ def parseGenericArg(argument, active):
|
|||||||
print(retValue)
|
print(retValue)
|
||||||
exit(0)
|
exit(0)
|
||||||
return True
|
return True
|
||||||
elif argument.get_option_nName()=="jobs":
|
elif argument.get_option_name()=="jobs":
|
||||||
if active==True:
|
if active==True:
|
||||||
multiprocess.set_core_number(int(argument.get_arg()))
|
multiprocess.set_core_number(int(argument.get_arg()))
|
||||||
return True
|
return True
|
||||||
elif argument.get_option_nName() == "verbose":
|
elif argument.get_option_name() == "verbose":
|
||||||
if active==True:
|
if active==True:
|
||||||
debug.set_level(int(argument.get_arg()))
|
debug.set_level(int(argument.get_arg()))
|
||||||
return True
|
return True
|
||||||
elif argument.get_option_nName() == "color":
|
elif argument.get_option_name() == "color":
|
||||||
if active==True:
|
if active==True:
|
||||||
debug.enable_color()
|
debug.enable_color()
|
||||||
return True
|
return True
|
||||||
elif argument.get_option_nName() == "force":
|
elif argument.get_option_name() == "force":
|
||||||
if active==True:
|
if active==True:
|
||||||
env.set_force_mode(True)
|
env.set_force_mode(True)
|
||||||
return True
|
return True
|
||||||
elif argument.get_option_nName() == "pretty":
|
elif argument.get_option_name() == "pretty":
|
||||||
if active==True:
|
if active==True:
|
||||||
env.set_print_pretty_mode(True)
|
env.set_print_pretty_mode(True)
|
||||||
return True
|
return True
|
||||||
elif argument.get_option_nName() == "force-strip":
|
elif argument.get_option_name() == "force-strip":
|
||||||
if active==True:
|
if active==True:
|
||||||
env.set_force_strip_mode(True)
|
env.set_force_strip_mode(True)
|
||||||
return True
|
return True
|
||||||
|
elif argument.get_option_name() == "warning":
|
||||||
|
if active==True:
|
||||||
|
env.set_warning_mode(True)
|
||||||
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# parse default unique argument:
|
# parse default unique argument:
|
||||||
@@ -139,7 +148,8 @@ config = {
|
|||||||
"arch":"auto",
|
"arch":"auto",
|
||||||
"generate-package":True,
|
"generate-package":True,
|
||||||
"simulation":False,
|
"simulation":False,
|
||||||
"gcov":False
|
"gcov":False,
|
||||||
|
"compilator-version":""
|
||||||
}
|
}
|
||||||
# load the default target :
|
# load the default target :
|
||||||
my_target = None
|
my_target = None
|
||||||
@@ -148,23 +158,25 @@ actionDone=False
|
|||||||
for argument in localArgument:
|
for argument in localArgument:
|
||||||
if parseGenericArg(argument, False) == True:
|
if parseGenericArg(argument, False) == True:
|
||||||
continue
|
continue
|
||||||
elif argument.get_option_nName() == "package":
|
elif argument.get_option_name() == "compilator-version":
|
||||||
|
config["compilator-version"] = argument.get_arg()
|
||||||
|
elif argument.get_option_name() == "package":
|
||||||
config["generate-package"]=False
|
config["generate-package"]=False
|
||||||
elif argument.get_option_nName() == "simulation":
|
elif argument.get_option_name() == "simulation":
|
||||||
config["simulation"]=True
|
config["simulation"]=True
|
||||||
elif argument.get_option_nName() == "gcov":
|
elif argument.get_option_name() == "gcov":
|
||||||
config["gcov"]=True
|
config["gcov"]=True
|
||||||
elif argument.get_option_nName() == "bus":
|
elif argument.get_option_name() == "bus":
|
||||||
config["bus-size"]=argument.get_arg()
|
config["bus-size"]=argument.get_arg()
|
||||||
elif argument.get_option_nName() == "arch":
|
elif argument.get_option_name() == "arch":
|
||||||
config["arch"]=argument.get_arg()
|
config["arch"]=argument.get_arg()
|
||||||
elif argument.get_option_nName() == "compilator":
|
elif argument.get_option_name() == "compilator":
|
||||||
if config["compilator"] != argument.get_arg():
|
if config["compilator"] != argument.get_arg():
|
||||||
debug.debug("change compilator ==> " + argument.get_arg())
|
debug.debug("change compilator ==> " + argument.get_arg())
|
||||||
config["compilator"] = argument.get_arg()
|
config["compilator"] = argument.get_arg()
|
||||||
#remove previous target
|
#remove previous target
|
||||||
my_target = None
|
my_target = None
|
||||||
elif argument.get_option_nName() == "target":
|
elif argument.get_option_name() == "target":
|
||||||
# No check input ==> this will be verify automaticly chen the target will be loaded
|
# No check input ==> this will be verify automaticly chen the target will be loaded
|
||||||
if targetName != argument.get_arg():
|
if targetName != argument.get_arg():
|
||||||
targetName = argument.get_arg()
|
targetName = argument.get_arg()
|
||||||
@@ -177,18 +189,19 @@ for argument in localArgument:
|
|||||||
"arch":"auto",
|
"arch":"auto",
|
||||||
"generate-package":True,
|
"generate-package":True,
|
||||||
"simulation":False,
|
"simulation":False,
|
||||||
"gcov":False
|
"gcov":False,
|
||||||
|
"compilator-version":""
|
||||||
}
|
}
|
||||||
#remove previous target
|
#remove previous target
|
||||||
my_target = None
|
my_target = None
|
||||||
elif argument.get_option_nName() == "mode":
|
elif argument.get_option_name() == "mode":
|
||||||
if config["mode"] != argument.get_arg():
|
if config["mode"] != argument.get_arg():
|
||||||
config["mode"] = argument.get_arg()
|
config["mode"] = argument.get_arg()
|
||||||
debug.debug("change mode ==> " + config["mode"])
|
debug.debug("change mode ==> " + config["mode"])
|
||||||
#remove previous target
|
#remove previous target
|
||||||
my_target = None
|
my_target = None
|
||||||
else:
|
else:
|
||||||
if argument.get_option_nName() != "":
|
if argument.get_option_name() != "":
|
||||||
debug.warning("Can not understand argument : '" + argument.get_option_nName() + "'")
|
debug.warning("Can not understand argument : '" + argument.get_option_nName() + "'")
|
||||||
usage()
|
usage()
|
||||||
else:
|
else:
|
||||||
|
95
lutin/arg.py
95
lutin/arg.py
@@ -12,22 +12,22 @@ from . import debug
|
|||||||
|
|
||||||
class ArgElement:
|
class ArgElement:
|
||||||
def __init__(self, option, value=""):
|
def __init__(self, option, value=""):
|
||||||
self.m_option = option;
|
self.option = option;
|
||||||
self.m_arg = value;
|
self.arg = value;
|
||||||
|
|
||||||
def get_option_nName(self):
|
def get_option_name(self):
|
||||||
return self.m_option
|
return self.option
|
||||||
|
|
||||||
def get_arg(self):
|
def get_arg(self):
|
||||||
return self.m_arg
|
return self.arg
|
||||||
|
|
||||||
def display(self):
|
def display(self):
|
||||||
if len(self.m_arg)==0:
|
if len(self.arg)==0:
|
||||||
debug.info("option : " + self.m_option)
|
debug.info("option : " + self.option)
|
||||||
elif len(self.m_option)==0:
|
elif len(self.option)==0:
|
||||||
debug.info("element : " + self.m_arg)
|
debug.info("element : " + self.arg)
|
||||||
else:
|
else:
|
||||||
debug.info("option : " + self.m_option + ":" + self.m_arg)
|
debug.info("option : " + self.option + ":" + self.arg)
|
||||||
|
|
||||||
|
|
||||||
class ArgDefine:
|
class ArgDefine:
|
||||||
@@ -37,61 +37,62 @@ class ArgDefine:
|
|||||||
list=[], # ["val", "description"]
|
list=[], # ["val", "description"]
|
||||||
desc="",
|
desc="",
|
||||||
haveParam=False):
|
haveParam=False):
|
||||||
self.m_optionSmall = smallOption;
|
self.option_small = smallOption;
|
||||||
self.m_optionBig = bigOption;
|
self.option_big = bigOption;
|
||||||
self.m_list = list;
|
self.list = list;
|
||||||
if len(self.m_list)!=0:
|
if len(self.list)!=0:
|
||||||
self.m_haveParam = True
|
self.have_param = True
|
||||||
else:
|
else:
|
||||||
if True==haveParam:
|
if True==haveParam:
|
||||||
self.m_haveParam = True
|
self.have_param = True
|
||||||
else:
|
else:
|
||||||
self.m_haveParam = False
|
self.have_param = False
|
||||||
self.m_description = desc;
|
self.description = desc;
|
||||||
|
|
||||||
def get_option_small(self):
|
def get_option_small(self):
|
||||||
return self.m_optionSmall
|
return self.option_small
|
||||||
|
|
||||||
def get_option_big(self):
|
def get_option_big(self):
|
||||||
return self.m_optionBig
|
return self.option_big
|
||||||
|
|
||||||
def need_parameters(self):
|
def need_parameters(self):
|
||||||
return self.m_haveParam
|
return self.have_param
|
||||||
|
|
||||||
def get_porperties(self):
|
def get_porperties(self):
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
def check_availlable(self, argument):
|
def check_availlable(self, argument):
|
||||||
if len(self.m_list)==0:
|
if len(self.list)==0:
|
||||||
return True
|
return True
|
||||||
for element,desc in self.m_list:
|
for element,desc in self.list:
|
||||||
if element == argument:
|
if element == argument:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def display(self):
|
def display(self):
|
||||||
if self.m_optionSmall != "" and self.m_optionBig != "":
|
color = debug.get_color_set()
|
||||||
print(" -" + self.m_optionSmall + " / --" + self.m_optionBig)
|
if self.option_small != "" and self.option_big != "":
|
||||||
elif self.m_optionSmall != "":
|
print(" " + color['red'] + "-" + self.option_small + "" + color['default'] + " / " + color['red'] + "--" + self.option_big + color['default'])
|
||||||
print(" -" + self.m_optionSmall)
|
elif self.option_small != "":
|
||||||
elif self.m_optionBig != "":
|
print(" " + color['red'] + "-" + self.option_small + color['default'])
|
||||||
print(" --" + self.m_optionBig)
|
elif self.option_big != "":
|
||||||
|
print(" " + color['red'] + "--" + self.option_big + color['default'])
|
||||||
else:
|
else:
|
||||||
print(" ???? ==> internal error ...")
|
print(" ???? ==> internal error ...")
|
||||||
if self.m_description != "":
|
if self.description != "":
|
||||||
print(" " + self.m_description)
|
print(" " + self.description)
|
||||||
if len(self.m_list)!=0:
|
if len(self.list)!=0:
|
||||||
hasDescriptiveElement=False
|
hasDescriptiveElement=False
|
||||||
for val,desc in self.m_list:
|
for val,desc in self.list:
|
||||||
if desc!="":
|
if desc!="":
|
||||||
hasDescriptiveElement=True
|
hasDescriptiveElement=True
|
||||||
break;
|
break;
|
||||||
if hasDescriptiveElement==True:
|
if hasDescriptiveElement==True:
|
||||||
for val,desc in self.m_list:
|
for val,desc in self.list:
|
||||||
print(" " + val + " : " + desc)
|
print(" " + val + " : " + desc)
|
||||||
else:
|
else:
|
||||||
tmpElementPrint = ""
|
tmpElementPrint = ""
|
||||||
for val,desc in self.m_list:
|
for val,desc in self.list:
|
||||||
if len(tmpElementPrint)!=0:
|
if len(tmpElementPrint)!=0:
|
||||||
tmpElementPrint += " / "
|
tmpElementPrint += " / "
|
||||||
tmpElementPrint += val
|
tmpElementPrint += val
|
||||||
@@ -105,8 +106,8 @@ class ArgSection:
|
|||||||
def __init__(self,
|
def __init__(self,
|
||||||
sectionName="",
|
sectionName="",
|
||||||
desc=""):
|
desc=""):
|
||||||
self.m_section = sectionName;
|
self.section = sectionName;
|
||||||
self.m_description = desc;
|
self.description = desc;
|
||||||
|
|
||||||
def get_option_small(self):
|
def get_option_small(self):
|
||||||
return ""
|
return ""
|
||||||
@@ -115,10 +116,12 @@ class ArgSection:
|
|||||||
return ""
|
return ""
|
||||||
|
|
||||||
def get_porperties(self):
|
def get_porperties(self):
|
||||||
return " [" + self.m_section + "]"
|
color = debug.get_color_set()
|
||||||
|
return " [" + color['blue'] + self.section + color['default'] + "]"
|
||||||
|
|
||||||
def display(self):
|
def display(self):
|
||||||
print(" [" + self.m_section + "] : " + self.m_description)
|
color = debug.get_color_set()
|
||||||
|
print(" [" + color['blue'] + self.section + color['default'] + "] : " + self.description)
|
||||||
|
|
||||||
def parse(self, argList, currentID):
|
def parse(self, argList, currentID):
|
||||||
return currentID;
|
return currentID;
|
||||||
@@ -126,13 +129,13 @@ class ArgSection:
|
|||||||
|
|
||||||
class LutinArg:
|
class LutinArg:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.m_listProperties = []
|
self.listProperties = []
|
||||||
|
|
||||||
def add(self, argument):
|
def add(self, argument):
|
||||||
self.m_listProperties.append(argument) #ArgDefine(smallOption, bigOption, haveParameter, parameterList, description));
|
self.listProperties.append(argument) #ArgDefine(smallOption, bigOption, haveParameter, parameterList, description));
|
||||||
|
|
||||||
def add_section(self, sectionName, sectionDesc):
|
def add_section(self, sectionName, sectionDesc):
|
||||||
self.m_listProperties.append(ArgSection(sectionName, sectionDesc))
|
self.listProperties.append(ArgSection(sectionName, sectionDesc))
|
||||||
|
|
||||||
def parse(self):
|
def parse(self):
|
||||||
listArgument = [] # composed of list element
|
listArgument = [] # composed of list element
|
||||||
@@ -155,7 +158,7 @@ class LutinArg:
|
|||||||
argumentFound=False;
|
argumentFound=False;
|
||||||
if option[:2]=="--":
|
if option[:2]=="--":
|
||||||
# big argument
|
# big argument
|
||||||
for prop in self.m_listProperties:
|
for prop in self.listProperties:
|
||||||
if prop.get_option_big()=="":
|
if prop.get_option_big()=="":
|
||||||
continue
|
continue
|
||||||
if prop.get_option_big() == option[2:]:
|
if prop.get_option_big() == option[2:]:
|
||||||
@@ -197,7 +200,7 @@ class LutinArg:
|
|||||||
debug.error("UNKNOW argument : '" + argument + "'")
|
debug.error("UNKNOW argument : '" + argument + "'")
|
||||||
elif option[:1]=="-":
|
elif option[:1]=="-":
|
||||||
# small argument
|
# small argument
|
||||||
for prop in self.m_listProperties:
|
for prop in self.listProperties:
|
||||||
if prop.get_option_small()=="":
|
if prop.get_option_small()=="":
|
||||||
continue
|
continue
|
||||||
if prop.get_option_small() == option[1:1+len(prop.get_option_small())]:
|
if prop.get_option_small() == option[1:1+len(prop.get_option_small())]:
|
||||||
@@ -251,8 +254,8 @@ class LutinArg:
|
|||||||
def display(self):
|
def display(self):
|
||||||
print("usage:")
|
print("usage:")
|
||||||
listOfPropertiesArg = "";
|
listOfPropertiesArg = "";
|
||||||
for element in self.m_listProperties :
|
for element in self.listProperties :
|
||||||
listOfPropertiesArg += element.get_porperties()
|
listOfPropertiesArg += element.get_porperties()
|
||||||
print(" " + sys.argv[0] + listOfPropertiesArg + " ...")
|
print(" " + sys.argv[0] + listOfPropertiesArg + " ...")
|
||||||
for element in self.m_listProperties :
|
for element in self.listProperties :
|
||||||
element.display()
|
element.display()
|
@@ -139,3 +139,21 @@ def print_compilator(myString):
|
|||||||
debugLock.acquire()
|
debugLock.acquire()
|
||||||
print(myString)
|
print(myString)
|
||||||
debugLock.release()
|
debugLock.release()
|
||||||
|
|
||||||
|
def get_color_set() :
|
||||||
|
global color_default
|
||||||
|
global color_red
|
||||||
|
global color_green
|
||||||
|
global color_yellow
|
||||||
|
global color_blue
|
||||||
|
global color_purple
|
||||||
|
global color_cyan
|
||||||
|
return {
|
||||||
|
"default": color_default,
|
||||||
|
"red": color_red,
|
||||||
|
"green": color_green,
|
||||||
|
"yellow": color_yellow,
|
||||||
|
"blue": color_blue,
|
||||||
|
"purple": color_purple,
|
||||||
|
"cyan": color_cyan,
|
||||||
|
}
|
||||||
|
69
lutin/env.py
69
lutin/env.py
@@ -12,32 +12,45 @@ from . import debug
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
forceMode=False
|
force_mode=False
|
||||||
|
|
||||||
def set_force_mode(val):
|
def set_force_mode(val):
|
||||||
global forceMode
|
global force_mode
|
||||||
if val==1:
|
if val==1:
|
||||||
forceMode = 1
|
force_mode = 1
|
||||||
else:
|
else:
|
||||||
forceMode = 0
|
force_mode = 0
|
||||||
|
|
||||||
def get_force_mode():
|
def get_force_mode():
|
||||||
global forceMode
|
global force_mode
|
||||||
return forceMode
|
return force_mode
|
||||||
|
|
||||||
|
|
||||||
printPrettyMode=False
|
print_pretty_mode=False
|
||||||
|
|
||||||
def set_print_pretty_mode(val):
|
def set_print_pretty_mode(val):
|
||||||
global printPrettyMode
|
global print_pretty_mode
|
||||||
if val == True:
|
if val == True:
|
||||||
printPrettyMode = True
|
print_pretty_mode = True
|
||||||
else:
|
else:
|
||||||
printPrettyMode = False
|
print_pretty_mode = False
|
||||||
|
|
||||||
def get_print_pretty_mode():
|
def get_print_pretty_mode():
|
||||||
global printPrettyMode
|
global print_pretty_mode
|
||||||
return printPrettyMode
|
return print_pretty_mode
|
||||||
|
|
||||||
|
store_warning=False
|
||||||
|
def set_warning_mode(val):
|
||||||
|
global store_warning
|
||||||
|
if val == True:
|
||||||
|
store_warning = True
|
||||||
|
else:
|
||||||
|
store_warning = False
|
||||||
|
|
||||||
|
def get_warning_mode():
|
||||||
|
global store_warning
|
||||||
|
return store_warning
|
||||||
|
|
||||||
|
|
||||||
def end_with(name, list):
|
def end_with(name, list):
|
||||||
for appl in list:
|
for appl in list:
|
||||||
@@ -47,14 +60,14 @@ def end_with(name, list):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def print_pretty(myString, force=False):
|
def print_pretty(my_string, force=False):
|
||||||
global printPrettyMode
|
global print_pretty_mode
|
||||||
if printPrettyMode == True \
|
if print_pretty_mode == True \
|
||||||
or force == True:
|
or force == True:
|
||||||
if myString[len(myString)-1] == ' ':
|
if my_string[len(my_string)-1] == ' ':
|
||||||
tmpcmdLine = myString[:len(myString)-1]
|
tmpcmdLine = my_string[:len(my_string)-1]
|
||||||
else:
|
else:
|
||||||
tmpcmdLine = myString
|
tmpcmdLine = my_string
|
||||||
cmdApplication = tmpcmdLine.split(' ')[0]
|
cmdApplication = tmpcmdLine.split(' ')[0]
|
||||||
tmpcmdLine = tmpcmdLine.replace(' ', '\n\t')
|
tmpcmdLine = tmpcmdLine.replace(' ', '\n\t')
|
||||||
tmpcmdLine = tmpcmdLine.replace('\n\t\n\t', '\n\t')
|
tmpcmdLine = tmpcmdLine.replace('\n\t\n\t', '\n\t')
|
||||||
@@ -92,7 +105,9 @@ def print_pretty(myString, force=False):
|
|||||||
"-arch",
|
"-arch",
|
||||||
"-keystore",
|
"-keystore",
|
||||||
"-sigalg",
|
"-sigalg",
|
||||||
"-digestalg"]
|
"-digestalg",
|
||||||
|
"-target",
|
||||||
|
"-gcc-toolchain"]
|
||||||
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 ["<", "<<", ">", ">>"]:
|
||||||
@@ -101,18 +116,18 @@ def print_pretty(myString, force=False):
|
|||||||
|
|
||||||
return tmpcmdLine
|
return tmpcmdLine
|
||||||
else:
|
else:
|
||||||
return myString
|
return my_string
|
||||||
|
|
||||||
forceStripMode=False
|
force_strip_mode=False
|
||||||
|
|
||||||
def set_force_strip_mode(val):
|
def set_force_strip_mode(val):
|
||||||
global forceStripMode
|
global force_strip_mode
|
||||||
if val==True:
|
if val == True:
|
||||||
forceStripMode = True
|
force_strip_mode = True
|
||||||
else:
|
else:
|
||||||
forceStripMode = False
|
force_strip_mode = False
|
||||||
|
|
||||||
def get_force_strip_mode():
|
def get_force_strip_mode():
|
||||||
global forceStripMode
|
global force_strip_mode
|
||||||
return forceStripMode
|
return force_strip_mode
|
||||||
|
|
||||||
|
@@ -31,7 +31,7 @@ class HeritageList:
|
|||||||
self.src=[]
|
self.src=[]
|
||||||
self.path={}
|
self.path={}
|
||||||
|
|
||||||
self.listHeritage=[]
|
self.list_heritage=[]
|
||||||
if heritage != None:
|
if heritage != None:
|
||||||
self.add_heritage(heritage)
|
self.add_heritage(heritage)
|
||||||
|
|
||||||
@@ -39,22 +39,22 @@ class HeritageList:
|
|||||||
if type(heritage) == type(None) \
|
if type(heritage) == type(None) \
|
||||||
or heritage.name == "":
|
or heritage.name == "":
|
||||||
return
|
return
|
||||||
for element in self.listHeritage:
|
for element in self.list_heritage:
|
||||||
if element.name == heritage.name:
|
if element.name == heritage.name:
|
||||||
return
|
return
|
||||||
self.listHeritage.append(heritage)
|
self.list_heritage.append(heritage)
|
||||||
self.regenerate_tree()
|
self.regenerate_tree()
|
||||||
|
|
||||||
def add_heritage_list(self, heritage_list):
|
def add_heritage_list(self, heritage_list):
|
||||||
if type(heritage_list) == type(None):
|
if type(heritage_list) == type(None):
|
||||||
return
|
return
|
||||||
for herit in heritage_list.listHeritage:
|
for herit in heritage_list.list_heritage:
|
||||||
find = False
|
find = False
|
||||||
for element in self.listHeritage:
|
for element in self.list_heritage:
|
||||||
if element.name == herit.name:
|
if element.name == herit.name:
|
||||||
find = True
|
find = True
|
||||||
if find == False:
|
if find == False:
|
||||||
self.listHeritage.append(herit)
|
self.list_heritage.append(herit)
|
||||||
self.regenerate_tree()
|
self.regenerate_tree()
|
||||||
|
|
||||||
def regenerate_tree(self):
|
def regenerate_tree(self):
|
||||||
@@ -63,34 +63,34 @@ class HeritageList:
|
|||||||
self.src=[]
|
self.src=[]
|
||||||
self.path={}
|
self.path={}
|
||||||
# reorder heritage list :
|
# reorder heritage list :
|
||||||
listHeritage = self.listHeritage
|
listHeritage = self.list_heritage
|
||||||
self.listHeritage = []
|
self.list_heritage = []
|
||||||
# first step : add all lib with no dependency:
|
# first step : add all lib with no dependency:
|
||||||
for herit in listHeritage:
|
for herit in listHeritage:
|
||||||
if len(herit.depends) == 0:
|
if len(herit.depends) == 0:
|
||||||
self.listHeritage.append(herit)
|
self.list_heritage.append(herit)
|
||||||
listHeritage.remove(herit)
|
listHeritage.remove(herit)
|
||||||
while len(listHeritage) > 0:
|
while len(listHeritage) > 0:
|
||||||
currentHeritageSize = len(listHeritage)
|
currentHeritageSize = len(listHeritage)
|
||||||
debug.verbose("list heritage = " + str([[x.name, x.depends] for x in listHeritage]))
|
debug.verbose("list heritage = " + str([[x.name, x.depends] for x in listHeritage]))
|
||||||
# Add element only when all dependence are resolved
|
# Add element only when all dependence are resolved
|
||||||
for herit in listHeritage:
|
for herit in listHeritage:
|
||||||
listDependsName = [y.name for y in self.listHeritage]
|
listDependsName = [y.name for y in self.list_heritage]
|
||||||
if all(x in listDependsName for x in herit.depends) == True:
|
if all(x in listDependsName for x in herit.depends) == True:
|
||||||
listHeritage.remove(herit)
|
listHeritage.remove(herit)
|
||||||
self.listHeritage.append(herit)
|
self.list_heritage.append(herit)
|
||||||
if currentHeritageSize == len(listHeritage):
|
if currentHeritageSize == len(listHeritage):
|
||||||
debug.warning("Not resolve dependency between the library ==> can be a cyclic dependency !!!")
|
debug.warning("Not resolve dependency between the library ==> can be a cyclic dependency !!!")
|
||||||
for herit in listHeritage:
|
for herit in listHeritage:
|
||||||
self.listHeritage.append(herit)
|
self.list_heritage.append(herit)
|
||||||
listHeritage = []
|
listHeritage = []
|
||||||
debug.warning("new heritage list:")
|
debug.warning("new heritage list:")
|
||||||
for element in self.listHeritage:
|
for element in self.list_heritage:
|
||||||
debug.warning(" " + element.name + " " + str(element.depends))
|
debug.warning(" " + element.name + " " + str(element.depends))
|
||||||
debug.verbose("new heritage list:")
|
debug.verbose("new heritage list:")
|
||||||
for element in self.listHeritage:
|
for element in self.list_heritage:
|
||||||
debug.verbose(" " + element.name + " " + str(element.depends))
|
debug.verbose(" " + element.name + " " + str(element.depends))
|
||||||
for element in reversed(self.listHeritage):
|
for element in reversed(self.list_heritage):
|
||||||
for flags in element.flags:
|
for flags in element.flags:
|
||||||
if flags in ["c-version", "c++-version"]:
|
if flags in ["c-version", "c++-version"]:
|
||||||
continue
|
continue
|
||||||
|
185
lutin/module.py
185
lutin/module.py
@@ -57,7 +57,7 @@ class Module:
|
|||||||
# sources list:
|
# sources list:
|
||||||
self.src = []
|
self.src = []
|
||||||
# copy files and folders:
|
# copy files and folders:
|
||||||
self.imageToCopy = []
|
self.image_to_copy = []
|
||||||
self.files = []
|
self.files = []
|
||||||
self.folders = []
|
self.folders = []
|
||||||
self.isbuild = False
|
self.isbuild = False
|
||||||
@@ -127,7 +127,7 @@ class Module:
|
|||||||
## @brief Commands for copying files
|
## @brief Commands for copying files
|
||||||
##
|
##
|
||||||
def image_to_staging(self, binary_name, target):
|
def image_to_staging(self, binary_name, target):
|
||||||
for source, destination, sizeX, sizeY in self.imageToCopy:
|
for source, destination, sizeX, sizeY in self.image_to_copy:
|
||||||
extension = source[source.rfind('.'):]
|
extension = source[source.rfind('.'):]
|
||||||
if extension != ".png" \
|
if extension != ".png" \
|
||||||
and extension != ".jpg" \
|
and extension != ".jpg" \
|
||||||
@@ -170,6 +170,109 @@ class Module:
|
|||||||
debug.debug("Might copy folder : " + source + "==>" + destination)
|
debug.debug("Might copy folder : " + source + "==>" + destination)
|
||||||
tools.copy_anything_target(target, self.origin_folder + "/" + source, destination)
|
tools.copy_anything_target(target, self.origin_folder + "/" + source, destination)
|
||||||
|
|
||||||
|
def gcov(self, target, generate_output=False):
|
||||||
|
if self.type == 'PREBUILD':
|
||||||
|
debug.error("Can not generate gcov on prebuid system ... : '" + self.name + "'");
|
||||||
|
return
|
||||||
|
# remove uncompilable elements:
|
||||||
|
list_file = tools.filter_extention(self.src, self.extention_order_build, True)
|
||||||
|
global_list_file = ""
|
||||||
|
for file in list_file:
|
||||||
|
debug.verbose(" gcov : " + self.name + " <== " + file);
|
||||||
|
file_dst = target.get_full_name_destination(self.name, self.origin_folder, file, "o")
|
||||||
|
global_list_file += file_dst + " "
|
||||||
|
cmd = "gcov"
|
||||||
|
# specify the version of gcov we need to use
|
||||||
|
if target.config["compilator-version"] != "":
|
||||||
|
cmd += "-" + target.config["compilator-version"] + " "
|
||||||
|
cmd += " --branch-counts --preserve-paths "
|
||||||
|
if generate_output == False:
|
||||||
|
cmd += "--no-output "
|
||||||
|
cmd += global_list_file
|
||||||
|
debug.extreme_verbose(" " + cmd);
|
||||||
|
ret = multiprocess.run_command_direct(cmd)
|
||||||
|
# parsing ret :
|
||||||
|
debug.extreme_verbose("result: " + str(ret));
|
||||||
|
ret = ret.split('\n');
|
||||||
|
debug.verbose("*** Gcov result parsing ...");
|
||||||
|
useful_list = []
|
||||||
|
remove_next = False
|
||||||
|
last_file = ""
|
||||||
|
executed_lines = 0
|
||||||
|
executable_lines = 0
|
||||||
|
for elem in ret:
|
||||||
|
if remove_next == True:
|
||||||
|
remove_next = False
|
||||||
|
continue;
|
||||||
|
if elem[:10] == "Creating '" \
|
||||||
|
or elem[:10] == "Removing '":
|
||||||
|
remove_next = True
|
||||||
|
continue
|
||||||
|
if elem[:6] == "File '" \
|
||||||
|
and self.origin_folder != elem[6:len(self.origin_folder)+6]:
|
||||||
|
remove_next = True
|
||||||
|
continue
|
||||||
|
if elem[:6] == "File '":
|
||||||
|
last_file = elem[6+len(self.origin_folder)+1:-1]
|
||||||
|
continue
|
||||||
|
start_with = "Lines executed:"
|
||||||
|
if elem[:len(start_with)] != start_with:
|
||||||
|
debug.warning(" gcov ret : " + str(elem));
|
||||||
|
debug.warning(" ==> does not start with : " + start_with);
|
||||||
|
debug.warning(" Parsing error");
|
||||||
|
continue
|
||||||
|
out = elem[len(start_with):].split("% of ")
|
||||||
|
if len(out) != 2:
|
||||||
|
debug.warning(" gcov ret : " + str(elem));
|
||||||
|
debug.warning(" Parsing error of '% of '");
|
||||||
|
continue
|
||||||
|
pourcent = float(out[0])
|
||||||
|
total_line_count = int(out[1])
|
||||||
|
total_executed_line = int(float(total_line_count)*pourcent/100.0)
|
||||||
|
useful_list.append([last_file, pourcent, total_executed_line, total_line_count])
|
||||||
|
executed_lines += total_executed_line
|
||||||
|
executable_lines += total_line_count
|
||||||
|
last_file = ""
|
||||||
|
ret = useful_list[:-1]
|
||||||
|
#for elem in ret:
|
||||||
|
# debug.info(" " + str(elem));
|
||||||
|
for elem in ret:
|
||||||
|
if elem[1]<10.0:
|
||||||
|
debug.info(" % " + str(elem[1]) + "\r\t\t" + str(elem[0]));
|
||||||
|
elif elem[1]<100.0:
|
||||||
|
debug.info(" % " + str(elem[1]) + "\r\t\t" + str(elem[0]));
|
||||||
|
else:
|
||||||
|
debug.info(" % " + str(elem[1]) + "\r\t\t" + str(elem[0]));
|
||||||
|
pourcent = 100.0*float(executed_lines)/float(executable_lines)
|
||||||
|
# generate json file:
|
||||||
|
json_file_name = target.get_build_folder(self.name) + "/" + self.name + "_coverage.json"
|
||||||
|
debug.debug("generate json file : " + json_file_name)
|
||||||
|
tmp_file = open(json_file_name, 'w')
|
||||||
|
tmp_file.write('{\n')
|
||||||
|
tmp_file.write(' "lib-name":"' + self.name + '",\n')
|
||||||
|
#tmp_file.write(' "coverage":"' + str(pourcent) + '",\n')
|
||||||
|
tmp_file.write(' "executed":"' + str(executed_lines) + '",\n')
|
||||||
|
tmp_file.write(' "executable":"' + str(executable_lines) + '",\n')
|
||||||
|
tmp_file.write(' "list":[\n')
|
||||||
|
val = 0
|
||||||
|
for elem in ret:
|
||||||
|
if val == 0 :
|
||||||
|
tmp_file.write(' {\n')
|
||||||
|
else:
|
||||||
|
tmp_file.write(' }, {\n')
|
||||||
|
val += 1
|
||||||
|
tmp_file.write(' "file":"' + elem[0] + '",\n')
|
||||||
|
#tmp_file.write(' "coverage":' + str(elem[1]) + ',\n')
|
||||||
|
tmp_file.write(' "executed":' + str(elem[2]) + ',\n')
|
||||||
|
tmp_file.write(' "executable":' + str(elem[3]) + '\n')
|
||||||
|
tmp_file.write(' }\n')
|
||||||
|
tmp_file.write(' ]\n')
|
||||||
|
tmp_file.write('}\n')
|
||||||
|
tmp_file.flush()
|
||||||
|
tmp_file.close()
|
||||||
|
# print debug:
|
||||||
|
debug.print_element("coverage", self.name, ":", str(pourcent) + "% " + str(executed_lines) + "/" + str(executable_lines))
|
||||||
|
|
||||||
# call here to build the module
|
# call here to build the module
|
||||||
def build(self, target, package_name):
|
def build(self, target, package_name):
|
||||||
# ckeck if not previously build
|
# ckeck if not previously build
|
||||||
@@ -226,7 +329,7 @@ class Module:
|
|||||||
fileExt = file.split(".")[-1]
|
fileExt = file.split(".")[-1]
|
||||||
try:
|
try:
|
||||||
tmp_builder = builder.get_builder(fileExt);
|
tmp_builder = builder.get_builder(fileExt);
|
||||||
resFile = tmp_builder.compile(file,
|
res_file = tmp_builder.compile(file,
|
||||||
package_name,
|
package_name,
|
||||||
target,
|
target,
|
||||||
self.sub_heritage_list,
|
self.sub_heritage_list,
|
||||||
@@ -234,12 +337,12 @@ class Module:
|
|||||||
path = self.path,
|
path = self.path,
|
||||||
name = self.name,
|
name = self.name,
|
||||||
basic_folder = self.origin_folder)
|
basic_folder = self.origin_folder)
|
||||||
if resFile["action"] == "add":
|
if res_file["action"] == "add":
|
||||||
list_sub_file_needed_to_build.append(resFile["file"])
|
list_sub_file_needed_to_build.append(res_file["file"])
|
||||||
elif resFile["action"] == "path":
|
elif res_file["action"] == "path":
|
||||||
self.add_path(resFile["path"], type='c')
|
self.add_path(res_file["path"], type='c')
|
||||||
else:
|
else:
|
||||||
debug.error("an not do action for : " + str(resFile))
|
debug.error("an not do action for : " + str(res_file))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
debug.warning(" UN-SUPPORTED file format: '" + self.origin_folder + "/" + file + "'")
|
debug.warning(" UN-SUPPORTED file format: '" + self.origin_folder + "/" + file + "'")
|
||||||
# now build the other :
|
# now build the other :
|
||||||
@@ -249,7 +352,7 @@ class Module:
|
|||||||
fileExt = file.split(".")[-1]
|
fileExt = file.split(".")[-1]
|
||||||
try:
|
try:
|
||||||
tmp_builder = builder.get_builder(fileExt);
|
tmp_builder = builder.get_builder(fileExt);
|
||||||
resFile = tmp_builder.compile(file,
|
res_file = tmp_builder.compile(file,
|
||||||
package_name,
|
package_name,
|
||||||
target,
|
target,
|
||||||
self.sub_heritage_list,
|
self.sub_heritage_list,
|
||||||
@@ -257,12 +360,12 @@ class Module:
|
|||||||
path = self.path,
|
path = self.path,
|
||||||
name = self.name,
|
name = self.name,
|
||||||
basic_folder = self.origin_folder)
|
basic_folder = self.origin_folder)
|
||||||
if resFile["action"] == "add":
|
if res_file["action"] == "add":
|
||||||
list_sub_file_needed_to_build.append(resFile["file"])
|
list_sub_file_needed_to_build.append(res_file["file"])
|
||||||
elif resFile["action"] == "path":
|
elif res_file["action"] == "path":
|
||||||
self.add_path(resFile["path"], type='c')
|
self.add_path(res_file["path"], type='c')
|
||||||
else:
|
else:
|
||||||
debug.error("an not do action for : " + str(resFile))
|
debug.error("an not do action for : " + str(res_file))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
debug.warning(" UN-SUPPORTED file format: '" + self.origin_folder + "/" + file + "'")
|
debug.warning(" UN-SUPPORTED file format: '" + self.origin_folder + "/" + file + "'")
|
||||||
# when multiprocess availlable, we need to synchronize here ...
|
# when multiprocess availlable, we need to synchronize here ...
|
||||||
@@ -277,32 +380,32 @@ class Module:
|
|||||||
tmp_builder = builder.get_builder_with_output("a");
|
tmp_builder = builder.get_builder_with_output("a");
|
||||||
list_file = tools.filter_extention(list_sub_file_needed_to_build, tmp_builder.get_input_type())
|
list_file = tools.filter_extention(list_sub_file_needed_to_build, tmp_builder.get_input_type())
|
||||||
if len(list_file) > 0:
|
if len(list_file) > 0:
|
||||||
resFile = tmp_builder.link(list_file,
|
res_file = tmp_builder.link(list_file,
|
||||||
package_name,
|
package_name,
|
||||||
target,
|
target,
|
||||||
self.sub_heritage_list,
|
self.sub_heritage_list,
|
||||||
name = self.name,
|
name = self.name,
|
||||||
basic_folder = self.origin_folder)
|
basic_folder = self.origin_folder)
|
||||||
self.local_heritage.add_sources(resFile)
|
self.local_heritage.add_sources(res_file)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
debug.error(" UN-SUPPORTED link format: '.a'")
|
debug.error(" UN-SUPPORTED link format: '.a'")
|
||||||
try:
|
try:
|
||||||
tmp_builder = builder.get_builder_with_output("jar");
|
tmp_builder = builder.get_builder_with_output("jar");
|
||||||
list_file = tools.filter_extention(list_sub_file_needed_to_build, tmp_builder.get_input_type())
|
list_file = tools.filter_extention(list_sub_file_needed_to_build, tmp_builder.get_input_type())
|
||||||
if len(list_file) > 0:
|
if len(list_file) > 0:
|
||||||
resFile = tmp_builder.link(list_file,
|
res_file = tmp_builder.link(list_file,
|
||||||
package_name,
|
package_name,
|
||||||
target,
|
target,
|
||||||
self.sub_heritage_list,
|
self.sub_heritage_list,
|
||||||
name = self.name,
|
name = self.name,
|
||||||
basic_folder = self.origin_folder)
|
basic_folder = self.origin_folder)
|
||||||
self.local_heritage.add_sources(resFile)
|
self.local_heritage.add_sources(res_file)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
debug.error(" UN-SUPPORTED link format: '.jar'")
|
debug.error(" UN-SUPPORTED link format: '.jar'")
|
||||||
elif self.type=='BINARY':
|
elif self.type=='BINARY':
|
||||||
try:
|
try:
|
||||||
tmp_builder = builder.get_builder_with_output("bin");
|
tmp_builder = builder.get_builder_with_output("bin");
|
||||||
resFile = tmp_builder.link(list_sub_file_needed_to_build,
|
res_file = tmp_builder.link(list_sub_file_needed_to_build,
|
||||||
package_name,
|
package_name,
|
||||||
target,
|
target,
|
||||||
self.sub_heritage_list,
|
self.sub_heritage_list,
|
||||||
@@ -320,32 +423,32 @@ class Module:
|
|||||||
try:
|
try:
|
||||||
tmp_builder = builder.get_builder_with_output("so");
|
tmp_builder = builder.get_builder_with_output("so");
|
||||||
list_file = tools.filter_extention(list_sub_file_needed_to_build, tmp_builder.get_input_type())
|
list_file = tools.filter_extention(list_sub_file_needed_to_build, tmp_builder.get_input_type())
|
||||||
resFile = tmp_builder.link(list_file,
|
res_file = tmp_builder.link(list_file,
|
||||||
package_name,
|
package_name,
|
||||||
target,
|
target,
|
||||||
self.sub_heritage_list,
|
self.sub_heritage_list,
|
||||||
name = "lib" + self.name,
|
name = "lib" + self.name,
|
||||||
basic_folder = self.origin_folder)
|
basic_folder = self.origin_folder)
|
||||||
self.local_heritage.add_sources(resFile)
|
self.local_heritage.add_sources(res_file)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
debug.error(" UN-SUPPORTED link format: '.so'")
|
debug.error(" UN-SUPPORTED link format: '.so'")
|
||||||
try:
|
try:
|
||||||
tmp_builder = builder.get_builder_with_output("jar");
|
tmp_builder = builder.get_builder_with_output("jar");
|
||||||
list_file = tools.filter_extention(list_sub_file_needed_to_build, tmp_builder.get_input_type())
|
list_file = tools.filter_extention(list_sub_file_needed_to_build, tmp_builder.get_input_type())
|
||||||
if len(list_file) > 0:
|
if len(list_file) > 0:
|
||||||
resFile = tmp_builder.link(list_file,
|
res_file = tmp_builder.link(list_file,
|
||||||
package_name,
|
package_name,
|
||||||
target,
|
target,
|
||||||
self.sub_heritage_list,
|
self.sub_heritage_list,
|
||||||
name = self.name,
|
name = self.name,
|
||||||
basic_folder = self.origin_folder)
|
basic_folder = self.origin_folder)
|
||||||
self.local_heritage.add_sources(resFile)
|
self.local_heritage.add_sources(res_file)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
debug.error(" UN-SUPPORTED link format: '.jar'")
|
debug.error(" UN-SUPPORTED link format: '.jar'")
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
tmp_builder = builder.get_builder_with_output("bin");
|
tmp_builder = builder.get_builder_with_output("bin");
|
||||||
resFile = tmp_builder.link(list_sub_file_needed_to_build,
|
res_file = tmp_builder.link(list_sub_file_needed_to_build,
|
||||||
package_name,
|
package_name,
|
||||||
target,
|
target,
|
||||||
self.sub_heritage_list,
|
self.sub_heritage_list,
|
||||||
@@ -357,7 +460,7 @@ class Module:
|
|||||||
# generate tree for this special binary
|
# generate tree for this special binary
|
||||||
self.build_tree(target, self.name)
|
self.build_tree(target, self.name)
|
||||||
target.copy_to_staging(self.name)
|
target.copy_to_staging(self.name)
|
||||||
if target.endGeneratePackage==True:
|
if target.end_generate_package == True:
|
||||||
# generate the package with his properties ...
|
# generate the package with his properties ...
|
||||||
if target.name=="Android":
|
if target.name=="Android":
|
||||||
self.sub_heritage_list.add_heritage(self.local_heritage)
|
self.sub_heritage_list.add_heritage(self.local_heritage)
|
||||||
@@ -374,7 +477,7 @@ class Module:
|
|||||||
# call here to build the module
|
# call here to build the module
|
||||||
def build_tree(self, target, package_name):
|
def build_tree(self, target, package_name):
|
||||||
# ckeck if not previously build
|
# ckeck if not previously build
|
||||||
if target.is_module_buildTree(self.name)==True:
|
if target.is_module_build_tree(self.name)==True:
|
||||||
return
|
return
|
||||||
debug.verbose("build tree of " + self.name)
|
debug.verbose("build tree of " + self.name)
|
||||||
# add all the elements (first added only one keep ==> permit to everload sublib element)
|
# add all the elements (first added only one keep ==> permit to everload sublib element)
|
||||||
@@ -416,14 +519,14 @@ class Module:
|
|||||||
if True==order:
|
if True==order:
|
||||||
listout.sort()
|
listout.sort()
|
||||||
|
|
||||||
def append_to_internalList2(self, listout, module, list, order=False):
|
def append_to_internal_list2(self, listout, module, list, order=False):
|
||||||
# add list in the Map
|
# add list in the Map
|
||||||
if module not in listout:
|
if module not in listout:
|
||||||
listout[module] = []
|
listout[module] = []
|
||||||
# add elements...
|
# add elements...
|
||||||
self.append_to_internalList(listout[module], list, order)
|
self.append_to_internal_list(listout[module], list, order)
|
||||||
|
|
||||||
def append_to_internalList(self, listout, list, order=False):
|
def append_to_internal_list(self, listout, list, order=False):
|
||||||
if type(list) == type(str()):
|
if type(list) == type(str()):
|
||||||
self.append_and_check(listout, list, order)
|
self.append_and_check(listout, list, order)
|
||||||
else:
|
else:
|
||||||
@@ -432,23 +535,23 @@ class Module:
|
|||||||
self.append_and_check(listout, elem, order)
|
self.append_and_check(listout, elem, order)
|
||||||
|
|
||||||
def add_module_depend(self, list):
|
def add_module_depend(self, list):
|
||||||
self.append_to_internalList(self.depends, list, True)
|
self.append_to_internal_list(self.depends, list, True)
|
||||||
|
|
||||||
def add_optionnal_module_depend(self, module_name, compilation_flags=["", ""], export=False):
|
def add_optionnal_module_depend(self, module_name, compilation_flags=["", ""], export=False):
|
||||||
self.append_and_check(self.depends_optionnal, [module_name, compilation_flags, export], True)
|
self.append_and_check(self.depends_optionnal, [module_name, compilation_flags, export], True)
|
||||||
|
|
||||||
def add_export_path(self, list, type='c'):
|
def add_export_path(self, list, type='c'):
|
||||||
self.append_to_internalList2(self.path["export"], type, list)
|
self.append_to_internal_list2(self.path["export"], type, list)
|
||||||
|
|
||||||
def add_path(self, list, type='c'):
|
def add_path(self, list, type='c'):
|
||||||
self.append_to_internalList2(self.path["local"], type, list)
|
self.append_to_internal_list2(self.path["local"], type, list)
|
||||||
|
|
||||||
def add_export_flag(self, type, list):
|
def add_export_flag(self, type, list):
|
||||||
self.append_to_internalList2(self.flags["export"], type, list)
|
self.append_to_internal_list2(self.flags["export"], type, list)
|
||||||
|
|
||||||
# add the link flag at the module
|
# add the link flag at the module
|
||||||
def compile_flags(self, type, list):
|
def compile_flags(self, type, list):
|
||||||
self.append_to_internalList2(self.flags["local"], type, list)
|
self.append_to_internal_list2(self.flags["local"], type, list)
|
||||||
|
|
||||||
def compile_version_XX(self, version, same_as_api=True, gnu=False):
|
def compile_version_XX(self, version, same_as_api=True, gnu=False):
|
||||||
cpp_version_list = [1999, 2003, 2011, 2014]
|
cpp_version_list = [1999, 2003, 2011, 2014]
|
||||||
@@ -481,10 +584,10 @@ class Module:
|
|||||||
debug.warning("Can not propagate the gnu extention of the C vesion for API");
|
debug.warning("Can not propagate the gnu extention of the C vesion for API");
|
||||||
|
|
||||||
def add_src_file(self, list):
|
def add_src_file(self, list):
|
||||||
self.append_to_internalList(self.src, list, True)
|
self.append_to_internal_list(self.src, list, True)
|
||||||
|
|
||||||
def copy_image(self, source, destination='', sizeX=-1, sizeY=-1):
|
def copy_image(self, source, destination='', sizeX=-1, sizeY=-1):
|
||||||
self.imageToCopy.append([source, destination, sizeX, sizeY])
|
self.image_to_copy.append([source, destination, sizeX, sizeY])
|
||||||
|
|
||||||
def copy_file(self, source, destination=''):
|
def copy_file(self, source, destination=''):
|
||||||
self.files.append([source, destination])
|
self.files.append([source, destination])
|
||||||
@@ -631,21 +734,21 @@ class Module:
|
|||||||
|
|
||||||
|
|
||||||
moduleList=[]
|
moduleList=[]
|
||||||
__startModuleName="lutin_"
|
__start_module_name="lutin_"
|
||||||
|
|
||||||
def import_path(path):
|
def import_path(path):
|
||||||
global moduleList
|
global moduleList
|
||||||
matches = []
|
matches = []
|
||||||
debug.debug('MODULE: Start find sub File : "%s"' %path)
|
debug.debug('MODULE: Start find sub File : "%s"' %path)
|
||||||
for root, dirnames, filenames in os.walk(path):
|
for root, dirnames, filenames in os.walk(path):
|
||||||
tmpList = fnmatch.filter(filenames, __startModuleName + "*.py")
|
tmpList = fnmatch.filter(filenames, __start_module_name + "*.py")
|
||||||
# Import the module :
|
# Import the module :
|
||||||
for filename in tmpList:
|
for filename in tmpList:
|
||||||
debug.debug('Module: Find a file : "%s"' %os.path.join(root, filename))
|
debug.debug('Module: Find a file : "%s"' %os.path.join(root, filename))
|
||||||
#matches.append(os.path.join(root, filename))
|
#matches.append(os.path.join(root, filename))
|
||||||
sys.path.append(os.path.dirname(os.path.join(root, filename)) )
|
sys.path.append(os.path.dirname(os.path.join(root, filename)) )
|
||||||
moduleName = filename.replace('.py', '')
|
moduleName = filename.replace('.py', '')
|
||||||
moduleName = moduleName.replace(__startModuleName, '')
|
moduleName = moduleName.replace(__start_module_name, '')
|
||||||
debug.debug("MODULE: Integrate module: '" + moduleName + "' from '" + os.path.join(root, filename) + "'")
|
debug.debug("MODULE: Integrate module: '" + moduleName + "' from '" + os.path.join(root, filename) + "'")
|
||||||
moduleList.append([moduleName,os.path.join(root, filename)])
|
moduleList.append([moduleName,os.path.join(root, filename)])
|
||||||
|
|
||||||
@@ -661,8 +764,8 @@ def load_module(target, name):
|
|||||||
for mod in moduleList:
|
for mod in moduleList:
|
||||||
if mod[0] == name:
|
if mod[0] == name:
|
||||||
sys.path.append(os.path.dirname(mod[1]))
|
sys.path.append(os.path.dirname(mod[1]))
|
||||||
debug.verbose("import module : '" + __startModuleName + name + "'")
|
debug.verbose("import module : '" + __start_module_name + name + "'")
|
||||||
theModule = __import__(__startModuleName + name)
|
theModule = __import__(__start_module_name + name)
|
||||||
#try:
|
#try:
|
||||||
tmpElement = theModule.create(target)
|
tmpElement = theModule.create(target)
|
||||||
#except:
|
#except:
|
||||||
|
@@ -20,7 +20,7 @@ import subprocess
|
|||||||
import shlex
|
import shlex
|
||||||
# Local import
|
# Local import
|
||||||
from . import debug
|
from . import debug
|
||||||
import tools
|
from . import tools
|
||||||
from . import env
|
from . import env
|
||||||
|
|
||||||
queueLock = threading.Lock()
|
queueLock = threading.Lock()
|
||||||
@@ -42,30 +42,20 @@ isinit = False # the thread are initialized
|
|||||||
errorOccured = False # a thread have an error
|
errorOccured = False # a thread have an error
|
||||||
processorAvaillable = 1 # number of CPU core availlable
|
processorAvaillable = 1 # number of CPU core availlable
|
||||||
|
|
||||||
def store_command(cmdLine, file):
|
|
||||||
# write cmd line only after to prevent errors ...
|
|
||||||
if file != "" \
|
|
||||||
and file != None:
|
|
||||||
# Create directory:
|
|
||||||
tools.create_directory_of_file(file)
|
|
||||||
# Store the command Line:
|
|
||||||
file2 = open(file, "w")
|
|
||||||
file2.write(cmdLine)
|
|
||||||
file2.flush()
|
|
||||||
file2.close()
|
|
||||||
|
|
||||||
##
|
##
|
||||||
## @brief Execute the command and ruturn generate data
|
## @brief Execute the command and ruturn generate data
|
||||||
##
|
##
|
||||||
def run_command_direct(cmdLine):
|
def run_command_direct(cmd_line):
|
||||||
# prepare command line:
|
# prepare command line:
|
||||||
args = shlex.split(cmdLine)
|
args = shlex.split(cmd_line)
|
||||||
debug.verbose("cmd = " + str(args))
|
debug.verbose("cmd = " + str(args))
|
||||||
try:
|
try:
|
||||||
# create the subprocess
|
# create the subprocess
|
||||||
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
debug.error("subprocess.CalledProcessError : " + str(args))
|
debug.error("subprocess.CalledProcessError : " + str(args))
|
||||||
|
except:
|
||||||
|
debug.error("Exception on : " + str(args))
|
||||||
# launch the subprocess:
|
# launch the subprocess:
|
||||||
output, err = p.communicate()
|
output, err = p.communicate()
|
||||||
if sys.version_info >= (3, 0):
|
if sys.version_info >= (3, 0):
|
||||||
@@ -80,29 +70,33 @@ def run_command_direct(cmdLine):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def run_command(cmdLine, storeCmdLine="", buildId=-1, file=""):
|
def run_command(cmd_line, store_cmd_line="", build_id=-1, file="", store_output_file=""):
|
||||||
global errorOccured
|
global errorOccured
|
||||||
global exitFlag
|
global exitFlag
|
||||||
global currentIdExecution
|
global currentIdExecution
|
||||||
# prepare command line:
|
# prepare command line:
|
||||||
args = shlex.split(cmdLine)
|
args = shlex.split(cmd_line)
|
||||||
debug.verbose("cmd = " + str(args))
|
debug.verbose("cmd = " + str(args))
|
||||||
try:
|
try:
|
||||||
# create the subprocess
|
# create the subprocess
|
||||||
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
debug.error("subprocess.CalledProcessError : TODO ...")
|
debug.error("subprocess.CalledProcessError : TODO ...")
|
||||||
|
except:
|
||||||
|
debug.error("Exception on : " + str(args))
|
||||||
# launch the subprocess:
|
# launch the subprocess:
|
||||||
output, err = p.communicate()
|
output, err = p.communicate()
|
||||||
if sys.version_info >= (3, 0):
|
if sys.version_info >= (3, 0):
|
||||||
output = output.decode("utf-8")
|
output = output.decode("utf-8")
|
||||||
err = err.decode("utf-8")
|
err = err.decode("utf-8")
|
||||||
|
# store error if needed:
|
||||||
|
tools.store_warning(store_output_file, output, err)
|
||||||
# Check error :
|
# Check error :
|
||||||
if p.returncode == 0:
|
if p.returncode == 0:
|
||||||
debug.debug(env.print_pretty(cmdLine))
|
debug.debug(env.print_pretty(cmd_line))
|
||||||
queueLock.acquire()
|
queueLock.acquire()
|
||||||
# TODO : Print the output all the time .... ==> to show warnings ...
|
# TODO : Print the output all the time .... ==> to show warnings ...
|
||||||
if buildId >= 0 and (output != "" or err != ""):
|
if build_id >= 0 and (output != "" or err != ""):
|
||||||
debug.warning("output in subprocess compiling: '" + file + "'")
|
debug.warning("output in subprocess compiling: '" + file + "'")
|
||||||
if output != "":
|
if output != "":
|
||||||
debug.print_compilator(output)
|
debug.print_compilator(output)
|
||||||
@@ -113,8 +107,8 @@ def run_command(cmdLine, storeCmdLine="", buildId=-1, file=""):
|
|||||||
errorOccured = True
|
errorOccured = True
|
||||||
exitFlag = True
|
exitFlag = True
|
||||||
# if No ID : Not in a multiprocess mode ==> just stop here
|
# if No ID : Not in a multiprocess mode ==> just stop here
|
||||||
if buildId < 0:
|
if build_id < 0:
|
||||||
debug.debug(env.print_pretty(cmdLine), force=True)
|
debug.debug(env.print_pretty(cmd_line), force=True)
|
||||||
debug.print_compilator(output)
|
debug.print_compilator(output)
|
||||||
debug.print_compilator(err)
|
debug.print_compilator(err)
|
||||||
if p.returncode == 2:
|
if p.returncode == 2:
|
||||||
@@ -125,12 +119,12 @@ def run_command(cmdLine, storeCmdLine="", buildId=-1, file=""):
|
|||||||
# in multiprocess interface
|
# in multiprocess interface
|
||||||
queueLock.acquire()
|
queueLock.acquire()
|
||||||
# if an other write an error before, check if the current process is started before ==> then is the first error
|
# if an other write an error before, check if the current process is started before ==> then is the first error
|
||||||
if errorExecution["id"] >= buildId:
|
if errorExecution["id"] >= build_id:
|
||||||
# nothing to do ...
|
# nothing to do ...
|
||||||
queueLock.release()
|
queueLock.release()
|
||||||
return;
|
return;
|
||||||
errorExecution["id"] = buildId
|
errorExecution["id"] = build_id
|
||||||
errorExecution["cmd"] = cmdLine
|
errorExecution["cmd"] = cmd_line
|
||||||
errorExecution["return"] = p.returncode
|
errorExecution["return"] = p.returncode
|
||||||
errorExecution["err"] = err,
|
errorExecution["err"] = err,
|
||||||
errorExecution["out"] = output,
|
errorExecution["out"] = output,
|
||||||
@@ -139,14 +133,14 @@ def run_command(cmdLine, storeCmdLine="", buildId=-1, file=""):
|
|||||||
return
|
return
|
||||||
debug.verbose("done 3")
|
debug.verbose("done 3")
|
||||||
# write cmd line only after to prevent errors ...
|
# write cmd line only after to prevent errors ...
|
||||||
store_command(cmdLine, storeCmdLine)
|
tools.store_command(cmd_line, store_cmd_line)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class myThread(threading.Thread):
|
class myThread(threading.Thread):
|
||||||
def __init__(self, threadID, lock, queue):
|
def __init__(self, threadID, lock, queue):
|
||||||
threading.Thread.__init__(self)
|
threading.Thread.__init__(self)
|
||||||
self.threadID = threadID
|
self.thread_id = threadID
|
||||||
self.name = "Thread " + str(threadID)
|
self.name = "Thread " + str(threadID)
|
||||||
self.queue = queue
|
self.queue = queue
|
||||||
self.lock = lock
|
self.lock = lock
|
||||||
@@ -168,8 +162,8 @@ class myThread(threading.Thread):
|
|||||||
comment = data[2]
|
comment = data[2]
|
||||||
cmdLine = data[1]
|
cmdLine = data[1]
|
||||||
cmdStoreFile = data[3]
|
cmdStoreFile = data[3]
|
||||||
debug.print_element( "[" + str(data[4]) + "][" + str(self.threadID) + "] " + comment[0], comment[1], comment[2], comment[3])
|
debug.print_element( "[" + str(data[4]) + "][" + str(self.thread_id) + "] " + comment[0], comment[1], comment[2], comment[3])
|
||||||
run_command(cmdLine, cmdStoreFile, buildId=data[4], file=comment[3])
|
run_command(cmdLine, cmdStoreFile, build_id=data[4], file=comment[3], store_output_file=data[5])
|
||||||
else:
|
else:
|
||||||
debug.warning("unknow request command : " + data[0])
|
debug.warning("unknow request command : " + data[0])
|
||||||
else:
|
else:
|
||||||
@@ -224,18 +218,18 @@ def un_init():
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
def run_in_pool(cmdLine, comment, storeCmdLine=""):
|
def run_in_pool(cmd_line, comment, store_cmd_line="", store_output_file=""):
|
||||||
global currentIdExecution
|
global currentIdExecution
|
||||||
if processorAvaillable <= 1:
|
if processorAvaillable <= 1:
|
||||||
debug.print_element(comment[0], comment[1], comment[2], comment[3])
|
debug.print_element(comment[0], comment[1], comment[2], comment[3])
|
||||||
run_command(cmdLine, storeCmdLine, file=comment[3])
|
run_command(cmd_line, store_cmd_line, file=comment[3], store_output_file=store_output_file)
|
||||||
return
|
return
|
||||||
# multithreaded mode
|
# multithreaded mode
|
||||||
init()
|
init()
|
||||||
# Fill the queue
|
# Fill the queue
|
||||||
queueLock.acquire()
|
queueLock.acquire()
|
||||||
debug.verbose("add : in pool cmdLine")
|
debug.verbose("add : in pool cmdLine")
|
||||||
workQueue.put(["cmdLine", cmdLine, comment, storeCmdLine, currentIdExecution])
|
workQueue.put(["cmdLine", cmd_line, comment, store_cmd_line, currentIdExecution, store_output_file])
|
||||||
currentIdExecution +=1;
|
currentIdExecution +=1;
|
||||||
queueLock.release()
|
queueLock.release()
|
||||||
|
|
||||||
|
@@ -98,7 +98,7 @@ def createModuleFromSystem(target, dict):
|
|||||||
# Dictionnaire of Target name
|
# Dictionnaire of Target name
|
||||||
# inside table of ["Name of the lib", "path of the lib", boolean loaded, module loaded]
|
# inside table of ["Name of the lib", "path of the lib", boolean loaded, module loaded]
|
||||||
systemList={}
|
systemList={}
|
||||||
__startSystemName="lutinSystem_"
|
__start_system_name="lutinSystem_"
|
||||||
|
|
||||||
|
|
||||||
def import_path(path):
|
def import_path(path):
|
||||||
@@ -106,13 +106,13 @@ def import_path(path):
|
|||||||
matches = []
|
matches = []
|
||||||
debug.debug('Start find sub File : "%s"' %path)
|
debug.debug('Start find sub File : "%s"' %path)
|
||||||
for root, dirnames, filenames in os.walk(path):
|
for root, dirnames, filenames in os.walk(path):
|
||||||
tmpList = fnmatch.filter(filenames, __startSystemName + "*.py")
|
tmpList = fnmatch.filter(filenames, __start_system_name + "*.py")
|
||||||
# Import the module :
|
# Import the module :
|
||||||
for filename in tmpList:
|
for filename in tmpList:
|
||||||
debug.verbose(' Find a file : "%s"' %os.path.join(root, filename))
|
debug.verbose(' Find a file : "%s"' %os.path.join(root, filename))
|
||||||
sys.path.append(os.path.dirname(os.path.join(root, filename)) )
|
sys.path.append(os.path.dirname(os.path.join(root, filename)) )
|
||||||
systemName = filename.replace('.py', '')
|
systemName = filename.replace('.py', '')
|
||||||
systemName = systemName.replace(__startSystemName, '')
|
systemName = systemName.replace(__start_system_name, '')
|
||||||
targetType, systemName = systemName.split('_')
|
targetType, systemName = systemName.split('_')
|
||||||
debug.debug("integrate system: '" + targetType + "':'" + systemName + "' from '" + os.path.join(root, filename) + "'")
|
debug.debug("integrate system: '" + targetType + "':'" + systemName + "' from '" + os.path.join(root, filename) + "'")
|
||||||
if targetType in systemList:
|
if targetType in systemList:
|
||||||
@@ -151,7 +151,7 @@ def exist(lib_name, target_name, target) :
|
|||||||
debug.verbose("add to path: '" + os.path.dirname(data["path"]) + "'")
|
debug.verbose("add to path: '" + os.path.dirname(data["path"]) + "'")
|
||||||
sys.path.append(os.path.dirname(data["path"]))
|
sys.path.append(os.path.dirname(data["path"]))
|
||||||
debug.verbose("import system : '" + data["name"] + "'")
|
debug.verbose("import system : '" + data["name"] + "'")
|
||||||
theSystem = __import__(__startSystemName + target_name + "_" + data["name"])
|
theSystem = __import__(__start_system_name + target_name + "_" + data["name"])
|
||||||
#create the system module
|
#create the system module
|
||||||
try:
|
try:
|
||||||
debug.info("call : " + data["name"])
|
debug.info("call : " + data["name"])
|
||||||
|
121
lutin/target.py
121
lutin/target.py
@@ -26,9 +26,9 @@ class Target:
|
|||||||
self.config = config
|
self.config = config
|
||||||
|
|
||||||
#processor type selection (auto/arm/ppc/x86)
|
#processor type selection (auto/arm/ppc/x86)
|
||||||
self.selectArch = config["arch"]; # TODO : Remove THIS ...
|
self.select_arch = config["arch"]; # TODO : Remove THIS ...
|
||||||
#bus size selection (auto/32/64)
|
#bus size selection (auto/32/64)
|
||||||
self.selectBus = config["bus-size"]; # TODO : Remove THIS ...
|
self.select_bus = config["bus-size"]; # TODO : Remove THIS ...
|
||||||
|
|
||||||
if config["bus-size"] == "auto":
|
if config["bus-size"] == "auto":
|
||||||
debug.error("system error ==> must generate the default 'bus-size' config")
|
debug.error("system error ==> must generate the default 'bus-size' config")
|
||||||
@@ -43,8 +43,8 @@ class Target:
|
|||||||
|
|
||||||
# todo : remove this :
|
# todo : remove this :
|
||||||
self.sumulator = config["simulation"]
|
self.sumulator = config["simulation"]
|
||||||
self.name=name
|
self.name = name
|
||||||
self.endGeneratePackage = config["generate-package"]
|
self.end_generate_package = config["generate-package"]
|
||||||
debug.info("=================================");
|
debug.info("=================================");
|
||||||
debug.info("== Target='" + self.name + "' " + config["bus-size"] + " bits for arch '" + config["arch"] + "'");
|
debug.info("== Target='" + self.name + "' " + config["bus-size"] + " bits for arch '" + config["arch"] + "'");
|
||||||
debug.info("=================================");
|
debug.info("=================================");
|
||||||
@@ -56,8 +56,8 @@ class Target:
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
self.global_include_cc=[]
|
self.global_include_cc=[]
|
||||||
self.global_flags_cc=['-D__TARGET_OS__'+self.name,
|
self.global_flags_cc=['-D__TARGET_OS__'+self.name,
|
||||||
'-D__TARGET_ARCH__'+self.selectArch,
|
'-D__TARGET_ARCH__'+self.select_arch,
|
||||||
'-D__TARGET_ADDR__'+self.selectBus + 'BITS',
|
'-D__TARGET_ADDR__'+self.select_bus + 'BITS',
|
||||||
'-D_REENTRANT']
|
'-D_REENTRANT']
|
||||||
|
|
||||||
self.global_flags_xx=[]
|
self.global_flags_xx=[]
|
||||||
@@ -74,7 +74,8 @@ class Target:
|
|||||||
|
|
||||||
self.global_sysroot=""
|
self.global_sysroot=""
|
||||||
|
|
||||||
self.suffix_cmdLine='.cmd'
|
self.suffix_cmd_line='.cmd'
|
||||||
|
self.suffix_warning='.warning'
|
||||||
self.suffix_dependence='.d'
|
self.suffix_dependence='.d'
|
||||||
self.suffix_obj='.o'
|
self.suffix_obj='.o'
|
||||||
self.suffix_lib_static='.a'
|
self.suffix_lib_static='.a'
|
||||||
@@ -105,11 +106,11 @@ class Target:
|
|||||||
self.folder_lib="/usr/lib"
|
self.folder_lib="/usr/lib"
|
||||||
self.folder_data="/usr/share"
|
self.folder_data="/usr/share"
|
||||||
self.folder_doc="/usr/share/doc"
|
self.folder_doc="/usr/share/doc"
|
||||||
self.buildDone=[]
|
self.build_done=[]
|
||||||
self.buildTreeDone=[]
|
self.build_tree_done=[]
|
||||||
self.moduleList=[]
|
self.module_list=[]
|
||||||
# output staging files list :
|
# output staging files list :
|
||||||
self.listFinalFile=[]
|
self.list_final_file=[]
|
||||||
|
|
||||||
self.sysroot=""
|
self.sysroot=""
|
||||||
|
|
||||||
@@ -148,13 +149,16 @@ class Target:
|
|||||||
if self.config["compilator"] == "clang":
|
if self.config["compilator"] == "clang":
|
||||||
self.cc = self.cross + "clang"
|
self.cc = self.cross + "clang"
|
||||||
self.xx = self.cross + "clang++"
|
self.xx = self.cross + "clang++"
|
||||||
#self.ar=self.cross + "llvm-ar"
|
self.ar=self.cross + "llvm-ar"
|
||||||
#self.ranlib="ls"
|
self.ranlib=""
|
||||||
else:
|
else:
|
||||||
self.cc = self.cross + "gcc"
|
self.cc = self.cross + "gcc"
|
||||||
self.xx = self.cross + "g++"
|
self.xx = self.cross + "g++"
|
||||||
#self.ar=self.cross + "ar"
|
#self.ar=self.cross + "ar"
|
||||||
#self.ranlib=self.cross + "ranlib"
|
#self.ranlib=self.cross + "ranlib"
|
||||||
|
if self.config["compilator-version"] != "":
|
||||||
|
self.cc = self.cc + "-" + self.config["compilator-version"]
|
||||||
|
self.xx = self.xx + "-" + self.config["compilator-version"]
|
||||||
|
|
||||||
#get g++ compilation version :
|
#get g++ compilation version :
|
||||||
ret = multiprocess.run_command_direct(self.xx + " -dumpversion");
|
ret = multiprocess.run_command_direct(self.xx + " -dumpversion");
|
||||||
@@ -173,24 +177,24 @@ class Target:
|
|||||||
return self.config["mode"]
|
return self.config["mode"]
|
||||||
|
|
||||||
def add_image_staging(self, inputFile, outputFile, sizeX, sizeY, cmdFile=None):
|
def add_image_staging(self, inputFile, outputFile, sizeX, sizeY, cmdFile=None):
|
||||||
for source, dst, x, y, cmdFile2 in self.listFinalFile:
|
for source, dst, x, y, cmdFile2 in self.list_final_file:
|
||||||
if dst == outputFile :
|
if dst == outputFile :
|
||||||
debug.verbose("already added : " + outputFile)
|
debug.verbose("already added : " + outputFile)
|
||||||
return
|
return
|
||||||
debug.verbose("add file : '" + inputFile + "' ==> '" + outputFile + "'")
|
debug.verbose("add file : '" + inputFile + "' ==> '" + outputFile + "'")
|
||||||
self.listFinalFile.append([inputFile,outputFile, sizeX, sizeY, cmdFile])
|
self.list_final_file.append([inputFile,outputFile, sizeX, sizeY, cmdFile])
|
||||||
|
|
||||||
def add_file_staging(self, inputFile, outputFile, cmdFile=None):
|
def add_file_staging(self, inputFile, outputFile, cmdFile=None):
|
||||||
for source, dst, x, y, cmdFile2 in self.listFinalFile:
|
for source, dst, x, y, cmdFile2 in self.list_final_file:
|
||||||
if dst == outputFile :
|
if dst == outputFile :
|
||||||
debug.verbose("already added : " + outputFile)
|
debug.verbose("already added : " + outputFile)
|
||||||
return
|
return
|
||||||
debug.verbose("add file : '" + inputFile + "' ==> '" + outputFile + "'");
|
debug.verbose("add file : '" + inputFile + "' ==> '" + outputFile + "'");
|
||||||
self.listFinalFile.append([inputFile, outputFile, -1, -1, cmdFile])
|
self.list_final_file.append([inputFile, outputFile, -1, -1, cmdFile])
|
||||||
|
|
||||||
def copy_to_staging(self, binaryName):
|
def copy_to_staging(self, binaryName):
|
||||||
baseFolder = self.get_staging_folder_data(binaryName)
|
baseFolder = self.get_staging_folder_data(binaryName)
|
||||||
for source, dst, x, y, cmdFile in self.listFinalFile:
|
for source, dst, x, y, cmdFile in self.list_final_file:
|
||||||
if cmdFile != None \
|
if cmdFile != None \
|
||||||
and cmdFile != "":
|
and cmdFile != "":
|
||||||
debug.verbose("cmd file " + cmdFile)
|
debug.verbose("cmd file " + cmdFile)
|
||||||
@@ -203,8 +207,8 @@ class Target:
|
|||||||
|
|
||||||
|
|
||||||
def clean_module_tree(self):
|
def clean_module_tree(self):
|
||||||
self.buildTreeDone = []
|
self.build_tree_done = []
|
||||||
self.listFinalFile = []
|
self.list_final_file = []
|
||||||
|
|
||||||
|
|
||||||
# TODO : Remove this hack ... ==> really bad ... but usefull
|
# TODO : Remove this hack ... ==> really bad ... but usefull
|
||||||
@@ -221,8 +225,11 @@ class Target:
|
|||||||
def get_full_name_cmd(self, moduleName, basePath, file):
|
def get_full_name_cmd(self, moduleName, basePath, file):
|
||||||
if file[0] == '/':
|
if file[0] == '/':
|
||||||
if tools.os.path.isfile(file):
|
if tools.os.path.isfile(file):
|
||||||
return file + self.suffix_cmdLine
|
return file + self.suffix_cmd_line
|
||||||
return self.get_build_folder(moduleName) + "/" + file + self.suffix_cmdLine
|
return self.get_build_folder(moduleName) + "/" + file + self.suffix_cmd_line
|
||||||
|
|
||||||
|
def get_full_name_warning(self, moduleName, basePath, file):
|
||||||
|
return self.get_build_folder(moduleName) + "/" + file + self.suffix_warning;
|
||||||
|
|
||||||
def get_full_name_destination(self, moduleName, basePath, file, suffix, remove_suffix=False):
|
def get_full_name_destination(self, moduleName, basePath, file, suffix, remove_suffix=False):
|
||||||
# special patch for java file:
|
# special patch for java file:
|
||||||
@@ -256,24 +263,28 @@ class Target:
|
|||||||
list.append(file)
|
list.append(file)
|
||||||
list.append(self.get_staging_folder(binaryName) + "/" + self.folder_bin + "/" + moduleName + self.suffix_binary)
|
list.append(self.get_staging_folder(binaryName) + "/" + self.folder_bin + "/" + moduleName + self.suffix_binary)
|
||||||
list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_dependence)
|
list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_dependence)
|
||||||
list.append(self.get_build_folder(binaryName) + "/" + self.folder_bin + "/" + moduleName + self.suffix_binary + self.suffix_cmdLine)
|
list.append(self.get_build_folder(binaryName) + "/" + self.folder_bin + "/" + moduleName + self.suffix_binary + self.suffix_cmd_line)
|
||||||
|
list.append(self.get_build_folder(binaryName) + "/" + self.folder_bin + "/" + moduleName + self.suffix_binary + self.suffix_warning)
|
||||||
elif (type=="lib-shared"):
|
elif (type=="lib-shared"):
|
||||||
list.append(file)
|
list.append(file)
|
||||||
list.append(self.get_staging_folder(binaryName) + "/" + self.folder_lib + "/" + moduleName + self.suffix_lib_dynamic)
|
list.append(self.get_staging_folder(binaryName) + "/" + self.folder_lib + "/" + moduleName + self.suffix_lib_dynamic)
|
||||||
list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_dependence)
|
list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_dependence)
|
||||||
list.append(self.get_build_folder(binaryName) + "/" + self.folder_lib + "/" + moduleName + self.suffix_lib_dynamic + self.suffix_cmdLine)
|
list.append(self.get_build_folder(binaryName) + "/" + self.folder_lib + "/" + moduleName + self.suffix_lib_dynamic + self.suffix_cmd_line)
|
||||||
|
list.append(self.get_build_folder(binaryName) + "/" + self.folder_lib + "/" + moduleName + self.suffix_lib_dynamic + self.suffix_warning)
|
||||||
elif (type=="lib-static"):
|
elif (type=="lib-static"):
|
||||||
list.append(file)
|
list.append(file)
|
||||||
list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_lib_static)
|
list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_lib_static)
|
||||||
list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_dependence)
|
list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_dependence)
|
||||||
list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_lib_static + self.suffix_cmdLine)
|
list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_lib_static + self.suffix_cmd_line)
|
||||||
|
list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_lib_static + self.suffix_warning)
|
||||||
elif (type=="jar"):
|
elif (type=="jar"):
|
||||||
list.append(file)
|
list.append(file)
|
||||||
list.append(self.get_build_folder(moduleName) + "/" + moduleName + ".jar")
|
list.append(self.get_build_folder(moduleName) + "/" + moduleName + ".jar")
|
||||||
list.append(self.get_build_folder(moduleName) + "/" + moduleName + ".jar" + self.suffix_dependence)
|
list.append(self.get_build_folder(moduleName) + "/" + moduleName + ".jar" + self.suffix_dependence)
|
||||||
list.append(self.get_build_folder(moduleName) + "/" + moduleName + ".jar" + self.suffix_cmdLine)
|
list.append(self.get_build_folder(moduleName) + "/" + moduleName + ".jar" + self.suffix_cmd_line)
|
||||||
|
list.append(self.get_build_folder(moduleName) + "/" + moduleName + ".jar" + self.suffix_warning)
|
||||||
elif (type=="image"):
|
elif (type=="image"):
|
||||||
list.append(self.get_build_folder(binaryName) + "/data/" + file + self.suffix_cmdLine)
|
list.append(self.get_build_folder(binaryName) + "/data/" + file + self.suffix_cmd_line)
|
||||||
else:
|
else:
|
||||||
debug.error("unknow type : " + type)
|
debug.error("unknow type : " + type)
|
||||||
return list
|
return list
|
||||||
@@ -294,25 +305,25 @@ class Target:
|
|||||||
return tools.get_run_folder() + self.folder_out + self.folder_doc + "/" + moduleName
|
return tools.get_run_folder() + self.folder_out + self.folder_doc + "/" + moduleName
|
||||||
|
|
||||||
def is_module_build(self, my_module):
|
def is_module_build(self, my_module):
|
||||||
for mod in self.buildDone:
|
for mod in self.build_done:
|
||||||
if mod == my_module:
|
if mod == my_module:
|
||||||
return True
|
return True
|
||||||
self.buildDone.append(my_module)
|
self.build_done.append(my_module)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def is_module_buildTree(self, my_module):
|
def is_module_build_tree(self, my_module):
|
||||||
for mod in self.buildTreeDone:
|
for mod in self.build_tree_done:
|
||||||
if mod == my_module:
|
if mod == my_module:
|
||||||
return True
|
return True
|
||||||
self.buildTreeDone.append(my_module)
|
self.build_tree_done.append(my_module)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def add_module(self, newModule):
|
def add_module(self, newModule):
|
||||||
debug.debug("Add nodule for Taget : " + newModule.name)
|
debug.debug("Add nodule for Taget : " + newModule.name)
|
||||||
self.moduleList.append(newModule)
|
self.module_list.append(newModule)
|
||||||
|
|
||||||
def get_module(self, name):
|
def get_module(self, name):
|
||||||
for mod in self.buildDone:
|
for mod in self.build_done:
|
||||||
if mod.name == name:
|
if mod.name == name:
|
||||||
return mod
|
return mod
|
||||||
debug.error("the module '" + str(name) + "'does not exist/already build")
|
debug.error("the module '" + str(name) + "'does not exist/already build")
|
||||||
@@ -321,28 +332,28 @@ class Target:
|
|||||||
# return inherit packages ...
|
# return inherit packages ...
|
||||||
"""
|
"""
|
||||||
def build(self, name, packagesName):
|
def build(self, name, packagesName):
|
||||||
for module in self.moduleList:
|
for module in self.module_list:
|
||||||
if module.name == name:
|
if module.name == name:
|
||||||
return module.build(self, packagesName)
|
return module.build(self, packagesName)
|
||||||
debug.error("request to build an un-existant module name : '" + name + "'")
|
debug.error("request to build an un-existant module name : '" + name + "'")
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def build_tree(self, name, packagesName):
|
def build_tree(self, name, packagesName):
|
||||||
for mod in self.moduleList:
|
for mod in self.module_list:
|
||||||
if mod.name == name:
|
if mod.name == name:
|
||||||
mod.build_tree(self, packagesName)
|
mod.build_tree(self, packagesName)
|
||||||
return
|
return
|
||||||
debug.error("request to build tree on un-existant module name : '" + name + "'")
|
debug.error("request to build tree on un-existant module name : '" + name + "'")
|
||||||
|
|
||||||
def clean(self, name):
|
def clean(self, name):
|
||||||
for mod in self.moduleList:
|
for mod in self.module_list:
|
||||||
if mod.name == name:
|
if mod.name == name:
|
||||||
mod.clean(self)
|
mod.clean(self)
|
||||||
return
|
return
|
||||||
debug.error("request to clean an un-existant module name : '" + name + "'")
|
debug.error("request to clean an un-existant module name : '" + name + "'")
|
||||||
|
|
||||||
def load_if_needed(self, name, optionnal=False):
|
def load_if_needed(self, name, optionnal=False):
|
||||||
for elem in self.moduleList:
|
for elem in self.module_list:
|
||||||
if elem.name == name:
|
if elem.name == name:
|
||||||
return True
|
return True
|
||||||
# TODO : Check internal module and system module ...
|
# TODO : Check internal module and system module ...
|
||||||
@@ -365,22 +376,25 @@ class Target:
|
|||||||
self.load_if_needed(modName)
|
self.load_if_needed(modName)
|
||||||
|
|
||||||
def project_add_module(self, name, projectMng, addedModule):
|
def project_add_module(self, name, projectMng, addedModule):
|
||||||
for mod in self.moduleList:
|
for mod in self.module_list:
|
||||||
if mod.name == name:
|
if mod.name == name:
|
||||||
mod.ext_project_add_module(self, projectMng, addedModule)
|
mod.ext_project_add_module(self, projectMng, addedModule)
|
||||||
return
|
return
|
||||||
|
|
||||||
def build(self, name, packagesName=None, optionnal=False):
|
def build(self, name, packagesName=None, optionnal=False):
|
||||||
|
if name == "gcov":
|
||||||
|
debug.info("gcov all")
|
||||||
|
debug.error("must set the gcov parsig on a specific library or binary ==> not supported now for all")
|
||||||
if name == "dump":
|
if name == "dump":
|
||||||
debug.info("dump all")
|
debug.info("dump all")
|
||||||
self.load_all()
|
self.load_all()
|
||||||
for mod in self.moduleList:
|
for mod in self.module_list:
|
||||||
mod.display(self)
|
mod.display(self)
|
||||||
return
|
return
|
||||||
if name == "all":
|
if name == "all":
|
||||||
debug.info("build all")
|
debug.info("build all")
|
||||||
self.load_all()
|
self.load_all()
|
||||||
for mod in self.moduleList:
|
for mod in self.module_list:
|
||||||
if self.name=="Android":
|
if self.name=="Android":
|
||||||
if mod.type == "PACKAGE":
|
if mod.type == "PACKAGE":
|
||||||
mod.build(self, None)
|
mod.build(self, None)
|
||||||
@@ -391,12 +405,16 @@ class Target:
|
|||||||
elif name == "clean":
|
elif name == "clean":
|
||||||
debug.info("clean all")
|
debug.info("clean all")
|
||||||
self.load_all()
|
self.load_all()
|
||||||
for mod in self.moduleList:
|
for mod in self.module_list:
|
||||||
mod.clean(self)
|
mod.clean(self)
|
||||||
else:
|
else:
|
||||||
# get the action an the module ....
|
# get the action an the module ....
|
||||||
gettedElement = name.split("?")
|
gettedElement = name.split("?")
|
||||||
moduleName = gettedElement[0]
|
moduleName = gettedElement[0]
|
||||||
|
if len(gettedElement)>=3:
|
||||||
|
sub_action_name = gettedElement[2]
|
||||||
|
else:
|
||||||
|
sub_action_name = ""
|
||||||
if len(gettedElement)>=2:
|
if len(gettedElement)>=2:
|
||||||
actionName = gettedElement[1]
|
actionName = gettedElement[1]
|
||||||
else :
|
else :
|
||||||
@@ -415,7 +433,7 @@ class Target:
|
|||||||
and optionnal == True:
|
and optionnal == True:
|
||||||
return [heritage.HeritageList(), False]
|
return [heritage.HeritageList(), False]
|
||||||
# clean requested
|
# clean requested
|
||||||
for mod in self.moduleList:
|
for mod in self.module_list:
|
||||||
if mod.name == moduleName:
|
if mod.name == moduleName:
|
||||||
if actionName == "dump":
|
if actionName == "dump":
|
||||||
debug.info("dump module '" + moduleName + "'")
|
debug.info("dump module '" + moduleName + "'")
|
||||||
@@ -423,6 +441,11 @@ class Target:
|
|||||||
elif actionName == "clean":
|
elif actionName == "clean":
|
||||||
debug.info("clean module '" + moduleName + "'")
|
debug.info("clean module '" + moduleName + "'")
|
||||||
return mod.clean(self)
|
return mod.clean(self)
|
||||||
|
elif actionName == "gcov":
|
||||||
|
debug.debug("gcov on module '" + moduleName + "'")
|
||||||
|
if sub_action_name == "output":
|
||||||
|
return mod.gcov(self, generate_output=True)
|
||||||
|
return mod.gcov(self, generate_output=False)
|
||||||
elif actionName == "build":
|
elif actionName == "build":
|
||||||
debug.debug("build module '" + moduleName + "'")
|
debug.debug("build module '" + moduleName + "'")
|
||||||
if optionnal == True:
|
if optionnal == True:
|
||||||
@@ -441,7 +464,7 @@ class Target:
|
|||||||
|
|
||||||
|
|
||||||
targetList=[]
|
targetList=[]
|
||||||
__startTargetName="lutinTarget_"
|
__start_target_name="lutinTarget_"
|
||||||
|
|
||||||
|
|
||||||
def import_path(path):
|
def import_path(path):
|
||||||
@@ -449,14 +472,14 @@ def import_path(path):
|
|||||||
matches = []
|
matches = []
|
||||||
debug.debug('TARGET: Start find sub File : "%s"' %path)
|
debug.debug('TARGET: Start find sub File : "%s"' %path)
|
||||||
for root, dirnames, filenames in os.walk(path):
|
for root, dirnames, filenames in os.walk(path):
|
||||||
tmpList = fnmatch.filter(filenames, __startTargetName + "*.py")
|
tmpList = fnmatch.filter(filenames, __start_target_name + "*.py")
|
||||||
# Import the module :
|
# Import the module :
|
||||||
for filename in tmpList:
|
for filename in tmpList:
|
||||||
debug.debug('TARGET: Find a file : "%s"' %os.path.join(root, filename))
|
debug.debug('TARGET: Find a file : "%s"' %os.path.join(root, filename))
|
||||||
#matches.append(os.path.join(root, filename))
|
#matches.append(os.path.join(root, filename))
|
||||||
sys.path.append(os.path.dirname(os.path.join(root, filename)) )
|
sys.path.append(os.path.dirname(os.path.join(root, filename)) )
|
||||||
targetName = filename.replace('.py', '')
|
targetName = filename.replace('.py', '')
|
||||||
targetName = targetName.replace(__startTargetName, '')
|
targetName = targetName.replace(__start_target_name, '')
|
||||||
debug.debug("TARGET: integrate module: '" + targetName + "' from '" + os.path.join(root, filename) + "'")
|
debug.debug("TARGET: integrate module: '" + targetName + "' from '" + os.path.join(root, filename) + "'")
|
||||||
targetList.append([targetName,os.path.join(root, filename)])
|
targetList.append([targetName,os.path.join(root, filename)])
|
||||||
|
|
||||||
@@ -471,8 +494,8 @@ def load_target(name, config):
|
|||||||
if mod[0] == name:
|
if mod[0] == name:
|
||||||
debug.verbose("add to path: '" + os.path.dirname(mod[1]) + "'")
|
debug.verbose("add to path: '" + os.path.dirname(mod[1]) + "'")
|
||||||
sys.path.append(os.path.dirname(mod[1]))
|
sys.path.append(os.path.dirname(mod[1]))
|
||||||
debug.verbose("import target : '" + __startTargetName + name + "'")
|
debug.verbose("import target : '" + __start_target_name + name + "'")
|
||||||
theTarget = __import__(__startTargetName + name)
|
theTarget = __import__(__start_target_name + name)
|
||||||
#create the target
|
#create the target
|
||||||
tmpTarget = theTarget.Target(config)
|
tmpTarget = theTarget.Target(config)
|
||||||
return tmpTarget
|
return tmpTarget
|
||||||
@@ -490,7 +513,7 @@ def list_all_target_with_desc():
|
|||||||
tmpList = []
|
tmpList = []
|
||||||
for mod in targetList:
|
for mod in targetList:
|
||||||
sys.path.append(os.path.dirname(mod[1]))
|
sys.path.append(os.path.dirname(mod[1]))
|
||||||
theTarget = __import__(__startTargetName + mod[0])
|
theTarget = __import__(__start_target_name + mod[0])
|
||||||
try:
|
try:
|
||||||
tmpdesc = theTarget.get_desc()
|
tmpdesc = theTarget.get_desc()
|
||||||
tmpList.append([mod[0], tmpdesc])
|
tmpList.append([mod[0], tmpdesc])
|
||||||
|
@@ -14,7 +14,7 @@ import fnmatch
|
|||||||
# Local import
|
# Local import
|
||||||
from . import debug
|
from . import debug
|
||||||
from . import depend
|
from . import depend
|
||||||
import multiprocess
|
from . import env
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -106,7 +106,7 @@ def copy_file(src, dst, cmd_file=None, force=False):
|
|||||||
debug.print_element("copy file", src, "==>", dst)
|
debug.print_element("copy file", src, "==>", dst)
|
||||||
create_directory_of_file(dst)
|
create_directory_of_file(dst)
|
||||||
shutil.copyfile(src, dst)
|
shutil.copyfile(src, dst)
|
||||||
multiprocess.store_command(cmd_line, cmd_file)
|
store_command(cmd_line, cmd_file)
|
||||||
|
|
||||||
|
|
||||||
def copy_anything(src, dst):
|
def copy_anything(src, dst):
|
||||||
@@ -176,5 +176,42 @@ def move_if_needed(src, dst):
|
|||||||
file_write_data(dst, src_data)
|
file_write_data(dst, src_data)
|
||||||
remove_file(src)
|
remove_file(src)
|
||||||
|
|
||||||
|
def store_command(cmd_line, file):
|
||||||
|
# write cmd line only after to prevent errors ...
|
||||||
|
if file == "" \
|
||||||
|
or file == None:
|
||||||
|
return;
|
||||||
|
debug.verbose("create cmd file: " + file)
|
||||||
|
# Create directory:
|
||||||
|
create_directory_of_file(file)
|
||||||
|
# Store the command Line:
|
||||||
|
file2 = open(file, "w")
|
||||||
|
file2.write(cmd_line)
|
||||||
|
file2.flush()
|
||||||
|
file2.close()
|
||||||
|
|
||||||
|
def store_warning(file, output, err):
|
||||||
|
# write warning line only after to prevent errors ...
|
||||||
|
if file == "" \
|
||||||
|
or file == None:
|
||||||
|
return;
|
||||||
|
if env.get_warning_mode() == False:
|
||||||
|
debug.verbose("remove warning file: " + file)
|
||||||
|
# remove file if exist...
|
||||||
|
remove_file(file);
|
||||||
|
return;
|
||||||
|
debug.verbose("create warning file: " + file)
|
||||||
|
# Create directory:
|
||||||
|
create_directory_of_file(file)
|
||||||
|
# Store the command Line:
|
||||||
|
file2 = open(file, "w")
|
||||||
|
file2.write("===== output =====\n")
|
||||||
|
file2.write(output)
|
||||||
|
file2.write("\n\n")
|
||||||
|
file2.write("===== error =====\n")
|
||||||
|
file2.write(err)
|
||||||
|
file2.write("\n\n")
|
||||||
|
file2.flush()
|
||||||
|
file2.close()
|
||||||
|
|
||||||
|
|
||||||
|
@@ -41,7 +41,7 @@ def get_output_type():
|
|||||||
## @brief Commands for running gcc to link an executable.
|
## @brief Commands for running gcc to link an executable.
|
||||||
##
|
##
|
||||||
def link(file, binary, target, depancy, name, basic_folder):
|
def link(file, binary, target, depancy, name, basic_folder):
|
||||||
file_src, file_dst, file_depend, file_cmd = target.generate_file(binary, name, basic_folder, file, "bin")
|
file_src, file_dst, file_depend, file_cmd, file_warning = target.generate_file(binary, name, basic_folder, file, "bin")
|
||||||
#create comdLine :
|
#create comdLine :
|
||||||
cmd = [
|
cmd = [
|
||||||
target.xx
|
target.xx
|
||||||
@@ -90,7 +90,7 @@ def link(file, binary, target, depancy, name, basic_folder):
|
|||||||
tools.create_directory_of_file(file_dst)
|
tools.create_directory_of_file(file_dst)
|
||||||
debug.print_element("Executable", name, "==>", file_dst)
|
debug.print_element("Executable", name, "==>", file_dst)
|
||||||
|
|
||||||
multiprocess.run_command(cmdLine)
|
multiprocess.run_command(cmdLine, store_output_file=file_warning)
|
||||||
if target.config["mode"] == "release"\
|
if target.config["mode"] == "release"\
|
||||||
or env.get_force_strip_mode() == True:
|
or env.get_force_strip_mode() == True:
|
||||||
# get the file size of the non strip file
|
# get the file size of the non strip file
|
||||||
@@ -99,10 +99,10 @@ def link(file, binary, target, depancy, name, basic_folder):
|
|||||||
cmdLineStrip=tools.list_to_str([
|
cmdLineStrip=tools.list_to_str([
|
||||||
target.strip,
|
target.strip,
|
||||||
file_dst])
|
file_dst])
|
||||||
multiprocess.run_command(cmdLineStrip)
|
multiprocess.run_command(cmdLineStrip, store_output_file=file_warning)
|
||||||
# get the stip size of the binary
|
# get the stip size of the binary
|
||||||
stripSize = tools.file_size(file_dst)
|
stripSize = tools.file_size(file_dst)
|
||||||
debug.debug("file reduce size : " + str(originSize/1024) + "ko ==> " + str(stripSize/1024) + "ko")
|
debug.debug("file reduce size : " + str(originSize/1024) + "ko ==> " + str(stripSize/1024) + "ko")
|
||||||
# write cmd line only after to prevent errors ...
|
# write cmd line only after to prevent errors ...
|
||||||
multiprocess.store_command(cmdLine, file_cmd)
|
tools.store_command(cmdLine, file_cmd)
|
||||||
|
|
@@ -45,6 +45,7 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
|||||||
file_cmd = target.get_full_name_cmd(name, basic_folder, file)
|
file_cmd = target.get_full_name_cmd(name, basic_folder, file)
|
||||||
file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type())
|
file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type())
|
||||||
file_depend = target.get_full_dependency(name, basic_folder, file)
|
file_depend = target.get_full_dependency(name, basic_folder, file)
|
||||||
|
file_warning = target.get_full_name_warning(name, basic_folder, file)
|
||||||
|
|
||||||
# create the command line befor requesting start:
|
# create the command line befor requesting start:
|
||||||
cmd = [
|
cmd = [
|
||||||
@@ -91,7 +92,7 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
|||||||
tools.create_directory_of_file(file_dst)
|
tools.create_directory_of_file(file_dst)
|
||||||
comment = ["c", name, "<==", file]
|
comment = ["c", name, "<==", file]
|
||||||
# process element
|
# process element
|
||||||
multiprocess.run_in_pool(cmdLine, comment, file_cmd)
|
multiprocess.run_in_pool(cmdLine, comment, file_cmd, store_output_file=file_warning)
|
||||||
return {"action":"add", "file":file_dst}
|
return {"action":"add", "file":file_dst}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -44,7 +44,7 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
|||||||
file_cmd = target.get_full_name_cmd(name, basic_folder, file)
|
file_cmd = target.get_full_name_cmd(name, basic_folder, file)
|
||||||
file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type())
|
file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type())
|
||||||
file_depend = target.get_full_dependency(name, basic_folder, file)
|
file_depend = target.get_full_dependency(name, basic_folder, file)
|
||||||
|
file_warning = target.get_full_name_warning(name, basic_folder, file)
|
||||||
# create the command line befor requesting start:
|
# create the command line befor requesting start:
|
||||||
cmd = [
|
cmd = [
|
||||||
target.xx,
|
target.xx,
|
||||||
@@ -91,14 +91,13 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
|||||||
cmd.append(file_src)
|
cmd.append(file_src)
|
||||||
# Create cmd line
|
# Create cmd line
|
||||||
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_build(file_dst, file_src, file_depend, file_cmd, cmdLine) == False:
|
if depend.need_re_build(file_dst, file_src, file_depend, file_cmd, cmdLine) == False:
|
||||||
return {"action":"add", "file":file_dst}
|
return {"action":"add", "file":file_dst}
|
||||||
tools.create_directory_of_file(file_dst)
|
tools.create_directory_of_file(file_dst)
|
||||||
comment = ["c++", name, "<==", file]
|
comment = ["c++", name, "<==", file]
|
||||||
#process element
|
#process element
|
||||||
multiprocess.run_in_pool(cmdLine, comment, file_cmd)
|
multiprocess.run_in_pool(cmdLine, comment, file_cmd, store_output_file=file_warning)
|
||||||
return {"action":"add", "file":file_dst}
|
return {"action":"add", "file":file_dst}
|
||||||
|
|
||||||
def get_version_compilation_flags(flags, dependency_flags):
|
def get_version_compilation_flags(flags, dependency_flags):
|
||||||
|
@@ -39,7 +39,7 @@ def get_output_type():
|
|||||||
## @brief Commands for running gcc to link a shared library.
|
## @brief Commands for running gcc to link a shared library.
|
||||||
##
|
##
|
||||||
def link(file, binary, target, depancy, name, basic_folder):
|
def link(file, binary, target, depancy, name, basic_folder):
|
||||||
file_src, file_dst, file_depend, file_cmd = target.generate_file(binary, name, basic_folder, file, "jar")
|
file_src, file_dst, file_depend, file_cmd, file_warning = target.generate_file(binary, name, basic_folder, file, "jar")
|
||||||
#create command Line
|
#create command Line
|
||||||
cmd = [
|
cmd = [
|
||||||
target.jar,
|
target.jar,
|
||||||
@@ -63,9 +63,9 @@ def link(file, binary, target, depancy, name, basic_folder):
|
|||||||
"""
|
"""
|
||||||
tools.create_directory_of_file(file_dst)
|
tools.create_directory_of_file(file_dst)
|
||||||
debug.print_element("jar", name, "==>", file_dst)
|
debug.print_element("jar", name, "==>", file_dst)
|
||||||
multiprocess.run_command(cmdLine)
|
multiprocess.run_command(cmdLine, store_output_file=file_warning)
|
||||||
# write cmd line only after to prevent errors ...
|
# write cmd line only after to prevent errors ...
|
||||||
multiprocess.store_command(cmdLine, file_cmd)
|
tools.store_command(cmdLine, file_cmd)
|
||||||
#debug.print_element("SharedLib", self.name, "==>", tmpList[1])
|
#debug.print_element("SharedLib", self.name, "==>", tmpList[1])
|
||||||
return file_dst
|
return file_dst
|
||||||
|
|
||||||
|
@@ -41,8 +41,7 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
|||||||
file_cmd = target.get_full_name_cmd(name, basic_folder, file)
|
file_cmd = target.get_full_name_cmd(name, basic_folder, file)
|
||||||
file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type(), remove_suffix=True)
|
file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type(), remove_suffix=True)
|
||||||
file_depend = target.get_full_dependency(name, basic_folder, file)
|
file_depend = target.get_full_dependency(name, basic_folder, file)
|
||||||
|
file_warning = target.get_full_name_warning(name, basic_folder, file)
|
||||||
|
|
||||||
# create the command line befor requesting start:
|
# create the command line befor requesting start:
|
||||||
cmd = [
|
cmd = [
|
||||||
target.java,
|
target.java,
|
||||||
@@ -89,6 +88,6 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
|||||||
tools.create_directory_of_file(file_dst)
|
tools.create_directory_of_file(file_dst)
|
||||||
comment = ["java", name, "<==", file]
|
comment = ["java", name, "<==", file]
|
||||||
#process element
|
#process element
|
||||||
multiprocess.run_in_pool(cmdLine, comment, file_cmd)
|
multiprocess.run_in_pool(cmdLine, comment, file_cmd, store_output_file=file_warning)
|
||||||
return {"action":"add", "file":file_dst}
|
return {"action":"add", "file":file_dst}
|
||||||
|
|
||||||
|
@@ -41,8 +41,7 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
|||||||
file_cmd = target.get_full_name_cmd(name, basic_folder, file)
|
file_cmd = target.get_full_name_cmd(name, basic_folder, file)
|
||||||
# file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type())
|
# file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type())
|
||||||
file_depend = target.get_full_dependency(name, basic_folder, file)
|
file_depend = target.get_full_dependency(name, basic_folder, file)
|
||||||
|
file_warning = target.get_full_name_warning(name, basic_folder, file)
|
||||||
|
|
||||||
# create the command line befor requesting start:
|
# create the command line befor requesting start:
|
||||||
cmd = [
|
cmd = [
|
||||||
target.javah,
|
target.javah,
|
||||||
@@ -66,7 +65,7 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
|||||||
#tools.create_directory_of_file(file_dst)
|
#tools.create_directory_of_file(file_dst)
|
||||||
comment = ["javah", class_to_build.replace(".", "_") + ".h", "<==", class_to_build]
|
comment = ["javah", class_to_build.replace(".", "_") + ".h", "<==", class_to_build]
|
||||||
#process element
|
#process element
|
||||||
multiprocess.run_in_pool(cmdLine, comment, file_cmd)
|
multiprocess.run_in_pool(cmdLine, comment, file_cmd, store_output_file=file_warning)
|
||||||
debug.verbose("file= " + file_dst)
|
debug.verbose("file= " + file_dst)
|
||||||
#return file_dst
|
#return file_dst
|
||||||
return {"action":"path", "path":target.get_build_folder(name) + target.folder_generate_code}
|
return {"action":"path", "path":target.get_build_folder(name) + target.folder_generate_code}
|
||||||
|
@@ -39,7 +39,7 @@ def get_output_type():
|
|||||||
## @brief Commands for running gcc to link a shared library.
|
## @brief Commands for running gcc to link a shared library.
|
||||||
##
|
##
|
||||||
def link(file, binary, target, depancy, name, basic_folder):
|
def link(file, binary, target, depancy, name, basic_folder):
|
||||||
file_src, file_dst, file_depend, file_cmd = target.generate_file(binary, name, basic_folder, file, "lib-shared")
|
file_src, file_dst, file_depend, file_cmd, file_warning = target.generate_file(binary, name, basic_folder, file, "lib-shared")
|
||||||
#create command Line
|
#create command Line
|
||||||
cmd = [
|
cmd = [
|
||||||
target.xx,
|
target.xx,
|
||||||
@@ -82,7 +82,7 @@ def link(file, binary, target, depancy, name, basic_folder):
|
|||||||
return tmpList[1]
|
return tmpList[1]
|
||||||
tools.create_directory_of_file(file_dst)
|
tools.create_directory_of_file(file_dst)
|
||||||
debug.print_element("SharedLib", name, "==>", file_dst)
|
debug.print_element("SharedLib", name, "==>", file_dst)
|
||||||
multiprocess.run_command(cmdLine)
|
multiprocess.run_command(cmdLine, store_output_file=file_warning)
|
||||||
# strip the output file:
|
# strip the output file:
|
||||||
if target.config["mode"] == "release" \
|
if target.config["mode"] == "release" \
|
||||||
or env.get_force_strip_mode() == True:
|
or env.get_force_strip_mode() == True:
|
||||||
@@ -92,11 +92,11 @@ def link(file, binary, target, depancy, name, basic_folder):
|
|||||||
cmdLineStrip=tools.list_to_str([
|
cmdLineStrip=tools.list_to_str([
|
||||||
target.strip,
|
target.strip,
|
||||||
file_dst])
|
file_dst])
|
||||||
multiprocess.run_command(cmdLineStrip)
|
multiprocess.run_command(cmdLineStrip, store_output_file=file_warning)
|
||||||
# get the stip size of the binary
|
# get the stip size of the binary
|
||||||
stripSize = tools.file_size(file_dst)
|
stripSize = tools.file_size(file_dst)
|
||||||
debug.debug("file reduce size : " + str(originSize/1024) + "ko ==> " + str(stripSize/1024) + "ko")
|
debug.debug("file reduce size : " + str(originSize/1024) + "ko ==> " + str(stripSize/1024) + "ko")
|
||||||
# write cmd line only after to prevent errors ...
|
# write cmd line only after to prevent errors ...
|
||||||
multiprocess.store_command(cmdLine, file_cmd)
|
tools.store_command(cmdLine, file_cmd)
|
||||||
#debug.print_element("SharedLib", self.name, "==>", tmpList[1])
|
#debug.print_element("SharedLib", self.name, "==>", tmpList[1])
|
||||||
return file_dst
|
return file_dst
|
||||||
|
@@ -39,7 +39,7 @@ def get_output_type():
|
|||||||
## @brief Commands for running ar.
|
## @brief Commands for running ar.
|
||||||
##
|
##
|
||||||
def link(file, binary, target, depancy, name, basic_folder):
|
def link(file, binary, target, depancy, name, basic_folder):
|
||||||
file_src, file_dst, file_depend, file_cmd = target.generate_file(binary, name, basic_folder, file, "lib-static")
|
file_src, file_dst, file_depend, file_cmd, file_warning = target.generate_file(binary, name, basic_folder, file, "lib-static")
|
||||||
#$(Q)$(TARGET_AR) $(TARGET_GLOBAL_ARFLAGS) $(PRIVATE_ARFLAGS) $@ $(PRIVATE_ALL_OBJECTS)
|
#$(Q)$(TARGET_AR) $(TARGET_GLOBAL_ARFLAGS) $(PRIVATE_ARFLAGS) $@ $(PRIVATE_ALL_OBJECTS)
|
||||||
cmd = [
|
cmd = [
|
||||||
target.ar
|
target.ar
|
||||||
@@ -70,13 +70,13 @@ def link(file, binary, target, depancy, name, basic_folder):
|
|||||||
# explicitly remove the destination to prevent error ...
|
# explicitly remove the destination to prevent error ...
|
||||||
if os.path.exists(file_dst) and os.path.isfile(file_dst):
|
if os.path.exists(file_dst) and os.path.isfile(file_dst):
|
||||||
os.remove(file_dst)
|
os.remove(file_dst)
|
||||||
multiprocess.run_command(cmdLine)
|
multiprocess.run_command(cmdLine, store_output_file=file_warning)
|
||||||
#$(Q)$(TARGET_RANLIB) $@
|
#$(Q)$(TARGET_RANLIB) $@
|
||||||
if target.ranlib != "":
|
if target.ranlib != "":
|
||||||
cmdLineRanLib=tools.list_to_str([
|
cmdLineRanLib=tools.list_to_str([
|
||||||
target.ranlib,
|
target.ranlib,
|
||||||
file_dst ])
|
file_dst ])
|
||||||
multiprocess.run_command(cmdLineRanLib)
|
multiprocess.run_command(cmdLineRanLib, store_output_file=file_warning)
|
||||||
# write cmd line only after to prevent errors ...
|
# write cmd line only after to prevent errors ...
|
||||||
multiprocess.store_command(cmdLine, file_cmd)
|
tools.store_command(cmdLine, file_cmd)
|
||||||
return file_dst
|
return file_dst
|
||||||
|
@@ -46,6 +46,7 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
|||||||
file_cmd = target.get_full_name_cmd(name, basic_folder, file)
|
file_cmd = target.get_full_name_cmd(name, basic_folder, file)
|
||||||
file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type())
|
file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type())
|
||||||
file_depend = target.get_full_dependency(name, basic_folder, file)
|
file_depend = target.get_full_dependency(name, basic_folder, file)
|
||||||
|
file_warning = target.get_full_name_warning(name, basic_folder, file)
|
||||||
# create the command line befor requesting start:
|
# create the command line befor requesting start:
|
||||||
cmd = [
|
cmd = [
|
||||||
target.cc,
|
target.cc,
|
||||||
@@ -98,6 +99,6 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
|||||||
tools.create_directory_of_file(file_dst)
|
tools.create_directory_of_file(file_dst)
|
||||||
comment = ["m", name, "<==", file]
|
comment = ["m", name, "<==", file]
|
||||||
#process element
|
#process element
|
||||||
multiprocess.run_in_pool(cmdLine, comment, file_cmd)
|
multiprocess.run_in_pool(cmdLine, comment, file_cmd, store_output_file=file_warning)
|
||||||
return {"action":"add", "file":file_dst}
|
return {"action":"add", "file":file_dst}
|
||||||
|
|
||||||
|
@@ -46,6 +46,7 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
|||||||
file_cmd = target.get_full_name_cmd(name, basic_folder, file)
|
file_cmd = target.get_full_name_cmd(name, basic_folder, file)
|
||||||
file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type())
|
file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type())
|
||||||
file_depend = target.get_full_dependency(name, basic_folder, file)
|
file_depend = target.get_full_dependency(name, basic_folder, file)
|
||||||
|
file_warning = target.get_full_name_warning(name, basic_folder, file)
|
||||||
# create the command line befor requesting start:
|
# create the command line befor requesting start:
|
||||||
cmd = [
|
cmd = [
|
||||||
target.xx,
|
target.xx,
|
||||||
@@ -98,5 +99,5 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
|||||||
tools.create_directory_of_file(file_dst)
|
tools.create_directory_of_file(file_dst)
|
||||||
comment = ["m++", name, "<==", file]
|
comment = ["m++", name, "<==", file]
|
||||||
#process element
|
#process element
|
||||||
multiprocess.run_in_pool(cmdLine, comment, file_cmd)
|
multiprocess.run_in_pool(cmdLine, comment, file_cmd, store_output_file=file_warning)
|
||||||
return {"action":"add", "file":file_dst}
|
return {"action":"add", "file":file_dst}
|
||||||
|
@@ -25,10 +25,14 @@ class Target(target.Target):
|
|||||||
#bus size selection (auto/32/64)
|
#bus size selection (auto/32/64)
|
||||||
if config["bus-size"] == "auto":
|
if config["bus-size"] == "auto":
|
||||||
config["bus-size"] = "32"
|
config["bus-size"] = "32"
|
||||||
|
arch = ""
|
||||||
arch = ""#"ARMv7"
|
|
||||||
target.Target.__init__(self, "Android", config, arch)
|
target.Target.__init__(self, "Android", config, arch)
|
||||||
|
|
||||||
|
if config["bus-size"] == "32":
|
||||||
|
arch="armv7"
|
||||||
|
else:
|
||||||
|
arch="arm64"
|
||||||
|
|
||||||
self.folder_ndk = os.getenv('PROJECT_NDK', "AUTO")
|
self.folder_ndk = os.getenv('PROJECT_NDK', "AUTO")
|
||||||
self.folder_sdk = os.getenv('PROJECT_SDK', "AUTO")
|
self.folder_sdk = os.getenv('PROJECT_SDK', "AUTO")
|
||||||
# auto search NDK
|
# auto search NDK
|
||||||
@@ -59,7 +63,7 @@ class Target(target.Target):
|
|||||||
if host.BUS_SIZE==64:
|
if host.BUS_SIZE==64:
|
||||||
tmpOsVal = "_64"
|
tmpOsVal = "_64"
|
||||||
if self.config["compilator"] == "clang":
|
if self.config["compilator"] == "clang":
|
||||||
self.set_cross_base(self.folder_ndk + "/toolchains/llvm-3.3/prebuilt/linux-x86_64/bin/")
|
self.set_cross_base(self.folder_ndk + "/toolchains/llvm-3.6/prebuilt/linux-x86" + tmpOsVal + "/bin/")
|
||||||
else:
|
else:
|
||||||
baseFolderArm = self.folder_ndk + "/toolchains/arm-linux-androideabi-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/"
|
baseFolderArm = self.folder_ndk + "/toolchains/arm-linux-androideabi-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/"
|
||||||
baseFolderMips = self.folder_ndk + "/toolchains/mipsel-linux-android-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/"
|
baseFolderMips = self.folder_ndk + "/toolchains/mipsel-linux-android-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/"
|
||||||
@@ -72,12 +76,6 @@ class Target(target.Target):
|
|||||||
if not os.path.isdir(baseFolderX86):
|
if not os.path.isdir(baseFolderX86):
|
||||||
debug.info("Gcc x86 path does not exist !!!")
|
debug.info("Gcc x86 path does not exist !!!")
|
||||||
|
|
||||||
arch = "ARMv7"
|
|
||||||
# for gcc :
|
|
||||||
|
|
||||||
# for clang :
|
|
||||||
|
|
||||||
|
|
||||||
self.folder_bin="/mustNotCreateBinary"
|
self.folder_bin="/mustNotCreateBinary"
|
||||||
self.folder_lib="/data/lib/armeabi"
|
self.folder_lib="/data/lib/armeabi"
|
||||||
self.folder_data="/data/assets"
|
self.folder_data="/data/assets"
|
||||||
@@ -86,7 +84,8 @@ class Target(target.Target):
|
|||||||
|
|
||||||
# board id at 14 is for android 4.0 and more ...
|
# board id at 14 is for android 4.0 and more ...
|
||||||
self.boardId = 14
|
self.boardId = 14
|
||||||
if arch == "ARMv5" or arch == "ARMv7":
|
self.global_flags_cc.append("-D__ANDROID_BOARD_ID__=" + str(self.boardId))
|
||||||
|
if arch == "armv5" or arch == "armv7":
|
||||||
self.global_include_cc.append("-I" + self.folder_ndk +"/platforms/android-" + str(self.boardId) + "/arch-arm/usr/include/")
|
self.global_include_cc.append("-I" + self.folder_ndk +"/platforms/android-" + str(self.boardId) + "/arch-arm/usr/include/")
|
||||||
elif arch == "mips":
|
elif arch == "mips":
|
||||||
self.global_include_cc.append("-I" + self.folder_ndk +"/platforms/android-" + str(self.boardId) + "/arch-mips/usr/include/")
|
self.global_include_cc.append("-I" + self.folder_ndk +"/platforms/android-" + str(self.boardId) + "/arch-mips/usr/include/")
|
||||||
@@ -95,15 +94,29 @@ class Target(target.Target):
|
|||||||
|
|
||||||
if True:
|
if True:
|
||||||
if self.config["compilator"] == "clang":
|
if self.config["compilator"] == "clang":
|
||||||
|
if self.boardId < 21:
|
||||||
|
debug.error("Clang work only with the board wersion >= 21 : android 5.x.x")
|
||||||
|
self.global_flags_cc.append("-D__STDCPP_LLVM__")
|
||||||
|
# llvm-libc++ : BSD | MIT
|
||||||
|
self.global_include_cc.append("-gcc-toolchain " + self.folder_ndk +"/sources/android/support/include")
|
||||||
|
self.global_include_cc.append("-I" + self.folder_ndk +"/sources/android/support/include")
|
||||||
self.global_include_cc.append("-I" + self.folder_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/include/")
|
self.global_include_cc.append("-I" + self.folder_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/include/")
|
||||||
if arch == "ARMv5":
|
if arch == "armv5":
|
||||||
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/libs/armeabi/"
|
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/libs/armeabi/"
|
||||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
||||||
self.global_flags_ld.append( stdCppBasePath + "libc++_static.a")
|
self.global_flags_ld.append( stdCppBasePath + "libc++_static.a")
|
||||||
elif arch == "ARMv7":
|
elif arch == "armv7":
|
||||||
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/libs/armeabi-v7a/"
|
# The only one tested ... ==> but we have link error ...
|
||||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
self.global_flags_cc.append("-target armv7-none-linux-androideabi")
|
||||||
self.global_flags_ld.append( stdCppBasePath + "libc++_static.a")
|
self.global_flags_cc.append("-march=armv7-a")
|
||||||
|
self.global_flags_cc.append("-mfpu=vfpv3-d16")
|
||||||
|
self.global_flags_cc.append("-mhard-float")
|
||||||
|
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/"
|
||||||
|
self.global_flags_ld.append( stdCppBasePath + "thumb/libc++_static.a")
|
||||||
|
self.global_flags_ld.append("-target armv7-none-linux-androideabi")
|
||||||
|
self.global_flags_ld.append("-Wl,--fix-cortex-a8")
|
||||||
|
self.global_flags_ld.append("-Wl,--no-warn-mismatch")
|
||||||
|
self.global_flags_ld.append("-lm_hard")
|
||||||
elif arch == "mips":
|
elif arch == "mips":
|
||||||
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/libs/mips/"
|
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/libs/mips/"
|
||||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
||||||
@@ -113,13 +126,16 @@ class Target(target.Target):
|
|||||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
||||||
self.global_flags_ld.append( stdCppBasePath + "libc++_static.a")
|
self.global_flags_ld.append( stdCppBasePath + "libc++_static.a")
|
||||||
else:
|
else:
|
||||||
|
self.global_flags_cc.append("-D__STDCPP_GNU__")
|
||||||
|
# GPL v3 (+ exception link for gcc compilator)
|
||||||
self.global_include_cc.append("-I" + self.folder_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/include/")
|
self.global_include_cc.append("-I" + self.folder_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/include/")
|
||||||
if arch == "ARMv5":
|
self.global_include_cc.append("-I" + self.folder_ndk +"/sources/android/support/include/")
|
||||||
|
if arch == "armv5":
|
||||||
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/libs/armeabi/"
|
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/libs/armeabi/"
|
||||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
||||||
self.global_flags_ld.append( stdCppBasePath + "thumb/libgnustl_static.a")
|
self.global_flags_ld.append( stdCppBasePath + "thumb/libgnustl_static.a")
|
||||||
self.global_flags_ld.append( stdCppBasePath + "thumb/libsupc++.a")
|
self.global_flags_ld.append( stdCppBasePath + "thumb/libsupc++.a")
|
||||||
elif arch == "ARMv7":
|
elif arch == "armv7":
|
||||||
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/libs/armeabi-v7a/"
|
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/libs/armeabi-v7a/"
|
||||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
||||||
self.global_flags_ld.append( stdCppBasePath + "thumb/libgnustl_static.a")
|
self.global_flags_ld.append( stdCppBasePath + "thumb/libgnustl_static.a")
|
||||||
@@ -145,7 +161,8 @@ class Target(target.Target):
|
|||||||
self.global_flags_cc.append("-D__ARM_ARCH_5T__")
|
self.global_flags_cc.append("-D__ARM_ARCH_5T__")
|
||||||
self.global_flags_cc.append("-D__ARM_ARCH_5E__")
|
self.global_flags_cc.append("-D__ARM_ARCH_5E__")
|
||||||
self.global_flags_cc.append("-D__ARM_ARCH_5TE__")
|
self.global_flags_cc.append("-D__ARM_ARCH_5TE__")
|
||||||
if self.arch == "ARM":
|
if self.config["compilator"] != "clang":
|
||||||
|
if self.arch == "armv5":
|
||||||
# -----------------------
|
# -----------------------
|
||||||
# -- arm V5 :
|
# -- arm V5 :
|
||||||
# -----------------------
|
# -----------------------
|
||||||
@@ -168,21 +185,18 @@ class Target(target.Target):
|
|||||||
# -- Common flags :
|
# -- Common flags :
|
||||||
# -----------------------
|
# -----------------------
|
||||||
self.global_flags_cc.append("-fpic")
|
self.global_flags_cc.append("-fpic")
|
||||||
|
if self.config["compilator"] != "clang":
|
||||||
self.global_flags_cc.append("-ffunction-sections")
|
self.global_flags_cc.append("-ffunction-sections")
|
||||||
self.global_flags_cc.append("-funwind-tables")
|
self.global_flags_cc.append("-funwind-tables")
|
||||||
self.global_flags_cc.append("-fstack-protector")
|
self.global_flags_cc.append("-fstack-protector")
|
||||||
self.global_flags_cc.append("-Wno-psabi")
|
self.global_flags_cc.append("-Wno-psabi")
|
||||||
self.global_flags_cc.append("-mtune=xscale")
|
self.global_flags_cc.append("-mtune=xscale")
|
||||||
self.global_flags_cc.append("-fexceptions")
|
|
||||||
##self.global_flags_cc.append("-fno-exceptions")
|
|
||||||
self.global_flags_cc.append("-fomit-frame-pointer")
|
self.global_flags_cc.append("-fomit-frame-pointer")
|
||||||
self.global_flags_cc.append("-fno-strict-aliasing")
|
self.global_flags_cc.append("-fno-strict-aliasing")
|
||||||
|
|
||||||
self.global_flags_xx.append("-frtti")
|
self.global_flags_xx.append("-frtti")
|
||||||
|
self.global_flags_cc.append("-fexceptions")
|
||||||
self.global_flags_xx.append("-Wa,--noexecstack")
|
self.global_flags_xx.append("-Wa,--noexecstack")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def check_right_package(self, pkgProperties, value):
|
def check_right_package(self, pkgProperties, value):
|
||||||
for val in pkgProperties["RIGHT"]:
|
for val in pkgProperties["RIGHT"]:
|
||||||
if value == val:
|
if value == val:
|
||||||
|
@@ -62,6 +62,7 @@ class Target(target.Target):
|
|||||||
self.global_flags_ld.append("-miphoneos-version-min=8.0")
|
self.global_flags_ld.append("-miphoneos-version-min=8.0")
|
||||||
self.global_flags_cc.append("-miphoneos-version-min=8.0")
|
self.global_flags_cc.append("-miphoneos-version-min=8.0")
|
||||||
|
|
||||||
|
self.global_flags_cc.append("-D__STDCPP_LLVM__")
|
||||||
self.global_flags_ld.append([
|
self.global_flags_ld.append([
|
||||||
"-Xlinker",
|
"-Xlinker",
|
||||||
"-objc_abi_version",
|
"-objc_abi_version",
|
||||||
|
@@ -33,6 +33,8 @@ class Target(target.Target):
|
|||||||
if host.BUS_SIZE != 32:
|
if host.BUS_SIZE != 32:
|
||||||
self.global_flags_cc.append("-m32")
|
self.global_flags_cc.append("-m32")
|
||||||
|
|
||||||
|
self.global_flags_cc.append("-D__STDCPP_GNU__")
|
||||||
|
|
||||||
def generate_list_separate_coma(self, list):
|
def generate_list_separate_coma(self, list):
|
||||||
result = ""
|
result = ""
|
||||||
fistTime = True
|
fistTime = True
|
||||||
|
@@ -38,6 +38,8 @@ class Target(target.Target):
|
|||||||
self.suffix_binary=''
|
self.suffix_binary=''
|
||||||
self.suffix_package=''
|
self.suffix_package=''
|
||||||
|
|
||||||
|
self.global_flags_cc.append("-D__STDCPP_LLVM__")
|
||||||
|
|
||||||
|
|
||||||
def get_staging_folder(self, binaryName):
|
def get_staging_folder(self, binaryName):
|
||||||
return tools.get_run_folder() + self.folder_out + self.folder_staging + "/" + binaryName + ".app/Contents/"
|
return tools.get_run_folder() + self.folder_out + self.folder_staging + "/" + binaryName + ".app/Contents/"
|
||||||
|
@@ -59,6 +59,7 @@ class Target(target.Target):
|
|||||||
self.suffix_lib_dynamic='.dll'
|
self.suffix_lib_dynamic='.dll'
|
||||||
self.suffix_binary='.exe'
|
self.suffix_binary='.exe'
|
||||||
self.suffix_package=''
|
self.suffix_package=''
|
||||||
|
self.global_flags_cc.append("-D__STDCPP_GNU__")
|
||||||
|
|
||||||
|
|
||||||
def get_staging_folder_data(self, binaryName):
|
def get_staging_folder_data(self, binaryName):
|
||||||
|
2
setup.py
2
setup.py
@@ -7,7 +7,7 @@ def readme():
|
|||||||
|
|
||||||
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
|
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
|
||||||
setup(name='lutin',
|
setup(name='lutin',
|
||||||
version='0.5.14',
|
version='0.6.4',
|
||||||
description='Lutin generic builder',
|
description='Lutin generic builder',
|
||||||
long_description=readme(),
|
long_description=readme(),
|
||||||
url='http://github.com/HeeroYui/lutin',
|
url='http://github.com/HeeroYui/lutin',
|
||||||
|
Reference in New Issue
Block a user