Compare commits
48 Commits
Author | SHA1 | Date | |
---|---|---|---|
dc42a8e14b | |||
97f7566a7e | |||
bf6fde3770 | |||
97db63bcfd | |||
43c7947b95 | |||
1c32b7089a | |||
760a589cbe | |||
d38ecf5432 | |||
7e44373f79 | |||
3804de2078 | |||
8fa25bb8ec | |||
beb97f4bed | |||
47dcca5578 | |||
dde9c9c280 | |||
598d301284 | |||
520f97c7f6 | |||
e4b69d17f4 | |||
42be4afd0a | |||
1fa860e5b3 | |||
87a4106101 | |||
1ec07b9446 | |||
5995effd9e | |||
43c0ec2535 | |||
31fb9818ff | |||
83d7154254 | |||
55609b904c | |||
4beda0dd23 | |||
236f19bf36 | |||
fe75da7ef9 | |||
e1728a4d8d | |||
c6ea16d046 | |||
b645f087f3 | |||
6e69681480 | |||
14114158aa | |||
618825ac76 | |||
2a0bdd9e90 | |||
3b2c888fad | |||
77358efa48 | |||
f069299a53 | |||
c962b4fb9f | |||
5d92a27738 | |||
c35e1d3a24 | |||
7c664f156d | |||
198513660e | |||
61db92894a | |||
a9dd50575a | |||
d21217bfc4 | |||
9b9c65d036 |
145
bin/lutin
145
bin/lutin
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
@@ -10,6 +11,8 @@
|
|||||||
# for path inspection:
|
# for path inspection:
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
import copy
|
||||||
|
import lutin
|
||||||
import lutin.debug as debug
|
import lutin.debug as debug
|
||||||
import lutin.arg as arguments
|
import lutin.arg as arguments
|
||||||
import lutin.host as host
|
import lutin.host as host
|
||||||
@@ -18,6 +21,8 @@ import lutin.target as target
|
|||||||
import lutin.env as env
|
import lutin.env as env
|
||||||
import lutin.multiprocess as multiprocess
|
import lutin.multiprocess as multiprocess
|
||||||
import lutin.tools as tools
|
import lutin.tools as tools
|
||||||
|
import lutin.host as lutinHost
|
||||||
|
import lutin.tools as lutinTools
|
||||||
|
|
||||||
myArgs = arguments.LutinArg()
|
myArgs = arguments.LutinArg()
|
||||||
myArgs.add(arguments.ArgDefine("h", "help", desc="Display this help"))
|
myArgs.add(arguments.ArgDefine("h", "help", desc="Display this help"))
|
||||||
@@ -28,8 +33,11 @@ myArgs.add(arguments.ArgDefine("C", "color", desc="Display makefile output in co
|
|||||||
myArgs.add(arguments.ArgDefine("B", "force-build", desc="Force the rebuild without checking the dependency"))
|
myArgs.add(arguments.ArgDefine("B", "force-build", desc="Force the rebuild without checking the dependency"))
|
||||||
myArgs.add(arguments.ArgDefine("P", "pretty", desc="Print the debug has pretty display"))
|
myArgs.add(arguments.ArgDefine("P", "pretty", desc="Print the debug has pretty display"))
|
||||||
myArgs.add(arguments.ArgDefine("j", "jobs", haveParam=True, desc="Specifies the number of jobs (commands) to run simultaneously"))
|
myArgs.add(arguments.ArgDefine("j", "jobs", haveParam=True, desc="Specifies the number of jobs (commands) to run simultaneously"))
|
||||||
|
myArgs.add(arguments.ArgDefine("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'"))
|
||||||
@@ -148,8 +156,18 @@ 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))
|
||||||
if argument.get_option_name() == "help":
|
if argument.get_option_name() == "help":
|
||||||
if active==False:
|
if active==False:
|
||||||
usage()
|
usage()
|
||||||
@@ -184,42 +202,123 @@ def parseGenericArg(argument, active):
|
|||||||
if active==True:
|
if active==True:
|
||||||
multiprocess.set_core_number(int(argument.get_arg()))
|
multiprocess.set_core_number(int(argument.get_arg()))
|
||||||
return True
|
return True
|
||||||
|
elif argument.get_option_name()=="depth":
|
||||||
|
if active==True:
|
||||||
|
env.set_parse_depth(int(argument.get_arg()))
|
||||||
|
return True
|
||||||
elif argument.get_option_name() == "verbose":
|
elif argument.get_option_name() == "verbose":
|
||||||
if active==True:
|
if active==True:
|
||||||
debug.set_level(int(argument.get_arg()))
|
debug.set_level(int(argument.get_arg()))
|
||||||
return True
|
return True
|
||||||
elif argument.get_option_name() == "color":
|
elif argument.get_option_name() == "color":
|
||||||
if active==True:
|
if active==True:
|
||||||
debug.enable_color()
|
if check_boolean(argument.get_arg()) == True:
|
||||||
|
debug.enable_color()
|
||||||
|
else:
|
||||||
|
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:
|
||||||
env.set_print_pretty_mode(True)
|
if check_boolean(argument.get_arg()) == True:
|
||||||
|
env.set_print_pretty_mode(True)
|
||||||
|
else:
|
||||||
|
env.set_print_pretty_mode(False)
|
||||||
|
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
|
return True
|
||||||
elif argument.get_option_name() == "force-strip":
|
elif argument.get_option_name() == "force-strip":
|
||||||
if active==True:
|
if active==True:
|
||||||
env.set_force_strip_mode(True)
|
if check_boolean(argument.get_arg()) == True:
|
||||||
|
env.set_force_strip_mode(True)
|
||||||
|
else:
|
||||||
|
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:
|
||||||
env.set_warning_mode(True)
|
if check_boolean(argument.get_arg()) == True:
|
||||||
|
env.set_warning_mode(True)
|
||||||
|
else:
|
||||||
|
env.set_warning_mode(False)
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
# open configuration of lutin:
|
||||||
|
config_file_name = "lutinConfig.py"
|
||||||
|
config_file = os.path.join(tools.get_run_path(), config_file_name)
|
||||||
|
if os.path.isfile(config_file) == True:
|
||||||
|
sys.path.append(os.path.dirname(config_file))
|
||||||
|
debug.debug("Find basic configuration file: '" + config_file + "'")
|
||||||
|
# the file exist, we can open it and get the initial configuration:
|
||||||
|
configuration_file = __import__(config_file_name[:-3])
|
||||||
|
|
||||||
|
if "get_exclude_path" in dir(configuration_file):
|
||||||
|
data = configuration_file.get_exclude_path()
|
||||||
|
debug.debug(" get default config 'get_exclude_path' val='" + str(data) + "'")
|
||||||
|
env.set_exclude_search_path(data)
|
||||||
|
|
||||||
|
if "get_parsing_depth" in dir(configuration_file):
|
||||||
|
data = configuration_file.get_parsing_depth()
|
||||||
|
debug.debug(" get default config 'get_parsing_depth' val='" + str(data) + "'")
|
||||||
|
parseGenericArg(arguments.ArgElement("depth", str(data)), True)
|
||||||
|
|
||||||
|
if "get_default_jobs" in dir(configuration_file):
|
||||||
|
data = configuration_file.get_default_jobs()
|
||||||
|
debug.debug(" get default config 'get_default_jobs' val='" + str(data) + "'")
|
||||||
|
parseGenericArg(arguments.ArgElement("jobs", str(data)), True)
|
||||||
|
|
||||||
|
if "get_default_color" in dir(configuration_file):
|
||||||
|
data = configuration_file.get_default_color()
|
||||||
|
debug.debug(" get default config 'get_default_color' val='" + str(data) + "'")
|
||||||
|
parseGenericArg(arguments.ArgElement("color", str(data)), True)
|
||||||
|
|
||||||
|
if "get_default_debug_level" in dir(configuration_file):
|
||||||
|
data = configuration_file.get_default_debug_level()
|
||||||
|
debug.debug(" get default config 'get_default_debug_level' val='" + str(data) + "'")
|
||||||
|
parseGenericArg(arguments.ArgElement("verbose", str(data)), True)
|
||||||
|
|
||||||
|
if "get_default_print_pretty" in dir(configuration_file):
|
||||||
|
data = configuration_file.get_default_print_pretty()
|
||||||
|
debug.debug(" get default config 'get_default_print_pretty' val='" + str(data) + "'")
|
||||||
|
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:
|
||||||
for argument in localArgument:
|
for argument in localArgument:
|
||||||
parseGenericArg(argument, True)
|
parseGenericArg(argument, True)
|
||||||
|
|
||||||
|
# initialize the system ...
|
||||||
import lutin
|
lutin.init()
|
||||||
|
|
||||||
|
|
||||||
import lutin.host as lutinHost
|
|
||||||
import lutin.tools as lutinTools
|
|
||||||
|
|
||||||
#available target : Linux / MacOs / Windows / Android ...
|
#available target : Linux / MacOs / Windows / Android ...
|
||||||
targetName = host.OS
|
targetName = host.OS
|
||||||
@@ -283,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" ...
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
@@ -8,6 +9,7 @@
|
|||||||
##
|
##
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import fnmatch
|
||||||
# Local import
|
# Local import
|
||||||
from . import target
|
from . import target
|
||||||
from . import builder
|
from . import builder
|
||||||
@@ -16,32 +18,138 @@ from . import host
|
|||||||
from . import tools
|
from . import tools
|
||||||
from . import debug
|
from . import debug
|
||||||
from . import module
|
from . import module
|
||||||
|
from . import env
|
||||||
is_init = False
|
is_init = False
|
||||||
|
|
||||||
if is_init == False:
|
|
||||||
|
def filter_name_and_file(root, list_files, filter):
|
||||||
|
# filter elements:
|
||||||
|
tmp_list = fnmatch.filter(list_files, filter)
|
||||||
|
out = []
|
||||||
|
for elem in tmp_list:
|
||||||
|
if os.path.isfile(os.path.join(root, elem)) == True:
|
||||||
|
out.append(elem);
|
||||||
|
return out;
|
||||||
|
|
||||||
|
def filter_path(root, list_files):
|
||||||
|
out = []
|
||||||
|
for elem in list_files:
|
||||||
|
if len(elem) == 0 \
|
||||||
|
or elem[0] == '.':
|
||||||
|
continue
|
||||||
|
if os.path.isdir(os.path.join(root, elem)) == True:
|
||||||
|
out.append(elem);
|
||||||
|
return out;
|
||||||
|
|
||||||
|
def import_path_local(path, limit_sub_folder, exclude_path = [], base_name = ""):
|
||||||
|
out = []
|
||||||
|
debug.verbose("lutin files: " + str(path) + " [START]")
|
||||||
|
if limit_sub_folder == 0:
|
||||||
|
debug.debug("Subparsing limitation append ...")
|
||||||
|
return []
|
||||||
|
try:
|
||||||
|
list_files = os.listdir(path)
|
||||||
|
except:
|
||||||
|
# an error occure, maybe read error ...
|
||||||
|
debug.warning("error when getting subdirectory of '" + str(path) + "'")
|
||||||
|
return []
|
||||||
|
if path in exclude_path:
|
||||||
|
debug.debug("find '" + str(path) + "' in exclude_path=" + str(exclude_path))
|
||||||
|
return []
|
||||||
|
# filter elements:
|
||||||
|
tmp_list_lutin_file = filter_name_and_file(path, list_files, base_name + "*.py")
|
||||||
|
debug.verbose("lutin files: " + str(path) + " : " + str(tmp_list_lutin_file))
|
||||||
|
# Import the module:
|
||||||
|
for filename in tmp_list_lutin_file:
|
||||||
|
out.append(os.path.join(path, filename))
|
||||||
|
debug.extreme_verbose(" Find a file : '" + str(out[-1]) + "'")
|
||||||
|
need_parse_sub_folder = True
|
||||||
|
rm_value = -1
|
||||||
|
# check if we need to parse sub_folder
|
||||||
|
if len(tmp_list_lutin_file) != 0:
|
||||||
|
need_parse_sub_folder = False
|
||||||
|
# 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:
|
||||||
|
debug.debug("find SubParser ... " + str(base_name + "ParseSubFolders.txt") + " " + path)
|
||||||
|
data_file_sub = tools.file_read_data(os.path.join(path, base_name + "ParseSubFolders.txt"))
|
||||||
|
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:
|
||||||
|
list_folders = filter_path(path, list_files)
|
||||||
|
for folder in list_folders:
|
||||||
|
tmp_out = import_path_local(os.path.join(path, folder),
|
||||||
|
limit_sub_folder - rm_value,
|
||||||
|
exclude_path,
|
||||||
|
base_name)
|
||||||
|
# add all the elements:
|
||||||
|
for elem in tmp_out:
|
||||||
|
out.append(elem)
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
def init():
|
||||||
|
global is_init;
|
||||||
|
if is_init == True:
|
||||||
|
return
|
||||||
debug.verbose("Use Make as a make stadard")
|
debug.verbose("Use Make as a make stadard")
|
||||||
sys.path.append(tools.get_run_path())
|
sys.path.append(tools.get_run_path())
|
||||||
builder.import_path(tools.get_current_path(__file__))
|
# create the list of basic folder:
|
||||||
module.import_path(tools.get_current_path(__file__))
|
basic_folder_list = []
|
||||||
system.import_path(tools.get_current_path(__file__))
|
basic_folder_list.append([tools.get_current_path(__file__), True])
|
||||||
target.import_path(tools.get_current_path(__file__))
|
|
||||||
|
|
||||||
debug.debug("missing file lutinBase.py ==> loading subPath...");
|
|
||||||
# Import all sub path without out and archive
|
# Import all sub path without out and archive
|
||||||
for path in os.listdir("."):
|
for elem_path in os.listdir("."):
|
||||||
if os.path.isdir(path)==True:
|
if os.path.isdir(elem_path) == False:
|
||||||
if path.lower()!="android" \
|
continue
|
||||||
and path.lower()!="archive" \
|
if elem_path.lower() == "android" \
|
||||||
and path.lower()!="out" :
|
or elem_path == "out" :
|
||||||
debug.debug("Automatic load path: '" + path + "'")
|
continue
|
||||||
builder.import_path(path)
|
debug.debug("Automatic load path: '" + elem_path + "'")
|
||||||
module.import_path(path)
|
basic_folder_list.append([elem_path, False])
|
||||||
system.import_path(path)
|
|
||||||
target.import_path(path)
|
# create in a single path the basic list of lutin files (all start with lutin and end with .py)
|
||||||
|
exclude_path = env.get_exclude_search_path()
|
||||||
|
limit_sub_folder = env.get_parse_depth()
|
||||||
|
list_of_lutin_files = []
|
||||||
|
for elem_path, is_system in basic_folder_list:
|
||||||
|
if is_system == True:
|
||||||
|
limit_sub_folder_tmp = 999999
|
||||||
|
else:
|
||||||
|
limit_sub_folder_tmp = limit_sub_folder
|
||||||
|
tmp_out = import_path_local(elem_path,
|
||||||
|
limit_sub_folder_tmp,
|
||||||
|
exclude_path,
|
||||||
|
env.get_build_system_base_name())
|
||||||
|
# add all the elements:
|
||||||
|
for elem in tmp_out:
|
||||||
|
list_of_lutin_files.append(elem)
|
||||||
|
|
||||||
|
debug.debug("Files specific lutin: ")
|
||||||
|
for elem_path in list_of_lutin_files:
|
||||||
|
debug.debug(" " + elem_path)
|
||||||
|
# simply import element from the basic list of files (single parse ...)
|
||||||
|
builder.import_path(list_of_lutin_files)
|
||||||
|
module.import_path(list_of_lutin_files)
|
||||||
|
system.import_path(list_of_lutin_files)
|
||||||
|
target.import_path(list_of_lutin_files)
|
||||||
|
|
||||||
builder.init()
|
builder.init()
|
||||||
|
|
||||||
is_init = True
|
is_init = True
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
@@ -14,6 +15,7 @@ import datetime
|
|||||||
# Local import
|
# Local import
|
||||||
from . import debug
|
from . import debug
|
||||||
from . import heritage
|
from . import heritage
|
||||||
|
from . import env
|
||||||
|
|
||||||
##
|
##
|
||||||
## constitution of dictionnary:
|
## constitution of dictionnary:
|
||||||
@@ -23,26 +25,37 @@ from . import heritage
|
|||||||
## - "builder": pointer on the element
|
## - "builder": pointer on the element
|
||||||
##
|
##
|
||||||
builder_list=[]
|
builder_list=[]
|
||||||
__start_builder_name="lutinBuilder_"
|
__start_builder_name="Builder_"
|
||||||
|
|
||||||
|
|
||||||
def import_path(path):
|
def import_path(path_list):
|
||||||
global builder_list
|
global builder_list
|
||||||
matches = []
|
global_base = env.get_build_system_base_name()
|
||||||
debug.debug('BUILDER: Start find sub File : "%s"' %path)
|
debug.debug("BUILDER: Init with Files list:")
|
||||||
for root, dirnames, filenames in os.walk(path):
|
for elem in path_list:
|
||||||
tmpList = fnmatch.filter(filenames, __start_builder_name + "*.py")
|
sys.path.append(os.path.dirname(elem))
|
||||||
# Import the module :
|
# Get file name:
|
||||||
for filename in tmpList:
|
filename = os.path.basename(elem)
|
||||||
debug.debug('BUILDER: Find a file : "%s"' %os.path.join(root, filename))
|
# Remove .py at the end:
|
||||||
#matches.append(os.path.join(root, filename))
|
filename = filename[:-3]
|
||||||
sys.path.append(os.path.dirname(os.path.join(root, filename)) )
|
base_file_name = filename
|
||||||
builder_name = filename.replace('.py', '')
|
# Remove global base name:
|
||||||
the_builder = __import__(builder_name)
|
filename = filename[len(global_base):]
|
||||||
builder_list.append({"name":builder_name,
|
# Check if it start with the local patern:
|
||||||
"element":the_builder
|
if filename[:len(__start_builder_name)] != __start_builder_name:
|
||||||
})
|
debug.extreme_verbose("BUILDER: Integrate: '" + filename + "' from '" + elem + "' ==> rejected")
|
||||||
debug.debug('BUILDER: type=' + the_builder.get_type() + " in=" + str(the_builder.get_input_type()) + " out=" + str(the_builder.get_output_type()))
|
continue
|
||||||
|
# Remove local patern
|
||||||
|
builder_name = filename[len(__start_builder_name):]
|
||||||
|
debug.verbose("BUILDER: Integrate: '" + builder_name + "' from '" + elem + "'")
|
||||||
|
the_builder = __import__(base_file_name)
|
||||||
|
builder_list.append({"name":builder_name,
|
||||||
|
"element":the_builder
|
||||||
|
})
|
||||||
|
debug.debug('BUILDER: type=' + the_builder.get_type() + " in=" + str(the_builder.get_input_type()) + " out=" + str(the_builder.get_output_type()))
|
||||||
|
debug.verbose("List of BUILDER: ")
|
||||||
|
for elem in builder_list:
|
||||||
|
debug.verbose(" " + str(elem["name"]))
|
||||||
|
|
||||||
# we must have call all import before ...
|
# we must have call all import before ...
|
||||||
def init():
|
def init():
|
||||||
|
136
lutin/debug.py
136
lutin/debug.py
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
@@ -11,8 +12,8 @@ import os
|
|||||||
import threading
|
import threading
|
||||||
import re
|
import re
|
||||||
|
|
||||||
debugLevel=3
|
debug_level=3
|
||||||
debugColor=False
|
debug_color=False
|
||||||
|
|
||||||
color_default= ""
|
color_default= ""
|
||||||
color_red = ""
|
color_red = ""
|
||||||
@@ -23,20 +24,20 @@ color_purple = ""
|
|||||||
color_cyan = ""
|
color_cyan = ""
|
||||||
|
|
||||||
|
|
||||||
debugLock = threading.Lock()
|
debug_lock = threading.Lock()
|
||||||
|
|
||||||
def set_level(id):
|
def set_level(id):
|
||||||
global debugLevel
|
global debug_level
|
||||||
debugLevel = id
|
debug_level = id
|
||||||
#print "SetDebug level at " + str(debugLevel)
|
#print "SetDebug level at " + str(debug_level)
|
||||||
|
|
||||||
def get_level():
|
def get_level():
|
||||||
global debugLevel
|
global debug_level
|
||||||
return debugLevel
|
return debug_level
|
||||||
|
|
||||||
def enable_color():
|
def enable_color():
|
||||||
global debugColor
|
global debug_color
|
||||||
debugColor = True
|
debug_color = True
|
||||||
global color_default
|
global color_default
|
||||||
color_default= "\033[00m"
|
color_default= "\033[00m"
|
||||||
global color_red
|
global color_red
|
||||||
@@ -52,81 +53,108 @@ def enable_color():
|
|||||||
global color_cyan
|
global color_cyan
|
||||||
color_cyan = "\033[36m"
|
color_cyan = "\033[36m"
|
||||||
|
|
||||||
|
def disable_color():
|
||||||
|
global debug_color
|
||||||
|
debug_color = True
|
||||||
|
global color_default
|
||||||
|
color_default= ""
|
||||||
|
global color_red
|
||||||
|
color_red = ""
|
||||||
|
global color_green
|
||||||
|
color_green = ""
|
||||||
|
global color_yellow
|
||||||
|
color_yellow = ""
|
||||||
|
global color_blue
|
||||||
|
color_blue = ""
|
||||||
|
global color_purple
|
||||||
|
color_purple = ""
|
||||||
|
global color_cyan
|
||||||
|
color_cyan = ""
|
||||||
|
|
||||||
def extreme_verbose(input, force=False):
|
def extreme_verbose(input, force=False):
|
||||||
global debugLock
|
global debug_lock
|
||||||
global debugLevel
|
global debug_level
|
||||||
if debugLevel >= 6 \
|
if debug_level >= 6 \
|
||||||
or force == True:
|
or force == True:
|
||||||
debugLock.acquire()
|
debug_lock.acquire()
|
||||||
print(color_blue + input + color_default)
|
print(color_blue + input + color_default)
|
||||||
debugLock.release()
|
debug_lock.release()
|
||||||
|
|
||||||
def verbose(input, force=False):
|
def verbose(input, force=False):
|
||||||
global debugLock
|
global debug_lock
|
||||||
global debugLevel
|
global debug_level
|
||||||
if debugLevel >= 5 \
|
if debug_level >= 5 \
|
||||||
or force == True:
|
or force == True:
|
||||||
debugLock.acquire()
|
debug_lock.acquire()
|
||||||
print(color_blue + input + color_default)
|
print(color_blue + input + color_default)
|
||||||
debugLock.release()
|
debug_lock.release()
|
||||||
|
|
||||||
def debug(input, force=False):
|
def debug(input, force=False):
|
||||||
global debugLock
|
global debug_lock
|
||||||
global debugLevel
|
global debug_level
|
||||||
if debugLevel >= 4 \
|
if debug_level >= 4 \
|
||||||
or force == True:
|
or force == True:
|
||||||
debugLock.acquire()
|
debug_lock.acquire()
|
||||||
print(color_green + input + color_default)
|
print(color_green + input + color_default)
|
||||||
debugLock.release()
|
debug_lock.release()
|
||||||
|
|
||||||
def info(input, force=False):
|
def info(input, force=False):
|
||||||
global debugLock
|
global debug_lock
|
||||||
global debugLevel
|
global debug_level
|
||||||
if debugLevel >= 3 \
|
if debug_level >= 3 \
|
||||||
or force == True:
|
or force == True:
|
||||||
debugLock.acquire()
|
debug_lock.acquire()
|
||||||
print(input + color_default)
|
print(input + color_default)
|
||||||
debugLock.release()
|
debug_lock.release()
|
||||||
|
|
||||||
def warning(input, force=False):
|
def warning(input, force=False):
|
||||||
global debugLock
|
global debug_lock
|
||||||
global debugLevel
|
global debug_level
|
||||||
if debugLevel >= 2 \
|
if debug_level >= 2 \
|
||||||
or force == True:
|
or force == True:
|
||||||
debugLock.acquire()
|
debug_lock.acquire()
|
||||||
print(color_purple + "[WARNING] " + input + color_default)
|
print(color_purple + "[WARNING] " + input + color_default)
|
||||||
debugLock.release()
|
debug_lock.release()
|
||||||
|
|
||||||
def error(input, threadID=-1, force=False, crash=True):
|
def todo(input, force=False):
|
||||||
global debugLock
|
global debug_lock
|
||||||
global debugLevel
|
global debug_level
|
||||||
if debugLevel >= 1 \
|
if debug_level >= 3 \
|
||||||
or force == True:
|
or force == True:
|
||||||
debugLock.acquire()
|
debug_lock.acquire()
|
||||||
|
print(color_purple + "[TODO] " + input + color_default)
|
||||||
|
debug_lock.release()
|
||||||
|
|
||||||
|
def error(input, thread_id=-1, force=False, crash=True):
|
||||||
|
global debug_lock
|
||||||
|
global debug_level
|
||||||
|
if debug_level >= 1 \
|
||||||
|
or force == True:
|
||||||
|
debug_lock.acquire()
|
||||||
print(color_red + "[ERROR] " + input + color_default)
|
print(color_red + "[ERROR] " + input + color_default)
|
||||||
debugLock.release()
|
debug_lock.release()
|
||||||
if crash==True:
|
if crash == True:
|
||||||
from . import multiprocess
|
from . import multiprocess
|
||||||
multiprocess.error_occured()
|
multiprocess.set_error_occured()
|
||||||
if threadID != -1:
|
if thread_id != -1:
|
||||||
threading.interrupt_main()
|
threading.interrupt_main()
|
||||||
exit(-1)
|
exit(-1)
|
||||||
#os_exit(-1)
|
#os_exit(-1)
|
||||||
#raise "error happend"
|
#raise "error happend"
|
||||||
|
|
||||||
def print_element(type, lib, dir, name, force=False):
|
def print_element(type, lib, dir, name, force=False):
|
||||||
global debugLock
|
global debug_lock
|
||||||
global debugLevel
|
global debug_level
|
||||||
if debugLevel >= 3 \
|
if debug_level >= 3 \
|
||||||
or force == True:
|
or force == True:
|
||||||
debugLock.acquire()
|
debug_lock.acquire()
|
||||||
print(color_cyan + type + color_default + " : " + color_yellow + lib + color_default + " " + dir + " " + color_blue + name + color_default)
|
print(color_cyan + type + color_default + " : " + color_yellow + lib + color_default + " " + dir + " " + color_blue + name + color_default)
|
||||||
debugLock.release()
|
debug_lock.release()
|
||||||
|
|
||||||
def print_compilator(myString):
|
def print_compilator(myString):
|
||||||
global debugColor
|
global debug_color
|
||||||
global debugLock
|
global debug_lock
|
||||||
if debugColor == True:
|
if debug_color == True:
|
||||||
myString = myString.replace('\\n', '\n')
|
myString = myString.replace('\\n', '\n')
|
||||||
myString = myString.replace('\\t', '\t')
|
myString = myString.replace('\\t', '\t')
|
||||||
myString = myString.replace('error:', color_red+'error:'+color_default)
|
myString = myString.replace('error:', color_red+'error:'+color_default)
|
||||||
@@ -136,9 +164,9 @@ def print_compilator(myString):
|
|||||||
myString = myString.replace('-COLORIN-', color_yellow)
|
myString = myString.replace('-COLORIN-', color_yellow)
|
||||||
myString = myString.replace('-COLOROUT-', color_default)
|
myString = myString.replace('-COLOROUT-', color_default)
|
||||||
|
|
||||||
debugLock.acquire()
|
debug_lock.acquire()
|
||||||
print(myString)
|
print(myString)
|
||||||
debugLock.release()
|
debug_lock.release()
|
||||||
|
|
||||||
def get_color_set() :
|
def get_color_set() :
|
||||||
global color_default
|
global color_default
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
|
130
lutin/env.py
130
lutin/env.py
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
@@ -25,6 +26,66 @@ 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
|
||||||
|
|
||||||
|
def set_parse_depth(val):
|
||||||
|
global parse_depth
|
||||||
|
parse_depth = val
|
||||||
|
debug.debug("Set depth search element: " + str(parse_depth))
|
||||||
|
|
||||||
|
def get_parse_depth():
|
||||||
|
global parse_depth
|
||||||
|
return parse_depth
|
||||||
|
|
||||||
|
exclude_search_path = []
|
||||||
|
|
||||||
|
def set_exclude_search_path(val):
|
||||||
|
global exclude_search_path
|
||||||
|
exclude_search_path = val
|
||||||
|
debug.debug("Set depth search element: " + str(exclude_search_path))
|
||||||
|
|
||||||
|
def get_exclude_search_path():
|
||||||
|
global exclude_search_path
|
||||||
|
return exclude_search_path
|
||||||
|
|
||||||
|
|
||||||
|
build_system_base_name = "lutin"
|
||||||
|
|
||||||
|
def set_build_system_base_name(val):
|
||||||
|
global build_system_base_name
|
||||||
|
build_system_base_name = val
|
||||||
|
debug.debug("Set basename: '" + str(build_system_base_name) + "'")
|
||||||
|
|
||||||
|
def get_build_system_base_name():
|
||||||
|
global build_system_base_name
|
||||||
|
return build_system_base_name
|
||||||
|
|
||||||
|
|
||||||
print_pretty_mode=False
|
print_pretty_mode=False
|
||||||
|
|
||||||
@@ -76,38 +137,55 @@ def print_pretty(my_string, force=False):
|
|||||||
baseElementList = []
|
baseElementList = []
|
||||||
if end_with(cmdApplication, ["javac"]) == True:
|
if end_with(cmdApplication, ["javac"]) == True:
|
||||||
baseElementList = [
|
baseElementList = [
|
||||||
"-d",
|
"-d",
|
||||||
"-D",
|
"-D",
|
||||||
"-classpath",
|
"-classpath",
|
||||||
"-sourcepath"
|
"-sourcepath"
|
||||||
]
|
]
|
||||||
|
elif end_with(cmdApplication, ["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",
|
||||||
"-C"
|
"-C"
|
||||||
]
|
]
|
||||||
elif end_with(cmdApplication, ["aapt"]) == True:
|
elif end_with(cmdApplication, ["aapt"]) == True:
|
||||||
baseElementList = [
|
baseElementList = [
|
||||||
"-M",
|
"-M",
|
||||||
"-F",
|
"-F",
|
||||||
"-I",
|
"-I",
|
||||||
"-S",
|
"-S",
|
||||||
"-J"
|
"-J"
|
||||||
]
|
]
|
||||||
elif end_with(cmdApplication, ["g++", "gcc", "clang", "clang++", "ar", "ld", "ranlib"]) == True:
|
elif end_with(cmdApplication, ["g++", "gcc", "clang", "clang++", "ar", "ld", "ranlib"]) == True:
|
||||||
baseElementList = [
|
baseElementList = [
|
||||||
"-o",
|
"-o",
|
||||||
"-D",
|
"-D",
|
||||||
"-I",
|
"-I",
|
||||||
"-L",
|
"-L",
|
||||||
"-framework",
|
"-framework",
|
||||||
"-isysroot",
|
"-isysroot",
|
||||||
"-arch",
|
"-arch",
|
||||||
"-keystore",
|
"-keystore",
|
||||||
"-sigalg",
|
"-sigalg",
|
||||||
"-digestalg",
|
"-digestalg",
|
||||||
"-target",
|
"-target",
|
||||||
"-gcc-toolchain"]
|
"-gcc-toolchain",
|
||||||
|
"-current_version",
|
||||||
|
"-compatibility_version"
|
||||||
|
]
|
||||||
|
|
||||||
for element in baseElementList:
|
for element in baseElementList:
|
||||||
tmpcmdLine = tmpcmdLine.replace(element+'\n\t', element+' ')
|
tmpcmdLine = tmpcmdLine.replace(element+'\n\t', element+' ')
|
||||||
for element in ["<", "<<", ">", ">>"]:
|
for element in ["<", "<<", ">", ">>"]:
|
||||||
|
@@ -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,61 +73,86 @@ 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:
|
||||||
if flags in ["c-version", "c++-version"]:
|
# get value
|
||||||
continue
|
|
||||||
value = element.flags[flags]
|
value = element.flags[flags]
|
||||||
if flags not in self.flags:
|
# if it is a list, simply add element on the previous one
|
||||||
self.flags[flags] = value
|
if type(value) == list:
|
||||||
else:
|
if flags not in self.flags:
|
||||||
append_to_list(self.flags[flags], value)
|
self.flags[flags] = value
|
||||||
|
else:
|
||||||
|
append_to_list(self.flags[flags], value)
|
||||||
|
elif type(value) == bool:
|
||||||
|
if flags not in self.flags:
|
||||||
|
self.flags[flags] = value
|
||||||
|
else:
|
||||||
|
# keep only true, if false ==> bad case ...
|
||||||
|
if self.flags[flags] == True \
|
||||||
|
or value == True:
|
||||||
|
self.flags[flags] = True
|
||||||
|
elif type(value) == int:
|
||||||
|
# case of "c-version", "c++-version"
|
||||||
|
if flags not in self.flags:
|
||||||
|
self.flags[flags] = value
|
||||||
|
else:
|
||||||
|
# keep only true, if false ==> bad case ...
|
||||||
|
if 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]
|
||||||
if "c-version" in element.flags:
|
self.path[ppp] = []
|
||||||
ver = element.flags["c-version"]
|
for iii in reversed(tmp):
|
||||||
if "c-version" in self.flags:
|
self.path[ppp].append(iii)
|
||||||
if self.flags["c-version"] > ver:
|
debug.extreme_verbose("Path : " + str(self.path))
|
||||||
ver = self.flags["c-version"]
|
|
||||||
self.flags["c-version"] = ver
|
|
||||||
if "c++-version" in element.flags:
|
|
||||||
ver = element.flags["c++-version"]
|
|
||||||
if "c++-version" in self.flags:
|
|
||||||
if self.flags["c++-version"] > ver:
|
|
||||||
ver = self.flags["c++-version"]
|
|
||||||
self.flags["c++-version"] = ver
|
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "{HeritageList:" + str(self.list_heritage) + "}"
|
||||||
|
|
||||||
class heritage:
|
class heritage:
|
||||||
def __init__(self, module, target):
|
def __init__(self, module, target):
|
||||||
@@ -149,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:
|
||||||
@@ -202,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)
|
||||||
@@ -220,4 +247,7 @@ class heritage:
|
|||||||
ver = self.flags["c++-version"]
|
ver = self.flags["c++-version"]
|
||||||
self.flags["c++-version"] = ver
|
self.flags["c++-version"] = ver
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "{Heritage:" + str(self.name) + " ... }"
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
@@ -35,10 +36,13 @@ def get_pow_2_multiple(size):
|
|||||||
# check if time change
|
# check if time change
|
||||||
# check if command line change
|
# check if command line change
|
||||||
def resize(src_file, dest_file, x, y, cmd_file=None):
|
def resize(src_file, dest_file, x, y, cmd_file=None):
|
||||||
if enable_resize_image == False:
|
|
||||||
return
|
|
||||||
if os.path.exists(src_file) == False:
|
if os.path.exists(src_file) == False:
|
||||||
debug.error("Request a resize an image that does not existed : '" + src_file + "'")
|
debug.error("Request a resize an image that does not existed : '" + src_file + "'")
|
||||||
|
return
|
||||||
|
if enable_resize_image == False:
|
||||||
|
debug.warning("Can not resize image missing pillow or CoreGraphics : '" + src_file + "' (just copy)")
|
||||||
|
tools.copy_file(src_file, dest_file)
|
||||||
|
return
|
||||||
cmd_line = "resize Image : " + src_file + " ==> " + dest_file + " newSize=(" + str(x) + "x" + str(y) + ")"
|
cmd_line = "resize Image : " + src_file + " ==> " + dest_file + " newSize=(" + str(x) + "x" + str(y) + ")"
|
||||||
if depend.need_re_build(dest_file, src_file, file_cmd=cmd_file , cmd_line=cmd_line) == False:
|
if depend.need_re_build(dest_file, src_file, file_cmd=cmd_file , cmd_line=cmd_line) == False:
|
||||||
return
|
return
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
|
467
lutin/module.py
467
lutin/module.py
@@ -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
|
||||||
@@ -20,6 +22,7 @@ from . import builder
|
|||||||
from . import multiprocess
|
from . import multiprocess
|
||||||
from . import image
|
from . import image
|
||||||
from . import license
|
from . import license
|
||||||
|
from . import env
|
||||||
|
|
||||||
class Module:
|
class Module:
|
||||||
|
|
||||||
@@ -41,6 +44,8 @@ class Module:
|
|||||||
self.type='LIBRARY'
|
self.type='LIBRARY'
|
||||||
# Name of the module
|
# Name of the module
|
||||||
self.name=module_name
|
self.name=module_name
|
||||||
|
# Tools list:
|
||||||
|
self.tools = []
|
||||||
# Dependency list:
|
# Dependency list:
|
||||||
self.depends = []
|
self.depends = []
|
||||||
# Dependency list (optionnal module):
|
# Dependency list (optionnal module):
|
||||||
@@ -73,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)
|
||||||
@@ -100,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,
|
||||||
@@ -119,9 +126,14 @@ 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):
|
||||||
|
return "{lutin.Module:" + str(self.name) + "}"
|
||||||
|
|
||||||
def get_type(self):
|
def get_type(self):
|
||||||
return self.type
|
return self.type
|
||||||
@@ -156,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" \
|
||||||
@@ -177,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)
|
||||||
@@ -193,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)))
|
||||||
@@ -222,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)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -230,12 +254,38 @@ class Module:
|
|||||||
if self.type == 'PREBUILD':
|
if self.type == 'PREBUILD':
|
||||||
debug.error("Can not generate gcov on prebuid system ... : '" + self.name + "'");
|
debug.error("Can not generate gcov on prebuid system ... : '" + self.name + "'");
|
||||||
return
|
return
|
||||||
|
# list of path that can apear in the output data :
|
||||||
|
gcov_path_file = []
|
||||||
|
gcov_path_file.append(target.get_build_path_include(self.name)) # for include (that is installed)
|
||||||
|
gcov_path_file.append(" " + target.get_build_path_include(self.name))
|
||||||
|
gcov_path_file.append(self.origin_path) # for sources.
|
||||||
|
gcov_path_file.append(" " + self.origin_path)
|
||||||
|
# squash header and src...
|
||||||
|
full_list_file = []
|
||||||
|
for elem in self.header:
|
||||||
|
debug.extreme_verbose("plop H : " +str(elem['src']))
|
||||||
|
full_list_file.append([self.name, elem['src']])
|
||||||
|
for elem in self.src:
|
||||||
|
debug.extreme_verbose("plop S : " +str(elem))
|
||||||
|
full_list_file.append([self.name, elem])
|
||||||
|
for mod_name in self.tools:
|
||||||
|
tool_module = load_module(target, mod_name)
|
||||||
|
if tool_module == None:
|
||||||
|
continue
|
||||||
|
for elem in tool_module.header:
|
||||||
|
debug.extreme_verbose("plop HH: " + ":" + str(elem['src']))
|
||||||
|
full_list_file.append([tool_module.name, elem['src']])
|
||||||
|
for elem in tool_module.src:
|
||||||
|
debug.extreme_verbose("plop SS: " + tool_module.name + ":" + str(elem))
|
||||||
|
full_list_file.append([tool_module.name, elem])
|
||||||
|
debug.extreme_verbose("plop F : " +str(self.extention_order_build))
|
||||||
# remove uncompilable elements:
|
# remove uncompilable elements:
|
||||||
list_file = tools.filter_extention(self.src, self.extention_order_build, True)
|
# TODO: list_file = tools.filter_extention(full_list_file, self.extention_order_build, True)
|
||||||
|
list_file = full_list_file;
|
||||||
global_list_file = ""
|
global_list_file = ""
|
||||||
for file in list_file:
|
for file in list_file:
|
||||||
debug.verbose(" gcov : " + self.name + " <== " + file);
|
debug.verbose(" gcov : " + self.name + " <== " + str(file));
|
||||||
file_dst = target.get_full_name_destination(self.name, self.origin_path, file, "o")
|
file_dst = target.get_full_name_destination(file[0], self.origin_path, file[1], "o")
|
||||||
global_list_file += file_dst + " "
|
global_list_file += file_dst + " "
|
||||||
cmd = "gcov"
|
cmd = "gcov"
|
||||||
# specify the version of gcov we need to use
|
# specify the version of gcov we need to use
|
||||||
@@ -257,39 +307,80 @@ class Module:
|
|||||||
executed_lines = 0
|
executed_lines = 0
|
||||||
executable_lines = 0
|
executable_lines = 0
|
||||||
for elem in ret:
|
for elem in ret:
|
||||||
|
debug.debug("line: " + elem)
|
||||||
if remove_next == True:
|
if remove_next == True:
|
||||||
remove_next = False
|
remove_next = False
|
||||||
|
debug.debug("--------------------------")
|
||||||
continue;
|
continue;
|
||||||
if elem[:10] == "Creating '" \
|
if elem[:10] == "Creating '" \
|
||||||
or elem[:10] == "Removing '":
|
or elem[:10] == "Removing '" \
|
||||||
|
or elem[:14] == "Suppression de" \
|
||||||
|
or elem[:11] == "Création de":
|
||||||
remove_next = True
|
remove_next = True
|
||||||
continue
|
continue
|
||||||
if elem[:6] == "File '" \
|
if elem[:6] in ["File '", "File «"] \
|
||||||
and self.origin_path != elem[6:len(self.origin_path)+6]:
|
or elem[:7] in ["File ' ", "File « "]:
|
||||||
remove_next = True
|
path_finder = False
|
||||||
|
for path_base_finder in gcov_path_file:
|
||||||
|
if path_base_finder == elem[6:len(path_base_finder)+6]:
|
||||||
|
path_finder = True
|
||||||
|
last_file = elem[6+len(path_base_finder)+1:-1]
|
||||||
|
while last_file[-1] == " ":
|
||||||
|
last_file = last_file[:-1]
|
||||||
|
if path_finder == False:
|
||||||
|
remove_next = True
|
||||||
|
debug.verbose(" REMOVE: '" + str(elem[6:len(self.origin_path)+1]) + "' not in " + str(gcov_path_file))
|
||||||
|
continue
|
||||||
continue
|
continue
|
||||||
if elem[:6] == "File '":
|
if elem[:7] == "Aucune " \
|
||||||
last_file = elem[6+len(self.origin_path)+1:-1]
|
or elem[:19] == "No executable lines":
|
||||||
|
debug.verbose(" Nothing to execute");
|
||||||
continue
|
continue
|
||||||
start_with = "Lines executed:"
|
start_with = ["Lines executed:", "Lignes exécutées:"]
|
||||||
if elem[:len(start_with)] != start_with:
|
find = False
|
||||||
|
for line_base in start_with:
|
||||||
|
if elem[:len(line_base)] == line_base:
|
||||||
|
find = True
|
||||||
|
elem = elem[len(line_base):]
|
||||||
|
break;
|
||||||
|
debug.verbose(" temp Value: " + str(elem))
|
||||||
|
if find == False:
|
||||||
debug.warning(" gcov ret : " + str(elem));
|
debug.warning(" gcov ret : " + str(elem));
|
||||||
debug.warning(" ==> does not start with : " + start_with);
|
debug.warning(" ==> does not start with : " + str(start_with));
|
||||||
debug.warning(" Parsing error");
|
debug.warning(" Parsing error");
|
||||||
continue
|
continue
|
||||||
out = elem[len(start_with):].split("% of ")
|
out = elem.split("% of ")
|
||||||
if len(out) != 2:
|
if len(out) != 2:
|
||||||
debug.warning(" gcov ret : " + str(elem));
|
out = elem.split("% de ")
|
||||||
debug.warning(" Parsing error of '% of '");
|
if len(out) != 2:
|
||||||
continue
|
debug.warning(" gcov ret : " + str(elem));
|
||||||
|
debug.warning(" Parsing error of '% of '");
|
||||||
|
continue
|
||||||
|
debug.verbose("property : " + str(out))
|
||||||
pourcent = float(out[0])
|
pourcent = float(out[0])
|
||||||
total_line_count = int(out[1])
|
total_line_count = int(out[1])
|
||||||
total_executed_line = int(float(total_line_count)*pourcent/100.0)
|
total_executed_line = int(float(total_line_count)*pourcent/100.0)
|
||||||
|
# check if in source or header:
|
||||||
|
in_source_file = False
|
||||||
|
debug.verbose(" ??> Check: " + str(last_file))
|
||||||
|
for elem_header in self.header:
|
||||||
|
debug.verbose(" ==> Check: " + str(elem_header['src']))
|
||||||
|
if elem_header['src'] == last_file:
|
||||||
|
in_source_file = True
|
||||||
|
for elem_src in self.src:
|
||||||
|
debug.verbose(" ==> Check: " + str(elem_src))
|
||||||
|
if elem_src == last_file:
|
||||||
|
in_source_file = True
|
||||||
|
if in_source_file == False:
|
||||||
|
debug.verbose(" ==> Remove not in source: " + str(out))
|
||||||
|
continue
|
||||||
useful_list.append([last_file, pourcent, total_executed_line, total_line_count])
|
useful_list.append([last_file, pourcent, total_executed_line, total_line_count])
|
||||||
executed_lines += total_executed_line
|
executed_lines += total_executed_line
|
||||||
executable_lines += total_line_count
|
executable_lines += total_line_count
|
||||||
last_file = ""
|
last_file = ""
|
||||||
|
debug.debug("--------------------------")
|
||||||
ret = useful_list[:-1]
|
ret = useful_list[:-1]
|
||||||
|
debug.verbose("plopppp " + str(useful_list))
|
||||||
#for elem in ret:
|
#for elem in ret:
|
||||||
# debug.info(" " + str(elem));
|
# debug.info(" " + str(elem));
|
||||||
for elem in ret:
|
for elem in ret:
|
||||||
@@ -299,7 +390,11 @@ 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]));
|
||||||
pourcent = 100.0*float(executed_lines)/float(executable_lines)
|
debug.verbose(" " + str(elem[2]) + " / " + str(elem[3]));
|
||||||
|
try:
|
||||||
|
pourcent = 100.0*float(executed_lines)/float(executable_lines)
|
||||||
|
except ZeroDivisionError:
|
||||||
|
pourcent = 0.0
|
||||||
# generate json file:
|
# generate json file:
|
||||||
json_file_name = target.get_build_path(self.name) + "/" + self.name + "_coverage.json"
|
json_file_name = target.get_build_path(self.name) + "/" + self.name + "_coverage.json"
|
||||||
debug.debug("generate json file : " + json_file_name)
|
debug.debug("generate json file : " + json_file_name)
|
||||||
@@ -327,14 +422,16 @@ class Module:
|
|||||||
tmp_file.close()
|
tmp_file.close()
|
||||||
# print debug:
|
# print debug:
|
||||||
debug.print_element("coverage", self.name, ":", str(pourcent) + "% " + str(executed_lines) + "/" + str(executable_lines))
|
debug.print_element("coverage", self.name, ":", str(pourcent) + "% " + str(executed_lines) + "/" + str(executable_lines))
|
||||||
|
return True
|
||||||
|
|
||||||
# call here to build the module
|
# call here to build the module
|
||||||
def build(self, target, package_name):
|
def build(self, target, package_name):
|
||||||
# ckeck if not previously build
|
# ckeck if not previously build
|
||||||
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)
|
||||||
|
|
||||||
@@ -352,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);
|
||||||
@@ -388,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)
|
||||||
@@ -404,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:
|
||||||
@@ -416,6 +566,9 @@ class Module:
|
|||||||
fileExt = file.split(".")[-1]
|
fileExt = file.split(".")[-1]
|
||||||
try:
|
try:
|
||||||
tmp_builder = builder.get_builder(fileExt);
|
tmp_builder = builder.get_builder(fileExt);
|
||||||
|
multithreading = tmp_builder.get_support_multithreading()
|
||||||
|
if multithreading == False:
|
||||||
|
multiprocess.pool_synchrosize()
|
||||||
res_file = tmp_builder.compile(file,
|
res_file = tmp_builder.compile(file,
|
||||||
package_name,
|
package_name,
|
||||||
target,
|
target,
|
||||||
@@ -425,6 +578,8 @@ class Module:
|
|||||||
name = self.name,
|
name = self.name,
|
||||||
basic_path = self.origin_path,
|
basic_path = self.origin_path,
|
||||||
module_src = self.src)
|
module_src = self.src)
|
||||||
|
if multithreading == False:
|
||||||
|
multiprocess.pool_synchrosize()
|
||||||
if res_file["action"] == "add":
|
if res_file["action"] == "add":
|
||||||
list_sub_file_needed_to_build.append(res_file["file"])
|
list_sub_file_needed_to_build.append(res_file["file"])
|
||||||
elif res_file["action"] == "path":
|
elif res_file["action"] == "path":
|
||||||
@@ -439,7 +594,10 @@ class Module:
|
|||||||
#debug.info(" " + self.name + " <== " + file);
|
#debug.info(" " + self.name + " <== " + file);
|
||||||
fileExt = file.split(".")[-1]
|
fileExt = file.split(".")[-1]
|
||||||
try:
|
try:
|
||||||
tmp_builder = builder.get_builder(fileExt);
|
tmp_builder = builder.get_builder(fileExt)
|
||||||
|
multithreading = tmp_builder.get_support_multithreading()
|
||||||
|
if multithreading == False:
|
||||||
|
multiprocess.pool_synchrosize()
|
||||||
res_file = tmp_builder.compile(file,
|
res_file = tmp_builder.compile(file,
|
||||||
package_name,
|
package_name,
|
||||||
target,
|
target,
|
||||||
@@ -449,6 +607,8 @@ class Module:
|
|||||||
name = self.name,
|
name = self.name,
|
||||||
basic_path = self.origin_path,
|
basic_path = self.origin_path,
|
||||||
module_src = self.src)
|
module_src = self.src)
|
||||||
|
if multithreading == False:
|
||||||
|
multiprocess.pool_synchrosize()
|
||||||
if res_file["action"] == "add":
|
if res_file["action"] == "add":
|
||||||
list_sub_file_needed_to_build.append(res_file["file"])
|
list_sub_file_needed_to_build.append(res_file["file"])
|
||||||
elif res_file["action"] == "path":
|
elif res_file["action"] == "path":
|
||||||
@@ -459,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 --
|
||||||
# ----------------------------------------------------
|
# ----------------------------------------------------
|
||||||
@@ -616,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()
|
||||||
@@ -672,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':
|
||||||
@@ -686,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
|
||||||
@@ -695,9 +838,13 @@ 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)
|
||||||
|
|
||||||
|
def add_tools(self, list):
|
||||||
|
tools.list_append_to(self.tools, list, True)
|
||||||
|
|
||||||
def add_module_depend(self, list):
|
def add_module_depend(self, list):
|
||||||
tools.list_append_to(self.depends, list, True)
|
tools.list_append_to(self.depends, list, True)
|
||||||
|
|
||||||
@@ -711,6 +858,7 @@ class Module:
|
|||||||
tools.list_append_to_2(self.flags["export"], type, list)
|
tools.list_append_to_2(self.flags["export"], type, list)
|
||||||
|
|
||||||
# add the link flag at the module
|
# add the link flag at the module
|
||||||
|
# TODO : Rename this in add_flag
|
||||||
def compile_flags(self, type, list):
|
def compile_flags(self, type, list):
|
||||||
tools.list_append_to_2(self.flags["local"], type, list)
|
tools.list_append_to_2(self.flags["local"], type, list)
|
||||||
|
|
||||||
@@ -750,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)
|
||||||
|
|
||||||
@@ -791,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('-----------------------------------------------')
|
||||||
@@ -815,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:
|
||||||
@@ -884,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:
|
||||||
@@ -925,29 +1167,32 @@ class Module:
|
|||||||
self.ext_project_add_module(target, projectMng)
|
self.ext_project_add_module(target, projectMng)
|
||||||
projectMng.generate_project_file()
|
projectMng.generate_project_file()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
module_list=[]
|
module_list=[]
|
||||||
__start_module_name="lutin_"
|
__start_module_name="_"
|
||||||
|
|
||||||
def import_path(path):
|
def import_path(path_list):
|
||||||
global module_list
|
global module_list
|
||||||
matches = []
|
global_base = env.get_build_system_base_name()
|
||||||
debug.debug('MODULE: Start find sub File : "%s"' %path)
|
debug.debug("MODULE: Init with Files list:")
|
||||||
for root, dirnames, filenames in os.walk(path):
|
for elem in path_list:
|
||||||
tmpList = fnmatch.filter(filenames, __start_module_name + "*.py")
|
sys.path.append(os.path.dirname(elem))
|
||||||
# Import the module :
|
# Get file name:
|
||||||
for filename in tmpList:
|
filename = os.path.basename(elem)
|
||||||
debug.debug('Module: Find a file : "%s"' %os.path.join(root, filename))
|
# Remove .py at the end:
|
||||||
#matches.append(os.path.join(root, filename))
|
filename = filename[:-3]
|
||||||
sys.path.append(os.path.dirname(os.path.join(root, filename)) )
|
# Remove global base name:
|
||||||
module_name = filename.replace('.py', '')
|
filename = filename[len(global_base):]
|
||||||
module_name = module_name.replace(__start_module_name, '')
|
# Check if it start with the local patern:
|
||||||
debug.debug("MODULE: Integrate module: '" + module_name + "' from '" + os.path.join(root, filename) + "'")
|
if filename[:len(__start_module_name)] != __start_module_name:
|
||||||
module_list.append([module_name, os.path.join(root, filename)])
|
debug.extreme_verbose("MODULE: NOT-Integrate: '" + filename + "' from '" + elem + "' ==> rejected")
|
||||||
|
continue
|
||||||
|
# Remove local patern
|
||||||
|
module_name = filename[len(__start_module_name):]
|
||||||
|
debug.verbose("MODULE: Integrate: '" + module_name + "' from '" + elem + "'")
|
||||||
|
module_list.append([module_name, elem])
|
||||||
debug.verbose("New list module: ")
|
debug.verbose("New list module: ")
|
||||||
for mod in module_list:
|
for elem in module_list:
|
||||||
debug.verbose(" " + str(mod[0]))
|
debug.verbose(" " + str(elem[0]))
|
||||||
|
|
||||||
def exist(target, name):
|
def exist(target, name):
|
||||||
global module_list
|
global module_list
|
||||||
@@ -961,9 +1206,9 @@ def load_module(target, name):
|
|||||||
for mod in module_list:
|
for mod in module_list:
|
||||||
if mod[0] == name:
|
if mod[0] == name:
|
||||||
sys.path.append(os.path.dirname(mod[1]))
|
sys.path.append(os.path.dirname(mod[1]))
|
||||||
debug.verbose("import module : '" + __start_module_name + name + "'")
|
debug.verbose("import module : '" + env.get_build_system_base_name() + __start_module_name + name + "'")
|
||||||
the_module_file = mod[1]
|
the_module_file = mod[1]
|
||||||
the_module = __import__(__start_module_name + name)
|
the_module = __import__(env.get_build_system_base_name() + __start_module_name + name)
|
||||||
# get basic module properties:
|
# get basic module properties:
|
||||||
property = get_module_option(the_module, name)
|
property = get_module_option(the_module, name)
|
||||||
# configure the module:
|
# configure the module:
|
||||||
@@ -1008,6 +1253,7 @@ def load_module(target, name):
|
|||||||
debug.debug("Request load module '" + name + "' not define for this platform")
|
debug.debug("Request load module '" + name + "' not define for this platform")
|
||||||
else:
|
else:
|
||||||
target.add_module(tmp_element)
|
target.add_module(tmp_element)
|
||||||
|
return tmp_element
|
||||||
|
|
||||||
def list_all_module():
|
def list_all_module():
|
||||||
global module_list
|
global module_list
|
||||||
@@ -1021,7 +1267,7 @@ def list_all_module_with_desc():
|
|||||||
tmpList = []
|
tmpList = []
|
||||||
for mod in module_list:
|
for mod in module_list:
|
||||||
sys.path.append(os.path.dirname(mod[1]))
|
sys.path.append(os.path.dirname(mod[1]))
|
||||||
the_module = __import__("lutin_" + mod[0])
|
the_module = __import__(env.get_build_system_base_name() + __start_module_name + mod[0])
|
||||||
tmpList.append(get_module_option(the_module, mod[0]))
|
tmpList.append(get_module_option(the_module, mod[0]))
|
||||||
return tmpList
|
return tmpList
|
||||||
|
|
||||||
@@ -1035,22 +1281,25 @@ def get_module_option(the_module, name):
|
|||||||
compagny_name = None
|
compagny_name = None
|
||||||
maintainer = None
|
maintainer = None
|
||||||
version = None
|
version = None
|
||||||
|
version_id = None
|
||||||
|
|
||||||
if "get_type" in dir(the_module):
|
list_of_function_in_factory = dir(the_module)
|
||||||
|
|
||||||
|
if "get_type" in list_of_function_in_factory:
|
||||||
type = the_module.get_type()
|
type = the_module.get_type()
|
||||||
else:
|
else:
|
||||||
debug.debug(" function get_type() must be provided in the module: " + name)
|
debug.debug(" function get_type() must be provided in the module: " + name)
|
||||||
|
|
||||||
if "get_sub_type" in dir(the_module):
|
if "get_sub_type" in list_of_function_in_factory:
|
||||||
sub_type = the_module.get_sub_type()
|
sub_type = the_module.get_sub_type()
|
||||||
|
|
||||||
if "get_desc" in dir(the_module):
|
if "get_desc" in list_of_function_in_factory:
|
||||||
description = the_module.get_desc()
|
description = the_module.get_desc()
|
||||||
|
|
||||||
if "get_licence" in dir(the_module):
|
if "get_licence" in list_of_function_in_factory:
|
||||||
license = the_module.get_licence()
|
license = the_module.get_licence()
|
||||||
|
|
||||||
if "get_compagny_type" in dir(the_module):
|
if "get_compagny_type" in list_of_function_in_factory:
|
||||||
compagny_type = the_module.get_compagny_type()
|
compagny_type = the_module.get_compagny_type()
|
||||||
# com : Commercial
|
# com : Commercial
|
||||||
# net : Network??
|
# net : Network??
|
||||||
@@ -1064,15 +1313,18 @@ def get_module_option(the_module, name):
|
|||||||
if compagny_type not in compagny_type_list:
|
if compagny_type not in compagny_type_list:
|
||||||
debug.warning("[" + name + "] type of the company not normal: " + compagny_type + " not in " + str(compagny_type_list))
|
debug.warning("[" + name + "] type of the company not normal: " + compagny_type + " not in " + str(compagny_type_list))
|
||||||
|
|
||||||
if "get_compagny_name" in dir(the_module):
|
if "get_compagny_name" in list_of_function_in_factory:
|
||||||
compagny_name = the_module.get_compagny_name()
|
compagny_name = the_module.get_compagny_name()
|
||||||
|
|
||||||
if "get_maintainer" in dir(the_module):
|
if "get_maintainer" in list_of_function_in_factory:
|
||||||
maintainer = the_module.get_maintainer()
|
maintainer = the_module.get_maintainer()
|
||||||
|
|
||||||
if "get_version" in dir(the_module):
|
if "get_version" in list_of_function_in_factory:
|
||||||
version = the_module.get_version()
|
version = the_module.get_version()
|
||||||
|
|
||||||
|
if "get_version_id" in list_of_function_in_factory:
|
||||||
|
version_id = the_module.get_version_id()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"name":name,
|
"name":name,
|
||||||
"description":description,
|
"description":description,
|
||||||
@@ -1082,7 +1334,8 @@ def get_module_option(the_module, name):
|
|||||||
"compagny-type":compagny_type,
|
"compagny-type":compagny_type,
|
||||||
"compagny-name":compagny_name,
|
"compagny-name":compagny_name,
|
||||||
"maintainer":maintainer,
|
"maintainer":maintainer,
|
||||||
"version":version
|
"version":version,
|
||||||
|
"version-id":version_id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
@@ -24,13 +25,13 @@ from . import tools
|
|||||||
from . import env
|
from . import env
|
||||||
from . import depend
|
from . import depend
|
||||||
|
|
||||||
queueLock = threading.Lock()
|
queue_lock = threading.Lock()
|
||||||
workQueue = queue.Queue()
|
work_queue = queue.Queue()
|
||||||
currentThreadWorking = 0
|
current_thread_working = 0
|
||||||
threads = []
|
threads = []
|
||||||
# To know the first error arrive in the pool ==> to display all the time the same error file when multiple compilation
|
# To know the first error arrive in the pool ==> to display all the time the same error file when multiple compilation
|
||||||
currentIdExecution = 0
|
current_id_execution = 0
|
||||||
errorExecution = {
|
error_execution = {
|
||||||
"id":-1,
|
"id":-1,
|
||||||
"cmd":"",
|
"cmd":"",
|
||||||
"return":0,
|
"return":0,
|
||||||
@@ -38,10 +39,26 @@ errorExecution = {
|
|||||||
"out":"",
|
"out":"",
|
||||||
}
|
}
|
||||||
|
|
||||||
exitFlag = False # resuest stop of the thread
|
exit_flag = False # resuest stop of the thread
|
||||||
isinit = False # the thread are initialized
|
is_init = False # the thread are initialized
|
||||||
errorOccured = False # a thread have an error
|
error_occured = False # a thread have an error
|
||||||
processorAvaillable = 1 # number of CPU core availlable
|
processor_availlable = 1 # number of CPU core availlable
|
||||||
|
##
|
||||||
|
## @brief Execute the command with no get of output
|
||||||
|
##
|
||||||
|
def run_command_no_lock_out(cmd_line):
|
||||||
|
# prepare command line:
|
||||||
|
args = shlex.split(cmd_line)
|
||||||
|
debug.info("cmd = " + str(args))
|
||||||
|
try:
|
||||||
|
# create the subprocess
|
||||||
|
p = subprocess.Popen(args)
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
debug.error("subprocess.CalledProcessError : " + str(args))
|
||||||
|
except:
|
||||||
|
debug.error("Exception on : " + str(args))
|
||||||
|
# launch the subprocess:
|
||||||
|
p.communicate()
|
||||||
|
|
||||||
##
|
##
|
||||||
## @brief Execute the command and ruturn generate data
|
## @brief Execute the command and ruturn generate data
|
||||||
@@ -72,9 +89,10 @@ def run_command_direct(cmd_line):
|
|||||||
|
|
||||||
|
|
||||||
def run_command(cmd_line, store_cmd_line="", build_id=-1, file="", store_output_file="", depend_data=None):
|
def run_command(cmd_line, store_cmd_line="", build_id=-1, file="", store_output_file="", depend_data=None):
|
||||||
global errorOccured
|
global error_occured
|
||||||
global exitFlag
|
global exit_flag
|
||||||
global currentIdExecution
|
global current_id_execution
|
||||||
|
global error_execution
|
||||||
# prepare command line:
|
# prepare command line:
|
||||||
args = shlex.split(cmd_line)
|
args = shlex.split(cmd_line)
|
||||||
debug.verbose("cmd = " + str(args))
|
debug.verbose("cmd = " + str(args))
|
||||||
@@ -95,7 +113,7 @@ def run_command(cmd_line, store_cmd_line="", build_id=-1, file="", store_output_
|
|||||||
# Check error :
|
# Check error :
|
||||||
if p.returncode == 0:
|
if p.returncode == 0:
|
||||||
debug.debug(env.print_pretty(cmd_line))
|
debug.debug(env.print_pretty(cmd_line))
|
||||||
queueLock.acquire()
|
queue_lock.acquire()
|
||||||
if depend_data != None:
|
if depend_data != None:
|
||||||
depend.create_dependency_file(depend_data['file'], depend_data['data'])
|
depend.create_dependency_file(depend_data['file'], depend_data['data'])
|
||||||
# TODO : Print the output all the time .... ==> to show warnings ...
|
# TODO : Print the output all the time .... ==> to show warnings ...
|
||||||
@@ -105,10 +123,10 @@ def run_command(cmd_line, store_cmd_line="", build_id=-1, file="", store_output_
|
|||||||
debug.print_compilator(output)
|
debug.print_compilator(output)
|
||||||
if err != "":
|
if err != "":
|
||||||
debug.print_compilator(err)
|
debug.print_compilator(err)
|
||||||
queueLock.release()
|
queue_lock.release()
|
||||||
else:
|
else:
|
||||||
errorOccured = True
|
error_occured = True
|
||||||
exitFlag = True
|
exit_flag = True
|
||||||
# if No ID : Not in a multiprocess mode ==> just stop here
|
# if No ID : Not in a multiprocess mode ==> just stop here
|
||||||
if build_id < 0:
|
if build_id < 0:
|
||||||
debug.debug(env.print_pretty(cmd_line), force=True)
|
debug.debug(env.print_pretty(cmd_line), force=True)
|
||||||
@@ -120,18 +138,18 @@ def run_command(cmd_line, store_cmd_line="", build_id=-1, file="", store_output_
|
|||||||
debug.error("can not compile file ... ret : " + str(p.returncode))
|
debug.error("can not compile file ... ret : " + str(p.returncode))
|
||||||
else:
|
else:
|
||||||
# in multiprocess interface
|
# in multiprocess interface
|
||||||
queueLock.acquire()
|
queue_lock.acquire()
|
||||||
# if an other write an error before, check if the current process is started before ==> then is the first error
|
# if an other write an error before, check if the current process is started before ==> then is the first error
|
||||||
if errorExecution["id"] >= build_id:
|
if error_execution["id"] >= build_id:
|
||||||
# nothing to do ...
|
# nothing to do ...
|
||||||
queueLock.release()
|
queue_lock.release()
|
||||||
return;
|
return;
|
||||||
errorExecution["id"] = build_id
|
error_execution["id"] = build_id
|
||||||
errorExecution["cmd"] = cmd_line
|
error_execution["cmd"] = cmd_line
|
||||||
errorExecution["return"] = p.returncode
|
error_execution["return"] = p.returncode
|
||||||
errorExecution["err"] = err,
|
error_execution["err"] = err,
|
||||||
errorExecution["out"] = output,
|
error_execution["out"] = output,
|
||||||
queueLock.release()
|
queue_lock.release()
|
||||||
# not write the command file...
|
# not write the command file...
|
||||||
return
|
return
|
||||||
debug.verbose("done 3")
|
debug.verbose("done 3")
|
||||||
@@ -141,38 +159,46 @@ def run_command(cmd_line, store_cmd_line="", build_id=-1, file="", store_output_
|
|||||||
|
|
||||||
|
|
||||||
class myThread(threading.Thread):
|
class myThread(threading.Thread):
|
||||||
def __init__(self, threadID, lock, queue):
|
def __init__(self, thread_id, lock, queue):
|
||||||
threading.Thread.__init__(self)
|
threading.Thread.__init__(self)
|
||||||
self.thread_id = threadID
|
self.thread_id = thread_id
|
||||||
self.name = "Thread " + str(threadID)
|
self.name = "Thread " + str(thread_id)
|
||||||
self.queue = queue
|
self.queue = queue
|
||||||
self.lock = lock
|
self.lock = lock
|
||||||
def run(self):
|
def run(self):
|
||||||
debug.verbose("Starting " + self.name)
|
debug.verbose("Starting " + self.name)
|
||||||
global exitFlag
|
global exit_flag
|
||||||
global currentThreadWorking
|
global current_thread_working
|
||||||
workingSet = False
|
working_set = False
|
||||||
while exitFlag == False:
|
while exit_flag == False:
|
||||||
self.lock.acquire()
|
self.lock.acquire()
|
||||||
if not self.queue.empty():
|
if not self.queue.empty():
|
||||||
if workingSet==False:
|
if working_set == False:
|
||||||
currentThreadWorking += 1
|
current_thread_working += 1
|
||||||
workingSet = True
|
working_set = True
|
||||||
data = self.queue.get()
|
data = self.queue.get()
|
||||||
self.lock.release()
|
self.lock.release()
|
||||||
debug.verbose(self.name + " processing '" + data[0] + "'")
|
debug.verbose(self.name + " processing '" + data[0] + "'")
|
||||||
if data[0]=="cmdLine":
|
if data[0]=="cmd_line":
|
||||||
comment = data[2]
|
comment = data[2]
|
||||||
cmdLine = data[1]
|
cmd_line = data[1]
|
||||||
cmdStoreFile = data[3]
|
cmd_store_file = data[3]
|
||||||
debug.print_element( "[" + str(data[4]) + "][" + str(self.thread_id) + "] " + comment[0], comment[1], comment[2], comment[3])
|
debug.print_element("[" + str(data[4]) + "][" + str(self.thread_id) + "] " + comment[0],
|
||||||
run_command(cmdLine, cmdStoreFile, build_id=data[4], file=comment[3], store_output_file=data[5], depend_data=data[6])
|
comment[1],
|
||||||
|
comment[2],
|
||||||
|
comment[3])
|
||||||
|
run_command(cmd_line,
|
||||||
|
cmd_store_file,
|
||||||
|
build_id=data[4],
|
||||||
|
file=comment[3],
|
||||||
|
store_output_file=data[5],
|
||||||
|
depend_data=data[6])
|
||||||
else:
|
else:
|
||||||
debug.warning("unknow request command : " + data[0])
|
debug.warning("unknow request command : " + data[0])
|
||||||
else:
|
else:
|
||||||
if workingSet==True:
|
if working_set==True:
|
||||||
currentThreadWorking -= 1
|
current_thread_working -= 1
|
||||||
workingSet=False
|
working_set=False
|
||||||
# no element to parse, just wait ...
|
# no element to parse, just wait ...
|
||||||
self.lock.release()
|
self.lock.release()
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
@@ -180,39 +206,41 @@ class myThread(threading.Thread):
|
|||||||
debug.verbose("Exiting " + self.name)
|
debug.verbose("Exiting " + self.name)
|
||||||
|
|
||||||
|
|
||||||
def error_occured():
|
def set_error_occured():
|
||||||
global exitFlag
|
global exit_flag
|
||||||
exitFlag = True
|
exit_flag = True
|
||||||
|
|
||||||
def set_core_number(numberOfcore):
|
def set_core_number(number_of_core):
|
||||||
global processorAvaillable
|
global processor_availlable
|
||||||
processorAvaillable = numberOfcore
|
processor_availlable = number_of_core
|
||||||
debug.debug(" set number of core for multi process compilation : " + str(processorAvaillable))
|
debug.debug(" set number of core for multi process compilation : " + str(processor_availlable))
|
||||||
# nothing else to do
|
# nothing else to do
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
global exitFlag
|
global error_occured
|
||||||
global isinit
|
global exit_flag
|
||||||
if isinit==False:
|
global is_init
|
||||||
isinit=True
|
if is_init == False:
|
||||||
|
is_init = True
|
||||||
|
error_occured = False
|
||||||
global threads
|
global threads
|
||||||
global queueLock
|
global queue_lock
|
||||||
global workQueue
|
global work_queue
|
||||||
# Create all the new threads
|
# Create all the new threads
|
||||||
threadID = 0
|
thread_id = 0
|
||||||
while threadID < processorAvaillable:
|
while thread_id < processor_availlable:
|
||||||
thread = myThread(threadID, queueLock, workQueue)
|
thread = myThread(thread_id, queue_lock, work_queue)
|
||||||
thread.start()
|
thread.start()
|
||||||
threads.append(thread)
|
threads.append(thread)
|
||||||
threadID += 1
|
thread_id += 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def un_init():
|
def un_init():
|
||||||
global exitFlag
|
global exit_flag
|
||||||
# Notify threads it's time to exit
|
# Notify threads it's time to exit
|
||||||
exitFlag = True
|
exit_flag = True
|
||||||
if processorAvaillable > 1:
|
if processor_availlable > 1:
|
||||||
# Wait for all threads to complete
|
# Wait for all threads to complete
|
||||||
for tmp in threads:
|
for tmp in threads:
|
||||||
debug.verbose("join thread ...")
|
debug.verbose("join thread ...")
|
||||||
@@ -222,53 +250,53 @@ def un_init():
|
|||||||
|
|
||||||
|
|
||||||
def run_in_pool(cmd_line, comment, store_cmd_line="", store_output_file="", depend_data=None):
|
def run_in_pool(cmd_line, comment, store_cmd_line="", store_output_file="", depend_data=None):
|
||||||
global currentIdExecution
|
global current_id_execution
|
||||||
if processorAvaillable <= 1:
|
if processor_availlable <= 1:
|
||||||
debug.print_element(comment[0], comment[1], comment[2], comment[3])
|
debug.print_element(comment[0], comment[1], comment[2], comment[3])
|
||||||
run_command(cmd_line, store_cmd_line, file=comment[3], store_output_file=store_output_file, depend_data=depend_data)
|
run_command(cmd_line, store_cmd_line, file=comment[3], store_output_file=store_output_file, depend_data=depend_data)
|
||||||
return
|
return
|
||||||
# multithreaded mode
|
# multithreaded mode
|
||||||
init()
|
init()
|
||||||
# Fill the queue
|
# Fill the queue
|
||||||
queueLock.acquire()
|
queue_lock.acquire()
|
||||||
debug.verbose("add : in pool cmdLine")
|
debug.verbose("add : in pool cmd_line")
|
||||||
workQueue.put(["cmdLine", cmd_line, comment, store_cmd_line, currentIdExecution, store_output_file, depend_data])
|
work_queue.put(["cmd_line", cmd_line, comment, store_cmd_line, current_id_execution, store_output_file, depend_data])
|
||||||
currentIdExecution +=1;
|
current_id_execution +=1;
|
||||||
queueLock.release()
|
queue_lock.release()
|
||||||
|
|
||||||
|
|
||||||
def pool_synchrosize():
|
def pool_synchrosize():
|
||||||
global errorOccured
|
global error_occured
|
||||||
global errorExecution
|
global error_execution
|
||||||
if processorAvaillable <= 1:
|
if processor_availlable <= 1:
|
||||||
#in this case : nothing to synchronise
|
#in this case : nothing to synchronise
|
||||||
return
|
return
|
||||||
|
|
||||||
debug.verbose("wait queue process ended\n")
|
debug.verbose("wait queue process ended\n")
|
||||||
# Wait for queue to empty
|
# Wait for queue to empty
|
||||||
while not workQueue.empty() \
|
while not work_queue.empty() \
|
||||||
and False==errorOccured:
|
and error_occured == False:
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
pass
|
pass
|
||||||
# Wait all thread have ended their current process
|
# Wait all thread have ended their current process
|
||||||
while currentThreadWorking != 0 \
|
while current_thread_working != 0 \
|
||||||
and False==errorOccured:
|
and error_occured == False:
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
pass
|
pass
|
||||||
if False==errorOccured:
|
if error_occured == False:
|
||||||
debug.verbose("queue is empty")
|
debug.verbose("queue is empty")
|
||||||
else:
|
else:
|
||||||
un_init()
|
un_init()
|
||||||
debug.debug("Thread return with error ... ==> stop all the pool")
|
debug.debug("Thread return with error ... ==> stop all the pool")
|
||||||
if errorExecution["id"] == -1:
|
if error_execution["id"] == -1:
|
||||||
debug.error("Pool error occured ... (No return information on Pool)")
|
debug.error("Pool error occured ... (No return information on Pool)")
|
||||||
return
|
return
|
||||||
debug.error("Error in an pool element : [" + str(errorExecution["id"]) + "]", crash=False)
|
debug.error("Error in an pool element : [" + str(error_execution["id"]) + "]", crash=False)
|
||||||
debug.debug(env.print_pretty(errorExecution["cmd"]), force=True)
|
debug.debug(env.print_pretty(error_execution["cmd"]), force=True)
|
||||||
debug.print_compilator(str(errorExecution["out"][0]))
|
debug.print_compilator(str(error_execution["out"][0]))
|
||||||
debug.print_compilator(str(errorExecution["err"][0]))
|
debug.print_compilator(str(error_execution["err"][0]))
|
||||||
if errorExecution["return"] == 2:
|
if error_execution["return"] == 2:
|
||||||
debug.error("can not compile file ... [keyboard interrrupt]")
|
debug.error("can not compile file ... [keyboard interrrupt]")
|
||||||
else:
|
else:
|
||||||
debug.error("can not compile file ... return value : " + str(errorExecution["return"]))
|
debug.error("can not compile file ... return value : " + str(error_execution["return"]))
|
||||||
|
|
||||||
|
131
lutin/system.py
131
lutin/system.py
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
@@ -16,6 +17,7 @@ import datetime
|
|||||||
from . import debug
|
from . import debug
|
||||||
from . import module
|
from . import module
|
||||||
from . import tools
|
from . import tools
|
||||||
|
from . import env
|
||||||
|
|
||||||
class System:
|
class System:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@@ -26,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)
|
||||||
@@ -40,12 +44,23 @@ 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):
|
||||||
|
return "{lutin.System}"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -65,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
|
||||||
|
|
||||||
|
|
||||||
@@ -73,76 +95,85 @@ def create_module_from_system(target, dict):
|
|||||||
|
|
||||||
# Dictionnaire of Target name
|
# Dictionnaire of Target name
|
||||||
# inside table of ["Name of the lib", "path of the lib", boolean loaded, module loaded]
|
# inside table of ["Name of the lib", "path of the lib", boolean loaded, module loaded]
|
||||||
systemList={}
|
system_list={}
|
||||||
__start_system_name="lutinSystem_"
|
__start_system_name="System_"
|
||||||
|
|
||||||
|
def import_path(path_list):
|
||||||
|
global system_list
|
||||||
|
global_base = env.get_build_system_base_name()
|
||||||
|
debug.debug("SYSTEM: Init with Files list:")
|
||||||
|
for elem in path_list:
|
||||||
|
sys.path.append(os.path.dirname(elem))
|
||||||
|
# Get file name:
|
||||||
|
filename = os.path.basename(elem)
|
||||||
|
# Remove .py at the end:
|
||||||
|
filename = filename[:-3]
|
||||||
|
# Remove global base name:
|
||||||
|
filename = filename[len(global_base):]
|
||||||
|
# Check if it start with the local patern:
|
||||||
|
if filename[:len(__start_system_name)] != __start_system_name:
|
||||||
|
debug.extreme_verbose("SYSTEM: NOT-Integrate: '" + filename + "' from '" + elem + "' ==> rejected")
|
||||||
|
continue
|
||||||
|
# Remove local patern
|
||||||
|
system_name = filename[len(__start_system_name):]
|
||||||
|
system_type, system_name = system_name.split('_')
|
||||||
|
debug.verbose("SYSTEM: Integrate: '" + system_type + "':'" + system_name + "' from '" + elem + "'")
|
||||||
|
if system_type in system_list:
|
||||||
|
system_list[system_type].append({"name":system_name,
|
||||||
|
"path":elem,
|
||||||
|
"system":None,
|
||||||
|
"loaded":False,
|
||||||
|
"exist":False,
|
||||||
|
"module":None})
|
||||||
|
else:
|
||||||
|
system_list[system_type] = [{"name":system_name,
|
||||||
|
"path":elem,
|
||||||
|
"system":None,
|
||||||
|
"loaded":False,
|
||||||
|
"exist":False,
|
||||||
|
"module":None}]
|
||||||
|
debug.verbose("New list system: ")
|
||||||
|
for elem in system_list:
|
||||||
|
debug.verbose(" " + str(elem))
|
||||||
|
for val in system_list[elem]:
|
||||||
|
debug.verbose(" " + str(val["name"]))
|
||||||
|
|
||||||
def import_path(path):
|
|
||||||
global targetList
|
|
||||||
matches = []
|
|
||||||
debug.debug('Start find sub File : "%s"' %path)
|
|
||||||
for root, dirnames, filenames in os.walk(path):
|
|
||||||
tmpList = fnmatch.filter(filenames, __start_system_name + "*.py")
|
|
||||||
# Import the module :
|
|
||||||
for filename in tmpList:
|
|
||||||
debug.verbose(' Find a file : "%s"' %os.path.join(root, filename))
|
|
||||||
sys.path.append(os.path.dirname(os.path.join(root, filename)) )
|
|
||||||
systemName = filename.replace('.py', '')
|
|
||||||
systemName = systemName.replace(__start_system_name, '')
|
|
||||||
targetType, systemName = systemName.split('_')
|
|
||||||
debug.debug("integrate system: '" + targetType + "':'" + systemName + "' from '" + os.path.join(root, filename) + "'")
|
|
||||||
if targetType in systemList:
|
|
||||||
systemList[targetType].append({"name":systemName,
|
|
||||||
"path":os.path.join(root, filename),
|
|
||||||
"system":None,
|
|
||||||
"loaded":False,
|
|
||||||
"exist":False,
|
|
||||||
"module":None})
|
|
||||||
else:
|
|
||||||
systemList[targetType] = [{"name":systemName,
|
|
||||||
"path":os.path.join(root, filename),
|
|
||||||
"system":None,
|
|
||||||
"loaded":False,
|
|
||||||
"exist":False,
|
|
||||||
"module":None}]
|
|
||||||
debug.debug("list system=" + str(systemList))
|
|
||||||
|
|
||||||
def display():
|
def display():
|
||||||
global systemList
|
global system_list
|
||||||
for elementName in systemList:
|
for elementName in system_list:
|
||||||
debug.info("integrate system: '" + elementName +"'")
|
debug.info("SYSTEM: Integrate system: '" + elementName +"'")
|
||||||
for data in systemList[elementName]:
|
for data in system_list[elementName]:
|
||||||
debug.info(" '" + data["name"] +"' in " + data["path"])
|
debug.info("SYSTEM: '" + data["name"] +"' in " + data["path"])
|
||||||
|
|
||||||
|
|
||||||
def exist(lib_name, target_name, target) :
|
def exist(lib_name, target_name, target) :
|
||||||
global systemList
|
global system_list
|
||||||
debug.verbose("exist= " + lib_name + " in " + target_name)
|
debug.verbose("exist= " + lib_name + " in " + target_name)
|
||||||
if target_name not in systemList:
|
if target_name not in system_list:
|
||||||
return False
|
return False
|
||||||
for data in systemList[target_name]:
|
for data in system_list[target_name]:
|
||||||
if data["name"] == lib_name:
|
if data["name"] == lib_name:
|
||||||
# we find it in the List ==> need to check if it is present in the system :
|
# we find it in the List ==> need to check if it is present in the system :
|
||||||
if data["loaded"] == False:
|
if data["loaded"] == False:
|
||||||
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__(__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.info("call : " + 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
|
||||||
|
|
||||||
def load(target, lib_name, target_name):
|
def load(target, lib_name, target_name):
|
||||||
global systemList
|
global system_list
|
||||||
if target_name not in systemList:
|
if target_name not in system_list:
|
||||||
debug.error("you must call this function after checking of the system exist() !1!")
|
debug.error("you must call this function after checking of the system exist() !1!")
|
||||||
for data in systemList[target_name]:
|
for data in system_list[target_name]:
|
||||||
if data["name"] == lib_name:
|
if data["name"] == lib_name:
|
||||||
if data["exist"] == False:
|
if data["exist"] == False:
|
||||||
debug.error("you must call this function after checking of the system exist() !2!")
|
debug.error("you must call this function after checking of the system exist() !2!")
|
||||||
|
344
lutin/target.py
344
lutin/target.py
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
@@ -19,6 +20,7 @@ from . import tools
|
|||||||
from . import module
|
from . import module
|
||||||
from . import system
|
from . import system
|
||||||
from . import multiprocess
|
from . import multiprocess
|
||||||
|
from . import env
|
||||||
|
|
||||||
class Target:
|
class Target:
|
||||||
def __init__(self, name, config, arch):
|
def __init__(self, name, config, arch):
|
||||||
@@ -43,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"] + "'");
|
||||||
@@ -95,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')
|
||||||
|
|
||||||
@@ -104,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",
|
||||||
@@ -115,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", [
|
||||||
"-fprofile-arcs",
|
"--coverage"
|
||||||
"-ftest-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"
|
||||||
@@ -130,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"
|
||||||
|
|
||||||
|
|
||||||
@@ -154,6 +170,9 @@ class Target:
|
|||||||
# special case for IOS (example) no build dynamicly ...
|
# special case for IOS (example) no build dynamicly ...
|
||||||
self.support_dynamic_link = True
|
self.support_dynamic_link = True
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "{lutin.Target}"
|
||||||
|
|
||||||
def add_flag(self, type, list):
|
def add_flag(self, type, list):
|
||||||
tools.list_append_to_2(self.global_flags, type, list)
|
tools.list_append_to_2(self.global_flags, type, list)
|
||||||
|
|
||||||
@@ -217,6 +236,16 @@ class Target:
|
|||||||
self.dlltool = self.cross + "dlltool"
|
self.dlltool = self.cross + "dlltool"
|
||||||
self.update_path_tree()
|
self.update_path_tree()
|
||||||
|
|
||||||
|
#some static libraries that is sometime needed when not use stdlib ...
|
||||||
|
ret = multiprocess.run_command_direct(self.xx + " -print-file-name=libgcc.a");
|
||||||
|
if ret == False:
|
||||||
|
debug.error("Can not get the g++/clang++ libgcc.a ...")
|
||||||
|
self.stdlib_name_libgcc = ret;
|
||||||
|
ret = multiprocess.run_command_direct(self.xx + " -print-file-name=libsupc++.a");
|
||||||
|
if ret == False:
|
||||||
|
debug.error("Can not get the g++/clang++ libsupc++.a ...")
|
||||||
|
self.stdlib_name_libsupc = ret;
|
||||||
|
|
||||||
def get_build_mode(self):
|
def get_build_mode(self):
|
||||||
return self.config["mode"]
|
return self.config["mode"]
|
||||||
|
|
||||||
@@ -334,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)
|
||||||
@@ -422,19 +454,18 @@ class Target:
|
|||||||
for elem in self.module_list:
|
for elem in self.module_list:
|
||||||
if elem.name == name:
|
if elem.name == name:
|
||||||
return True
|
return True
|
||||||
# TODO : Check internal module and system module ...
|
|
||||||
# need to import the module (or the system module ...)
|
|
||||||
exist = system.exist(name, self.name, self)
|
|
||||||
if exist == True:
|
|
||||||
system.load(self, name, self.name)
|
|
||||||
return True;
|
|
||||||
# try to find in the local Modules:
|
# try to find in the local Modules:
|
||||||
exist = module.exist(self, name)
|
exist = module.exist(self, name)
|
||||||
if exist == True:
|
if exist == True:
|
||||||
module.load_module(self, name)
|
module.load_module(self, name)
|
||||||
return True;
|
return True;
|
||||||
else:
|
# need to import the module (or the system module ...)
|
||||||
return False;
|
exist = system.exist(name, self.name, self)
|
||||||
|
if exist == True:
|
||||||
|
system.load(self, name, self.name)
|
||||||
|
return True;
|
||||||
|
# we did not find the module ...
|
||||||
|
return False;
|
||||||
|
|
||||||
def load_all(self):
|
def load_all(self):
|
||||||
listOfAllTheModule = module.list_all_module()
|
listOfAllTheModule = module.list_all_module()
|
||||||
@@ -447,15 +478,25 @@ 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 parsig 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")
|
||||||
if name == "dump":
|
if name == "dump":
|
||||||
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")
|
||||||
@@ -474,53 +515,100 @@ 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("?")
|
for action_name in action_list:
|
||||||
module_name = gettedElement[0]
|
debug.verbose("requested : " + module_name + "?" + action_name + " [START]")
|
||||||
if len(gettedElement)>=3:
|
ret = None;
|
||||||
sub_action_name = gettedElement[2]
|
if action_name == "install":
|
||||||
else:
|
try:
|
||||||
sub_action_name = ""
|
self.install_package(module_name)
|
||||||
if len(gettedElement)>=2:
|
except AttributeError:
|
||||||
actionName = gettedElement[1]
|
debug.error("target have no 'install_package' instruction")
|
||||||
else :
|
elif action_name == "uninstall":
|
||||||
actionName = "build"
|
try:
|
||||||
debug.verbose("requested : " + module_name + "?" + actionName)
|
self.un_install_package(module_name)
|
||||||
if actionName == "install":
|
except AttributeError:
|
||||||
self.build(module_name + "?build")
|
debug.error("target have no 'un_install_package' instruction")
|
||||||
self.install_package(module_name)
|
elif action_name[:3] == "run":
|
||||||
elif actionName == "uninstall":
|
if len(action_name) > 3:
|
||||||
self.un_install_package(module_name)
|
# we have option:
|
||||||
elif actionName == "log":
|
action_name2 = action_name.replace("\:", "1234COLUMN4321")
|
||||||
self.Log(module_name)
|
option_list = action_name2.split(":")
|
||||||
else:
|
if len(option_list) == 0:
|
||||||
present = self.load_if_needed(module_name, optionnal=optionnal)
|
debug.warning("action 'run' wrong options options ... : '" + action_name + "' might be separate with ':'")
|
||||||
if present == False \
|
option_list = []
|
||||||
and optionnal == True:
|
else:
|
||||||
return [heritage.HeritageList(), False]
|
option_list_tmp = option_list[1:]
|
||||||
# clean requested
|
option_list = []
|
||||||
for mod in self.module_list:
|
for elem in option_list_tmp:
|
||||||
if mod.name == module_name:
|
option_list.append(elem.replace("1234COLUMN4321", ":"))
|
||||||
if actionName == "dump":
|
else:
|
||||||
debug.info("dump module '" + module_name + "'")
|
option_list = []
|
||||||
return mod.display(self)
|
#try:
|
||||||
elif actionName == "clean":
|
self.run(module_name, option_list)
|
||||||
debug.info("clean module '" + module_name + "'")
|
#except AttributeError:
|
||||||
return mod.clean(self)
|
# debug.error("target have no 'run' instruction")
|
||||||
elif actionName == "gcov":
|
elif action_name == "log":
|
||||||
debug.debug("gcov on module '" + module_name + "'")
|
try:
|
||||||
if sub_action_name == "output":
|
self.show_log(module_name)
|
||||||
return mod.gcov(self, generate_output=True)
|
except AttributeError:
|
||||||
return mod.gcov(self, generate_output=False)
|
debug.error("target have no 'show_log' instruction")
|
||||||
elif actionName == "build":
|
else:
|
||||||
debug.debug("build module '" + module_name + "'")
|
present = self.load_if_needed(module_name, optionnal=optionnal)
|
||||||
if optionnal == True:
|
if present == False \
|
||||||
return [mod.build(self, None), True]
|
and optionnal == True:
|
||||||
return mod.build(self, None)
|
ret = [heritage.HeritageList(), False]
|
||||||
if optionnal == True:
|
else:
|
||||||
return [heritage.HeritageList(), False]
|
for mod in self.module_list:
|
||||||
debug.error("not know module name : '" + module_name + "' to '" + actionName + "' it")
|
if mod.name == module_name:
|
||||||
|
if action_name[:4] == "dump":
|
||||||
|
debug.info("dump module '" + module_name + "'")
|
||||||
|
if len(action_name) > 4:
|
||||||
|
debug.warning("action 'dump' does not support options ... : '" + action_name + "'")
|
||||||
|
ret = mod.display()
|
||||||
|
break
|
||||||
|
elif action_name[:5] == "clean":
|
||||||
|
debug.info("clean module '" + module_name + "'")
|
||||||
|
if len(action_name) > 5:
|
||||||
|
debug.warning("action 'clean' does not support options ... : '" + action_name + "'")
|
||||||
|
ret = mod.clean(self)
|
||||||
|
break
|
||||||
|
elif action_name[:4] == "gcov":
|
||||||
|
debug.debug("gcov on module '" + module_name + "'")
|
||||||
|
if len(action_name) > 4:
|
||||||
|
# we have option:
|
||||||
|
option_list = action_name.split(":")
|
||||||
|
if len(option_list) == 0:
|
||||||
|
debug.warning("action 'gcov' wrong options options ... : '" + action_name + "' might be separate with ':'")
|
||||||
|
option_list = []
|
||||||
|
else:
|
||||||
|
option_list = option_list[1:]
|
||||||
|
else:
|
||||||
|
option_list = []
|
||||||
|
if "output" in option_list:
|
||||||
|
ret = mod.gcov(self, generate_output=True)
|
||||||
|
else:
|
||||||
|
ret = mod.gcov(self, generate_output=False)
|
||||||
|
break
|
||||||
|
elif action_name[:5] == "build":
|
||||||
|
if len(action_name) > 5:
|
||||||
|
debug.warning("action 'build' does not support options ... : '" + action_name + "'")
|
||||||
|
debug.debug("build module '" + module_name + "'")
|
||||||
|
if optionnal == True:
|
||||||
|
ret = [mod.build(self, None), True]
|
||||||
|
else:
|
||||||
|
ret = mod.build(self, None)
|
||||||
|
break
|
||||||
|
if optionnal == True \
|
||||||
|
and ret == None:
|
||||||
|
ret = [heritage.HeritageList(), False]
|
||||||
|
break
|
||||||
|
if ret == None:
|
||||||
|
debug.error("not know module name : '" + module_name + "' to '" + action_name + "' it")
|
||||||
|
debug.verbose("requested : " + module_name + "?" + action_name + " [STOP]")
|
||||||
|
if len(action_list) == 1:
|
||||||
|
return ret
|
||||||
|
|
||||||
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):
|
||||||
debug.verbose("add action : " + name)
|
debug.verbose("add action : " + name)
|
||||||
@@ -567,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)
|
||||||
@@ -600,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
|
||||||
@@ -610,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={}
|
||||||
@@ -622,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
|
||||||
@@ -633,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={}
|
||||||
@@ -653,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:
|
||||||
"""
|
"""
|
||||||
@@ -711,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 ","
|
||||||
@@ -737,25 +844,32 @@ class Target:
|
|||||||
|
|
||||||
|
|
||||||
target_list=[]
|
target_list=[]
|
||||||
__start_target_name="lutinTarget_"
|
__start_target_name="Target_"
|
||||||
|
|
||||||
|
|
||||||
def import_path(path):
|
def import_path(path_list):
|
||||||
global target_list
|
global target_list
|
||||||
matches = []
|
global_base = env.get_build_system_base_name()
|
||||||
debug.debug('TARGET: Start find sub File : "%s"' %path)
|
debug.debug("TARGET: Init with Files list:")
|
||||||
for root, dirnames, filenames in os.walk(path):
|
for elem in path_list:
|
||||||
tmpList = fnmatch.filter(filenames, __start_target_name + "*.py")
|
sys.path.append(os.path.dirname(elem))
|
||||||
# Import the module :
|
# Get file name:
|
||||||
for filename in tmpList:
|
filename = os.path.basename(elem)
|
||||||
debug.debug('TARGET: Find a file : "%s"' %os.path.join(root, filename))
|
# Remove .py at the end:
|
||||||
#matches.append(os.path.join(root, filename))
|
filename = filename[:-3]
|
||||||
sys.path.append(os.path.dirname(os.path.join(root, filename)) )
|
# Remove global base name:
|
||||||
targetName = filename.replace('.py', '')
|
filename = filename[len(global_base):]
|
||||||
targetName = targetName.replace(__start_target_name, '')
|
# Check if it start with the local patern:
|
||||||
debug.debug("TARGET: integrate module: '" + targetName + "' from '" + os.path.join(root, filename) + "'")
|
if filename[:len(__start_target_name)] != __start_target_name:
|
||||||
target_list.append([targetName,os.path.join(root, filename)])
|
debug.extreme_verbose("TARGET: NOT-Integrate: '" + filename + "' from '" + elem + "' ==> rejected")
|
||||||
|
continue
|
||||||
|
# Remove local patern
|
||||||
|
target_name = filename[len(__start_target_name):]
|
||||||
|
debug.verbose("TARGET: Integrate: '" + target_name + "' from '" + elem + "'")
|
||||||
|
target_list.append([target_name, elem])
|
||||||
|
debug.verbose("New list TARGET: ")
|
||||||
|
for elem in target_list:
|
||||||
|
debug.verbose(" " + str(elem[0]))
|
||||||
|
|
||||||
def load_target(name, config):
|
def load_target(name, config):
|
||||||
global target_list
|
global target_list
|
||||||
@@ -767,8 +881,8 @@ def load_target(name, config):
|
|||||||
if mod[0] == name:
|
if mod[0] == name:
|
||||||
debug.verbose("add to path: '" + os.path.dirname(mod[1]) + "'")
|
debug.verbose("add to path: '" + os.path.dirname(mod[1]) + "'")
|
||||||
sys.path.append(os.path.dirname(mod[1]))
|
sys.path.append(os.path.dirname(mod[1]))
|
||||||
debug.verbose("import target : '" + __start_target_name + name + "'")
|
debug.verbose("import target : '" + env.get_build_system_base_name() + __start_target_name + name + "'")
|
||||||
theTarget = __import__(__start_target_name + name)
|
theTarget = __import__(env.get_build_system_base_name() + __start_target_name + name)
|
||||||
#create the target
|
#create the target
|
||||||
tmpTarget = theTarget.Target(config)
|
tmpTarget = theTarget.Target(config)
|
||||||
return tmpTarget
|
return tmpTarget
|
||||||
@@ -786,7 +900,7 @@ def list_all_target_with_desc():
|
|||||||
tmpList = []
|
tmpList = []
|
||||||
for mod in target_list:
|
for mod in target_list:
|
||||||
sys.path.append(os.path.dirname(mod[1]))
|
sys.path.append(os.path.dirname(mod[1]))
|
||||||
theTarget = __import__(__start_target_name + mod[0])
|
theTarget = __import__(env.get_build_system_base_name() + __start_target_name + mod[0])
|
||||||
try:
|
try:
|
||||||
tmpdesc = theTarget.get_desc()
|
tmpdesc = theTarget.get_desc()
|
||||||
tmpList.append([mod[0], tmpdesc])
|
tmpList.append([mod[0], tmpdesc])
|
||||||
|
@@ -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 = []
|
||||||
@@ -323,6 +340,10 @@ def list_append_to(out_list, in_list, order=False):
|
|||||||
debug.warning("can not add in list other than {list/dict/str} : " + str(type(in_list)))
|
debug.warning("can not add in list other than {list/dict/str} : " + str(type(in_list)))
|
||||||
|
|
||||||
def list_append_to_2(listout, module, list, order=False):
|
def list_append_to_2(listout, module, list, order=False):
|
||||||
|
# sepcial cse of bool
|
||||||
|
if type(list) == bool:
|
||||||
|
listout[module] = list
|
||||||
|
return
|
||||||
# add list in the Map
|
# add list in the Map
|
||||||
if module not in listout:
|
if module not in listout:
|
||||||
listout[module] = []
|
listout[module] = []
|
||||||
|
@@ -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)
|
||||||
|
##
|
||||||
|
@@ -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
|
||||||
##
|
##
|
||||||
@@ -36,6 +46,13 @@ def get_input_type():
|
|||||||
def get_output_type():
|
def get_output_type():
|
||||||
return ["", "exe", "bin"]
|
return ["", "exe", "bin"]
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Get builder support multi-threading or not
|
||||||
|
## @return True Multithreading supported
|
||||||
|
## @return False Multithreading NOT supported
|
||||||
|
##
|
||||||
|
def get_support_multithreading():
|
||||||
|
return False
|
||||||
|
|
||||||
##
|
##
|
||||||
## @brief Commands for running gcc to link an executable.
|
## @brief Commands for running gcc to link an executable.
|
||||||
@@ -62,9 +79,14 @@ def link(file, binary, target, depancy, flags, name, basic_path, static = False)
|
|||||||
if lib_name not in depancy.src['dynamic']:
|
if lib_name not in depancy.src['dynamic']:
|
||||||
list_static.append(elem)
|
list_static.append(elem)
|
||||||
#create comand line:
|
#create comand line:
|
||||||
cmd = [
|
cmd = []
|
||||||
target.xx
|
# a specific case to not depend on the libstdc++ automaticly added by the G++ or clang++ compilator ==> then need to compile with GCC or CLANG if use libcxx from llvm or other ...
|
||||||
]
|
if "need-libstdc++" in depancy.flags \
|
||||||
|
and depancy.flags["need-libstdc++"] == True:
|
||||||
|
cmd.append(target.xx)
|
||||||
|
else:
|
||||||
|
cmd.append(target.cc)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
cmd.append(target.arch)
|
cmd.append(target.arch)
|
||||||
except:
|
except:
|
||||||
@@ -105,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:
|
||||||
@@ -114,9 +137,29 @@ def link(file, binary, target, depancy, flags, name, basic_path, static = False)
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
cmd.append(target.global_flags_ld)
|
cmd.append(target.global_flags["link"])
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
for view in ["local", "export"]:
|
||||||
|
if view not in flags:
|
||||||
|
continue
|
||||||
|
for type in ["link-lib"]:
|
||||||
|
if type in flags[view]:
|
||||||
|
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"]:
|
||||||
|
if type in depancy.flags:
|
||||||
|
cmd.append([("-l" + sss).replace("-l/", "/") for sss in depancy.flags[type] ])
|
||||||
|
for type in ["link-lib"]:
|
||||||
|
if type in target.global_flags:
|
||||||
|
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 \
|
||||||
|
@@ -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
|
||||||
##
|
##
|
||||||
@@ -37,6 +47,14 @@ def get_input_type():
|
|||||||
def get_output_type():
|
def get_output_type():
|
||||||
return ["o"]
|
return ["o"]
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Get builder support multi-threading or not
|
||||||
|
## @return True Multithreading supported
|
||||||
|
## @return False Multithreading NOT supported
|
||||||
|
##
|
||||||
|
def get_support_multithreading():
|
||||||
|
return True
|
||||||
|
|
||||||
##
|
##
|
||||||
## @brief Commands for running gcc to compile a C file in object file.
|
## @brief Commands for running gcc to compile a C file in object file.
|
||||||
##
|
##
|
||||||
@@ -52,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"]))
|
||||||
@@ -63,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:
|
||||||
|
@@ -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
|
||||||
##
|
##
|
||||||
@@ -36,6 +46,14 @@ def get_input_type():
|
|||||||
def get_output_type():
|
def get_output_type():
|
||||||
return ["o"]
|
return ["o"]
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Get builder support multi-threading or not
|
||||||
|
## @return True Multithreading supported
|
||||||
|
## @return False Multithreading NOT supported
|
||||||
|
##
|
||||||
|
def get_support_multithreading():
|
||||||
|
return True
|
||||||
|
|
||||||
def remove_element(data, to_remove):
|
def remove_element(data, to_remove):
|
||||||
out = []
|
out = []
|
||||||
for elem in data:
|
for elem in data:
|
||||||
@@ -57,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++"]:
|
||||||
@@ -71,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:
|
||||||
|
@@ -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
|
||||||
##
|
##
|
||||||
@@ -35,6 +45,14 @@ def get_input_type():
|
|||||||
def get_output_type():
|
def get_output_type():
|
||||||
return ["jar"]
|
return ["jar"]
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Get builder support multi-threading or not
|
||||||
|
## @return True Multithreading supported
|
||||||
|
## @return False Multithreading NOT supported
|
||||||
|
##
|
||||||
|
def get_support_multithreading():
|
||||||
|
return False
|
||||||
|
|
||||||
##
|
##
|
||||||
## @brief Commands for running gcc to link a shared library.
|
## @brief Commands for running gcc to link a shared library.
|
||||||
##
|
##
|
||||||
|
@@ -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
|
||||||
##
|
##
|
||||||
@@ -33,6 +43,14 @@ def get_input_type():
|
|||||||
def get_output_type():
|
def get_output_type():
|
||||||
return ["class"]
|
return ["class"]
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Get builder support multi-threading or not
|
||||||
|
## @return True Multithreading supported
|
||||||
|
## @return False Multithreading NOT supported
|
||||||
|
##
|
||||||
|
def get_support_multithreading():
|
||||||
|
return False
|
||||||
|
|
||||||
def create_dependency_files(target, src, heritage_src, basic_path):
|
def create_dependency_files(target, src, heritage_src, basic_path):
|
||||||
depend = []
|
depend = []
|
||||||
for elem in src:
|
for elem in src:
|
||||||
|
@@ -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
|
||||||
##
|
##
|
||||||
@@ -33,6 +43,14 @@ def get_input_type():
|
|||||||
def get_output_type():
|
def get_output_type():
|
||||||
return ["h"]
|
return ["h"]
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Get builder support multi-threading or not
|
||||||
|
## @return True Multithreading supported
|
||||||
|
## @return False Multithreading NOT supported
|
||||||
|
##
|
||||||
|
def get_support_multithreading():
|
||||||
|
return False
|
||||||
|
|
||||||
def create_dependency_files(target, src, heritage_src, basic_path):
|
def create_dependency_files(target, src, heritage_src, basic_path):
|
||||||
depend = []
|
depend = []
|
||||||
for elem in src:
|
for elem in src:
|
||||||
|
@@ -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
|
||||||
##
|
##
|
||||||
@@ -35,6 +45,14 @@ def get_input_type():
|
|||||||
def get_output_type():
|
def get_output_type():
|
||||||
return ["so", "dynlib", "dll"]
|
return ["so", "dynlib", "dll"]
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Get builder support multi-threading or not
|
||||||
|
## @return True Multithreading supported
|
||||||
|
## @return False Multithreading NOT supported
|
||||||
|
##
|
||||||
|
def get_support_multithreading():
|
||||||
|
return False
|
||||||
|
|
||||||
##
|
##
|
||||||
## @brief Commands for running gcc to link a shared library.
|
## @brief Commands for running gcc to link a shared library.
|
||||||
##
|
##
|
||||||
@@ -59,10 +77,15 @@ def link(file, binary, target, depancy, flags, name, basic_path, static=False):
|
|||||||
if lib_name not in depancy.src['dynamic']:
|
if lib_name not in depancy.src['dynamic']:
|
||||||
list_static.append(elem)
|
list_static.append(elem)
|
||||||
#create command Line
|
#create command Line
|
||||||
cmd = [
|
cmd = []
|
||||||
target.xx,
|
# a specific case to not depend on the libstdc++ automaticly added by the G++ or clang++ compilator ==> then need to compile with GCC or CLANG if use libcxx from llvm or other ...
|
||||||
"-o", file_dst
|
if "need-libstdc++" in depancy.flags \
|
||||||
]
|
and depancy.flags["need-libstdc++"] == True:
|
||||||
|
cmd.append(target.xx)
|
||||||
|
else:
|
||||||
|
cmd.append(target.cc)
|
||||||
|
|
||||||
|
cmd.append(["-o", file_dst])
|
||||||
try:
|
try:
|
||||||
cmd.append(target.global_sysroot)
|
cmd.append(target.global_sysroot)
|
||||||
except:
|
except:
|
||||||
@@ -76,15 +99,24 @@ 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:
|
|
||||||
# keep only compilated files ...
|
|
||||||
cmd.append(tools.filter_extention(depancy.src['src'], get_input_type()))
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
try:
|
try:
|
||||||
cmd.append(list_static)
|
cmd.append(list_static)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
for view in ["local", "export"]:
|
||||||
|
if view not in flags:
|
||||||
|
continue
|
||||||
|
for type in ["link", "link-dynamic"]:
|
||||||
|
if type in flags[view]:
|
||||||
|
cmd.append(flags[view][type])
|
||||||
|
for type in ["link", "link-dynamic"]:
|
||||||
|
if type in depancy.flags:
|
||||||
|
cmd.append(depancy.flags[type])
|
||||||
|
for type in ["link", "link-dynamic"]:
|
||||||
|
if type in target.global_flags:
|
||||||
|
cmd.append(target.global_flags[type])
|
||||||
|
if 'src' in depancy.src:
|
||||||
|
cmd.append(tools.filter_extention(depancy.src['src'], get_input_type()))
|
||||||
try:
|
try:
|
||||||
for elem in list_dynamic:
|
for elem in list_dynamic:
|
||||||
lib_path = os.path.dirname(elem)
|
lib_path = os.path.dirname(elem)
|
||||||
@@ -97,22 +129,18 @@ def link(file, binary, target, depancy, flags, name, basic_path, static=False):
|
|||||||
cmd.append("-Wl,-R$ORIGIN/../lib/")
|
cmd.append("-Wl,-R$ORIGIN/../lib/")
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
try:
|
for view in ["local", "export"]:
|
||||||
cmd.append(flags["local"]["link"])
|
if view not in flags:
|
||||||
except:
|
continue
|
||||||
pass
|
for type in ["link-lib"]:
|
||||||
try:
|
if type in flags[view]:
|
||||||
cmd.append(flags["export"]["link"])
|
cmd.append([("-l" + sss).replace("-l/", "/") for sss in flags[view][type] ])
|
||||||
except:
|
for type in ["link-lib"]:
|
||||||
pass
|
if type in depancy.flags:
|
||||||
try:
|
cmd.append([("-l" + sss).replace("-l/", "/") for sss in depancy.flags[type] ])
|
||||||
cmd.append(depancy.flags["link"])
|
for type in ["link-lib"]:
|
||||||
except:
|
if type in target.global_flags:
|
||||||
pass
|
cmd.append([("-l" + sss).replace("-l/", "/") for sss in target.global_flags[type] ])
|
||||||
try:
|
|
||||||
cmd.append(target.global_flags["link"])
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
cmdLine=tools.list_to_str(cmd)
|
cmdLine=tools.list_to_str(cmd)
|
||||||
# check the dependency for this file :
|
# check the dependency for this file :
|
||||||
if depend.need_re_package(file_dst, file_src, True, file_cmd, cmdLine) == False \
|
if depend.need_re_package(file_dst, file_src, True, file_cmd, cmdLine) == False \
|
||||||
|
@@ -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
|
||||||
##
|
##
|
||||||
@@ -35,6 +45,14 @@ def get_input_type():
|
|||||||
def get_output_type():
|
def get_output_type():
|
||||||
return ["a"]
|
return ["a"]
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Get builder support multi-threading or not
|
||||||
|
## @return True Multithreading supported
|
||||||
|
## @return False Multithreading NOT supported
|
||||||
|
##
|
||||||
|
def get_support_multithreading():
|
||||||
|
return False
|
||||||
|
|
||||||
##
|
##
|
||||||
## @brief Commands for running ar.
|
## @brief Commands for running ar.
|
||||||
##
|
##
|
||||||
|
@@ -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
|
||||||
##
|
##
|
||||||
@@ -38,6 +48,14 @@ def get_input_type():
|
|||||||
def get_output_type():
|
def get_output_type():
|
||||||
return ["o"]
|
return ["o"]
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Get builder support multi-threading or not
|
||||||
|
## @return True Multithreading supported
|
||||||
|
## @return False Multithreading NOT supported
|
||||||
|
##
|
||||||
|
def get_support_multithreading():
|
||||||
|
return True
|
||||||
|
|
||||||
##
|
##
|
||||||
## @brief Commands for running gcc to compile a m file in object file.
|
## @brief Commands for running gcc to compile a m file in object file.
|
||||||
##
|
##
|
||||||
@@ -94,7 +112,7 @@ def compile(file, binary, target, depancy, flags, path, name, basic_path, module
|
|||||||
# Create cmd line
|
# Create cmd line
|
||||||
cmdLine=tools.list_to_str(cmd)
|
cmdLine=tools.list_to_str(cmd)
|
||||||
# check the dependency for this file :
|
# check the dependency for this file :
|
||||||
if False==depend.need_re_build(file_dst, file_src, file_depend, file_cmd, cmdLine):
|
if depend.need_re_build(file_dst, file_src, file_depend, file_cmd, cmdLine) == False:
|
||||||
return {"action":"add", "file":file_dst}
|
return {"action":"add", "file":file_dst}
|
||||||
tools.create_directory_of_file(file_dst)
|
tools.create_directory_of_file(file_dst)
|
||||||
comment = ["m", name, "<==", file]
|
comment = ["m", name, "<==", 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
|
||||||
##
|
##
|
||||||
@@ -38,6 +48,14 @@ def get_input_type():
|
|||||||
def get_output_type():
|
def get_output_type():
|
||||||
return ["o"]
|
return ["o"]
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Get builder support multi-threading or not
|
||||||
|
## @return True Multithreading supported
|
||||||
|
## @return False Multithreading NOT supported
|
||||||
|
##
|
||||||
|
def get_support_multithreading():
|
||||||
|
return True
|
||||||
|
|
||||||
##
|
##
|
||||||
## @brief Commands for running gcc to compile a m++ file in object file.
|
## @brief Commands for running gcc to compile a m++ file in object 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
|
||||||
##
|
##
|
||||||
@@ -31,3 +41,65 @@ def get_input_type():
|
|||||||
##
|
##
|
||||||
def get_output_type():
|
def get_output_type():
|
||||||
return ["o"]
|
return ["o"]
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Get builder support multi-threading or not
|
||||||
|
## @return True Multithreading supported
|
||||||
|
## @return False Multithreading NOT supported
|
||||||
|
##
|
||||||
|
def get_support_multithreading():
|
||||||
|
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}
|
||||||
|
@@ -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)
|
||||||
|
##
|
||||||
|
@@ -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):
|
||||||
|
@@ -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,8 +25,8 @@ 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_sources(jar_file_path)
|
self.add_export_sources(jar_file_path)
|
||||||
self.add_export_flag("link", "-ldl")
|
self.add_export_flag("link-lib", "dl")
|
||||||
self.add_export_flag("link", "-llog")
|
self.add_export_flag("link-lib", "log")
|
||||||
self.add_export_flag("link", "-landroid")
|
self.add_export_flag("link-lib", "android")
|
||||||
|
|
||||||
|
|
||||||
|
23
lutin/z_system/lutinSystem_Android_c.py
Normal file
23
lutin/z_system/lutinSystem_Android_c.py
Normal 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
|
||||||
|
|
@@ -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":
|
||||||
|
27
lutin/z_system/lutinSystem_Android_m.py
Normal file
27
lutin/z_system/lutinSystem_Android_m.py
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#!/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="M : m library \n base of std libs (availlagle in GNU C lib and bionic"
|
||||||
|
# No check ==> on the basic std libs:
|
||||||
|
self.valid = True
|
||||||
|
# todo : create a searcher of the presence of the library:
|
||||||
|
self.add_export_flag("link-lib", "m")
|
||||||
|
|
||||||
|
|
36
lutin/z_system/lutinSystem_Android_opengl.py
Normal file
36
lutin/z_system/lutinSystem_Android_opengl.py
Normal 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")
|
||||||
|
|
||||||
|
|
35
lutin/z_system/lutinSystem_Android_pthread.py
Normal file
35
lutin/z_system/lutinSystem_Android_pthread.py
Normal 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'
|
||||||
|
])
|
||||||
|
|
||||||
|
|
29
lutin/z_system/lutinSystem_Android_z.py
Normal file
29
lutin/z_system/lutinSystem_Android_z.py
Normal 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")
|
||||||
|
|
||||||
|
|
@@ -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):
|
||||||
|
@@ -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):
|
||||||
@@ -19,7 +21,8 @@ class System(system.System):
|
|||||||
self.help = "CXX: Generic C++ library"
|
self.help = "CXX: Generic C++ library"
|
||||||
self.valid = True
|
self.valid = True
|
||||||
# no check needed ==> just add this:
|
# no check needed ==> just add this:
|
||||||
self.add_export_flag("c++","-D__STDCPP_LLVM__")
|
self.add_export_flag("c++", "-D__STDCPP_LLVM__")
|
||||||
self.add_export_flag("c++-remove","-nostdlib")
|
self.add_export_flag("c++-remove", "-nostdlib")
|
||||||
|
self.add_export_flag("need-libstdc++", True)
|
||||||
|
|
||||||
|
|
||||||
|
27
lutin/z_system/lutinSystem_IOs_m.py
Normal file
27
lutin/z_system/lutinSystem_IOs_m.py
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#!/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="M : m library \n base of std libs (availlagle in GNU C lib and bionic"
|
||||||
|
# No check ==> on the basic std libs:
|
||||||
|
self.valid = True
|
||||||
|
# todo : create a searcher of the presence of the library:
|
||||||
|
self.add_export_flag("link-lib", "m")
|
||||||
|
|
||||||
|
|
33
lutin/z_system/lutinSystem_Linux_X11.py
Normal file
33
lutin/z_system/lutinSystem_Linux_X11.py
Normal 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)
|
||||||
|
|
||||||
|
|
@@ -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", "-lasound")
|
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'
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
41
lutin/z_system/lutinSystem_Linux_arpa.py
Normal file
41
lutin/z_system/lutinSystem_Linux_arpa.py
Normal 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'
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@@ -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", [
|
# todo : create a searcher of the presence of the library:
|
||||||
"-lboost_system",
|
self.add_export_flag("link-lib", [
|
||||||
"-lboost_thread",
|
"boost_system",
|
||||||
"-lboost_chrono"
|
"boost_thread",
|
||||||
])
|
"boost_chrono"
|
||||||
|
])
|
||||||
|
else:
|
||||||
|
self.add_header_file([
|
||||||
|
"/usr/include/boost/*"
|
||||||
|
],
|
||||||
|
destination_path="boost",
|
||||||
|
recursive=True)
|
||||||
|
self.add_module_depend([
|
||||||
|
'cxx'
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
175
lutin/z_system/lutinSystem_Linux_c.py
Normal file
175
lutin/z_system/lutinSystem_Linux_c.py
Normal 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")
|
||||||
|
|
@@ -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,7 +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_export_flag("c++","-D__STDCPP_GNU__")
|
self.add_module_depend([
|
||||||
self.add_export_flag("c++-remove","-nostdlib")
|
'c',
|
||||||
|
'm',
|
||||||
|
'pthread'
|
||||||
|
])
|
||||||
|
self.add_export_flag("c++", "-D__STDCPP_GNU__")
|
||||||
|
if env.get_isolate_system() == False:
|
||||||
|
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)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -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([
|
||||||
self.add_export_flag("link", "-ljack")
|
'uuid',
|
||||||
|
'c'
|
||||||
|
])
|
||||||
|
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)
|
||||||
|
|
||||||
|
|
||||||
|
37
lutin/z_system/lutinSystem_Linux_m.py
Normal file
37
lutin/z_system/lutinSystem_Linux_m.py
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
#!/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="M : m library \n base of std libs (availlagle in GNU C lib and bionic"
|
||||||
|
# No check ==> on the basic std libs:
|
||||||
|
self.valid = True
|
||||||
|
# todo : create a searcher of the presence of the library:
|
||||||
|
self.add_export_flag("link-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)
|
||||||
|
|
||||||
|
|
||||||
|
|
54
lutin/z_system/lutinSystem_Linux_opengl.py
Normal file
54
lutin/z_system/lutinSystem_Linux_opengl.py
Normal 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"
|
||||||
|
])
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
@@ -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,7 +26,7 @@ class System(system.System):
|
|||||||
return;
|
return;
|
||||||
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", "-ljack")
|
self.add_export_flag("link-lib", "oss")
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
39
lutin/z_system/lutinSystem_Linux_pthread.py
Normal file
39
lutin/z_system/lutinSystem_Linux_pthread.py
Normal 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/")
|
||||||
|
|
||||||
|
|
@@ -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", ["-lpulse-simple", "-lpulse"])
|
'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)
|
||||||
|
|
||||||
|
|
||||||
|
38
lutin/z_system/lutinSystem_Linux_rpc.py
Normal file
38
lutin/z_system/lutinSystem_Linux_rpc.py
Normal 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)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
39
lutin/z_system/lutinSystem_Linux_uuid.py
Normal file
39
lutin/z_system/lutinSystem_Linux_uuid.py
Normal 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)
|
||||||
|
|
||||||
|
|
@@ -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,6 +25,15 @@ class System(system.System):
|
|||||||
return;
|
return;
|
||||||
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", "-lz")
|
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="")
|
||||||
|
|
||||||
|
|
||||||
|
@@ -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):
|
||||||
|
@@ -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,6 @@ class System(system.System):
|
|||||||
# no check needed ==> just add this:
|
# no check needed ==> just add this:
|
||||||
self.add_export_flag("c++","-D__STDCPP_LLVM__")
|
self.add_export_flag("c++","-D__STDCPP_LLVM__")
|
||||||
self.add_export_flag("c++-remove","-nostdlib")
|
self.add_export_flag("c++-remove","-nostdlib")
|
||||||
|
self.add_export_flag("need-libstdc++", True)
|
||||||
|
|
||||||
|
|
||||||
|
27
lutin/z_system/lutinSystem_MacOs_m.py
Normal file
27
lutin/z_system/lutinSystem_MacOs_m.py
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#!/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="M : m library \n base of std libs (availlagle in GNU C lib and bionic"
|
||||||
|
# No check ==> on the basic std libs:
|
||||||
|
self.valid = True
|
||||||
|
# todo : create a searcher of the presence of the library:
|
||||||
|
self.add_export_flag("link-lib", "m")
|
||||||
|
|
||||||
|
|
@@ -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)
|
||||||
|
##
|
||||||
|
@@ -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):
|
||||||
@@ -27,5 +29,6 @@ class System(system.System):
|
|||||||
"-static-libstdc++",
|
"-static-libstdc++",
|
||||||
"-static"
|
"-static"
|
||||||
])
|
])
|
||||||
|
self.add_export_flag("need-libstdc++", True)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -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,10 +25,10 @@ class System(system.System):
|
|||||||
return;
|
return;
|
||||||
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",[
|
self.add_export_flag("link-lib",[
|
||||||
"-ldsound",
|
"dsound",
|
||||||
"-lwinmm",
|
"winmm",
|
||||||
"-lole32"
|
"ole32"
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
27
lutin/z_system/lutinSystem_Windows_m.py
Normal file
27
lutin/z_system/lutinSystem_Windows_m.py
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#!/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="M : m library \n base of std libs (availlagle in GNU C lib and bionic"
|
||||||
|
# No check ==> on the basic std libs:
|
||||||
|
self.valid = True
|
||||||
|
# todo : create a searcher of the presence of the library:
|
||||||
|
self.add_export_flag("link-lib", "m")
|
||||||
|
|
||||||
|
|
@@ -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)
|
||||||
|
##
|
||||||
|
@@ -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
|
||||||
@@ -28,7 +28,6 @@ class Target(target.Target):
|
|||||||
self.type_arch = ""
|
self.type_arch = ""
|
||||||
target.Target.__init__(self, "Android", config, self.type_arch)
|
target.Target.__init__(self, "Android", config, self.type_arch)
|
||||||
|
|
||||||
debug.warning("plop " + str(self.ar))
|
|
||||||
if config["bus-size"] == "32":
|
if config["bus-size"] == "32":
|
||||||
self.type_arch="armv7"
|
self.type_arch="armv7"
|
||||||
else:
|
else:
|
||||||
@@ -175,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)
|
||||||
@@ -277,7 +278,7 @@ class Target(target.Target):
|
|||||||
pkg_name_application_name = pkg_name
|
pkg_name_application_name = pkg_name
|
||||||
if self.config["mode"] == "debug":
|
if self.config["mode"] == "debug":
|
||||||
pkg_name_application_name += "debug"
|
pkg_name_application_name += "debug"
|
||||||
debug.info("ploppppp: " + str(pkg_properties))
|
#debug.info("ploppppp: " + str(pkg_properties))
|
||||||
# FINAL_path_JAVA_PROJECT
|
# FINAL_path_JAVA_PROJECT
|
||||||
self.path_java_project = os.path.join(target_outpath,
|
self.path_java_project = os.path.join(target_outpath,
|
||||||
"src")
|
"src")
|
||||||
@@ -468,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
|
||||||
@@ -513,7 +514,7 @@ class Target(target.Target):
|
|||||||
cmdLine = self.path_sdk + "/platform-tools/adb uninstall " + pkg_name_application_name
|
cmdLine = self.path_sdk + "/platform-tools/adb uninstall " + pkg_name_application_name
|
||||||
Rmultiprocess.run_command(cmdLine)
|
Rmultiprocess.run_command(cmdLine)
|
||||||
|
|
||||||
def Log(self, pkg_name):
|
def show_log(self, pkg_name):
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
debug.info("logcat of android board")
|
debug.info("logcat of android board")
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
@@ -74,8 +75,8 @@ class Target(target.Target):
|
|||||||
"-fobjc-link-runtime"
|
"-fobjc-link-runtime"
|
||||||
])
|
])
|
||||||
|
|
||||||
self.add_flag("m", ["-fobjc-arc")
|
self.add_flag("m", ["-fobjc-arc"])
|
||||||
#self.add_flag("m", ["-fmodules")
|
#self.add_flag("m", ["-fmodules"])
|
||||||
|
|
||||||
self.pkg_path_data = "share"
|
self.pkg_path_data = "share"
|
||||||
self.pkg_path_bin = ""
|
self.pkg_path_bin = ""
|
||||||
|
@@ -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,34 +79,38 @@ 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("------------------------------------------------------------------------")
|
||||||
debug.info("Install package '" + pkg_name + "'")
|
debug.info("-- Install package '" + pkg_name + "'")
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
# this is temporary ... Will call:
|
# this is temporary ... Will call:
|
||||||
if False:
|
if False:
|
||||||
@@ -123,7 +133,7 @@ class Target(target.Target):
|
|||||||
|
|
||||||
def un_install_package(self, pkg_name):
|
def un_install_package(self, pkg_name):
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
debug.info("Un-Install package '" + pkg_name + "'")
|
debug.info("-- Un-Install package '" + pkg_name + "'")
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
# this is temporary ... Will call:
|
# this is temporary ... Will call:
|
||||||
if False:
|
if False:
|
||||||
@@ -137,5 +147,17 @@ class Target(target.Target):
|
|||||||
# remove executable link version:
|
# remove executable link version:
|
||||||
tools.remove_file(target_bin_link)
|
tools.remove_file(target_bin_link)
|
||||||
|
|
||||||
|
def run(self, pkg_name, option_list):
|
||||||
|
debug.debug("------------------------------------------------------------------------")
|
||||||
|
debug.info("-- Run package '" + pkg_name + "' + option: " + str(option_list))
|
||||||
|
debug.debug("------------------------------------------------------------------------")
|
||||||
|
appl_path = os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app", "bin", pkg_name)
|
||||||
|
cmd = appl_path + " "
|
||||||
|
for elem in option_list:
|
||||||
|
cmd += elem + " "
|
||||||
|
multiprocess.run_command_no_lock_out(cmd)
|
||||||
|
debug.debug("------------------------------------------------------------------------")
|
||||||
|
debug.info("-- Run package '" + pkg_name + "' Finished")
|
||||||
|
debug.debug("------------------------------------------------------------------------")
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
@@ -136,7 +137,7 @@ class Target(target.Target):
|
|||||||
if os.path.exists("/Applications/" + pkg_name + ".app") == True:
|
if os.path.exists("/Applications/" + pkg_name + ".app") == True:
|
||||||
shutil.rmtree("/Applications/" + pkg_name + ".app")
|
shutil.rmtree("/Applications/" + pkg_name + ".app")
|
||||||
# copy the application in the basic application path : /Applications/xxx.app
|
# copy the application in the basic application path : /Applications/xxx.app
|
||||||
shutil.copytree(tools.get_run_path() + self.path_out + self.path_staging + "/" + pkg_name + ".app", "/Applications/" + pkg_name + ".app")
|
shutil.copytree(os.path.join(tools.get_run_path(),self.path_out,self.path_staging,pkg_name + ".app"), os.path.join("/Applications", pkg_name + ".app"))
|
||||||
|
|
||||||
def un_install_package(self, pkg_name):
|
def un_install_package(self, pkg_name):
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
@@ -147,6 +148,21 @@ class Target(target.Target):
|
|||||||
if os.path.exists("/Applications/" + pkg_name + ".app") == True:
|
if os.path.exists("/Applications/" + pkg_name + ".app") == True:
|
||||||
shutil.rmtree("/Applications/" + pkg_name + ".app")
|
shutil.rmtree("/Applications/" + pkg_name + ".app")
|
||||||
|
|
||||||
|
def run(self, pkg_name, option_list):
|
||||||
|
debug.debug("------------------------------------------------------------------------")
|
||||||
|
debug.info("-- Run package '" + pkg_name + "'")
|
||||||
|
debug.debug("------------------------------------------------------------------------")
|
||||||
|
appl_path = os.path.join(tools.get_run_path(),self.path_out,self.path_staging,pkg_name + ".app", "bin", pkg_name)
|
||||||
|
cmd = appl_path + " "
|
||||||
|
for elem in option_list:
|
||||||
|
cmd += elem + " "
|
||||||
|
multiprocess.run_command_no_lock_out(cmd)
|
||||||
|
debug.debug("------------------------------------------------------------------------")
|
||||||
|
debug.info("-- Run package '" + pkg_name + "' Finished")
|
||||||
|
debug.debug("------------------------------------------------------------------------")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -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("------------------------------------------------------------------------")
|
||||||
|
@@ -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
|
||||||
|
11
setup.py
11
setup.py
@@ -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.0.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',
|
||||||
|
Reference in New Issue
Block a user