[DEV] start compile in shered object mode
This commit is contained in:
parent
0afb15c5b3
commit
21af5be1a3
115
lutin/depend.py
115
lutin/depend.py
@ -29,11 +29,11 @@ def _file_read_data(path, binary=False):
|
|||||||
return data_file
|
return data_file
|
||||||
|
|
||||||
|
|
||||||
def need_re_build(dst, src, dependFile=None, file_cmd="", cmdLine="", force_identical=False):
|
def need_re_build(dst, src, depend_file=None, file_cmd="", cmd_line="", force_identical=False):
|
||||||
debug.extreme_verbose("Request check of dependency of :")
|
debug.extreme_verbose("Request check of dependency of :")
|
||||||
debug.extreme_verbose(" dst='" + str(dst) + "'")
|
debug.extreme_verbose(" dst='" + str(dst) + "'")
|
||||||
debug.extreme_verbose(" str='" + str(src) + "'")
|
debug.extreme_verbose(" src='" + str(src) + "'")
|
||||||
debug.extreme_verbose(" dept='" + str(dependFile) + "'")
|
debug.extreme_verbose(" dept='" + str(depend_file) + "'")
|
||||||
debug.extreme_verbose(" cmd='" + str(file_cmd) + "'")
|
debug.extreme_verbose(" cmd='" + str(file_cmd) + "'")
|
||||||
debug.extreme_verbose(" force_identical='" + str(force_identical) + "'")
|
debug.extreme_verbose(" force_identical='" + str(force_identical) + "'")
|
||||||
# if force mode selected ==> just force rebuild ...
|
# if force mode selected ==> just force rebuild ...
|
||||||
@ -59,9 +59,9 @@ def need_re_build(dst, src, dependFile=None, file_cmd="", cmdLine="", force_iden
|
|||||||
debug.extreme_verbose(" ==> must rebuild (source time greater)")
|
debug.extreme_verbose(" ==> must rebuild (source time greater)")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if dependFile != "" \
|
if depend_file != "" \
|
||||||
and dependFile != None \
|
and depend_file != None \
|
||||||
and os.path.exists(dependFile) == False:
|
and os.path.exists(depend_file) == False:
|
||||||
debug.extreme_verbose(" ==> must rebuild (no depending file)")
|
debug.extreme_verbose(" ==> must rebuild (no depending file)")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -70,50 +70,50 @@ def need_re_build(dst, src, dependFile=None, file_cmd="", cmdLine="", force_iden
|
|||||||
if os.path.exists(file_cmd) == False:
|
if os.path.exists(file_cmd) == False:
|
||||||
debug.extreme_verbose(" ==> must rebuild (no commandLine file)")
|
debug.extreme_verbose(" ==> must rebuild (no commandLine file)")
|
||||||
return True
|
return True
|
||||||
# check if the 2 cmdline are similar :
|
# check if the 2 cmd_line are similar :
|
||||||
file2 = open(file_cmd, "r")
|
file2 = open(file_cmd, "r")
|
||||||
firstAndUniqueLine = file2.read()
|
first_and_unique_line = file2.read()
|
||||||
if firstAndUniqueLine != cmdLine:
|
if first_and_unique_line != cmd_line:
|
||||||
debug.extreme_verbose(" ==> must rebuild (cmdLines are not identical)")
|
debug.extreme_verbose(" ==> must rebuild (cmd_lines are not identical)")
|
||||||
debug.extreme_verbose(" ==> '" + cmdLine + "'")
|
debug.extreme_verbose(" ==> '" + cmd_line + "'")
|
||||||
debug.extreme_verbose(" ==> '" + firstAndUniqueLine + "'")
|
debug.extreme_verbose(" ==> '" + first_and_unique_line + "'")
|
||||||
file2.close()
|
file2.close()
|
||||||
return True
|
return True
|
||||||
# the cmdfile is correct ...
|
# the cmdfile is correct ...
|
||||||
file2.close()
|
file2.close()
|
||||||
|
|
||||||
if dependFile != "" \
|
if depend_file != "" \
|
||||||
and dependFile != None:
|
and depend_file != None:
|
||||||
debug.extreme_verbose(" start parsing dependency file : '" + dependFile + "'")
|
debug.extreme_verbose(" start parsing dependency file : '" + depend_file + "'")
|
||||||
file = open(dependFile, "r")
|
file = open(depend_file, "r")
|
||||||
for curLine in file.readlines():
|
for cur_line in file.readlines():
|
||||||
# normal file : end with : ": \\n"
|
# normal file : end with : ": \\n"
|
||||||
curLine = curLine[:len(curLine)-1]
|
cur_line = cur_line[:len(cur_line)-1]
|
||||||
# removing last \ ...
|
# removing last \ ...
|
||||||
if curLine[len(curLine)-1:] == '\\' :
|
if cur_line[len(cur_line)-1:] == '\\' :
|
||||||
curLine = curLine[:len(curLine)-1]
|
cur_line = cur_line[:len(cur_line)-1]
|
||||||
# remove white space :
|
# remove white space :
|
||||||
#debug.verbose(" Line (read) : '" + curLine + "'");
|
#debug.verbose(" Line (read) : '" + cur_line + "'");
|
||||||
curLine = curLine.strip()
|
cur_line = cur_line.strip()
|
||||||
#debug.verbose(" Line (strip) : '" + curLine + "'");
|
#debug.verbose(" Line (strip) : '" + cur_line + "'");
|
||||||
|
|
||||||
testFile=""
|
test_file=""
|
||||||
if curLine[len(curLine)-1:] == ':':
|
if cur_line[len(cur_line)-1:] == ':':
|
||||||
debug.extreme_verbose(" Line (no check (already done) : '" + curLine + "'");
|
debug.extreme_verbose(" Line (no check (already done) : '" + cur_line + "'");
|
||||||
elif len(curLine) == 0 \
|
elif len(cur_line) == 0 \
|
||||||
or curLine == '\\':
|
or cur_line == '\\':
|
||||||
debug.extreme_verbose(" Line (Not parsed) : '" + curLine + "'");
|
debug.extreme_verbose(" Line (Not parsed) : '" + cur_line + "'");
|
||||||
else:
|
else:
|
||||||
testFile = curLine
|
test_file = cur_line
|
||||||
debug.extreme_verbose(" Line (might check) : '" + testFile + "'");
|
debug.extreme_verbose(" Line (might check) : '" + test_file + "'");
|
||||||
# really check files:
|
# really check files:
|
||||||
if testFile!="":
|
if test_file != "":
|
||||||
debug.extreme_verbose(" ==> test");
|
debug.extreme_verbose(" ==> test");
|
||||||
if False==os.path.exists(testFile):
|
if False==os.path.exists(test_file):
|
||||||
debug.extreme_verbose(" ==> must rebuild (a dependency file does not exist)")
|
debug.extreme_verbose(" ==> must rebuild (a dependency file does not exist)")
|
||||||
file.close()
|
file.close()
|
||||||
return True
|
return True
|
||||||
if os.path.getmtime(testFile) > os.path.getmtime(dst):
|
if os.path.getmtime(test_file) > os.path.getmtime(dst):
|
||||||
debug.extreme_verbose(" ==> must rebuild (a dependency file time is newer)")
|
debug.extreme_verbose(" ==> must rebuild (a dependency file time is newer)")
|
||||||
file.close()
|
file.close()
|
||||||
return True
|
return True
|
||||||
@ -121,7 +121,7 @@ def need_re_build(dst, src, dependFile=None, file_cmd="", cmdLine="", force_iden
|
|||||||
file.close()
|
file.close()
|
||||||
# check the 2 files are identical:
|
# check the 2 files are identical:
|
||||||
if force_identical == True:
|
if force_identical == True:
|
||||||
# check if the 2 cmdline are similar :
|
# check if the 2 cmd_line are similar :
|
||||||
size_src = _file_size(src)
|
size_src = _file_size(src)
|
||||||
size_dst = _file_size(dst)
|
size_dst = _file_size(dst)
|
||||||
if size_src != size_dst:
|
if size_src != size_dst:
|
||||||
@ -138,14 +138,27 @@ def need_re_build(dst, src, dependFile=None, file_cmd="", cmdLine="", force_iden
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
def need_re_package(dst, srcList, mustHaveSrc, file_cmd="", cmdLine=""):
|
def need_re_package(dst, src_list, must_have_src, file_cmd="", cmd_line=""):
|
||||||
debug.extreme_verbose("Resuest check of dependency of :")
|
debug.extreme_verbose("Request check of dependency of :")
|
||||||
debug.extreme_verbose(" dst='" + dst + "'")
|
debug.extreme_verbose(" dst='" + str(dst) + "'")
|
||||||
debug.extreme_verbose(" src()=")
|
compleate_list = []
|
||||||
for src in srcList:
|
debug.extreme_verbose(" src:")
|
||||||
debug.verbose(" '" + src + "'")
|
if type(src_list) == str:
|
||||||
|
compleate_list.append(src_list)
|
||||||
|
debug.extreme_verbose(" '" + src_list + "'")
|
||||||
|
elif type(src_list) == list:
|
||||||
|
for src in src_list:
|
||||||
|
compleate_list.append(src)
|
||||||
|
debug.extreme_verbose(" '" + str(src) + "'")
|
||||||
|
elif type(src_list) == dict:
|
||||||
|
for key in src_list:
|
||||||
|
debug.extreme_verbose(" '" + str(key) + "'")
|
||||||
|
for src in src_list[key]:
|
||||||
|
compleate_list.append(src)
|
||||||
|
debug.extreme_verbose(" '" + str(src) + "'")
|
||||||
|
|
||||||
if mustHaveSrc==False and len(srcList)==0:
|
if must_have_src == False \
|
||||||
|
and len(compleate_list) == 0:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# if force mode selected ==> just force rebuild ...
|
# if force mode selected ==> just force rebuild ...
|
||||||
@ -154,14 +167,14 @@ def need_re_package(dst, srcList, mustHaveSrc, file_cmd="", cmdLine=""):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
# check if the destination existed:
|
# check if the destination existed:
|
||||||
if False==os.path.exists(dst):
|
if os.path.exists(dst) == False:
|
||||||
debug.extreme_verbose(" ==> must re-package (dst does not exist)")
|
debug.extreme_verbose(" ==> must re-package (dst does not exist)")
|
||||||
return True
|
return True
|
||||||
# chek the basic date if the 2 files
|
# chek the basic date if the 2 files
|
||||||
if len(srcList)==0:
|
if len(compleate_list) == 0:
|
||||||
debug.extreme_verbose(" ==> must re-package (no source ???)")
|
debug.extreme_verbose(" ==> must re-package (no source ???)")
|
||||||
return True
|
return True
|
||||||
for src in srcList:
|
for src in compleate_list:
|
||||||
if os.path.getmtime(src) > os.path.getmtime(dst):
|
if os.path.getmtime(src) > os.path.getmtime(dst):
|
||||||
debug.extreme_verbose(" ==> must re-package (source time greater) : '" + src + "'")
|
debug.extreme_verbose(" ==> must re-package (source time greater) : '" + src + "'")
|
||||||
return True
|
return True
|
||||||
@ -170,13 +183,13 @@ def need_re_package(dst, srcList, mustHaveSrc, file_cmd="", cmdLine=""):
|
|||||||
if False==os.path.exists(file_cmd):
|
if False==os.path.exists(file_cmd):
|
||||||
debug.extreme_verbose(" ==> must rebuild (no commandLine file)")
|
debug.extreme_verbose(" ==> must rebuild (no commandLine file)")
|
||||||
return True
|
return True
|
||||||
# check if the 2 cmdline are similar :
|
# check if the 2 cmd_line are similar :
|
||||||
file2 = open(file_cmd, "r")
|
file2 = open(file_cmd, "r")
|
||||||
firstAndUniqueLine = file2.read()
|
first_and_unique_line = file2.read()
|
||||||
if firstAndUniqueLine != cmdLine:
|
if first_and_unique_line != cmd_line:
|
||||||
debug.extreme_verbose(" ==> must rebuild (cmdLines are not identical)")
|
debug.extreme_verbose(" ==> must rebuild (cmd_lines are not identical)")
|
||||||
debug.extreme_verbose(" ==> '" + cmdLine + "'")
|
debug.extreme_verbose(" ==> '" + cmd_line + "'")
|
||||||
debug.extreme_verbose(" ==> '" + firstAndUniqueLine + "'")
|
debug.extreme_verbose(" ==> '" + first_and_unique_line + "'")
|
||||||
file2.close()
|
file2.close()
|
||||||
return True
|
return True
|
||||||
# the cmdfile is correct ...
|
# the cmdfile is correct ...
|
||||||
|
@ -12,15 +12,15 @@ import copy
|
|||||||
from . import debug
|
from . import debug
|
||||||
|
|
||||||
|
|
||||||
def append_to_list(listout, list):
|
def append_to_list(list_out, elem):
|
||||||
if type(list) == type(str()):
|
if type(elem) == str:
|
||||||
if list not in listout:
|
if elem not in list_out:
|
||||||
listout.append(list)
|
list_out.append(elem)
|
||||||
else:
|
else:
|
||||||
# mulyiple imput in the list ...
|
# mulyiple imput in the list ...
|
||||||
for elem in list:
|
for element in elem:
|
||||||
if elem not in listout:
|
if element not in list_out:
|
||||||
listout.append(elem)
|
list_out.append(element)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -28,9 +28,11 @@ class HeritageList:
|
|||||||
def __init__(self, heritage = None):
|
def __init__(self, heritage = None):
|
||||||
self.flags = {}
|
self.flags = {}
|
||||||
# sources list:
|
# sources list:
|
||||||
self.src=[]
|
self.src = { 'src':[],
|
||||||
|
'dynamic':[],
|
||||||
|
'static':[]
|
||||||
|
}
|
||||||
self.path = {}
|
self.path = {}
|
||||||
|
|
||||||
self.list_heritage = []
|
self.list_heritage = []
|
||||||
if heritage != None:
|
if heritage != None:
|
||||||
self.add_heritage(heritage)
|
self.add_heritage(heritage)
|
||||||
@ -60,7 +62,10 @@ class HeritageList:
|
|||||||
def regenerate_tree(self):
|
def regenerate_tree(self):
|
||||||
self.flags = {}
|
self.flags = {}
|
||||||
# sources list:
|
# sources list:
|
||||||
self.src=[]
|
self.src = { 'src':[],
|
||||||
|
'dynamic':[],
|
||||||
|
'static':[]
|
||||||
|
}
|
||||||
self.path = {}
|
self.path = {}
|
||||||
# reorder heritage list :
|
# reorder heritage list :
|
||||||
listHeritage = self.list_heritage
|
listHeritage = self.list_heritage
|
||||||
@ -105,7 +110,9 @@ class HeritageList:
|
|||||||
self.path[ppp] = value
|
self.path[ppp] = value
|
||||||
else:
|
else:
|
||||||
append_to_list(self.path[ppp], value)
|
append_to_list(self.path[ppp], value)
|
||||||
append_to_list(self.src, element.src)
|
append_to_list(self.src['src'], element.src['src'])
|
||||||
|
append_to_list(self.src['dynamic'], element.src['dynamic'])
|
||||||
|
append_to_list(self.src['static'], element.src['static'])
|
||||||
if "c-version" in element.flags:
|
if "c-version" in element.flags:
|
||||||
ver = element.flags["c-version"]
|
ver = element.flags["c-version"]
|
||||||
if "c-version" in self.flags:
|
if "c-version" in self.flags:
|
||||||
@ -128,7 +135,10 @@ class heritage:
|
|||||||
# all the parameter that the upper classe need when build
|
# all the parameter that the upper classe need when build
|
||||||
self.flags = {}
|
self.flags = {}
|
||||||
# sources list:
|
# sources list:
|
||||||
self.src=[]
|
self.src = { 'src':[],
|
||||||
|
'dynamic':[],
|
||||||
|
'static':[]
|
||||||
|
}
|
||||||
self.path = {}
|
self.path = {}
|
||||||
# update is set at true when data are newly created ==> force upper element to update
|
# update is set at true when data are newly created ==> force upper element to update
|
||||||
self.hasBeenUpdated=False
|
self.hasBeenUpdated=False
|
||||||
@ -141,16 +151,32 @@ class heritage:
|
|||||||
self.flags = module.flags["export"]
|
self.flags = module.flags["export"]
|
||||||
self.path = module.path["export"]
|
self.path = module.path["export"]
|
||||||
|
|
||||||
def add_depends(self, depend):
|
def add_depends(self, elements):
|
||||||
self.depends.append(depend)
|
self.depends.append(elements)
|
||||||
|
|
||||||
def add_import_path(self, list):
|
def add_import_path(self, list):
|
||||||
append_to_list(self.path, list)
|
append_to_list(self.path, list)
|
||||||
|
|
||||||
def add_sources(self, list):
|
def add_sources(self, elements):
|
||||||
if type(list) == type(None):
|
if type(elements) == type(None):
|
||||||
debug.error("try add element none in a list ...")
|
debug.error("try add element none in a list ...")
|
||||||
append_to_list(self.src, list)
|
append_to_list(self.src['src'], elements)
|
||||||
|
|
||||||
|
def add_lib_static(self, elements):
|
||||||
|
if type(elements) == type(None):
|
||||||
|
debug.error("try add element none in a list ...")
|
||||||
|
append_to_list(self.src['static'], elements)
|
||||||
|
|
||||||
|
def add_lib_dynamic(self, elements):
|
||||||
|
if type(elements) == type(None):
|
||||||
|
debug.error("try add element none in a list ...")
|
||||||
|
append_to_list(self.src['dynamic'], elements)
|
||||||
|
|
||||||
|
def add_lib_interpreted(self, type_interpretation, elements):
|
||||||
|
debug.error("TODO ...")
|
||||||
|
if type(elements) == type(None):
|
||||||
|
debug.error("try add element none in a list ...")
|
||||||
|
append_to_list(self.src, elements)
|
||||||
|
|
||||||
def need_update(self, list):
|
def need_update(self, list):
|
||||||
self.hasBeenUpdated=True
|
self.hasBeenUpdated=True
|
||||||
|
@ -63,9 +63,10 @@ class Module:
|
|||||||
self.paths = []
|
self.paths = []
|
||||||
# The module has been already build ...
|
# The module has been already build ...
|
||||||
self.isbuild = False
|
self.isbuild = False
|
||||||
|
|
||||||
## end of basic INIT ...
|
## end of basic INIT ...
|
||||||
if moduleType == 'BINARY' \
|
if moduleType == 'BINARY' \
|
||||||
|
or moduleType == 'BINARY_SHARED' \
|
||||||
|
or moduleType == 'BINARY_STAND_ALONE' \
|
||||||
or moduleType == 'LIBRARY' \
|
or moduleType == 'LIBRARY' \
|
||||||
or moduleType == 'LIBRARY_DYNAMIC' \
|
or moduleType == 'LIBRARY_DYNAMIC' \
|
||||||
or moduleType == 'LIBRARY_STATIC' \
|
or moduleType == 'LIBRARY_STATIC' \
|
||||||
@ -316,8 +317,10 @@ class Module:
|
|||||||
self.local_heritage = heritage.heritage(self)
|
self.local_heritage = heritage.heritage(self)
|
||||||
|
|
||||||
if package_name==None \
|
if package_name==None \
|
||||||
and ( self.type=="BINARY" \
|
and ( self.type == 'BINARY'
|
||||||
or self.type=="PACKAGE" ) :
|
or self.type == 'BINARY_SHARED' \
|
||||||
|
or self.type == 'BINARY_STAND_ALONE' \
|
||||||
|
or self.type == 'PACKAGE' ) :
|
||||||
# this is the endpoint binary ...
|
# this is the endpoint binary ...
|
||||||
package_name = self.name
|
package_name = self.name
|
||||||
else:
|
else:
|
||||||
@ -362,7 +365,11 @@ class Module:
|
|||||||
if self.type=='LIBRARY_STATIC':
|
if self.type=='LIBRARY_STATIC':
|
||||||
debug.print_element("Library(static)", self.name, "", "")
|
debug.print_element("Library(static)", self.name, "", "")
|
||||||
if self.type=='BINARY':
|
if self.type=='BINARY':
|
||||||
debug.print_element("Binary", self.name, "", "")
|
debug.print_element("Binary(auto)", self.name, "", "")
|
||||||
|
if self.type=='BINARY_SHARED':
|
||||||
|
debug.print_element("Binary (shared)", self.name, "", "")
|
||||||
|
if self.type=='BINARY_STAND_ALONE':
|
||||||
|
debug.print_element("Binary (stand alone)", self.name, "", "")
|
||||||
if self.type=='PACKAGE':
|
if self.type=='PACKAGE':
|
||||||
debug.print_element("Package", self.name, "", "")
|
debug.print_element("Package", self.name, "", "")
|
||||||
# ----------------------------------------------------
|
# ----------------------------------------------------
|
||||||
@ -426,6 +433,7 @@ class Module:
|
|||||||
elif self.type == 'LIBRARY' \
|
elif self.type == 'LIBRARY' \
|
||||||
or self.type == 'LIBRARY_DYNAMIC' \
|
or self.type == 'LIBRARY_DYNAMIC' \
|
||||||
or self.type == 'LIBRARY_STATIC':
|
or self.type == 'LIBRARY_STATIC':
|
||||||
|
res_file_out = []
|
||||||
if self.type == 'LIBRARY' \
|
if self.type == 'LIBRARY' \
|
||||||
or self.type == 'LIBRARY_STATIC':
|
or self.type == 'LIBRARY_STATIC':
|
||||||
try:
|
try:
|
||||||
@ -438,7 +446,7 @@ class Module:
|
|||||||
self.sub_heritage_list,
|
self.sub_heritage_list,
|
||||||
name = self.name,
|
name = self.name,
|
||||||
basic_path = self.origin_path)
|
basic_path = self.origin_path)
|
||||||
self.local_heritage.add_sources(res_file)
|
self.local_heritage.add_lib_static(res_file)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
debug.error(" UN-SUPPORTED link format: '.a'")
|
debug.error(" UN-SUPPORTED link format: '.a'")
|
||||||
if self.type == 'LIBRARY' \
|
if self.type == 'LIBRARY' \
|
||||||
@ -453,7 +461,7 @@ class Module:
|
|||||||
self.sub_heritage_list,
|
self.sub_heritage_list,
|
||||||
name = self.name,
|
name = self.name,
|
||||||
basic_path = self.origin_path)
|
basic_path = self.origin_path)
|
||||||
# TODO : self.local_heritage.add_sources(res_file)
|
self.local_heritage.add_lib_dynamic(res_file)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
debug.error(" UN-SUPPORTED link format: '.so'/'.dynlib'/'.dll'")
|
debug.error(" UN-SUPPORTED link format: '.so'/'.dynlib'/'.dll'")
|
||||||
try:
|
try:
|
||||||
@ -466,18 +474,39 @@ class Module:
|
|||||||
self.sub_heritage_list,
|
self.sub_heritage_list,
|
||||||
name = self.name,
|
name = self.name,
|
||||||
basic_path = self.origin_path)
|
basic_path = self.origin_path)
|
||||||
self.local_heritage.add_sources(res_file)
|
self.local_heritage.add_lib_interpreted('java', 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' \
|
||||||
|
or self.type == 'BINARY_SHARED' \
|
||||||
|
or self.type == 'BINARY_STAND_ALONE':
|
||||||
try:
|
try:
|
||||||
tmp_builder = builder.get_builder_with_output("bin");
|
tmp_builder = builder.get_builder_with_output("bin");
|
||||||
|
parents = { 'src':[],
|
||||||
|
'dynamic':[],
|
||||||
|
'static':[]
|
||||||
|
}
|
||||||
|
parents_dynamic = []
|
||||||
|
parents_static = []
|
||||||
|
#extract libs ...
|
||||||
|
for elem in self.sub_heritage_list.src:
|
||||||
|
if elem[-len(target.suffix_lib_static):] == target.suffix_lib_static:
|
||||||
|
parents_static.append(elem)
|
||||||
|
elif elem[-len(target.suffix_lib_dynamic):] == target.suffix_lib_dynamic:
|
||||||
|
parents_dynamic.append(elem)
|
||||||
|
else:
|
||||||
|
parents['src'].append(elem)
|
||||||
|
|
||||||
|
static_mode = True
|
||||||
|
if self.type == 'BINARY_SHARED':
|
||||||
|
static_mode = False
|
||||||
res_file = 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,
|
||||||
name = self.name,
|
name = self.name,
|
||||||
basic_path = self.origin_path)
|
basic_path = self.origin_path,
|
||||||
|
static = static_mode)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
debug.error(" UN-SUPPORTED link format: '.bin'")
|
debug.error(" UN-SUPPORTED link format: '.bin'")
|
||||||
elif self.type == "PACKAGE":
|
elif self.type == "PACKAGE":
|
||||||
|
@ -79,6 +79,7 @@ class Target:
|
|||||||
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'
|
||||||
|
self.prefix_lib_dynamic='lib'
|
||||||
self.suffix_lib_dynamic='.so'
|
self.suffix_lib_dynamic='.so'
|
||||||
self.suffix_binary=''
|
self.suffix_binary=''
|
||||||
self.suffix_package='.deb'
|
self.suffix_package='.deb'
|
||||||
@ -280,7 +281,7 @@ class Target:
|
|||||||
list.append(os.path.join(self.get_build_path(binary_name), self.path_bin, module_name + self.suffix_binary + self.suffix_warning))
|
list.append(os.path.join(self.get_build_path(binary_name), self.path_bin, module_name + self.suffix_binary + self.suffix_warning))
|
||||||
elif (type=="lib-shared"):
|
elif (type=="lib-shared"):
|
||||||
list.append(file)
|
list.append(file)
|
||||||
list.append(os.path.join(self.get_build_path(module_name), self.path_lib, module_name + self.suffix_lib_dynamic))
|
list.append(os.path.join(self.get_build_path(module_name), self.path_lib, self.prefix_lib_dynamic + module_name + self.suffix_lib_dynamic))
|
||||||
list.append(os.path.join(self.get_build_path(module_name), self.path_lib, module_name + self.suffix_dependence))
|
list.append(os.path.join(self.get_build_path(module_name), self.path_lib, module_name + self.suffix_dependence))
|
||||||
list.append(os.path.join(self.get_build_path(module_name), self.path_lib, module_name + self.suffix_lib_dynamic + self.suffix_cmd_line))
|
list.append(os.path.join(self.get_build_path(module_name), self.path_lib, module_name + self.suffix_lib_dynamic + self.suffix_cmd_line))
|
||||||
list.append(os.path.join(self.get_build_path(module_name), self.path_lib, module_name + self.suffix_lib_dynamic + self.suffix_warning))
|
list.append(os.path.join(self.get_build_path(module_name), self.path_lib, module_name + self.suffix_lib_dynamic + self.suffix_warning))
|
||||||
|
@ -102,7 +102,7 @@ def copy_file(src, dst, cmd_file=None, force=False, force_identical=False):
|
|||||||
debug.error("Request a copy a file that does not existed : '" + src + "'")
|
debug.error("Request a copy a file that does not existed : '" + src + "'")
|
||||||
cmd_line = "copy \"" + src + "\" \"" + dst + "\""
|
cmd_line = "copy \"" + src + "\" \"" + dst + "\""
|
||||||
if force == False \
|
if force == False \
|
||||||
and depend.need_re_build(dst, src, file_cmd=cmd_file , cmdLine=cmd_line, force_identical=force_identical) == False:
|
and depend.need_re_build(dst, src, file_cmd=cmd_file , cmd_line=cmd_line, force_identical=force_identical) == False:
|
||||||
debug.verbose ("no need to copy ...")
|
debug.verbose ("no need to copy ...")
|
||||||
return
|
return
|
||||||
debug.print_element("copy file ", os.path.relpath(src), "==>", os.path.relpath(dst))
|
debug.print_element("copy file ", os.path.relpath(src), "==>", os.path.relpath(dst))
|
||||||
|
@ -40,9 +40,27 @@ 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_path):
|
def link(file, binary, target, depancy, name, basic_path, static = False):
|
||||||
file_src, file_dst, file_depend, file_cmd, file_warning = target.generate_file(binary, name, basic_path, file, "bin")
|
file_src, file_dst, file_depend, file_cmd, file_warning = target.generate_file(binary, name, basic_path, file, "bin")
|
||||||
#create comdLine :
|
debug.extreme_verbose("list files = " + str(depancy.src))
|
||||||
|
list_static = []
|
||||||
|
list_dynamic = []
|
||||||
|
if static == True:
|
||||||
|
#get all parent static libs
|
||||||
|
list_static = depancy.src['static']
|
||||||
|
# get only parent shared that is not static
|
||||||
|
for elem in depancy.src['dynamic']:
|
||||||
|
if elem[:-len(target.suffix_lib_dynamic)] + target.suffix_lib_static not in depancy.src['static']:
|
||||||
|
list_dynamic.append(elem)
|
||||||
|
else:
|
||||||
|
#get all parent dynamic libs
|
||||||
|
list_dynamic = depancy.src['dynamic']
|
||||||
|
# get only parent shared that is not static
|
||||||
|
for elem in depancy.src['static']:
|
||||||
|
if elem[:-len(target.suffix_lib_static)] + target.suffix_lib_dynamic not in depancy.src['dynamic']:
|
||||||
|
list_static.append(elem)
|
||||||
|
|
||||||
|
#create comand line:
|
||||||
cmd = [
|
cmd = [
|
||||||
target.xx
|
target.xx
|
||||||
]
|
]
|
||||||
@ -67,7 +85,20 @@ def link(file, binary, target, depancy, name, basic_path):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
cmd.append(depancy.src)
|
cmd.append(depancy.src['src'])
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
cmd.append(list_static)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
for elem in list_dynamic:
|
||||||
|
lib_path = os.path.dirname(elem)
|
||||||
|
lib_name = elem[len(lib_path)+len(target.prefix_lib_dynamic)+1:-len(target.suffix_lib_dynamic)]
|
||||||
|
cmd.append("-L" + lib_path)
|
||||||
|
cmd.append("-l" + lib_name)
|
||||||
|
#cmd.append(parents['dynamic'])
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
@ -82,27 +113,27 @@ def link(file, binary, target, depancy, name, basic_path):
|
|||||||
cmd.append(target.global_flags_ld)
|
cmd.append(target.global_flags_ld)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
cmdLine=tools.list_to_str(cmd)
|
cmd_line = tools.list_to_str(cmd)
|
||||||
# check the dependency for this file :
|
# check the dependency for this file :
|
||||||
if depend.need_re_package(file_dst, file_src, True, file_cmd, cmdLine) == False \
|
if depend.need_re_package(file_dst, file_src, True, file_cmd=file_cmd, cmd_line=cmd_line) == False \
|
||||||
and depend.need_re_package(file_dst, depancy.src, False, file_cmd, cmdLine) == False:
|
and depend.need_re_package(file_dst, depancy.src, False, file_cmd=file_cmd, cmd_line=cmd_line) == False:
|
||||||
return file_dst
|
return file_dst
|
||||||
tools.create_directory_of_file(file_dst)
|
tools.create_directory_of_file(file_dst)
|
||||||
debug.print_element("Executable", name, "==>", os.path.relpath(file_dst))
|
debug.print_element("Executable", name, "==>", os.path.relpath(file_dst))
|
||||||
|
|
||||||
multiprocess.run_command(cmdLine, store_output_file=file_warning)
|
multiprocess.run_command(cmd_line, 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
|
||||||
originSize = tools.file_size(file_dst);
|
originSize = tools.file_size(file_dst);
|
||||||
debug.print_element("Executable(strip)", name, "", "")
|
debug.print_element("Executable(strip)", name, "", "")
|
||||||
cmdLineStrip=tools.list_to_str([
|
cmd_lineStrip=tools.list_to_str([
|
||||||
target.strip,
|
target.strip,
|
||||||
file_dst])
|
file_dst])
|
||||||
multiprocess.run_command(cmdLineStrip, store_output_file=file_warning)
|
multiprocess.run_command(cmd_lineStrip, 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)
|
strip_size = 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(strip_size/1024) + "ko")
|
||||||
# write cmd line only after to prevent errors ...
|
# write cmd line only after to prevent errors ...
|
||||||
tools.store_command(cmdLine, file_cmd)
|
tools.store_command(cmd_line, file_cmd)
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ class Target(target.Target):
|
|||||||
tools.create_directory_of_file(target_outpath)
|
tools.create_directory_of_file(target_outpath)
|
||||||
|
|
||||||
## Create share datas
|
## Create share datas
|
||||||
target_outpath_data = os.path.join(target_outpath, "share")
|
target_outpath_data = os.path.join(target_outpath, "share", pkgName)
|
||||||
tools.create_directory_of_file(target_outpath_data)
|
tools.create_directory_of_file(target_outpath_data)
|
||||||
debug.debug("heritage for " + str(pkgName) + ":")
|
debug.debug("heritage for " + str(pkgName) + ":")
|
||||||
for heritage in heritage_list.list_heritage:
|
for heritage in heritage_list.list_heritage:
|
||||||
@ -139,6 +139,7 @@ class Target(target.Target):
|
|||||||
path_dst = os.path.join(target_outpath_bin, pkgName + self.suffix_binary)
|
path_dst = os.path.join(target_outpath_bin, pkgName + self.suffix_binary)
|
||||||
debug.warning("path_dst: " + str(path_dst))
|
debug.warning("path_dst: " + str(path_dst))
|
||||||
tools.copy_file(path_src, path_dst)
|
tools.copy_file(path_src, path_dst)
|
||||||
|
|
||||||
## Create libraries
|
## Create libraries
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user