Compare commits
47 Commits
Author | SHA1 | Date | |
---|---|---|---|
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 | |||
055a37bcd5 | |||
6c3f96c2a9 | |||
1200434b97 | |||
6c431ad300 | |||
8a72df67c6 | |||
7360adce0b | |||
5065c7b6ee | |||
b497e09dd0 | |||
75d1490a59 | |||
ddff6f82b9 | |||
4067d6266e | |||
fcd357e452 | |||
3c186dc92e | |||
0b33c94680 |
69
.travis.yml
Normal file
69
.travis.yml
Normal file
@@ -0,0 +1,69 @@
|
||||
#language: python
|
||||
|
||||
sudo: false
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- dev
|
||||
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-4.9
|
||||
- expect
|
||||
- binutils-mingw-w64-i686 # 32bit MinGW
|
||||
- gcc-mingw-w64-i686
|
||||
- g++-mingw-w64-i686
|
||||
- binutils-mingw-w64-x86-64 # 64bit MinGW
|
||||
- gcc-mingw-w64-x86-64
|
||||
- g++-mingw-w64-x86-64
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
env: CONF=release BUILDER=gcc TARGET=Linux TAG=Linux
|
||||
compiler: gcc
|
||||
- os: linux
|
||||
env: CONF=debug BUILDER=clang TARGET=Linux
|
||||
compiler: clang
|
||||
- os: linux
|
||||
env: CONF=release BUILDER=gcc TARGET=Windows TAG=Mingw
|
||||
compiler: gcc
|
||||
- os: linux
|
||||
env: CONF=release BUILDER=gcc TARGET=Android TAG=Android DISABLE_PACKAGE=-p
|
||||
compiler: gcc
|
||||
- os: osx
|
||||
env: CONF=release BUILDER=clang TARGET=MacOs TAG=MacOs
|
||||
compiler: clang
|
||||
- os: osx
|
||||
env: CONF=release BUILDER=clang TARGET=IOs TAG=IOs
|
||||
compiler: clang
|
||||
|
||||
install:
|
||||
- cd ..
|
||||
# download NDK
|
||||
- if [ "$TAG" == "Android" ]; then
|
||||
git clone --depth 1 --branch master https://github.com/HeeroYui/android-download-tool;
|
||||
./android-download-tool/dl-android.sh;
|
||||
fi
|
||||
- git clone --depth 1 --branch master https://github.com/atria-soft/ci.git
|
||||
- cd -
|
||||
|
||||
before_script:
|
||||
- ./setup.py build
|
||||
- export PYTHONPATH=$PYTHONPATH:./lutin/build/lib.linux-x86_64-2.7/:./lutin/build/lib.linux-x86_64-2.7/lutin/:./lutin/build/lib:./lutin/build/lib/lutin/
|
||||
- cd ..
|
||||
- pwd
|
||||
- ls -l *
|
||||
- ./ci/build_send.py --tag=$TAG --status=START;
|
||||
|
||||
script:
|
||||
- ./lutin/build/scripts-2.7/lutin -w -j4 -C -P -t$TARGET -c $BUILDER $COMPILATOR_OPTION $BUS -m $CONF $GCOV $DISABLE_PACKAGE test-c; STATUS=$?
|
||||
- ./ci/build_send.py --tag=$TAG --status="$STATUS";
|
||||
|
||||
notifications:
|
||||
email:
|
||||
- yui.heero@gmail.com
|
43
README.rst
43
README.rst
@@ -3,9 +3,52 @@ Lutin
|
||||
|
||||
`lutin` is a generic builder and package maker is a FREE software tool.
|
||||
|
||||
|
||||
.. image:: https://badge.fury.io/py/lutin.png
|
||||
:target: https://pypi.python.org/pypi/lutin
|
||||
|
||||
Release (master)
|
||||
----------------
|
||||
|
||||
.. image:: https://travis-ci.org/HeeroYui/lutin.svg?branch=master
|
||||
:target: https://travis-ci.org/HeeroYui/lutin
|
||||
|
||||
|
||||
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=master&tag=Linux
|
||||
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=master&tag=MacOs
|
||||
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=master&tag=Mingw
|
||||
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||
|
||||
|
||||
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=master&tag=Android
|
||||
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=master&tag=IOs
|
||||
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||
|
||||
|
||||
Developement (dev)
|
||||
------------------
|
||||
|
||||
.. image:: https://travis-ci.org/HeeroYui/lutin.svg?branch=dev
|
||||
:target: https://travis-ci.org/HeeroYui/lutin
|
||||
|
||||
|
||||
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=dev&tag=Linux
|
||||
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=dev&tag=MacOs
|
||||
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=dev&tag=Mingw
|
||||
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||
|
||||
|
||||
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=dev&tag=Android
|
||||
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=dev&tag=IOs
|
||||
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||
|
||||
|
||||
Instructions
|
||||
------------
|
||||
|
||||
|
125
bin/lutin
125
bin/lutin
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
@@ -10,6 +11,8 @@
|
||||
# for path inspection:
|
||||
import sys
|
||||
import os
|
||||
import copy
|
||||
import lutin
|
||||
import lutin.debug as debug
|
||||
import lutin.arg as arguments
|
||||
import lutin.host as host
|
||||
@@ -18,6 +21,8 @@ import lutin.target as target
|
||||
import lutin.env as env
|
||||
import lutin.multiprocess as multiprocess
|
||||
import lutin.tools as tools
|
||||
import lutin.host as lutinHost
|
||||
import lutin.tools as lutinTools
|
||||
|
||||
myArgs = arguments.LutinArg()
|
||||
myArgs.add(arguments.ArgDefine("h", "help", desc="Display this help"))
|
||||
@@ -28,7 +33,9 @@ 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("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("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("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_section("properties", "keep in the sequency of the cible")
|
||||
@@ -148,8 +155,18 @@ def usage(full=False):
|
||||
print(" ex: " + sys.argv[0] + " all --target=Android all -t Windows -m debug all")
|
||||
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
|
||||
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 active==False:
|
||||
usage()
|
||||
@@ -184,42 +201,104 @@ def parseGenericArg(argument, active):
|
||||
if active==True:
|
||||
multiprocess.set_core_number(int(argument.get_arg()))
|
||||
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":
|
||||
if active==True:
|
||||
debug.set_level(int(argument.get_arg()))
|
||||
return True
|
||||
elif argument.get_option_name() == "color":
|
||||
if active==True:
|
||||
debug.enable_color()
|
||||
if check_boolean(argument.get_arg()) == True:
|
||||
debug.enable_color()
|
||||
else:
|
||||
debug.disable_color()
|
||||
return True
|
||||
elif argument.get_option_name() == "force-build":
|
||||
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
|
||||
elif argument.get_option_name() == "pretty":
|
||||
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() == "force-strip":
|
||||
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
|
||||
elif argument.get_option_name() == "warning":
|
||||
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 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)
|
||||
|
||||
|
||||
|
||||
# parse default unique argument:
|
||||
for argument in localArgument:
|
||||
parseGenericArg(argument, True)
|
||||
|
||||
|
||||
import lutin
|
||||
|
||||
|
||||
import lutin.host as lutinHost
|
||||
import lutin.tools as lutinTools
|
||||
# initialize the system ...
|
||||
lutin.init()
|
||||
|
||||
#available target : Linux / MacOs / Windows / Android ...
|
||||
targetName = host.OS
|
||||
@@ -283,14 +362,34 @@ for argument in localArgument:
|
||||
#remove previous target
|
||||
my_target = None
|
||||
else:
|
||||
argument_value = argument.get_arg()
|
||||
debug.debug("something request : '" + argument_value + "'")
|
||||
if argument.get_option_name() != "":
|
||||
debug.warning("Can not understand argument : '" + argument.get_option_name() + "'")
|
||||
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:
|
||||
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 :
|
||||
if my_target == None:
|
||||
my_target = target.load_target(targetName, config)
|
||||
my_target.build(argument.get_arg())
|
||||
my_target = target.load_target(targetName, copy.deepcopy(config))
|
||||
my_target.build(module_name, actions=action_list)
|
||||
actionDone=True
|
||||
|
||||
# if no action done : we do "all" ...
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
@@ -8,6 +9,7 @@
|
||||
##
|
||||
import os
|
||||
import sys
|
||||
import fnmatch
|
||||
# Local import
|
||||
from . import target
|
||||
from . import builder
|
||||
@@ -16,32 +18,138 @@ from . import host
|
||||
from . import tools
|
||||
from . import debug
|
||||
from . import module
|
||||
|
||||
from . import env
|
||||
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")
|
||||
sys.path.append(tools.get_run_path())
|
||||
builder.import_path(tools.get_current_path(__file__))
|
||||
module.import_path(tools.get_current_path(__file__))
|
||||
system.import_path(tools.get_current_path(__file__))
|
||||
target.import_path(tools.get_current_path(__file__))
|
||||
|
||||
debug.debug("missing file lutinBase.py ==> loading subPath...");
|
||||
# create the list of basic folder:
|
||||
basic_folder_list = []
|
||||
basic_folder_list.append([tools.get_current_path(__file__), True])
|
||||
# Import all sub path without out and archive
|
||||
for path in os.listdir("."):
|
||||
if os.path.isdir(path)==True:
|
||||
if path.lower()!="android" \
|
||||
and path.lower()!="archive" \
|
||||
and path.lower()!="out" :
|
||||
debug.debug("Automatic load path: '" + path + "'")
|
||||
builder.import_path(path)
|
||||
module.import_path(path)
|
||||
system.import_path(path)
|
||||
target.import_path(path)
|
||||
for elem_path in os.listdir("."):
|
||||
if os.path.isdir(elem_path) == False:
|
||||
continue
|
||||
if elem_path.lower() == "android" \
|
||||
or elem_path == "out" :
|
||||
continue
|
||||
debug.debug("Automatic load path: '" + elem_path + "'")
|
||||
basic_folder_list.append([elem_path, False])
|
||||
|
||||
# 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()
|
||||
|
||||
is_init = True
|
||||
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
@@ -14,6 +15,7 @@ import datetime
|
||||
# Local import
|
||||
from . import debug
|
||||
from . import heritage
|
||||
from . import env
|
||||
|
||||
##
|
||||
## constitution of dictionnary:
|
||||
@@ -23,26 +25,37 @@ from . import heritage
|
||||
## - "builder": pointer on the element
|
||||
##
|
||||
builder_list=[]
|
||||
__start_builder_name="lutinBuilder_"
|
||||
__start_builder_name="Builder_"
|
||||
|
||||
|
||||
def import_path(path):
|
||||
def import_path(path_list):
|
||||
global builder_list
|
||||
matches = []
|
||||
debug.debug('BUILDER: Start find sub File : "%s"' %path)
|
||||
for root, dirnames, filenames in os.walk(path):
|
||||
tmpList = fnmatch.filter(filenames, __start_builder_name + "*.py")
|
||||
# Import the module :
|
||||
for filename in tmpList:
|
||||
debug.debug('BUILDER: Find a file : "%s"' %os.path.join(root, filename))
|
||||
#matches.append(os.path.join(root, filename))
|
||||
sys.path.append(os.path.dirname(os.path.join(root, filename)) )
|
||||
builder_name = filename.replace('.py', '')
|
||||
the_builder = __import__(builder_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()))
|
||||
global_base = env.get_build_system_base_name()
|
||||
debug.debug("BUILDER: 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]
|
||||
base_file_name = filename
|
||||
# Remove global base name:
|
||||
filename = filename[len(global_base):]
|
||||
# Check if it start with the local patern:
|
||||
if filename[:len(__start_builder_name)] != __start_builder_name:
|
||||
debug.extreme_verbose("BUILDER: Integrate: '" + filename + "' from '" + elem + "' ==> rejected")
|
||||
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 ...
|
||||
def init():
|
||||
|
136
lutin/debug.py
136
lutin/debug.py
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
@@ -11,8 +12,8 @@ import os
|
||||
import threading
|
||||
import re
|
||||
|
||||
debugLevel=3
|
||||
debugColor=False
|
||||
debug_level=3
|
||||
debug_color=False
|
||||
|
||||
color_default= ""
|
||||
color_red = ""
|
||||
@@ -23,20 +24,20 @@ color_purple = ""
|
||||
color_cyan = ""
|
||||
|
||||
|
||||
debugLock = threading.Lock()
|
||||
debug_lock = threading.Lock()
|
||||
|
||||
def set_level(id):
|
||||
global debugLevel
|
||||
debugLevel = id
|
||||
#print "SetDebug level at " + str(debugLevel)
|
||||
global debug_level
|
||||
debug_level = id
|
||||
#print "SetDebug level at " + str(debug_level)
|
||||
|
||||
def get_level():
|
||||
global debugLevel
|
||||
return debugLevel
|
||||
global debug_level
|
||||
return debug_level
|
||||
|
||||
def enable_color():
|
||||
global debugColor
|
||||
debugColor = True
|
||||
global debug_color
|
||||
debug_color = True
|
||||
global color_default
|
||||
color_default= "\033[00m"
|
||||
global color_red
|
||||
@@ -52,81 +53,108 @@ def enable_color():
|
||||
global color_cyan
|
||||
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):
|
||||
global debugLock
|
||||
global debugLevel
|
||||
if debugLevel >= 6 \
|
||||
global debug_lock
|
||||
global debug_level
|
||||
if debug_level >= 6 \
|
||||
or force == True:
|
||||
debugLock.acquire()
|
||||
debug_lock.acquire()
|
||||
print(color_blue + input + color_default)
|
||||
debugLock.release()
|
||||
debug_lock.release()
|
||||
|
||||
def verbose(input, force=False):
|
||||
global debugLock
|
||||
global debugLevel
|
||||
if debugLevel >= 5 \
|
||||
global debug_lock
|
||||
global debug_level
|
||||
if debug_level >= 5 \
|
||||
or force == True:
|
||||
debugLock.acquire()
|
||||
debug_lock.acquire()
|
||||
print(color_blue + input + color_default)
|
||||
debugLock.release()
|
||||
debug_lock.release()
|
||||
|
||||
def debug(input, force=False):
|
||||
global debugLock
|
||||
global debugLevel
|
||||
if debugLevel >= 4 \
|
||||
global debug_lock
|
||||
global debug_level
|
||||
if debug_level >= 4 \
|
||||
or force == True:
|
||||
debugLock.acquire()
|
||||
debug_lock.acquire()
|
||||
print(color_green + input + color_default)
|
||||
debugLock.release()
|
||||
debug_lock.release()
|
||||
|
||||
def info(input, force=False):
|
||||
global debugLock
|
||||
global debugLevel
|
||||
if debugLevel >= 3 \
|
||||
global debug_lock
|
||||
global debug_level
|
||||
if debug_level >= 3 \
|
||||
or force == True:
|
||||
debugLock.acquire()
|
||||
debug_lock.acquire()
|
||||
print(input + color_default)
|
||||
debugLock.release()
|
||||
debug_lock.release()
|
||||
|
||||
def warning(input, force=False):
|
||||
global debugLock
|
||||
global debugLevel
|
||||
if debugLevel >= 2 \
|
||||
global debug_lock
|
||||
global debug_level
|
||||
if debug_level >= 2 \
|
||||
or force == True:
|
||||
debugLock.acquire()
|
||||
debug_lock.acquire()
|
||||
print(color_purple + "[WARNING] " + input + color_default)
|
||||
debugLock.release()
|
||||
debug_lock.release()
|
||||
|
||||
def error(input, threadID=-1, force=False, crash=True):
|
||||
global debugLock
|
||||
global debugLevel
|
||||
if debugLevel >= 1 \
|
||||
def todo(input, force=False):
|
||||
global debug_lock
|
||||
global debug_level
|
||||
if debug_level >= 3 \
|
||||
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)
|
||||
debugLock.release()
|
||||
if crash==True:
|
||||
debug_lock.release()
|
||||
if crash == True:
|
||||
from . import multiprocess
|
||||
multiprocess.error_occured()
|
||||
if threadID != -1:
|
||||
multiprocess.set_error_occured()
|
||||
if thread_id != -1:
|
||||
threading.interrupt_main()
|
||||
exit(-1)
|
||||
#os_exit(-1)
|
||||
#raise "error happend"
|
||||
|
||||
def print_element(type, lib, dir, name, force=False):
|
||||
global debugLock
|
||||
global debugLevel
|
||||
if debugLevel >= 3 \
|
||||
global debug_lock
|
||||
global debug_level
|
||||
if debug_level >= 3 \
|
||||
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)
|
||||
debugLock.release()
|
||||
debug_lock.release()
|
||||
|
||||
def print_compilator(myString):
|
||||
global debugColor
|
||||
global debugLock
|
||||
if debugColor == True:
|
||||
global debug_color
|
||||
global debug_lock
|
||||
if debug_color == True:
|
||||
myString = myString.replace('\\n', '\n')
|
||||
myString = myString.replace('\\t', '\t')
|
||||
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('-COLOROUT-', color_default)
|
||||
|
||||
debugLock.acquire()
|
||||
debug_lock.acquire()
|
||||
print(myString)
|
||||
debugLock.release()
|
||||
debug_lock.release()
|
||||
|
||||
def get_color_set() :
|
||||
global color_default
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
|
117
lutin/env.py
117
lutin/env.py
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
@@ -25,6 +26,53 @@ def get_force_mode():
|
||||
global 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
|
||||
|
||||
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
|
||||
|
||||
@@ -76,38 +124,55 @@ def print_pretty(my_string, force=False):
|
||||
baseElementList = []
|
||||
if end_with(cmdApplication, ["javac"]) == True:
|
||||
baseElementList = [
|
||||
"-d",
|
||||
"-D",
|
||||
"-classpath",
|
||||
"-sourcepath"
|
||||
]
|
||||
"-d",
|
||||
"-D",
|
||||
"-classpath",
|
||||
"-sourcepath"
|
||||
]
|
||||
elif end_with(cmdApplication, ["java"]) == True:
|
||||
baseElementList = [
|
||||
"-z",
|
||||
"-f",
|
||||
"-rf"
|
||||
]
|
||||
elif end_with(cmdApplication, ["jarsigner"]) == True:
|
||||
baseElementList = [
|
||||
"-sigalg",
|
||||
"-digestalg",
|
||||
"-storepass",
|
||||
"-keypass"
|
||||
]
|
||||
elif end_with(cmdApplication, ["jar"]) == True:
|
||||
baseElementList = [
|
||||
"cf",
|
||||
"-C"
|
||||
]
|
||||
"cf",
|
||||
"-C"
|
||||
]
|
||||
elif end_with(cmdApplication, ["aapt"]) == True:
|
||||
baseElementList = [
|
||||
"-M",
|
||||
"-F",
|
||||
"-I",
|
||||
"-S",
|
||||
"-J"
|
||||
]
|
||||
"-M",
|
||||
"-F",
|
||||
"-I",
|
||||
"-S",
|
||||
"-J"
|
||||
]
|
||||
elif end_with(cmdApplication, ["g++", "gcc", "clang", "clang++", "ar", "ld", "ranlib"]) == True:
|
||||
baseElementList = [
|
||||
"-o",
|
||||
"-D",
|
||||
"-I",
|
||||
"-L",
|
||||
"-framework",
|
||||
"-isysroot",
|
||||
"-arch",
|
||||
"-keystore",
|
||||
"-sigalg",
|
||||
"-digestalg",
|
||||
"-target",
|
||||
"-gcc-toolchain"]
|
||||
"-o",
|
||||
"-D",
|
||||
"-I",
|
||||
"-L",
|
||||
"-framework",
|
||||
"-isysroot",
|
||||
"-arch",
|
||||
"-keystore",
|
||||
"-sigalg",
|
||||
"-digestalg",
|
||||
"-target",
|
||||
"-gcc-toolchain",
|
||||
"-current_version",
|
||||
"-compatibility_version"
|
||||
]
|
||||
|
||||
for element in baseElementList:
|
||||
tmpcmdLine = tmpcmdLine.replace(element+'\n\t', element+' ')
|
||||
for element in ["<", "<<", ">", ">>"]:
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
@@ -97,13 +98,30 @@ class HeritageList:
|
||||
debug.verbose(" " + element.name + " " + str(element.depends))
|
||||
for element in reversed(self.list_heritage):
|
||||
for flags in element.flags:
|
||||
if flags in ["c-version", "c++-version"]:
|
||||
continue
|
||||
# get value
|
||||
value = element.flags[flags]
|
||||
if flags not in self.flags:
|
||||
self.flags[flags] = value
|
||||
else:
|
||||
append_to_list(self.flags[flags], value)
|
||||
# if it is a list, simply add element on the previous one
|
||||
if type(value) == list:
|
||||
if flags not in self.flags:
|
||||
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
|
||||
for ppp in element.path:
|
||||
value = element.path[ppp]
|
||||
if ppp not in self.path:
|
||||
@@ -113,19 +131,9 @@ class HeritageList:
|
||||
append_to_list(self.src['src'], element.src['src'])
|
||||
append_to_list(self.src['dynamic'], element.src['dynamic'])
|
||||
append_to_list(self.src['static'], element.src['static'])
|
||||
if "c-version" in element.flags:
|
||||
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
|
||||
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:
|
||||
def __init__(self, module, target):
|
||||
@@ -219,5 +227,8 @@ class heritage:
|
||||
if self.flags["c++-version"] > ver:
|
||||
ver = self.flags["c++-version"]
|
||||
self.flags["c++-version"] = ver
|
||||
|
||||
def __repr__(self):
|
||||
return "{Heritage:" + str(self.name) + " ... }"
|
||||
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
@@ -35,10 +36,13 @@ def get_pow_2_multiple(size):
|
||||
# check if time change
|
||||
# check if command line change
|
||||
def resize(src_file, dest_file, x, y, cmd_file=None):
|
||||
if enable_resize_image == False:
|
||||
return
|
||||
if os.path.exists(src_file) == False:
|
||||
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) + ")"
|
||||
if depend.need_re_build(dest_file, src_file, file_cmd=cmd_file , cmd_line=cmd_line) == False:
|
||||
return
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
|
352
lutin/module.py
352
lutin/module.py
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
@@ -9,6 +10,7 @@
|
||||
|
||||
import sys
|
||||
import os
|
||||
import copy
|
||||
import inspect
|
||||
import fnmatch
|
||||
# Local import
|
||||
@@ -20,6 +22,7 @@ from . import builder
|
||||
from . import multiprocess
|
||||
from . import image
|
||||
from . import license
|
||||
from . import env
|
||||
|
||||
class Module:
|
||||
|
||||
@@ -41,6 +44,8 @@ class Module:
|
||||
self.type='LIBRARY'
|
||||
# Name of the module
|
||||
self.name=module_name
|
||||
# Tools list:
|
||||
self.tools = []
|
||||
# Dependency list:
|
||||
self.depends = []
|
||||
# Dependency list (optionnal module):
|
||||
@@ -82,25 +87,26 @@ class Module:
|
||||
self.origin_file = file;
|
||||
self.origin_path = tools.get_current_path(self.origin_file)
|
||||
self.local_heritage = heritage.heritage(self, None)
|
||||
|
||||
self.package_prop = { "COMPAGNY_TYPE" : set(""),
|
||||
"COMPAGNY_NAME" : set(""),
|
||||
"COMPAGNY_NAME2" : set(""),
|
||||
"MAINTAINER" : set([]),
|
||||
# TODO : Do a better dynamic property system => not really versatil
|
||||
self.package_prop = { "COMPAGNY_TYPE" : "",
|
||||
"COMPAGNY_NAME" : "",
|
||||
"COMPAGNY_NAME2" : "",
|
||||
"MAINTAINER" : [],
|
||||
#"ICON" : set(""),
|
||||
"SECTION" : set([]),
|
||||
"PRIORITY" : set(""),
|
||||
"DESCRIPTION" : set(""),
|
||||
"SECTION" : [],
|
||||
"PRIORITY" : "",
|
||||
"DESCRIPTION" : "",
|
||||
"VERSION" : [0,0,0],
|
||||
"VERSION_CODE" : "",
|
||||
"NAME" : set("no-name"), # name of the application
|
||||
"NAME" : "no-name", # name of the application
|
||||
"ANDROID_MANIFEST" : "", # By default generate the manifest
|
||||
"ANDROID_RESOURCES" : [],
|
||||
"ANDROID_APPL_TYPE" : "APPL", # the other mode is "WALLPAPER" ... and later "WIDGET"
|
||||
"ANDROID_WALLPAPER_PROPERTIES" : [], # To create properties of the wallpaper (no use of EWOL display)
|
||||
"RIGHT" : [],
|
||||
"LICENSE" : "", # by default: no license
|
||||
"ADMOD_POSITION" : "top"
|
||||
"ADMOD_POSITION" : "top",
|
||||
"ANDROID_SIGN" : "no_file.jks"
|
||||
}
|
||||
self.package_prop_default = { "COMPAGNY_TYPE" : True,
|
||||
"COMPAGNY_NAME" : True,
|
||||
@@ -119,10 +125,14 @@ class Module:
|
||||
"ANDROID_WALLPAPER_PROPERTIES" : True,
|
||||
"RIGHT" : True,
|
||||
"LICENSE" : True,
|
||||
"ADMOD_POSITION" : True
|
||||
"ADMOD_POSITION" : True,
|
||||
"ANDROID_SIGN" : True
|
||||
}
|
||||
self.sub_heritage_list = None
|
||||
|
||||
def __repr__(self):
|
||||
return "{lutin.Module:" + str(self.name) + "}"
|
||||
|
||||
def get_type(self):
|
||||
return self.type
|
||||
##
|
||||
@@ -135,9 +145,10 @@ class Module:
|
||||
"-Wreturn-type",
|
||||
#"-Wint-to-pointer-cast",
|
||||
"-Wno-write-strings",
|
||||
"-Woverloaded-virtual",
|
||||
"-Wnon-virtual-dtor",
|
||||
"-Wno-unused-variable"]);
|
||||
self.compile_flags('c++', [
|
||||
"-Woverloaded-virtual",
|
||||
"-Wnon-virtual-dtor"]);
|
||||
#only for gcc : "-Wunused-variable", "-Wunused-but-set-variable",
|
||||
|
||||
##
|
||||
@@ -229,12 +240,38 @@ class Module:
|
||||
if self.type == 'PREBUILD':
|
||||
debug.error("Can not generate gcov on prebuid system ... : '" + self.name + "'");
|
||||
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:
|
||||
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 = ""
|
||||
for file in list_file:
|
||||
debug.verbose(" gcov : " + self.name + " <== " + file);
|
||||
file_dst = target.get_full_name_destination(self.name, self.origin_path, file, "o")
|
||||
debug.verbose(" gcov : " + self.name + " <== " + str(file));
|
||||
file_dst = target.get_full_name_destination(file[0], self.origin_path, file[1], "o")
|
||||
global_list_file += file_dst + " "
|
||||
cmd = "gcov"
|
||||
# specify the version of gcov we need to use
|
||||
@@ -256,39 +293,79 @@ class Module:
|
||||
executed_lines = 0
|
||||
executable_lines = 0
|
||||
for elem in ret:
|
||||
debug.debug("line: " + elem)
|
||||
if remove_next == True:
|
||||
remove_next = False
|
||||
debug.debug("--------------------------")
|
||||
continue;
|
||||
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
|
||||
continue
|
||||
if elem[:6] == "File '" \
|
||||
and self.origin_path != elem[6:len(self.origin_path)+6]:
|
||||
remove_next = True
|
||||
if elem[:6] in ["File '", "File «"] \
|
||||
or elem[:7] in ["File ' ", "File « "]:
|
||||
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
|
||||
if elem[:6] == "File '":
|
||||
last_file = elem[6+len(self.origin_path)+1:-1]
|
||||
if elem[:7] == "Aucune " \
|
||||
or elem[:19] == "No executable lines":
|
||||
debug.verbose(" Nothing to execute");
|
||||
continue
|
||||
start_with = "Lines executed:"
|
||||
if elem[:len(start_with)] != start_with:
|
||||
start_with = ["Lines executed:", "Lignes exécutées:"]
|
||||
find = False
|
||||
for line_base in start_with:
|
||||
if elem[:len(line_base)] == line_base:
|
||||
find = True
|
||||
elem = elem[len(line_base)+1:]
|
||||
break;
|
||||
if find == False:
|
||||
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");
|
||||
continue
|
||||
out = elem[len(start_with):].split("% of ")
|
||||
out = elem.split("% of ")
|
||||
if len(out) != 2:
|
||||
debug.warning(" gcov ret : " + str(elem));
|
||||
debug.warning(" Parsing error of '% of '");
|
||||
continue
|
||||
out = elem.split("% de ")
|
||||
if len(out) != 2:
|
||||
debug.warning(" gcov ret : " + str(elem));
|
||||
debug.warning(" Parsing error of '% of '");
|
||||
continue
|
||||
debug.verbose("property : " + str(out))
|
||||
pourcent = float(out[0])
|
||||
total_line_count = int(out[1])
|
||||
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])
|
||||
executed_lines += total_executed_line
|
||||
executable_lines += total_line_count
|
||||
last_file = ""
|
||||
debug.debug("--------------------------")
|
||||
ret = useful_list[:-1]
|
||||
debug.verbose("plopppp " + str(useful_list))
|
||||
#for elem in ret:
|
||||
# debug.info(" " + str(elem));
|
||||
for elem in ret:
|
||||
@@ -298,7 +375,10 @@ class Module:
|
||||
debug.info(" % " + str(elem[1]) + "\r\t\t" + str(elem[0]));
|
||||
else:
|
||||
debug.info(" % " + str(elem[1]) + "\r\t\t" + str(elem[0]));
|
||||
pourcent = 100.0*float(executed_lines)/float(executable_lines)
|
||||
try:
|
||||
pourcent = 100.0*float(executed_lines)/float(executable_lines)
|
||||
except ZeroDivisionError:
|
||||
pourcent = 0.0
|
||||
# generate json file:
|
||||
json_file_name = target.get_build_path(self.name) + "/" + self.name + "_coverage.json"
|
||||
debug.debug("generate json file : " + json_file_name)
|
||||
@@ -326,14 +406,16 @@ class Module:
|
||||
tmp_file.close()
|
||||
# print debug:
|
||||
debug.print_element("coverage", self.name, ":", str(pourcent) + "% " + str(executed_lines) + "/" + str(executable_lines))
|
||||
return True
|
||||
|
||||
# call here to build the module
|
||||
def build(self, target, package_name):
|
||||
# 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:
|
||||
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
|
||||
self.local_heritage = heritage.heritage(self, target)
|
||||
|
||||
@@ -386,22 +468,23 @@ class Module:
|
||||
# ----------------------------------------------------
|
||||
# -- Generic library help --
|
||||
# ----------------------------------------------------
|
||||
package_version_string = tools.version_to_string(self.package_prop["VERSION"]);
|
||||
if self.type == 'PREBUILD':
|
||||
debug.print_element("Prebuild", self.name, "", "")
|
||||
if self.type == 'LIBRARY':
|
||||
debug.print_element("Library", self.name, "", "")
|
||||
if self.type == 'LIBRARY_DYNAMIC':
|
||||
debug.print_element("Library(dynamic)", self.name, "", "")
|
||||
if self.type == 'LIBRARY_STATIC':
|
||||
debug.print_element("Library(static)", self.name, "", "")
|
||||
if self.type == 'BINARY':
|
||||
debug.print_element("Binary(auto)", self.name, "", "")
|
||||
if self.type == 'BINARY_SHARED':
|
||||
debug.print_element("Binary (shared)", self.name, "", "")
|
||||
if self.type == 'BINARY_STAND_ALONE':
|
||||
debug.print_element("Binary (stand alone)", self.name, "", "")
|
||||
if self.type == 'PACKAGE':
|
||||
debug.print_element("Package", self.name, "", "")
|
||||
debug.print_element("Prebuild", self.name, "-", package_version_string)
|
||||
elif self.type == 'LIBRARY':
|
||||
debug.print_element("Library", self.name, "-", package_version_string)
|
||||
elif self.type == 'LIBRARY_DYNAMIC':
|
||||
debug.print_element("Library(dynamic)", self.name, "-", package_version_string)
|
||||
elif self.type == 'LIBRARY_STATIC':
|
||||
debug.print_element("Library(static)", self.name, "-", package_version_string)
|
||||
elif self.type == 'BINARY':
|
||||
debug.print_element("Binary(auto)", self.name, "-", package_version_string)
|
||||
elif self.type == 'BINARY_SHARED':
|
||||
debug.print_element("Binary (shared)", self.name, "-", package_version_string)
|
||||
elif self.type == 'BINARY_STAND_ALONE':
|
||||
debug.print_element("Binary (stand alone)", self.name, "-", package_version_string)
|
||||
elif self.type == 'PACKAGE':
|
||||
debug.print_element("Package", self.name, "-", package_version_string)
|
||||
# ----------------------------------------------------
|
||||
# -- Sources compilation --
|
||||
# ----------------------------------------------------
|
||||
@@ -414,6 +497,9 @@ class Module:
|
||||
fileExt = file.split(".")[-1]
|
||||
try:
|
||||
tmp_builder = builder.get_builder(fileExt);
|
||||
multithreading = tmp_builder.get_support_multithreading()
|
||||
if multithreading == False:
|
||||
multiprocess.pool_synchrosize()
|
||||
res_file = tmp_builder.compile(file,
|
||||
package_name,
|
||||
target,
|
||||
@@ -423,6 +509,8 @@ class Module:
|
||||
name = self.name,
|
||||
basic_path = self.origin_path,
|
||||
module_src = self.src)
|
||||
if multithreading == False:
|
||||
multiprocess.pool_synchrosize()
|
||||
if res_file["action"] == "add":
|
||||
list_sub_file_needed_to_build.append(res_file["file"])
|
||||
elif res_file["action"] == "path":
|
||||
@@ -437,7 +525,10 @@ class Module:
|
||||
#debug.info(" " + self.name + " <== " + file);
|
||||
fileExt = file.split(".")[-1]
|
||||
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,
|
||||
package_name,
|
||||
target,
|
||||
@@ -447,6 +538,8 @@ class Module:
|
||||
name = self.name,
|
||||
basic_path = self.origin_path,
|
||||
module_src = self.src)
|
||||
if multithreading == False:
|
||||
multiprocess.pool_synchrosize()
|
||||
if res_file["action"] == "add":
|
||||
list_sub_file_needed_to_build.append(res_file["file"])
|
||||
elif res_file["action"] == "path":
|
||||
@@ -457,6 +550,7 @@ class Module:
|
||||
debug.warning(" UN-SUPPORTED file format: '" + self.origin_path + "/" + file + "'")
|
||||
# when multiprocess availlable, we need to synchronize here ...
|
||||
multiprocess.pool_synchrosize()
|
||||
|
||||
# ----------------------------------------------------
|
||||
# -- Generation point --
|
||||
# ----------------------------------------------------
|
||||
@@ -625,11 +719,19 @@ class Module:
|
||||
include_path = target.get_build_path_include(self.name)
|
||||
for file in self.header:
|
||||
src_path = os.path.join(self.origin_path, file["src"])
|
||||
dst_path = os.path.join(include_path, file["dst"])
|
||||
tools.copy_file(src_path,
|
||||
dst_path,
|
||||
force_identical=True,
|
||||
in_list=copy_list)
|
||||
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 ...)
|
||||
@@ -662,13 +764,14 @@ class Module:
|
||||
target.make_package(self.name, self.package_prop, os.path.join(self.origin_path, ".."), self.sub_heritage_list)
|
||||
|
||||
# return local dependency ...
|
||||
return self.sub_heritage_list
|
||||
return copy.deepcopy(self.sub_heritage_list)
|
||||
|
||||
# call here to clean the module
|
||||
def clean(self, target):
|
||||
if self.type=='PREBUILD':
|
||||
# nothing to add ==> just dependence
|
||||
None
|
||||
return True
|
||||
elif self.type=='LIBRARY' \
|
||||
or self.type=='LIBRARY_DYNAMIC' \
|
||||
or self.type=='LIBRARY_STATIC':
|
||||
@@ -676,6 +779,7 @@ class Module:
|
||||
pathbuild = target.get_build_path(self.name)
|
||||
debug.info("remove path : '" + pathbuild + "'")
|
||||
tools.remove_path_and_sub_path(pathbuild)
|
||||
return True
|
||||
elif self.type=='BINARY' \
|
||||
or self.type=='PACKAGE':
|
||||
# remove path of the lib ... for this targer
|
||||
@@ -685,51 +789,29 @@ class Module:
|
||||
pathStaging = target.get_staging_path(self.name)
|
||||
debug.info("remove path : '" + pathStaging + "'")
|
||||
tools.remove_path_and_sub_path(pathStaging)
|
||||
return True
|
||||
else:
|
||||
debug.error("Dit not know the element type ... (impossible case) type=" + self.type)
|
||||
|
||||
def append_and_check(self, listout, newElement, order):
|
||||
for element in listout:
|
||||
if element==newElement:
|
||||
return
|
||||
listout.append(newElement)
|
||||
if True==order:
|
||||
listout.sort()
|
||||
|
||||
def append_to_internal_list2(self, listout, module, list, order=False):
|
||||
# add list in the Map
|
||||
if module not in listout:
|
||||
listout[module] = []
|
||||
# add elements...
|
||||
self.append_to_internal_list(listout[module], list, order)
|
||||
|
||||
def append_to_internal_list(self, out_list, in_list, order=False):
|
||||
if type(in_list) == str:
|
||||
self.append_and_check(out_list, in_list, order)
|
||||
elif type(in_list) == list:
|
||||
# mulyiple imput in the list ...
|
||||
for elem in in_list:
|
||||
self.append_and_check(out_list, elem, order)
|
||||
elif type(in_list) == dict:
|
||||
self.append_and_check(out_list, in_list, order)
|
||||
else:
|
||||
debug.warning("can not add in list other than {list/dict/str} : " + str(type(in_list)))
|
||||
def add_tools(self, list):
|
||||
tools.list_append_to(self.tools, list, True)
|
||||
|
||||
def add_module_depend(self, list):
|
||||
self.append_to_internal_list(self.depends, list, True)
|
||||
tools.list_append_to(self.depends, list, True)
|
||||
|
||||
def add_optionnal_module_depend(self, module_name, compilation_flags=["", ""], export=False):
|
||||
self.append_and_check(self.depends_optionnal, [module_name, compilation_flags, export], True)
|
||||
tools.list_append_and_check(self.depends_optionnal, [module_name, compilation_flags, export], True)
|
||||
|
||||
def add_path(self, list, type='c'):
|
||||
self.append_to_internal_list2(self.path["local"], type, list)
|
||||
tools.list_append_to_2(self.path["local"], type, list)
|
||||
|
||||
def add_export_flag(self, type, list):
|
||||
self.append_to_internal_list2(self.flags["export"], type, list)
|
||||
tools.list_append_to_2(self.flags["export"], type, list)
|
||||
|
||||
# add the link flag at the module
|
||||
# TODO : Rename this in add_flag
|
||||
def compile_flags(self, type, list):
|
||||
self.append_to_internal_list2(self.flags["local"], type, list)
|
||||
tools.list_append_to_2(self.flags["local"], type, list)
|
||||
|
||||
def compile_version(self, compilator_type, version, same_as_api=True, gnu=False):
|
||||
if compilator_type == "c++" \
|
||||
@@ -766,23 +848,28 @@ class Module:
|
||||
debug.warning("Can not set version of compilator:" + str(compilator_type));
|
||||
|
||||
def add_src_file(self, list):
|
||||
self.append_to_internal_list(self.src, list, True)
|
||||
tools.list_append_to(self.src, list, True)
|
||||
|
||||
def add_header_file(self, list, 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 = []
|
||||
for elem in list:
|
||||
if destination_path != None:
|
||||
new_list.append({"src":elem,
|
||||
"dst":os.path.join(destination_path, os.path.basename(elem))})
|
||||
base = os.path.basename(elem)
|
||||
if '*' in base or '[' in base or '(' in base:
|
||||
new_list.append({"src":elem,
|
||||
"multi-dst":destination_path})
|
||||
else:
|
||||
new_list.append({"src":elem,
|
||||
"dst":os.path.join(destination_path, base)})
|
||||
else:
|
||||
new_list.append({"src":elem,
|
||||
"dst":elem})
|
||||
self.append_to_internal_list(self.header, new_list, True)
|
||||
tools.list_append_to(self.header, new_list, True)
|
||||
|
||||
def add_export_path(self, list, type='c'):
|
||||
self.append_to_internal_list2(self.path["export"], type, list)
|
||||
tools.list_append_to_2(self.path["export"], type, list)
|
||||
|
||||
def copy_image(self, source, destination='', sizeX=-1, sizeY=-1):
|
||||
self.image_to_copy.append([source, destination, sizeX, sizeY])
|
||||
@@ -803,7 +890,7 @@ class Module:
|
||||
print(' ' + str(description))
|
||||
print(' ' + str(input_list))
|
||||
|
||||
def display(self, target):
|
||||
def display(self):
|
||||
print('-----------------------------------------------')
|
||||
print(' package : "' + self.name + "'")
|
||||
print('-----------------------------------------------')
|
||||
@@ -827,12 +914,13 @@ class Module:
|
||||
self.print_list('paths',self.paths)
|
||||
for element in self.path["local"]:
|
||||
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"]:
|
||||
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):
|
||||
if "COMPAGNY_TYPE" == variable:
|
||||
@@ -896,7 +984,8 @@ class Module:
|
||||
"ANDROID_APPL_TYPE",
|
||||
"ADMOD_ID",
|
||||
"APPLE_APPLICATION_IOS_ID",
|
||||
"LICENSE"]:
|
||||
"LICENSE",
|
||||
"ANDROID_SIGN"]:
|
||||
self.package_prop[variable] = value
|
||||
self.package_prop_default[variable] = False
|
||||
elif "ADMOD_POSITION" == variable:
|
||||
@@ -937,29 +1026,32 @@ class Module:
|
||||
self.ext_project_add_module(target, projectMng)
|
||||
projectMng.generate_project_file()
|
||||
|
||||
|
||||
|
||||
module_list=[]
|
||||
__start_module_name="lutin_"
|
||||
__start_module_name="_"
|
||||
|
||||
def import_path(path):
|
||||
def import_path(path_list):
|
||||
global module_list
|
||||
matches = []
|
||||
debug.debug('MODULE: Start find sub File : "%s"' %path)
|
||||
for root, dirnames, filenames in os.walk(path):
|
||||
tmpList = fnmatch.filter(filenames, __start_module_name + "*.py")
|
||||
# Import the module :
|
||||
for filename in tmpList:
|
||||
debug.debug('Module: Find a file : "%s"' %os.path.join(root, filename))
|
||||
#matches.append(os.path.join(root, filename))
|
||||
sys.path.append(os.path.dirname(os.path.join(root, filename)) )
|
||||
module_name = filename.replace('.py', '')
|
||||
module_name = module_name.replace(__start_module_name, '')
|
||||
debug.debug("MODULE: Integrate module: '" + module_name + "' from '" + os.path.join(root, filename) + "'")
|
||||
module_list.append([module_name,os.path.join(root, filename)])
|
||||
global_base = env.get_build_system_base_name()
|
||||
debug.debug("MODULE: 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_module_name)] != __start_module_name:
|
||||
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: ")
|
||||
for mod in module_list:
|
||||
debug.verbose(" " + str(mod[0]))
|
||||
for elem in module_list:
|
||||
debug.verbose(" " + str(elem[0]))
|
||||
|
||||
def exist(target, name):
|
||||
global module_list
|
||||
@@ -973,9 +1065,9 @@ def load_module(target, name):
|
||||
for mod in module_list:
|
||||
if mod[0] == name:
|
||||
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 = __import__(__start_module_name + name)
|
||||
the_module = __import__(env.get_build_system_base_name() + __start_module_name + name)
|
||||
# get basic module properties:
|
||||
property = get_module_option(the_module, name)
|
||||
# configure the module:
|
||||
@@ -1020,6 +1112,7 @@ def load_module(target, name):
|
||||
debug.debug("Request load module '" + name + "' not define for this platform")
|
||||
else:
|
||||
target.add_module(tmp_element)
|
||||
return tmp_element
|
||||
|
||||
def list_all_module():
|
||||
global module_list
|
||||
@@ -1033,7 +1126,7 @@ def list_all_module_with_desc():
|
||||
tmpList = []
|
||||
for mod in module_list:
|
||||
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]))
|
||||
return tmpList
|
||||
|
||||
@@ -1047,22 +1140,25 @@ def get_module_option(the_module, name):
|
||||
compagny_name = None
|
||||
maintainer = 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()
|
||||
else:
|
||||
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()
|
||||
|
||||
if "get_desc" in dir(the_module):
|
||||
if "get_desc" in list_of_function_in_factory:
|
||||
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()
|
||||
|
||||
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()
|
||||
# com : Commercial
|
||||
# net : Network??
|
||||
@@ -1076,15 +1172,18 @@ def get_module_option(the_module, name):
|
||||
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))
|
||||
|
||||
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()
|
||||
|
||||
if "get_maintainer" in dir(the_module):
|
||||
if "get_maintainer" in list_of_function_in_factory:
|
||||
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()
|
||||
|
||||
if "get_version_id" in list_of_function_in_factory:
|
||||
version_id = the_module.get_version_id()
|
||||
|
||||
return {
|
||||
"name":name,
|
||||
"description":description,
|
||||
@@ -1094,7 +1193,8 @@ def get_module_option(the_module, name):
|
||||
"compagny-type":compagny_type,
|
||||
"compagny-name":compagny_name,
|
||||
"maintainer":maintainer,
|
||||
"version":version
|
||||
"version":version,
|
||||
"version-id":version_id
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
@@ -24,13 +25,13 @@ from . import tools
|
||||
from . import env
|
||||
from . import depend
|
||||
|
||||
queueLock = threading.Lock()
|
||||
workQueue = queue.Queue()
|
||||
currentThreadWorking = 0
|
||||
queue_lock = threading.Lock()
|
||||
work_queue = queue.Queue()
|
||||
current_thread_working = 0
|
||||
threads = []
|
||||
# To know the first error arrive in the pool ==> to display all the time the same error file when multiple compilation
|
||||
currentIdExecution = 0
|
||||
errorExecution = {
|
||||
current_id_execution = 0
|
||||
error_execution = {
|
||||
"id":-1,
|
||||
"cmd":"",
|
||||
"return":0,
|
||||
@@ -38,10 +39,26 @@ errorExecution = {
|
||||
"out":"",
|
||||
}
|
||||
|
||||
exitFlag = False # resuest stop of the thread
|
||||
isinit = False # the thread are initialized
|
||||
errorOccured = False # a thread have an error
|
||||
processorAvaillable = 1 # number of CPU core availlable
|
||||
exit_flag = False # resuest stop of the thread
|
||||
is_init = False # the thread are initialized
|
||||
error_occured = False # a thread have an error
|
||||
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
|
||||
@@ -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):
|
||||
global errorOccured
|
||||
global exitFlag
|
||||
global currentIdExecution
|
||||
global error_occured
|
||||
global exit_flag
|
||||
global current_id_execution
|
||||
global error_execution
|
||||
# prepare command line:
|
||||
args = shlex.split(cmd_line)
|
||||
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 :
|
||||
if p.returncode == 0:
|
||||
debug.debug(env.print_pretty(cmd_line))
|
||||
queueLock.acquire()
|
||||
queue_lock.acquire()
|
||||
if depend_data != None:
|
||||
depend.create_dependency_file(depend_data['file'], depend_data['data'])
|
||||
# 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)
|
||||
if err != "":
|
||||
debug.print_compilator(err)
|
||||
queueLock.release()
|
||||
queue_lock.release()
|
||||
else:
|
||||
errorOccured = True
|
||||
exitFlag = True
|
||||
error_occured = True
|
||||
exit_flag = True
|
||||
# if No ID : Not in a multiprocess mode ==> just stop here
|
||||
if build_id < 0:
|
||||
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))
|
||||
else:
|
||||
# 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 errorExecution["id"] >= build_id:
|
||||
if error_execution["id"] >= build_id:
|
||||
# nothing to do ...
|
||||
queueLock.release()
|
||||
queue_lock.release()
|
||||
return;
|
||||
errorExecution["id"] = build_id
|
||||
errorExecution["cmd"] = cmd_line
|
||||
errorExecution["return"] = p.returncode
|
||||
errorExecution["err"] = err,
|
||||
errorExecution["out"] = output,
|
||||
queueLock.release()
|
||||
error_execution["id"] = build_id
|
||||
error_execution["cmd"] = cmd_line
|
||||
error_execution["return"] = p.returncode
|
||||
error_execution["err"] = err,
|
||||
error_execution["out"] = output,
|
||||
queue_lock.release()
|
||||
# not write the command file...
|
||||
return
|
||||
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):
|
||||
def __init__(self, threadID, lock, queue):
|
||||
def __init__(self, thread_id, lock, queue):
|
||||
threading.Thread.__init__(self)
|
||||
self.thread_id = threadID
|
||||
self.name = "Thread " + str(threadID)
|
||||
self.thread_id = thread_id
|
||||
self.name = "Thread " + str(thread_id)
|
||||
self.queue = queue
|
||||
self.lock = lock
|
||||
def run(self):
|
||||
debug.verbose("Starting " + self.name)
|
||||
global exitFlag
|
||||
global currentThreadWorking
|
||||
workingSet = False
|
||||
while exitFlag == False:
|
||||
global exit_flag
|
||||
global current_thread_working
|
||||
working_set = False
|
||||
while exit_flag == False:
|
||||
self.lock.acquire()
|
||||
if not self.queue.empty():
|
||||
if workingSet==False:
|
||||
currentThreadWorking += 1
|
||||
workingSet = True
|
||||
if working_set == False:
|
||||
current_thread_working += 1
|
||||
working_set = True
|
||||
data = self.queue.get()
|
||||
self.lock.release()
|
||||
debug.verbose(self.name + " processing '" + data[0] + "'")
|
||||
if data[0]=="cmdLine":
|
||||
if data[0]=="cmd_line":
|
||||
comment = data[2]
|
||||
cmdLine = data[1]
|
||||
cmdStoreFile = data[3]
|
||||
debug.print_element( "[" + str(data[4]) + "][" + str(self.thread_id) + "] " + comment[0], comment[1], comment[2], comment[3])
|
||||
run_command(cmdLine, cmdStoreFile, build_id=data[4], file=comment[3], store_output_file=data[5], depend_data=data[6])
|
||||
cmd_line = data[1]
|
||||
cmd_store_file = data[3]
|
||||
debug.print_element("[" + str(data[4]) + "][" + str(self.thread_id) + "] " + comment[0],
|
||||
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:
|
||||
debug.warning("unknow request command : " + data[0])
|
||||
else:
|
||||
if workingSet==True:
|
||||
currentThreadWorking -= 1
|
||||
workingSet=False
|
||||
if working_set==True:
|
||||
current_thread_working -= 1
|
||||
working_set=False
|
||||
# no element to parse, just wait ...
|
||||
self.lock.release()
|
||||
time.sleep(0.2)
|
||||
@@ -180,39 +206,41 @@ class myThread(threading.Thread):
|
||||
debug.verbose("Exiting " + self.name)
|
||||
|
||||
|
||||
def error_occured():
|
||||
global exitFlag
|
||||
exitFlag = True
|
||||
def set_error_occured():
|
||||
global exit_flag
|
||||
exit_flag = True
|
||||
|
||||
def set_core_number(numberOfcore):
|
||||
global processorAvaillable
|
||||
processorAvaillable = numberOfcore
|
||||
debug.debug(" set number of core for multi process compilation : " + str(processorAvaillable))
|
||||
def set_core_number(number_of_core):
|
||||
global processor_availlable
|
||||
processor_availlable = number_of_core
|
||||
debug.debug(" set number of core for multi process compilation : " + str(processor_availlable))
|
||||
# nothing else to do
|
||||
|
||||
def init():
|
||||
global exitFlag
|
||||
global isinit
|
||||
if isinit==False:
|
||||
isinit=True
|
||||
global error_occured
|
||||
global exit_flag
|
||||
global is_init
|
||||
if is_init == False:
|
||||
is_init = True
|
||||
error_occured = False
|
||||
global threads
|
||||
global queueLock
|
||||
global workQueue
|
||||
global queue_lock
|
||||
global work_queue
|
||||
# Create all the new threads
|
||||
threadID = 0
|
||||
while threadID < processorAvaillable:
|
||||
thread = myThread(threadID, queueLock, workQueue)
|
||||
thread_id = 0
|
||||
while thread_id < processor_availlable:
|
||||
thread = myThread(thread_id, queue_lock, work_queue)
|
||||
thread.start()
|
||||
threads.append(thread)
|
||||
threadID += 1
|
||||
thread_id += 1
|
||||
|
||||
|
||||
|
||||
def un_init():
|
||||
global exitFlag
|
||||
global exit_flag
|
||||
# Notify threads it's time to exit
|
||||
exitFlag = True
|
||||
if processorAvaillable > 1:
|
||||
exit_flag = True
|
||||
if processor_availlable > 1:
|
||||
# Wait for all threads to complete
|
||||
for tmp in threads:
|
||||
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):
|
||||
global currentIdExecution
|
||||
if processorAvaillable <= 1:
|
||||
global current_id_execution
|
||||
if processor_availlable <= 1:
|
||||
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)
|
||||
return
|
||||
# multithreaded mode
|
||||
init()
|
||||
# Fill the queue
|
||||
queueLock.acquire()
|
||||
debug.verbose("add : in pool cmdLine")
|
||||
workQueue.put(["cmdLine", cmd_line, comment, store_cmd_line, currentIdExecution, store_output_file, depend_data])
|
||||
currentIdExecution +=1;
|
||||
queueLock.release()
|
||||
queue_lock.acquire()
|
||||
debug.verbose("add : in pool cmd_line")
|
||||
work_queue.put(["cmd_line", cmd_line, comment, store_cmd_line, current_id_execution, store_output_file, depend_data])
|
||||
current_id_execution +=1;
|
||||
queue_lock.release()
|
||||
|
||||
|
||||
def pool_synchrosize():
|
||||
global errorOccured
|
||||
global errorExecution
|
||||
if processorAvaillable <= 1:
|
||||
global error_occured
|
||||
global error_execution
|
||||
if processor_availlable <= 1:
|
||||
#in this case : nothing to synchronise
|
||||
return
|
||||
|
||||
debug.verbose("wait queue process ended\n")
|
||||
# Wait for queue to empty
|
||||
while not workQueue.empty() \
|
||||
and False==errorOccured:
|
||||
while not work_queue.empty() \
|
||||
and error_occured == False:
|
||||
time.sleep(0.2)
|
||||
pass
|
||||
# Wait all thread have ended their current process
|
||||
while currentThreadWorking != 0 \
|
||||
and False==errorOccured:
|
||||
while current_thread_working != 0 \
|
||||
and error_occured == False:
|
||||
time.sleep(0.2)
|
||||
pass
|
||||
if False==errorOccured:
|
||||
if error_occured == False:
|
||||
debug.verbose("queue is empty")
|
||||
else:
|
||||
un_init()
|
||||
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)")
|
||||
return
|
||||
debug.error("Error in an pool element : [" + str(errorExecution["id"]) + "]", crash=False)
|
||||
debug.debug(env.print_pretty(errorExecution["cmd"]), force=True)
|
||||
debug.print_compilator(str(errorExecution["out"][0]))
|
||||
debug.print_compilator(str(errorExecution["err"][0]))
|
||||
if errorExecution["return"] == 2:
|
||||
debug.error("Error in an pool element : [" + str(error_execution["id"]) + "]", crash=False)
|
||||
debug.debug(env.print_pretty(error_execution["cmd"]), force=True)
|
||||
debug.print_compilator(str(error_execution["out"][0]))
|
||||
debug.print_compilator(str(error_execution["err"][0]))
|
||||
if error_execution["return"] == 2:
|
||||
debug.error("can not compile file ... [keyboard interrrupt]")
|
||||
else:
|
||||
debug.error("can not compile file ... return value : " + str(errorExecution["return"]))
|
||||
debug.error("can not compile file ... return value : " + str(error_execution["return"]))
|
||||
|
||||
|
179
lutin/system.py
179
lutin/system.py
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
@@ -15,77 +16,56 @@ import datetime
|
||||
# Local import
|
||||
from . import debug
|
||||
from . import module
|
||||
from . import tools
|
||||
from . import env
|
||||
|
||||
class System:
|
||||
def __init__(self):
|
||||
self.valid=False;
|
||||
self.help="";
|
||||
self.include_cc=[]
|
||||
self.export_flags_cc=[]
|
||||
self.export_flags_xx=[]
|
||||
self.export_flags_mm=[]
|
||||
self.export_flags_m=[]
|
||||
self.export_flags_ar=[]
|
||||
self.export_flags_ld=[]
|
||||
self.export_flags_ld_shared=[]
|
||||
self.export_libs_ld=[]
|
||||
self.export_libs_ld_shared=[]
|
||||
self.export_depends=[]
|
||||
self.export_flags={}
|
||||
self.export_src=[]
|
||||
self.export_path=[]
|
||||
self.action_on_state={}
|
||||
|
||||
def append_and_check(self, listout, newElement, order):
|
||||
for element in listout:
|
||||
if element==newElement:
|
||||
return
|
||||
listout.append(newElement)
|
||||
if True==order:
|
||||
listout.sort()
|
||||
|
||||
def append_to_internal_list(self, listout, list, order=False):
|
||||
if type(list) == type(str()):
|
||||
self.append_and_check(listout, list, order)
|
||||
else:
|
||||
# mulyiple imput in the list ...
|
||||
for elem in list:
|
||||
self.append_and_check(listout, elem, order)
|
||||
def add_export_sources(self, list):
|
||||
tools.list_append_to(self.export_src, list)
|
||||
|
||||
def add_export_flag_LD(self, list):
|
||||
self.append_to_internal_list(self.export_flags_ld, list)
|
||||
# todo : add other than C ...
|
||||
def add_export_path(self, list):
|
||||
tools.list_append_to(self.export_path, list)
|
||||
|
||||
def add_export_flag_CC(self, list):
|
||||
self.append_to_internal_list(self.export_flags_cc, list)
|
||||
def add_module_depend(self, list):
|
||||
tools.list_append_to(self.export_depends, list, True)
|
||||
|
||||
def add_export_flag_XX(self, list):
|
||||
self.append_to_internal_list(self.export_flags_xx, list)
|
||||
|
||||
def add_export_flag_M(self, list):
|
||||
self.append_to_internal_list(self.export_flags_m, list)
|
||||
|
||||
def add_export_flag_MM(self, list):
|
||||
self.append_to_internal_list(self.export_flags_mm, list)
|
||||
|
||||
def add_export_SRC(self, list):
|
||||
self.append_to_internal_list(self.export_src, list)
|
||||
def add_export_flag(self, type, list):
|
||||
tools.list_append_to_2(self.export_flags, type, list)
|
||||
|
||||
def add_action(self, name_of_state="PACKAGE", level=5, name="no-name", action=None):
|
||||
if name_of_state not in self.action_on_state:
|
||||
if name_of_state not in self.action_on_add_src_filestate:
|
||||
self.action_on_state[name_of_state] = [[level, name, action]]
|
||||
else:
|
||||
self.action_on_state[name_of_state].append([level, name, action])
|
||||
|
||||
def __repr__(self):
|
||||
return "{lutin.System}"
|
||||
|
||||
|
||||
|
||||
def createModuleFromSystem(target, dict):
|
||||
def create_module_from_system(target, dict):
|
||||
myModule = module.Module(dict["path"], dict["name"], 'PREBUILD')
|
||||
|
||||
myModule.add_export_flag('c', dict["system"].export_flags_cc)
|
||||
myModule.add_export_flag('link', dict["system"].export_flags_ld)
|
||||
myModule.add_export_flag('c++', dict["system"].export_flags_xx)
|
||||
myModule.add_export_flag('m', dict["system"].export_flags_m)
|
||||
myModule.add_export_flag('mm', dict["system"].export_flags_mm)
|
||||
# add element flags to export
|
||||
for elem in dict["system"].export_flags:
|
||||
debug.verbose("add element :" + str(elem) + " elems=" + str(dict["system"].export_flags[elem]))
|
||||
myModule.add_export_flag(elem, dict["system"].export_flags[elem])
|
||||
# add module dependency
|
||||
myModule.add_module_depend(dict["system"].export_depends)
|
||||
# add exporting sources
|
||||
myModule.add_src_file(dict["system"].export_src)
|
||||
|
||||
# add export path
|
||||
myModule.add_export_path(dict["system"].export_path)
|
||||
# Export all actions ...
|
||||
for elem in dict["system"].action_on_state:
|
||||
level, name, action = dict["system"].action_on_state[elem]
|
||||
target.add_action(elem, level, name, action)
|
||||
@@ -97,64 +77,73 @@ def createModuleFromSystem(target, dict):
|
||||
|
||||
# Dictionnaire of Target name
|
||||
# inside table of ["Name of the lib", "path of the lib", boolean loaded, module loaded]
|
||||
systemList={}
|
||||
__start_system_name="lutinSystem_"
|
||||
system_list={}
|
||||
__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():
|
||||
global systemList
|
||||
for elementName in systemList:
|
||||
debug.info("integrate system: '" + elementName +"'")
|
||||
for data in systemList[elementName]:
|
||||
debug.info(" '" + data["name"] +"' in " + data["path"])
|
||||
|
||||
global system_list
|
||||
for elementName in system_list:
|
||||
debug.info("SYSTEM: Integrate system: '" + elementName +"'")
|
||||
for data in system_list[elementName]:
|
||||
debug.info("SYSTEM: '" + data["name"] +"' in " + data["path"])
|
||||
|
||||
def exist(lib_name, target_name, target) :
|
||||
global systemList
|
||||
global system_list
|
||||
debug.verbose("exist= " + lib_name + " in " + target_name)
|
||||
if target_name not in systemList:
|
||||
if target_name not in system_list:
|
||||
return False
|
||||
for data in systemList[target_name]:
|
||||
for data in system_list[target_name]:
|
||||
if data["name"] == lib_name:
|
||||
# we find it in the List ==> need to check if it is present in the system :
|
||||
if data["loaded"] == False:
|
||||
debug.verbose("add to path: '" + os.path.dirname(data["path"]) + "'")
|
||||
sys.path.append(os.path.dirname(data["path"]))
|
||||
debug.verbose("import system : '" + data["name"] + "'")
|
||||
theSystem = __import__(__start_system_name + target_name + "_" + data["name"])
|
||||
theSystem = __import__(env.get_build_system_base_name() + __start_system_name + target_name + "_" + data["name"])
|
||||
#create the system module
|
||||
try:
|
||||
debug.info("call : " + data["name"])
|
||||
debug.verbose("SYSTEM: request: " + data["name"])
|
||||
data["system"] = theSystem.System(target)
|
||||
data["exist"] = data["system"].valid
|
||||
except:
|
||||
@@ -163,16 +152,16 @@ def exist(lib_name, target_name, target) :
|
||||
return False
|
||||
|
||||
def load(target, lib_name, target_name):
|
||||
global systemList
|
||||
if target_name not in systemList:
|
||||
global system_list
|
||||
if target_name not in system_list:
|
||||
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["exist"] == False:
|
||||
debug.error("you must call this function after checking of the system exist() !2!")
|
||||
if data["module"] == None:
|
||||
# create a module from the system interface...
|
||||
data["module"] = createModuleFromSystem(target, data)
|
||||
data["module"] = create_module_from_system(target, data)
|
||||
data["loaded"] = True
|
||||
target.add_module(data["module"])
|
||||
return
|
||||
|
371
lutin/target.py
371
lutin/target.py
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
@@ -19,6 +20,7 @@ from . import tools
|
||||
from . import module
|
||||
from . import system
|
||||
from . import multiprocess
|
||||
from . import env
|
||||
|
||||
class Target:
|
||||
def __init__(self, name, config, arch):
|
||||
@@ -43,6 +45,7 @@ class Target:
|
||||
# todo : remove this :
|
||||
self.sumulator = config["simulation"]
|
||||
self.name = name
|
||||
self.config_based_on = name
|
||||
self.end_generate_package = config["generate-package"]
|
||||
debug.info("=================================");
|
||||
debug.info("== Target='" + self.name + "' " + config["bus-size"] + " bits for arch '" + config["arch"] + "'");
|
||||
@@ -54,11 +57,11 @@ class Target:
|
||||
# Target global variables.
|
||||
###############################################################################
|
||||
self.global_include_cc=[]
|
||||
"""
|
||||
self.global_flags_cc=['-D__TARGET_OS__'+self.name,
|
||||
'-D__TARGET_ARCH__'+self.select_arch,
|
||||
'-D__TARGET_ADDR__'+self.select_bus + 'BITS',
|
||||
'-D_REENTRANT']
|
||||
|
||||
self.global_flags_xx=[]
|
||||
self.global_flags_mm=[]
|
||||
if self.name == "Windows":
|
||||
@@ -68,6 +71,9 @@ class Target:
|
||||
self.global_flags_ar=['rcs']
|
||||
self.global_flags_ld=[]
|
||||
self.global_flags_ld_shared=[]
|
||||
"""
|
||||
self.global_flags={}
|
||||
|
||||
self.global_libs_ld=[]
|
||||
self.global_libs_ld_shared=[]
|
||||
|
||||
@@ -86,28 +92,53 @@ class Target:
|
||||
self.path_generate_code="/generate_header"
|
||||
self.path_arch="/" + self.name
|
||||
|
||||
self.add_flag("c", [
|
||||
'-D__TARGET_OS__' + self.name,
|
||||
'-D__TARGET_ARCH__' + self.select_arch,
|
||||
'-D__TARGET_ADDR__' + self.select_bus + 'BITS',
|
||||
'-D_REENTRANT'
|
||||
])
|
||||
self.add_flag("c++", "-nostdlib")
|
||||
self.add_flag("ar", 'rcs')
|
||||
|
||||
if self.name == "Windows":
|
||||
self.add_flag("c++", ['-static-libgcc', '-static-libstdc++'])
|
||||
|
||||
if "debug" == self.config["mode"]:
|
||||
self.global_flags_cc.append("-g")
|
||||
self.global_flags_cc.append("-DDEBUG")
|
||||
self.global_flags_cc.append("-O0")
|
||||
self.add_flag("c", [
|
||||
"-g",
|
||||
"-DDEBUG"
|
||||
])
|
||||
if env.get_force_optimisation() == False:
|
||||
self.add_flag("c", "-O0")
|
||||
else:
|
||||
self.add_flag("c", "-O3")
|
||||
else:
|
||||
self.global_flags_cc.append("-DNDEBUG")
|
||||
self.global_flags_cc.append("-O3")
|
||||
self.add_flag("c", [
|
||||
"-DNDEBUG",
|
||||
"-O3"
|
||||
])
|
||||
|
||||
## To add code coverate on build result system
|
||||
if self.config["gcov"] == True:
|
||||
self.global_flags_cc.append("-fprofile-arcs")
|
||||
self.global_flags_cc.append("-ftest-coverage")
|
||||
self.global_flags_ld.append("-fprofile-arcs")
|
||||
self.global_flags_ld.append("-ftest-coverage")
|
||||
if self.config["compilator"] == "clang":
|
||||
self.add_flag("c", [
|
||||
"--coverage"
|
||||
])
|
||||
self.add_flag("link", [
|
||||
"--coverage"
|
||||
])
|
||||
else:
|
||||
self.add_flag("c", [
|
||||
"-fprofile-arcs",
|
||||
"-ftest-coverage"
|
||||
])
|
||||
self.add_flag("link", [
|
||||
"-lgcov",
|
||||
"--coverage"
|
||||
])
|
||||
|
||||
self.update_path_tree()
|
||||
"""
|
||||
self.path_bin="usr/bin"
|
||||
self.path_lib="usr/lib"
|
||||
self.path_data="usr/share"
|
||||
self.path_doc="usr/share/doc"
|
||||
"""
|
||||
self.path_bin="bin"
|
||||
self.path_lib="lib"
|
||||
self.path_data="share"
|
||||
@@ -137,6 +168,12 @@ class Target:
|
||||
# special case for IOS (example) no build dynamicly ...
|
||||
self.support_dynamic_link = True
|
||||
|
||||
def __repr__(self):
|
||||
return "{lutin.Target}"
|
||||
|
||||
def add_flag(self, type, list):
|
||||
tools.list_append_to_2(self.global_flags, type, list)
|
||||
|
||||
def update_path_tree(self):
|
||||
self.path_out = os.path.join("out", self.name + "_" + self.config["arch"] + "_" + self.config["bus-size"], self.config["mode"])
|
||||
self.path_final = os.path.join("final", self.config["compilator"])
|
||||
@@ -196,6 +233,16 @@ class Target:
|
||||
self.strip = self.cross + "strip"
|
||||
self.dlltool = self.cross + "dlltool"
|
||||
self.update_path_tree()
|
||||
|
||||
#some static libraries that is sometime needed when not use stdlib ...
|
||||
ret = multiprocess.run_command_direct(self.xx + " -print-file-name=libgcc.a");
|
||||
if ret == False:
|
||||
debug.error("Can not get the g++/clang++ libgcc.a ...")
|
||||
self.stdlib_name_libgcc = ret;
|
||||
ret = multiprocess.run_command_direct(self.xx + " -print-file-name=libsupc++.a");
|
||||
if ret == False:
|
||||
debug.error("Can not get the g++/clang++ libsupc++.a ...")
|
||||
self.stdlib_name_libsupc = ret;
|
||||
|
||||
def get_build_mode(self):
|
||||
return self.config["mode"]
|
||||
@@ -402,19 +449,18 @@ class Target:
|
||||
for elem in self.module_list:
|
||||
if elem.name == name:
|
||||
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:
|
||||
exist = module.exist(self, name)
|
||||
if exist == True:
|
||||
module.load_module(self, name)
|
||||
return True;
|
||||
else:
|
||||
return False;
|
||||
# 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;
|
||||
# we did not find the module ...
|
||||
return False;
|
||||
|
||||
def load_all(self):
|
||||
listOfAllTheModule = module.list_all_module()
|
||||
@@ -427,15 +473,25 @@ class Target:
|
||||
mod.ext_project_add_module(self, projectMng, addedModule)
|
||||
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":
|
||||
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":
|
||||
debug.info("dump all")
|
||||
self.load_all()
|
||||
for mod in self.module_list:
|
||||
mod.display(self)
|
||||
mod.display()
|
||||
return
|
||||
if name == "all":
|
||||
debug.info("build all")
|
||||
@@ -454,53 +510,100 @@ class Target:
|
||||
for mod in self.module_list:
|
||||
mod.clean(self)
|
||||
else:
|
||||
# get the action an the module ....
|
||||
name2 = name.replace("@", "?")
|
||||
gettedElement = name2.split("?")
|
||||
module_name = gettedElement[0]
|
||||
if len(gettedElement)>=3:
|
||||
sub_action_name = gettedElement[2]
|
||||
else:
|
||||
sub_action_name = ""
|
||||
if len(gettedElement)>=2:
|
||||
actionName = gettedElement[1]
|
||||
else :
|
||||
actionName = "build"
|
||||
debug.verbose("requested : " + module_name + "?" + actionName)
|
||||
if actionName == "install":
|
||||
self.build(module_name + "?build")
|
||||
self.install_package(module_name)
|
||||
elif actionName == "uninstall":
|
||||
self.un_install_package(module_name)
|
||||
elif actionName == "log":
|
||||
self.Log(module_name)
|
||||
else:
|
||||
present = self.load_if_needed(module_name, optionnal=optionnal)
|
||||
if present == False \
|
||||
and optionnal == True:
|
||||
return [heritage.HeritageList(), False]
|
||||
# clean requested
|
||||
for mod in self.module_list:
|
||||
if mod.name == module_name:
|
||||
if actionName == "dump":
|
||||
debug.info("dump module '" + module_name + "'")
|
||||
return mod.display(self)
|
||||
elif actionName == "clean":
|
||||
debug.info("clean module '" + module_name + "'")
|
||||
return mod.clean(self)
|
||||
elif actionName == "gcov":
|
||||
debug.debug("gcov on module '" + module_name + "'")
|
||||
if sub_action_name == "output":
|
||||
return mod.gcov(self, generate_output=True)
|
||||
return mod.gcov(self, generate_output=False)
|
||||
elif actionName == "build":
|
||||
debug.debug("build module '" + module_name + "'")
|
||||
if optionnal == True:
|
||||
return [mod.build(self, None), True]
|
||||
return mod.build(self, None)
|
||||
if optionnal == True:
|
||||
return [heritage.HeritageList(), False]
|
||||
debug.error("not know module name : '" + module_name + "' to '" + actionName + "' it")
|
||||
module_name = name
|
||||
action_list = actions
|
||||
for action_name in action_list:
|
||||
debug.verbose("requested : " + module_name + "?" + action_name + " [START]")
|
||||
ret = None;
|
||||
if action_name == "install":
|
||||
try:
|
||||
self.install_package(module_name)
|
||||
except AttributeError:
|
||||
debug.error("target have no 'install_package' instruction")
|
||||
elif action_name == "uninstall":
|
||||
try:
|
||||
self.un_install_package(module_name)
|
||||
except AttributeError:
|
||||
debug.error("target have no 'un_install_package' instruction")
|
||||
elif action_name[:3] == "run":
|
||||
if len(action_name) > 3:
|
||||
# we have option:
|
||||
action_name2 = action_name.replace("\:", "1234COLUMN4321")
|
||||
option_list = action_name2.split(":")
|
||||
if len(option_list) == 0:
|
||||
debug.warning("action 'run' wrong options options ... : '" + action_name + "' might be separate with ':'")
|
||||
option_list = []
|
||||
else:
|
||||
option_list_tmp = option_list[1:]
|
||||
option_list = []
|
||||
for elem in option_list_tmp:
|
||||
option_list.append(elem.replace("1234COLUMN4321", ":"))
|
||||
else:
|
||||
option_list = []
|
||||
#try:
|
||||
self.run(module_name, option_list)
|
||||
#except AttributeError:
|
||||
# debug.error("target have no 'run' instruction")
|
||||
elif action_name == "log":
|
||||
try:
|
||||
self.show_log(module_name)
|
||||
except AttributeError:
|
||||
debug.error("target have no 'show_log' instruction")
|
||||
else:
|
||||
present = self.load_if_needed(module_name, optionnal=optionnal)
|
||||
if present == False \
|
||||
and optionnal == True:
|
||||
ret = [heritage.HeritageList(), False]
|
||||
else:
|
||||
for mod in self.module_list:
|
||||
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):
|
||||
debug.verbose("add action : " + name)
|
||||
@@ -547,6 +650,8 @@ class Target:
|
||||
## @param[in] pkg_name Package Name (generic name)
|
||||
## @param[in] heritage_list List of dependency of the package
|
||||
## @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):
|
||||
target_shared_path = os.path.join(path_package, self.pkg_path_data)
|
||||
@@ -580,9 +685,10 @@ class Target:
|
||||
force_identical=True,
|
||||
in_list=copy_list)
|
||||
#real copy files
|
||||
tools.copy_list(copy_list)
|
||||
ret_copy = tools.copy_list(copy_list)
|
||||
# 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
|
||||
@@ -590,6 +696,8 @@ class Target:
|
||||
## @param[in] pkg_name Package Name (generic name)
|
||||
## @param[in] heritage_list List of dependency of the package
|
||||
## @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):
|
||||
copy_list={}
|
||||
@@ -602,10 +710,12 @@ class Target:
|
||||
path_dst,
|
||||
in_list=copy_list)
|
||||
#real copy files
|
||||
tools.copy_list(copy_list)
|
||||
ret_copy = tools.copy_list(copy_list)
|
||||
ret_remove = False
|
||||
if self.pkg_path_bin != "":
|
||||
# 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
|
||||
@@ -613,6 +723,8 @@ class Target:
|
||||
## @param[in] pkg_name Package Name (generic name)
|
||||
## @param[in] heritage_list List of dependency of the package
|
||||
## @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):
|
||||
copy_list={}
|
||||
@@ -633,46 +745,49 @@ class Target:
|
||||
os.path.join(path_package_lib, os.path.basename(file_src)),
|
||||
in_list=copy_list)
|
||||
#real copy files
|
||||
tools.copy_list(copy_list)
|
||||
ret_copy = tools.copy_list(copy_list)
|
||||
ret_remove = False
|
||||
if self.pkg_path_lib != "":
|
||||
# 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):
|
||||
## Create version file:
|
||||
tools.file_write_data(os.path.join(path_package, self.pkg_path_version_file),
|
||||
tools.version_to_string(pkg_properties["VERSION"]),
|
||||
only_if_new=True)
|
||||
ret_version = tools.file_write_data(os.path.join(path_package, self.pkg_path_version_file),
|
||||
tools.version_to_string(pkg_properties["VERSION"]),
|
||||
only_if_new=True)
|
||||
|
||||
## Create maintainer file:
|
||||
tools.file_write_data(os.path.join(path_package, self.pkg_path_maintainer_file),
|
||||
self.generate_list_separate_coma(pkg_properties["MAINTAINER"]),
|
||||
only_if_new=True)
|
||||
ret_maintainer = tools.file_write_data(os.path.join(path_package, self.pkg_path_maintainer_file),
|
||||
self.generate_list_separate_coma(pkg_properties["MAINTAINER"]),
|
||||
only_if_new=True)
|
||||
|
||||
## Create appl_name file:
|
||||
tools.file_write_data(os.path.join(path_package, self.pkg_path_application_name_file),
|
||||
"en_EN:" + pkg_properties["NAME"],
|
||||
only_if_new=True)
|
||||
ret_appl_name = tools.file_write_data(os.path.join(path_package, self.pkg_path_application_name_file),
|
||||
"en_EN:" + pkg_properties["NAME"],
|
||||
only_if_new=True)
|
||||
|
||||
## Create appl_description file:
|
||||
tools.file_write_data(os.path.join(path_package, self.pkg_path_application_description_file),
|
||||
"en_EN:" + pkg_properties["DESCRIPTION"],
|
||||
only_if_new=True)
|
||||
ret_appl_desc = tools.file_write_data(os.path.join(path_package, self.pkg_path_application_description_file),
|
||||
"en_EN:" + pkg_properties["DESCRIPTION"],
|
||||
only_if_new=True)
|
||||
|
||||
## Create 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:
|
||||
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:
|
||||
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:
|
||||
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:
|
||||
debug.debug("no file 'README', 'README.md' or 'os-Linux/README' ==> generate an empty one")
|
||||
tools.file_write_data(readme_file_dest,
|
||||
"No documentation for " + pkg_name + "\n",
|
||||
only_if_new=True)
|
||||
ret_readme = tools.file_write_data(readme_file_dest,
|
||||
"No documentation for " + pkg_name + "\n",
|
||||
only_if_new=True)
|
||||
|
||||
## Create licence file:
|
||||
"""
|
||||
@@ -691,13 +806,20 @@ class Target:
|
||||
|
||||
## Create changeLog 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:
|
||||
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:
|
||||
debug.debug("no file 'changelog' ==> generate an empty one")
|
||||
tools.file_write_data(change_log_file_dest,
|
||||
"No changelog data " + pkg_name + "\n",
|
||||
only_if_new=True)
|
||||
ret_changelog = tools.file_write_data(change_log_file_dest,
|
||||
"No changelog data " + pkg_name + "\n",
|
||||
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 ","
|
||||
@@ -717,25 +839,32 @@ class Target:
|
||||
|
||||
|
||||
target_list=[]
|
||||
__start_target_name="lutinTarget_"
|
||||
__start_target_name="Target_"
|
||||
|
||||
|
||||
def import_path(path):
|
||||
def import_path(path_list):
|
||||
global target_list
|
||||
matches = []
|
||||
debug.debug('TARGET: Start find sub File : "%s"' %path)
|
||||
for root, dirnames, filenames in os.walk(path):
|
||||
tmpList = fnmatch.filter(filenames, __start_target_name + "*.py")
|
||||
# Import the module :
|
||||
for filename in tmpList:
|
||||
debug.debug('TARGET: Find a file : "%s"' %os.path.join(root, filename))
|
||||
#matches.append(os.path.join(root, filename))
|
||||
sys.path.append(os.path.dirname(os.path.join(root, filename)) )
|
||||
targetName = filename.replace('.py', '')
|
||||
targetName = targetName.replace(__start_target_name, '')
|
||||
debug.debug("TARGET: integrate module: '" + targetName + "' from '" + os.path.join(root, filename) + "'")
|
||||
target_list.append([targetName,os.path.join(root, filename)])
|
||||
|
||||
global_base = env.get_build_system_base_name()
|
||||
debug.debug("TARGET: 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_target_name)] != __start_target_name:
|
||||
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):
|
||||
global target_list
|
||||
@@ -747,8 +876,8 @@ def load_target(name, config):
|
||||
if mod[0] == name:
|
||||
debug.verbose("add to path: '" + os.path.dirname(mod[1]) + "'")
|
||||
sys.path.append(os.path.dirname(mod[1]))
|
||||
debug.verbose("import target : '" + __start_target_name + name + "'")
|
||||
theTarget = __import__(__start_target_name + name)
|
||||
debug.verbose("import target : '" + env.get_build_system_base_name() + __start_target_name + name + "'")
|
||||
theTarget = __import__(env.get_build_system_base_name() + __start_target_name + name)
|
||||
#create the target
|
||||
tmpTarget = theTarget.Target(config)
|
||||
return tmpTarget
|
||||
@@ -766,7 +895,7 @@ def list_all_target_with_desc():
|
||||
tmpList = []
|
||||
for mod in target_list:
|
||||
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:
|
||||
tmpdesc = theTarget.get_desc()
|
||||
tmpList.append([mod[0], tmpdesc])
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
@@ -50,6 +51,8 @@ def remove_path_and_sub_path(path):
|
||||
def remove_file(path):
|
||||
if os.path.isfile(path):
|
||||
os.remove(path)
|
||||
elif os.path.islink(path):
|
||||
os.remove(path)
|
||||
|
||||
def file_size(path):
|
||||
if not os.path.isfile(path):
|
||||
@@ -84,17 +87,20 @@ def version_to_string(version):
|
||||
## @param[in] path Path of the data might be written.
|
||||
## @param[in] data Data To write in the file.
|
||||
## @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):
|
||||
if only_if_new == True:
|
||||
old_data = file_read_data(path)
|
||||
if old_data == data:
|
||||
return
|
||||
return False
|
||||
#real write of data:
|
||||
create_directory_of_file(path)
|
||||
file = open(path, "w")
|
||||
file.write(data)
|
||||
file.close()
|
||||
return True
|
||||
|
||||
def list_to_str(list):
|
||||
if type(list) == type(str()):
|
||||
@@ -128,6 +134,8 @@ def add_prefix(prefix,list):
|
||||
## @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,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):
|
||||
if os.path.exists(src) == False:
|
||||
@@ -135,7 +143,7 @@ def copy_file(src, dst, cmd_file=None, force=False, force_identical=False, in_li
|
||||
cmd_line = "copy \"" + src + "\" \"" + dst + "\""
|
||||
if force == 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 dst in in_list:
|
||||
debug.verbose("replace copy file " + os.path.relpath(src) + " ==> " + os.path.relpath(dst))
|
||||
@@ -145,7 +153,7 @@ def copy_file(src, dst, cmd_file=None, force=False, force_identical=False, in_li
|
||||
in_list[dst] = {"src":src,
|
||||
"cmd_file":cmd_file,
|
||||
"need_copy":False}
|
||||
return
|
||||
return False
|
||||
if in_list == None:
|
||||
debug.print_element("copy file ", os.path.relpath(src), "==>", os.path.relpath(dst))
|
||||
create_directory_of_file(dst)
|
||||
@@ -160,6 +168,7 @@ def copy_file(src, dst, cmd_file=None, force=False, force_identical=False, in_li
|
||||
in_list[dst] = {"src":src,
|
||||
"cmd_file":cmd_file,
|
||||
"need_copy":True}
|
||||
return True
|
||||
|
||||
##
|
||||
## @brief Copy a compleate directory in a specific folder
|
||||
@@ -207,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
|
||||
## @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):
|
||||
has_file_copied = False
|
||||
for dst in in_list:
|
||||
if in_list[dst]["need_copy"] == False:
|
||||
continue
|
||||
# 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)
|
||||
has_file_copied = True
|
||||
return has_file_copied
|
||||
|
||||
##
|
||||
## @brief Clean a path from all un-needed element in a directory
|
||||
## @param[in] path Path to clean
|
||||
## @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):
|
||||
has_file_removed = False
|
||||
# get a list of all element in the path:
|
||||
for root, dirnames, filenames in os.walk(path):
|
||||
for file in filenames:
|
||||
@@ -228,6 +245,8 @@ def clean_directory(path, normal_list):
|
||||
if file_name not in normal_list:
|
||||
debug.print_element("remove file ", os.path.relpath(file_name), "==>", "---")
|
||||
os.remove(file_name)
|
||||
has_file_removed = True
|
||||
return has_file_removed
|
||||
|
||||
def filter_extention(list_files, extentions, invert=False):
|
||||
out = []
|
||||
@@ -298,3 +317,35 @@ def store_warning(file, output, err):
|
||||
file2.close()
|
||||
|
||||
|
||||
## List tools:
|
||||
def list_append_and_check(listout, newElement, order):
|
||||
for element in listout:
|
||||
if element==newElement:
|
||||
return
|
||||
listout.append(newElement)
|
||||
if order == True:
|
||||
if type(newElement) is not dict:
|
||||
listout.sort()
|
||||
|
||||
def list_append_to(out_list, in_list, order=False):
|
||||
if type(in_list) == str:
|
||||
list_append_and_check(out_list, in_list, order)
|
||||
elif type(in_list) == list:
|
||||
# mulyiple imput in the list ...
|
||||
for elem in in_list:
|
||||
list_append_and_check(out_list, elem, order)
|
||||
elif type(in_list) == dict:
|
||||
list_append_and_check(out_list, in_list, order)
|
||||
else:
|
||||
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):
|
||||
# sepcial cse of bool
|
||||
if type(list) == bool:
|
||||
listout[module] = list
|
||||
return
|
||||
# add list in the Map
|
||||
if module not in listout:
|
||||
listout[module] = []
|
||||
# add elements...
|
||||
list_append_to(listout[module], list, order)
|
@@ -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
|
||||
##
|
||||
@@ -36,6 +46,13 @@ def get_input_type():
|
||||
def get_output_type():
|
||||
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.
|
||||
@@ -62,9 +79,14 @@ def link(file, binary, target, depancy, flags, name, basic_path, static = False)
|
||||
if lib_name not in depancy.src['dynamic']:
|
||||
list_static.append(elem)
|
||||
#create comand line:
|
||||
cmd = [
|
||||
target.xx
|
||||
]
|
||||
cmd = []
|
||||
# a specific case to not depend on the libstdc++ automaticly added by the G++ or clang++ compilator ==> then need to compile with GCC or CLANG if use libcxx from llvm or other ...
|
||||
if "need-libstdc++" in depancy.flags \
|
||||
and depancy.flags["need-libstdc++"] == True:
|
||||
cmd.append(target.xx)
|
||||
else:
|
||||
cmd.append(target.cc)
|
||||
|
||||
try:
|
||||
cmd.append(target.arch)
|
||||
except:
|
||||
@@ -114,9 +136,21 @@ def link(file, binary, target, depancy, flags, name, basic_path, static = False)
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
cmd.append(target.global_flags_ld)
|
||||
cmd.append(target.global_flags["link"])
|
||||
except:
|
||||
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-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] ])
|
||||
cmd_line = tools.list_to_str(cmd)
|
||||
# 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 \
|
||||
|
@@ -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
|
||||
##
|
||||
@@ -37,6 +47,14 @@ def get_input_type():
|
||||
def get_output_type():
|
||||
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.
|
||||
##
|
||||
@@ -68,7 +86,7 @@ def compile(file, binary, target, depancy, flags, path, name, basic_path, module
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
cmd.append(target.global_flags_cc)
|
||||
cmd.append(target.global_flags["c"])
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
|
@@ -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
|
||||
##
|
||||
@@ -36,6 +46,21 @@ def get_input_type():
|
||||
def get_output_type():
|
||||
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):
|
||||
out = []
|
||||
for elem in data:
|
||||
if elem not in to_remove:
|
||||
out.append(elem)
|
||||
return out;
|
||||
|
||||
##
|
||||
## @brief Commands for running gcc to compile a C++ file in object file.
|
||||
##
|
||||
@@ -68,29 +93,53 @@ def compile(file, binary, target, depancy, flags, path, name, basic_path, module
|
||||
cmd.append(get_version_compilation_flags(flags, depancy.flags))
|
||||
except:
|
||||
pass
|
||||
list_flags = [];
|
||||
try:
|
||||
cmd.append(target.global_flags_cc)
|
||||
list_flags.append(target.global_flags["c"])
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
cmd.append(target.global_flags_xx)
|
||||
list_flags.append(target.global_flags["c++"])
|
||||
except:
|
||||
pass
|
||||
for type in ["c", "c++"]:
|
||||
try:
|
||||
cmd.append(depancy.flags[type])
|
||||
list_flags.append(depancy.flags[type])
|
||||
except:
|
||||
pass
|
||||
for view in ["local", "export"]:
|
||||
for type in ["c", "c++"]:
|
||||
try:
|
||||
cmd.append(flags[view][type])
|
||||
list_flags.append(flags[view][type])
|
||||
except:
|
||||
pass
|
||||
# get blacklist of flags
|
||||
list_flags_blacklist = [];
|
||||
try:
|
||||
list_flags_blacklist.append(target.global_flags["c-remove"])
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
list_flags_blacklist.append(target.global_flags["c++-remove"])
|
||||
except:
|
||||
pass
|
||||
for type in ["c-remove", "c++-remove"]:
|
||||
try:
|
||||
list_flags_blacklist.append(depancy.flags[type])
|
||||
except:
|
||||
pass
|
||||
for view in ["local", "export"]:
|
||||
for type in ["c-remove", "c++-remove"]:
|
||||
try:
|
||||
list_flags_blacklist.append(flags[view][type])
|
||||
except:
|
||||
pass
|
||||
# apply blacklisting of data and add it on the cmdLine
|
||||
cmd.append(remove_element(list_flags, list_flags_blacklist));
|
||||
cmd.append(["-c", "-MMD", "-MP"])
|
||||
cmd.append(file_src)
|
||||
# Create cmd line
|
||||
cmdLine=tools.list_to_str(cmd)
|
||||
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}
|
||||
|
@@ -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
|
||||
##
|
||||
@@ -35,6 +45,14 @@ def get_input_type():
|
||||
def get_output_type():
|
||||
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.
|
||||
##
|
||||
|
@@ -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
|
||||
##
|
||||
@@ -33,6 +43,14 @@ def get_input_type():
|
||||
def get_output_type():
|
||||
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):
|
||||
depend = []
|
||||
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
|
||||
##
|
||||
@@ -33,6 +43,14 @@ def get_input_type():
|
||||
def get_output_type():
|
||||
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):
|
||||
depend = []
|
||||
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
|
||||
##
|
||||
@@ -35,6 +45,14 @@ def get_input_type():
|
||||
def get_output_type():
|
||||
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.
|
||||
##
|
||||
@@ -59,10 +77,15 @@ def link(file, binary, target, depancy, flags, name, basic_path, static=False):
|
||||
if lib_name not in depancy.src['dynamic']:
|
||||
list_static.append(elem)
|
||||
#create command Line
|
||||
cmd = [
|
||||
target.xx,
|
||||
"-o", file_dst
|
||||
]
|
||||
cmd = []
|
||||
# a specific case to not depend on the libstdc++ automaticly added by the G++ or clang++ compilator ==> then need to compile with GCC or CLANG if use libcxx from llvm or other ...
|
||||
if "need-libstdc++" in depancy.flags \
|
||||
and depancy.flags["need-libstdc++"] == True:
|
||||
cmd.append(target.xx)
|
||||
else:
|
||||
cmd.append(target.cc)
|
||||
|
||||
cmd.append(["-o", file_dst])
|
||||
try:
|
||||
cmd.append(target.global_sysroot)
|
||||
except:
|
||||
@@ -76,15 +99,24 @@ def link(file, binary, target, depancy, flags, name, basic_path, static=False):
|
||||
cmd.append(file_src)
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
# keep only compilated files ...
|
||||
cmd.append(tools.filter_extention(depancy.src['src'], get_input_type()))
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
cmd.append(list_static)
|
||||
except:
|
||||
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:
|
||||
for elem in list_dynamic:
|
||||
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/")
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
cmd.append(flags["local"]["link"])
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
cmd.append(flags["export"]["link"])
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
cmd.append(depancy.flags["link"])
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
cmd.append(target.global_flags_ld)
|
||||
except:
|
||||
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-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] ])
|
||||
cmdLine=tools.list_to_str(cmd)
|
||||
# check the dependency for this file :
|
||||
if depend.need_re_package(file_dst, file_src, True, file_cmd, cmdLine) == False \
|
||||
|
@@ -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
|
||||
##
|
||||
@@ -35,6 +45,14 @@ def get_input_type():
|
||||
def get_output_type():
|
||||
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.
|
||||
##
|
||||
@@ -45,7 +63,7 @@ def link(file, binary, target, depancy, flags, name, basic_path):
|
||||
target.ar
|
||||
]
|
||||
try:
|
||||
cmd.append(target.global_flags_ar)
|
||||
cmd.append(target.global_flags["ar"])
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
|
@@ -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
|
||||
##
|
||||
@@ -38,6 +48,14 @@ def get_input_type():
|
||||
def get_output_type():
|
||||
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.
|
||||
##
|
||||
@@ -70,11 +88,11 @@ def compile(file, binary, target, depancy, flags, path, name, basic_path, module
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
cmd.append(target.global_flags_cc)
|
||||
cmd.append(target.global_flags["c"])
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
cmd.append(target.global_flags_m)
|
||||
cmd.append(target.global_flags["m"])
|
||||
except:
|
||||
pass
|
||||
for type in ["c", "m"]:
|
||||
@@ -94,7 +112,7 @@ def compile(file, binary, target, depancy, flags, path, name, basic_path, module
|
||||
# Create cmd line
|
||||
cmdLine=tools.list_to_str(cmd)
|
||||
# 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}
|
||||
tools.create_directory_of_file(file_dst)
|
||||
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
|
||||
##
|
||||
@@ -38,6 +48,14 @@ def get_input_type():
|
||||
def get_output_type():
|
||||
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.
|
||||
##
|
||||
@@ -69,14 +87,11 @@ def compile(file, binary, target, depancy, flags, path, name, basic_path, module
|
||||
cmd.append(local_ref_on_builder_cpp.get_version_compilation_flags(flags, depancy.flags))
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
cmd.append(target.global_flags_cc)
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
cmd.append(target.global_flags_mm)
|
||||
except:
|
||||
pass
|
||||
for type in ["c", "c++", "m", "mm"]:
|
||||
try:
|
||||
cmd.append(target.global_flags[type])
|
||||
except:
|
||||
pass
|
||||
for type in ["c", "c++", "m", "mm"]:
|
||||
try:
|
||||
cmd.append(depancy.flags[type])
|
||||
|
@@ -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
|
||||
##
|
||||
@@ -31,3 +41,11 @@ def get_input_type():
|
||||
##
|
||||
def get_output_type():
|
||||
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
|
||||
|
@@ -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
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
@@ -20,7 +21,7 @@ class System(system.System):
|
||||
# todo : Check if present ...
|
||||
self.valid = True
|
||||
# todo : create a searcher of the presence of the library:
|
||||
self.add_export_SRC(target.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar")
|
||||
self.add_export_sources(target.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar")
|
||||
self.add_action("PACKAGE", 10, "admod-auto-wrapper", tool_generate_main_java_class)
|
||||
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
@@ -17,12 +18,14 @@ class System(system.System):
|
||||
system.System.__init__(self)
|
||||
# create some HELP:
|
||||
self.help="SDK: Android SDK basic interface java\n"
|
||||
# jar file:
|
||||
jar_file_path=os.path.join(target.path_sdk, "platforms", "android-" + str(target.board_id), "android.jar")
|
||||
# TODO : Check if the android sdk android.jar is present ...
|
||||
self.valid = True
|
||||
# todo : create a searcher of the presence of the library:
|
||||
self.add_export_SRC(target.path_sdk + "/platforms/android-" + str(target.boardId) + "/android.jar")
|
||||
self.add_export_flag_LD("-ldl")
|
||||
self.add_export_flag_LD("-llog")
|
||||
self.add_export_flag_LD("-landroid")
|
||||
self.add_export_sources(jar_file_path)
|
||||
self.add_export_flag("link-lib", "dl")
|
||||
self.add_export_flag("link-lib", "log")
|
||||
self.add_export_flag("link-lib", "android")
|
||||
|
||||
|
||||
|
76
lutin/z_system/lutinSystem_Android_cxx.py
Normal file
76
lutin/z_system/lutinSystem_Android_cxx.py
Normal file
@@ -0,0 +1,76 @@
|
||||
#!/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
|
||||
import os
|
||||
|
||||
class System(system.System):
|
||||
def __init__(self, target):
|
||||
system.System.__init__(self)
|
||||
# create some HELP:
|
||||
self.help = "CXX: Generic C++ library"
|
||||
self.valid = True
|
||||
if target.config["compilator"] == "clang":
|
||||
if target.board_id < 21:
|
||||
debug.error("Clang work only with the board wersion >= 21 : android 5.x.x")
|
||||
self.valid = False
|
||||
return
|
||||
self.add_export_flag("c++", "-D__STDCPP_LLVM__")
|
||||
# llvm is BSD-like licence
|
||||
self.add_export_path(os.path.join(target.path_ndk, "sources", "cxx-stl", "llvm-libc++", "libcxx", "include"))
|
||||
if target.type_arch == "armv5":
|
||||
stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "llvm-libc++", "libcxx", "libs", "armeabi")
|
||||
self.add_export_path( os.path.join(stdCppBasePath, "include"))
|
||||
self.add_export_flag("link", os.path.join(stdCppBasePath, "libc++_static.a"))
|
||||
elif target.type_arch == "armv7":
|
||||
stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "llvm-libc++", "libs", "armeabi-v7a")
|
||||
self.add_export_path( os.path.join(stdCppBasePath + "include"))
|
||||
self.add_export_flag("link", os.path.join(stdCppBasePath, "thumb", "libc++_static.a"))
|
||||
elif target.type_arch == "mips":
|
||||
stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "llvm-libc++", "libcxx", "libs", "mips")
|
||||
self.add_export_path( os.path.join(stdCppBasePath + "include"))
|
||||
self.add_export_flag("link", os.path.join(stdCppBasePath + "libc++_static.a"))
|
||||
elif target.type_arch == "x86":
|
||||
stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "llvm-libc++", "libcxx", "libs", "x86")
|
||||
self.add_export_path( os.path.join(stdCppBasePath, "include"))
|
||||
self.add_export_flag("link", os.path.join(stdCppBasePath, "libc++_static.a"))
|
||||
else:
|
||||
debug.warning("unknow architecture: '" + str(target.arch) + "'");
|
||||
else:
|
||||
self.add_export_flag("c++", "-D__STDCPP_GNU__")
|
||||
self.add_export_flag("c++-remove","-nostdlib")
|
||||
self.add_export_flag("need-libstdc++", True)
|
||||
# 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"))
|
||||
if target.type_arch == "armv5":
|
||||
stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "gnu-libstdc++", target.compilator_version, "libs", "armeabi")
|
||||
self.add_export_path( os.path.join(stdCppBasePath, "include"))
|
||||
self.add_export_flag("link", os.path.join(stdCppBasePath, "thumb", "libgnustl_static.a"))
|
||||
self.add_export_flag("link", os.path.join(stdCppBasePath, "thumb", "libsupc++.a"))
|
||||
elif target.type_arch == "armv7":
|
||||
stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "gnu-libstdc++", target.compilator_version, "libs", "armeabi-v7a")
|
||||
self.add_export_path( os.path.join(stdCppBasePath, "include"))
|
||||
self.add_export_flag("link", os.path.join(stdCppBasePath, "thumb", "libgnustl_static.a"))
|
||||
self.add_export_flag("link", os.path.join(stdCppBasePath, "thumb", "libsupc++.a"))
|
||||
elif target.type_arch == "mips":
|
||||
stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "gnu-libstdc++", target.compilator_version, "libs", "mips")
|
||||
self.add_export_path( os.path.join(stdCppBasePath, "include/"))
|
||||
self.add_export_flag("link", os.path.join(stdCppBasePath, "libgnustl_static.a"))
|
||||
self.add_export_flag("link", os.path.join(stdCppBasePath, "libsupc++.a"))
|
||||
elif target.type_arch == "x86":
|
||||
stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "gnu-libstdc++", target.compilator_version, "libs", "x86")
|
||||
self.add_export_path( os.path.join(stdCppBasePath, "include"))
|
||||
self.add_export_flag("link", os.path.join(stdCppBasePath, "libgnustl_static.a"))
|
||||
self.add_export_flag("link", os.path.join(stdCppBasePath, "libsupc++.a"))
|
||||
else:
|
||||
debug.warning("unknow architecture: '" + str(target.arch) + "'");
|
||||
debug.warning("plop")
|
26
lutin/z_system/lutinSystem_Android_m.py
Normal file
26
lutin/z_system/lutinSystem_Android_m.py
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/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
|
||||
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")
|
||||
|
||||
|
28
lutin/z_system/lutinSystem_Android_z.py
Normal file
28
lutin/z_system/lutinSystem_Android_z.py
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/python
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||
##
|
||||
## @license APACHE v2.0 (see license file)
|
||||
##
|
||||
|
||||
from lutin import debug
|
||||
from lutin import system
|
||||
from lutin import tools
|
||||
import os
|
||||
|
||||
class System(system.System):
|
||||
def __init__(self, target):
|
||||
system.System.__init__(self)
|
||||
# create some HELP:
|
||||
self.help="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
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
@@ -19,7 +20,7 @@ class System(system.System):
|
||||
self.help="CoreAudio : Ios interface for audio (all time present, just system interface)"
|
||||
self.valid = True
|
||||
# todo : create a searcher of the presence of the library:
|
||||
self.add_export_flag_LD("-framework CoreAudio")
|
||||
self.add_export_flag_LD("-framework AudioToolbox")
|
||||
self.add_export_flag("link", "-framework CoreAudio")
|
||||
self.add_export_flag("link", "-framework AudioToolbox")
|
||||
|
||||
|
||||
|
27
lutin/z_system/lutinSystem_IOs_cxx.py
Normal file
27
lutin/z_system/lutinSystem_IOs_cxx.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
|
||||
import os
|
||||
|
||||
class System(system.System):
|
||||
def __init__(self, target):
|
||||
system.System.__init__(self)
|
||||
# create some HELP:
|
||||
self.help = "CXX: Generic C++ library"
|
||||
self.valid = True
|
||||
# no check needed ==> just add this:
|
||||
self.add_export_flag("c++", "-D__STDCPP_LLVM__")
|
||||
self.add_export_flag("c++-remove", "-nostdlib")
|
||||
self.add_export_flag("need-libstdc++", True)
|
||||
|
||||
|
26
lutin/z_system/lutinSystem_IOs_m.py
Normal file
26
lutin/z_system/lutinSystem_IOs_m.py
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/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
|
||||
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")
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
@@ -24,6 +25,6 @@ class System(system.System):
|
||||
return;
|
||||
self.valid = True
|
||||
# todo : create a searcher of the presence of the library:
|
||||
self.add_export_flag_LD("-lasound")
|
||||
self.add_export_flag("link-lib", "asound")
|
||||
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
@@ -23,10 +24,10 @@ class System(system.System):
|
||||
return;
|
||||
self.valid = True
|
||||
# todo : create a searcher of the presence of the library:
|
||||
self.add_export_flag_LD([
|
||||
"-lboost_system",
|
||||
"-lboost_thread",
|
||||
"-lboost_chrono"
|
||||
self.add_export_flag("link-lib", [
|
||||
"boost_system",
|
||||
"boost_thread",
|
||||
"boost_chrono"
|
||||
])
|
||||
|
||||
|
||||
|
27
lutin/z_system/lutinSystem_Linux_cxx.py
Normal file
27
lutin/z_system/lutinSystem_Linux_cxx.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
|
||||
import os
|
||||
|
||||
class System(system.System):
|
||||
def __init__(self, target):
|
||||
system.System.__init__(self)
|
||||
# create some HELP:
|
||||
self.help = "CXX: Generic C++ library"
|
||||
self.valid = True
|
||||
# no check needed ==> just add this:
|
||||
self.add_export_flag("c++", "-D__STDCPP_GNU__")
|
||||
self.add_export_flag("c++-remove", "-nostdlib")
|
||||
self.add_export_flag("need-libstdc++", True)
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
@@ -23,6 +24,6 @@ class System(system.System):
|
||||
return;
|
||||
self.valid = True
|
||||
# todo : create a searcher of the presence of the library:
|
||||
self.add_export_flag_LD("-ljack")
|
||||
self.add_export_flag("link-lib", "jack")
|
||||
|
||||
|
||||
|
26
lutin/z_system/lutinSystem_Linux_m.py
Normal file
26
lutin/z_system/lutinSystem_Linux_m.py
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/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
|
||||
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")
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
@@ -24,7 +25,7 @@ class System(system.System):
|
||||
return;
|
||||
self.valid = True
|
||||
# todo : create a searcher of the presence of the library:
|
||||
self.add_export_flag_CC("-ljack")
|
||||
self.add_export_flag("link-lib", "oss")
|
||||
"""
|
||||
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
@@ -23,6 +24,6 @@ class System(system.System):
|
||||
return;
|
||||
self.valid = True
|
||||
# todo : create a searcher of the presence of the library:
|
||||
self.add_export_flag_LD(["-lpulse-simple", "-lpulse"])
|
||||
self.add_export_flag("link-lib", ["pulse-simple", "pulse"])
|
||||
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
@@ -23,6 +24,6 @@ class System(system.System):
|
||||
return;
|
||||
self.valid = True
|
||||
# todo : create a searcher of the presence of the library:
|
||||
self.add_export_flag_LD(["-lz"])
|
||||
self.add_export_flag("link-lib", "z")
|
||||
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
@@ -19,6 +20,6 @@ class System(system.System):
|
||||
self.help="CoreAudio : MacOs interface for audio (all time present, just system interface)"
|
||||
self.valid = True
|
||||
# todo : create a searcher of the presence of the library:
|
||||
self.add_export_flag_LD("-framework CoreAudio")
|
||||
self.add_export_flag_LD("-framework CoreFoundation")
|
||||
self.add_export_flag("link", "-framework CoreAudio")
|
||||
self.add_export_flag("link", "-framework CoreFoundation")
|
||||
|
||||
|
27
lutin/z_system/lutinSystem_MacOs_cxx.py
Normal file
27
lutin/z_system/lutinSystem_MacOs_cxx.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
|
||||
import os
|
||||
|
||||
class System(system.System):
|
||||
def __init__(self, target):
|
||||
system.System.__init__(self)
|
||||
# create some HELP:
|
||||
self.help = "CXX: Generic C++ library"
|
||||
self.valid = True
|
||||
# no check needed ==> just add this:
|
||||
self.add_export_flag("c++","-D__STDCPP_LLVM__")
|
||||
self.add_export_flag("c++-remove","-nostdlib")
|
||||
self.add_export_flag("need-libstdc++", True)
|
||||
|
||||
|
26
lutin/z_system/lutinSystem_MacOs_m.py
Normal file
26
lutin/z_system/lutinSystem_MacOs_m.py
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/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
|
||||
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)
|
||||
##
|
||||
|
33
lutin/z_system/lutinSystem_Windows_cxx.py
Normal file
33
lutin/z_system/lutinSystem_Windows_cxx.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
|
||||
import os
|
||||
|
||||
class System(system.System):
|
||||
def __init__(self, target):
|
||||
system.System.__init__(self)
|
||||
# create some HELP:
|
||||
self.help = "CXX: Generic C++ library"
|
||||
self.valid = True
|
||||
# no check needed ==> just add this:
|
||||
self.add_export_flag("c++","-D__STDCPP_GNU__")
|
||||
self.add_export_flag("c++-remove","-nostdlib")
|
||||
# force static link to prenvent many errors ...
|
||||
self.add_export_flag("link", [
|
||||
"-static-libgcc",
|
||||
"-static-libstdc++",
|
||||
"-static"
|
||||
])
|
||||
self.add_export_flag("need-libstdc++", True)
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
@@ -23,9 +24,10 @@ class System(system.System):
|
||||
return;
|
||||
self.valid = True
|
||||
# todo : create a searcher of the presence of the library:
|
||||
self.add_export_flag_LD(["-ldsound",
|
||||
"-lwinmm",
|
||||
"-lole32"
|
||||
])
|
||||
self.add_export_flag("link-lib",[
|
||||
"dsound",
|
||||
"winmm",
|
||||
"ole32"
|
||||
])
|
||||
|
||||
|
||||
|
26
lutin/z_system/lutinSystem_Windows_m.py
Normal file
26
lutin/z_system/lutinSystem_Windows_m.py
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/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
|
||||
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
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
@@ -7,7 +8,6 @@
|
||||
## @license APACHE v2.0 (see license file)
|
||||
##
|
||||
|
||||
|
||||
from lutin import debug
|
||||
from lutin import target
|
||||
from lutin import tools
|
||||
@@ -25,13 +25,13 @@ class Target(target.Target):
|
||||
#bus size selection (auto/32/64)
|
||||
if config["bus-size"] == "auto":
|
||||
config["bus-size"] = "32"
|
||||
arch = ""
|
||||
target.Target.__init__(self, "Android", config, arch)
|
||||
self.type_arch = ""
|
||||
target.Target.__init__(self, "Android", config, self.type_arch)
|
||||
|
||||
if config["bus-size"] == "32":
|
||||
arch="armv7"
|
||||
self.type_arch="armv7"
|
||||
else:
|
||||
arch="arm64"
|
||||
self.type_arch="arm64"
|
||||
|
||||
self.path_ndk = os.getenv('PROJECT_NDK', "AUTO")
|
||||
self.path_sdk = os.getenv('PROJECT_SDK', "AUTO")
|
||||
@@ -60,10 +60,14 @@ class Target(target.Target):
|
||||
|
||||
tmpOsVal = "64"
|
||||
gccVersion = "4.9"
|
||||
# TODO : Remove this or set it better ...
|
||||
self.compilator_version = gccVersion
|
||||
if host.BUS_SIZE==64:
|
||||
tmpOsVal = "_64"
|
||||
if self.config["compilator"] == "clang":
|
||||
self.set_cross_base(self.path_ndk + "/toolchains/llvm-3.6/prebuilt/linux-x86" + tmpOsVal + "/bin/")
|
||||
# Patch for LLVM AR tool
|
||||
self.ar = self.cross + "llvm-ar"
|
||||
else:
|
||||
basepathArm = self.path_ndk + "/toolchains/arm-linux-androideabi-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/"
|
||||
basepathMips = self.path_ndk + "/toolchains/mipsel-linux-android-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/"
|
||||
@@ -87,120 +91,119 @@ class Target(target.Target):
|
||||
self.pkg_path_lib = "data/lib/armeabi"
|
||||
self.pkg_path_license = "license"
|
||||
|
||||
# board id at 15 is for android 4.0.3 and more ... (note: API 14 has been removed ...)
|
||||
self.boardId = 15
|
||||
self.global_flags_cc.append("-D__ANDROID_BOARD_ID__=" + str(self.boardId))
|
||||
if arch == "armv5" or arch == "armv7":
|
||||
self.global_include_cc.append("-I" + self.path_ndk +"/platforms/android-" + str(self.boardId) + "/arch-arm/usr/include/")
|
||||
elif arch == "mips":
|
||||
self.global_include_cc.append("-I" + self.path_ndk +"/platforms/android-" + str(self.boardId) + "/arch-mips/usr/include/")
|
||||
elif arch == "x86":
|
||||
self.global_include_cc.append("-I" + self.path_ndk +"/platforms/android-" + str(self.boardId) + "/arch-x86/usr/include/")
|
||||
# If the env variable is not define, find the newest version of the BOARD_ID (Note: 0: autofind)
|
||||
self.board_id = int(os.getenv('PROJECT_NDK_BOARD_ID', "0"))
|
||||
if self.board_id != 0:
|
||||
# check if element existed :
|
||||
if not os.path.isdir(self.path_sdk +"/platforms/android-" + str(self.board_id)):
|
||||
debug.error("Specify PROJECT_NDK_BOARD_ID env variable and the BOARD_ID does not exit ... : " + str(self.board_id) + "==> auto-search")
|
||||
self.board_id = 0
|
||||
if self.board_id == 0:
|
||||
debug.debug("Auto-search BOARD-ID")
|
||||
for iii in reversed(range(0, 50)):
|
||||
debug.debug("try: " + os.path.join(self.path_sdk, "platforms", "android-" + str(iii)))
|
||||
if os.path.isdir(os.path.join(self.path_sdk, "platforms", "android-" + str(iii))):
|
||||
debug.debug("Find BOARD-ID : " + str(iii))
|
||||
self.board_id = iii
|
||||
break;
|
||||
if self.board_id == 0:
|
||||
debug.error("Can not find BOARD-ID ==> update your android SDK")
|
||||
|
||||
if True:
|
||||
if self.config["compilator"] == "clang":
|
||||
if self.boardId < 21:
|
||||
debug.error("Clang work only with the board wersion >= 21 : android 5.x.x")
|
||||
self.global_flags_cc.append("-D__STDCPP_LLVM__")
|
||||
# llvm-libc++ : BSD | MIT
|
||||
self.global_include_cc.append("-gcc-toolchain " + self.path_ndk +"/sources/android/support/include")
|
||||
self.global_include_cc.append("-I" + self.path_ndk +"/sources/android/support/include")
|
||||
self.global_include_cc.append("-I" + self.path_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/include/")
|
||||
if arch == "armv5":
|
||||
stdCppBasePath = self.path_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/libs/armeabi/"
|
||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
||||
self.global_flags_ld.append( stdCppBasePath + "libc++_static.a")
|
||||
elif arch == "armv7":
|
||||
# The only one tested ... ==> but we have link error ...
|
||||
self.global_flags_cc.append("-target armv7-none-linux-androideabi")
|
||||
self.global_flags_cc.append("-march=armv7-a")
|
||||
self.global_flags_cc.append("-mfpu=vfpv3-d16")
|
||||
self.global_flags_cc.append("-mhard-float")
|
||||
stdCppBasePath = self.path_ndk +"/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/"
|
||||
self.global_flags_ld.append( stdCppBasePath + "thumb/libc++_static.a")
|
||||
self.global_flags_ld.append("-target armv7-none-linux-androideabi")
|
||||
self.global_flags_ld.append("-Wl,--fix-cortex-a8")
|
||||
self.global_flags_ld.append("-Wl,--no-warn-mismatch")
|
||||
self.global_flags_ld.append("-lm_hard")
|
||||
elif arch == "mips":
|
||||
stdCppBasePath = self.path_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/libs/mips/"
|
||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
||||
self.global_flags_ld.append( stdCppBasePath + "libc++_static.a")
|
||||
elif arch == "x86":
|
||||
stdCppBasePath = self.path_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/libs/x86/"
|
||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
||||
self.global_flags_ld.append( stdCppBasePath + "libc++_static.a")
|
||||
else:
|
||||
self.global_flags_cc.append("-D__STDCPP_GNU__")
|
||||
# GPL v3 (+ exception link for gcc compilator)
|
||||
self.global_include_cc.append("-I" + self.path_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/include/")
|
||||
self.global_include_cc.append("-I" + self.path_ndk +"/sources/android/support/include/")
|
||||
if arch == "armv5":
|
||||
stdCppBasePath = self.path_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/libs/armeabi/"
|
||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
||||
self.global_flags_ld.append( stdCppBasePath + "thumb/libgnustl_static.a")
|
||||
self.global_flags_ld.append( stdCppBasePath + "thumb/libsupc++.a")
|
||||
elif arch == "armv7":
|
||||
stdCppBasePath = self.path_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/libs/armeabi-v7a/"
|
||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
||||
self.global_flags_ld.append( stdCppBasePath + "thumb/libgnustl_static.a")
|
||||
self.global_flags_ld.append( stdCppBasePath + "thumb/libsupc++.a")
|
||||
elif arch == "mips":
|
||||
stdCppBasePath = self.path_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/libs/mips/"
|
||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
||||
self.global_flags_ld.append( stdCppBasePath + "libgnustl_static.a")
|
||||
self.global_flags_ld.append( stdCppBasePath + "libsupc++.a")
|
||||
elif arch == "x86":
|
||||
stdCppBasePath = self.path_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/libs/x86/"
|
||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
||||
self.global_flags_ld.append( stdCppBasePath + "libgnustl_static.a")
|
||||
self.global_flags_ld.append( stdCppBasePath + "libsupc++.a")
|
||||
else :
|
||||
self.global_include_cc.append("-I" + self.path_ndk +"/sources/cxx-stl/system/include/")
|
||||
self.global_include_cc.append("-I" + self.path_ndk +"/sources/cxx-stl/stlport/stlport/")
|
||||
self.global_flags_ld.append(self.path_ndk +"/platforms/android-" + str(self.boardId) + "/arch-arm/usr/lib/libstdc++.a")
|
||||
self.add_flag("c", "-D__ANDROID_BOARD_ID__=" + str(self.board_id))
|
||||
if self.type_arch == "armv5" or self.type_arch == "armv7":
|
||||
self.global_include_cc.append("-I" + os.path.join(self.path_ndk, "platforms", "android-" + str(self.board_id), "arch-arm", "usr", "include"))
|
||||
elif self.type_arch == "mips":
|
||||
self.global_include_cc.append("-I" + os.path.join(self.path_ndk, "platforms", "android-" + str(self.board_id), "arch-mips", "usr", "include"))
|
||||
elif self.type_arch == "x86":
|
||||
self.global_include_cc.append("-I" + os.path.join(self.path_ndk, "platforms", "android-" + str(self.board_id), "arch-x86", "usr", "include"))
|
||||
|
||||
self.global_sysroot = "--sysroot=" + self.path_ndk +"/platforms/android-" + str(self.boardId) + "/arch-arm"
|
||||
self.global_include_cc.append("-I" + os.path.join(self.path_ndk, "sources", "android", "support", "include"))
|
||||
|
||||
self.global_flags_cc.append("-D__ARM_ARCH_5__")
|
||||
self.global_flags_cc.append("-D__ARM_ARCH_5T__")
|
||||
self.global_flags_cc.append("-D__ARM_ARCH_5E__")
|
||||
self.global_flags_cc.append("-D__ARM_ARCH_5TE__")
|
||||
if self.config["compilator"] == "clang":
|
||||
self.global_include_cc.append("-gcc-toolchain " + os.path.join(self.path_ndk, "sources", "android", "support", "include"))
|
||||
if self.type_arch == "armv5":
|
||||
pass
|
||||
elif self.type_arch == "armv7":
|
||||
# The only one tested ... ==> but we have link error ...
|
||||
self.add_flag("c", [
|
||||
"-target armv7-none-linux-androideabi",
|
||||
"-march=armv7-a",
|
||||
"-mfpu=vfpv3-d16",
|
||||
"-mhard-float"
|
||||
])
|
||||
self.add_flag("link", [
|
||||
"-target armv7-none-linux-androideabi",
|
||||
"-Wl,--fix-cortex-a8",
|
||||
"-Wl,--no-warn-mismatch",
|
||||
"-lm_hard"
|
||||
])
|
||||
elif self.type_arch == "mips":
|
||||
pass
|
||||
elif self.type_arch == "x86":
|
||||
pass
|
||||
else:
|
||||
if self.type_arch == "armv5":
|
||||
pass
|
||||
elif self.type_arch == "armv7":
|
||||
pass
|
||||
elif self.type_arch == "mips":
|
||||
pass
|
||||
elif self.type_arch == "x86":
|
||||
pass
|
||||
|
||||
self.global_sysroot = "--sysroot=" + os.path.join(self.path_ndk, "platforms", "android-" + str(self.board_id), "arch-arm")
|
||||
|
||||
self.add_flag("c", [
|
||||
"-D__ARM_ARCH_5__",
|
||||
"-D__ARM_ARCH_5T__",
|
||||
"-D__ARM_ARCH_5E__",
|
||||
"-D__ARM_ARCH_5TE__"
|
||||
])
|
||||
if self.config["compilator"] != "clang":
|
||||
if self.arch == "armv5":
|
||||
if self.type_arch == "armv5":
|
||||
# -----------------------
|
||||
# -- arm V5 :
|
||||
# -----------------------
|
||||
self.global_flags_cc.append("-march=armv5te")
|
||||
self.global_flags_cc.append("-msoft-float")
|
||||
self.add_flag("c", [
|
||||
"-march=armv5te",
|
||||
"-msoft-float"
|
||||
])
|
||||
else:
|
||||
# -----------------------
|
||||
# -- arm V7 (Neon) :
|
||||
# -----------------------
|
||||
self.global_flags_cc.append("-mfpu=neon")
|
||||
self.global_flags_cc.append("-mfloat-abi=softfp")
|
||||
self.global_flags_ld.append("-mfpu=neon")
|
||||
self.global_flags_ld.append("-mfloat-abi=softfp")
|
||||
self.global_flags_cc.append("-D__ARM_ARCH_7__")
|
||||
self.global_flags_cc.append("-D__ARM_NEON__")
|
||||
self.add_flag("c", [
|
||||
"-mfpu=neon",
|
||||
"-mfloat-abi=softfp",
|
||||
"-D__ARM_ARCH_7__",
|
||||
"-D__ARM_NEON__"
|
||||
])
|
||||
self.add_flag("link", [
|
||||
"-mfpu=neon",
|
||||
"-mfloat-abi=softfp"
|
||||
])
|
||||
|
||||
# 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)
|
||||
self.global_flags_cc.append("-mthumb")
|
||||
self.add_flag("c", "-mthumb")
|
||||
# -----------------------
|
||||
# -- Common flags :
|
||||
# -----------------------
|
||||
self.global_flags_cc.append("-fpic")
|
||||
self.add_flag("c", "-fpic")
|
||||
if self.config["compilator"] != "clang":
|
||||
self.global_flags_cc.append("-ffunction-sections")
|
||||
self.global_flags_cc.append("-funwind-tables")
|
||||
self.global_flags_cc.append("-fstack-protector")
|
||||
self.global_flags_cc.append("-Wno-psabi")
|
||||
self.global_flags_cc.append("-mtune=xscale")
|
||||
self.global_flags_cc.append("-fomit-frame-pointer")
|
||||
self.global_flags_cc.append("-fno-strict-aliasing")
|
||||
self.global_flags_xx.append("-frtti")
|
||||
self.global_flags_cc.append("-fexceptions")
|
||||
self.global_flags_xx.append("-Wa,--noexecstack")
|
||||
self.add_flag("c", [
|
||||
"-ffunction-sections",
|
||||
"-funwind-tables",
|
||||
"-fstack-protector",
|
||||
"-Wno-psabi",
|
||||
"-mtune=xscale",
|
||||
"-fomit-frame-pointer",
|
||||
"-fno-strict-aliasing"
|
||||
])
|
||||
self.add_flag("c++", [
|
||||
"-frtti",
|
||||
"-fexceptions",
|
||||
"-Wa,--noexecstack"
|
||||
])
|
||||
|
||||
def check_right_package(self, pkg_properties, value):
|
||||
for val in pkg_properties["RIGHT"]:
|
||||
@@ -208,6 +211,13 @@ class Target(target.Target):
|
||||
return True
|
||||
return False
|
||||
|
||||
def convert_name_application(self, pkg_name):
|
||||
value = pkg_name.lower()
|
||||
value = value.replace(' ', '')
|
||||
value = value.replace('-', '')
|
||||
value = value.replace('_', '')
|
||||
return value
|
||||
|
||||
"""
|
||||
def get_staging_path_data(self, binary_name):
|
||||
return self.get_staging_path(binary_name) + self.path_data
|
||||
@@ -266,16 +276,27 @@ class Target(target.Target):
|
||||
pkg_name_application_name = pkg_name
|
||||
if self.config["mode"] == "debug":
|
||||
pkg_name_application_name += "debug"
|
||||
#debug.info("ploppppp: " + str(pkg_properties))
|
||||
# FINAL_path_JAVA_PROJECT
|
||||
self.path_java_project = os.path.join(target_outpath,
|
||||
"src",
|
||||
pkg_properties["COMPAGNY_TYPE"],
|
||||
pkg_properties["COMPAGNY_NAME2"],
|
||||
"src")
|
||||
if pkg_properties["COMPAGNY_TYPE"] != "":
|
||||
self.path_java_project = os.path.join(self.path_java_project,
|
||||
pkg_properties["COMPAGNY_TYPE"])
|
||||
if pkg_properties["COMPAGNY_NAME2"] != "":
|
||||
self.path_java_project = os.path.join(self.path_java_project,
|
||||
pkg_properties["COMPAGNY_NAME2"])
|
||||
self.path_java_project = os.path.join(self.path_java_project,
|
||||
pkg_name_application_name)
|
||||
#FINAL_FILE_ABSTRACTION
|
||||
self.file_final_abstraction = os.path.join(self.path_java_project, pkg_name_application_name + ".java")
|
||||
|
||||
compleatePackageName = pkg_properties["COMPAGNY_TYPE"]+"."+pkg_properties["COMPAGNY_NAME2"]+"." + pkg_name_application_name
|
||||
compleatePackageName = ""
|
||||
if pkg_properties["COMPAGNY_TYPE"] != "":
|
||||
compleatePackageName += pkg_properties["COMPAGNY_TYPE"] + "."
|
||||
if pkg_properties["COMPAGNY_NAME2"] != "":
|
||||
compleatePackageName += pkg_properties["COMPAGNY_NAME2"] + "."
|
||||
compleatePackageName += pkg_name_application_name
|
||||
|
||||
if "ADMOD_ID" in pkg_properties:
|
||||
pkg_properties["RIGHT"].append("INTERNET")
|
||||
@@ -321,21 +342,25 @@ class Target(target.Target):
|
||||
# http://asantoso.wordpress.com/2009/09/15/how-to-build-android-application-package-apk-from-the-command-line-using-the-sdk-tools-continuously-integrated-using-cruisecontrol/
|
||||
debug.print_element("pkg", "R.java", "<==", "Resources files")
|
||||
tools.create_directory_of_file(target_outpath + "/src/noFile")
|
||||
androidToolPath = self.path_sdk + "/build-tools/"
|
||||
android_tool_path = self.path_sdk + "/build-tools/"
|
||||
# find android tool version
|
||||
dirnames = tools.get_list_sub_path(androidToolPath)
|
||||
if len(dirnames) != 1:
|
||||
debug.error("an error occured when getting the tools for android")
|
||||
androidToolPath += dirnames[0] + "/"
|
||||
dirnames = tools.get_list_sub_path(android_tool_path)
|
||||
if len(dirnames) == 0:
|
||||
debug.warning("This does not comport directory: '" + android_tool_path + "'")
|
||||
debug.error("An error occured when getting the tools for android")
|
||||
elif len(dirnames) > 1:
|
||||
dirnames = sorted(dirnames, reverse=True)
|
||||
debug.debug("sort tools directory: '" + str(dirnames) + "' ==> select : " + str(dirnames[0]))
|
||||
android_tool_path += dirnames[0] + "/"
|
||||
|
||||
# this is to create resource file for android ... (we did not use aset in jar with ewol ...
|
||||
adModResoucepath = ""
|
||||
if "ADMOD_ID" in pkg_properties:
|
||||
adModResoucepath = " -S " + self.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/res/ "
|
||||
cmdLine = androidToolPath + "aapt p -f " \
|
||||
cmdLine = android_tool_path + "aapt p -f " \
|
||||
+ "-M " + target_outpath + "/AndroidManifest.xml " \
|
||||
+ "-F " + target_outpath + "/resources.res " \
|
||||
+ "-I " + self.path_sdk + "/platforms/android-" + str(self.boardId) + "/android.jar "\
|
||||
+ "-I " + self.path_sdk + "/platforms/android-" + str(self.board_id) + "/android.jar "\
|
||||
+ "-S " + target_outpath + "/res/ " \
|
||||
+ adModResoucepath \
|
||||
+ "-J " + target_outpath + "/src/ "
|
||||
@@ -360,7 +385,7 @@ class Target(target.Target):
|
||||
|
||||
cmdLine = "javac " \
|
||||
+ "-d " + self.get_staging_path(pkg_name) + "/build/classes " \
|
||||
+ "-classpath " + self.path_sdk + "/platforms/android-" + str(self.boardId) + "/android.jar" \
|
||||
+ "-classpath " + self.path_sdk + "/platforms/android-" + str(self.board_id) + "/android.jar" \
|
||||
+ adModJarFile + " " \
|
||||
+ filesString \
|
||||
+ self.file_final_abstraction + " " \
|
||||
@@ -385,7 +410,7 @@ class Target(target.Target):
|
||||
multiprocess.run_command(cmdLine)
|
||||
|
||||
debug.print_element("pkg", ".dex", "<==", "*.class")
|
||||
cmdLine = androidToolPath + "dx " \
|
||||
cmdLine = android_tool_path + "dx " \
|
||||
+ "--dex --no-strict " \
|
||||
+ "--output=" + target_outpath + "/build/" + pkg_name_application_name + ".dex " \
|
||||
+ target_outpath + "/build/classes/ "
|
||||
@@ -442,7 +467,7 @@ class Target(target.Target):
|
||||
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)")
|
||||
cmdLine = "jarsigner " \
|
||||
+ " -keystore " + base_pkg_path + "/AndroidKey.jks " \
|
||||
+ " -keystore " + pkg_properties["ANDROID_SIGN"] + " " \
|
||||
+ " -sigalg SHA1withRSA -digestalg SHA1 " \
|
||||
+ target_outpath + "/build/" + pkg_name_application_name + "-unalligned.apk " \
|
||||
+ " " + pkg_name_application_name
|
||||
@@ -456,7 +481,7 @@ class Target(target.Target):
|
||||
debug.print_element("pkg", ".apk(aligned)", "<==", ".apk (not aligned)")
|
||||
tools.remove_file(target_outpath + "/" + pkg_name_application_name + ".apk")
|
||||
# verbose mode : -v
|
||||
cmdLine = androidToolPath + "zipalign 4 " \
|
||||
cmdLine = android_tool_path + "zipalign 4 " \
|
||||
+ target_outpath + "/build/" + pkg_name_application_name + "-unalligned.apk " \
|
||||
+ target_outpath + "/" + pkg_name_application_name + ".apk "
|
||||
multiprocess.run_command(cmdLine)
|
||||
@@ -487,7 +512,7 @@ class Target(target.Target):
|
||||
cmdLine = self.path_sdk + "/platform-tools/adb uninstall " + pkg_name_application_name
|
||||
Rmultiprocess.run_command(cmdLine)
|
||||
|
||||
def Log(self, pkg_name):
|
||||
def show_log(self, pkg_name):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("logcat of android board")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
|
200
lutin/z_target/lutinTarget_Debian.py
Normal file
200
lutin/z_target/lutinTarget_Debian.py
Normal file
@@ -0,0 +1,200 @@
|
||||
#!/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 target
|
||||
from lutin import tools
|
||||
import os
|
||||
import stat
|
||||
import re
|
||||
from lutin import host
|
||||
from lutin import multiprocess
|
||||
|
||||
class Target(target.Target):
|
||||
def __init__(self, config):
|
||||
#processor type selection (auto/arm/ppc/x86)
|
||||
if config["arch"] == "auto":
|
||||
config["arch"] = "x86"
|
||||
#bus size selection (auto/32/64)
|
||||
if config["bus-size"] == "auto":
|
||||
config["bus-size"] = str(host.BUS_SIZE)
|
||||
target.Target.__init__(self, "Linux", config, "")
|
||||
if self.config["bus-size"] == "64":
|
||||
# 64 bits
|
||||
if host.BUS_SIZE != 64:
|
||||
self.add_flag("c", "-m64")
|
||||
else:
|
||||
# 32 bits
|
||||
if host.BUS_SIZE != 32:
|
||||
self.add_flag("c", "-m32")
|
||||
|
||||
self.add_flag("c", "-fpic")
|
||||
|
||||
self.pkg_path_data = "share"
|
||||
self.pkg_path_bin = "bin"
|
||||
self.pkg_path_lib = "lib"
|
||||
self.pkg_path_license = "license"
|
||||
|
||||
"""
|
||||
.local/application
|
||||
*--> applName -> applName.app/bin/applName
|
||||
*--> applName.app
|
||||
*--> appl_description.txt
|
||||
*--> appl_name.txt
|
||||
*--> changelog.txt
|
||||
*--> copyright.txt
|
||||
*--> readme.txt
|
||||
*--> version.txt
|
||||
*--> website.txt
|
||||
*--> icon.png
|
||||
*--> bin
|
||||
* *--> applName
|
||||
*--> doc
|
||||
* *--> applName
|
||||
*--> lib
|
||||
* *--> XX.so
|
||||
* *--> YY.so
|
||||
*--> license
|
||||
* *--> applName.txt
|
||||
* *--> libXX.txt
|
||||
* *--> libYY.txt
|
||||
*--> man
|
||||
*--> share
|
||||
* *--> applName
|
||||
* *--> XX
|
||||
* *--> YY
|
||||
*--> sources
|
||||
"""
|
||||
def make_package_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Generate generic '" + pkg_name + "' v" + tools.version_to_string(pkg_properties["VERSION"]))
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
#output path
|
||||
target_outpath = os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app")
|
||||
tools.create_directory_of_file(target_outpath)
|
||||
|
||||
## Create share datas:
|
||||
self.make_package_binary_data(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
|
||||
|
||||
## copy binary files:
|
||||
self.make_package_binary_bin(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
|
||||
|
||||
## Create libraries:
|
||||
self.make_package_binary_lib(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
|
||||
|
||||
## Create generic files:
|
||||
self.make_package_generic_files(target_outpath, pkg_properties, pkg_name, base_pkg_path, heritage_list, static)
|
||||
|
||||
## create the package:
|
||||
debug.debug("package : " + 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(self.get_staging_path(pkg_name) + "/" + pkg_name + ".app.tar.gz", self.get_final_path() + "/" + pkg_name + ".app.gpkg")
|
||||
|
||||
|
||||
|
||||
|
||||
def make_package_debian(self, pkg_name, pkg_properties, base_pkg_path, heritage_list):
|
||||
# http://alp.developpez.com/tutoriels/debian/creer-paquet/
|
||||
debianpkg_name = re.sub("_", "-", pkg_name)
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Generate package '" + debianpkg_name + "' v"+pkg_properties["VERSION"])
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
self.get_staging_path(pkg_name)
|
||||
target_outpathDebian = self.get_staging_path(pkg_name) + "/DEBIAN/"
|
||||
finalFileControl = target_outpathDebian + "control"
|
||||
finalFilepostRm = target_outpathDebian + "postrm"
|
||||
# create the paths :
|
||||
tools.create_directory_of_file(finalFileControl)
|
||||
tools.create_directory_of_file(finalFilepostRm)
|
||||
## Create the control file
|
||||
tools.create_directory_of_file(finalFileControl)
|
||||
tmpFile = open(finalFileControl, 'w')
|
||||
tmpFile.write("Package: " + debianpkg_name + "\n")
|
||||
tmpFile.write("Version: " + pkg_properties["VERSION"] + "\n")
|
||||
tmpFile.write("Section: " + self.generate_list_separate_coma(pkg_properties["SECTION"]) + "\n")
|
||||
tmpFile.write("Priority: " + pkg_properties["PRIORITY"] + "\n")
|
||||
tmpFile.write("Architecture: all\n")
|
||||
tmpFile.write("Depends: bash\n")
|
||||
tmpFile.write("Maintainer: " + self.generate_list_separate_coma(pkg_properties["MAINTAINER"]) + "\n")
|
||||
tmpFile.write("Description: " + pkg_properties["DESCRIPTION"] + "\n")
|
||||
tmpFile.write("\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## Create the PostRm
|
||||
tmpFile = open(finalFilepostRm, 'w')
|
||||
tmpFile.write("#!/bin/bash\n")
|
||||
tmpFile.write("touch ~/." + pkg_name + "\n")
|
||||
if pkg_name != "":
|
||||
tmpFile.write("touch ~/.local/share/" + pkg_name + "\n")
|
||||
tmpFile.write("rm -r ~/.local/share/" + pkg_name + "\n")
|
||||
tmpFile.write("\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## Enable Execution in script
|
||||
os.chmod(finalFilepostRm, stat.S_IRWXU + stat.S_IRGRP + stat.S_IXGRP + stat.S_IROTH + stat.S_IXOTH);
|
||||
## Readme donumentation
|
||||
readmeFileDest = self.get_staging_path(pkg_name) + "/usr/share/doc/"+ debianpkg_name + "/README"
|
||||
tools.create_directory_of_file(readmeFileDest)
|
||||
if os.path.exists(base_pkg_path + "/os-Linux/README")==True:
|
||||
tools.copy_file(base_pkg_path + "/os-Linux/README", readmeFileDest)
|
||||
elif os.path.exists(base_pkg_path + "/README")==True:
|
||||
tools.copy_file(base_pkg_path + "/README", readmeFileDest)
|
||||
elif os.path.exists(base_pkg_path + "/README.md")==True:
|
||||
tools.copy_file(base_pkg_path + "/README.md", readmeFileDest)
|
||||
else:
|
||||
debug.info("no file 'README', 'README.md' or 'os-Linux/README' ==> generate an empty one")
|
||||
tmpFile = open(readmeFileDest, 'w')
|
||||
tmpFile.write("No documentation for " + pkg_name + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## licence file
|
||||
license_file_dest = self.get_staging_path(pkg_name) + "/usr/share/doc/"+ debianpkg_name + "/copyright"
|
||||
tools.create_directory_of_file(license_file_dest)
|
||||
if os.path.exists(base_pkg_path + "/license.txt")==True:
|
||||
tools.copy_file(base_pkg_path + "/license.txt", license_file_dest)
|
||||
else:
|
||||
debug.info("no file 'license.txt' ==> generate an empty one")
|
||||
tmpFile = open(license_file_dest, 'w')
|
||||
tmpFile.write("No license define by the developper for " + pkg_name + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
##changeLog file
|
||||
change_log_file_dest = self.get_staging_path(pkg_name) + "/usr/share/doc/"+ debianpkg_name + "/changelog"
|
||||
tools.create_directory_of_file(change_log_file_dest)
|
||||
if os.path.exists(base_pkg_path + "/changelog")==True:
|
||||
tools.copy_file(base_pkg_path + "/changelog", change_log_file_dest)
|
||||
else:
|
||||
debug.info("no file 'changelog' ==> generate an empty one")
|
||||
tmpFile = open(change_log_file_dest, 'w')
|
||||
tmpFile.write("No changelog data " + pkg_name + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## create the package :
|
||||
debug.debug("package : " + self.get_staging_path(pkg_name) + "/" + debianpkg_name + ".deb")
|
||||
os.system("cd " + self.get_staging_path("") + " ; dpkg-deb --build " + pkg_name)
|
||||
tools.create_directory_of_file(self.get_final_path())
|
||||
tools.copy_file(self.get_staging_path("") + "/" + pkg_name + self.suffix_package, self.get_final_path() + "/" + pkg_name + self.suffix_package)
|
||||
|
||||
def install_package(self, pkg_name):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Install package '" + pkg_name + "'")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
os.system("sudo dpkg -i " + self.get_final_path() + "/" + pkg_name + self.suffix_package)
|
||||
|
||||
def un_install_package(self, pkg_name):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Un-Install package '" + pkg_name + "'")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
os.system("sudo dpkg -r " + self.get_final_path() + "/" + pkg_name + self.suffix_package)
|
||||
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
@@ -56,26 +57,26 @@ class Target(target.Target):
|
||||
|
||||
if self.sumulator == True:
|
||||
self.sysroot = "-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk"
|
||||
self.global_flags_ld.append("-mios-simulator-version-min=8.0")
|
||||
self.global_flags_cc.append("-mios-simulator-version-min=8.0")
|
||||
self.add_flag("link", "-mios-simulator-version-min=8.0")
|
||||
self.add_flag("c", "-mios-simulator-version-min=8.0")
|
||||
else:
|
||||
self.sysroot = "-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk"
|
||||
self.global_flags_ld.append("-miphoneos-version-min=8.0")
|
||||
self.global_flags_cc.append("-miphoneos-version-min=8.0")
|
||||
self.add_flag("link", "-miphoneos-version-min=8.0")
|
||||
self.add_flag("c", "-miphoneos-version-min=8.0")
|
||||
|
||||
self.global_flags_cc.append("-D__STDCPP_LLVM__")
|
||||
self.global_flags_ld.append([
|
||||
"-Xlinker",
|
||||
"-objc_abi_version",
|
||||
"-Xlinker 2",
|
||||
"-Xlinker",
|
||||
"-no_implicit_dylibs",
|
||||
"-stdlib=libc++",
|
||||
"-fobjc-arc",
|
||||
"-fobjc-link-runtime"])
|
||||
self.add_flag("link", [
|
||||
"-Xlinker",
|
||||
"-objc_abi_version",
|
||||
"-Xlinker 2",
|
||||
"-Xlinker",
|
||||
"-no_implicit_dylibs",
|
||||
"-stdlib=libc++",
|
||||
"-fobjc-arc",
|
||||
"-fobjc-link-runtime"
|
||||
])
|
||||
|
||||
self.global_flags_m.append("-fobjc-arc")
|
||||
#self.global_flags_m.append("-fmodules")
|
||||
self.add_flag("m", ["-fobjc-arc"])
|
||||
#self.add_flag("m", ["-fmodules"])
|
||||
|
||||
self.pkg_path_data = "share"
|
||||
self.pkg_path_bin = ""
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
@@ -28,15 +29,13 @@ class Target(target.Target):
|
||||
if self.config["bus-size"] == "64":
|
||||
# 64 bits
|
||||
if host.BUS_SIZE != 64:
|
||||
self.global_flags_cc.append("-m64")
|
||||
self.add_flag("c", "-m64")
|
||||
else:
|
||||
# 32 bits
|
||||
if host.BUS_SIZE != 32:
|
||||
self.global_flags_cc.append("-m32")
|
||||
|
||||
self.global_flags_cc.append("-fpic")
|
||||
self.global_flags_cc.append("-D__STDCPP_GNU__")
|
||||
self.add_flag("c", "-m32")
|
||||
|
||||
self.add_flag("c", "-fpic")
|
||||
|
||||
self.pkg_path_data = "share"
|
||||
self.pkg_path_bin = "bin"
|
||||
@@ -75,240 +74,85 @@ class Target(target.Target):
|
||||
"""
|
||||
def make_package_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static):
|
||||
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("------------------------------------------------------------------------")
|
||||
#output path
|
||||
target_outpath = os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app")
|
||||
tools.create_directory_of_file(target_outpath)
|
||||
|
||||
## 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:
|
||||
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:
|
||||
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:
|
||||
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:
|
||||
debug.debug("package : " + 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(self.get_staging_path(pkg_name) + "/" + pkg_name + ".app.tar.gz", self.get_final_path() + "/" + pkg_name + ".app.gpkg")
|
||||
|
||||
|
||||
|
||||
|
||||
def make_package_debian(self, pkg_name, pkg_properties, base_pkg_path, heritage_list):
|
||||
# http://alp.developpez.com/tutoriels/debian/creer-paquet/
|
||||
debianpkg_name = re.sub("_", "-", pkg_name)
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Generate package '" + debianpkg_name + "' v"+pkg_properties["VERSION"])
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
self.get_staging_path(pkg_name)
|
||||
target_outpathDebian = self.get_staging_path(pkg_name) + "/DEBIAN/"
|
||||
finalFileControl = target_outpathDebian + "control"
|
||||
finalFilepostRm = target_outpathDebian + "postrm"
|
||||
# create the paths :
|
||||
tools.create_directory_of_file(finalFileControl)
|
||||
tools.create_directory_of_file(finalFilepostRm)
|
||||
## Create the control file
|
||||
tools.create_directory_of_file(finalFileControl)
|
||||
tmpFile = open(finalFileControl, 'w')
|
||||
tmpFile.write("Package: " + debianpkg_name + "\n")
|
||||
tmpFile.write("Version: " + pkg_properties["VERSION"] + "\n")
|
||||
tmpFile.write("Section: " + self.generate_list_separate_coma(pkg_properties["SECTION"]) + "\n")
|
||||
tmpFile.write("Priority: " + pkg_properties["PRIORITY"] + "\n")
|
||||
tmpFile.write("Architecture: all\n")
|
||||
tmpFile.write("Depends: bash\n")
|
||||
tmpFile.write("Maintainer: " + self.generate_list_separate_coma(pkg_properties["MAINTAINER"]) + "\n")
|
||||
tmpFile.write("Description: " + pkg_properties["DESCRIPTION"] + "\n")
|
||||
tmpFile.write("\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## Create the PostRm
|
||||
tmpFile = open(finalFilepostRm, 'w')
|
||||
tmpFile.write("#!/bin/bash\n")
|
||||
tmpFile.write("touch ~/." + pkg_name + "\n")
|
||||
if pkg_name != "":
|
||||
tmpFile.write("touch ~/.local/share/" + pkg_name + "\n")
|
||||
tmpFile.write("rm -r ~/.local/share/" + pkg_name + "\n")
|
||||
tmpFile.write("\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## Enable Execution in script
|
||||
os.chmod(finalFilepostRm, stat.S_IRWXU + stat.S_IRGRP + stat.S_IXGRP + stat.S_IROTH + stat.S_IXOTH);
|
||||
## Readme donumentation
|
||||
readmeFileDest = self.get_staging_path(pkg_name) + "/usr/share/doc/"+ debianpkg_name + "/README"
|
||||
tools.create_directory_of_file(readmeFileDest)
|
||||
if os.path.exists(base_pkg_path + "/os-Linux/README")==True:
|
||||
tools.copy_file(base_pkg_path + "/os-Linux/README", readmeFileDest)
|
||||
elif os.path.exists(base_pkg_path + "/README")==True:
|
||||
tools.copy_file(base_pkg_path + "/README", readmeFileDest)
|
||||
elif os.path.exists(base_pkg_path + "/README.md")==True:
|
||||
tools.copy_file(base_pkg_path + "/README.md", readmeFileDest)
|
||||
else:
|
||||
debug.info("no file 'README', 'README.md' or 'os-Linux/README' ==> generate an empty one")
|
||||
tmpFile = open(readmeFileDest, 'w')
|
||||
tmpFile.write("No documentation for " + pkg_name + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## licence file
|
||||
license_file_dest = self.get_staging_path(pkg_name) + "/usr/share/doc/"+ debianpkg_name + "/copyright"
|
||||
tools.create_directory_of_file(license_file_dest)
|
||||
if os.path.exists(base_pkg_path + "/license.txt")==True:
|
||||
tools.copy_file(base_pkg_path + "/license.txt", license_file_dest)
|
||||
else:
|
||||
debug.info("no file 'license.txt' ==> generate an empty one")
|
||||
tmpFile = open(license_file_dest, 'w')
|
||||
tmpFile.write("No license define by the developper for " + pkg_name + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
##changeLog file
|
||||
change_log_file_dest = self.get_staging_path(pkg_name) + "/usr/share/doc/"+ debianpkg_name + "/changelog"
|
||||
tools.create_directory_of_file(change_log_file_dest)
|
||||
if os.path.exists(base_pkg_path + "/changelog")==True:
|
||||
tools.copy_file(base_pkg_path + "/changelog", change_log_file_dest)
|
||||
else:
|
||||
debug.info("no file 'changelog' ==> generate an empty one")
|
||||
tmpFile = open(change_log_file_dest, 'w')
|
||||
tmpFile.write("No changelog data " + pkg_name + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## create the package :
|
||||
debug.debug("package : " + self.get_staging_path(pkg_name) + "/" + debianpkg_name + ".deb")
|
||||
os.system("cd " + self.get_staging_path("") + " ; dpkg-deb --build " + pkg_name)
|
||||
tools.create_directory_of_file(self.get_final_path())
|
||||
tools.copy_file(self.get_staging_path("") + "/" + pkg_name + self.suffix_package, self.get_final_path() + "/" + pkg_name + self.suffix_package)
|
||||
if ret_share \
|
||||
or ret_bin \
|
||||
or ret_lib \
|
||||
or ret_file:
|
||||
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):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Install package '" + pkg_name + "'")
|
||||
debug.info("-- Install package '" + pkg_name + "'")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
os.system("sudo dpkg -i " + self.get_final_path() + "/" + pkg_name + self.suffix_package)
|
||||
# this is temporary ... Will call:
|
||||
if False:
|
||||
os.system("lutin-pkg -i " + os.path.join(self.get_final_path(), + pkg_name + ".app.gpkg"))
|
||||
else:
|
||||
#Copy directly from staging path:
|
||||
appl_path = os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app")
|
||||
target_path = os.path.join(os.path.expanduser("~"), ".local", "application", pkg_name + ".app")
|
||||
target_bin_path = os.path.join(os.path.expanduser("~"), ".local", "application", pkg_name + ".app", "bin", pkg_name)
|
||||
target_bin_link = os.path.join(os.path.expanduser("~"), ".local", "application", pkg_name)
|
||||
# remove output path:
|
||||
tools.remove_path_and_sub_path(target_path)
|
||||
# remove executable link version:
|
||||
tools.remove_file(target_bin_link)
|
||||
# copy result:
|
||||
tools.copy_anything(appl_path, target_path, recursive=True)
|
||||
# create synbolic link:
|
||||
debug.info("kkk " + "ln -s " + target_bin_path + " " + target_bin_link)
|
||||
os.symlink(target_bin_path, target_bin_link)
|
||||
|
||||
def un_install_package(self, pkg_name):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Un-Install package '" + pkg_name + "'")
|
||||
debug.info("-- Un-Install package '" + pkg_name + "'")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
os.system("sudo dpkg -r " + self.get_final_path() + "/" + pkg_name + self.suffix_package)
|
||||
# this is temporary ... Will call:
|
||||
if False:
|
||||
os.system("lutin-pkg -r " + pkg_name)
|
||||
else:
|
||||
#Copy directly from staging path:
|
||||
target_path = os.path.join(os.path.expanduser("~"), ".local", "application", pkg_name + ".app")
|
||||
target_bin_link = os.path.join(os.path.expanduser("~"), ".local", "application", pkg_name)
|
||||
# remove output path:
|
||||
tools.remove_path_and_sub_path(target_path)
|
||||
# remove executable link version:
|
||||
tools.remove_file(target_bin_link)
|
||||
|
||||
"""
|
||||
.local/application
|
||||
*--> applName -> applName.app/bin/applName
|
||||
*--> applName.app
|
||||
*--> appl_description.txt
|
||||
*--> appl_name.txt
|
||||
*--> changelog.txt
|
||||
*--> copyright.txt
|
||||
*--> readme.txt
|
||||
*--> version.txt
|
||||
*--> website.txt
|
||||
*--> icon.png
|
||||
*--> bin
|
||||
* *--> applName
|
||||
*--> doc
|
||||
* *--> applName
|
||||
*--> lib
|
||||
* *--> XX.so
|
||||
* *--> YY.so
|
||||
*--> license
|
||||
* *--> applName.txt
|
||||
* *--> libXX.txt
|
||||
* *--> libYY.txt
|
||||
*--> man
|
||||
*--> share
|
||||
* *--> applName
|
||||
* *--> XX
|
||||
* *--> YY
|
||||
*--> sources
|
||||
"""
|
||||
def make_package_generic(self, pkg_name, pkg_properties, base_pkg_path, heritage_list):
|
||||
debug.warning("heritage for " + str(pkg_name) + ":")
|
||||
for heritage in heritage_list.list_heritage:
|
||||
debug.warning("heritage .... " + str(heritage.name) + " : " + str(heritage.depends))
|
||||
debianpkg_name = re.sub("_", "-", pkg_name)
|
||||
def run(self, pkg_name, option_list):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Generate generic '" + debianpkg_name + "' v"+pkg_properties["VERSION"])
|
||||
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("------------------------------------------------------------------------")
|
||||
target_outpath = self.get_staging_path(pkg_name) + "/edn.app/"
|
||||
tools.create_directory_of_file(target_outpath)
|
||||
## Create version file
|
||||
tmpFile = open(target_outpath + "/version.txt", 'w')
|
||||
tmpFile.write(pkg_properties["VERSION"])
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## Create maintainer file
|
||||
tmpFile = open(target_outpath + "/maintainer.txt", 'w')
|
||||
tmpFile.write(self.generate_list_separate_coma(pkg_properties["MAINTAINER"]))
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## Create appl_name file
|
||||
tmpFile = open(target_outpath + "/appl_name.txt", 'w')
|
||||
tmpFile.write("en_EN:" + pkg_properties["NAME"])
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## Create appl_description file
|
||||
tmpFile = open(target_outpath + "/appl_description.txt", 'w')
|
||||
tmpFile.write("en_EN:" + pkg_properties["DESCRIPTION"])
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## Create Readme file
|
||||
readmeFileDest = target_outpath + "/readme.txt"
|
||||
if os.path.exists(base_pkg_path + "/os-Linux/README")==True:
|
||||
tools.copy_file(base_pkg_path + "/os-Linux/README", readmeFileDest)
|
||||
elif os.path.exists(base_pkg_path + "/README")==True:
|
||||
tools.copy_file(base_pkg_path + "/README", readmeFileDest)
|
||||
elif os.path.exists(base_pkg_path + "/README.md")==True:
|
||||
tools.copy_file(base_pkg_path + "/README.md", readmeFileDest)
|
||||
else:
|
||||
debug.info("no file 'README', 'README.md' or 'os-Linux/README' ==> generate an empty one")
|
||||
tmpFile = open(readmeFileDest, 'w')
|
||||
tmpFile.write("No documentation for " + pkg_name + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## Create licence file
|
||||
license_file_dest = target_outpath + "/license/"+ debianpkg_name + ".txt"
|
||||
tools.create_directory_of_file(license_file_dest)
|
||||
if os.path.exists(base_pkg_path + "/license.txt")==True:
|
||||
tools.copy_file(base_pkg_path + "/license.txt", license_file_dest)
|
||||
else:
|
||||
debug.info("no file 'license.txt' ==> generate an empty one")
|
||||
tmpFile = open(license_file_dest, 'w')
|
||||
tmpFile.write("No license define by the developper for " + pkg_name + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## Create changeLog file
|
||||
change_log_file_dest = target_outpath + "/changelog.txt"
|
||||
if os.path.exists(base_pkg_path + "/changelog") == True:
|
||||
tools.copy_file(base_pkg_path + "/changelog", change_log_file_dest)
|
||||
else:
|
||||
debug.info("no file 'changelog' ==> generate an empty one")
|
||||
tmpFile = open(change_log_file_dest, 'w')
|
||||
tmpFile.write("No changelog data " + pkg_name + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## copy share path
|
||||
#debug.info("plop:" + self.get_staging_path(pkg_name) + self.path_data)
|
||||
if os.path.exists(self.get_staging_path(pkg_name) + self.path_data) == True:
|
||||
tools.copy_anything(self.get_staging_path(pkg_name) + self.path_data + "/*", target_outpath + self.path_data, recursive=True)
|
||||
|
||||
## Create binary path:
|
||||
bin_path = target_outpath + self.path_bin
|
||||
#tools.create_directory_of_file(bin_path)
|
||||
tools.copy_anything(self.get_staging_path(pkg_name) + self.path_bin + "/*",
|
||||
bin_path)
|
||||
|
||||
## create the package:
|
||||
debug.debug("package : " + self.get_staging_path(pkg_name) + "/" + debianpkg_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(self.get_staging_path(pkg_name) + "/" + pkg_name + ".app.tar.gz", self.get_final_path() + "/" + pkg_name + ".app.gpkg")
|
||||
|
||||
|
||||
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
@@ -38,8 +39,6 @@ class Target(target.Target):
|
||||
#self.suffix_binary=''
|
||||
#self.suffix_package=''
|
||||
|
||||
self.global_flags_cc.append("-D__STDCPP_LLVM__")
|
||||
|
||||
self.pkg_path_data = "Resources"
|
||||
self.pkg_path_bin = "MacOS"
|
||||
self.pkg_path_lib = "lib"
|
||||
@@ -138,7 +137,7 @@ class Target(target.Target):
|
||||
if os.path.exists("/Applications/" + pkg_name + ".app") == True:
|
||||
shutil.rmtree("/Applications/" + pkg_name + ".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):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
@@ -148,6 +147,21 @@ class Target(target.Target):
|
||||
# Remove the application in the basic application path : /Applications/xxx.app
|
||||
if os.path.exists("/Applications/" + pkg_name + ".app") == True:
|
||||
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
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
@@ -45,15 +46,6 @@ class Target(target.Target):
|
||||
else:
|
||||
# 32 bits
|
||||
self.set_cross_base("i686-w64-mingw32-")
|
||||
# force static link to prenvent many errors ...
|
||||
self.global_flags_ld.append(["-static-libgcc",
|
||||
"-static-libstdc++",
|
||||
"-static"])
|
||||
|
||||
#self.path_bin=""
|
||||
#self.path_lib="lib"
|
||||
#self.path_data="data"
|
||||
#self.path_doc="doc"
|
||||
|
||||
self.pkg_path_data = "data"
|
||||
self.pkg_path_bin = ""
|
||||
@@ -64,7 +56,6 @@ class Target(target.Target):
|
||||
self.suffix_lib_dynamic='.dll'
|
||||
self.suffix_binary='.exe'
|
||||
#self.suffix_package=''
|
||||
self.global_flags_cc.append("-D__STDCPP_GNU__")
|
||||
|
||||
|
||||
def get_staging_path_data(self, binary_name, heritage_list):
|
||||
@@ -72,24 +63,30 @@ class Target(target.Target):
|
||||
|
||||
def make_package_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static):
|
||||
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("------------------------------------------------------------------------")
|
||||
#output path
|
||||
target_outpath = os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app")
|
||||
tools.create_directory_of_file(target_outpath)
|
||||
|
||||
## 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:
|
||||
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:
|
||||
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:
|
||||
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):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
@@ -6,6 +7,7 @@
|
||||
##
|
||||
## @license APACHE v2.0 (see license file)
|
||||
##
|
||||
|
||||
import platform
|
||||
import os
|
||||
import zipfile
|
||||
|
11
setup.py
11
setup.py
@@ -1,4 +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)
|
||||
##
|
||||
|
||||
from setuptools import setup
|
||||
|
||||
def readme():
|
||||
@@ -7,7 +16,7 @@ def readme():
|
||||
|
||||
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
|
||||
setup(name='lutin',
|
||||
version='0.7.6',
|
||||
version='1.2.2',
|
||||
description='Lutin generic builder (might replace makefile, CMake ...)',
|
||||
long_description=readme(),
|
||||
url='http://github.com/HeeroYui/lutin',
|
||||
|
22
test/test-c/lutin_test-c.py
Normal file
22
test/test-c/lutin_test-c.py
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/python
|
||||
import lutin.module as module
|
||||
import lutin.tools as tools
|
||||
import lutin.debug as debug
|
||||
import os
|
||||
|
||||
def get_type():
|
||||
return "BINARY"
|
||||
|
||||
def get_desc():
|
||||
return "Text C compilation"
|
||||
|
||||
def create(target, module_name):
|
||||
my_module = module.Module(__file__, module_name, get_type())
|
||||
my_module.add_extra_compile_flags()
|
||||
my_module.add_src_file([
|
||||
'test.c'
|
||||
])
|
||||
if target.name=="Android":
|
||||
my_module.compile_version("c", 1999)
|
||||
return my_module
|
||||
|
6
test/test-c/test.c
Normal file
6
test/test-c/test.c
Normal file
@@ -0,0 +1,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int _argc, char* _argv[]) {
|
||||
printf("Hello World\n");
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user