Compare commits

..

29 Commits
1.2.0 ... 1.2.6

Author SHA1 Message Date
dc42a8e14b [RELEASE] new version 1.2.6 2016-09-02 21:39:18 +02:00
97f7566a7e [DEV] rework isaolated function to manage it in option 2016-09-02 21:39:18 +02:00
bf6fde3770 [RELEASE] new version 1.2.4 2016-08-31 23:49:11 +02:00
97db63bcfd [DEV] add based on element 2016-08-22 21:52:31 +02:00
43c7947b95 [DEBUG/DEV] correct copy of library data, add DATA type of a module 2016-08-22 22:37:47 +02:00
1c32b7089a [DEV] add empty element for Android board (not work ...) 2016-08-09 23:44:55 +02:00
760a589cbe [DEV] correct copy of generated files 2016-08-09 21:26:39 +02:00
d38ecf5432 [DEV] continue proper isolation of basic c and c++ libs 2016-08-09 21:09:26 +02:00
7e44373f79 [DEV] better isolation 2016-08-08 22:23:27 +02:00
3804de2078 [DEV] create an isolation in the include file in Linux...
now libc header is install in a specific directory
lib c++ header is install in a specific directory
idem for pthread, X11, openGL, m, ...
2016-08-07 22:42:05 +02:00
8fa25bb8ec [DEBUG] correct the android build dependency order' 2016-08-01 00:28:18 +02:00
beb97f4bed [DEV] add compilation of S and s file (asm) 2016-07-13 20:50:01 +02:00
47dcca5578 [DEV] install header before building project 2016-05-05 23:18:19 +02:00
dde9c9c280 [RELEASE] new version 1.2.3 2016-04-28 22:31:32 +02:00
598d301284 [DEBUG] correct gcov report 2016-04-14 21:57:56 +02:00
520f97c7f6 [RELEASE] create version 1.2.2 2016-04-10 13:39:36 +02:00
e4b69d17f4 [DEV] thik of coverage for clang 2016-04-01 21:35:42 +02:00
42be4afd0a [DEV] optimize build for linux and windows with no regeneration of package when not needed 2016-03-17 22:38:58 +01:00
1fa860e5b3 [DEBUG] set back target optimisation 2016-03-17 21:45:22 +01:00
87a4106101 [DEBUG] correct the compilation with wrong dependency include ==> remove target optimisation 2016-03-17 21:11:17 +01:00
1ec07b9446 [DEV] add multiple compilation requesting with xxx* (only work with * at the end) 2016-03-16 23:41:25 +01:00
5995effd9e [DEV] add specific subfolder in the file lutinParseSubFolders.txt 2016-03-16 23:41:25 +01:00
43c0ec2535 [DEBUG] correct android signing property 2016-03-07 22:09:23 +01:00
31fb9818ff [DEBUG/DEV] correct android build (gcc) and add force optimisation to build with -O3 in debug 2016-03-07 22:08:50 +01:00
83d7154254 [DEV] add base on target 2016-02-24 21:20:49 +01:00
55609b904c [DEBUG] clean and display log error 2016-02-23 21:55:32 +01:00
4beda0dd23 [DEBUG] correct the no line to execute 2016-02-23 21:49:03 +01:00
236f19bf36 [RELEASE] new release for bugFix 2016-02-23 21:43:37 +01:00
fe75da7ef9 [DEBUG] Missing type of string for python file 2016-02-23 21:40:24 +01:00
71 changed files with 1502 additions and 203 deletions

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##
@@ -10,6 +11,7 @@
# for path inspection: # for path inspection:
import sys import sys
import os import os
import copy
import lutin import lutin
import lutin.debug as debug import lutin.debug as debug
import lutin.arg as arguments import lutin.arg as arguments
@@ -33,7 +35,9 @@ myArgs.add(arguments.ArgDefine("P", "pretty", desc="Print the debug has pretty d
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("d", "depth", haveParam=True, desc="Depth of the search of sub element lutin_*.py (default=" + str(env.get_parse_depth()) + ")")) myArgs.add(arguments.ArgDefine("d", "depth", haveParam=True, desc="Depth of the search of sub element lutin_*.py (default=" + str(env.get_parse_depth()) + ")"))
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("o", "force-optimisation", desc="Force optimisation of the build"))
myArgs.add(arguments.ArgDefine("w", "warning", desc="Store warning in a file build file")) myArgs.add(arguments.ArgDefine("w", "warning", desc="Store warning in a file build file"))
myArgs.add(arguments.ArgDefine("i", "isolate-system", desc="Isolate system build (copy header of c and c++ system lib to not include unneeded external libs) EXPERIMENTAL (archlinux)"))
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'"))
@@ -152,6 +156,15 @@ def usage(full=False):
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")
exit(0) exit(0)
def check_boolean(value):
if value == "" \
or value == "1" \
or value == "true" \
or value == "True" \
or value == True:
return True
return False
# 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):
debug.extreme_verbose("parse arg : " + argument.get_option_name() + " " + argument.get_arg() + " active=" + str(active)) debug.extreme_verbose("parse arg : " + argument.get_option_name() + " " + argument.get_arg() + " active=" + str(active))
@@ -199,48 +212,49 @@ def parseGenericArg(argument, active):
return True return True
elif argument.get_option_name() == "color": elif argument.get_option_name() == "color":
if active==True: if active==True:
if argument.get_arg() == "" \ if check_boolean(argument.get_arg()) == True:
or argument.get_arg() == "1" \
or argument.get_arg() == "true" \
or argument.get_arg() == "True" \
or argument.get_arg() == True:
debug.enable_color() debug.enable_color()
else: else:
debug.disable_color() debug.disable_color()
return True return True
elif argument.get_option_name() == "force-build": elif argument.get_option_name() == "force-build":
if active==True: if active==True:
env.set_force_mode(True) if check_boolean(argument.get_arg()) == True:
env.set_force_mode(True)
else:
env.set_force_mode(False)
return True return True
elif argument.get_option_name() == "pretty": elif argument.get_option_name() == "pretty":
if active==True: if active==True:
if argument.get_arg() == "" \ if check_boolean(argument.get_arg()) == True:
or argument.get_arg() == "1" \
or argument.get_arg() == "true" \
or argument.get_arg() == "True" \
or argument.get_arg() == True:
env.set_print_pretty_mode(True) env.set_print_pretty_mode(True)
else: else:
env.set_print_pretty_mode(False) env.set_print_pretty_mode(False)
return True return True
elif argument.get_option_name() == "force-optimisation":
if active==True:
if check_boolean(argument.get_arg()) == True:
env.set_force_optimisation(True)
else:
env.set_force_optimisation(False)
return True
elif argument.get_option_name() == "isolate-system":
if active==True:
if check_boolean(argument.get_arg()) == True:
env.set_isolate_system(True)
else:
env.set_isolate_system(False)
return True
elif argument.get_option_name() == "force-strip": elif argument.get_option_name() == "force-strip":
if active==True: if active==True:
if argument.get_arg() == "" \ if check_boolean(argument.get_arg()) == True:
or argument.get_arg() == "1" \
or argument.get_arg() == "true" \
or argument.get_arg() == "True" \
or argument.get_arg() == True:
env.set_force_strip_mode(True) env.set_force_strip_mode(True)
else: else:
env.set_force_strip_mode(False) env.set_force_strip_mode(False)
return True return True
elif argument.get_option_name() == "warning": elif argument.get_option_name() == "warning":
if active==True: if active==True:
if argument.get_arg() == "" \ if check_boolean(argument.get_arg()) == True:
or argument.get_arg() == "1" \
or argument.get_arg() == "true" \
or argument.get_arg() == "True" \
or argument.get_arg() == True:
env.set_warning_mode(True) env.set_warning_mode(True)
else: else:
env.set_warning_mode(False) env.set_warning_mode(False)
@@ -256,10 +270,12 @@ if os.path.isfile(config_file) == True:
debug.debug("Find basic configuration file: '" + config_file + "'") debug.debug("Find basic configuration file: '" + config_file + "'")
# the file exist, we can open it and get the initial configuration: # the file exist, we can open it and get the initial configuration:
configuration_file = __import__(config_file_name[:-3]) configuration_file = __import__(config_file_name[:-3])
if "get_exclude_path" in dir(configuration_file): if "get_exclude_path" in dir(configuration_file):
data = configuration_file.get_exclude_path() data = configuration_file.get_exclude_path()
debug.debug(" get default config 'get_exclude_path' val='" + str(data) + "'") debug.debug(" get default config 'get_exclude_path' val='" + str(data) + "'")
env.set_exclude_search_path(data) env.set_exclude_search_path(data)
if "get_parsing_depth" in dir(configuration_file): if "get_parsing_depth" in dir(configuration_file):
data = configuration_file.get_parsing_depth() data = configuration_file.get_parsing_depth()
debug.debug(" get default config 'get_parsing_depth' val='" + str(data) + "'") debug.debug(" get default config 'get_parsing_depth' val='" + str(data) + "'")
@@ -285,6 +301,16 @@ if os.path.isfile(config_file) == True:
debug.debug(" get default config 'get_default_print_pretty' val='" + str(data) + "'") debug.debug(" get default config 'get_default_print_pretty' val='" + str(data) + "'")
parseGenericArg(arguments.ArgElement("pretty", str(data)), True) parseGenericArg(arguments.ArgElement("pretty", str(data)), True)
if "get_default_force_optimisation" in dir(configuration_file):
data = configuration_file.get_default_force_optimisation()
debug.debug(" get default config 'get_default_force_optimisation' val='" + str(data) + "'")
parseGenericArg(arguments.ArgElement("force-optimisation", str(data)), True)
if "get_default_isolate_system" in dir(configuration_file):
data = configuration_file.get_default_isolate_system()
debug.debug(" get default config 'get_default_isolate_system' val='" + str(data) + "'")
parseGenericArg(arguments.ArgElement("isolate-system", str(data)), True)
# parse default unique argument: # parse default unique argument:
@@ -356,14 +382,34 @@ for argument in localArgument:
#remove previous target #remove previous target
my_target = None my_target = None
else: else:
argument_value = argument.get_arg()
debug.debug("something request : '" + argument_value + "'")
if argument.get_option_name() != "": if argument.get_option_name() != "":
debug.warning("Can not understand argument : '" + argument.get_option_name() + "'") debug.warning("Can not understand argument : '" + argument.get_option_name() + "'")
usage() usage()
break;
name2 = argument_value.replace("@", "?")
gettedElement = name2.split("?")
module_name = gettedElement[0]
action_list = gettedElement[1:]
if len(action_list) == 0:
action_list = "build"
debug.debug("requested: '" + module_name + "' ? actions:'" + str(action_list) + "'")
multiple_module_list = []
if module_name[-1] == "*":
base_name = module_name[:-1]
for mod in module.list_all_module():
if mod[:len(base_name)] == base_name:
debug.verbose("need do it for: " + mod);
multiple_module_list.append(mod)
else: else:
multiple_module_list.append(module_name)
debug.debug("Will do: '" + str(multiple_module_list) + "' ? actions:'" + str(action_list) + "'")
for module_name in multiple_module_list:
#load the target if needed : #load the target if needed :
if my_target == None: if my_target == None:
my_target = target.load_target(targetName, config) my_target = target.load_target(targetName, copy.deepcopy(config))
my_target.build(argument.get_arg()) my_target.build(module_name, actions=action_list)
actionDone=True actionDone=True
# if no action done : we do "all" ... # if no action done : we do "all" ...

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##
@@ -70,8 +71,26 @@ def import_path_local(path, limit_sub_folder, exclude_path = [], base_name = "")
# check if the file "lutin_parse_sub.py" is present ==> parse SubFolder (force and add +1 in the resursing # check if the file "lutin_parse_sub.py" is present ==> parse SubFolder (force and add +1 in the resursing
if base_name + "ParseSubFolders.txt" in list_files: if base_name + "ParseSubFolders.txt" in list_files:
debug.debug("find SubParser ... " + str(base_name + "ParseSubFolders.txt") + " " + path) debug.debug("find SubParser ... " + str(base_name + "ParseSubFolders.txt") + " " + path)
need_parse_sub_folder = True data_file_sub = tools.file_read_data(os.path.join(path, base_name + "ParseSubFolders.txt"))
rm_value = 0 if data_file_sub == "":
debug.debug(" Empty file Load all subfolder in the worktree in '" + str(path) + "'")
need_parse_sub_folder = True
rm_value = 0
else:
list_sub = data_file_sub.split("\n")
debug.debug(" Parse selected folders " + str(list_sub) + " no parse local folder directory")
need_parse_sub_folder = False
for folder in list_sub:
if folder == "" \
or folder == "/":
continue;
tmp_out = import_path_local(os.path.join(path, folder),
1,
exclude_path,
base_name)
# add all the elements:
for elem in tmp_out:
out.append(elem)
if need_parse_sub_folder == True: if need_parse_sub_folder == True:
list_folders = filter_path(path, list_files) list_folders = filter_path(path, list_files)
for folder in list_folders: for folder in list_folders:

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##
@@ -25,6 +26,32 @@ def get_force_mode():
global force_mode global force_mode
return force_mode return force_mode
force_optimisation=False
def set_force_optimisation(val):
global force_optimisation
if val==1:
force_optimisation = 1
else:
force_optimisation = 0
def get_force_optimisation():
global force_optimisation
return force_optimisation
isolate_system=False
def set_isolate_system(val):
global isolate_system
if val==1:
isolate_system = 1
else:
isolate_system = 0
def get_isolate_system():
global isolate_system
return isolate_system
parse_depth = 9999999 parse_depth = 9999999
def set_parse_depth(val): def set_parse_depth(val):
@@ -115,6 +142,19 @@ def print_pretty(my_string, force=False):
"-classpath", "-classpath",
"-sourcepath" "-sourcepath"
] ]
elif end_with(cmdApplication, ["java"]) == True:
baseElementList = [
"-z",
"-f",
"-rf"
]
elif end_with(cmdApplication, ["jarsigner"]) == True:
baseElementList = [
"-sigalg",
"-digestalg",
"-storepass",
"-keypass"
]
elif end_with(cmdApplication, ["jar"]) == True: elif end_with(cmdApplication, ["jar"]) == True:
baseElementList = [ baseElementList = [
"cf", "cf",

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##
@@ -15,12 +16,12 @@ from . import debug
def append_to_list(list_out, elem): def append_to_list(list_out, elem):
if type(elem) == str: if type(elem) == str:
if elem not in list_out: if elem not in list_out:
list_out.append(elem) list_out.append(copy.deepcopy(elem))
else: else:
# mulyiple imput in the list ... # mulyiple imput in the list ...
for element in elem: for element in elem:
if element not in list_out: if element not in list_out:
list_out.append(element) list_out.append(copy.deepcopy(element))
@@ -60,6 +61,7 @@ class HeritageList:
self.regenerate_tree() self.regenerate_tree()
def regenerate_tree(self): def regenerate_tree(self):
debug.verbose("Regenerate heritage list:")
self.flags = {} self.flags = {}
# sources list: # sources list:
self.src = { 'src':[], self.src = { 'src':[],
@@ -71,30 +73,37 @@ class HeritageList:
listHeritage = self.list_heritage listHeritage = self.list_heritage
self.list_heritage = [] self.list_heritage = []
# first step : add all lib with no dependency: # first step : add all lib with no dependency:
debug.extreme_verbose(" add element with no dependency:")
for herit in listHeritage: for herit in listHeritage:
if len(herit.depends) == 0: if len(herit.depends) == 0:
self.list_heritage.append(herit) debug.extreme_verbose(" add: " + str(herit.name))
self.list_heritage.append(copy.deepcopy(herit))
listHeritage.remove(herit) listHeritage.remove(herit)
debug.extreme_verbose(" add element with dependency:")
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]))
debug.extreme_verbose(" list heritage (rest):")
for tmppp_herit in listHeritage:
debug.extreme_verbose(" elem= " + str(tmppp_herit.name) + " : " + str(tmppp_herit.depends))
# 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.list_heritage] 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:
debug.extreme_verbose(" add: " + str(herit.name))
listHeritage.remove(herit) listHeritage.remove(herit)
self.list_heritage.append(herit) self.list_heritage.append(copy.deepcopy(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.list_heritage.append(herit) self.list_heritage.append(copy.deepcopy(herit))
listHeritage = [] listHeritage = []
debug.warning("new heritage list:") debug.warning("new heritage list:")
for element in self.list_heritage: 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.extreme_verbose("new heritage list:")
for element in self.list_heritage: for element in self.list_heritage:
debug.verbose(" " + element.name + " " + str(element.depends)) debug.extreme_verbose(" " + element.name + " " + str(element.depends))
for element in reversed(self.list_heritage): for element in reversed(self.list_heritage):
for flags in element.flags: for flags in element.flags:
# get value # get value
@@ -121,15 +130,26 @@ class HeritageList:
# keep only true, if false ==> bad case ... # keep only true, if false ==> bad case ...
if self.flags[flags] < value: if self.flags[flags] < value:
self.flags[flags] = value self.flags[flags] = value
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'])
for element in self.list_heritage:
debug.extreme_verbose(" elem: " + str(element.name))
debug.extreme_verbose(" Path (base): " + str(self.path))
debug.extreme_verbose(" inside: " + str(element.path))
for ppp in element.path: for ppp in element.path:
value = element.path[ppp] value = copy.deepcopy(element.path[ppp])
if ppp not in self.path: if ppp not in self.path:
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['src'], element.src['src']) debug.extreme_verbose("Path : " + str(self.path))
append_to_list(self.src['dynamic'], element.src['dynamic']) for ppp in self.path:
append_to_list(self.src['static'], element.src['static']) tmp = self.path[ppp]
self.path[ppp] = []
for iii in reversed(tmp):
self.path[ppp].append(iii)
debug.extreme_verbose("Path : " + str(self.path))
def __repr__(self): def __repr__(self):
return "{HeritageList:" + str(self.list_heritage) + "}" return "{HeritageList:" + str(self.list_heritage) + "}"
@@ -156,8 +176,8 @@ class heritage:
self.name = module.name self.name = module.name
self.depends = copy.deepcopy(module.depends) self.depends = copy.deepcopy(module.depends)
# keep reference because the flags can change in time # keep reference because the flags can change in time
self.flags = module.flags["export"] self.flags = module.flags["export"] # have no deep copy here is a feature ...
self.path = module.path["export"] self.path = copy.deepcopy(module.path["export"])
# if the user install some header ==> they will ba autoamaticaly exported ... # if the user install some header ==> they will ba autoamaticaly exported ...
if target != None: if target != None:
if len(module.header) > 0: if len(module.header) > 0:
@@ -209,7 +229,7 @@ class heritage:
for flags in other.flags: for flags in other.flags:
value = other.flags[flags] value = other.flags[flags]
if flags not in self.flags: if flags not in self.flags:
self.flags[flags] = value self.flags[flags] = copy.deepcopy(value)
else: else:
append_to_list(self.flags[flags], value) append_to_list(self.flags[flags], value)
self.add_import_path(other.path) self.add_import_path(other.path)

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##
@@ -9,6 +10,7 @@
import sys import sys
import os import os
import copy
import inspect import inspect
import fnmatch import fnmatch
# Local import # Local import
@@ -76,7 +78,8 @@ class Module:
or moduleType == 'LIBRARY_DYNAMIC' \ or moduleType == 'LIBRARY_DYNAMIC' \
or moduleType == 'LIBRARY_STATIC' \ or moduleType == 'LIBRARY_STATIC' \
or moduleType == 'PACKAGE' \ or moduleType == 'PACKAGE' \
or moduleType == 'PREBUILD': or moduleType == 'PREBUILD' \
or moduleType == 'DATA':
self.type=moduleType self.type=moduleType
else : else :
debug.error('for module "%s"' %module_name) debug.error('for module "%s"' %module_name)
@@ -103,7 +106,8 @@ class Module:
"ANDROID_WALLPAPER_PROPERTIES" : [], # To create properties of the wallpaper (no use of EWOL display) "ANDROID_WALLPAPER_PROPERTIES" : [], # To create properties of the wallpaper (no use of EWOL display)
"RIGHT" : [], "RIGHT" : [],
"LICENSE" : "", # by default: no license "LICENSE" : "", # by default: no license
"ADMOD_POSITION" : "top" "ADMOD_POSITION" : "top",
"ANDROID_SIGN" : "no_file.jks"
} }
self.package_prop_default = { "COMPAGNY_TYPE" : True, self.package_prop_default = { "COMPAGNY_TYPE" : True,
"COMPAGNY_NAME" : True, "COMPAGNY_NAME" : True,
@@ -122,9 +126,11 @@ class Module:
"ANDROID_WALLPAPER_PROPERTIES" : True, "ANDROID_WALLPAPER_PROPERTIES" : True,
"RIGHT" : True, "RIGHT" : True,
"LICENSE" : True, "LICENSE" : True,
"ADMOD_POSITION" : True "ADMOD_POSITION" : True,
"ANDROID_SIGN" : True
} }
self.sub_heritage_list = None self.sub_heritage_list = None
self.generate_file = []
def __repr__(self): def __repr__(self):
return "{lutin.Module:" + str(self.name) + "}" return "{lutin.Module:" + str(self.name) + "}"
@@ -162,8 +168,9 @@ class Module:
## ##
## @brief Send image in the build data directory ## @brief Send image in the build data directory
## @param[in] target Target object ## @param[in] target Target object
## @param[in] copy_list When copy file, this API permit to remove unneeded files
## ##
def image_to_build(self, target): def image_to_build(self, target, copy_list):
for source, destination, sizeX, sizeY in self.image_to_copy: for source, destination, sizeX, sizeY in self.image_to_copy:
extension = source[source.rfind('.'):] extension = source[source.rfind('.'):]
if extension != ".png" \ if extension != ".png" \
@@ -183,13 +190,17 @@ class Module:
image.resize(source, os.path.join(target.get_build_path_data(self.name), destination), sizeX, sizeY, file_cmd) image.resize(source, os.path.join(target.get_build_path_data(self.name), destination), sizeX, sizeY, file_cmd)
else: else:
debug.verbose("Might copy file : " + display_source + " ==> " + destination) debug.verbose("Might copy file : " + display_source + " ==> " + destination)
tools.copy_file(source, os.path.join(target.get_build_path_data(self.name), destination), file_cmd) tools.copy_file(source,
os.path.join(target.get_build_path_data(self.name), destination),
file_cmd,
in_list=copy_list)
## ##
## @brief Send files in the build data directory ## @brief Send files in the build data directory
## @param[in] target Target object ## @param[in] target Target object
## @param[in] copy_list When copy file, this API permit to remove unneeded files
## ##
def files_to_build(self, target): def files_to_build(self, target, copy_list):
for source, destination in self.files: for source, destination in self.files:
display_source = source display_source = source
source = os.path.join(self.origin_path, source) source = os.path.join(self.origin_path, source)
@@ -199,13 +210,17 @@ class Module:
# TODO : set it back : file_cmd = target.get_build_path_data(self.name) # TODO : set it back : file_cmd = target.get_build_path_data(self.name)
file_cmd = "" file_cmd = ""
debug.verbose("Might copy file : " + display_source + " ==> " + destination) debug.verbose("Might copy file : " + display_source + " ==> " + destination)
tools.copy_file(source, os.path.join(target.get_build_path_data(self.name), destination), file_cmd) tools.copy_file(source,
os.path.join(target.get_build_path_data(self.name), destination),
force_identical=True,
in_list=copy_list)
## ##
## @brief Send compleate folder in the build data directory ## @brief Send compleate folder in the build data directory
## @param[in] target Target object ## @param[in] target Target object
## @param[in] copy_list When copy file, this API permit to remove unneeded files
## ##
def paths_to_build(self, target): def paths_to_build(self, target, copy_list):
for source, destination in self.paths: for source, destination in self.paths:
debug.debug("Might copy path : " + source + "==>" + destination) debug.debug("Might copy path : " + source + "==>" + destination)
tmp_path = os.path.dirname(os.path.realpath(os.path.join(self.origin_path, source))) tmp_path = os.path.dirname(os.path.realpath(os.path.join(self.origin_path, source)))
@@ -228,7 +243,10 @@ class Module:
# new_destination = os.path.join(new_destination, root[len(source)-1:]) # new_destination = os.path.join(new_destination, root[len(source)-1:])
debug.verbose("Might copy : '" + os.path.join(root, cycle_file) + "' ==> '" + os.path.join(target.get_build_path_data(self.name), new_destination, cycle_file) + "'" ) debug.verbose("Might copy : '" + os.path.join(root, cycle_file) + "' ==> '" + os.path.join(target.get_build_path_data(self.name), new_destination, cycle_file) + "'" )
file_cmd = "" # TODO : ... file_cmd = "" # TODO : ...
tools.copy_file(os.path.join(root, cycle_file), os.path.join(target.get_build_path_data(self.name), new_destination, cycle_file), file_cmd) tools.copy_file(os.path.join(root, cycle_file),
os.path.join(target.get_build_path_data(self.name), new_destination, cycle_file),
file_cmd,
in_list=copy_list)
@@ -314,7 +332,8 @@ class Module:
debug.verbose(" REMOVE: '" + str(elem[6:len(self.origin_path)+1]) + "' not in " + str(gcov_path_file)) debug.verbose(" REMOVE: '" + str(elem[6:len(self.origin_path)+1]) + "' not in " + str(gcov_path_file))
continue continue
continue continue
if elem[:7] == "Aucune ": if elem[:7] == "Aucune " \
or elem[:19] == "No executable lines":
debug.verbose(" Nothing to execute"); debug.verbose(" Nothing to execute");
continue continue
start_with = ["Lines executed:", "Lignes exécutées:"] start_with = ["Lines executed:", "Lignes exécutées:"]
@@ -322,8 +341,9 @@ class Module:
for line_base in start_with: for line_base in start_with:
if elem[:len(line_base)] == line_base: if elem[:len(line_base)] == line_base:
find = True find = True
elem = elem[len(line_base)+1:] elem = elem[len(line_base):]
break; break;
debug.verbose(" temp Value: " + str(elem))
if find == False: if find == False:
debug.warning(" gcov ret : " + str(elem)); debug.warning(" gcov ret : " + str(elem));
debug.warning(" ==> does not start with : " + str(start_with)); debug.warning(" ==> does not start with : " + str(start_with));
@@ -370,6 +390,7 @@ class Module:
debug.info(" % " + str(elem[1]) + "\r\t\t" + str(elem[0])); debug.info(" % " + str(elem[1]) + "\r\t\t" + str(elem[0]));
else: else:
debug.info(" % " + str(elem[1]) + "\r\t\t" + str(elem[0])); debug.info(" % " + str(elem[1]) + "\r\t\t" + str(elem[0]));
debug.verbose(" " + str(elem[2]) + " / " + str(elem[3]));
try: try:
pourcent = 100.0*float(executed_lines)/float(executable_lines) pourcent = 100.0*float(executed_lines)/float(executable_lines)
except ZeroDivisionError: except ZeroDivisionError:
@@ -409,7 +430,8 @@ class Module:
if target.is_module_build(self.name) == True: if target.is_module_build(self.name) == True:
if self.sub_heritage_list == None: if self.sub_heritage_list == None:
self.local_heritage = heritage.heritage(self, target) self.local_heritage = heritage.heritage(self, target)
return self.sub_heritage_list debug.warning("plop " + str(self.local_heritage));
return copy.deepcopy(self.sub_heritage_list)
# create the package heritage # create the package heritage
self.local_heritage = heritage.heritage(self, target) self.local_heritage = heritage.heritage(self, target)
@@ -427,6 +449,7 @@ class Module:
self.sub_heritage_list = heritage.HeritageList() self.sub_heritage_list = heritage.HeritageList()
# optionnal dependency : # optionnal dependency :
for dep, option, export in self.depends_optionnal: for dep, option, export in self.depends_optionnal:
debug.verbose("try find optionnal dependency: '" + str(dep) + "'")
inherit_list, isBuilt = target.build(dep, package_name, True) inherit_list, isBuilt = target.build(dep, package_name, True)
if isBuilt == True: if isBuilt == True:
self.local_heritage.add_depends(dep); self.local_heritage.add_depends(dep);
@@ -463,7 +486,9 @@ class Module:
# -- Generic library help -- # -- Generic library help --
# ---------------------------------------------------- # ----------------------------------------------------
package_version_string = tools.version_to_string(self.package_prop["VERSION"]); package_version_string = tools.version_to_string(self.package_prop["VERSION"]);
if self.type == 'PREBUILD': if self.type == 'DATA':
debug.print_element("Data", self.name, "-", package_version_string)
elif self.type == 'PREBUILD':
debug.print_element("Prebuild", self.name, "-", package_version_string) debug.print_element("Prebuild", self.name, "-", package_version_string)
elif self.type == 'LIBRARY': elif self.type == 'LIBRARY':
debug.print_element("Library", self.name, "-", package_version_string) debug.print_element("Library", self.name, "-", package_version_string)
@@ -479,9 +504,59 @@ class Module:
debug.print_element("Binary (stand alone)", self.name, "-", package_version_string) debug.print_element("Binary (stand alone)", self.name, "-", package_version_string)
elif self.type == 'PACKAGE': elif self.type == 'PACKAGE':
debug.print_element("Package", self.name, "-", package_version_string) debug.print_element("Package", self.name, "-", package_version_string)
# ----------------------------------------------------
# -- Sources compilation -- # list of all file to copy:
# ---------------------------------------------------- copy_list={}
# ---------------------------------------------------------------------------
# -- install header (generated header files) --
# ---------------------------------------------------------------------------
generate_path = target.get_build_path_temporary_generate(self.name)
include_path = target.get_build_path_include(self.name)
have_only_generate_file = False
if len(self.generate_file) > 0:
debug.debug("install GENERATED headers ...")
for elem_generate in self.generate_file:
ret_write = tools.file_write_data(os.path.join(generate_path, elem_generate["filename"]), elem_generate["data"], only_if_new=True)
if ret_write == True:
debug.print_element("generate", self.name, "##", elem_generate["filename"])
dst = os.path.join(include_path, elem_generate["filename"])
copy_list[dst] = {"src":os.path.join(generate_path, elem_generate["filename"]),
"cmd_file":None,
"need_copy":ret_write}
if elem_generate["install"] == True:
have_only_generate_file = True
if have_only_generate_file == True:
self.add_path(generate_path)
# ---------------------------------------------------------------------------
# -- install header (do it first for extern lib and gcov better interface) --
# ---------------------------------------------------------------------------
debug.debug("install headers ...")
for file in self.header:
src_path = os.path.join(self.origin_path, file["src"])
if "multi-dst" in file:
dst_path = os.path.join(include_path, file["multi-dst"])
tools.copy_anything(src_path,
dst_path,
recursive=file["recursive"],
force_identical=True,
in_list=copy_list)
else:
dst_path = os.path.join(include_path, file["dst"])
tools.copy_file(src_path,
dst_path,
force_identical=True,
in_list=copy_list)
#real copy files
tools.copy_list(copy_list)
# remove unneded files (NOT folder ...)
tools.clean_directory(include_path, copy_list)
# add the pat to the usable dirrectory
self.add_path(include_path)
# ---------------------------------------------------------------------------
# -- Sources compilation --
# ---------------------------------------------------------------------------
if self.type != 'PREBUILD': if self.type != 'PREBUILD':
# build local sources in a specific order: # build local sources in a specific order:
for extention_local in self.extention_order_build: for extention_local in self.extention_order_build:
@@ -544,6 +619,7 @@ class Module:
debug.warning(" UN-SUPPORTED file format: '" + self.origin_path + "/" + file + "'") debug.warning(" UN-SUPPORTED file format: '" + self.origin_path + "/" + file + "'")
# when multiprocess availlable, we need to synchronize here ... # when multiprocess availlable, we need to synchronize here ...
multiprocess.pool_synchrosize() multiprocess.pool_synchrosize()
# ---------------------------------------------------- # ----------------------------------------------------
# -- Generation point -- # -- Generation point --
# ---------------------------------------------------- # ----------------------------------------------------
@@ -701,43 +777,23 @@ class Module:
basic_path = self.origin_path) basic_path = self.origin_path)
except ValueError: except ValueError:
debug.error(" UN-SUPPORTED link format: 'binary'") debug.error(" UN-SUPPORTED link format: 'binary'")
elif self.type == "DATA":
debug.debug("Data package have noting to build... just install")
else: else:
debug.error("Did not known the element type ... (impossible case) type=" + self.type) debug.error("Did not known the element type ... (impossible case) type=" + self.type)
# ----------------------------------------------------
# -- install header --
# ----------------------------------------------------
debug.debug("install headers ...")
copy_list={}
include_path = target.get_build_path_include(self.name)
for file in self.header:
src_path = os.path.join(self.origin_path, file["src"])
if "multi-dst" in file:
dst_path = os.path.join(include_path, file["multi-dst"])
tools.copy_anything(src_path,
dst_path,
recursive=False,
force_identical=True,
in_list=copy_list)
else:
dst_path = os.path.join(include_path, file["dst"])
tools.copy_file(src_path,
dst_path,
force_identical=True,
in_list=copy_list)
#real copy files
tools.copy_list(copy_list)
# remove unneded files (NOT folder ...)
tools.clean_directory(include_path, copy_list)
# ---------------------------------------------------- # ----------------------------------------------------
# -- install data -- # -- install data --
# ---------------------------------------------------- # ----------------------------------------------------
debug.debug("install datas") debug.debug("install datas")
self.image_to_build(target) copy_list={}
self.files_to_build(target) self.image_to_build(target, copy_list) # TODO : When file is resized, the final file is not removed if the file is not needed anymore
self.paths_to_build(target) self.files_to_build(target, copy_list)
# TODO : do sothing that create a list of file set in this directory and remove it if necessary ... ==> if not needed anymore ... self.paths_to_build(target, copy_list)
#real copy files
tools.copy_list(copy_list)
# remove unneded files (NOT folder ...)
tools.clean_directory(target.get_build_path_data(self.name), copy_list)
# create local heritage specification # create local heritage specification
self.local_heritage.auto_add_build_header() self.local_heritage.auto_add_build_header()
@@ -757,13 +813,14 @@ class Module:
target.make_package(self.name, self.package_prop, os.path.join(self.origin_path, ".."), self.sub_heritage_list) target.make_package(self.name, self.package_prop, os.path.join(self.origin_path, ".."), self.sub_heritage_list)
# return local dependency ... # return local dependency ...
return self.sub_heritage_list return copy.deepcopy(self.sub_heritage_list)
# call here to clean the module # call here to clean the module
def clean(self, target): def clean(self, target):
if self.type=='PREBUILD': if self.type=='PREBUILD':
# nothing to add ==> just dependence # nothing to add ==> just dependence
None None
return True
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':
@@ -771,6 +828,7 @@ class Module:
pathbuild = target.get_build_path(self.name) pathbuild = target.get_build_path(self.name)
debug.info("remove path : '" + pathbuild + "'") debug.info("remove path : '" + pathbuild + "'")
tools.remove_path_and_sub_path(pathbuild) tools.remove_path_and_sub_path(pathbuild)
return True
elif self.type=='BINARY' \ elif self.type=='BINARY' \
or self.type=='PACKAGE': or self.type=='PACKAGE':
# remove path of the lib ... for this targer # remove path of the lib ... for this targer
@@ -780,6 +838,7 @@ class Module:
pathStaging = target.get_staging_path(self.name) pathStaging = target.get_staging_path(self.name)
debug.info("remove path : '" + pathStaging + "'") debug.info("remove path : '" + pathStaging + "'")
tools.remove_path_and_sub_path(pathStaging) tools.remove_path_and_sub_path(pathStaging)
return True
else: else:
debug.error("Dit not know the element type ... (impossible case) type=" + self.type) debug.error("Dit not know the element type ... (impossible case) type=" + self.type)
@@ -839,25 +898,117 @@ class Module:
def add_src_file(self, list): def add_src_file(self, list):
tools.list_append_to(self.src, list, True) tools.list_append_to(self.src, list, True)
##
def add_header_file(self, list, destination_path=None): ## @brief An an header file in the install directory
## @param[in] list List of element that is needed to install (can be a list or a simple string)
## @param[in,optional] destination_path Path to install the files (remove all the path of the file)
## @param[in,optional] clip_path Remove a part of the path set in the list and install data in generic include path
## @param[in,optional] recursive when use regexp in file list ==> we can add recursive property
##
## @code
## my_module.add_header_file([
## 'include/ewol/widget.h',
## 'include/ewol/context/context.h',
## ])
## @endcode
## Here the user need to acces to the file wrote: #include <include/ewol/cotext/context.h>
##
## We can simplify it:
## @code
## my_module.add_header_file([
## 'include/ewol/widget.h',
## 'include/ewol/context/context.h',
## ],
## destination_path='ewol')
## @endcode
## Here the user need to acces to the file wrote: #include <ewol/context.h> ==> the internal path has been removed
##
## An other way is:
## @code
## my_module.add_header_file([
## 'include/ewol/widget.h',
## 'include/ewol/context/context.h',
## ],
## clip_path='include')
## @endcode
## Here the user need to acces to the file wrote: #include <ewol/context/context.h> ==> it just remove the include data
##
## With a copy all methode:
## @code
## my_module.add_header_file(
## 'include/*.h',
## recursive=True)
## @endcode
## Here the user need to acces to the file wrote: #include <ewol/context/context.h> ==> it just remove the include data
##
def add_header_file(self, list, destination_path=None, clip_path=None, recursive=False):
if destination_path != None: if destination_path != None:
debug.verbose("Change destination PATH: '" + str(destination_path) + "'") debug.verbose("Change destination PATH: '" + str(destination_path) + "'")
new_list = [] new_list = []
if type(list) == str:
list = [list]
for elem in list: for elem in list:
base = os.path.basename(elem)
if destination_path != None: if destination_path != None:
base = os.path.basename(elem) if clip_path != None:
if '*' in base or '[' in base or '(' in base: debug.error("can not use 'destination_path' and 'clip_path' at the same time ...");
if '*' in base \
or '[' in base \
or '(' in base:
new_list.append({"src":elem, new_list.append({"src":elem,
"multi-dst":destination_path}) "multi-dst":destination_path,
"recursive":recursive})
else: else:
new_list.append({"src":elem, new_list.append({"src":elem,
"dst":os.path.join(destination_path, base)}) "dst":os.path.join(destination_path, base),
"recursive":recursive})
else: else:
new_list.append({"src":elem, if clip_path == None:
"dst":elem}) if '*' in base \
or '[' in base \
or '(' in base:
new_list.append({"src":elem,
"multi-dst":"",
"recursive":recursive})
else:
new_list.append({"src":elem,
"dst":elem,
"recursive":recursive})
else:
if len(clip_path)>len(elem):
debug.error("can not clip a path with not the same name: '" + clip_path + "' != '" + elem + "' (size too small)")
if clip_path != elem[:len(clip_path)]:
debug.error("can not clip a path with not the same name: '" + clip_path + "' != '" + elem[:len(clip_path)] + "'")
out_elem = elem[len(clip_path):]
while len(out_elem) > 0 \
and out_elem[0] == "/":
out_elem = out_elem[1:]
if '*' in base \
or '[' in base \
or '(' in base:
new_list.append({"src":elem,
"multi-dst":"",
"recursive":recursive})
else:
new_list.append({"src":elem,
"dst":out_elem,
"recursive":recursive})
tools.list_append_to(self.header, new_list, True) tools.list_append_to(self.header, new_list, True)
##
## @brief Many library need to generate dynamic file configuration, use this to generat your configuration and add it in the include path
## @param[in] data_file Data of the file that is generated
## @param[in] destination_path Path where to install data
## @param[in] install_element add the file in the include path and not only in the generate path
## @note this does not rewrite the file if it is not needed
##
def add_generated_header_file(self, data_file, destination_path, install_element=False):
self.generate_file.append({
"data":data_file,
"filename":destination_path,
"install":install_element
});
def add_export_path(self, list, type='c'): def add_export_path(self, list, type='c'):
tools.list_append_to_2(self.path["export"], type, list) tools.list_append_to_2(self.path["export"], type, list)
@@ -880,7 +1031,7 @@ class Module:
print(' ' + str(description)) print(' ' + str(description))
print(' ' + str(input_list)) print(' ' + str(input_list))
def display(self, target): def display(self):
print('-----------------------------------------------') print('-----------------------------------------------')
print(' package : "' + self.name + "'") print(' package : "' + self.name + "'")
print('-----------------------------------------------') print('-----------------------------------------------')
@@ -904,12 +1055,13 @@ class Module:
self.print_list('paths',self.paths) self.print_list('paths',self.paths)
for element in self.path["local"]: for element in self.path["local"]:
value = self.path["local"][element] value = self.path["local"][element]
self.print_list('local path ' + str(element), value) self.print_list('local path "' + str(element) + '" ' + str(len(value)), value)
for element in self.path["export"]: for element in self.path["export"]:
value = self.path["export"][element] value = self.path["export"][element]
self.print_list('export path ' + str(element), value) self.print_list('export path "' + str(element) + '" ' + str(len(value)), value)
return True
def pkg_set(self, variable, value): def pkg_set(self, variable, value):
if "COMPAGNY_TYPE" == variable: if "COMPAGNY_TYPE" == variable:
@@ -973,7 +1125,8 @@ class Module:
"ANDROID_APPL_TYPE", "ANDROID_APPL_TYPE",
"ADMOD_ID", "ADMOD_ID",
"APPLE_APPLICATION_IOS_ID", "APPLE_APPLICATION_IOS_ID",
"LICENSE"]: "LICENSE",
"ANDROID_SIGN"]:
self.package_prop[variable] = value self.package_prop[variable] = value
self.package_prop_default[variable] = False self.package_prop_default[variable] = False
elif "ADMOD_POSITION" == variable: elif "ADMOD_POSITION" == variable:

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##
@@ -27,6 +28,8 @@ class System:
self.export_src=[] self.export_src=[]
self.export_path=[] self.export_path=[]
self.action_on_state={} self.action_on_state={}
self.headers=[]
self.version=None
def add_export_sources(self, list): def add_export_sources(self, list):
tools.list_append_to(self.export_src, list) tools.list_append_to(self.export_src, list)
@@ -41,12 +44,21 @@ class System:
def add_export_flag(self, type, list): def add_export_flag(self, type, list):
tools.list_append_to_2(self.export_flags, type, list) tools.list_append_to_2(self.export_flags, type, list)
def set_version(self, version_list):
self.version = version_list
def add_action(self, name_of_state="PACKAGE", level=5, name="no-name", action=None): def add_action(self, name_of_state="PACKAGE", level=5, name="no-name", action=None):
if name_of_state not in self.action_on_add_src_filestate: if name_of_state not in self.action_on_add_src_filestate:
self.action_on_state[name_of_state] = [[level, name, action]] self.action_on_state[name_of_state] = [[level, name, action]]
else: else:
self.action_on_state[name_of_state].append([level, name, action]) self.action_on_state[name_of_state].append([level, name, action])
def add_header_file(self, list, destination_path=None, clip_path=None, recursive=False):
self.headers.append({
"list":list,
"dst":destination_path,
"clip":clip_path,
"recursive":recursive
})
def __repr__(self): def __repr__(self):
return "{lutin.System}" return "{lutin.System}"
@@ -68,7 +80,14 @@ def create_module_from_system(target, dict):
for elem in dict["system"].action_on_state: for elem in dict["system"].action_on_state:
level, name, action = dict["system"].action_on_state[elem] level, name, action = dict["system"].action_on_state[elem]
target.add_action(elem, level, name, action) target.add_action(elem, level, name, action)
for elem in dict["system"].headers:
myModule.add_header_file(
elem["list"],
destination_path=elem["dst"],
clip_path=elem["clip"],
recursive=elem["recursive"])
if dict["system"].version != None:
myModule.package_prop["VERSION"] = dict["system"].version
return myModule return myModule
@@ -139,13 +158,13 @@ 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__(env.get_build_system_base_name() + __start_system_name + target_name + "_" + data["name"]) the_system = __import__(env.get_build_system_base_name() + __start_system_name + target_name + "_" + data["name"])
#create the system module #create the system module
try: debug.verbose("SYSTEM: request: " + str(data["name"]))
debug.verbose("SYSTEM: request: " + data["name"]) if "System" in dir(the_system):
data["system"] = theSystem.System(target) data["system"] = the_system.System(target)
data["exist"] = data["system"].valid data["exist"] = data["system"].valid
except: else:
debug.warning("Not find: '" + data["name"] + "' ==> get exception") debug.warning("Not find: '" + data["name"] + "' ==> get exception")
return data["exist"] return data["exist"]
return False return False

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##
@@ -44,6 +45,7 @@ class Target:
# todo : remove this : # todo : remove this :
self.sumulator = config["simulation"] self.sumulator = config["simulation"]
self.name = name self.name = name
self.config_based_on = name
self.end_generate_package = 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"] + "'");
@@ -96,6 +98,7 @@ class Target:
'-D__TARGET_ADDR__' + self.select_bus + 'BITS', '-D__TARGET_ADDR__' + self.select_bus + 'BITS',
'-D_REENTRANT' '-D_REENTRANT'
]) ])
self.add_flag("c", "-nodefaultlibs")
self.add_flag("c++", "-nostdlib") self.add_flag("c++", "-nostdlib")
self.add_flag("ar", 'rcs') self.add_flag("ar", 'rcs')
@@ -105,9 +108,12 @@ class Target:
if "debug" == self.config["mode"]: if "debug" == self.config["mode"]:
self.add_flag("c", [ self.add_flag("c", [
"-g", "-g",
"-DDEBUG", "-DDEBUG"
"-O0"
]) ])
if env.get_force_optimisation() == False:
self.add_flag("c", "-O0")
else:
self.add_flag("c", "-O3")
else: else:
self.add_flag("c", [ self.add_flag("c", [
"-DNDEBUG", "-DNDEBUG",
@@ -116,14 +122,22 @@ class Target:
## To add code coverate on build result system ## To add code coverate on build result system
if self.config["gcov"] == True: if self.config["gcov"] == True:
self.add_flag("c", [ if self.config["compilator"] == "clang":
"-fprofile-arcs", self.add_flag("c", [
"-ftest-coverage" "--coverage"
]) ])
self.add_flag("link", [ self.add_flag("link", [
"-lgcov", "--coverage"
"--coverage" ])
]) else:
self.add_flag("c", [
"-fprofile-arcs",
"-ftest-coverage"
])
self.add_flag("link", [
"-lgcov",
"--coverage"
])
self.update_path_tree() self.update_path_tree()
self.path_bin="bin" self.path_bin="bin"
@@ -131,6 +145,7 @@ class Target:
self.path_data="share" self.path_data="share"
self.path_doc="doc" self.path_doc="doc"
self.path_include="include" self.path_include="include"
self.path_temporary_generate="generate"
self.path_object="obj" self.path_object="obj"
@@ -348,6 +363,9 @@ class Target:
def get_build_path_include(self, binary_name): def get_build_path_include(self, binary_name):
return os.path.join(self.get_build_path(binary_name), self.path_include) return os.path.join(self.get_build_path(binary_name), self.path_include)
def get_build_path_temporary_generate(self, binary_name):
return os.path.join(self.get_build_path(binary_name), self.path_temporary_generate)
def get_build_file_bin(self, binary_name): def get_build_file_bin(self, binary_name):
return os.path.join(self.get_build_path_bin(binary_name), binary_name + self.suffix_binary) return os.path.join(self.get_build_path_bin(binary_name), binary_name + self.suffix_binary)
@@ -460,7 +478,17 @@ class Target:
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, actions=[]):
if len(name.split("?")) != 1\
or len(name.split("@")) != 1:
debug.error("need update")
if actions == "":
actions = ["build"]
if actions == []:
actions = ["build"]
if type(actions) == str:
actions = [actions]
if name == "gcov": if name == "gcov":
debug.info("gcov all") debug.info("gcov all")
debug.error("must set the gcov parsing on a specific library or binary ==> not supported now for all") debug.error("must set the gcov parsing on a specific library or binary ==> not supported now for all")
@@ -468,7 +496,7 @@ class Target:
debug.info("dump all") debug.info("dump all")
self.load_all() self.load_all()
for mod in self.module_list: for mod in self.module_list:
mod.display(self) mod.display()
return return
if name == "all": if name == "all":
debug.info("build all") debug.info("build all")
@@ -487,14 +515,8 @@ class Target:
for mod in self.module_list: for mod in self.module_list:
mod.clean(self) mod.clean(self)
else: else:
# get the action an the module .... module_name = name
name2 = name.replace("@", "?") action_list = actions
gettedElement = name2.split("?")
module_name = gettedElement[0]
action_list = gettedElement[1:]
if len(action_list) == 0:
action_list = ["build"]
debug.verbose("requested : " + module_name + " ? actions:" + str(action_list))
for action_name in action_list: for action_name in action_list:
debug.verbose("requested : " + module_name + "?" + action_name + " [START]") debug.verbose("requested : " + module_name + "?" + action_name + " [START]")
ret = None; ret = None;
@@ -538,14 +560,13 @@ class Target:
and optionnal == True: and optionnal == True:
ret = [heritage.HeritageList(), False] ret = [heritage.HeritageList(), False]
else: else:
# clean requested
for mod in self.module_list: for mod in self.module_list:
if mod.name == module_name: if mod.name == module_name:
if action_name[:4] == "dump": if action_name[:4] == "dump":
debug.info("dump module '" + module_name + "'") debug.info("dump module '" + module_name + "'")
if len(action_name) > 4: if len(action_name) > 4:
debug.warning("action 'dump' does not support options ... : '" + action_name + "'") debug.warning("action 'dump' does not support options ... : '" + action_name + "'")
ret = mod.display(self) ret = mod.display()
break break
elif action_name[:5] == "clean": elif action_name[:5] == "clean":
debug.info("clean module '" + module_name + "'") debug.info("clean module '" + module_name + "'")
@@ -634,6 +655,8 @@ class Target:
## @param[in] pkg_name Package Name (generic name) ## @param[in] pkg_name Package Name (generic name)
## @param[in] heritage_list List of dependency of the package ## @param[in] heritage_list List of dependency of the package
## @param[in] static The package is build in static mode ## @param[in] static The package is build in static mode
## @return True Something has been copied
## @return False Nothing has been copied
## ##
def make_package_binary_data(self, path_package, pkg_name, base_pkg_path, heritage_list, static): def make_package_binary_data(self, path_package, pkg_name, base_pkg_path, heritage_list, static):
target_shared_path = os.path.join(path_package, self.pkg_path_data) target_shared_path = os.path.join(path_package, self.pkg_path_data)
@@ -667,9 +690,10 @@ class Target:
force_identical=True, force_identical=True,
in_list=copy_list) in_list=copy_list)
#real copy files #real copy files
tools.copy_list(copy_list) ret_copy = tools.copy_list(copy_list)
# remove unneded files (NOT folder ...) # remove unneded files (NOT folder ...)
tools.clean_directory(target_shared_path, copy_list) ret_remove = tools.clean_directory(target_shared_path, copy_list)
return ret_copy or ret_remove
## ##
## @brief Create a generic tree of the binary folder ## @brief Create a generic tree of the binary folder
@@ -677,6 +701,8 @@ class Target:
## @param[in] pkg_name Package Name (generic name) ## @param[in] pkg_name Package Name (generic name)
## @param[in] heritage_list List of dependency of the package ## @param[in] heritage_list List of dependency of the package
## @param[in] static The package is build in static mode ## @param[in] static The package is build in static mode
## @return True Something has been copied
## @return False Nothing has been copied
## ##
def make_package_binary_bin(self, path_package, pkg_name, base_pkg_path, heritage_list, static): def make_package_binary_bin(self, path_package, pkg_name, base_pkg_path, heritage_list, static):
copy_list={} copy_list={}
@@ -689,10 +715,12 @@ class Target:
path_dst, path_dst,
in_list=copy_list) in_list=copy_list)
#real copy files #real copy files
tools.copy_list(copy_list) ret_copy = tools.copy_list(copy_list)
ret_remove = False
if self.pkg_path_bin != "": if self.pkg_path_bin != "":
# remove unneded files (NOT folder ...) # remove unneded files (NOT folder ...)
tools.clean_directory(path_package_bin, copy_list) ret_remove = tools.clean_directory(path_package_bin, copy_list)
return ret_copy or ret_remove
## ##
## @brief Create a generic tree of the library folder ## @brief Create a generic tree of the library folder
@@ -700,6 +728,8 @@ class Target:
## @param[in] pkg_name Package Name (generic name) ## @param[in] pkg_name Package Name (generic name)
## @param[in] heritage_list List of dependency of the package ## @param[in] heritage_list List of dependency of the package
## @param[in] static The package is build in static mode ## @param[in] static The package is build in static mode
## @return True Something has been copied
## @return False Nothing has been copied
## ##
def make_package_binary_lib(self, path_package, pkg_name, base_pkg_path, heritage_list, static): def make_package_binary_lib(self, path_package, pkg_name, base_pkg_path, heritage_list, static):
copy_list={} copy_list={}
@@ -720,46 +750,49 @@ class Target:
os.path.join(path_package_lib, os.path.basename(file_src)), os.path.join(path_package_lib, os.path.basename(file_src)),
in_list=copy_list) in_list=copy_list)
#real copy files #real copy files
tools.copy_list(copy_list) ret_copy = tools.copy_list(copy_list)
ret_remove = False
if self.pkg_path_lib != "": if self.pkg_path_lib != "":
# remove unneded files (NOT folder ...) # remove unneded files (NOT folder ...)
tools.clean_directory(path_package_lib, copy_list) ret_remove = tools.clean_directory(path_package_lib, copy_list)
return ret_copy or ret_remove
def make_package_generic_files(self, path_package, pkg_properties, pkg_name, base_pkg_path, heritage_list, static): def make_package_generic_files(self, path_package, pkg_properties, pkg_name, base_pkg_path, heritage_list, static):
## Create version file: ## Create version file:
tools.file_write_data(os.path.join(path_package, self.pkg_path_version_file), ret_version = tools.file_write_data(os.path.join(path_package, self.pkg_path_version_file),
tools.version_to_string(pkg_properties["VERSION"]), tools.version_to_string(pkg_properties["VERSION"]),
only_if_new=True) only_if_new=True)
## Create maintainer file: ## Create maintainer file:
tools.file_write_data(os.path.join(path_package, self.pkg_path_maintainer_file), ret_maintainer = tools.file_write_data(os.path.join(path_package, self.pkg_path_maintainer_file),
self.generate_list_separate_coma(pkg_properties["MAINTAINER"]), self.generate_list_separate_coma(pkg_properties["MAINTAINER"]),
only_if_new=True) only_if_new=True)
## Create appl_name file: ## Create appl_name file:
tools.file_write_data(os.path.join(path_package, self.pkg_path_application_name_file), ret_appl_name = tools.file_write_data(os.path.join(path_package, self.pkg_path_application_name_file),
"en_EN:" + pkg_properties["NAME"], "en_EN:" + pkg_properties["NAME"],
only_if_new=True) only_if_new=True)
## Create appl_description file: ## Create appl_description file:
tools.file_write_data(os.path.join(path_package, self.pkg_path_application_description_file), ret_appl_desc = tools.file_write_data(os.path.join(path_package, self.pkg_path_application_description_file),
"en_EN:" + pkg_properties["DESCRIPTION"], "en_EN:" + pkg_properties["DESCRIPTION"],
only_if_new=True) only_if_new=True)
## Create Readme file: ## Create Readme file:
readme_file_dest = os.path.join(path_package, self.pkg_path_readme_file) readme_file_dest = os.path.join(path_package, self.pkg_path_readme_file)
ret_readme = False
if os.path.exists(os.path.join(base_pkg_path, "os-Linux/README"))==True: if os.path.exists(os.path.join(base_pkg_path, "os-Linux/README"))==True:
tools.copy_file(os.path.join(base_pkg_path, "os-Linux/README"), readme_file_dest) ret_readme = tools.copy_file(os.path.join(base_pkg_path, "os-Linux/README"), readme_file_dest)
elif os.path.exists(os.path.join(base_pkg_path, "README"))==True: elif os.path.exists(os.path.join(base_pkg_path, "README"))==True:
tools.copy_file(os.path.join(base_pkg_path, "README"), readme_file_dest) ret_readme = tools.copy_file(os.path.join(base_pkg_path, "README"), readme_file_dest)
elif os.path.exists(os.path.join(base_pkg_path, "README.md"))==True: elif os.path.exists(os.path.join(base_pkg_path, "README.md"))==True:
tools.copy_file(os.path.join(base_pkg_path, "README.md"), readme_file_dest) ret_readme = tools.copy_file(os.path.join(base_pkg_path, "README.md"), readme_file_dest)
else: else:
debug.debug("no file 'README', 'README.md' or 'os-Linux/README' ==> generate an empty one") debug.debug("no file 'README', 'README.md' or 'os-Linux/README' ==> generate an empty one")
tools.file_write_data(readme_file_dest, ret_readme = tools.file_write_data(readme_file_dest,
"No documentation for " + pkg_name + "\n", "No documentation for " + pkg_name + "\n",
only_if_new=True) only_if_new=True)
## Create licence file: ## Create licence file:
""" """
@@ -778,13 +811,20 @@ class Target:
## Create changeLog file: ## Create changeLog file:
change_log_file_dest = os.path.join(path_package, self.pkg_path_change_log_file) change_log_file_dest = os.path.join(path_package, self.pkg_path_change_log_file)
ret_changelog = False
if os.path.exists(os.path.join(base_pkg_path, "changelog")) == True: if os.path.exists(os.path.join(base_pkg_path, "changelog")) == True:
tools.copy_file(os.path.join(base_pkg_path, "changelog"), change_log_file_dest) ret_changelog = tools.copy_file(os.path.join(base_pkg_path, "changelog"), change_log_file_dest)
else: else:
debug.debug("no file 'changelog' ==> generate an empty one") debug.debug("no file 'changelog' ==> generate an empty one")
tools.file_write_data(change_log_file_dest, ret_changelog = tools.file_write_data(change_log_file_dest,
"No changelog data " + pkg_name + "\n", "No changelog data " + pkg_name + "\n",
only_if_new=True) only_if_new=True)
return ret_version \
or ret_maintainer \
or ret_appl_name \
or ret_appl_desc \
or ret_readme \
or ret_changelog
## ##
## @brief convert a s list of string in a string separated by a "," ## @brief convert a s list of string in a string separated by a ","

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##
@@ -86,17 +87,20 @@ def version_to_string(version):
## @param[in] path Path of the data might be written. ## @param[in] path Path of the data might be written.
## @param[in] data Data To write in the file. ## @param[in] data Data To write in the file.
## @param[in] only_if_new (default: False) Write data only if data is different. ## @param[in] only_if_new (default: False) Write data only if data is different.
## @return True Something has been copied
## @return False Nothing has been copied
## ##
def file_write_data(path, data, only_if_new=False): def file_write_data(path, data, only_if_new=False):
if only_if_new == True: if only_if_new == True:
old_data = file_read_data(path) old_data = file_read_data(path)
if old_data == data: if old_data == data:
return return False
#real write of data: #real write of data:
create_directory_of_file(path) create_directory_of_file(path)
file = open(path, "w") file = open(path, "w")
file.write(data) file.write(data)
file.close() file.close()
return True
def list_to_str(list): def list_to_str(list):
if type(list) == type(str()): if type(list) == type(str()):
@@ -130,6 +134,8 @@ def add_prefix(prefix,list):
## @param[in] force (default False) Force copy of the file ## @param[in] force (default False) Force copy of the file
## @param[in] force_identical (default False) Force file to be identical (read it in binary) ## @param[in] force_identical (default False) Force file to be identical (read it in binary)
## @param[in,out] in_list (default None) Not real copy: set the request copy in the input list ## @param[in,out] in_list (default None) Not real copy: set the request copy in the input list
## @return True Something has/must been copied
## @return False Nothing has/myst been copied
## ##
def copy_file(src, dst, cmd_file=None, force=False, force_identical=False, in_list=None): def copy_file(src, dst, cmd_file=None, force=False, force_identical=False, in_list=None):
if os.path.exists(src) == False: if os.path.exists(src) == False:
@@ -137,7 +143,7 @@ def copy_file(src, dst, cmd_file=None, force=False, force_identical=False, in_li
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 , cmd_line=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 ...")
if in_list != None: if in_list != None:
if dst in in_list: if dst in in_list:
debug.verbose("replace copy file " + os.path.relpath(src) + " ==> " + os.path.relpath(dst)) debug.verbose("replace copy file " + os.path.relpath(src) + " ==> " + os.path.relpath(dst))
@@ -147,7 +153,7 @@ def copy_file(src, dst, cmd_file=None, force=False, force_identical=False, in_li
in_list[dst] = {"src":src, in_list[dst] = {"src":src,
"cmd_file":cmd_file, "cmd_file":cmd_file,
"need_copy":False} "need_copy":False}
return return False
if in_list == None: if in_list == None:
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))
create_directory_of_file(dst) create_directory_of_file(dst)
@@ -162,6 +168,7 @@ def copy_file(src, dst, cmd_file=None, force=False, force_identical=False, in_li
in_list[dst] = {"src":src, in_list[dst] = {"src":src,
"cmd_file":cmd_file, "cmd_file":cmd_file,
"need_copy":True} "need_copy":True}
return True
## ##
## @brief Copy a compleate directory in a specific folder ## @brief Copy a compleate directory in a specific folder
@@ -209,20 +216,28 @@ def copy_anything(src, dst, recursive = False, force_identical=False, in_list=No
## ##
## @brief real copy of files in a specific dictionnary list ## @brief real copy of files in a specific dictionnary list
## @param[in] in_list Dictionnary of file to copy ## @param[in] in_list Dictionnary of file to copy
## @return True Something has been copied
## @return False Nothing has been copied
## ##
def copy_list(in_list): def copy_list(in_list):
has_file_copied = False
for dst in in_list: for dst in in_list:
if in_list[dst]["need_copy"] == False: if in_list[dst]["need_copy"] == False:
continue continue
# note we force the copy to disable the check of needed of copy (already done) # note we force the copy to disable the check of needed of copy (already done)
copy_file(in_list[dst]["src"], dst, cmd_file=in_list[dst]["cmd_file"], force=True) copy_file(in_list[dst]["src"], dst, cmd_file=in_list[dst]["cmd_file"], force=True)
has_file_copied = True
return has_file_copied
## ##
## @brief Clean a path from all un-needed element in a directory ## @brief Clean a path from all un-needed element in a directory
## @param[in] path Path to clean ## @param[in] path Path to clean
## @param[in] normal_list List of all files/path in the path ## @param[in] normal_list List of all files/path in the path
## @return True Something has been removed
## @return False Nothing has been removed
## ##
def clean_directory(path, normal_list): def clean_directory(path, normal_list):
has_file_removed = False
# get a list of all element in the path: # get a list of all element in the path:
for root, dirnames, filenames in os.walk(path): for root, dirnames, filenames in os.walk(path):
for file in filenames: for file in filenames:
@@ -230,6 +245,8 @@ def clean_directory(path, normal_list):
if file_name not in normal_list: if file_name not in normal_list:
debug.print_element("remove file ", os.path.relpath(file_name), "==>", "---") debug.print_element("remove file ", os.path.relpath(file_name), "==>", "---")
os.remove(file_name) os.remove(file_name)
has_file_removed = True
return has_file_removed
def filter_extention(list_files, extentions, invert=False): def filter_extention(list_files, extentions, invert=False):
out = [] out = []

View File

@@ -0,0 +1,9 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##

View File

@@ -1,3 +1,13 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
## ##
## Executable/binary builder ## Executable/binary builder
## ##
@@ -117,6 +127,7 @@ def link(file, binary, target, depancy, flags, name, basic_path, static = False)
cmd.append("-Wl,-R$ORIGIN/../lib/") cmd.append("-Wl,-R$ORIGIN/../lib/")
except: except:
pass pass
cmd.append("-Wl,-rpath,\"\$ORIGIN/../lib\"")
try: try:
cmd.append(flags["local"]["link"]) cmd.append(flags["local"]["link"])
except: except:
@@ -135,12 +146,20 @@ def link(file, binary, target, depancy, flags, name, basic_path, static = False)
for type in ["link-lib"]: for type in ["link-lib"]:
if type in flags[view]: if type in flags[view]:
cmd.append([("-l" + sss).replace("-l/", "/") for sss in flags[view][type] ]) cmd.append([("-l" + sss).replace("-l/", "/") for sss in flags[view][type] ])
for type in ["link-bin"]:
if type in flags[view]:
cmd.append(flags[view][type])
for type in ["link-lib"]: for type in ["link-lib"]:
if type in depancy.flags: if type in depancy.flags:
cmd.append([("-l" + sss).replace("-l/", "/") for sss in depancy.flags[type] ]) cmd.append([("-l" + sss).replace("-l/", "/") for sss in depancy.flags[type] ])
for type in ["link-lib"]: for type in ["link-lib"]:
if type in target.global_flags: if type in target.global_flags:
cmd.append([("-l" + sss).replace("-l/", "/") for sss in target.global_flags[type] ]) cmd.append([("-l" + sss).replace("-l/", "/") for sss in target.global_flags[type] ])
for type in ["link-bin"]:
if type in target.global_flags:
cmd.append(target.global_flags[type])
if type in depancy.flags:
cmd.append(depancy.flags[type])
cmd_line = 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=file_cmd, cmd_line=cmd_line) == False \ if depend.need_re_package(file_dst, file_src, True, file_cmd=file_cmd, cmd_line=cmd_line) == False \

View File

@@ -1,3 +1,13 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
## ##
## C builder ## C builder
## ##
@@ -60,8 +70,7 @@ def compile(file, binary, target, depancy, flags, path, name, basic_path, module
target.cc, target.cc,
"-o", file_dst, "-o", file_dst,
target.arch, target.arch,
target.sysroot, target.sysroot]
target.global_include_cc]
for view in ["export", "local"]: for view in ["export", "local"]:
try: try:
cmd.append(tools.add_prefix("-I", path[view]["c"])) cmd.append(tools.add_prefix("-I", path[view]["c"]))
@@ -71,6 +80,7 @@ def compile(file, binary, target, depancy, flags, path, name, basic_path, module
cmd.append(tools.add_prefix("-I", depancy.path["c"])) cmd.append(tools.add_prefix("-I", depancy.path["c"]))
except: except:
pass pass
cmd.append(target.global_include_cc)
try: try:
cmd.append(get_version_compilation_flags(flags, depancy.flags)) cmd.append(get_version_compilation_flags(flags, depancy.flags))
except: except:

View File

@@ -1,3 +1,13 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
## ##
## C++ builder ## C++ builder
## ##
@@ -65,8 +75,7 @@ def compile(file, binary, target, depancy, flags, path, name, basic_path, module
target.xx, target.xx,
"-o", file_dst, "-o", file_dst,
target.arch, target.arch,
target.sysroot, target.sysroot
target.global_include_cc
] ]
for view in ["export", "local"]: for view in ["export", "local"]:
for type in ["c", "c++"]: for type in ["c", "c++"]:
@@ -79,6 +88,7 @@ def compile(file, binary, target, depancy, flags, path, name, basic_path, module
cmd.append(tools.add_prefix("-I",depancy.path[type])) cmd.append(tools.add_prefix("-I",depancy.path[type]))
except: except:
pass pass
cmd.append(target.global_include_cc)
try: try:
cmd.append(get_version_compilation_flags(flags, depancy.flags)) cmd.append(get_version_compilation_flags(flags, depancy.flags))
except: except:

View File

@@ -1,3 +1,13 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
## ##
## Dynamic library builder ## Dynamic library builder
## ##

View File

@@ -1,3 +1,13 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
## ##
## Java builder ## Java builder
## ##

View File

@@ -1,3 +1,13 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
## ##
## Java builder ## Java builder
## ##

View File

@@ -1,3 +1,13 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
## ##
## Dynamic library builder ## Dynamic library builder
## ##
@@ -89,6 +99,10 @@ def link(file, binary, target, depancy, flags, name, basic_path, static=False):
cmd.append(file_src) cmd.append(file_src)
except: except:
pass pass
try:
cmd.append(list_static)
except:
pass
for view in ["local", "export"]: for view in ["local", "export"]:
if view not in flags: if view not in flags:
continue continue
@@ -103,10 +117,6 @@ def link(file, binary, target, depancy, flags, name, basic_path, static=False):
cmd.append(target.global_flags[type]) cmd.append(target.global_flags[type])
if 'src' in depancy.src: if 'src' in depancy.src:
cmd.append(tools.filter_extention(depancy.src['src'], get_input_type())) cmd.append(tools.filter_extention(depancy.src['src'], get_input_type()))
try:
cmd.append(list_static)
except:
pass
try: try:
for elem in list_dynamic: for elem in list_dynamic:
lib_path = os.path.dirname(elem) lib_path = os.path.dirname(elem)

View File

@@ -1,3 +1,13 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
## ##
## Static library builder ## Static library builder
## ##

View File

@@ -1,3 +1,13 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
## ##
## Objective-C builder ## Objective-C builder
## ##

View File

@@ -1,3 +1,13 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
## ##
## Objective C++ builder ## Objective C++ builder
## ##

View File

@@ -1,3 +1,13 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
## ##
## ASM builder ## ASM builder
## ##
@@ -39,3 +49,57 @@ def get_output_type():
## ##
def get_support_multithreading(): def get_support_multithreading():
return True return True
##
## @brief Commands for running gcc to compile a C file in object file.
##
def compile(file, binary, target, depancy, flags, path, name, basic_path, module_src):
file_src = target.get_full_name_source(basic_path, file)
file_cmd = target.get_full_name_cmd(name, basic_path, file)
file_dst = target.get_full_name_destination(name, basic_path, file, get_output_type())
file_depend = target.get_full_dependency(name, basic_path, file)
file_warning = target.get_full_name_warning(name, basic_path, file)
# create the command line befor requesting start:
cmd = [
target.cc,
"-o", file_dst,
target.arch,
target.sysroot]
for view in ["export", "local"]:
try:
cmd.append(tools.add_prefix("-I", path[view]["c"]))
except:
pass
try:
cmd.append(tools.add_prefix("-I", depancy.path["c"]))
except:
pass
cmd.append(target.global_include_cc)
try:
cmd.append(target.global_flags["c"])
except:
pass
try:
cmd.append(depancy.flags["c"])
except:
pass
for view in ["local", "export"]:
try:
cmd.append(flags[view]["c"])
except:
pass
cmd.append("-c")
cmd.append("-MMD")
cmd.append("-MP")
cmd.append(file_src)
# Create cmd line
cmdLine=tools.list_to_str(cmd)
# check the dependency for this file :
if depend.need_re_build(file_dst, file_src, file_depend, file_cmd, cmdLine) == False:
return {"action":"add", "file":file_dst}
tools.create_directory_of_file(file_dst)
comment = ["s", name, "<==", file]
# process element
multiprocess.run_in_pool(cmdLine, comment, file_cmd, store_output_file=file_warning)
return {"action":"add", "file":file_dst}

View File

@@ -0,0 +1,9 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##
@@ -10,6 +11,7 @@
from lutin import debug from lutin import debug
from lutin import system from lutin import system
from lutin import tools from lutin import tools
from lutin import env
import os import os
class System(system.System): class System(system.System):

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##
@@ -10,6 +11,7 @@
from lutin import debug from lutin import debug
from lutin import system from lutin import system
from lutin import tools from lutin import tools
from lutin import env
import os import os
class System(system.System): class System(system.System):

View File

@@ -0,0 +1,23 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
from lutin import debug
from lutin import system
from lutin import tools
from lutin import env
import os
class System(system.System):
def __init__(self, target):
system.System.__init__(self)
# create some HELP:
self.help = "C: Generic C library"
self.valid = True

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##
@@ -10,6 +11,7 @@
from lutin import debug from lutin import debug
from lutin import system from lutin import system
from lutin import tools from lutin import tools
from lutin import env
import os import os
class System(system.System): class System(system.System):
@@ -47,6 +49,7 @@ class System(system.System):
else: else:
self.add_export_flag("c++", "-D__STDCPP_GNU__") self.add_export_flag("c++", "-D__STDCPP_GNU__")
self.add_export_flag("c++-remove","-nostdlib") self.add_export_flag("c++-remove","-nostdlib")
self.add_export_flag("need-libstdc++", True)
# GPL v3 (+ exception link for gcc compilator) # GPL v3 (+ exception link for gcc compilator)
self.add_export_path(os.path.join(target.path_ndk, "sources", "cxx-stl", "gnu-libstdc++", target.compilator_version, "include")) self.add_export_path(os.path.join(target.path_ndk, "sources", "cxx-stl", "gnu-libstdc++", target.compilator_version, "include"))
if target.type_arch == "armv5": if target.type_arch == "armv5":

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##
@@ -10,6 +11,7 @@
from lutin import debug from lutin import debug
from lutin import system from lutin import system
from lutin import tools from lutin import tools
from lutin import env
import os import os
class System(system.System): class System(system.System):

View File

@@ -0,0 +1,36 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
from lutin import debug
from lutin import system
from lutin import tools
from lutin import env
import os
class System(system.System):
def __init__(self, target):
system.System.__init__(self)
# create some HELP:
self.help = "OpenGL: Generic graphic library"
self.valid = True
# no check needed ==> just add this:
self.add_module_depend([
'c',
])
"""
self.add_header_file([
"/usr/include/GL/*"
],
destination_path="GL",
recursive=True)
"""
self.add_export_flag('link-lib', "GLESv2")

View File

@@ -0,0 +1,35 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
from lutin import debug
from lutin import system
from lutin import tools
from lutin import env
import os
class System(system.System):
def __init__(self, target):
system.System.__init__(self)
# create some HELP:
self.help="pthread : Generic multithreading system\n Can be install with the package:\n - pthread-dev"
# check if the library exist:
"""
if not os.path.isfile("/usr/include/pthread.h"):
# we did not find the library reqiested (just return) (automaticly set at false)
return;
"""
self.valid = True
# todo : create a searcher of the presence of the library:
#self.add_export_flag("link-lib", "pthread")
self.add_module_depend([
'c'
])

View File

@@ -0,0 +1,29 @@
#!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
from lutin import debug
from lutin import system
from lutin import tools
from lutin import env
import os
class System(system.System):
def __init__(self, target):
system.System.__init__(self)
# create some HELP:
self.help="Z : z library \n Can be install with the package:\n - zlib1g-dev"
# check if the library exist:
if not os.path.isfile("/usr/include/zlib.h"):
# we did not find the library reqiested (just return) (automaticly set at false)
return;
self.valid = True
# todo : create a searcher of the presence of the library:
self.add_export_flag("link-lib", "z")

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##
@@ -10,6 +11,7 @@
from lutin import debug from lutin import debug
from lutin import system from lutin import system
from lutin import tools from lutin import tools
from lutin import env
import os import os
class System(system.System): class System(system.System):

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##
@@ -10,6 +11,7 @@
from lutin import debug from lutin import debug
from lutin import system from lutin import system
from lutin import tools from lutin import tools
from lutin import env
import os import os
class System(system.System): class System(system.System):

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##
@@ -10,6 +11,7 @@
from lutin import debug from lutin import debug
from lutin import system from lutin import system
from lutin import tools from lutin import tools
from lutin import env
import os import os
class System(system.System): class System(system.System):

View File

@@ -0,0 +1,33 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
from lutin import debug
from lutin import system
from lutin import tools
from lutin import env
import os
class System(system.System):
def __init__(self, target):
system.System.__init__(self)
# create some HELP:
self.help = "X11: Basic interface of Linux Graphic interface"
self.valid = True
# no check needed ==> just add this:
self.add_module_depend(['c'])
self.add_export_flag('link-lib', 'X11')
if env.get_isolate_system() == False:
self.add_header_file([
"/usr/include/X11/*"
],
destination_path="X11",
recursive=True)

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##
@@ -10,6 +11,7 @@
from lutin import debug from lutin import debug
from lutin import system from lutin import system
from lutin import tools from lutin import tools
from lutin import env
import os import os
class System(system.System): class System(system.System):
@@ -23,7 +25,22 @@ class System(system.System):
# we did not find the library reqiested (just return) (automaticly set at false) # we did not find the library reqiested (just return) (automaticly set at false)
return; return;
self.valid = True self.valid = True
# todo : create a searcher of the presence of the library: if env.get_isolate_system() == False:
self.add_export_flag("link-lib", "asound") self.add_export_flag("link-lib", "asound")
else:
self.add_export_flag("link-lib", "asound")
self.add_header_file([
"/usr/include/alsa/*",
],
destination_path="alsa",
recursive=True)
self.add_header_file([
"/usr/include/dssi/*",
],
destination_path="dssi",
recursive=True)
self.add_module_depend([
'c'
])

View File

@@ -0,0 +1,41 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
from lutin import debug
from lutin import system
from lutin import tools
from lutin import env
import os
class System(system.System):
def __init__(self, target):
system.System.__init__(self)
# create some HELP:
self.help="rpc : generic RPC library (developed by oracle)"
# check if the library exist:
if not os.path.isfile("/usr/include/arpa/ftp.h"):
# we did not find the library reqiested (just return) (automaticly set at false)
return;
# No check ==> on the basic std libs:
self.valid = True
if env.get_isolate_system() == True:
#self.add_export_flag("link-lib", "xns")
self.add_header_file([
"/usr/include/arpa/*"
],
destination_path="arpa",
recursive=True)
self.add_module_depend([
'c'
])

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##
@@ -10,6 +11,7 @@
from lutin import debug from lutin import debug
from lutin import system from lutin import system
from lutin import tools from lutin import tools
from lutin import env
import os import os
class System(system.System): class System(system.System):
@@ -22,12 +24,22 @@ class System(system.System):
# we did not find the library reqiested (just return) (automaticly set at false) # we did not find the library reqiested (just return) (automaticly set at false)
return; return;
self.valid = True self.valid = True
# todo : create a searcher of the presence of the library: if env.get_isolate_system() == False:
self.add_export_flag("link-lib", [ # todo : create a searcher of the presence of the library:
"boost_system", self.add_export_flag("link-lib", [
"boost_thread", "boost_system",
"boost_chrono" "boost_thread",
]) "boost_chrono"
])
else:
self.add_header_file([
"/usr/include/boost/*"
],
destination_path="boost",
recursive=True)
self.add_module_depend([
'cxx'
])

View File

@@ -0,0 +1,175 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
from lutin import debug
from lutin import system
from lutin import tools
from lutin import env
import os
class System(system.System):
def __init__(self, target):
system.System.__init__(self)
# create some HELP:
self.help = "C: Generic C library"
self.valid = True
if env.get_isolate_system() == False:
# We must have it ... all time
pass
else:
# grep "This file is part of the GNU C Library" /usr/include/*
self.add_header_file([
'/usr/include/aio.h*',
'/usr/include/aliases.h*',
'/usr/include/alloca.h*',
'/usr/include/ansidecl.h*',
'/usr/include/argp.h*',
'/usr/include/argz.h*',
'/usr/include/ar.h*',
'/usr/include/assert.h*',
'/usr/include/byteswap.h*',
'/usr/include/complex.h*',
'/usr/include/cpio.h*',
'/usr/include/ctype.h*',
'/usr/include/dirent.h*',
'/usr/include/dlfcn.h*',
'/usr/include/elf.h*',
'/usr/include/endian.h*',
'/usr/include/envz.h*',
'/usr/include/err.h*',
'/usr/include/errno.h*',
'/usr/include/error.h*',
'/usr/include/execinfo.h*',
'/usr/include/fcntl.h*',
'/usr/include/features.h*',
'/usr/include/fenv.h*',
'/usr/include/fmtmsg.h*',
'/usr/include/fnmatch.h*',
'/usr/include/fpu_control.h*',
'/usr/include/fts.h*',
'/usr/include/ftw.h*',
'/usr/include/gconv.h*',
'/usr/include/getopt.h*',
'/usr/include/glob.h*',
'/usr/include/gnu-versions.h*',
'/usr/include/grp.h*',
'/usr/include/gshadow.h*',
'/usr/include/iconv.h*',
'/usr/include/ieee754.h*',
'/usr/include/ifaddrs.h*',
'/usr/include/inttypes.h*',
'/usr/include/langinfo.h*',
'/usr/include/libgen.h*',
'/usr/include/libintl.h*',
'/usr/include/libio.h*',
'/usr/include/limits.h*',
'/usr/include/link.h*',
'/usr/include/locale.h*',
'/usr/include/malloc.h*',
'/usr/include/mcheck.h*',
'/usr/include/memory.h*',
'/usr/include/mntent.h*',
'/usr/include/monetary.h*',
'/usr/include/mqueue.h*',
'/usr/include/netdb.h*',
'/usr/include/nl_types.h*',
'/usr/include/nss.h*',
'/usr/include/obstack.h*',
'/usr/include/printf.h*',
'/usr/include/pthread.h*',
'/usr/include/pty.h*',
'/usr/include/pwd.h*',
'/usr/include/re_comp.h*',
'/usr/include/regex.h*',
'/usr/include/regexp.h*',
'/usr/include/sched.h*',
'/usr/include/search.h*',
'/usr/include/semaphore.h*',
'/usr/include/setjmp.h*',
'/usr/include/sgtty.h*',
'/usr/include/shadow.h*',
'/usr/include/signal.h*',
'/usr/include/spawn.h*',
'/usr/include/stdc-predef.h*',
'/usr/include/stdint.h*',
'/usr/include/stdio_ext.h*',
'/usr/include/stdio.h*',
'/usr/include/stdlib.h*',
'/usr/include/string.h*',
'/usr/include/strings.h*',
'/usr/include/stropts.h*',
'/usr/include/tar.h*',
'/usr/include/termios.h*',
'/usr/include/tgmath.h*',
'/usr/include/thread_db.h*',
'/usr/include/time.h*',
'/usr/include/uchar.h*',
'/usr/include/ucontext.h*',
'/usr/include/ulimit.h*',
'/usr/include/unistd.h*',
'/usr/include/utime.h*',
'/usr/include/utmp.h*',
'/usr/include/utmpx.h*',
'/usr/include/values.h*',
'/usr/include/wchar.h*',
'/usr/include/wctype.h*',
'/usr/include/wordexp.h*',
'/usr/include/xlocale.h*',
],
destination_path="")
self.add_header_file([
'/usr/include/poll.h*',
'/usr/include/unistdio.h*',
'/usr/include/syslog.h*',
'/usr/include/_G_config.h*',
],
destination_path="")
self.add_header_file([
"/usr/include/sys/*",
],
destination_path="sys",
recursive=True)
self.add_header_file([
"/usr/include/bits/*",
],
destination_path="bits",
recursive=True)
self.add_header_file([
"/usr/include/gnu/*",
],
destination_path="gnu",
recursive=True)
self.add_header_file([
"/usr/include/linux/*",
],
destination_path="linux",
recursive=True)
self.add_header_file([
"/usr/include/asm/*",
],
destination_path="asm",
recursive=True)
self.add_header_file([
"/usr/include/asm-generic/*",
],
destination_path="asm-generic",
recursive=True)
self.add_header_file([
"/usr/include/netinet/*",
],
destination_path="netinet",
recursive=True)
self.add_header_file([
"/usr/include/net/*",
],
destination_path="net",
recursive=True)
self.add_export_flag("link", "-B/usr/lib")

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##
@@ -10,6 +11,8 @@
from lutin import debug from lutin import debug
from lutin import system from lutin import system
from lutin import tools from lutin import tools
from lutin import multiprocess
from lutin import env
import os import os
class System(system.System): class System(system.System):
@@ -19,8 +22,29 @@ class System(system.System):
self.help = "CXX: Generic C++ library" self.help = "CXX: Generic C++ library"
self.valid = True self.valid = True
# no check needed ==> just add this: # no check needed ==> just add this:
self.add_module_depend([
'c',
'm',
'pthread'
])
self.add_export_flag("c++", "-D__STDCPP_GNU__") self.add_export_flag("c++", "-D__STDCPP_GNU__")
self.add_export_flag("c++-remove", "-nostdlib") if env.get_isolate_system() == False:
self.add_export_flag("need-libstdc++", True) self.add_export_flag("c++-remove", "-nostdlib")
self.add_export_flag("need-libstdc++", True)
else:
self.add_export_flag("link-lib", "stdc++")
compilator_gcc = "g++"
if target.config["compilator-version"] != "":
compilator_gcc = compilator_gcc + "-" + target.config["compilator-version"]
#get g++ compilation version :
version_cpp = multiprocess.run_command_direct(compilator_gcc + " -dumpversion");
if version_cpp == False:
debug.error("Can not get the g++ version ...")
self.add_header_file([
"/usr/include/c++/" + version_cpp + "/*"
],
recursive=True)

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##
@@ -10,6 +11,7 @@
from lutin import debug from lutin import debug
from lutin import system from lutin import system
from lutin import tools from lutin import tools
from lutin import env
import os import os
class System(system.System): class System(system.System):
@@ -22,7 +24,16 @@ class System(system.System):
# we did not find the library reqiested (just return) (automaticly set at false) # we did not find the library reqiested (just return) (automaticly set at false)
return; return;
self.valid = True self.valid = True
# todo : create a searcher of the presence of the library: self.add_module_depend([
'uuid',
'c'
])
self.add_export_flag("link-lib", "jack") self.add_export_flag("link-lib", "jack")
if env.get_isolate_system() == True:
self.add_header_file([
"/usr/include/jack/*",
],
destination_path="jack",
recursive=True)

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##
@@ -10,6 +11,7 @@
from lutin import debug from lutin import debug
from lutin import system from lutin import system
from lutin import tools from lutin import tools
from lutin import env
import os import os
class System(system.System): class System(system.System):
@@ -21,5 +23,15 @@ class System(system.System):
self.valid = True self.valid = True
# todo : create a searcher of the presence of the library: # todo : create a searcher of the presence of the library:
self.add_export_flag("link-lib", "m") self.add_export_flag("link-lib", "m")
self.add_module_depend([
'c'
])
if env.get_isolate_system() == True:
self.add_header_file([
"/usr/include/math.h"
],
clip_path="/usr/include",
recursive=False)

View File

@@ -0,0 +1,54 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
from lutin import debug
from lutin import system
from lutin import tools
from lutin import env
import os
class System(system.System):
def __init__(self, target):
system.System.__init__(self)
# create some HELP:
self.help = "OpenGL: Generic graphic library"
self.valid = True
# no check needed ==> just add this:
self.add_module_depend([
'c',
'X11'
])
self.add_export_flag('link-lib', 'GL')
if env.get_isolate_system() == True:
self.add_header_file([
"/usr/include/GL/*"
],
destination_path="GL",
recursive=True)
"""
if target.name=="Linux":
elif target.name=="Android":
my_module.add_export_flag('link-lib', "GLESv2")
elif target.name=="Windows":
my_module.add_module_depend([
"glew"
])
elif target.name=="MacOs":
my_module.add_export_flag('link', [
"-framework OpenGL"])
elif target.name=="IOs":
my_module.add_export_flag('link', [
"-framework OpenGLES"
])
"""

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##
@@ -10,6 +11,7 @@
from lutin import debug from lutin import debug
from lutin import system from lutin import system
from lutin import tools from lutin import tools
from lutin import env
import os import os
class System(system.System): class System(system.System):

View File

@@ -0,0 +1,39 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
from lutin import debug
from lutin import system
from lutin import tools
from lutin import env
import os
class System(system.System):
def __init__(self, target):
system.System.__init__(self)
# create some HELP:
self.help="pthread : Generic multithreading system\n Can be install with the package:\n - pthread-dev"
# check if the library exist:
if not os.path.isfile("/usr/include/pthread.h"):
# we did not find the library reqiested (just return) (automaticly set at false)
return;
self.valid = True
# todo : create a searcher of the presence of the library:
self.add_export_flag("link-lib", "pthread")
self.add_module_depend([
'c'
])
if env.get_isolate_system() == True:
self.add_header_file([
"/usr/include/sched.h",
"/usr/include/pthread.h"
],
clip_path="/usr/include/")

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##
@@ -10,6 +11,7 @@
from lutin import debug from lutin import debug
from lutin import system from lutin import system
from lutin import tools from lutin import tools
from lutin import env
import os import os
class System(system.System): class System(system.System):
@@ -21,8 +23,43 @@ class System(system.System):
if not os.path.isfile("/usr/include/pulse/pulseaudio.h"): if not os.path.isfile("/usr/include/pulse/pulseaudio.h"):
# we did not find the library reqiested (just return) (automaticly set at false) # we did not find the library reqiested (just return) (automaticly set at false)
return; return;
dst_data = tools.file_read_data("/usr/include/pulse/version.h")
lines = dst_data.split("\n")
patern = "#define pa_get_headers_version() (\""
version = None
for line in lines:
if line[:len(patern)] == patern:
#Find the version line
version = line[len(patern)]
version2 = line[len(patern)+2]
debug.verbose("detect version '" + version + "'")
break;
if version == None:
debug.warning("Can not det version of Pulseaudio ... ==> remove it")
return
self.set_version([int(version),int(version2)])
self.valid = True self.valid = True
# todo : create a searcher of the presence of the library: self.add_module_depend([
self.add_export_flag("link-lib", ["pulse-simple", "pulse"]) 'c'
])
if env.get_isolate_system() == False:
self.add_export_flag("link-lib", [
"pulse-simple",
"pulse"
])
else:
# todo : create a searcher of the presence of the library:
self.add_export_flag("link-lib", [
"pulsecommon-" + version + ".0",
"pulse-mainloop-glib",
"pulse-simple",
"pulse"
])
self.add_export_flag("link", "-L/usr/lib/pulseaudio")
self.add_header_file([
"/usr/include/pulse/*",
],
destination_path="pulse",
recursive=True)

View File

@@ -0,0 +1,38 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
from lutin import debug
from lutin import system
from lutin import tools
from lutin import env
import os
class System(system.System):
def __init__(self, target):
system.System.__init__(self)
# create some HELP:
self.help="rpc : generic RPC library (developed by oracle)"
# No check ==> on the basic std libs:
self.valid = True
self.add_module_depend([
'c'
])
# todo : create a searcher of the presence of the library:
self.add_export_flag("link-lib", "rpcsvc")
if env.get_isolate_system() == False:
self.add_header_file([
"/usr/include/rpc/*"
],
destination_path="rpc",
recursive=True)

View File

@@ -0,0 +1,39 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
from lutin import debug
from lutin import system
from lutin import tools
from lutin import env
import os
class System(system.System):
def __init__(self, target):
system.System.__init__(self)
# create some HELP:
self.help="uuid: Unique ID library"
# check if the library exist:
if not os.path.isfile("/usr/include/uuid/uuid.h"):
# we did not find the library reqiested (just return) (automaticly set at false)
return;
self.valid = True
self.add_module_depend([
'c'
])
# todo : create a searcher of the presence of the library:
self.add_export_flag("link-lib", "uuid")
if env.get_isolate_system() == False:
self.add_header_file([
"/usr/include/uuid/*",
],
destination_path="uuid",
recursive=True)

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##
@@ -10,6 +11,7 @@
from lutin import debug from lutin import debug
from lutin import system from lutin import system
from lutin import tools from lutin import tools
from lutin import env
import os import os
class System(system.System): class System(system.System):
@@ -24,5 +26,14 @@ class System(system.System):
self.valid = True self.valid = True
# todo : create a searcher of the presence of the library: # todo : create a searcher of the presence of the library:
self.add_export_flag("link-lib", "z") self.add_export_flag("link-lib", "z")
self.add_module_depend([
'c'
])
if env.get_isolate_system() == False:
self.add_header_file([
"/usr/include/zlib.h"
],
destination_path="")

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##
@@ -10,6 +11,7 @@
from lutin import debug from lutin import debug
from lutin import system from lutin import system
from lutin import tools from lutin import tools
from lutin import env
import os import os
class System(system.System): class System(system.System):

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##
@@ -10,6 +11,7 @@
from lutin import debug from lutin import debug
from lutin import system from lutin import system
from lutin import tools from lutin import tools
from lutin import env
import os import os
class System(system.System): class System(system.System):

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##
@@ -10,6 +11,7 @@
from lutin import debug from lutin import debug
from lutin import system from lutin import system
from lutin import tools from lutin import tools
from lutin import env
import os import os
class System(system.System): class System(system.System):

View File

@@ -0,0 +1,9 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##
@@ -10,6 +11,7 @@
from lutin import debug from lutin import debug
from lutin import system from lutin import system
from lutin import tools from lutin import tools
from lutin import env
import os import os
class System(system.System): class System(system.System):

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##
@@ -10,6 +11,7 @@
from lutin import debug from lutin import debug
from lutin import system from lutin import system
from lutin import tools from lutin import tools
from lutin import env
import os import os
class System(system.System): class System(system.System):

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##
@@ -10,6 +11,7 @@
from lutin import debug from lutin import debug
from lutin import system from lutin import system
from lutin import tools from lutin import tools
from lutin import env
import os import os
class System(system.System): class System(system.System):

View File

@@ -0,0 +1,9 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##
@@ -7,7 +8,6 @@
## @license APACHE v2.0 (see license file) ## @license APACHE v2.0 (see license file)
## ##
from lutin import debug from lutin import debug
from lutin import target from lutin import target
from lutin import tools from lutin import tools
@@ -174,13 +174,15 @@ class Target(target.Target):
# ----------------------- # -----------------------
self.add_flag("c", [ self.add_flag("c", [
"-mfpu=neon", "-mfpu=neon",
"-march=armv7-a",
"-mfloat-abi=softfp", "-mfloat-abi=softfp",
"-D__ARM_ARCH_7__", "-D__ARM_ARCH_7__",
"-D__ARM_NEON__" "-D__ARM_NEON__"
]) ])
self.add_flag("link", [ self.add_flag("link", [
"-mfpu=neon", "-mfpu=neon",
"-mfloat-abi=softfp" "-mfloat-abi=softfp",
"-Wl,--fix-cortex-a8",
]) ])
# the -mthumb must be set for all the android produc, some ot the not work coretly without this one ... (all android code is generated with this flags) # the -mthumb must be set for all the android produc, some ot the not work coretly without this one ... (all android code is generated with this flags)
@@ -467,7 +469,7 @@ class Target(target.Target):
print("On release mode we need the file : and key an pasword to sign the application ...") print("On release mode we need the file : and key an pasword to sign the application ...")
debug.print_element("pkg", ".apk(signed debug)", "<==", ".apk (not signed)") debug.print_element("pkg", ".apk(signed debug)", "<==", ".apk (not signed)")
cmdLine = "jarsigner " \ cmdLine = "jarsigner " \
+ " -keystore " + base_pkg_path + "/AndroidKey.jks " \ + " -keystore " + pkg_properties["ANDROID_SIGN"] + " " \
+ " -sigalg SHA1withRSA -digestalg SHA1 " \ + " -sigalg SHA1withRSA -digestalg SHA1 " \
+ target_outpath + "/build/" + pkg_name_application_name + "-unalligned.apk " \ + target_outpath + "/build/" + pkg_name_application_name + "-unalligned.apk " \
+ " " + pkg_name_application_name + " " + pkg_name_application_name

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##
@@ -10,6 +11,7 @@
from lutin import debug from lutin import debug
from lutin import target from lutin import target
from lutin import tools from lutin import tools
from lutin import env
import os import os
import stat import stat
import re import re
@@ -40,6 +42,10 @@ class Target(target.Target):
self.pkg_path_bin = "bin" self.pkg_path_bin = "bin"
self.pkg_path_lib = "lib" self.pkg_path_lib = "lib"
self.pkg_path_license = "license" self.pkg_path_license = "license"
# disable sysroot when generate build in isolated mode
if env.get_isolate_system() == True:
self.sysroot = "--sysroot=/aDirectoryThatDoesNotExist/"
""" """
.local/application .local/application
@@ -73,30 +79,34 @@ class Target(target.Target):
""" """
def make_package_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static): def make_package_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static):
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("-- Generate generic '" + pkg_name + "' v" + tools.version_to_string(pkg_properties["VERSION"])) debug.debug("-- Generate generic '" + pkg_name + "' v" + tools.version_to_string(pkg_properties["VERSION"]))
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
#output path #output path
target_outpath = os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app") target_outpath = os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app")
tools.create_directory_of_file(target_outpath) tools.create_directory_of_file(target_outpath)
## Create share datas: ## Create share datas:
self.make_package_binary_data(target_outpath, pkg_name, base_pkg_path, heritage_list, static) ret_share = self.make_package_binary_data(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
## copy binary files: ## copy binary files:
self.make_package_binary_bin(target_outpath, pkg_name, base_pkg_path, heritage_list, static) ret_bin = self.make_package_binary_bin(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
## Create libraries: ## Create libraries:
self.make_package_binary_lib(target_outpath, pkg_name, base_pkg_path, heritage_list, static) ret_lib = self.make_package_binary_lib(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
## Create generic files: ## Create generic files:
self.make_package_generic_files(target_outpath, pkg_properties, pkg_name, base_pkg_path, heritage_list, static) ret_file = self.make_package_generic_files(target_outpath, pkg_properties, pkg_name, base_pkg_path, heritage_list, static)
## create the package: ## create the package:
debug.debug("package : " + os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app.pkg")) if ret_share \
os.system("cd " + self.get_staging_path(pkg_name) + " ; tar -czf " + pkg_name + ".app.tar.gz " + pkg_name + ".app") or ret_bin \
#multiprocess.run_command("cd " + self.get_staging_path(pkg_name) + " ; tar -czf " + pkg_name + ".app.tar.gz " + pkg_name + ".app") or ret_lib \
tools.create_directory_of_file(self.get_final_path()) or ret_file:
tools.copy_file(os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app.tar.gz"), os.path.join(self.get_final_path(), pkg_name + ".app.gpkg")) debug.debug("package : " + os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app.pkg"))
os.system("cd " + self.get_staging_path(pkg_name) + " ; tar -czf " + pkg_name + ".app.tar.gz " + pkg_name + ".app")
#multiprocess.run_command("cd " + self.get_staging_path(pkg_name) + " ; tar -czf " + pkg_name + ".app.tar.gz " + pkg_name + ".app")
tools.create_directory_of_file(self.get_final_path())
tools.copy_file(os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app.tar.gz"), os.path.join(self.get_final_path(), pkg_name + ".app.gpkg"))
def install_package(self, pkg_name): def install_package(self, pkg_name):
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##
@@ -62,24 +63,30 @@ class Target(target.Target):
def make_package_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static): def make_package_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static):
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("Generate package '" + pkg_name + "' v" + tools.version_to_string(pkg_properties["VERSION"])) debug.debug("Generate package '" + pkg_name + "' v" + tools.version_to_string(pkg_properties["VERSION"]))
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
#output path #output path
target_outpath = os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app") target_outpath = os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app")
tools.create_directory_of_file(target_outpath) tools.create_directory_of_file(target_outpath)
## Create share datas: ## Create share datas:
self.make_package_binary_data(target_outpath, pkg_name, base_pkg_path, heritage_list, static) ret_share = self.make_package_binary_data(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
## copy binary files: ## copy binary files:
self.make_package_binary_bin(target_outpath, pkg_name, base_pkg_path, heritage_list, static) ret_bin = self.make_package_binary_bin(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
## Create libraries: ## Create libraries:
self.make_package_binary_lib(target_outpath, pkg_name, base_pkg_path, heritage_list, static) ret_lib = self.make_package_binary_lib(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
## Create generic files: ## Create generic files:
self.make_package_generic_files(target_outpath, pkg_properties, pkg_name, base_pkg_path, heritage_list, static) ret_file = self.make_package_generic_files(target_outpath, pkg_properties, pkg_name, base_pkg_path, heritage_list, static)
## create the package:
if ret_share \
or ret_bin \
or ret_lib \
or ret_file:
debug.info("TODO: create a windows pkg ...")
def make_package_single_file(self, pkg_name, pkg_properties, base_pkg_path, heritage_list): def make_package_single_file(self, pkg_name, pkg_properties, base_pkg_path, heritage_list):
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")

View File

@@ -1,4 +1,5 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
## @author Edouard DUPIN ## @author Edouard DUPIN
## ##
@@ -6,6 +7,7 @@
## ##
## @license APACHE v2.0 (see license file) ## @license APACHE v2.0 (see license file)
## ##
import platform import platform
import os import os
import zipfile import zipfile

View File

@@ -1,4 +1,13 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*-
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
from setuptools import setup from setuptools import setup
def readme(): def readme():
@@ -7,7 +16,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='1.2.0', version='1.2.6',
description='Lutin generic builder (might replace makefile, CMake ...)', description='Lutin generic builder (might replace makefile, CMake ...)',
long_description=readme(), long_description=readme(),
url='http://github.com/HeeroYui/lutin', url='http://github.com/HeeroYui/lutin',