Compare commits
	
		
			25 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| eeb070e014 | |||
| 99927380d6 | |||
| 8fc81f1caa | |||
| 5f325c2d7e | |||
| f65a5f58ee | |||
| 4020c70fc3 | |||
| 6cb2ef2bd2 | |||
| aa120cde57 | |||
| 2604cd93be | |||
| 10055dd3c6 | |||
| db0c2a8e11 | |||
| 2bb4e2d377 | |||
| 07058eda14 | |||
| a4ddf8e81b | |||
| c73a7a0df6 | |||
| 7e41e6f393 | |||
| 2e2143ebcf | |||
| 780979e0f0 | |||
| 9034d303e5 | |||
| 912171b33d | |||
| 18b37ba5d0 | |||
| 3111d3899f | |||
| 8d92551ec8 | |||
| 78edf4851a | |||
| 2b7baf2581 | 
@@ -1 +1,2 @@
 | 
				
			|||||||
include README.rst
 | 
					include README.rst
 | 
				
			||||||
 | 
					include bash-autocompletion/lutin
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,6 +3,9 @@ Lutin
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
`lutin` is a generic builder and package maker is a FREE software tool.
 | 
					`lutin` is a generic builder and package maker is a FREE software tool.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.. image:: https://badge.fury.io/py/lutin.png
 | 
				
			||||||
 | 
					    :target: https://pypi.python.org/pypi/lutin
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Instructions
 | 
					Instructions
 | 
				
			||||||
------------
 | 
					------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -61,7 +61,7 @@ _lutin()
 | 
				
			|||||||
			return 0
 | 
								return 0
 | 
				
			||||||
			;;
 | 
								;;
 | 
				
			||||||
		--target)
 | 
							--target)
 | 
				
			||||||
			local names=`lutin.py --list-target`
 | 
								local names=`lutin --list-target`
 | 
				
			||||||
			COMPREPLY=( $(compgen -W "${names}" -- ${cur}) )
 | 
								COMPREPLY=( $(compgen -W "${names}" -- ${cur}) )
 | 
				
			||||||
			return 0
 | 
								return 0
 | 
				
			||||||
			;;
 | 
								;;
 | 
				
			||||||
@@ -82,9 +82,9 @@ _lutin()
 | 
				
			|||||||
		COMPREPLY=( $(compgen -W "${optshorts}" -- ${cur}) )
 | 
							COMPREPLY=( $(compgen -W "${optshorts}" -- ${cur}) )
 | 
				
			||||||
		return 0
 | 
							return 0
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
	listmodule=`lutin.py --list-module`
 | 
						listmodule=`lutin --list-module`
 | 
				
			||||||
	COMPREPLY=( $(compgen -W "${listmodule}" -- ${cur}) )
 | 
						COMPREPLY=( $(compgen -W "${listmodule}" -- ${cur}) )
 | 
				
			||||||
	return 0
 | 
						return 0
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
complete -F _lutin lutin.py
 | 
					complete -F _lutin lutin
 | 
				
			||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
to install autocompletion for lutin :
 | 
					to install autocompletion for lutin :
 | 
				
			||||||
 | 
					
 | 
				
			||||||
sudo cp bash-autocompletion/lutin.py /etc/bash_completion.d
 | 
					sudo cp bash-autocompletion/lutin /etc/bash_completion.d
 | 
				
			||||||
 | 
					
 | 
				
			||||||
==> and restart bash ...
 | 
					==> and restart bash ...
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										22
									
								
								bin/lutin
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								bin/lutin
									
									
									
									
									
								
							@@ -31,6 +31,7 @@ myArgs.add(arguments.ArgDefine("s", "force-strip", desc="Force the stripping of
 | 
				
			|||||||
myArgs.add_section("properties", "keep in the sequency of the cible")
 | 
					myArgs.add_section("properties", "keep in the sequency of the cible")
 | 
				
			||||||
myArgs.add(arguments.ArgDefine("t", "target", haveParam=True, desc="Select a target (by default the platform is the computer that compile this) To know list : 'lutin.py --list-target'"))
 | 
					myArgs.add(arguments.ArgDefine("t", "target", haveParam=True, desc="Select a target (by default the platform is the computer that compile this) To know list : 'lutin.py --list-target'"))
 | 
				
			||||||
myArgs.add(arguments.ArgDefine("c", "compilator", list=[["clang",""],["gcc",""]], desc="Compile with clang or Gcc mode (by default gcc will be used)"))
 | 
					myArgs.add(arguments.ArgDefine("c", "compilator", list=[["clang",""],["gcc",""]], desc="Compile with clang or Gcc mode (by default gcc will be used)"))
 | 
				
			||||||
 | 
					myArgs.add(arguments.ArgDefine("", "compilator-version", haveParam=True, desc="with travis we need to specify the name of the version if we want to compile with gcc 4.9 ==> --compilator-version=4.9"))
 | 
				
			||||||
myArgs.add(arguments.ArgDefine("m", "mode", list=[["debug",""],["release",""]], desc="Compile in release or debug mode (default release)"))
 | 
					myArgs.add(arguments.ArgDefine("m", "mode", list=[["debug",""],["release",""]], desc="Compile in release or debug mode (default release)"))
 | 
				
			||||||
myArgs.add(arguments.ArgDefine("a", "arch", list=[["auto","Automatic choice"],["arm","Arm processer"],["x86","Generic PC : AMD/Intel"],["ppc","Power PC"]], desc="Architecture to compile"))
 | 
					myArgs.add(arguments.ArgDefine("a", "arch", list=[["auto","Automatic choice"],["arm","Arm processer"],["x86","Generic PC : AMD/Intel"],["ppc","Power PC"]], desc="Architecture to compile"))
 | 
				
			||||||
myArgs.add(arguments.ArgDefine("b", "bus", list=[["auto","Automatic choice"],["32","32 bits"],["64","64 bits"]], desc="Adressing size (Bus size)"))
 | 
					myArgs.add(arguments.ArgDefine("b", "bus", list=[["auto","Automatic choice"],["32","32 bits"],["64","64 bits"]], desc="Adressing size (Bus size)"))
 | 
				
			||||||
@@ -47,18 +48,21 @@ localArgument = myArgs.parse()
 | 
				
			|||||||
	display the help of this makefile
 | 
						display the help of this makefile
 | 
				
			||||||
"""
 | 
					"""
 | 
				
			||||||
def usage():
 | 
					def usage():
 | 
				
			||||||
 | 
						color = debug.get_color_set()
 | 
				
			||||||
	# generic argument displayed : 
 | 
						# generic argument displayed : 
 | 
				
			||||||
	myArgs.display()
 | 
						myArgs.display()
 | 
				
			||||||
	print("		All target can finish with '?clean' '?dump' ... ?action")
 | 
						print("		All target can finish with '?clean' '?dump' '?gcov' ... ?action")
 | 
				
			||||||
	print("		all")
 | 
						print("		" + color['green'] + "all" + color['default'])
 | 
				
			||||||
	print("			build all (only for the current selected board) (bynary and packages)")
 | 
						print("			build all (only for the current selected board) (bynary and packages)")
 | 
				
			||||||
	print("		clean")
 | 
						print("		" + color['green'] + "clean" + color['default'])
 | 
				
			||||||
	print("			clean all (same as previous)")
 | 
						print("			clean all (same as previous)")
 | 
				
			||||||
	print("		dump")
 | 
						print("		" + color['green'] + "dump" + color['default'])
 | 
				
			||||||
	print("			Dump all the module dependency and properties")
 | 
						print("			Dump all the module dependency and properties")
 | 
				
			||||||
 | 
						print("		" + color['green'] + "gcov" + color['default'])
 | 
				
			||||||
 | 
						print("			Parse all the code of the library with the gcov resolution")
 | 
				
			||||||
	listOfAllModule = module.list_all_module_with_desc()
 | 
						listOfAllModule = module.list_all_module_with_desc()
 | 
				
			||||||
	for mod in listOfAllModule:
 | 
						for mod in listOfAllModule:
 | 
				
			||||||
		print("		" + mod[0])
 | 
							print("		" + color['green'] + mod[0] + color['default'])
 | 
				
			||||||
		if mod[1] != "":
 | 
							if mod[1] != "":
 | 
				
			||||||
			print("			" + mod[1])
 | 
								print("			" + mod[1])
 | 
				
			||||||
	print("	ex: " + sys.argv[0] + " all --target=Android all -t Windows -m debug all")
 | 
						print("	ex: " + sys.argv[0] + " all --target=Android all -t Windows -m debug all")
 | 
				
			||||||
@@ -139,7 +143,8 @@ config = {
 | 
				
			|||||||
	"arch":"auto",
 | 
						"arch":"auto",
 | 
				
			||||||
	"generate-package":True,
 | 
						"generate-package":True,
 | 
				
			||||||
	"simulation":False,
 | 
						"simulation":False,
 | 
				
			||||||
	"gcov":False
 | 
						"gcov":False,
 | 
				
			||||||
 | 
						"compilator-version":""
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
# load the default target :
 | 
					# load the default target :
 | 
				
			||||||
my_target = None
 | 
					my_target = None
 | 
				
			||||||
@@ -148,6 +153,8 @@ actionDone=False
 | 
				
			|||||||
for argument in localArgument:
 | 
					for argument in localArgument:
 | 
				
			||||||
	if parseGenericArg(argument, False) == True:
 | 
						if parseGenericArg(argument, False) == True:
 | 
				
			||||||
		continue
 | 
							continue
 | 
				
			||||||
 | 
						elif argument.get_option_nName() == "compilator-version":
 | 
				
			||||||
 | 
							config["compilator-version"] = argument.get_arg()
 | 
				
			||||||
	elif argument.get_option_nName() == "package":
 | 
						elif argument.get_option_nName() == "package":
 | 
				
			||||||
		config["generate-package"]=False
 | 
							config["generate-package"]=False
 | 
				
			||||||
	elif argument.get_option_nName() == "simulation":
 | 
						elif argument.get_option_nName() == "simulation":
 | 
				
			||||||
@@ -177,7 +184,8 @@ for argument in localArgument:
 | 
				
			|||||||
			             "arch":"auto",
 | 
								             "arch":"auto",
 | 
				
			||||||
			             "generate-package":True,
 | 
								             "generate-package":True,
 | 
				
			||||||
			             "simulation":False,
 | 
								             "simulation":False,
 | 
				
			||||||
			             "gcov":False
 | 
								             "gcov":False,
 | 
				
			||||||
 | 
								             "compilator-version":""
 | 
				
			||||||
			          }
 | 
								          }
 | 
				
			||||||
			#remove previous target
 | 
								#remove previous target
 | 
				
			||||||
			my_target = None
 | 
								my_target = None
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										13
									
								
								lutin/arg.py
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								lutin/arg.py
									
									
									
									
									
								
							@@ -70,12 +70,13 @@ class ArgDefine:
 | 
				
			|||||||
		return False
 | 
							return False
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	def display(self):
 | 
						def display(self):
 | 
				
			||||||
 | 
							color = debug.get_color_set()
 | 
				
			||||||
		if self.m_optionSmall != "" and self.m_optionBig != "":
 | 
							if self.m_optionSmall != "" and self.m_optionBig != "":
 | 
				
			||||||
			print("		-" + self.m_optionSmall + " / --" + self.m_optionBig)
 | 
								print("		" + color['red'] + "-" + self.m_optionSmall + "" + color['default'] + " / " + color['red'] + "--" + self.m_optionBig + color['default'])
 | 
				
			||||||
		elif self.m_optionSmall != "":
 | 
							elif self.m_optionSmall != "":
 | 
				
			||||||
			print("		-" + self.m_optionSmall)
 | 
								print("		" + color['red'] + "-" + self.m_optionSmall + color['default'])
 | 
				
			||||||
		elif self.m_optionBig != "":
 | 
							elif self.m_optionBig != "":
 | 
				
			||||||
			print("		--" + self.m_optionBig)
 | 
								print("		" + color['red'] + "--" + self.m_optionBig + color['default'])
 | 
				
			||||||
		else:
 | 
							else:
 | 
				
			||||||
			print("		???? ==> internal error ...")
 | 
								print("		???? ==> internal error ...")
 | 
				
			||||||
		if self.m_description != "":
 | 
							if self.m_description != "":
 | 
				
			||||||
@@ -115,10 +116,12 @@ class ArgSection:
 | 
				
			|||||||
		return ""
 | 
							return ""
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
	def get_porperties(self):
 | 
						def get_porperties(self):
 | 
				
			||||||
		return " [" + self.m_section + "]"
 | 
							color = debug.get_color_set()
 | 
				
			||||||
 | 
							return " [" + color['blue'] + self.m_section + color['default'] + "]"
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	def display(self):
 | 
						def display(self):
 | 
				
			||||||
		print("	[" + self.m_section + "] : " + self.m_description)
 | 
							color = debug.get_color_set()
 | 
				
			||||||
 | 
							print("	[" + color['blue'] + self.m_section + color['default'] + "] : " + self.m_description)
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	def parse(self, argList, currentID):
 | 
						def parse(self, argList, currentID):
 | 
				
			||||||
		return currentID;
 | 
							return currentID;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,34 +0,0 @@
 | 
				
			|||||||
##
 | 
					 | 
				
			||||||
## Java builder
 | 
					 | 
				
			||||||
##
 | 
					 | 
				
			||||||
from lutin import multiprocess
 | 
					 | 
				
			||||||
from lutin import tools
 | 
					 | 
				
			||||||
from lutin import debug
 | 
					 | 
				
			||||||
from lutin import depend
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
##
 | 
					 | 
				
			||||||
## Initialize the builder, if needed ... to get dependency between builder (for example)
 | 
					 | 
				
			||||||
##
 | 
					 | 
				
			||||||
def init():
 | 
					 | 
				
			||||||
	pass
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
##
 | 
					 | 
				
			||||||
## Get the current builder type.
 | 
					 | 
				
			||||||
## Return the type of builder
 | 
					 | 
				
			||||||
##
 | 
					 | 
				
			||||||
def get_type():
 | 
					 | 
				
			||||||
	return "compiler"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
##
 | 
					 | 
				
			||||||
## @brief Get builder input file type
 | 
					 | 
				
			||||||
## @return List of extention supported
 | 
					 | 
				
			||||||
##
 | 
					 | 
				
			||||||
def get_input_type():
 | 
					 | 
				
			||||||
	return ["java"]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
##
 | 
					 | 
				
			||||||
## @brief Get builder output file type
 | 
					 | 
				
			||||||
## @return List of extention supported
 | 
					 | 
				
			||||||
##
 | 
					 | 
				
			||||||
def get_output_type():
 | 
					 | 
				
			||||||
	return ["class"]
 | 
					 | 
				
			||||||
@@ -139,3 +139,21 @@ def print_compilator(myString):
 | 
				
			|||||||
	debugLock.acquire()
 | 
						debugLock.acquire()
 | 
				
			||||||
	print(myString)
 | 
						print(myString)
 | 
				
			||||||
	debugLock.release()
 | 
						debugLock.release()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def get_color_set() :
 | 
				
			||||||
 | 
						global color_default
 | 
				
			||||||
 | 
						global color_red
 | 
				
			||||||
 | 
						global color_green
 | 
				
			||||||
 | 
						global color_yellow
 | 
				
			||||||
 | 
						global color_blue
 | 
				
			||||||
 | 
						global color_purple
 | 
				
			||||||
 | 
						global color_cyan
 | 
				
			||||||
 | 
						return {
 | 
				
			||||||
 | 
						    "default": color_default,
 | 
				
			||||||
 | 
						    "red": color_red,
 | 
				
			||||||
 | 
						    "green": color_green,
 | 
				
			||||||
 | 
						    "yellow": color_yellow,
 | 
				
			||||||
 | 
						    "blue": color_blue,
 | 
				
			||||||
 | 
						    "purple": color_purple,
 | 
				
			||||||
 | 
						    "cyan": color_cyan,
 | 
				
			||||||
 | 
						    }
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										74
									
								
								lutin/env.py
									
									
									
									
									
								
							
							
						
						
									
										74
									
								
								lutin/env.py
									
									
									
									
									
								
							@@ -39,44 +39,66 @@ def get_print_pretty_mode():
 | 
				
			|||||||
	global printPrettyMode
 | 
						global printPrettyMode
 | 
				
			||||||
	return printPrettyMode
 | 
						return printPrettyMode
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def end_with(name, list):
 | 
				
			||||||
 | 
						for appl in list:
 | 
				
			||||||
 | 
							#debug.info("pppppppp : " + str([name[-len(appl):], appl]))
 | 
				
			||||||
 | 
							if name[-len(appl):] == appl:
 | 
				
			||||||
 | 
								return True
 | 
				
			||||||
 | 
						return False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def print_pretty(myString, force=False):
 | 
					def print_pretty(myString, force=False):
 | 
				
			||||||
	global printPrettyMode
 | 
						global printPrettyMode
 | 
				
			||||||
	if    printPrettyMode == True \
 | 
						if    printPrettyMode == True \
 | 
				
			||||||
	   or force == True:
 | 
						   or force == True:
 | 
				
			||||||
		if myString[len(myString)-1]==' ' : 
 | 
							if myString[len(myString)-1] == ' ':
 | 
				
			||||||
			tmpcmdLine = myString[:len(myString)-1]
 | 
								tmpcmdLine = myString[:len(myString)-1]
 | 
				
			||||||
		else :
 | 
							else:
 | 
				
			||||||
			tmpcmdLine = myString
 | 
								tmpcmdLine = myString
 | 
				
			||||||
 | 
							cmdApplication = tmpcmdLine.split(' ')[0]
 | 
				
			||||||
		tmpcmdLine = tmpcmdLine.replace(' ', '\n\t')
 | 
							tmpcmdLine = tmpcmdLine.replace(' ', '\n\t')
 | 
				
			||||||
		tmpcmdLine = tmpcmdLine.replace('\n\t\n\t', '\n\t')
 | 
							tmpcmdLine = tmpcmdLine.replace('\n\t\n\t', '\n\t')
 | 
				
			||||||
		tmpcmdLine = tmpcmdLine.replace('\n\t\n\t', '\n\t')
 | 
							tmpcmdLine = tmpcmdLine.replace('\n\t\n\t', '\n\t')
 | 
				
			||||||
		tmpcmdLine = tmpcmdLine.replace('\n\t\n\t', '\n\t')
 | 
							tmpcmdLine = tmpcmdLine.replace('\n\t\n\t', '\n\t')
 | 
				
			||||||
		baseElementList = ["-o",
 | 
							baseElementList = []
 | 
				
			||||||
		                   "-D",
 | 
							if end_with(cmdApplication, ["javac"]) == True:
 | 
				
			||||||
		                   "-I",
 | 
								baseElementList = [
 | 
				
			||||||
		                   "-L",
 | 
									"-d",
 | 
				
			||||||
		                   "g++",
 | 
									"-D",
 | 
				
			||||||
		                   "gcc",
 | 
									"-classpath",
 | 
				
			||||||
		                   "clang",
 | 
									"-sourcepath"
 | 
				
			||||||
		                   "clang++",
 | 
									]
 | 
				
			||||||
		                   "ar",
 | 
							elif end_with(cmdApplication, ["jar"]) == True:
 | 
				
			||||||
		                   "ld",
 | 
								baseElementList = [
 | 
				
			||||||
		                   "ranlib",
 | 
									"cf",
 | 
				
			||||||
		                   "-framework",
 | 
									"-C"
 | 
				
			||||||
		                   "-isysroot",
 | 
									]
 | 
				
			||||||
		                   "-arch",
 | 
							elif end_with(cmdApplication, ["aapt"]) == True:
 | 
				
			||||||
		                   "-keystore",
 | 
								baseElementList = [
 | 
				
			||||||
		                   "-sigalg",
 | 
									"-M",
 | 
				
			||||||
		                   "-digestalg",
 | 
									"-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"]
 | 
				
			||||||
		for element in baseElementList:
 | 
							for element in baseElementList:
 | 
				
			||||||
			tmpcmdLine = tmpcmdLine.replace(element+'\n\t', element+' ')
 | 
								tmpcmdLine = tmpcmdLine.replace(element+'\n\t', element+' ')
 | 
				
			||||||
		baseElementList = ["g++", "gcc", "clang", "clang++", "ar", "ld", "ranlib"]
 | 
							for element in ["<", "<<", ">", ">>"]:
 | 
				
			||||||
		for element in baseElementList:
 | 
								tmpcmdLine = tmpcmdLine.replace(element+'\n\t', element+' ')
 | 
				
			||||||
			tmpcmdLine = tmpcmdLine.replace('/'+element+' ', '/'+element+'\n\t')
 | 
					 | 
				
			||||||
		tmpcmdLine = tmpcmdLine.replace('\n\t', ' \\\n\t')
 | 
							tmpcmdLine = tmpcmdLine.replace('\n\t', ' \\\n\t')
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		return tmpcmdLine
 | 
							return tmpcmdLine
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -29,7 +29,7 @@ class HeritageList:
 | 
				
			|||||||
		self.flags={}
 | 
							self.flags={}
 | 
				
			||||||
		# sources list:
 | 
							# sources list:
 | 
				
			||||||
		self.src=[]
 | 
							self.src=[]
 | 
				
			||||||
		self.path=[]
 | 
							self.path={}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		self.listHeritage=[]
 | 
							self.listHeritage=[]
 | 
				
			||||||
		if heritage != None:
 | 
							if heritage != None:
 | 
				
			||||||
@@ -61,7 +61,7 @@ class HeritageList:
 | 
				
			|||||||
		self.flags={}
 | 
							self.flags={}
 | 
				
			||||||
		# sources list:
 | 
							# sources list:
 | 
				
			||||||
		self.src=[]
 | 
							self.src=[]
 | 
				
			||||||
		self.path=[]
 | 
							self.path={}
 | 
				
			||||||
		# reorder heritage list :
 | 
							# reorder heritage list :
 | 
				
			||||||
		listHeritage = self.listHeritage
 | 
							listHeritage = self.listHeritage
 | 
				
			||||||
		self.listHeritage = []
 | 
							self.listHeritage = []
 | 
				
			||||||
@@ -99,7 +99,12 @@ class HeritageList:
 | 
				
			|||||||
					self.flags[flags] = value
 | 
										self.flags[flags] = value
 | 
				
			||||||
				else:
 | 
									else:
 | 
				
			||||||
					append_to_list(self.flags[flags], value)
 | 
										append_to_list(self.flags[flags], value)
 | 
				
			||||||
			append_to_list(self.path, element.path)
 | 
								for ppp in element.path:
 | 
				
			||||||
 | 
									value = element.path[ppp]
 | 
				
			||||||
 | 
									if ppp not in self.path:
 | 
				
			||||||
 | 
										self.path[ppp] = value
 | 
				
			||||||
 | 
									else:
 | 
				
			||||||
 | 
										append_to_list(self.path[ppp], value)
 | 
				
			||||||
			append_to_list(self.src, element.src)
 | 
								append_to_list(self.src, element.src)
 | 
				
			||||||
			if "c-version" in element.flags:
 | 
								if "c-version" in element.flags:
 | 
				
			||||||
				ver = element.flags["c-version"]
 | 
									ver = element.flags["c-version"]
 | 
				
			||||||
@@ -124,7 +129,7 @@ class heritage:
 | 
				
			|||||||
		self.flags={}
 | 
							self.flags={}
 | 
				
			||||||
		# sources list:
 | 
							# sources list:
 | 
				
			||||||
		self.src=[]
 | 
							self.src=[]
 | 
				
			||||||
		self.path=[]
 | 
							self.path={}
 | 
				
			||||||
		# update is set at true when data are newly created ==> force upper element to update
 | 
							# update is set at true when data are newly created ==> force upper element to update
 | 
				
			||||||
		self.hasBeenUpdated=False
 | 
							self.hasBeenUpdated=False
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
@@ -143,6 +148,8 @@ class heritage:
 | 
				
			|||||||
		append_to_list(self.path, list)
 | 
							append_to_list(self.path, list)
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	def add_sources(self, list):
 | 
						def add_sources(self, list):
 | 
				
			||||||
 | 
							if type(list) == type(None):
 | 
				
			||||||
 | 
								debug.error("try add element none in a list ...")
 | 
				
			||||||
		append_to_list(self.src, list)
 | 
							append_to_list(self.src, list)
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	def need_update(self, list):
 | 
						def need_update(self, list):
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										294
									
								
								lutin/module.py
									
									
									
									
									
								
							
							
						
						
									
										294
									
								
								lutin/module.py
									
									
									
									
									
								
							@@ -47,27 +47,13 @@ class Module:
 | 
				
			|||||||
		# Documentation list:
 | 
							# Documentation list:
 | 
				
			||||||
		self.documentation = None
 | 
							self.documentation = None
 | 
				
			||||||
		# export PATH
 | 
							# export PATH
 | 
				
			||||||
		self.path = {"export":[],
 | 
							self.path = {"export":{},
 | 
				
			||||||
		             "local":[]
 | 
							             "local":{}
 | 
				
			||||||
		            }
 | 
							            }
 | 
				
			||||||
		self.flags = {"export":{},
 | 
							self.flags = {"export":{},
 | 
				
			||||||
		              "local":{}
 | 
							              "local":{}
 | 
				
			||||||
		             }
 | 
							             }
 | 
				
			||||||
		"""
 | 
							self.extention_order_build = ["java", "javah"] # all is not set here is done in the provided order ...
 | 
				
			||||||
		self.export_flags_ld = []
 | 
					 | 
				
			||||||
		self.export_flags_cc = []
 | 
					 | 
				
			||||||
		self.export_flags_xx = []
 | 
					 | 
				
			||||||
		self.export_flags_m = []
 | 
					 | 
				
			||||||
		self.export_flags_mm = []
 | 
					 | 
				
			||||||
		# list of all flags:
 | 
					 | 
				
			||||||
		self.flags_ld = []
 | 
					 | 
				
			||||||
		self.flags_cc = []
 | 
					 | 
				
			||||||
		self.flags_xx = []
 | 
					 | 
				
			||||||
		self.flags_m = []
 | 
					 | 
				
			||||||
		self.flags_mm = []
 | 
					 | 
				
			||||||
		self.flags_s = []
 | 
					 | 
				
			||||||
		self.flags_ar = []
 | 
					 | 
				
			||||||
		"""
 | 
					 | 
				
			||||||
		# sources list:
 | 
							# sources list:
 | 
				
			||||||
		self.src = []
 | 
							self.src = []
 | 
				
			||||||
		# copy files and folders:
 | 
							# copy files and folders:
 | 
				
			||||||
@@ -102,7 +88,6 @@ class Module:
 | 
				
			|||||||
		                      "VERSION_CODE" : "",
 | 
							                      "VERSION_CODE" : "",
 | 
				
			||||||
		                      "NAME" : set("no-name"), # name of the application
 | 
							                      "NAME" : set("no-name"), # name of the application
 | 
				
			||||||
		                      "ANDROID_MANIFEST" : "", # By default generate the manifest
 | 
							                      "ANDROID_MANIFEST" : "", # By default generate the manifest
 | 
				
			||||||
		                      "ANDROID_JAVA_FILES" : ["DEFAULT"], # when user want to create his own services and activities
 | 
					 | 
				
			||||||
		                      "ANDROID_RESOURCES" : [],
 | 
							                      "ANDROID_RESOURCES" : [],
 | 
				
			||||||
		                      "ANDROID_APPL_TYPE" : "APPL", # the other mode is "WALLPAPER" ... and later "WIDGET"
 | 
							                      "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)
 | 
							                      "ANDROID_WALLPAPER_PROPERTIES" : [], # To create properties of the wallpaper (no use of EWOL display)
 | 
				
			||||||
@@ -185,6 +170,109 @@ class Module:
 | 
				
			|||||||
			debug.debug("Might copy folder : " + source + "==>" + destination)
 | 
								debug.debug("Might copy folder : " + source + "==>" + destination)
 | 
				
			||||||
			tools.copy_anything_target(target, self.origin_folder + "/" + source, destination)
 | 
								tools.copy_anything_target(target, self.origin_folder + "/" + source, destination)
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 | 
						def gcov(self, target, generate_output=False):
 | 
				
			||||||
 | 
							if self.type == 'PREBUILD':
 | 
				
			||||||
 | 
								debug.error("Can not generate gcov on prebuid system ... : '" + self.name + "'");
 | 
				
			||||||
 | 
								return
 | 
				
			||||||
 | 
							# remove uncompilable elements:
 | 
				
			||||||
 | 
							list_file = tools.filter_extention(self.src, self.extention_order_build, True)
 | 
				
			||||||
 | 
							global_list_file = ""
 | 
				
			||||||
 | 
							for file in list_file:
 | 
				
			||||||
 | 
								debug.verbose(" gcov : " + self.name + " <== " + file);
 | 
				
			||||||
 | 
								file_dst = target.get_full_name_destination(self.name, self.origin_folder, file, "o")
 | 
				
			||||||
 | 
								global_list_file += file_dst + " "
 | 
				
			||||||
 | 
							cmd = "gcov"
 | 
				
			||||||
 | 
							# specify the version of gcov we need to use
 | 
				
			||||||
 | 
							if target.config["compilator-version"] != "":
 | 
				
			||||||
 | 
								cmd += "-" + target.config["compilator-version"] + " "
 | 
				
			||||||
 | 
							cmd += " --branch-counts --preserve-paths "
 | 
				
			||||||
 | 
							if generate_output == False:
 | 
				
			||||||
 | 
								cmd += "--no-output "
 | 
				
			||||||
 | 
							cmd += global_list_file
 | 
				
			||||||
 | 
							debug.extreme_verbose("      " + cmd);
 | 
				
			||||||
 | 
							ret = multiprocess.run_command_direct(cmd)
 | 
				
			||||||
 | 
							# parsing ret :
 | 
				
			||||||
 | 
							debug.extreme_verbose("result: " + str(ret));
 | 
				
			||||||
 | 
							ret = ret.split('\n');
 | 
				
			||||||
 | 
							debug.verbose("*** Gcov result parsing ...");
 | 
				
			||||||
 | 
							useful_list = []
 | 
				
			||||||
 | 
							remove_next = False
 | 
				
			||||||
 | 
							last_file = ""
 | 
				
			||||||
 | 
							executed_lines = 0
 | 
				
			||||||
 | 
							executable_lines = 0
 | 
				
			||||||
 | 
							for elem in ret:
 | 
				
			||||||
 | 
								if remove_next == True:
 | 
				
			||||||
 | 
									remove_next = False
 | 
				
			||||||
 | 
									continue;
 | 
				
			||||||
 | 
								if    elem[:10] == "Creating '" \
 | 
				
			||||||
 | 
								   or elem[:10] == "Removing '":
 | 
				
			||||||
 | 
									remove_next = True
 | 
				
			||||||
 | 
									continue
 | 
				
			||||||
 | 
								if     elem[:6] == "File '" \
 | 
				
			||||||
 | 
								   and self.origin_folder != elem[6:len(self.origin_folder)+6]:
 | 
				
			||||||
 | 
									remove_next = True
 | 
				
			||||||
 | 
									continue
 | 
				
			||||||
 | 
								if elem[:6] == "File '":
 | 
				
			||||||
 | 
									last_file = elem[6+len(self.origin_folder)+1:-1]
 | 
				
			||||||
 | 
									continue
 | 
				
			||||||
 | 
								start_with = "Lines executed:"
 | 
				
			||||||
 | 
								if elem[:len(start_with)] != start_with:
 | 
				
			||||||
 | 
									debug.warning("    gcov ret : " + str(elem));
 | 
				
			||||||
 | 
									debug.warning("         ==> does not start with : " + start_with);
 | 
				
			||||||
 | 
									debug.warning("         Parsing error");
 | 
				
			||||||
 | 
									continue
 | 
				
			||||||
 | 
								out = elem[len(start_with):].split("% of ")
 | 
				
			||||||
 | 
								if len(out) != 2:
 | 
				
			||||||
 | 
									debug.warning("    gcov ret : " + str(elem));
 | 
				
			||||||
 | 
									debug.warning("         Parsing error of '% of '");
 | 
				
			||||||
 | 
									continue
 | 
				
			||||||
 | 
								pourcent = float(out[0])
 | 
				
			||||||
 | 
								total_line_count = int(out[1])
 | 
				
			||||||
 | 
								total_executed_line = int(float(total_line_count)*pourcent/100.0)
 | 
				
			||||||
 | 
								useful_list.append([last_file, pourcent, total_executed_line, total_line_count])
 | 
				
			||||||
 | 
								executed_lines += total_executed_line
 | 
				
			||||||
 | 
								executable_lines += total_line_count
 | 
				
			||||||
 | 
								last_file = ""
 | 
				
			||||||
 | 
							ret = useful_list[:-1]
 | 
				
			||||||
 | 
							#for elem in ret:
 | 
				
			||||||
 | 
							#	debug.info("    " + str(elem));
 | 
				
			||||||
 | 
							for elem in ret:
 | 
				
			||||||
 | 
								if elem[1]<10.0:
 | 
				
			||||||
 | 
									debug.info("   %   " + str(elem[1]) + "\r\t\t" + str(elem[0]));
 | 
				
			||||||
 | 
								elif elem[1]<100.0:
 | 
				
			||||||
 | 
									debug.info("   %  " + str(elem[1]) + "\r\t\t" + str(elem[0]));
 | 
				
			||||||
 | 
								else:
 | 
				
			||||||
 | 
									debug.info("   % " + str(elem[1]) + "\r\t\t" + str(elem[0]));
 | 
				
			||||||
 | 
							pourcent = 100.0*float(executed_lines)/float(executable_lines)
 | 
				
			||||||
 | 
							# generate json file:
 | 
				
			||||||
 | 
							json_file_name = target.get_build_folder(self.name) + "/" + self.name + "_coverage.json"
 | 
				
			||||||
 | 
							debug.debug("generate json file : " + json_file_name)
 | 
				
			||||||
 | 
							tmp_file = open(json_file_name, 'w')
 | 
				
			||||||
 | 
							tmp_file.write('{\n')
 | 
				
			||||||
 | 
							tmp_file.write('	"lib-name":"' + self.name + '",\n')
 | 
				
			||||||
 | 
							#tmp_file.write('	"coverage":"' + str(pourcent) + '",\n')
 | 
				
			||||||
 | 
							tmp_file.write('	"executed":"' + str(executed_lines) + '",\n')
 | 
				
			||||||
 | 
							tmp_file.write('	"executable":"' + str(executable_lines) + '",\n')
 | 
				
			||||||
 | 
							tmp_file.write('	"list":[\n')
 | 
				
			||||||
 | 
							val = 0
 | 
				
			||||||
 | 
							for elem in ret:
 | 
				
			||||||
 | 
								if val == 0 :
 | 
				
			||||||
 | 
									tmp_file.write('		{\n')
 | 
				
			||||||
 | 
								else:
 | 
				
			||||||
 | 
									tmp_file.write('		}, {\n')
 | 
				
			||||||
 | 
								val += 1
 | 
				
			||||||
 | 
								tmp_file.write('			"file":"' + elem[0] + '",\n')
 | 
				
			||||||
 | 
								#tmp_file.write('			"coverage":' + str(elem[1]) + ',\n')
 | 
				
			||||||
 | 
								tmp_file.write('			"executed":' + str(elem[2]) + ',\n')
 | 
				
			||||||
 | 
								tmp_file.write('			"executable":' + str(elem[3]) + '\n')
 | 
				
			||||||
 | 
							tmp_file.write('		}\n')
 | 
				
			||||||
 | 
							tmp_file.write('	]\n')
 | 
				
			||||||
 | 
							tmp_file.write('}\n')
 | 
				
			||||||
 | 
							tmp_file.flush()
 | 
				
			||||||
 | 
							tmp_file.close()
 | 
				
			||||||
 | 
							# print debug:
 | 
				
			||||||
 | 
							debug.print_element("coverage", self.name, ":", str(pourcent) + "%  " + str(executed_lines) + "/" + str(executable_lines))
 | 
				
			||||||
 | 
						
 | 
				
			||||||
	# call here to build the module
 | 
						# call here to build the module
 | 
				
			||||||
	def build(self, target, package_name):
 | 
						def build(self, target, package_name):
 | 
				
			||||||
		# ckeck if not previously build
 | 
							# ckeck if not previously build
 | 
				
			||||||
@@ -203,13 +291,12 @@ class Module:
 | 
				
			|||||||
		else :
 | 
							else :
 | 
				
			||||||
			# TODO : Set it better ...
 | 
								# TODO : Set it better ...
 | 
				
			||||||
			None
 | 
								None
 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		# build dependency before
 | 
							# build dependency before
 | 
				
			||||||
		list_sub_file_needed_to_build = []
 | 
							list_sub_file_needed_to_build = []
 | 
				
			||||||
		self.sub_heritage_list = heritage.HeritageList()
 | 
							self.sub_heritage_list = heritage.HeritageList()
 | 
				
			||||||
		# optionnal dependency :
 | 
							# optionnal dependency :
 | 
				
			||||||
		for dep, option, export in self.depends_optionnal:
 | 
							for dep, option, export in self.depends_optionnal:
 | 
				
			||||||
			inherit_list, isBuilt = target.build_optionnal(dep, package_name)
 | 
								inherit_list, isBuilt = target.build(dep, package_name, True)
 | 
				
			||||||
			if isBuilt == True:
 | 
								if isBuilt == True:
 | 
				
			||||||
				self.local_heritage.add_depends(dep);
 | 
									self.local_heritage.add_depends(dep);
 | 
				
			||||||
				# TODO : Add optionnal Flags ...
 | 
									# TODO : Add optionnal Flags ...
 | 
				
			||||||
@@ -221,46 +308,100 @@ class Module:
 | 
				
			|||||||
			# add at the heritage list :
 | 
								# add at the heritage list :
 | 
				
			||||||
			self.sub_heritage_list.add_heritage_list(inherit_list)
 | 
								self.sub_heritage_list.add_heritage_list(inherit_list)
 | 
				
			||||||
		for dep in self.depends:
 | 
							for dep in self.depends:
 | 
				
			||||||
			inherit_list = target.build(dep, package_name)
 | 
								debug.debug("module: '" + str(self.name) + "'   request: '" + dep + "'")
 | 
				
			||||||
 | 
								inherit_list = target.build(dep, package_name, False)
 | 
				
			||||||
			# add at the heritage list :
 | 
								# add at the heritage list :
 | 
				
			||||||
			self.sub_heritage_list.add_heritage_list(inherit_list)
 | 
								self.sub_heritage_list.add_heritage_list(inherit_list)
 | 
				
			||||||
 | 
							# do sub library action for automatic generating ...
 | 
				
			||||||
 | 
							if self.type in target.action_on_state:
 | 
				
			||||||
 | 
								for lvl in range(0,100):
 | 
				
			||||||
 | 
									for level, action_name, action in target.action_on_state[self.type]:
 | 
				
			||||||
 | 
										if level == lvl:
 | 
				
			||||||
 | 
											debug.debug("level=" + str(level) + " Do Action : " + action_name)
 | 
				
			||||||
 | 
											elem = action(target, self, package_name);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		# build local sources
 | 
							if self.type != 'PREBUILD':
 | 
				
			||||||
		for file in self.src:
 | 
								# build local sources in a specific order :
 | 
				
			||||||
			#debug.info(" " + self.name + " <== " + file);
 | 
								for extention_local in self.extention_order_build:
 | 
				
			||||||
			fileExt = file.split(".")[-1]
 | 
									list_file = tools.filter_extention(self.src, [extention_local])
 | 
				
			||||||
			try:
 | 
									for file in list_file:
 | 
				
			||||||
				tmp_builder = builder.get_builder(fileExt);
 | 
										#debug.info(" " + self.name + " <== " + file);
 | 
				
			||||||
				resFile = tmp_builder.compile(file,
 | 
										fileExt = file.split(".")[-1]
 | 
				
			||||||
				                             package_name,
 | 
										try:
 | 
				
			||||||
				                             target,
 | 
											tmp_builder = builder.get_builder(fileExt);
 | 
				
			||||||
				                             self.sub_heritage_list,
 | 
											resFile = tmp_builder.compile(file,
 | 
				
			||||||
				                             flags = self.flags,
 | 
											                             package_name,
 | 
				
			||||||
				                             path = self.path,
 | 
											                             target,
 | 
				
			||||||
				                             name = self.name,
 | 
											                             self.sub_heritage_list,
 | 
				
			||||||
				                             basic_folder = self.origin_folder)
 | 
											                             flags = self.flags,
 | 
				
			||||||
				list_sub_file_needed_to_build.append(resFile)
 | 
											                             path = self.path,
 | 
				
			||||||
			except ValueError:
 | 
											                             name = self.name,
 | 
				
			||||||
				debug.warning(" UN-SUPPORTED file format:  '" + self.origin_folder + "/" + file + "'")
 | 
											                             basic_folder = self.origin_folder)
 | 
				
			||||||
		
 | 
											if resFile["action"] == "add":
 | 
				
			||||||
		# when multiprocess availlable, we need to synchronize here ...
 | 
												list_sub_file_needed_to_build.append(resFile["file"])
 | 
				
			||||||
		multiprocess.pool_synchrosize()
 | 
											elif resFile["action"] == "path":
 | 
				
			||||||
 | 
												self.add_path(resFile["path"], type='c')
 | 
				
			||||||
 | 
											else:
 | 
				
			||||||
 | 
												debug.error("an not do action for : " + str(resFile))
 | 
				
			||||||
 | 
										except ValueError:
 | 
				
			||||||
 | 
											debug.warning(" UN-SUPPORTED file format:  '" + self.origin_folder + "/" + file + "'")
 | 
				
			||||||
 | 
								# now build the other :
 | 
				
			||||||
 | 
								list_file = tools.filter_extention(self.src, self.extention_order_build, invert=True)
 | 
				
			||||||
 | 
								for file in list_file:
 | 
				
			||||||
 | 
									#debug.info(" " + self.name + " <== " + file);
 | 
				
			||||||
 | 
									fileExt = file.split(".")[-1]
 | 
				
			||||||
 | 
									try:
 | 
				
			||||||
 | 
										tmp_builder = builder.get_builder(fileExt);
 | 
				
			||||||
 | 
										resFile = tmp_builder.compile(file,
 | 
				
			||||||
 | 
										                             package_name,
 | 
				
			||||||
 | 
										                             target,
 | 
				
			||||||
 | 
										                             self.sub_heritage_list,
 | 
				
			||||||
 | 
										                             flags = self.flags,
 | 
				
			||||||
 | 
										                             path = self.path,
 | 
				
			||||||
 | 
										                             name = self.name,
 | 
				
			||||||
 | 
										                             basic_folder = self.origin_folder)
 | 
				
			||||||
 | 
										if resFile["action"] == "add":
 | 
				
			||||||
 | 
											list_sub_file_needed_to_build.append(resFile["file"])
 | 
				
			||||||
 | 
										elif resFile["action"] == "path":
 | 
				
			||||||
 | 
											self.add_path(resFile["path"], type='c')
 | 
				
			||||||
 | 
										else:
 | 
				
			||||||
 | 
											debug.error("an not do action for : " + str(resFile))
 | 
				
			||||||
 | 
									except ValueError:
 | 
				
			||||||
 | 
										debug.warning(" UN-SUPPORTED file format:  '" + self.origin_folder + "/" + file + "'")
 | 
				
			||||||
 | 
								# when multiprocess availlable, we need to synchronize here ...
 | 
				
			||||||
 | 
								multiprocess.pool_synchrosize()
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		# generate end point:
 | 
							# generate end point:
 | 
				
			||||||
		if self.type=='PREBUILD':
 | 
							if self.type=='PREBUILD':
 | 
				
			||||||
			debug.print_element("Prebuild", self.name, "==>", "find")
 | 
								debug.print_element("Prebuild", self.name, "==>", "find")
 | 
				
			||||||
 | 
								self.local_heritage.add_sources(self.src)
 | 
				
			||||||
		elif self.type=='LIBRARY':
 | 
							elif self.type=='LIBRARY':
 | 
				
			||||||
			try:
 | 
								try:
 | 
				
			||||||
				tmp_builder = builder.get_builder_with_output("a");
 | 
									tmp_builder = builder.get_builder_with_output("a");
 | 
				
			||||||
				resFile = tmp_builder.link(list_sub_file_needed_to_build,
 | 
									list_file = tools.filter_extention(list_sub_file_needed_to_build, tmp_builder.get_input_type())
 | 
				
			||||||
				                           package_name,
 | 
									if len(list_file) > 0:
 | 
				
			||||||
				                           target,
 | 
										resFile = tmp_builder.link(list_file,
 | 
				
			||||||
				                           self.sub_heritage_list,
 | 
										                           package_name,
 | 
				
			||||||
				                           name = self.name,
 | 
										                           target,
 | 
				
			||||||
				                           basic_folder = self.origin_folder)
 | 
										                           self.sub_heritage_list,
 | 
				
			||||||
				self.local_heritage.add_sources(resFile)
 | 
										                           name = self.name,
 | 
				
			||||||
 | 
										                           basic_folder = self.origin_folder)
 | 
				
			||||||
 | 
										self.local_heritage.add_sources(resFile)
 | 
				
			||||||
			except ValueError:
 | 
								except ValueError:
 | 
				
			||||||
				debug.error(" UN-SUPPORTED link format:  '.a'")
 | 
									debug.error(" UN-SUPPORTED link format:  '.a'")
 | 
				
			||||||
 | 
								try:
 | 
				
			||||||
 | 
									tmp_builder = builder.get_builder_with_output("jar");
 | 
				
			||||||
 | 
									list_file = tools.filter_extention(list_sub_file_needed_to_build, tmp_builder.get_input_type())
 | 
				
			||||||
 | 
									if len(list_file) > 0:
 | 
				
			||||||
 | 
										resFile = tmp_builder.link(list_file,
 | 
				
			||||||
 | 
										                           package_name,
 | 
				
			||||||
 | 
										                           target,
 | 
				
			||||||
 | 
										                           self.sub_heritage_list,
 | 
				
			||||||
 | 
										                           name = self.name,
 | 
				
			||||||
 | 
										                           basic_folder = self.origin_folder)
 | 
				
			||||||
 | 
										self.local_heritage.add_sources(resFile)
 | 
				
			||||||
 | 
								except ValueError:
 | 
				
			||||||
 | 
									debug.error(" UN-SUPPORTED link format:  '.jar'")
 | 
				
			||||||
		elif self.type=='BINARY':
 | 
							elif self.type=='BINARY':
 | 
				
			||||||
			try:
 | 
								try:
 | 
				
			||||||
				tmp_builder = builder.get_builder_with_output("bin");
 | 
									tmp_builder = builder.get_builder_with_output("bin");
 | 
				
			||||||
@@ -278,17 +419,32 @@ class Module:
 | 
				
			|||||||
			target.copy_to_staging(self.name)
 | 
								target.copy_to_staging(self.name)
 | 
				
			||||||
		elif self.type=="PACKAGE":
 | 
							elif self.type=="PACKAGE":
 | 
				
			||||||
			if target.name=="Android":
 | 
								if target.name=="Android":
 | 
				
			||||||
				# special case for android wrapper :
 | 
									# special case for android wrapper:
 | 
				
			||||||
				try:
 | 
									try:
 | 
				
			||||||
					tmp_builder = builder.get_builder_with_output("so");
 | 
										tmp_builder = builder.get_builder_with_output("so");
 | 
				
			||||||
					resFile = tmp_builder.link(list_sub_file_needed_to_build,
 | 
										list_file = tools.filter_extention(list_sub_file_needed_to_build, tmp_builder.get_input_type())
 | 
				
			||||||
 | 
										resFile = tmp_builder.link(list_file,
 | 
				
			||||||
					                           package_name,
 | 
										                           package_name,
 | 
				
			||||||
					                           target,
 | 
										                           target,
 | 
				
			||||||
					                           self.sub_heritage_list,
 | 
										                           self.sub_heritage_list,
 | 
				
			||||||
					                           name = "libewol",
 | 
										                           name = "lib" + self.name,
 | 
				
			||||||
					                           basic_folder = self.origin_folder)
 | 
										                           basic_folder = self.origin_folder)
 | 
				
			||||||
 | 
										self.local_heritage.add_sources(resFile)
 | 
				
			||||||
				except ValueError:
 | 
									except ValueError:
 | 
				
			||||||
					debug.error(" UN-SUPPORTED link format:  '.so'")
 | 
										debug.error(" UN-SUPPORTED link format:  '.so'")
 | 
				
			||||||
 | 
									try:
 | 
				
			||||||
 | 
										tmp_builder = builder.get_builder_with_output("jar");
 | 
				
			||||||
 | 
										list_file = tools.filter_extention(list_sub_file_needed_to_build, tmp_builder.get_input_type())
 | 
				
			||||||
 | 
										if len(list_file) > 0:
 | 
				
			||||||
 | 
											resFile = tmp_builder.link(list_file,
 | 
				
			||||||
 | 
											                           package_name,
 | 
				
			||||||
 | 
											                           target,
 | 
				
			||||||
 | 
											                           self.sub_heritage_list,
 | 
				
			||||||
 | 
											                           name = self.name,
 | 
				
			||||||
 | 
											                           basic_folder = self.origin_folder)
 | 
				
			||||||
 | 
											self.local_heritage.add_sources(resFile)
 | 
				
			||||||
 | 
									except ValueError:
 | 
				
			||||||
 | 
										debug.error(" UN-SUPPORTED link format:  '.jar'")
 | 
				
			||||||
			else:
 | 
								else:
 | 
				
			||||||
				try:
 | 
									try:
 | 
				
			||||||
					tmp_builder = builder.get_builder_with_output("bin");
 | 
										tmp_builder = builder.get_builder_with_output("bin");
 | 
				
			||||||
@@ -306,7 +462,11 @@ class Module:
 | 
				
			|||||||
			target.copy_to_staging(self.name)
 | 
								target.copy_to_staging(self.name)
 | 
				
			||||||
			if target.endGeneratePackage==True:
 | 
								if target.endGeneratePackage==True:
 | 
				
			||||||
				# generate the package with his properties ...
 | 
									# generate the package with his properties ...
 | 
				
			||||||
				target.make_package(self.name, self.package_prop, self.origin_folder + "/..")
 | 
									if target.name=="Android":
 | 
				
			||||||
 | 
										self.sub_heritage_list.add_heritage(self.local_heritage)
 | 
				
			||||||
 | 
										target.make_package(self.name, self.package_prop, self.origin_folder + "/..", self.sub_heritage_list)
 | 
				
			||||||
 | 
									else:
 | 
				
			||||||
 | 
										target.make_package(self.name, self.package_prop, self.origin_folder + "/..")
 | 
				
			||||||
		else:
 | 
							else:
 | 
				
			||||||
			debug.error("Dit not know the element type ... (impossible case) type=" + self.type)
 | 
								debug.error("Dit not know the element type ... (impossible case) type=" + self.type)
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
@@ -380,11 +540,11 @@ class Module:
 | 
				
			|||||||
	def add_optionnal_module_depend(self, module_name, compilation_flags=["", ""], export=False):
 | 
						def add_optionnal_module_depend(self, module_name, compilation_flags=["", ""], export=False):
 | 
				
			||||||
		self.append_and_check(self.depends_optionnal, [module_name, compilation_flags, export], True)
 | 
							self.append_and_check(self.depends_optionnal, [module_name, compilation_flags, export], True)
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	def add_export_path(self, list):
 | 
						def add_export_path(self, list, type='c'):
 | 
				
			||||||
		self.append_to_internalList(self.path["export"], list)
 | 
							self.append_to_internalList2(self.path["export"], type, list)
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	def add_path(self, list):
 | 
						def add_path(self, list, type='c'):
 | 
				
			||||||
		self.append_to_internalList(self.path["local"], list)
 | 
							self.append_to_internalList2(self.path["local"], type, list)
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	def add_export_flag(self, type, list):
 | 
						def add_export_flag(self, type, list):
 | 
				
			||||||
		self.append_to_internalList2(self.flags["export"], type, list)
 | 
							self.append_to_internalList2(self.flags["export"], type, list)
 | 
				
			||||||
@@ -452,17 +612,25 @@ class Module:
 | 
				
			|||||||
		self.print_list('depends',self.depends)
 | 
							self.print_list('depends',self.depends)
 | 
				
			||||||
		self.print_list('depends_optionnal', self.depends_optionnal)
 | 
							self.print_list('depends_optionnal', self.depends_optionnal)
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		for element,value in self.flags["local"]:
 | 
							for element in self.flags["local"]:
 | 
				
			||||||
 | 
								value = self.flags["local"][element]
 | 
				
			||||||
			self.print_list('flags ' + element, value)
 | 
								self.print_list('flags ' + element, value)
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		for element,value in self.flags["export"]:
 | 
							for element in self.flags["export"]:
 | 
				
			||||||
 | 
								value = self.flags["export"][element]
 | 
				
			||||||
			self.print_list('flags export ' + element, value)
 | 
								self.print_list('flags export ' + element, value)
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		self.print_list('src',self.src)
 | 
							self.print_list('src',self.src)
 | 
				
			||||||
		self.print_list('files',self.files)
 | 
							self.print_list('files',self.files)
 | 
				
			||||||
		self.print_list('folders',self.folders)
 | 
							self.print_list('folders',self.folders)
 | 
				
			||||||
		self.print_list('export path',self.path["export"])
 | 
							for element in self.path["local"]:
 | 
				
			||||||
		self.print_list('local  path',self.path["local"])
 | 
								value = self.path["local"][element]
 | 
				
			||||||
 | 
								self.print_list('local path ' + element, value)
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							for element in self.path["export"]:
 | 
				
			||||||
 | 
								value = self.path["export"][element]
 | 
				
			||||||
 | 
								self.print_list('export path ' + element, value)
 | 
				
			||||||
 | 
							
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	def pkg_set(self, variable, value):
 | 
						def pkg_set(self, variable, value):
 | 
				
			||||||
		if "COMPAGNY_TYPE" == variable:
 | 
							if "COMPAGNY_TYPE" == variable:
 | 
				
			||||||
@@ -539,8 +707,10 @@ class Module:
 | 
				
			|||||||
			debug.error("not know pkg element : '" + variable + "'")
 | 
								debug.error("not know pkg element : '" + variable + "'")
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	def pkg_add(self, variable, value):
 | 
						def pkg_add(self, variable, value):
 | 
				
			||||||
		# TODO : Check values...
 | 
							if variable in self.package_prop:
 | 
				
			||||||
		self.package_prop[variable].append(value)
 | 
								self.package_prop[variable].append(value)
 | 
				
			||||||
 | 
							else:
 | 
				
			||||||
 | 
								self.package_prop[variable] = [value]
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	def ext_project_add_module(self, target, projectMng, added_module = []):
 | 
						def ext_project_add_module(self, target, projectMng, added_module = []):
 | 
				
			||||||
		if self.name in added_module:
 | 
							if self.name in added_module:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -66,6 +66,8 @@ def run_command_direct(cmdLine):
 | 
				
			|||||||
		p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
 | 
							p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
 | 
				
			||||||
	except subprocess.CalledProcessError as e:
 | 
						except subprocess.CalledProcessError as e:
 | 
				
			||||||
		debug.error("subprocess.CalledProcessError : " + str(args))
 | 
							debug.error("subprocess.CalledProcessError : " + str(args))
 | 
				
			||||||
 | 
						except:
 | 
				
			||||||
 | 
							debug.error("Exception on : " + str(args))
 | 
				
			||||||
	# launch the subprocess:
 | 
						# launch the subprocess:
 | 
				
			||||||
	output, err = p.communicate()
 | 
						output, err = p.communicate()
 | 
				
			||||||
	if sys.version_info >= (3, 0):
 | 
						if sys.version_info >= (3, 0):
 | 
				
			||||||
@@ -92,6 +94,8 @@ def run_command(cmdLine, storeCmdLine="", buildId=-1, file=""):
 | 
				
			|||||||
		p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
 | 
							p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
 | 
				
			||||||
	except subprocess.CalledProcessError as e:
 | 
						except subprocess.CalledProcessError as e:
 | 
				
			||||||
		debug.error("subprocess.CalledProcessError : TODO ...")
 | 
							debug.error("subprocess.CalledProcessError : TODO ...")
 | 
				
			||||||
 | 
						except:
 | 
				
			||||||
 | 
							debug.error("Exception on : " + str(args))
 | 
				
			||||||
	# launch the subprocess:
 | 
						# launch the subprocess:
 | 
				
			||||||
	output, err = p.communicate()
 | 
						output, err = p.communicate()
 | 
				
			||||||
	if sys.version_info >= (3, 0):
 | 
						if sys.version_info >= (3, 0):
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -30,6 +30,8 @@ class System:
 | 
				
			|||||||
		self.export_flags_ld_shared=[]
 | 
							self.export_flags_ld_shared=[]
 | 
				
			||||||
		self.export_libs_ld=[]
 | 
							self.export_libs_ld=[]
 | 
				
			||||||
		self.export_libs_ld_shared=[]
 | 
							self.export_libs_ld_shared=[]
 | 
				
			||||||
 | 
							self.export_src=[]
 | 
				
			||||||
 | 
							self.action_on_state={}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
	def append_and_check(self, listout, newElement, order):
 | 
						def append_and_check(self, listout, newElement, order):
 | 
				
			||||||
		for element in listout:
 | 
							for element in listout:
 | 
				
			||||||
@@ -62,6 +64,14 @@ class System:
 | 
				
			|||||||
	def add_export_flag_MM(self, list):
 | 
						def add_export_flag_MM(self, list):
 | 
				
			||||||
		self.append_to_internalList(self.export_flags_mm, list)
 | 
							self.append_to_internalList(self.export_flags_mm, list)
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 | 
						def add_export_SRC(self, list):
 | 
				
			||||||
 | 
							self.append_to_internalList(self.export_src, 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:
 | 
				
			||||||
 | 
								self.action_on_state[name_of_state] = [[level, name, action]]
 | 
				
			||||||
 | 
							else:
 | 
				
			||||||
 | 
								self.action_on_state[name_of_state].append([level, name, action])
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -74,7 +84,12 @@ def createModuleFromSystem(target, dict):
 | 
				
			|||||||
	myModule.add_export_flag('c++', dict["system"].export_flags_xx)
 | 
						myModule.add_export_flag('c++', dict["system"].export_flags_xx)
 | 
				
			||||||
	myModule.add_export_flag('m', dict["system"].export_flags_m)
 | 
						myModule.add_export_flag('m', dict["system"].export_flags_m)
 | 
				
			||||||
	myModule.add_export_flag('mm', dict["system"].export_flags_mm)
 | 
						myModule.add_export_flag('mm', dict["system"].export_flags_mm)
 | 
				
			||||||
	# add the currrent module at the 
 | 
						myModule.add_src_file(dict["system"].export_src)
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						for elem in dict["system"].action_on_state:
 | 
				
			||||||
 | 
							level, name, action = dict["system"].action_on_state[elem]
 | 
				
			||||||
 | 
							target.add_action(elem, level, name, action)
 | 
				
			||||||
 | 
						
 | 
				
			||||||
	return myModule
 | 
						return myModule
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -114,6 +129,7 @@ def import_path(path):
 | 
				
			|||||||
				                           "loaded":False,
 | 
									                           "loaded":False,
 | 
				
			||||||
				                           "exist":False,
 | 
									                           "exist":False,
 | 
				
			||||||
				                           "module":None}]
 | 
									                           "module":None}]
 | 
				
			||||||
 | 
						debug.debug("list system=" + str(systemList))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def display():
 | 
					def display():
 | 
				
			||||||
	global systemList
 | 
						global systemList
 | 
				
			||||||
@@ -123,8 +139,9 @@ def display():
 | 
				
			|||||||
			debug.info("    '" + data["name"] +"' in " + data["path"])
 | 
								debug.info("    '" + data["name"] +"' in " + data["path"])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def exist(lib_name, target_name) :
 | 
					def exist(lib_name, target_name, target) :
 | 
				
			||||||
	global systemList
 | 
						global systemList
 | 
				
			||||||
 | 
						debug.verbose("exist= " + lib_name + " in " + target_name)
 | 
				
			||||||
	if target_name not in systemList:
 | 
						if target_name not in systemList:
 | 
				
			||||||
		return False
 | 
							return False
 | 
				
			||||||
	for data in systemList[target_name]:
 | 
						for data in systemList[target_name]:
 | 
				
			||||||
@@ -137,7 +154,8 @@ def exist(lib_name, target_name) :
 | 
				
			|||||||
				theSystem = __import__(__startSystemName + target_name + "_" + data["name"])
 | 
									theSystem = __import__(__startSystemName + target_name + "_" + data["name"])
 | 
				
			||||||
				#create the system module
 | 
									#create the system module
 | 
				
			||||||
				try:
 | 
									try:
 | 
				
			||||||
					data["system"] = theSystem.System()
 | 
										debug.info("call : " + data["name"])
 | 
				
			||||||
 | 
										data["system"] = theSystem.System(target)
 | 
				
			||||||
					data["exist"] = data["system"].valid
 | 
										data["exist"] = data["system"].valid
 | 
				
			||||||
				except:
 | 
									except:
 | 
				
			||||||
					debug.debug("Not find: '" + data["name"] + "'")
 | 
										debug.debug("Not find: '" + data["name"] + "'")
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										139
									
								
								lutin/target.py
									
									
									
									
									
								
							
							
						
						
									
										139
									
								
								lutin/target.py
									
									
									
									
									
								
							@@ -82,6 +82,7 @@ class Target:
 | 
				
			|||||||
		self.suffix_binary=''
 | 
							self.suffix_binary=''
 | 
				
			||||||
		self.suffix_package='.deb'
 | 
							self.suffix_package='.deb'
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
 | 
							self.folder_generate_code="/generate_header"
 | 
				
			||||||
		self.folder_arch="/" + self.name
 | 
							self.folder_arch="/" + self.name
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		if "debug" == self.config["mode"]:
 | 
							if "debug" == self.config["mode"]:
 | 
				
			||||||
@@ -112,6 +113,8 @@ class Target:
 | 
				
			|||||||
		
 | 
							
 | 
				
			||||||
		self.sysroot=""
 | 
							self.sysroot=""
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
 | 
							self.action_on_state={}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
	def update_folder_tree(self):
 | 
						def update_folder_tree(self):
 | 
				
			||||||
		self.folder_out="/out/" + self.name + "_" + self.config["arch"] + "_" + self.config["bus-size"] + "/" + self.config["mode"]
 | 
							self.folder_out="/out/" + self.name + "_" + self.config["arch"] + "_" + self.config["bus-size"] + "/" + self.config["mode"]
 | 
				
			||||||
		self.folder_final="/final/" + self.config["compilator"]
 | 
							self.folder_final="/final/" + self.config["compilator"]
 | 
				
			||||||
@@ -137,18 +140,24 @@ class Target:
 | 
				
			|||||||
	def set_cross_base(self, cross=""):
 | 
						def set_cross_base(self, cross=""):
 | 
				
			||||||
		self.cross = cross
 | 
							self.cross = cross
 | 
				
			||||||
		debug.debug("== Target='" + self.cross + "'");
 | 
							debug.debug("== Target='" + self.cross + "'");
 | 
				
			||||||
 | 
							self.java = "javac"
 | 
				
			||||||
 | 
							self.javah = "javah"
 | 
				
			||||||
 | 
							self.jar = "jar"
 | 
				
			||||||
		self.ar = self.cross + "ar"
 | 
							self.ar = self.cross + "ar"
 | 
				
			||||||
		self.ranlib = self.cross + "ranlib"
 | 
							self.ranlib = self.cross + "ranlib"
 | 
				
			||||||
		if self.config["compilator"] == "clang":
 | 
							if self.config["compilator"] == "clang":
 | 
				
			||||||
			self.cc = self.cross + "clang"
 | 
								self.cc = self.cross + "clang"
 | 
				
			||||||
			self.xx = self.cross + "clang++"
 | 
								self.xx = self.cross + "clang++"
 | 
				
			||||||
			#self.ar=self.cross + "llvm-ar"
 | 
								self.ar=self.cross + "llvm-ar"
 | 
				
			||||||
			#self.ranlib="ls"
 | 
								self.ranlib=""
 | 
				
			||||||
		else:
 | 
							else:
 | 
				
			||||||
			self.cc = self.cross + "gcc"
 | 
								self.cc = self.cross + "gcc"
 | 
				
			||||||
			self.xx = self.cross + "g++"
 | 
								self.xx = self.cross + "g++"
 | 
				
			||||||
			#self.ar=self.cross + "ar"
 | 
								#self.ar=self.cross + "ar"
 | 
				
			||||||
			#self.ranlib=self.cross + "ranlib"
 | 
								#self.ranlib=self.cross + "ranlib"
 | 
				
			||||||
 | 
							if self.config["compilator-version"] != "":
 | 
				
			||||||
 | 
								self.cc = self.cc + "-" + self.config["compilator-version"]
 | 
				
			||||||
 | 
								self.xx = self.xx + "-" + self.config["compilator-version"]
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		#get g++ compilation version :
 | 
							#get g++ compilation version :
 | 
				
			||||||
		ret = multiprocess.run_command_direct(self.xx + " -dumpversion");
 | 
							ret = multiprocess.run_command_direct(self.xx + " -dumpversion");
 | 
				
			||||||
@@ -206,13 +215,38 @@ class Target:
 | 
				
			|||||||
		self.folder_ewol = folder
 | 
							self.folder_ewol = folder
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	def file_generate_object(self,binaryName,moduleName,basePath,file):
 | 
						def get_full_name_source(self, basePath, file):
 | 
				
			||||||
		list=[]
 | 
							if file[0] == '/':
 | 
				
			||||||
		list.append(basePath + "/" + file)
 | 
								if tools.os.path.isfile(file):
 | 
				
			||||||
		list.append(self.get_build_folder(moduleName) + "/" + file + self.suffix_obj)
 | 
									return file
 | 
				
			||||||
		list.append(self.get_build_folder(moduleName) + "/" + file + self.suffix_dependence)
 | 
							return basePath + "/" + file
 | 
				
			||||||
		list.append(self.get_build_folder(moduleName) + "/" + file + self.suffix_cmdLine)
 | 
						
 | 
				
			||||||
		return list
 | 
						def get_full_name_cmd(self, moduleName, basePath, file):
 | 
				
			||||||
 | 
							if file[0] == '/':
 | 
				
			||||||
 | 
								if tools.os.path.isfile(file):
 | 
				
			||||||
 | 
									return file + self.suffix_cmdLine
 | 
				
			||||||
 | 
							return self.get_build_folder(moduleName) + "/" + file + self.suffix_cmdLine
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						def get_full_name_destination(self, moduleName, basePath, file, suffix, remove_suffix=False):
 | 
				
			||||||
 | 
							# special patch for java file:
 | 
				
			||||||
 | 
							if file[-4:] == "java":
 | 
				
			||||||
 | 
								for elem in ["org/", "com/"]:
 | 
				
			||||||
 | 
									pos = file.find(elem);
 | 
				
			||||||
 | 
									if pos > 0:
 | 
				
			||||||
 | 
										file = file[pos:]
 | 
				
			||||||
 | 
							if remove_suffix == True:
 | 
				
			||||||
 | 
								file = file[:file.rfind(".")] + '.'
 | 
				
			||||||
 | 
							else:
 | 
				
			||||||
 | 
								file += "."
 | 
				
			||||||
 | 
							if len(suffix) >= 1:
 | 
				
			||||||
 | 
								suffix = suffix[0]
 | 
				
			||||||
 | 
							else:
 | 
				
			||||||
 | 
								suffix = ""
 | 
				
			||||||
 | 
							return self.get_build_folder(moduleName) + "/" + file + suffix
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						def get_full_dependency(self, moduleName, basePath, file):
 | 
				
			||||||
 | 
							return self.get_build_folder(moduleName) + "/" + file + self.suffix_dependence
 | 
				
			||||||
 | 
						
 | 
				
			||||||
	"""
 | 
						"""
 | 
				
			||||||
		return a list of 3 elements :
 | 
							return a list of 3 elements :
 | 
				
			||||||
			0 : sources files (can be a list)
 | 
								0 : sources files (can be a list)
 | 
				
			||||||
@@ -225,17 +259,22 @@ class Target:
 | 
				
			|||||||
			list.append(file)
 | 
								list.append(file)
 | 
				
			||||||
			list.append(self.get_staging_folder(binaryName) + "/" + self.folder_bin + "/" + moduleName + self.suffix_binary)
 | 
								list.append(self.get_staging_folder(binaryName) + "/" + self.folder_bin + "/" + moduleName + self.suffix_binary)
 | 
				
			||||||
			list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_dependence)
 | 
								list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_dependence)
 | 
				
			||||||
			list.append(self.get_build_folder(binaryName) + "/" + self.folder_bin + "/" + moduleName + self.suffix_cmdLine)
 | 
								list.append(self.get_build_folder(binaryName) + "/" + self.folder_bin + "/" + moduleName + self.suffix_binary + self.suffix_cmdLine)
 | 
				
			||||||
		elif (type=="lib-shared"):
 | 
							elif (type=="lib-shared"):
 | 
				
			||||||
			list.append(file)
 | 
								list.append(file)
 | 
				
			||||||
			list.append(self.get_staging_folder(binaryName) + "/" + self.folder_lib + "/" + moduleName + self.suffix_lib_dynamic)
 | 
								list.append(self.get_staging_folder(binaryName) + "/" + self.folder_lib + "/" + moduleName + self.suffix_lib_dynamic)
 | 
				
			||||||
			list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_dependence)
 | 
								list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_dependence)
 | 
				
			||||||
			list.append(self.get_build_folder(binaryName) + "/" + self.folder_lib + "/" + moduleName + self.suffix_cmdLine)
 | 
								list.append(self.get_build_folder(binaryName) + "/" + self.folder_lib + "/" + moduleName + self.suffix_lib_dynamic + self.suffix_cmdLine)
 | 
				
			||||||
		elif (type=="lib-static"):
 | 
							elif (type=="lib-static"):
 | 
				
			||||||
			list.append(file)
 | 
								list.append(file)
 | 
				
			||||||
			list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_lib_static)
 | 
								list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_lib_static)
 | 
				
			||||||
			list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_dependence)
 | 
								list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_dependence)
 | 
				
			||||||
			list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_cmdLine)
 | 
								list.append(self.get_build_folder(moduleName) + "/" + moduleName + self.suffix_lib_static + self.suffix_cmdLine)
 | 
				
			||||||
 | 
							elif (type=="jar"):
 | 
				
			||||||
 | 
								list.append(file)
 | 
				
			||||||
 | 
								list.append(self.get_build_folder(moduleName) + "/" + moduleName + ".jar")
 | 
				
			||||||
 | 
								list.append(self.get_build_folder(moduleName) + "/" + moduleName + ".jar" + self.suffix_dependence)
 | 
				
			||||||
 | 
								list.append(self.get_build_folder(moduleName) + "/" + moduleName + ".jar" + self.suffix_cmdLine)
 | 
				
			||||||
		elif (type=="image"):
 | 
							elif (type=="image"):
 | 
				
			||||||
			list.append(self.get_build_folder(binaryName) + "/data/" + file + self.suffix_cmdLine)
 | 
								list.append(self.get_build_folder(binaryName) + "/data/" + file + self.suffix_cmdLine)
 | 
				
			||||||
		else:
 | 
							else:
 | 
				
			||||||
@@ -275,6 +314,12 @@ class Target:
 | 
				
			|||||||
		debug.debug("Add nodule for Taget : " + newModule.name)
 | 
							debug.debug("Add nodule for Taget : " + newModule.name)
 | 
				
			||||||
		self.moduleList.append(newModule)
 | 
							self.moduleList.append(newModule)
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 | 
						def get_module(self, name):
 | 
				
			||||||
 | 
							for mod in self.buildDone:
 | 
				
			||||||
 | 
								if mod.name == name:
 | 
				
			||||||
 | 
									return mod
 | 
				
			||||||
 | 
							debug.error("the module '" + str(name) + "'does not exist/already build")
 | 
				
			||||||
 | 
							return None
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	# return inherit packages ...
 | 
						# return inherit packages ...
 | 
				
			||||||
	"""
 | 
						"""
 | 
				
			||||||
@@ -303,23 +348,19 @@ class Target:
 | 
				
			|||||||
		for elem in self.moduleList:
 | 
							for elem in self.moduleList:
 | 
				
			||||||
			if elem.name == name:
 | 
								if elem.name == name:
 | 
				
			||||||
				return True
 | 
									return True
 | 
				
			||||||
		if optionnal == False:
 | 
							# 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)
 | 
								module.load_module(self, name)
 | 
				
			||||||
			return True
 | 
								return True;
 | 
				
			||||||
		else:
 | 
							else:
 | 
				
			||||||
			# TODO : Check internal module and system module ...
 | 
								return False;
 | 
				
			||||||
			# need to import the module (or the system module ...)
 | 
					 | 
				
			||||||
			exist = system.exist(name, self.name)
 | 
					 | 
				
			||||||
			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;
 | 
					 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	def load_all(self):
 | 
						def load_all(self):
 | 
				
			||||||
		listOfAllTheModule = module.list_all_module()
 | 
							listOfAllTheModule = module.list_all_module()
 | 
				
			||||||
@@ -332,19 +373,10 @@ class Target:
 | 
				
			|||||||
				mod.ext_project_add_module(self, projectMng, addedModule)
 | 
									mod.ext_project_add_module(self, projectMng, addedModule)
 | 
				
			||||||
				return
 | 
									return
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	def build_optionnal(self, moduleName, packagesName=None):
 | 
						def build(self, name, packagesName=None, optionnal=False):
 | 
				
			||||||
		present = self.load_if_needed(moduleName, optionnal=True)
 | 
							if name == "gcov":
 | 
				
			||||||
		if present == False:
 | 
								debug.info("gcov all")
 | 
				
			||||||
			return [heritage.HeritageList(), False]
 | 
								debug.error("must set the gcov parsig on a specific library or binary ==> not supported now for all")
 | 
				
			||||||
		# clean requested
 | 
					 | 
				
			||||||
		for mod in self.moduleList:
 | 
					 | 
				
			||||||
			if mod.name == moduleName:
 | 
					 | 
				
			||||||
				debug.debug("build module '" + moduleName + "'")
 | 
					 | 
				
			||||||
				return [mod.build(self, None), True]
 | 
					 | 
				
			||||||
		debug.warning("not know module name : '" + moduleName + "' to '" + "build" + "' it")
 | 
					 | 
				
			||||||
		return [heritage.HeritageList(), False]
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	def build(self, name, packagesName=None):
 | 
					 | 
				
			||||||
		if name == "dump":
 | 
							if name == "dump":
 | 
				
			||||||
			debug.info("dump all")
 | 
								debug.info("dump all")
 | 
				
			||||||
			self.load_all()
 | 
								self.load_all()
 | 
				
			||||||
@@ -371,11 +403,15 @@ class Target:
 | 
				
			|||||||
			# get the action an the module ....
 | 
								# get the action an the module ....
 | 
				
			||||||
			gettedElement = name.split("?")
 | 
								gettedElement = name.split("?")
 | 
				
			||||||
			moduleName = gettedElement[0]
 | 
								moduleName = gettedElement[0]
 | 
				
			||||||
 | 
								if len(gettedElement)>=3:
 | 
				
			||||||
 | 
									sub_action_name = gettedElement[2]
 | 
				
			||||||
 | 
								else:
 | 
				
			||||||
 | 
									sub_action_name = ""
 | 
				
			||||||
			if len(gettedElement)>=2:
 | 
								if len(gettedElement)>=2:
 | 
				
			||||||
				actionName = gettedElement[1]
 | 
									actionName = gettedElement[1]
 | 
				
			||||||
			else :
 | 
								else :
 | 
				
			||||||
				actionName = "build"
 | 
									actionName = "build"
 | 
				
			||||||
			debug.verbose("requested : " + moduleName + "-" + actionName)
 | 
								debug.verbose("requested : " + moduleName + "?" + actionName)
 | 
				
			||||||
			if actionName == "install":
 | 
								if actionName == "install":
 | 
				
			||||||
				self.build(moduleName + "?build")
 | 
									self.build(moduleName + "?build")
 | 
				
			||||||
				self.install_package(moduleName)
 | 
									self.install_package(moduleName)
 | 
				
			||||||
@@ -384,7 +420,10 @@ class Target:
 | 
				
			|||||||
			elif actionName == "log":
 | 
								elif actionName == "log":
 | 
				
			||||||
				self.Log(moduleName)
 | 
									self.Log(moduleName)
 | 
				
			||||||
			else:
 | 
								else:
 | 
				
			||||||
				self.load_if_needed(moduleName)
 | 
									present = self.load_if_needed(moduleName, optionnal=optionnal)
 | 
				
			||||||
 | 
									if     present == False \
 | 
				
			||||||
 | 
									   and optionnal == True:
 | 
				
			||||||
 | 
										return [heritage.HeritageList(), False]
 | 
				
			||||||
				# clean requested
 | 
									# clean requested
 | 
				
			||||||
				for mod in self.moduleList:
 | 
									for mod in self.moduleList:
 | 
				
			||||||
					if mod.name == moduleName:
 | 
										if mod.name == moduleName:
 | 
				
			||||||
@@ -394,11 +433,27 @@ class Target:
 | 
				
			|||||||
						elif actionName == "clean":
 | 
											elif actionName == "clean":
 | 
				
			||||||
							debug.info("clean module '" + moduleName + "'")
 | 
												debug.info("clean module '" + moduleName + "'")
 | 
				
			||||||
							return mod.clean(self)
 | 
												return mod.clean(self)
 | 
				
			||||||
 | 
											elif actionName == "gcov":
 | 
				
			||||||
 | 
												debug.debug("gcov on module '" + moduleName + "'")
 | 
				
			||||||
 | 
												if sub_action_name == "output":
 | 
				
			||||||
 | 
													return mod.gcov(self, generate_output=True)
 | 
				
			||||||
 | 
												return mod.gcov(self, generate_output=False)
 | 
				
			||||||
						elif actionName == "build":
 | 
											elif actionName == "build":
 | 
				
			||||||
							debug.debug("build module '" + moduleName + "'")
 | 
												debug.debug("build module '" + moduleName + "'")
 | 
				
			||||||
 | 
												if optionnal == True:
 | 
				
			||||||
 | 
													return [mod.build(self, None), True]
 | 
				
			||||||
							return mod.build(self, None)
 | 
												return mod.build(self, None)
 | 
				
			||||||
 | 
									if optionnal == True:
 | 
				
			||||||
 | 
										return [heritage.HeritageList(), False]
 | 
				
			||||||
				debug.error("not know module name : '" + moduleName + "' to '" + actionName + "' it")
 | 
									debug.error("not know module name : '" + moduleName + "' to '" + actionName + "' it")
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 | 
						def add_action(self, name_of_state="PACKAGE", level=5, name="no-name", action=None):
 | 
				
			||||||
 | 
							debug.verbose("add action : " + name)
 | 
				
			||||||
 | 
							if name_of_state not in self.action_on_state:
 | 
				
			||||||
 | 
								self.action_on_state[name_of_state] = [[level, name, action]]
 | 
				
			||||||
 | 
							else:
 | 
				
			||||||
 | 
								self.action_on_state[name_of_state].append([level, name, action])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
targetList=[]
 | 
					targetList=[]
 | 
				
			||||||
__startTargetName="lutinTarget_"
 | 
					__startTargetName="lutinTarget_"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,747 +0,0 @@
 | 
				
			|||||||
#!/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 target
 | 
					 | 
				
			||||||
from lutin import tools
 | 
					 | 
				
			||||||
from lutin import image
 | 
					 | 
				
			||||||
from lutin import multiprocess
 | 
					 | 
				
			||||||
from lutin import host
 | 
					 | 
				
			||||||
import os
 | 
					 | 
				
			||||||
import sys
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class Target(target.Target):
 | 
					 | 
				
			||||||
	def __init__(self, config):
 | 
					 | 
				
			||||||
		#processor type selection (auto/arm/ppc/x86)
 | 
					 | 
				
			||||||
		if config["arch"] == "auto":
 | 
					 | 
				
			||||||
			config["arch"] = "arm"
 | 
					 | 
				
			||||||
		#bus size selection (auto/32/64)
 | 
					 | 
				
			||||||
		if config["bus-size"] == "auto":
 | 
					 | 
				
			||||||
			config["bus-size"] = "32"
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		arch = ""#"ARMv7"
 | 
					 | 
				
			||||||
		target.Target.__init__(self, "Android", config, arch)
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		self.folder_ndk = os.getenv('PROJECT_NDK', "AUTO")
 | 
					 | 
				
			||||||
		self.folder_sdk = os.getenv('PROJECT_SDK', "AUTO")
 | 
					 | 
				
			||||||
		# auto search NDK
 | 
					 | 
				
			||||||
		if self.folder_ndk == "AUTO":
 | 
					 | 
				
			||||||
			for folder in os.listdir("."):
 | 
					 | 
				
			||||||
				if os.path.isdir(folder)==True:
 | 
					 | 
				
			||||||
					if folder=="android":
 | 
					 | 
				
			||||||
						self.folder_ndk = folder + "/ndk"
 | 
					 | 
				
			||||||
			if self.folder_ndk == "AUTO":
 | 
					 | 
				
			||||||
				self.folder_ndk = tools.get_run_folder() + "/../android/ndk"
 | 
					 | 
				
			||||||
		# auto search SDK
 | 
					 | 
				
			||||||
		if self.folder_sdk == "AUTO":
 | 
					 | 
				
			||||||
			for folder in os.listdir("."):
 | 
					 | 
				
			||||||
				if os.path.isdir(folder)==True:
 | 
					 | 
				
			||||||
					if folder=="android":
 | 
					 | 
				
			||||||
						self.folder_sdk = folder + "/sdk"
 | 
					 | 
				
			||||||
			if self.folder_sdk == "AUTO":
 | 
					 | 
				
			||||||
				self.folder_sdk = tools.get_run_folder() + "/../android/sdk"
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		if not os.path.isdir(self.folder_ndk):
 | 
					 | 
				
			||||||
			debug.error("NDK path not set !!! set env : PROJECT_NDK on the NDK path")
 | 
					 | 
				
			||||||
		if not os.path.isdir(self.folder_sdk):
 | 
					 | 
				
			||||||
			debug.error("SDK path not set !!! set env : PROJECT_SDK on the SDK path")
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		tmpOsVal = "64"
 | 
					 | 
				
			||||||
		gccVersion = "4.9"
 | 
					 | 
				
			||||||
		if host.BUS_SIZE==64:
 | 
					 | 
				
			||||||
			tmpOsVal = "_64"
 | 
					 | 
				
			||||||
		if self.config["compilator"] == "clang":
 | 
					 | 
				
			||||||
			self.set_cross_base(self.folder_ndk + "/toolchains/llvm-3.3/prebuilt/linux-x86_64/bin/")
 | 
					 | 
				
			||||||
		else:
 | 
					 | 
				
			||||||
			baseFolderArm = self.folder_ndk + "/toolchains/arm-linux-androideabi-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/"
 | 
					 | 
				
			||||||
			baseFolderMips = self.folder_ndk + "/toolchains/mipsel-linux-android-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/"
 | 
					 | 
				
			||||||
			baseFolderX86 = self.folder_ndk + "/toolchains/x86-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/"
 | 
					 | 
				
			||||||
			self.set_cross_base(baseFolderArm + "arm-linux-androideabi-")
 | 
					 | 
				
			||||||
			if not os.path.isdir(baseFolderArm):
 | 
					 | 
				
			||||||
				debug.error("Gcc Arm path does not exist !!!")
 | 
					 | 
				
			||||||
			if not os.path.isdir(baseFolderMips):
 | 
					 | 
				
			||||||
				debug.info("Gcc Mips path does not exist !!!")
 | 
					 | 
				
			||||||
			if not os.path.isdir(baseFolderX86):
 | 
					 | 
				
			||||||
				debug.info("Gcc x86 path does not exist !!!")
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		arch = "ARMv7"
 | 
					 | 
				
			||||||
		# for gcc :
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		# for clang :
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		self.folder_bin="/mustNotCreateBinary"
 | 
					 | 
				
			||||||
		self.folder_lib="/data/lib/armeabi"
 | 
					 | 
				
			||||||
		self.folder_data="/data/assets"
 | 
					 | 
				
			||||||
		self.folder_doc="/doc"
 | 
					 | 
				
			||||||
		self.suffix_package='.pkg'
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		# board id at 14 is for android 4.0 and more ...
 | 
					 | 
				
			||||||
		self.boardId = 14
 | 
					 | 
				
			||||||
		if arch == "ARMv5" or arch == "ARMv7":
 | 
					 | 
				
			||||||
			self.global_include_cc.append("-I" + self.folder_ndk +"/platforms/android-" + str(self.boardId) + "/arch-arm/usr/include/")
 | 
					 | 
				
			||||||
		elif arch == "mips":
 | 
					 | 
				
			||||||
			self.global_include_cc.append("-I" + self.folder_ndk +"/platforms/android-" + str(self.boardId) + "/arch-mips/usr/include/")
 | 
					 | 
				
			||||||
		elif arch == "x86":
 | 
					 | 
				
			||||||
			self.global_include_cc.append("-I" + self.folder_ndk +"/platforms/android-" + str(self.boardId) + "/arch-x86/usr/include/")
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		if True:
 | 
					 | 
				
			||||||
			if self.config["compilator"] == "clang":
 | 
					 | 
				
			||||||
				self.global_include_cc.append("-I" + self.folder_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/include/")
 | 
					 | 
				
			||||||
				if arch == "ARMv5":
 | 
					 | 
				
			||||||
					stdCppBasePath = self.folder_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":
 | 
					 | 
				
			||||||
					stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/libs/armeabi-v7a/"
 | 
					 | 
				
			||||||
					self.global_include_cc.append("-I" + stdCppBasePath + "include/")
 | 
					 | 
				
			||||||
					self.global_flags_ld.append(         stdCppBasePath + "libc++_static.a")
 | 
					 | 
				
			||||||
				elif arch == "mips":
 | 
					 | 
				
			||||||
					stdCppBasePath = self.folder_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.folder_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_include_cc.append("-I" + self.folder_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/include/")
 | 
					 | 
				
			||||||
				if arch == "ARMv5":
 | 
					 | 
				
			||||||
					stdCppBasePath = self.folder_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.folder_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.folder_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.folder_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.folder_ndk +"/sources/cxx-stl/system/include/")
 | 
					 | 
				
			||||||
			self.global_include_cc.append("-I" + self.folder_ndk +"/sources/cxx-stl/stlport/stlport/")
 | 
					 | 
				
			||||||
			self.global_flags_ld.append(self.folder_ndk +"/platforms/android-" + str(self.boardId) + "/arch-arm/usr/lib/libstdc++.a")
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		self.global_sysroot = "--sysroot=" + self.folder_ndk +"/platforms/android-" + str(self.boardId) + "/arch-arm"
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		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.arch == "ARM":
 | 
					 | 
				
			||||||
			# -----------------------
 | 
					 | 
				
			||||||
			# -- arm V5 :
 | 
					 | 
				
			||||||
			# -----------------------
 | 
					 | 
				
			||||||
			self.global_flags_cc.append("-march=armv5te")
 | 
					 | 
				
			||||||
			self.global_flags_cc.append("-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__")
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		# 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")
 | 
					 | 
				
			||||||
		# -----------------------
 | 
					 | 
				
			||||||
		# -- Common flags :
 | 
					 | 
				
			||||||
		# -----------------------
 | 
					 | 
				
			||||||
		self.global_flags_cc.append("-fpic")
 | 
					 | 
				
			||||||
		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("-fexceptions")
 | 
					 | 
				
			||||||
		##self.global_flags_cc.append("-fno-exceptions")
 | 
					 | 
				
			||||||
		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_xx.append("-Wa,--noexecstack")
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	def check_right_package(self, pkgProperties, value):
 | 
					 | 
				
			||||||
		for val in pkgProperties["RIGHT"]:
 | 
					 | 
				
			||||||
			if value == val:
 | 
					 | 
				
			||||||
				return True
 | 
					 | 
				
			||||||
		return False
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	def get_staging_folder_data(self, binaryName):
 | 
					 | 
				
			||||||
		return self.get_staging_folder(binaryName) + self.folder_data
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	def make_package(self, pkgName, pkgProperties, basePkgPath):
 | 
					 | 
				
			||||||
		# http://alp.developpez.com/tutoriels/debian/creer-paquet/
 | 
					 | 
				
			||||||
		debug.debug("------------------------------------------------------------------------")
 | 
					 | 
				
			||||||
		debug.info("Generate package '" + pkgName + "'")
 | 
					 | 
				
			||||||
		debug.debug("------------------------------------------------------------------------")
 | 
					 | 
				
			||||||
		pkgNameApplicationName = pkgName
 | 
					 | 
				
			||||||
		if self.config["mode"] == "debug":
 | 
					 | 
				
			||||||
			pkgNameApplicationName += "debug"
 | 
					 | 
				
			||||||
		# FINAL_FOLDER_JAVA_PROJECT
 | 
					 | 
				
			||||||
		self.folder_javaProject=   self.get_staging_folder(pkgName) \
 | 
					 | 
				
			||||||
		                         + "/src/" \
 | 
					 | 
				
			||||||
		                         + pkgProperties["COMPAGNY_TYPE"] \
 | 
					 | 
				
			||||||
		                         + "/" + pkgProperties["COMPAGNY_NAME2"] \
 | 
					 | 
				
			||||||
		                         + "/" + pkgNameApplicationName + "/"
 | 
					 | 
				
			||||||
		#FINAL_FILE_ABSTRACTION
 | 
					 | 
				
			||||||
		self.file_finalAbstraction = self.folder_javaProject + "/" + pkgNameApplicationName + ".java"
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		compleatePackageName = pkgProperties["COMPAGNY_TYPE"]+"."+pkgProperties["COMPAGNY_NAME2"]+"." + pkgNameApplicationName
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		if "ADMOD_ID" in pkgProperties:
 | 
					 | 
				
			||||||
			pkgProperties["RIGHT"].append("INTERNET")
 | 
					 | 
				
			||||||
			pkgProperties["RIGHT"].append("ACCESS_NETWORK_STATE")
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		debug.print_element("pkg", "absractionFile", "<==", "dynamic file")
 | 
					 | 
				
			||||||
		# Create folder :
 | 
					 | 
				
			||||||
		tools.create_directory_of_file(self.file_finalAbstraction)
 | 
					 | 
				
			||||||
		# Create file :
 | 
					 | 
				
			||||||
		tmpFile = open(self.file_finalAbstraction, 'w')
 | 
					 | 
				
			||||||
		if pkgProperties["ANDROID_APPL_TYPE"]=="APPL":
 | 
					 | 
				
			||||||
			tmpFile.write( "/**\n")
 | 
					 | 
				
			||||||
			tmpFile.write( " * @author Edouard DUPIN, Kevin BILLONNEAU\n")
 | 
					 | 
				
			||||||
			tmpFile.write( " * @copyright 2011, Edouard DUPIN, all right reserved\n")
 | 
					 | 
				
			||||||
			tmpFile.write( " * @license APACHE v2.0 (see license file)\n")
 | 
					 | 
				
			||||||
			tmpFile.write( " * @note This file is autogenerate ==> see documantation to generate your own\n")
 | 
					 | 
				
			||||||
			tmpFile.write( " */\n")
 | 
					 | 
				
			||||||
			tmpFile.write( "package "+ compleatePackageName + ";\n")
 | 
					 | 
				
			||||||
			tmpFile.write( "import org.ewol.EwolActivity;\n")
 | 
					 | 
				
			||||||
			if "ADMOD_ID" in pkgProperties:
 | 
					 | 
				
			||||||
				tmpFile.write( "import com.google.android.gms.ads.AdRequest;\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "import com.google.android.gms.ads.AdSize;\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "import com.google.android.gms.ads.AdView;\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "import android.widget.LinearLayout;\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "import android.widget.Button;\n")
 | 
					 | 
				
			||||||
			tmpFile.write( "public class " + pkgNameApplicationName + " extends EwolActivity {\n")
 | 
					 | 
				
			||||||
			if "ADMOD_ID" in pkgProperties:
 | 
					 | 
				
			||||||
				tmpFile.write( "	/** The view to show the ad. */\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "	private AdView adView;\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "	private LinearLayout mLayout = null;\n")
 | 
					 | 
				
			||||||
			tmpFile.write( "	public void onCreate(android.os.Bundle savedInstanceState) {\n")
 | 
					 | 
				
			||||||
			tmpFile.write( "		super.onCreate(savedInstanceState);\n")
 | 
					 | 
				
			||||||
			tmpFile.write( "		initApkPath(\"" + pkgProperties["COMPAGNY_TYPE"]+"\", \""+pkgProperties["COMPAGNY_NAME2"]+"\", \"" + pkgNameApplicationName + "\");\n")
 | 
					 | 
				
			||||||
			if "ADMOD_ID" in pkgProperties:
 | 
					 | 
				
			||||||
				tmpFile.write( "		mLayout = new LinearLayout(this);\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "		mLayout.setOrientation(android.widget.LinearLayout.VERTICAL);\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "		LinearLayout.LayoutParams paramsWindows = new LinearLayout.LayoutParams(\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "			LinearLayout.LayoutParams.FILL_PARENT,\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "			LinearLayout.LayoutParams.FILL_PARENT);\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "		\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "		setContentView(mLayout, paramsWindows);\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "		\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "		LinearLayout.LayoutParams paramsAdds = new LinearLayout.LayoutParams(\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "			LinearLayout.LayoutParams.FILL_PARENT,\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "			LinearLayout.LayoutParams.WRAP_CONTENT);\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "		paramsAdds.weight = 0;\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "		\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "		LinearLayout.LayoutParams paramsGLView = new LinearLayout.LayoutParams(\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "			LinearLayout.LayoutParams.FILL_PARENT,\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "			LinearLayout.LayoutParams.FILL_PARENT);\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "		paramsGLView.weight = 1;\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "		paramsGLView.height = 0;\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "		\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "		mLayout.setGravity(android.view.Gravity.TOP);\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "		\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "		// Create an adds.\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "		adView = new AdView(this);\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "		adView.setAdSize(AdSize.SMART_BANNER);\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "		adView.setAdUnitId(\"" + pkgProperties["ADMOD_ID"] + "\");\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "		\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "		// Create an ad request. Check logcat output for the hashed device ID to get test ads on a physical device.\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "		AdRequest adRequest = new AdRequest.Builder()\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "			.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "			.build();\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "		\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "		// Add the AdView to the view hierarchy. The view will have no size until the ad is loaded.\n")
 | 
					 | 
				
			||||||
				if     "ADMOD_POSITION" in pkgProperties.keys() \
 | 
					 | 
				
			||||||
				   and pkgProperties["ADMOD_POSITION"] == "top":
 | 
					 | 
				
			||||||
					tmpFile.write( "		mLayout.addView(adView, paramsAdds);\n")
 | 
					 | 
				
			||||||
					tmpFile.write( "		mLayout.addView(mGLView, paramsGLView);\n")
 | 
					 | 
				
			||||||
				else:
 | 
					 | 
				
			||||||
					tmpFile.write( "		mLayout.addView(mGLView, paramsGLView);\n")
 | 
					 | 
				
			||||||
					tmpFile.write( "		mLayout.addView(adView, paramsAdds);\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "		\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "		// Start loading the ad in the background.\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "		adView.loadAd(adRequest);\n")
 | 
					 | 
				
			||||||
			tmpFile.write( "	}\n")
 | 
					 | 
				
			||||||
			if "ADMOD_ID" in pkgProperties:
 | 
					 | 
				
			||||||
				tmpFile.write( "	@Override protected void onResume() {\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "		super.onResume();\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "		if (adView != null) {\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "			adView.resume();\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "		}\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "	}\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "	@Override protected void onPause() {\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "		if (adView != null) {\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "			adView.pause();\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "		}\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "		super.onPause();\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "	}\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "	@Override protected void onDestroy() {\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "		// Destroy the AdView.\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "		if (adView != null) {\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "			adView.destroy();\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "		}\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "		super.onDestroy();\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "	}\n")
 | 
					 | 
				
			||||||
			tmpFile.write( "}\n")
 | 
					 | 
				
			||||||
		else :
 | 
					 | 
				
			||||||
			# wallpaper mode ...
 | 
					 | 
				
			||||||
			tmpFile.write( "/**\n")
 | 
					 | 
				
			||||||
			tmpFile.write( " * @author Edouard DUPIN, Kevin BILLONNEAU\n")
 | 
					 | 
				
			||||||
			tmpFile.write( " * @copyright 2011, Edouard DUPIN, all right reserved\n")
 | 
					 | 
				
			||||||
			tmpFile.write( " * @license APACHE v2.0 (see license file)\n")
 | 
					 | 
				
			||||||
			tmpFile.write( " * @note This file is autogenerate ==> see documantation to generate your own\n")
 | 
					 | 
				
			||||||
			tmpFile.write( " */\n")
 | 
					 | 
				
			||||||
			tmpFile.write( "package "+ compleatePackageName + ";\n")
 | 
					 | 
				
			||||||
			tmpFile.write( "import org.ewol.EwolWallpaper;\n")
 | 
					 | 
				
			||||||
			tmpFile.write( "public class " + pkgNameApplicationName + " extends EwolWallpaper {\n")
 | 
					 | 
				
			||||||
			tmpFile.write( "	public static final String SHARED_PREFS_NAME = \"" + pkgNameApplicationName + "settings\";\n")
 | 
					 | 
				
			||||||
			tmpFile.write( "	public Engine onCreateEngine() {\n")
 | 
					 | 
				
			||||||
			tmpFile.write( "		Engine tmpEngine = super.onCreateEngine();\n")
 | 
					 | 
				
			||||||
			tmpFile.write( "		initApkPath(\"" + pkgProperties["COMPAGNY_TYPE"]+"\", \""+pkgProperties["COMPAGNY_NAME2"]+"\", \"" + pkgNameApplicationName + "\");\n")
 | 
					 | 
				
			||||||
			tmpFile.write( "		return tmpEngine;\n")
 | 
					 | 
				
			||||||
			tmpFile.write( "	}\n")
 | 
					 | 
				
			||||||
			tmpFile.write( "}\n")
 | 
					 | 
				
			||||||
		tmpFile.flush()
 | 
					 | 
				
			||||||
		tmpFile.close()
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		tools.create_directory_of_file(self.get_staging_folder(pkgName) + "/res/drawable/icon.png");
 | 
					 | 
				
			||||||
		if     "ICON" in pkgProperties.keys() \
 | 
					 | 
				
			||||||
		   and pkgProperties["ICON"] != "":
 | 
					 | 
				
			||||||
			image.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/res/drawable/icon.png", 256, 256)
 | 
					 | 
				
			||||||
		else:
 | 
					 | 
				
			||||||
			# to be sure that we have all time a resource ...
 | 
					 | 
				
			||||||
			tmpFile = open(self.get_staging_folder(pkgName) + "/res/drawable/plop.txt", 'w')
 | 
					 | 
				
			||||||
			tmpFile.write('plop\n')
 | 
					 | 
				
			||||||
			tmpFile.flush()
 | 
					 | 
				
			||||||
			tmpFile.close()
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		if pkgProperties["ANDROID_MANIFEST"]!="":
 | 
					 | 
				
			||||||
			debug.print_element("pkg", "AndroidManifest.xml", "<==", pkgProperties["ANDROID_MANIFEST"])
 | 
					 | 
				
			||||||
			tools.copy_file(pkgProperties["ANDROID_MANIFEST"], self.get_staging_folder(pkgName) + "/AndroidManifest.xml", force=True)
 | 
					 | 
				
			||||||
		else:
 | 
					 | 
				
			||||||
			if "VERSION_CODE" not in pkgProperties:
 | 
					 | 
				
			||||||
				pkgProperties["VERSION_CODE"] = "1"
 | 
					 | 
				
			||||||
			debug.print_element("pkg", "AndroidManifest.xml", "<==", "package configurations")
 | 
					 | 
				
			||||||
			tmpFile = open(self.get_staging_folder(pkgName) + "/AndroidManifest.xml", 'w')
 | 
					 | 
				
			||||||
			tmpFile.write( '<?xml version="1.0" encoding="utf-8"?>\n')
 | 
					 | 
				
			||||||
			tmpFile.write( '<!-- Manifest is autoGenerated with Ewol ... do not patch it-->\n')
 | 
					 | 
				
			||||||
			tmpFile.write( '<manifest xmlns:android="http://schemas.android.com/apk/res/android" \n')
 | 
					 | 
				
			||||||
			tmpFile.write( '          package="' + compleatePackageName + '" \n')
 | 
					 | 
				
			||||||
			tmpFile.write( '          android:versionCode="'+pkgProperties["VERSION_CODE"]+'" \n')
 | 
					 | 
				
			||||||
			tmpFile.write( '          android:versionName="'+pkgProperties["VERSION"]+'"> \n')
 | 
					 | 
				
			||||||
			tmpFile.write( '	<uses-feature android:glEsVersion="0x00020000" android:required="true" />\n')
 | 
					 | 
				
			||||||
			tmpFile.write( '	<uses-sdk android:minSdkVersion="' + str(self.boardId) + '" \n')
 | 
					 | 
				
			||||||
			tmpFile.write( '	          android:targetSdkVersion="' + str(self.boardId) + '" /> \n')
 | 
					 | 
				
			||||||
			if pkgProperties["ANDROID_APPL_TYPE"]=="APPL":
 | 
					 | 
				
			||||||
				tmpFile.write( '	<application android:label="' + pkgNameApplicationName + '" \n')
 | 
					 | 
				
			||||||
				if "ICON" in pkgProperties.keys():
 | 
					 | 
				
			||||||
					tmpFile.write( '	             android:icon="@drawable/icon" \n')
 | 
					 | 
				
			||||||
				if self.config["mode"] == "debug":
 | 
					 | 
				
			||||||
					tmpFile.write( '	             android:debuggable="true" \n')
 | 
					 | 
				
			||||||
				tmpFile.write( '	             >\n')
 | 
					 | 
				
			||||||
				if "ADMOD_ID" in pkgProperties:
 | 
					 | 
				
			||||||
					tmpFile.write( '		<meta-data android:name="com.google.android.gms.version" \n')
 | 
					 | 
				
			||||||
					tmpFile.write( '		           android:value="@integer/google_play_services_version"/>\n')
 | 
					 | 
				
			||||||
				
 | 
					 | 
				
			||||||
				tmpFile.write( '		<activity android:name=".' + pkgNameApplicationName + '" \n')
 | 
					 | 
				
			||||||
				tmpFile.write( '		          android:label="' + pkgProperties['NAME'])
 | 
					 | 
				
			||||||
				if self.config["mode"] == "debug":
 | 
					 | 
				
			||||||
					tmpFile.write("-debug")
 | 
					 | 
				
			||||||
				tmpFile.write( '"\n')
 | 
					 | 
				
			||||||
				if "ICON" in pkgProperties.keys():
 | 
					 | 
				
			||||||
					tmpFile.write( '		          android:icon="@drawable/icon" \n')
 | 
					 | 
				
			||||||
				tmpFile.write( '		          android:hardwareAccelerated="true" \n')
 | 
					 | 
				
			||||||
				tmpFile.write( '		          android:configChanges="keyboard|keyboardHidden|orientation|screenSize"> \n')
 | 
					 | 
				
			||||||
				tmpFile.write( '			<intent-filter> \n')
 | 
					 | 
				
			||||||
				tmpFile.write( '				<action android:name="android.intent.action.MAIN" /> \n')
 | 
					 | 
				
			||||||
				tmpFile.write( '				<category android:name="android.intent.category.LAUNCHER" /> \n')
 | 
					 | 
				
			||||||
				tmpFile.write( '			</intent-filter> \n')
 | 
					 | 
				
			||||||
				tmpFile.write( '		</activity> \n')
 | 
					 | 
				
			||||||
				if "ADMOD_ID" in pkgProperties:
 | 
					 | 
				
			||||||
					tmpFile.write( '		<activity android:name="com.google.android.gms.ads.AdActivity"\n')
 | 
					 | 
				
			||||||
					tmpFile.write( '		          android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>\n')
 | 
					 | 
				
			||||||
				
 | 
					 | 
				
			||||||
				tmpFile.write( '	</application>\n')
 | 
					 | 
				
			||||||
			else:
 | 
					 | 
				
			||||||
				tmpFile.write( '	<application android:label="' + pkgNameApplicationName + '" \n')
 | 
					 | 
				
			||||||
				tmpFile.write( '	             android:permission="android.permission.BIND_WALLPAPER" \n')
 | 
					 | 
				
			||||||
				if "ICON" in pkgProperties.keys():
 | 
					 | 
				
			||||||
					tmpFile.write( '	             android:icon="@drawable/icon"\n')
 | 
					 | 
				
			||||||
				tmpFile.write( '	             >\n')
 | 
					 | 
				
			||||||
				tmpFile.write( '		<service android:name=".' + pkgNameApplicationName + '" \n')
 | 
					 | 
				
			||||||
				tmpFile.write( '		         android:label="' + pkgProperties['NAME'])
 | 
					 | 
				
			||||||
				if self.config["mode"] == "debug":
 | 
					 | 
				
			||||||
					tmpFile.write("-debug")
 | 
					 | 
				
			||||||
				tmpFile.write( '"\n')
 | 
					 | 
				
			||||||
				if "ICON" in pkgProperties.keys():
 | 
					 | 
				
			||||||
					tmpFile.write( '		         android:icon="@drawable/icon"\n')
 | 
					 | 
				
			||||||
				tmpFile.write( '		         >\n')
 | 
					 | 
				
			||||||
				tmpFile.write( '			<intent-filter>\n')
 | 
					 | 
				
			||||||
				tmpFile.write( '				<action android:name="android.service.wallpaper.WallpaperService" />\n')
 | 
					 | 
				
			||||||
				tmpFile.write( '			</intent-filter>\n')
 | 
					 | 
				
			||||||
				tmpFile.write( '			<meta-data android:name="android.service.wallpaper"\n')
 | 
					 | 
				
			||||||
				tmpFile.write( '			           android:resource="@xml/' + pkgNameApplicationName + '_resource" />\n')
 | 
					 | 
				
			||||||
				tmpFile.write( '		</service>\n')
 | 
					 | 
				
			||||||
				if len(pkgProperties["ANDROID_WALLPAPER_PROPERTIES"])!=0:
 | 
					 | 
				
			||||||
					tmpFile.write( '		<activity android:label="Setting"\n')
 | 
					 | 
				
			||||||
					tmpFile.write( '		          android:name=".' + pkgNameApplicationName + 'Settings"\n')
 | 
					 | 
				
			||||||
					tmpFile.write( '		          android:theme="@android:style/Theme.Light.WallpaperSettings"\n')
 | 
					 | 
				
			||||||
					tmpFile.write( '		          android:exported="true"\n')
 | 
					 | 
				
			||||||
					if "ICON" in pkgProperties.keys():
 | 
					 | 
				
			||||||
						tmpFile.write( '		          android:icon="@drawable/icon"\n')
 | 
					 | 
				
			||||||
					tmpFile.write( '		          >\n')
 | 
					 | 
				
			||||||
					tmpFile.write( '		</activity>\n')
 | 
					 | 
				
			||||||
				tmpFile.write( '	</application>\n')
 | 
					 | 
				
			||||||
			# write package autorisations :
 | 
					 | 
				
			||||||
			if True==self.check_right_package(pkgProperties, "WRITE_EXTERNAL_STORAGE"):
 | 
					 | 
				
			||||||
				tmpFile.write( '	<permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> \n')
 | 
					 | 
				
			||||||
				tmpFile.write( '	<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> \n')
 | 
					 | 
				
			||||||
			if True==self.check_right_package(pkgProperties, "CAMERA"):
 | 
					 | 
				
			||||||
				tmpFile.write( '	<permission android:name="android.permission.CAMERA" /> \n')
 | 
					 | 
				
			||||||
				tmpFile.write( '	<uses-permission android:name="android.permission.CAMERA" /> \n')
 | 
					 | 
				
			||||||
			if True==self.check_right_package(pkgProperties, "INTERNET"):
 | 
					 | 
				
			||||||
				tmpFile.write( '	<permission android:name="android.permission.INTERNET" /> \n')
 | 
					 | 
				
			||||||
				tmpFile.write( '	<uses-permission android:name="android.permission.INTERNET" /> \n')
 | 
					 | 
				
			||||||
			if True==self.check_right_package(pkgProperties, "ACCESS_NETWORK_STATE"):
 | 
					 | 
				
			||||||
				tmpFile.write( '	<permission android:name="android.permission.ACCESS_NETWORK_STATE" /> \n')
 | 
					 | 
				
			||||||
				tmpFile.write( '	<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> \n')
 | 
					 | 
				
			||||||
			if True==self.check_right_package(pkgProperties, "MODIFY_AUDIO_SETTINGS"):
 | 
					 | 
				
			||||||
				tmpFile.write( '	<permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> \n')
 | 
					 | 
				
			||||||
				tmpFile.write( '	<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> \n')
 | 
					 | 
				
			||||||
			if True==self.check_right_package(pkgProperties, "READ_CALENDAR"):
 | 
					 | 
				
			||||||
				tmpFile.write( '	<permission android:name="android.permission.READ_CALENDAR" /> \n')
 | 
					 | 
				
			||||||
				tmpFile.write( '	<uses-permission android:name="android.permission.READ_CALENDAR" /> \n')
 | 
					 | 
				
			||||||
			if True==self.check_right_package(pkgProperties, "READ_CONTACTS"):
 | 
					 | 
				
			||||||
				tmpFile.write( '	<permission android:name="android.permission.READ_CONTACTS" /> \n')
 | 
					 | 
				
			||||||
				tmpFile.write( '	<uses-permission android:name="android.permission.READ_CONTACTS" /> \n')
 | 
					 | 
				
			||||||
			if True==self.check_right_package(pkgProperties, "READ_FRAME_BUFFER"):
 | 
					 | 
				
			||||||
				tmpFile.write( '	<permission android:name="android.permission.READ_FRAME_BUFFER" /> \n')
 | 
					 | 
				
			||||||
				tmpFile.write( '	<uses-permission android:name="android.permission.READ_FRAME_BUFFER" /> \n')
 | 
					 | 
				
			||||||
			if True==self.check_right_package(pkgProperties, "READ_PROFILE"):
 | 
					 | 
				
			||||||
				tmpFile.write( '	<permission android:name="android.permission.READ_PROFILE" /> \n')
 | 
					 | 
				
			||||||
				tmpFile.write( '	<uses-permission android:name="android.permission.READ_PROFILE" /> \n')
 | 
					 | 
				
			||||||
			if True==self.check_right_package(pkgProperties, "RECORD_AUDIO"):
 | 
					 | 
				
			||||||
				tmpFile.write( '	<permission android:name="android.permission.RECORD_AUDIO" /> \n')
 | 
					 | 
				
			||||||
				tmpFile.write( '	<uses-permission android:name="android.permission.RECORD_AUDIO" /> \n')
 | 
					 | 
				
			||||||
			if True==self.check_right_package(pkgProperties, "SET_ORIENTATION"):
 | 
					 | 
				
			||||||
				tmpFile.write( '	<permission android:name="android.permission.SET_ORIENTATION" /> \n')
 | 
					 | 
				
			||||||
				tmpFile.write( '	<uses-permission android:name="android.permission.SET_ORIENTATION" /> \n')
 | 
					 | 
				
			||||||
			if True==self.check_right_package(pkgProperties, "VIBRATE"):
 | 
					 | 
				
			||||||
				tmpFile.write( '	<permission android:name="android.permission.VIBRATE" /> \n')
 | 
					 | 
				
			||||||
				tmpFile.write( '	<uses-permission android:name="android.permission.VIBRATE" /> \n')
 | 
					 | 
				
			||||||
			if True==self.check_right_package(pkgProperties, "ACCESS_COARSE_LOCATION"):
 | 
					 | 
				
			||||||
				tmpFile.write( '	<permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> \n')
 | 
					 | 
				
			||||||
				tmpFile.write( '	<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> \n')
 | 
					 | 
				
			||||||
			if True==self.check_right_package(pkgProperties, "ACCESS_FINE_LOCATION"):
 | 
					 | 
				
			||||||
				tmpFile.write( '	<permission android:name="android.permission.ACCESS_FINE_LOCATION" /> \n')
 | 
					 | 
				
			||||||
				tmpFile.write( '	<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> \n')
 | 
					 | 
				
			||||||
			tmpFile.write( '</manifest>\n\n')
 | 
					 | 
				
			||||||
			tmpFile.flush()
 | 
					 | 
				
			||||||
			tmpFile.close()
 | 
					 | 
				
			||||||
			# end generating android manifest
 | 
					 | 
				
			||||||
			
 | 
					 | 
				
			||||||
			if pkgProperties["ANDROID_APPL_TYPE"]!="APPL":
 | 
					 | 
				
			||||||
				#create the Wallpaper sub files : (main element for the application
 | 
					 | 
				
			||||||
				debug.print_element("pkg", pkgNameApplicationName + "_resource.xml", "<==", "package configurations")
 | 
					 | 
				
			||||||
				tools.create_directory_of_file(self.get_staging_folder(pkgName) + "/res/xml/" + pkgNameApplicationName + "_resource.xml")
 | 
					 | 
				
			||||||
				tmpFile = open(self.get_staging_folder(pkgName) + "/res/xml/" + pkgNameApplicationName + "_resource.xml", 'w')
 | 
					 | 
				
			||||||
				tmpFile.write( "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "<wallpaper xmlns:android=\"http://schemas.android.com/apk/res/android\"\n")
 | 
					 | 
				
			||||||
				if len(pkgProperties["ANDROID_WALLPAPER_PROPERTIES"])!=0:
 | 
					 | 
				
			||||||
					tmpFile.write( "           android:settingsActivity=\""+compleatePackageName + "."+ pkgNameApplicationName + "Settings\"\n")
 | 
					 | 
				
			||||||
				if "ICON" in pkgProperties.keys():
 | 
					 | 
				
			||||||
					tmpFile.write( "           android:thumbnail=\"@drawable/icon\"\n")
 | 
					 | 
				
			||||||
				tmpFile.write( "           />\n")
 | 
					 | 
				
			||||||
				tmpFile.flush()
 | 
					 | 
				
			||||||
				tmpFile.close()
 | 
					 | 
				
			||||||
				# create wallpaper setting if needed (class and config file)
 | 
					 | 
				
			||||||
				if len(pkgProperties["ANDROID_WALLPAPER_PROPERTIES"])!=0:
 | 
					 | 
				
			||||||
					tools.create_directory_of_file(self.folder_javaProject + pkgNameApplicationName + "Settings.java")
 | 
					 | 
				
			||||||
					debug.print_element("pkg", self.folder_javaProject + pkgNameApplicationName + "Settings.java", "<==", "package configurations")
 | 
					 | 
				
			||||||
					tmpFile = open(self.folder_javaProject + pkgNameApplicationName + "Settings.java", 'w');
 | 
					 | 
				
			||||||
					tmpFile.write( "package " + compleatePackageName + ";\n")
 | 
					 | 
				
			||||||
					tmpFile.write( "\n")
 | 
					 | 
				
			||||||
					tmpFile.write( "import " + compleatePackageName + ".R;\n")
 | 
					 | 
				
			||||||
					tmpFile.write( "\n")
 | 
					 | 
				
			||||||
					tmpFile.write( "import android.content.SharedPreferences;\n")
 | 
					 | 
				
			||||||
					tmpFile.write( "import android.os.Bundle;\n")
 | 
					 | 
				
			||||||
					tmpFile.write( "import android.preference.PreferenceActivity;\n")
 | 
					 | 
				
			||||||
					tmpFile.write( "\n")
 | 
					 | 
				
			||||||
					tmpFile.write( "public class " + pkgNameApplicationName + "Settings extends PreferenceActivity implements SharedPreferences.OnSharedPreferenceChangeListener\n")
 | 
					 | 
				
			||||||
					tmpFile.write( "{\n")
 | 
					 | 
				
			||||||
					tmpFile.write( "	@Override protected void onCreate(Bundle icicle) {\n")
 | 
					 | 
				
			||||||
					tmpFile.write( "		super.onCreate(icicle);\n")
 | 
					 | 
				
			||||||
					tmpFile.write( "		getPreferenceManager().setSharedPreferencesName("+ pkgNameApplicationName + ".SHARED_PREFS_NAME);\n")
 | 
					 | 
				
			||||||
					tmpFile.write( "		addPreferencesFromResource(R.xml."+ pkgNameApplicationName  + "_settings);\n")
 | 
					 | 
				
			||||||
					tmpFile.write( "		getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);\n")
 | 
					 | 
				
			||||||
					tmpFile.write( "	}\n")
 | 
					 | 
				
			||||||
					tmpFile.write( "	@Override protected void onResume() {\n")
 | 
					 | 
				
			||||||
					tmpFile.write( "		super.onResume();\n")
 | 
					 | 
				
			||||||
					tmpFile.write( "	}\n")
 | 
					 | 
				
			||||||
					tmpFile.write( "	@Override protected void onDestroy() {\n")
 | 
					 | 
				
			||||||
					tmpFile.write( "		getPreferenceManager().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this);\n")
 | 
					 | 
				
			||||||
					tmpFile.write( "		super.onDestroy();\n")
 | 
					 | 
				
			||||||
					tmpFile.write( "	}\n")
 | 
					 | 
				
			||||||
					tmpFile.write( "	public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,String key) { }\n")
 | 
					 | 
				
			||||||
					tmpFile.write( "}\n")
 | 
					 | 
				
			||||||
					tmpFile.flush()
 | 
					 | 
				
			||||||
					tmpFile.close()
 | 
					 | 
				
			||||||
					
 | 
					 | 
				
			||||||
					debug.print_element("pkg", self.get_staging_folder(pkgName) + "/res/xml/" + pkgNameApplicationName + "_settings.xml", "<==", "package configurations")
 | 
					 | 
				
			||||||
					tools.create_directory_of_file(self.get_staging_folder(pkgName) + "/res/xml/" + pkgNameApplicationName + "_settings.xml")
 | 
					 | 
				
			||||||
					tmpFile = open(self.get_staging_folder(pkgName) + "/res/xml/" + pkgNameApplicationName + "_settings.xml", 'w');
 | 
					 | 
				
			||||||
					tmpFile.write( "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
 | 
					 | 
				
			||||||
					tmpFile.write( "<PreferenceScreen xmlns:android=\"http://schemas.android.com/apk/res/android\"\n")
 | 
					 | 
				
			||||||
					tmpFile.write( "                  android:title=\"Settings\"\n")
 | 
					 | 
				
			||||||
					tmpFile.write( "                  android:key=\"" + pkgNameApplicationName  + "_settings\">\n")
 | 
					 | 
				
			||||||
					WALL_haveArray = False
 | 
					 | 
				
			||||||
					for WALL_type, WALL_key, WALL_title, WALL_summary, WALL_other in pkgProperties["ANDROID_WALLPAPER_PROPERTIES"]:
 | 
					 | 
				
			||||||
						debug.info("find : '" + WALL_type + "'");
 | 
					 | 
				
			||||||
						if WALL_type == "list":
 | 
					 | 
				
			||||||
							debug.info("    create : LIST");
 | 
					 | 
				
			||||||
							tmpFile.write( "	<ListPreference android:key=\"" + pkgNameApplicationName + "_" + WALL_key + "\"\n")
 | 
					 | 
				
			||||||
							tmpFile.write( "	                android:title=\"" + WALL_title + "\"\n")
 | 
					 | 
				
			||||||
							tmpFile.write( "	                android:summary=\"" + WALL_summary + "\"\n")
 | 
					 | 
				
			||||||
							tmpFile.write( "	                android:entries=\"@array/" + pkgNameApplicationName + "_" + WALL_key + "_names\"\n")
 | 
					 | 
				
			||||||
							tmpFile.write( "	                android:entryValues=\"@array/" + pkgNameApplicationName + "_" + WALL_key + "_prefix\"/>\n")
 | 
					 | 
				
			||||||
							WALL_haveArray=True
 | 
					 | 
				
			||||||
						elif WALL_type == "bool":
 | 
					 | 
				
			||||||
							debug.info("    create : CHECKBOX");
 | 
					 | 
				
			||||||
							tmpFile.write( "	<CheckBoxPreference android:key=\"" + pkgNameApplicationName + "_" + WALL_key + "\"\n")
 | 
					 | 
				
			||||||
							tmpFile.write( "	                    android:title=\"" + WALL_title + "\"\n")
 | 
					 | 
				
			||||||
							tmpFile.write( "	                    android:summary=\"" + WALL_summary + "\"\n")
 | 
					 | 
				
			||||||
							tmpFile.write( "	                    android:summaryOn=\"" + WALL_other[0] + "\"\n")
 | 
					 | 
				
			||||||
							tmpFile.write( "	                    android:summaryOff=\"" + WALL_other[1] + "\"/>\n")
 | 
					 | 
				
			||||||
					tmpFile.write( "</PreferenceScreen>\n")
 | 
					 | 
				
			||||||
					tmpFile.flush()
 | 
					 | 
				
			||||||
					tmpFile.close()
 | 
					 | 
				
			||||||
					if WALL_haveArray==True:
 | 
					 | 
				
			||||||
						for WALL_type, WALL_key, WALL_title, WALL_summary, WALL_other in pkgProperties["ANDROID_WALLPAPER_PROPERTIES"]:
 | 
					 | 
				
			||||||
							if WALL_type == "list":
 | 
					 | 
				
			||||||
								debug.print_element("pkg", self.get_staging_folder(pkgName) + "/res/values/" + WALL_key + ".xml", "<==", "package configurations")
 | 
					 | 
				
			||||||
								tools.create_directory_of_file(self.get_staging_folder(pkgName) + "/res/values/" + WALL_key + ".xml")
 | 
					 | 
				
			||||||
								tmpFile = open(self.get_staging_folder(pkgName) + "/res/values/" + WALL_key + ".xml", 'w');
 | 
					 | 
				
			||||||
								tmpFile.write( "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
 | 
					 | 
				
			||||||
								tmpFile.write( "<resources xmlns:xliff=\"urn:oasis:names:tc:xliff:document:1.2\">\n")
 | 
					 | 
				
			||||||
								tmpFile.write( "	<string-array name=\"" + pkgNameApplicationName + "_" + WALL_key + "_names\">\n")
 | 
					 | 
				
			||||||
								for WALL_subKey, WALL_display in WALL_other:
 | 
					 | 
				
			||||||
									tmpFile.write( "		<item>" + WALL_display + "</item>\n")
 | 
					 | 
				
			||||||
								tmpFile.write( "	</string-array>\n")
 | 
					 | 
				
			||||||
								tmpFile.write( "	<string-array name=\"" + pkgNameApplicationName + "_" + WALL_key + "_prefix\">\n")
 | 
					 | 
				
			||||||
								for WALL_subKey, WALL_display in WALL_other:
 | 
					 | 
				
			||||||
									tmpFile.write( "		<item>" + WALL_subKey + "</item>\n")
 | 
					 | 
				
			||||||
								tmpFile.write( "	</string-array>\n")
 | 
					 | 
				
			||||||
								tmpFile.write( "</resources>\n")
 | 
					 | 
				
			||||||
								tmpFile.flush()
 | 
					 | 
				
			||||||
								tmpFile.close()
 | 
					 | 
				
			||||||
						
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		#add properties on wallpaper : 
 | 
					 | 
				
			||||||
		# myModule.pkg_add("ANDROID_WALLPAPER_PROPERTIES", ["list", key, title, summary, [["key","value display"],["key2","value display 2"]])
 | 
					 | 
				
			||||||
		# myModule.pkg_add("ANDROID_WALLPAPER_PROPERTIES", ["list", "testpattern", "Select test pattern", "Choose which test pattern to display", [["key","value display"],["key2","value display 2"]]])
 | 
					 | 
				
			||||||
		# myModule.pkg_add("ANDROID_WALLPAPER_PROPERTIES", ["bool", key, title, summary, ["enable string", "disable String"])
 | 
					 | 
				
			||||||
		# myModule.pkg_add("ANDROID_WALLPAPER_PROPERTIES", ["bool", "movement", "Motion", "Apply movement to test pattern", ["Moving test pattern", "Still test pattern"]
 | 
					 | 
				
			||||||
		#copy needed resources :
 | 
					 | 
				
			||||||
		for res_source, res_dest in pkgProperties["ANDROID_RESOURCES"]:
 | 
					 | 
				
			||||||
			if res_source == "":
 | 
					 | 
				
			||||||
				continue
 | 
					 | 
				
			||||||
			tools.copy_file(res_source , self.get_staging_folder(pkgName) + "/res/" + res_dest + "/" + os.path.basename(res_source), force=True)
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		# Doc :
 | 
					 | 
				
			||||||
		# 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(self.get_staging_folder(pkgName) + "/src/noFile")
 | 
					 | 
				
			||||||
		androidToolPath = self.folder_sdk + "/build-tools/"
 | 
					 | 
				
			||||||
		# find android tool version
 | 
					 | 
				
			||||||
		dirnames = tools.get_list_sub_folder(androidToolPath)
 | 
					 | 
				
			||||||
		if len(dirnames) != 1:
 | 
					 | 
				
			||||||
			debug.error("an error occured when getting the tools for android")
 | 
					 | 
				
			||||||
		androidToolPath += dirnames[0] + "/"
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		adModResouceFolder = ""
 | 
					 | 
				
			||||||
		if "ADMOD_ID" in pkgProperties:
 | 
					 | 
				
			||||||
			adModResouceFolder = " -S " + self.folder_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/res/ "
 | 
					 | 
				
			||||||
		cmdLine = androidToolPath + "aapt p -f " \
 | 
					 | 
				
			||||||
		          + "-M " + self.get_staging_folder(pkgName) + "/AndroidManifest.xml " \
 | 
					 | 
				
			||||||
		          + "-F " + self.get_staging_folder(pkgName) + "/resources.res " \
 | 
					 | 
				
			||||||
		          + "-I " + self.folder_sdk + "/platforms/android-" + str(self.boardId) + "/android.jar "\
 | 
					 | 
				
			||||||
		          + "-S " + self.get_staging_folder(pkgName) + "/res/ " \
 | 
					 | 
				
			||||||
		          + adModResouceFolder \
 | 
					 | 
				
			||||||
		          + "-J " + self.get_staging_folder(pkgName) + "/src/ "
 | 
					 | 
				
			||||||
		multiprocess.run_command(cmdLine)
 | 
					 | 
				
			||||||
		#aapt  package -f -M ${manifest.file} -F ${packaged.resource.file} -I ${path.to.android-jar.library} 
 | 
					 | 
				
			||||||
		#      -S ${android-resource-directory} [-m -J ${folder.to.output.the.R.java}]
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		tools.create_directory_of_file(self.get_staging_folder(pkgName) + "/build/classes/noFile")
 | 
					 | 
				
			||||||
		debug.print_element("pkg", "*.class", "<==", "*.java")
 | 
					 | 
				
			||||||
		# more information with : -Xlint
 | 
					 | 
				
			||||||
		#          + self.file_finalAbstraction + " "\ # this generate ex: out/Android/debug/staging/tethys/src/com/edouarddupin/tethys/edn.java
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		#generate android java files:
 | 
					 | 
				
			||||||
		filesString=""
 | 
					 | 
				
			||||||
		for element in pkgProperties["ANDROID_JAVA_FILES"]:
 | 
					 | 
				
			||||||
			if element=="DEFAULT":
 | 
					 | 
				
			||||||
				filesString += self.folder_ewol + "/sources/android/src/org/ewol/EwolAudioTask.java "
 | 
					 | 
				
			||||||
				filesString += self.folder_ewol + "/sources/android/src/org/ewol/EwolCallback.java "
 | 
					 | 
				
			||||||
				filesString += self.folder_ewol + "/sources/android/src/org/ewol/EwolConstants.java "
 | 
					 | 
				
			||||||
				filesString += self.folder_ewol + "/sources/android/src/org/ewol/Ewol.java "
 | 
					 | 
				
			||||||
				filesString += self.folder_ewol + "/sources/android/src/org/ewol/EwolRendererGL.java "
 | 
					 | 
				
			||||||
				filesString += self.folder_ewol + "/sources/android/src/org/ewol/EwolSurfaceViewGL.java "
 | 
					 | 
				
			||||||
				filesString += self.folder_ewol + "/sources/android/src/org/ewol/EwolActivity.java "
 | 
					 | 
				
			||||||
				filesString += self.folder_ewol + "/sources/android/src/org/ewol/EwolWallpaper.java "
 | 
					 | 
				
			||||||
			else:
 | 
					 | 
				
			||||||
				filesString += element + " "
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		if "ADMOD_ID" in pkgProperties:
 | 
					 | 
				
			||||||
			filesString += self.folder_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/src/android/UnusedStub.java "
 | 
					 | 
				
			||||||
			
 | 
					 | 
				
			||||||
		if len(pkgProperties["ANDROID_WALLPAPER_PROPERTIES"])!=0:
 | 
					 | 
				
			||||||
			filesString += self.folder_javaProject + pkgNameApplicationName + "Settings.java "
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		adModJarFile = ""
 | 
					 | 
				
			||||||
		if "ADMOD_ID" in pkgProperties:
 | 
					 | 
				
			||||||
			adModJarFile = ":" + self.folder_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar"
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		cmdLine = "javac " \
 | 
					 | 
				
			||||||
		          + "-d " + self.get_staging_folder(pkgName) + "/build/classes " \
 | 
					 | 
				
			||||||
		          + "-classpath " + self.folder_sdk + "/platforms/android-" + str(self.boardId) + "/android.jar" \
 | 
					 | 
				
			||||||
		          + adModJarFile + " " \
 | 
					 | 
				
			||||||
		          + filesString \
 | 
					 | 
				
			||||||
		          + self.file_finalAbstraction + " "  \
 | 
					 | 
				
			||||||
		          + self.get_staging_folder(pkgName) + "/src/R.java "
 | 
					 | 
				
			||||||
		multiprocess.run_command(cmdLine)
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		debug.print_element("pkg", ".dex", "<==", "*.class")
 | 
					 | 
				
			||||||
		cmdLine = androidToolPath + "dx " \
 | 
					 | 
				
			||||||
		          + "--dex --no-strict " \
 | 
					 | 
				
			||||||
		          + "--output=" + self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + ".dex " \
 | 
					 | 
				
			||||||
		          + self.get_staging_folder(pkgName) + "/build/classes/ "
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		if "ADMOD_ID" in pkgProperties:
 | 
					 | 
				
			||||||
			cmdLine += self.folder_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar "
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		multiprocess.run_command(cmdLine)
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		debug.print_element("pkg", ".apk", "<==", ".dex, assets, .so, res")
 | 
					 | 
				
			||||||
		#builderDebug="-agentlib:jdwp=transport=dt_socket,server=y,address=8050,suspend=y "
 | 
					 | 
				
			||||||
		builderDebug=""
 | 
					 | 
				
			||||||
		# note : set -u not signed application...
 | 
					 | 
				
			||||||
		#+ ":" + self.folder_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar "
 | 
					 | 
				
			||||||
		cmdLine =   "java -Xmx128M " \
 | 
					 | 
				
			||||||
		          + " -classpath " + self.folder_sdk + "/tools/lib/sdklib.jar " \
 | 
					 | 
				
			||||||
		          + builderDebug \
 | 
					 | 
				
			||||||
		          + " com.android.sdklib.build.ApkBuilderMain " \
 | 
					 | 
				
			||||||
		          + self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \
 | 
					 | 
				
			||||||
		          + " -u " \
 | 
					 | 
				
			||||||
		          + " -z " + self.get_staging_folder(pkgName) + "/resources.res " \
 | 
					 | 
				
			||||||
		          + " -f " + self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + ".dex " \
 | 
					 | 
				
			||||||
		          + " -rf " + self.get_staging_folder(pkgName) + "/data "
 | 
					 | 
				
			||||||
		multiprocess.run_command(cmdLine)
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		# doc :
 | 
					 | 
				
			||||||
		# http://developer.android.com/tools/publishing/app-signing.html
 | 
					 | 
				
			||||||
		# Create a key for signing your application:
 | 
					 | 
				
			||||||
		# keytool -genkeypair -v -keystore AndroidKey.jks -storepass Pass__AndroidDebugKey -alias alias__AndroidDebugKey -keypass PassKey__AndroidDebugKey -keyalg RSA -validity 36500
 | 
					 | 
				
			||||||
		if self.config["mode"] == "debug":
 | 
					 | 
				
			||||||
			debug.print_element("pkg", ".apk(signed debug)", "<==", ".apk (not signed)")
 | 
					 | 
				
			||||||
			# verbose mode : 
 | 
					 | 
				
			||||||
			#debugOption = "-verbose -certs "
 | 
					 | 
				
			||||||
			debugOption = ""
 | 
					 | 
				
			||||||
			cmdLine = "jarsigner " \
 | 
					 | 
				
			||||||
			    + debugOption \
 | 
					 | 
				
			||||||
			    + "-keystore " + tools.get_current_path(__file__) + "/AndroidDebugKey.jks " \
 | 
					 | 
				
			||||||
			    + " -sigalg SHA1withRSA -digestalg SHA1 " \
 | 
					 | 
				
			||||||
			    + " -storepass Pass__AndroidDebugKey " \
 | 
					 | 
				
			||||||
			    + " -keypass PassKey__AndroidDebugKey " \
 | 
					 | 
				
			||||||
			    + self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \
 | 
					 | 
				
			||||||
			    + " alias__AndroidDebugKey"
 | 
					 | 
				
			||||||
			multiprocess.run_command(cmdLine)
 | 
					 | 
				
			||||||
			tmpFile = open("tmpPass.boo", 'w')
 | 
					 | 
				
			||||||
			tmpFile.write("\n")
 | 
					 | 
				
			||||||
			tmpFile.flush()
 | 
					 | 
				
			||||||
			tmpFile.close()
 | 
					 | 
				
			||||||
		else:
 | 
					 | 
				
			||||||
			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 " + basePkgPath + "/AndroidKey.jks " \
 | 
					 | 
				
			||||||
			    + " -sigalg SHA1withRSA -digestalg SHA1 " \
 | 
					 | 
				
			||||||
			    + self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \
 | 
					 | 
				
			||||||
			    + " " + pkgNameApplicationName
 | 
					 | 
				
			||||||
			multiprocess.run_command(cmdLine)
 | 
					 | 
				
			||||||
			cmdLine = "jarsigner " \
 | 
					 | 
				
			||||||
			    + " -verify -verbose -certs " \
 | 
					 | 
				
			||||||
			    + " -sigalg SHA1withRSA -digestalg SHA1 " \
 | 
					 | 
				
			||||||
			    + self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk "
 | 
					 | 
				
			||||||
			multiprocess.run_command(cmdLine)
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		debug.print_element("pkg", ".apk(aligned)", "<==", ".apk (not aligned)")
 | 
					 | 
				
			||||||
		tools.remove_file(self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk")
 | 
					 | 
				
			||||||
		# verbose mode : -v
 | 
					 | 
				
			||||||
		cmdLine = androidToolPath + "zipalign 4 " \
 | 
					 | 
				
			||||||
		          + self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \
 | 
					 | 
				
			||||||
		          + self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk "
 | 
					 | 
				
			||||||
		multiprocess.run_command(cmdLine)
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		# copy file in the final stage :
 | 
					 | 
				
			||||||
		tools.copy_file(self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk",
 | 
					 | 
				
			||||||
		                self.get_final_folder() + "/" + pkgNameApplicationName + ".apk",
 | 
					 | 
				
			||||||
		                force=True)
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	def install_package(self, pkgName):
 | 
					 | 
				
			||||||
		debug.debug("------------------------------------------------------------------------")
 | 
					 | 
				
			||||||
		debug.info("Install package '" + pkgName + "'")
 | 
					 | 
				
			||||||
		debug.debug("------------------------------------------------------------------------")
 | 
					 | 
				
			||||||
		pkgNameApplicationName = pkgName
 | 
					 | 
				
			||||||
		if self.config["mode"] == "debug":
 | 
					 | 
				
			||||||
			pkgNameApplicationName += "debug"
 | 
					 | 
				
			||||||
		cmdLine = self.folder_sdk + "/platform-tools/adb install -r " \
 | 
					 | 
				
			||||||
		          + self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk "
 | 
					 | 
				
			||||||
		multiprocess.run_command(cmdLine)
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	def un_install_package(self, pkgName):
 | 
					 | 
				
			||||||
		debug.debug("------------------------------------------------------------------------")
 | 
					 | 
				
			||||||
		debug.info("Un-Install package '" + pkgName + "'")
 | 
					 | 
				
			||||||
		debug.debug("------------------------------------------------------------------------")
 | 
					 | 
				
			||||||
		pkgNameApplicationName = pkgName
 | 
					 | 
				
			||||||
		if self.config["mode"] == "debug":
 | 
					 | 
				
			||||||
			pkgNameApplicationName += "debug"
 | 
					 | 
				
			||||||
		cmdLine = self.folder_sdk + "/platform-tools/adb uninstall " + pkgNameApplicationName
 | 
					 | 
				
			||||||
		Rmultiprocess.unCommand(cmdLine)
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	def Log(self, pkgName):
 | 
					 | 
				
			||||||
		debug.debug("------------------------------------------------------------------------")
 | 
					 | 
				
			||||||
		debug.info("logcat of android board")
 | 
					 | 
				
			||||||
		debug.debug("------------------------------------------------------------------------")
 | 
					 | 
				
			||||||
		debug.info("cmd: " + self.folder_sdk + "/platform-tools/adb shell logcat ")
 | 
					 | 
				
			||||||
		cmdLine = self.folder_sdk + "/platform-tools/adb shell logcat "
 | 
					 | 
				
			||||||
		multiprocess.run_command(cmdLine)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@@ -144,3 +144,37 @@ def copy_anything_target(target, src, dst):
 | 
				
			|||||||
					newDst += "/"
 | 
										newDst += "/"
 | 
				
			||||||
			debug.verbose("Might copy : '" + root+"/"+cycleFile + "' ==> '" + newDst+cycleFile + "'" )
 | 
								debug.verbose("Might copy : '" + root+"/"+cycleFile + "' ==> '" + newDst+cycleFile + "'" )
 | 
				
			||||||
			target.add_file_staging(root+"/"+cycleFile, newDst+cycleFile)
 | 
								target.add_file_staging(root+"/"+cycleFile, newDst+cycleFile)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def filter_extention(list_files, extentions, invert=False):
 | 
				
			||||||
 | 
						out = []
 | 
				
			||||||
 | 
						for file in list_files:
 | 
				
			||||||
 | 
							in_list = False
 | 
				
			||||||
 | 
							for ext in extentions:
 | 
				
			||||||
 | 
								if file[-len(ext):] == ext:
 | 
				
			||||||
 | 
									in_list = True
 | 
				
			||||||
 | 
							if     in_list == True \
 | 
				
			||||||
 | 
							   and invert == False:
 | 
				
			||||||
 | 
								out.append(file)
 | 
				
			||||||
 | 
							elif     in_list == False \
 | 
				
			||||||
 | 
							     and invert == True:
 | 
				
			||||||
 | 
								out.append(file)
 | 
				
			||||||
 | 
						return out
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def move_if_needed(src, dst):
 | 
				
			||||||
 | 
						if not os.path.isfile(src):
 | 
				
			||||||
 | 
							debug.error("request move if needed, but file does not exist: '" + str(src) + "' to '" + str(dst) + "'")
 | 
				
			||||||
 | 
							return
 | 
				
			||||||
 | 
						src_data = file_read_data(src)
 | 
				
			||||||
 | 
						if os.path.isfile(dst):
 | 
				
			||||||
 | 
							# file exist ==> must check ...
 | 
				
			||||||
 | 
							dst_data = file_read_data(dst)
 | 
				
			||||||
 | 
							if src_data == dst_data:
 | 
				
			||||||
 | 
								# nothing to do ...
 | 
				
			||||||
 | 
								return
 | 
				
			||||||
 | 
						file_write_data(dst, src_data)
 | 
				
			||||||
 | 
						remove_file(src)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -41,7 +41,10 @@ def get_output_type():
 | 
				
			|||||||
## @brief Commands for running gcc to compile a C file in object file.
 | 
					## @brief Commands for running gcc to compile a C file in object file.
 | 
				
			||||||
##
 | 
					##
 | 
				
			||||||
def compile(file, binary, target, depancy, flags, path, name, basic_folder):
 | 
					def compile(file, binary, target, depancy, flags, path, name, basic_folder):
 | 
				
			||||||
	file_src, file_dst, file_depend, file_cmd = target.file_generate_object(binary, name, basic_folder,file)
 | 
						file_src = target.get_full_name_source(basic_folder, file)
 | 
				
			||||||
 | 
						file_cmd = target.get_full_name_cmd(name, basic_folder, file)
 | 
				
			||||||
 | 
						file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type())
 | 
				
			||||||
 | 
						file_depend = target.get_full_dependency(name, basic_folder, file)
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	# create the command line befor requesting start:
 | 
						# create the command line befor requesting start:
 | 
				
			||||||
	cmd = [
 | 
						cmd = [
 | 
				
			||||||
@@ -50,16 +53,13 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
 | 
				
			|||||||
		target.arch,
 | 
							target.arch,
 | 
				
			||||||
		target.sysroot,
 | 
							target.sysroot,
 | 
				
			||||||
		target.global_include_cc]
 | 
							target.global_include_cc]
 | 
				
			||||||
 | 
						for view in ["export", "local"]:
 | 
				
			||||||
 | 
							try:
 | 
				
			||||||
 | 
								cmd.append(tools.add_prefix("-I", path[view]["c"]))
 | 
				
			||||||
 | 
							except:
 | 
				
			||||||
 | 
								pass
 | 
				
			||||||
	try:
 | 
						try:
 | 
				
			||||||
		cmd.append(tools.add_prefix("-I", path["export"]))
 | 
							cmd.append(tools.add_prefix("-I", depancy.path["c"]))
 | 
				
			||||||
	except:
 | 
					 | 
				
			||||||
		pass
 | 
					 | 
				
			||||||
	try:
 | 
					 | 
				
			||||||
		cmd.append(tools.add_prefix("-I", path["local"]))
 | 
					 | 
				
			||||||
	except:
 | 
					 | 
				
			||||||
		pass
 | 
					 | 
				
			||||||
	try:
 | 
					 | 
				
			||||||
		cmd.append(tools.add_prefix("-I", depancy.path))
 | 
					 | 
				
			||||||
	except:
 | 
						except:
 | 
				
			||||||
		pass
 | 
							pass
 | 
				
			||||||
	try:
 | 
						try:
 | 
				
			||||||
@@ -74,14 +74,11 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
 | 
				
			|||||||
		cmd.append(depancy.flags["c"])
 | 
							cmd.append(depancy.flags["c"])
 | 
				
			||||||
	except:
 | 
						except:
 | 
				
			||||||
		pass
 | 
							pass
 | 
				
			||||||
	try:
 | 
						for view in ["local", "export"]:
 | 
				
			||||||
		cmd.append(flags["local"]["c"])
 | 
							try:
 | 
				
			||||||
	except:
 | 
								cmd.append(flags[view]["c"])
 | 
				
			||||||
		pass
 | 
							except:
 | 
				
			||||||
	try:
 | 
								pass
 | 
				
			||||||
		cmd.append(flags["export"]["c"])
 | 
					 | 
				
			||||||
	except:
 | 
					 | 
				
			||||||
		pass
 | 
					 | 
				
			||||||
	cmd.append("-c")
 | 
						cmd.append("-c")
 | 
				
			||||||
	cmd.append("-MMD")
 | 
						cmd.append("-MMD")
 | 
				
			||||||
	cmd.append("-MP")
 | 
						cmd.append("-MP")
 | 
				
			||||||
@@ -90,12 +87,12 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
 | 
				
			|||||||
	cmdLine=tools.list_to_str(cmd)
 | 
						cmdLine=tools.list_to_str(cmd)
 | 
				
			||||||
	# check the dependency for this file :
 | 
						# check the dependency for this file :
 | 
				
			||||||
	if depend.need_re_build(file_dst, file_src, file_depend, file_cmd, cmdLine) == False:
 | 
						if depend.need_re_build(file_dst, file_src, file_depend, file_cmd, cmdLine) == False:
 | 
				
			||||||
		return file_dst
 | 
							return {"action":"add", "file":file_dst}
 | 
				
			||||||
	tools.create_directory_of_file(file_dst)
 | 
						tools.create_directory_of_file(file_dst)
 | 
				
			||||||
	comment = ["c", name, "<==", file]
 | 
						comment = ["c", name, "<==", file]
 | 
				
			||||||
	# process element
 | 
						# process element
 | 
				
			||||||
	multiprocess.run_in_pool(cmdLine, comment, file_cmd)
 | 
						multiprocess.run_in_pool(cmdLine, comment, file_cmd)
 | 
				
			||||||
	return file_dst
 | 
						return {"action":"add", "file":file_dst}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def get_version_compilation_flags(flags, dependency_flags):
 | 
					def get_version_compilation_flags(flags, dependency_flags):
 | 
				
			||||||
@@ -40,7 +40,10 @@ def get_output_type():
 | 
				
			|||||||
## @brief Commands for running gcc to compile a C++ file in object file.
 | 
					## @brief Commands for running gcc to compile a C++ file in object file.
 | 
				
			||||||
##
 | 
					##
 | 
				
			||||||
def compile(file, binary, target, depancy, flags, path, name, basic_folder):
 | 
					def compile(file, binary, target, depancy, flags, path, name, basic_folder):
 | 
				
			||||||
	file_src, file_dst, file_depend, file_cmd = target.file_generate_object(binary, name, basic_folder, file)
 | 
						file_src = target.get_full_name_source(basic_folder, file)
 | 
				
			||||||
 | 
						file_cmd = target.get_full_name_cmd(name, basic_folder, file)
 | 
				
			||||||
 | 
						file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type())
 | 
				
			||||||
 | 
						file_depend = target.get_full_dependency(name, basic_folder, file)
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	# create the command line befor requesting start:
 | 
						# create the command line befor requesting start:
 | 
				
			||||||
	cmd = [
 | 
						cmd = [
 | 
				
			||||||
@@ -50,18 +53,17 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
 | 
				
			|||||||
		target.sysroot,
 | 
							target.sysroot,
 | 
				
			||||||
		target.global_include_cc
 | 
							target.global_include_cc
 | 
				
			||||||
		]
 | 
							]
 | 
				
			||||||
	try:
 | 
						for view in ["export", "local"]:
 | 
				
			||||||
		cmd.append(tools.add_prefix("-I",path["export"]))
 | 
							for type in ["c", "c++"]:
 | 
				
			||||||
	except:
 | 
								try:
 | 
				
			||||||
		pass
 | 
									cmd.append(tools.add_prefix("-I",path[view][type]))
 | 
				
			||||||
	try:
 | 
								except:
 | 
				
			||||||
		cmd.append(tools.add_prefix("-I",path["local"]))
 | 
									pass
 | 
				
			||||||
	except:
 | 
						for type in ["c", "c++"]:
 | 
				
			||||||
		pass
 | 
							try:
 | 
				
			||||||
	try:
 | 
								cmd.append(tools.add_prefix("-I",depancy.path[type]))
 | 
				
			||||||
		cmd.append(tools.add_prefix("-I",depancy.path))
 | 
							except:
 | 
				
			||||||
	except:
 | 
								pass
 | 
				
			||||||
		pass
 | 
					 | 
				
			||||||
	try:
 | 
						try:
 | 
				
			||||||
		cmd.append(get_version_compilation_flags(flags, depancy.flags))
 | 
							cmd.append(get_version_compilation_flags(flags, depancy.flags))
 | 
				
			||||||
	except:
 | 
						except:
 | 
				
			||||||
@@ -74,30 +76,17 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
 | 
				
			|||||||
		cmd.append(target.global_flags_xx)
 | 
							cmd.append(target.global_flags_xx)
 | 
				
			||||||
	except:
 | 
						except:
 | 
				
			||||||
		pass
 | 
							pass
 | 
				
			||||||
	try:
 | 
						for type in ["c", "c++"]:
 | 
				
			||||||
		cmd.append(depancy.flags["c"])
 | 
							try:
 | 
				
			||||||
	except:
 | 
								cmd.append(depancy.flags[type])
 | 
				
			||||||
		pass
 | 
							except:
 | 
				
			||||||
	try:
 | 
								pass
 | 
				
			||||||
		cmd.append(depancy.flags["c++"])
 | 
						for view in ["local", "export"]:
 | 
				
			||||||
	except:
 | 
							for type in ["c", "c++"]:
 | 
				
			||||||
		pass
 | 
								try:
 | 
				
			||||||
	try:
 | 
									cmd.append(flags[view][type])
 | 
				
			||||||
		cmd.append(flags["local"]["c"])
 | 
								except:
 | 
				
			||||||
	except:
 | 
									pass
 | 
				
			||||||
		pass
 | 
					 | 
				
			||||||
	try:
 | 
					 | 
				
			||||||
		cmd.append(flags["local"]["c++"])
 | 
					 | 
				
			||||||
	except:
 | 
					 | 
				
			||||||
		pass
 | 
					 | 
				
			||||||
	try:
 | 
					 | 
				
			||||||
		cmd.append(flags["export"]["c"])
 | 
					 | 
				
			||||||
	except:
 | 
					 | 
				
			||||||
		pass
 | 
					 | 
				
			||||||
	try:
 | 
					 | 
				
			||||||
		cmd.append(flags["export"]["c++"])
 | 
					 | 
				
			||||||
	except:
 | 
					 | 
				
			||||||
		pass
 | 
					 | 
				
			||||||
	cmd.append(["-c", "-MMD", "-MP"])
 | 
						cmd.append(["-c", "-MMD", "-MP"])
 | 
				
			||||||
	cmd.append(file_src)
 | 
						cmd.append(file_src)
 | 
				
			||||||
	# Create cmd line
 | 
						# Create cmd line
 | 
				
			||||||
@@ -105,12 +94,12 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
 | 
				
			|||||||
	
 | 
						
 | 
				
			||||||
	# check the dependency for this file :
 | 
						# check the dependency for this file :
 | 
				
			||||||
	if depend.need_re_build(file_dst, file_src, file_depend, file_cmd, cmdLine) == False:
 | 
						if depend.need_re_build(file_dst, file_src, file_depend, file_cmd, cmdLine) == False:
 | 
				
			||||||
		return file_dst
 | 
							return {"action":"add", "file":file_dst}
 | 
				
			||||||
	tools.create_directory_of_file(file_dst)
 | 
						tools.create_directory_of_file(file_dst)
 | 
				
			||||||
	comment = ["c++", name, "<==", file]
 | 
						comment = ["c++", name, "<==", file]
 | 
				
			||||||
	#process element
 | 
						#process element
 | 
				
			||||||
	multiprocess.run_in_pool(cmdLine, comment, file_cmd)
 | 
						multiprocess.run_in_pool(cmdLine, comment, file_cmd)
 | 
				
			||||||
	return file_dst
 | 
						return {"action":"add", "file":file_dst}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def get_version_compilation_flags(flags, dependency_flags):
 | 
					def get_version_compilation_flags(flags, dependency_flags):
 | 
				
			||||||
	try:
 | 
						try:
 | 
				
			||||||
							
								
								
									
										73
									
								
								lutin/z_builder/lutinBuilder_jar.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										73
									
								
								lutin/z_builder/lutinBuilder_jar.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,73 @@
 | 
				
			|||||||
 | 
					##
 | 
				
			||||||
 | 
					## Dynamic library builder
 | 
				
			||||||
 | 
					##
 | 
				
			||||||
 | 
					from lutin import multiprocess
 | 
				
			||||||
 | 
					from lutin import tools
 | 
				
			||||||
 | 
					from lutin import debug
 | 
				
			||||||
 | 
					from lutin import depend
 | 
				
			||||||
 | 
					from lutin import env
 | 
				
			||||||
 | 
					import os
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					##
 | 
				
			||||||
 | 
					## Initialize the builder, if needed ... to get dependency between builder (for example)
 | 
				
			||||||
 | 
					##
 | 
				
			||||||
 | 
					def init():
 | 
				
			||||||
 | 
						pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					##
 | 
				
			||||||
 | 
					## Get the current builder type.
 | 
				
			||||||
 | 
					## Return the type of builder
 | 
				
			||||||
 | 
					##
 | 
				
			||||||
 | 
					def get_type():
 | 
				
			||||||
 | 
						return "linker"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					##
 | 
				
			||||||
 | 
					## @brief Get builder input file type
 | 
				
			||||||
 | 
					## @return List of extention supported
 | 
				
			||||||
 | 
					##
 | 
				
			||||||
 | 
					def get_input_type():
 | 
				
			||||||
 | 
						return ["class"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					##
 | 
				
			||||||
 | 
					## @brief Get builder output file type
 | 
				
			||||||
 | 
					## @return List of extention supported
 | 
				
			||||||
 | 
					##
 | 
				
			||||||
 | 
					def get_output_type():
 | 
				
			||||||
 | 
						return ["jar"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					##
 | 
				
			||||||
 | 
					## @brief Commands for running gcc to link a shared library.
 | 
				
			||||||
 | 
					##
 | 
				
			||||||
 | 
					def link(file, binary, target, depancy, name, basic_folder):
 | 
				
			||||||
 | 
						file_src, file_dst, file_depend, file_cmd = target.generate_file(binary, name, basic_folder, file, "jar")
 | 
				
			||||||
 | 
						#create command Line
 | 
				
			||||||
 | 
						cmd = [
 | 
				
			||||||
 | 
							target.jar,
 | 
				
			||||||
 | 
							"cf", file_dst,
 | 
				
			||||||
 | 
							]
 | 
				
			||||||
 | 
						for file in file_src:
 | 
				
			||||||
 | 
							path = ""
 | 
				
			||||||
 | 
							for elem in ["org/", "com/"]:
 | 
				
			||||||
 | 
								pos = file.find(elem);
 | 
				
			||||||
 | 
								if pos > 0:
 | 
				
			||||||
 | 
									path = file[:pos]
 | 
				
			||||||
 | 
									file = file[pos:]
 | 
				
			||||||
 | 
							cmd.append("-C")
 | 
				
			||||||
 | 
							cmd.append(path)
 | 
				
			||||||
 | 
							cmd.append(file)
 | 
				
			||||||
 | 
						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:
 | 
				
			||||||
 | 
							return tmpList[1]
 | 
				
			||||||
 | 
						"""
 | 
				
			||||||
 | 
						tools.create_directory_of_file(file_dst)
 | 
				
			||||||
 | 
						debug.print_element("jar", name, "==>", file_dst)
 | 
				
			||||||
 | 
						multiprocess.run_command(cmdLine)
 | 
				
			||||||
 | 
						# write cmd line only after to prevent errors ...
 | 
				
			||||||
 | 
						multiprocess.store_command(cmdLine, file_cmd)
 | 
				
			||||||
 | 
						#debug.print_element("SharedLib", self.name, "==>", tmpList[1])
 | 
				
			||||||
 | 
						return file_dst
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										94
									
								
								lutin/z_builder/lutinBuilder_java.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										94
									
								
								lutin/z_builder/lutinBuilder_java.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,94 @@
 | 
				
			|||||||
 | 
					##
 | 
				
			||||||
 | 
					## Java builder
 | 
				
			||||||
 | 
					##
 | 
				
			||||||
 | 
					from lutin import multiprocess
 | 
				
			||||||
 | 
					from lutin import tools
 | 
				
			||||||
 | 
					from lutin import debug
 | 
				
			||||||
 | 
					from lutin import depend
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					##
 | 
				
			||||||
 | 
					## Initialize the builder, if needed ... to get dependency between builder (for example)
 | 
				
			||||||
 | 
					##
 | 
				
			||||||
 | 
					def init():
 | 
				
			||||||
 | 
						pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					##
 | 
				
			||||||
 | 
					## Get the current builder type.
 | 
				
			||||||
 | 
					## Return the type of builder
 | 
				
			||||||
 | 
					##
 | 
				
			||||||
 | 
					def get_type():
 | 
				
			||||||
 | 
						return "compiler"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					##
 | 
				
			||||||
 | 
					## @brief Get builder input file type
 | 
				
			||||||
 | 
					## @return List of extention supported
 | 
				
			||||||
 | 
					##
 | 
				
			||||||
 | 
					def get_input_type():
 | 
				
			||||||
 | 
						return ["java"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					##
 | 
				
			||||||
 | 
					## @brief Get builder output file type
 | 
				
			||||||
 | 
					## @return List of extention supported
 | 
				
			||||||
 | 
					##
 | 
				
			||||||
 | 
					def get_output_type():
 | 
				
			||||||
 | 
						return ["class"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					##
 | 
				
			||||||
 | 
					## @brief Commands for running gcc to compile a C++ file in object file.
 | 
				
			||||||
 | 
					##
 | 
				
			||||||
 | 
					def compile(file, binary, target, depancy, flags, path, name, basic_folder):
 | 
				
			||||||
 | 
						file_src = target.get_full_name_source(basic_folder, file)
 | 
				
			||||||
 | 
						file_cmd = target.get_full_name_cmd(name, basic_folder, file)
 | 
				
			||||||
 | 
						file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type(), remove_suffix=True)
 | 
				
			||||||
 | 
						file_depend = target.get_full_dependency(name, basic_folder, file)
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						# create the command line befor requesting start:
 | 
				
			||||||
 | 
						cmd = [
 | 
				
			||||||
 | 
							target.java,
 | 
				
			||||||
 | 
							"-d", target.get_build_folder(name)
 | 
				
			||||||
 | 
							]
 | 
				
			||||||
 | 
						# add source dependency:
 | 
				
			||||||
 | 
						list_sources_path = []
 | 
				
			||||||
 | 
						for view in ["export", "local"]:
 | 
				
			||||||
 | 
							try:
 | 
				
			||||||
 | 
								list = path[view]["java"]
 | 
				
			||||||
 | 
								for elem in list:
 | 
				
			||||||
 | 
									list_sources_path.append(elem)
 | 
				
			||||||
 | 
							except:
 | 
				
			||||||
 | 
								pass
 | 
				
			||||||
 | 
						if len(list_sources_path) > 0:
 | 
				
			||||||
 | 
							cmd.append("-sourcepath")
 | 
				
			||||||
 | 
							out = ""
 | 
				
			||||||
 | 
							for elem in list_sources_path:
 | 
				
			||||||
 | 
								if len(out) > 0:
 | 
				
			||||||
 | 
									out += ":"
 | 
				
			||||||
 | 
								out += elem
 | 
				
			||||||
 | 
							cmd.append(out)
 | 
				
			||||||
 | 
						class_extern = []
 | 
				
			||||||
 | 
						upper_jar = tools.filter_extention(depancy.src, ["jar"])
 | 
				
			||||||
 | 
						#debug.warning("ploppppp = " + str(upper_jar))
 | 
				
			||||||
 | 
						for elem in upper_jar:
 | 
				
			||||||
 | 
							class_extern.append(elem)
 | 
				
			||||||
 | 
						if len(class_extern) > 0:
 | 
				
			||||||
 | 
							cmd.append("-classpath")
 | 
				
			||||||
 | 
							out = ""
 | 
				
			||||||
 | 
							for elem in class_extern:
 | 
				
			||||||
 | 
								if len(out) > 0:
 | 
				
			||||||
 | 
									out += ":"
 | 
				
			||||||
 | 
								out += elem
 | 
				
			||||||
 | 
							cmd.append(out)
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						cmd.append(file_src)
 | 
				
			||||||
 | 
						# Create cmd line
 | 
				
			||||||
 | 
						cmdLine=tools.list_to_str(cmd)
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						# check the dependency for this file :
 | 
				
			||||||
 | 
						if depend.need_re_build(file_dst, file_src, file_depend, file_cmd, cmdLine) == False:
 | 
				
			||||||
 | 
							return {"action":"add", "file":file_dst}
 | 
				
			||||||
 | 
						tools.create_directory_of_file(file_dst)
 | 
				
			||||||
 | 
						comment = ["java", name, "<==", file]
 | 
				
			||||||
 | 
						#process element
 | 
				
			||||||
 | 
						multiprocess.run_in_pool(cmdLine, comment, file_cmd)
 | 
				
			||||||
 | 
						return {"action":"add", "file":file_dst}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										73
									
								
								lutin/z_builder/lutinBuilder_javah.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										73
									
								
								lutin/z_builder/lutinBuilder_javah.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,73 @@
 | 
				
			|||||||
 | 
					##
 | 
				
			||||||
 | 
					## Java builder
 | 
				
			||||||
 | 
					##
 | 
				
			||||||
 | 
					from lutin import multiprocess
 | 
				
			||||||
 | 
					from lutin import tools
 | 
				
			||||||
 | 
					from lutin import debug
 | 
				
			||||||
 | 
					from lutin import depend
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					##
 | 
				
			||||||
 | 
					## Initialize the builder, if needed ... to get dependency between builder (for example)
 | 
				
			||||||
 | 
					##
 | 
				
			||||||
 | 
					def init():
 | 
				
			||||||
 | 
						pass
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					##
 | 
				
			||||||
 | 
					## Get the current builder type.
 | 
				
			||||||
 | 
					## Return the type of builder
 | 
				
			||||||
 | 
					##
 | 
				
			||||||
 | 
					def get_type():
 | 
				
			||||||
 | 
						return "compiler"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					##
 | 
				
			||||||
 | 
					## @brief Get builder input file type
 | 
				
			||||||
 | 
					## @return List of extention supported
 | 
				
			||||||
 | 
					##
 | 
				
			||||||
 | 
					def get_input_type():
 | 
				
			||||||
 | 
						return ["javah"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					##
 | 
				
			||||||
 | 
					## @brief Get builder output file type
 | 
				
			||||||
 | 
					## @return List of extention supported
 | 
				
			||||||
 | 
					##
 | 
				
			||||||
 | 
					def get_output_type():
 | 
				
			||||||
 | 
						return ["h"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					##
 | 
				
			||||||
 | 
					## @brief Commands for running gcc to compile a C++ file in object file.
 | 
				
			||||||
 | 
					##
 | 
				
			||||||
 | 
					def compile(file, binary, target, depancy, flags, path, name, basic_folder):
 | 
				
			||||||
 | 
						# file_src = target.get_full_name_source(basic_folder, file)
 | 
				
			||||||
 | 
						file_cmd = target.get_full_name_cmd(name, basic_folder, file)
 | 
				
			||||||
 | 
						# file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type())
 | 
				
			||||||
 | 
						file_depend = target.get_full_dependency(name, basic_folder, file)
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						# create the command line befor requesting start:
 | 
				
			||||||
 | 
						cmd = [
 | 
				
			||||||
 | 
							target.javah,
 | 
				
			||||||
 | 
							"-d", target.get_build_folder(name) + target.folder_generate_code
 | 
				
			||||||
 | 
							]
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						if debug.get_level() >= 5:
 | 
				
			||||||
 | 
							cmd.append("-verbose")
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						cmd.append("-classpath")
 | 
				
			||||||
 | 
						cmd.append(target.get_build_folder(name))
 | 
				
			||||||
 | 
						class_to_build = file[:-6]
 | 
				
			||||||
 | 
						cmd.append(class_to_build)
 | 
				
			||||||
 | 
						# Create cmd line
 | 
				
			||||||
 | 
						cmdLine=tools.list_to_str(cmd)
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						file_dst = target.get_build_folder(name) + "/tmp_header/" + class_to_build.replace(".", "_") + ".h"
 | 
				
			||||||
 | 
						# check the dependency for this file :
 | 
				
			||||||
 | 
						#if depend.need_re_build(file_dst, file_src, file_depend, file_cmd, cmdLine) == False:
 | 
				
			||||||
 | 
						#	return file_dst
 | 
				
			||||||
 | 
						#tools.create_directory_of_file(file_dst)
 | 
				
			||||||
 | 
						comment = ["javah", class_to_build.replace(".", "_") + ".h", "<==", class_to_build]
 | 
				
			||||||
 | 
						#process element
 | 
				
			||||||
 | 
						multiprocess.run_in_pool(cmdLine, comment, file_cmd)
 | 
				
			||||||
 | 
						debug.verbose("file= " + file_dst)
 | 
				
			||||||
 | 
						#return file_dst
 | 
				
			||||||
 | 
						return {"action":"path", "path":target.get_build_folder(name) + target.folder_generate_code}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -26,7 +26,7 @@ def get_type():
 | 
				
			|||||||
## @return List of extention supported
 | 
					## @return List of extention supported
 | 
				
			||||||
##
 | 
					##
 | 
				
			||||||
def get_input_type():
 | 
					def get_input_type():
 | 
				
			||||||
	return ["o"]
 | 
						return ["o", "a"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
##
 | 
					##
 | 
				
			||||||
## @brief Get builder output file type
 | 
					## @brief Get builder output file type
 | 
				
			||||||
@@ -59,7 +59,8 @@ def link(file, binary, target, depancy, name, basic_folder):
 | 
				
			|||||||
	except:
 | 
						except:
 | 
				
			||||||
		pass
 | 
							pass
 | 
				
			||||||
	try:
 | 
						try:
 | 
				
			||||||
		cmd.append(depancy.src)
 | 
							# keep only compilated files ...
 | 
				
			||||||
 | 
							cmd.append(tools.filter_extention(depancy.src, get_input_type()))
 | 
				
			||||||
	except:
 | 
						except:
 | 
				
			||||||
		pass
 | 
							pass
 | 
				
			||||||
	try:
 | 
						try:
 | 
				
			||||||
@@ -98,3 +99,4 @@ def link(file, binary, target, depancy, name, basic_folder):
 | 
				
			|||||||
	# write cmd line only after to prevent errors ...
 | 
						# write cmd line only after to prevent errors ...
 | 
				
			||||||
	multiprocess.store_command(cmdLine, file_cmd)
 | 
						multiprocess.store_command(cmdLine, file_cmd)
 | 
				
			||||||
	#debug.print_element("SharedLib", self.name, "==>", tmpList[1])
 | 
						#debug.print_element("SharedLib", self.name, "==>", tmpList[1])
 | 
				
			||||||
 | 
						return file_dst
 | 
				
			||||||
@@ -26,7 +26,7 @@ def get_type():
 | 
				
			|||||||
## @return List of extention supported
 | 
					## @return List of extention supported
 | 
				
			||||||
##
 | 
					##
 | 
				
			||||||
def get_input_type():
 | 
					def get_input_type():
 | 
				
			||||||
	return ["o"]
 | 
						return ["o", "a"]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
##
 | 
					##
 | 
				
			||||||
## @brief Get builder output file type
 | 
					## @brief Get builder output file type
 | 
				
			||||||
@@ -42,7 +42,10 @@ def get_output_type():
 | 
				
			|||||||
## @brief Commands for running gcc to compile a m file in object file.
 | 
					## @brief Commands for running gcc to compile a m file in object file.
 | 
				
			||||||
##
 | 
					##
 | 
				
			||||||
def compile(file, binary, target, depancy, flags, path, name, basic_folder):
 | 
					def compile(file, binary, target, depancy, flags, path, name, basic_folder):
 | 
				
			||||||
	file_src, file_dst, file_depend, file_cmd = target.file_generate_object(binary, name, basic_folder, file)
 | 
						file_src = target.get_full_name_source(basic_folder, file)
 | 
				
			||||||
 | 
						file_cmd = target.get_full_name_cmd(name, basic_folder, file)
 | 
				
			||||||
 | 
						file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type())
 | 
				
			||||||
 | 
						file_depend = target.get_full_dependency(name, basic_folder, file)
 | 
				
			||||||
	# create the command line befor requesting start:
 | 
						# create the command line befor requesting start:
 | 
				
			||||||
	cmd = [
 | 
						cmd = [
 | 
				
			||||||
		target.cc,
 | 
							target.cc,
 | 
				
			||||||
@@ -50,18 +53,17 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
 | 
				
			|||||||
		target.arch,
 | 
							target.arch,
 | 
				
			||||||
		target.sysroot,
 | 
							target.sysroot,
 | 
				
			||||||
		target.global_include_cc]
 | 
							target.global_include_cc]
 | 
				
			||||||
	try:
 | 
						for view in ["export", "local"]:
 | 
				
			||||||
		cmd.append(tools.add_prefix("-I",path["export"]))
 | 
							for type in ["c", "m"]:
 | 
				
			||||||
	except:
 | 
								try:
 | 
				
			||||||
		pass
 | 
									cmd.append(tools.add_prefix("-I",path[view][type]))
 | 
				
			||||||
	try:
 | 
								except:
 | 
				
			||||||
		cmd.append(tools.add_prefix("-I",path["local"]))
 | 
									pass
 | 
				
			||||||
	except:
 | 
						for type in ["c", "m"]:
 | 
				
			||||||
		pass
 | 
							try:
 | 
				
			||||||
	try:
 | 
								cmd.append(tools.add_prefix("-I",depancy.path[type]))
 | 
				
			||||||
		cmd.append(tools.add_prefix("-I",depancy.path))
 | 
							except:
 | 
				
			||||||
	except:
 | 
								pass
 | 
				
			||||||
		pass
 | 
					 | 
				
			||||||
	try:
 | 
						try:
 | 
				
			||||||
		cmd.append(local_ref_on_builder_c.get_version_compilation_flags(flags, depancy.flags))
 | 
							cmd.append(local_ref_on_builder_c.get_version_compilation_flags(flags, depancy.flags))
 | 
				
			||||||
	except:
 | 
						except:
 | 
				
			||||||
@@ -74,30 +76,17 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
 | 
				
			|||||||
		cmd.append(target.global_flags_m)
 | 
							cmd.append(target.global_flags_m)
 | 
				
			||||||
	except:
 | 
						except:
 | 
				
			||||||
		pass
 | 
							pass
 | 
				
			||||||
	try:
 | 
						for type in ["c", "m"]:
 | 
				
			||||||
		cmd.append(depancy.flags["c"])
 | 
							try:
 | 
				
			||||||
	except:
 | 
								cmd.append(depancy.flags[type])
 | 
				
			||||||
		pass
 | 
							except:
 | 
				
			||||||
	try:
 | 
								pass
 | 
				
			||||||
		cmd.append(depancy.flags["m"])
 | 
						for view in ["local", "export"]:
 | 
				
			||||||
	except:
 | 
							for type in ["c", "m"]:
 | 
				
			||||||
		pass
 | 
								try:
 | 
				
			||||||
	try:
 | 
									cmd.append(flags[view][type])
 | 
				
			||||||
		cmd.append(flags["local"]["c"])
 | 
								except:
 | 
				
			||||||
	except:
 | 
									pass
 | 
				
			||||||
		pass
 | 
					 | 
				
			||||||
	try:
 | 
					 | 
				
			||||||
		cmd.append(flags["local"]["m"])
 | 
					 | 
				
			||||||
	except:
 | 
					 | 
				
			||||||
		pass
 | 
					 | 
				
			||||||
	try:
 | 
					 | 
				
			||||||
		cmd.append(flags["export"]["c"])
 | 
					 | 
				
			||||||
	except:
 | 
					 | 
				
			||||||
		pass
 | 
					 | 
				
			||||||
	try:
 | 
					 | 
				
			||||||
		cmd.append(flags["export"]["m"])
 | 
					 | 
				
			||||||
	except:
 | 
					 | 
				
			||||||
		pass
 | 
					 | 
				
			||||||
	cmd.append("-c -MMD -MP")
 | 
						cmd.append("-c -MMD -MP")
 | 
				
			||||||
	cmd.append("-x objective-c")
 | 
						cmd.append("-x objective-c")
 | 
				
			||||||
	cmd.append(file_src)
 | 
						cmd.append(file_src)
 | 
				
			||||||
@@ -105,10 +94,10 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
 | 
				
			|||||||
	cmdLine=tools.list_to_str(cmd)
 | 
						cmdLine=tools.list_to_str(cmd)
 | 
				
			||||||
	# check the dependency for this file :
 | 
						# check the dependency for this file :
 | 
				
			||||||
	if False==depend.need_re_build(file_dst, file_src, file_depend, file_cmd, cmdLine):
 | 
						if False==depend.need_re_build(file_dst, file_src, file_depend, file_cmd, cmdLine):
 | 
				
			||||||
		return file_dst
 | 
							return {"action":"add", "file":file_dst}
 | 
				
			||||||
	tools.create_directory_of_file(file_dst)
 | 
						tools.create_directory_of_file(file_dst)
 | 
				
			||||||
	comment = ["m", name, "<==", file]
 | 
						comment = ["m", name, "<==", file]
 | 
				
			||||||
	#process element
 | 
						#process element
 | 
				
			||||||
	multiprocess.run_in_pool(cmdLine, comment, file_cmd)
 | 
						multiprocess.run_in_pool(cmdLine, comment, file_cmd)
 | 
				
			||||||
	return file_dst
 | 
						return {"action":"add", "file":file_dst}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -42,7 +42,10 @@ def get_output_type():
 | 
				
			|||||||
## @brief Commands for running gcc to compile a m++ file in object file.
 | 
					## @brief Commands for running gcc to compile a m++ file in object file.
 | 
				
			||||||
##
 | 
					##
 | 
				
			||||||
def compile(file, binary, target, depancy, flags, path, name, basic_folder):
 | 
					def compile(file, binary, target, depancy, flags, path, name, basic_folder):
 | 
				
			||||||
	file_src, file_dst, file_depend, file_cmd = target.file_generate_object(binary, name, basic_folder, file)
 | 
						file_src = target.get_full_name_source(basic_folder, file)
 | 
				
			||||||
 | 
						file_cmd = target.get_full_name_cmd(name, basic_folder, file)
 | 
				
			||||||
 | 
						file_dst = target.get_full_name_destination(name, basic_folder, file, get_output_type())
 | 
				
			||||||
 | 
						file_depend = target.get_full_dependency(name, basic_folder, file)
 | 
				
			||||||
	# create the command line befor requesting start:
 | 
						# create the command line befor requesting start:
 | 
				
			||||||
	cmd = [
 | 
						cmd = [
 | 
				
			||||||
		target.xx,
 | 
							target.xx,
 | 
				
			||||||
@@ -50,18 +53,17 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
 | 
				
			|||||||
		target.arch,
 | 
							target.arch,
 | 
				
			||||||
		target.sysroot,
 | 
							target.sysroot,
 | 
				
			||||||
		target.global_include_cc]
 | 
							target.global_include_cc]
 | 
				
			||||||
	try:
 | 
						for view in ["export", "local"]:
 | 
				
			||||||
		cmd.append(tools.add_prefix("-I",path["export"]))
 | 
							for type in ["c", "c++", "m", "mm"]:
 | 
				
			||||||
	except:
 | 
								try:
 | 
				
			||||||
		pass
 | 
									cmd.append(tools.add_prefix("-I",path[view][type]))
 | 
				
			||||||
	try:
 | 
								except:
 | 
				
			||||||
		cmd.append(tools.add_prefix("-I",path["local"]))
 | 
									pass
 | 
				
			||||||
	except:
 | 
						for type in ["c", "c++", "m", "mm"]:
 | 
				
			||||||
		pass
 | 
							try:
 | 
				
			||||||
	try:
 | 
								cmd.append(tools.add_prefix("-I",depancy.path[type]))
 | 
				
			||||||
		cmd.append(tools.add_prefix("-I",depancy.path))
 | 
							except:
 | 
				
			||||||
	except:
 | 
								pass
 | 
				
			||||||
		pass
 | 
					 | 
				
			||||||
	try:
 | 
						try:
 | 
				
			||||||
		cmd.append(local_ref_on_builder_cpp.get_version_compilation_flags(flags, depancy.flags))
 | 
							cmd.append(local_ref_on_builder_cpp.get_version_compilation_flags(flags, depancy.flags))
 | 
				
			||||||
	except:
 | 
						except:
 | 
				
			||||||
@@ -74,42 +76,17 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
 | 
				
			|||||||
		cmd.append(target.global_flags_mm)
 | 
							cmd.append(target.global_flags_mm)
 | 
				
			||||||
	except:
 | 
						except:
 | 
				
			||||||
		pass
 | 
							pass
 | 
				
			||||||
	try:
 | 
						for type in ["c", "c++", "m", "mm"]:
 | 
				
			||||||
		cmd.append(depancy.flags["c"])
 | 
							try:
 | 
				
			||||||
	except:
 | 
								cmd.append(depancy.flags[type])
 | 
				
			||||||
		pass
 | 
							except:
 | 
				
			||||||
	try:
 | 
								pass
 | 
				
			||||||
		cmd.append(depancy.flags["c++"])
 | 
						for view in ["export", "local"]:
 | 
				
			||||||
	except:
 | 
							for type in ["c", "c++", "m", "mm"]:
 | 
				
			||||||
		pass
 | 
								try:
 | 
				
			||||||
	try:
 | 
									cmd.append(flags[view][type])
 | 
				
			||||||
		cmd.append(depancy.flags["mm"])
 | 
								except:
 | 
				
			||||||
	except:
 | 
									pass
 | 
				
			||||||
		pass
 | 
					 | 
				
			||||||
	try:
 | 
					 | 
				
			||||||
		cmd.append(flags["local"]["c"])
 | 
					 | 
				
			||||||
	except:
 | 
					 | 
				
			||||||
		pass
 | 
					 | 
				
			||||||
	try:
 | 
					 | 
				
			||||||
		cmd.append(flags["local"]["c++"])
 | 
					 | 
				
			||||||
	except:
 | 
					 | 
				
			||||||
		pass
 | 
					 | 
				
			||||||
	try:
 | 
					 | 
				
			||||||
		cmd.append(flags["local"]["mm"])
 | 
					 | 
				
			||||||
	except:
 | 
					 | 
				
			||||||
		pass
 | 
					 | 
				
			||||||
	try:
 | 
					 | 
				
			||||||
		cmd.append(flags["export"]["c"])
 | 
					 | 
				
			||||||
	except:
 | 
					 | 
				
			||||||
		pass
 | 
					 | 
				
			||||||
	try:
 | 
					 | 
				
			||||||
		cmd.append(flags["export"]["c++"])
 | 
					 | 
				
			||||||
	except:
 | 
					 | 
				
			||||||
		pass
 | 
					 | 
				
			||||||
	try:
 | 
					 | 
				
			||||||
		cmd.append(flags["export"]["mm"])
 | 
					 | 
				
			||||||
	except:
 | 
					 | 
				
			||||||
		pass
 | 
					 | 
				
			||||||
	cmd.append("-c -MMD -MP")
 | 
						cmd.append("-c -MMD -MP")
 | 
				
			||||||
	cmd.append("-x objective-c++")
 | 
						cmd.append("-x objective-c++")
 | 
				
			||||||
	cmd.append(file_src)
 | 
						cmd.append(file_src)
 | 
				
			||||||
@@ -117,9 +94,9 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
 | 
				
			|||||||
	cmdLine=tools.list_to_str(cmd)
 | 
						cmdLine=tools.list_to_str(cmd)
 | 
				
			||||||
	# check the dependency for this file :
 | 
						# check the dependency for this file :
 | 
				
			||||||
	if False==depend.need_re_build(file_dst, file_src, file_depend, file_cmd, cmdLine):
 | 
						if False==depend.need_re_build(file_dst, file_src, file_depend, file_cmd, cmdLine):
 | 
				
			||||||
		return file_dst
 | 
							return {"action":"add", "file":file_dst}
 | 
				
			||||||
	tools.create_directory_of_file(file_dst)
 | 
						tools.create_directory_of_file(file_dst)
 | 
				
			||||||
	comment = ["m++", name, "<==", file]
 | 
						comment = ["m++", name, "<==", file]
 | 
				
			||||||
	#process element
 | 
						#process element
 | 
				
			||||||
	multiprocess.run_in_pool(cmdLine, comment, file_cmd)
 | 
						multiprocess.run_in_pool(cmdLine, comment, file_cmd)
 | 
				
			||||||
	return file_dst
 | 
						return {"action":"add", "file":file_dst}
 | 
				
			||||||
							
								
								
									
										0
									
								
								lutin/z_system/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								lutin/z_system/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										115
									
								
								lutin/z_system/lutinSystem_Android_ADMOD.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										115
									
								
								lutin/z_system/lutinSystem_Android_ADMOD.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,115 @@
 | 
				
			|||||||
 | 
					#!/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="ADMOD: Android SDK ad-mod interface (auto-create interface for admod)\n"
 | 
				
			||||||
 | 
							# todo : Check if present ...
 | 
				
			||||||
 | 
							self.valid = True
 | 
				
			||||||
 | 
							# todo : create a searcher of the presence of the library:
 | 
				
			||||||
 | 
							self.add_export_SRC(target.folder_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)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					##################################################################
 | 
				
			||||||
 | 
					##
 | 
				
			||||||
 | 
					## Android specific section
 | 
				
			||||||
 | 
					##
 | 
				
			||||||
 | 
					##################################################################
 | 
				
			||||||
 | 
					def tool_generate_main_java_class(target, module, package_name):
 | 
				
			||||||
 | 
						if "ADMOD_ID" not in module.package_prop:
 | 
				
			||||||
 | 
							debug.warning("Missing parameter ADMOD_ID wen you resuested dependency of ADMOD")
 | 
				
			||||||
 | 
							return
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						module.package_prop["RIGHT"].append("INTERNET")
 | 
				
			||||||
 | 
						module.package_prop["RIGHT"].append("ACCESS_NETWORK_STATE")
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						module.pkg_add("GENERATE_SECTION__IMPORT", [
 | 
				
			||||||
 | 
							"import com.google.android.gms.ads.AdRequest;",
 | 
				
			||||||
 | 
							"import com.google.android.gms.ads.AdSize;",
 | 
				
			||||||
 | 
							"import com.google.android.gms.ads.AdView;",
 | 
				
			||||||
 | 
							"import android.widget.LinearLayout;",
 | 
				
			||||||
 | 
							"import android.widget.Button;"
 | 
				
			||||||
 | 
							])
 | 
				
			||||||
 | 
						module.pkg_add("GENERATE_SECTION__DECLARE", [
 | 
				
			||||||
 | 
							"/** The view to show the ad. */",
 | 
				
			||||||
 | 
							"private AdView adView;",
 | 
				
			||||||
 | 
							"private LinearLayout mLayout = null;"
 | 
				
			||||||
 | 
							])
 | 
				
			||||||
 | 
						list_create = [
 | 
				
			||||||
 | 
							"mLayout = new LinearLayout(this);"
 | 
				
			||||||
 | 
							"mLayout.setOrientation(android.widget.LinearLayout.VERTICAL);",
 | 
				
			||||||
 | 
							"LinearLayout.LayoutParams paramsWindows = new LinearLayout.LayoutParams(",
 | 
				
			||||||
 | 
							"	LinearLayout.LayoutParams.FILL_PARENT,",
 | 
				
			||||||
 | 
							"	LinearLayout.LayoutParams.FILL_PARENT);",
 | 
				
			||||||
 | 
							"",
 | 
				
			||||||
 | 
							"setContentView(mLayout, paramsWindows);",
 | 
				
			||||||
 | 
							"",
 | 
				
			||||||
 | 
							"LinearLayout.LayoutParams paramsAdds = new LinearLayout.LayoutParams(",
 | 
				
			||||||
 | 
							"	LinearLayout.LayoutParams.FILL_PARENT,",
 | 
				
			||||||
 | 
							"	LinearLayout.LayoutParams.WRAP_CONTENT);",
 | 
				
			||||||
 | 
							"paramsAdds.weight = 0;",
 | 
				
			||||||
 | 
							"",
 | 
				
			||||||
 | 
							"LinearLayout.LayoutParams paramsGLView = new LinearLayout.LayoutParams(",
 | 
				
			||||||
 | 
							"	LinearLayout.LayoutParams.FILL_PARENT,",
 | 
				
			||||||
 | 
							"	LinearLayout.LayoutParams.FILL_PARENT);",
 | 
				
			||||||
 | 
							"paramsGLView.weight = 1;",
 | 
				
			||||||
 | 
							"paramsGLView.height = 0;",
 | 
				
			||||||
 | 
							"",
 | 
				
			||||||
 | 
							"mLayout.setGravity(android.view.Gravity.TOP);",
 | 
				
			||||||
 | 
							"",
 | 
				
			||||||
 | 
							"// Create an adds.",
 | 
				
			||||||
 | 
							"adView = new AdView(this);",
 | 
				
			||||||
 | 
							"adView.setAdSize(AdSize.SMART_BANNER);",
 | 
				
			||||||
 | 
							"adView.setAdUnitId(\"" + module.package_prop["ADMOD_ID"] + "\");",
 | 
				
			||||||
 | 
							"",
 | 
				
			||||||
 | 
							"// Create an ad request. Check logcat output for the hashed device ID to get test ads on a physical device.",
 | 
				
			||||||
 | 
							"AdRequest adRequest = new AdRequest.Builder()",
 | 
				
			||||||
 | 
							"	.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)",
 | 
				
			||||||
 | 
							"	.build();",
 | 
				
			||||||
 | 
							"",
 | 
				
			||||||
 | 
							"// Add the AdView to the view hierarchy. The view will have no size until the ad is loaded."]
 | 
				
			||||||
 | 
							if     "ADMOD_POSITION" in module.package_prop \
 | 
				
			||||||
 | 
							   and module.package_prop["ADMOD_POSITION"] == "top":
 | 
				
			||||||
 | 
								list_create.append("mLayout.addView(adView, paramsAdds);")
 | 
				
			||||||
 | 
								list_create.append("mLayout.addView(mGLView, paramsGLView);")
 | 
				
			||||||
 | 
							else:
 | 
				
			||||||
 | 
								list_create.append("mLayout.addView(mGLView, paramsGLView);")
 | 
				
			||||||
 | 
								list_create.append("mLayout.addView(adView, paramsAdds);")
 | 
				
			||||||
 | 
							list_create.append("")
 | 
				
			||||||
 | 
							list_create.append("// Start loading the ad in the background.")
 | 
				
			||||||
 | 
							list_create.append("adView.loadAd(adRequest);")
 | 
				
			||||||
 | 
						module.pkg_add("GENERATE_SECTION__ON_CREATE", list_create)
 | 
				
			||||||
 | 
						module.pkg_add("GENERATE_SECTION__ON_RESUME", [
 | 
				
			||||||
 | 
							"if (adView != null) {",
 | 
				
			||||||
 | 
							"	adView.resume();",
 | 
				
			||||||
 | 
							"}"
 | 
				
			||||||
 | 
							])
 | 
				
			||||||
 | 
						module.pkg_add("GENERATE_SECTION__ON_PAUSE", [
 | 
				
			||||||
 | 
							"if (adView != null) {",
 | 
				
			||||||
 | 
							"	adView.pause();",
 | 
				
			||||||
 | 
							"}"
 | 
				
			||||||
 | 
							])
 | 
				
			||||||
 | 
						module.pkg_add("GENERATE_SECTION__ON_DESTROY", [
 | 
				
			||||||
 | 
							"// Destroy the AdView.",
 | 
				
			||||||
 | 
							"if (adView != null) {",
 | 
				
			||||||
 | 
							"	adView.destroy();",
 | 
				
			||||||
 | 
							"}"
 | 
				
			||||||
 | 
							])
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										28
									
								
								lutin/z_system/lutinSystem_Android_SDK.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								lutin/z_system/lutinSystem_Android_SDK.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="SDK: Android SDK basic interface java\n"
 | 
				
			||||||
 | 
							# 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.folder_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")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -13,7 +13,7 @@ from lutin import tools
 | 
				
			|||||||
import os
 | 
					import os
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class System(system.System):
 | 
					class System(system.System):
 | 
				
			||||||
	def __init__(self):
 | 
						def __init__(self, target):
 | 
				
			||||||
		system.System.__init__(self)
 | 
							system.System.__init__(self)
 | 
				
			||||||
		# create some HELP:
 | 
							# create some HELP:
 | 
				
			||||||
		self.help="CoreAudio : Ios interface for audio (all time present, just system interface)"
 | 
							self.help="CoreAudio : Ios interface for audio (all time present, just system interface)"
 | 
				
			||||||
@@ -13,7 +13,7 @@ from lutin import tools
 | 
				
			|||||||
import os
 | 
					import os
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class System(system.System):
 | 
					class System(system.System):
 | 
				
			||||||
	def __init__(self):
 | 
						def __init__(self, target):
 | 
				
			||||||
		system.System.__init__(self)
 | 
							system.System.__init__(self)
 | 
				
			||||||
		# create some HELP:
 | 
							# create some HELP:
 | 
				
			||||||
		self.help="ALSA : Advanced Linux Sound Architecture\n Can be install with the package:\n    - libasound2-dev"
 | 
							self.help="ALSA : Advanced Linux Sound Architecture\n Can be install with the package:\n    - libasound2-dev"
 | 
				
			||||||
@@ -13,7 +13,7 @@ from lutin import tools
 | 
				
			|||||||
import os
 | 
					import os
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class System(system.System):
 | 
					class System(system.System):
 | 
				
			||||||
	def __init__(self):
 | 
						def __init__(self, target):
 | 
				
			||||||
		system.System.__init__(self)
 | 
							system.System.__init__(self)
 | 
				
			||||||
		# create some HELP:
 | 
							# create some HELP:
 | 
				
			||||||
		self.help="BOOST : Boost interface (need when we have not all c++ feature\n Can be install with the package:\n    - libboost-all-dev"
 | 
							self.help="BOOST : Boost interface (need when we have not all c++ feature\n Can be install with the package:\n    - libboost-all-dev"
 | 
				
			||||||
@@ -13,7 +13,7 @@ from lutin import tools
 | 
				
			|||||||
import os
 | 
					import os
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class System(system.System):
 | 
					class System(system.System):
 | 
				
			||||||
	def __init__(self):
 | 
						def __init__(self, target):
 | 
				
			||||||
		system.System.__init__(self)
 | 
							system.System.__init__(self)
 | 
				
			||||||
		# create some HELP:
 | 
							# create some HELP:
 | 
				
			||||||
		self.help="JACK : Jack Low-Latency Audio Server\n Can be install with the package:\n    - libjack-jackd2-dev (new)\n    - libjack-dev (old)"
 | 
							self.help="JACK : Jack Low-Latency Audio Server\n Can be install with the package:\n    - libjack-jackd2-dev (new)\n    - libjack-dev (old)"
 | 
				
			||||||
@@ -13,7 +13,7 @@ from lutin import tools
 | 
				
			|||||||
import os
 | 
					import os
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class System(system.System):
 | 
					class System(system.System):
 | 
				
			||||||
	def __init__(self):
 | 
						def __init__(self, target):
 | 
				
			||||||
		system.System.__init__(self)
 | 
							system.System.__init__(self)
 | 
				
			||||||
		# create some HELP:
 | 
							# create some HELP:
 | 
				
			||||||
		self.help="OSS : Linux Open Sound System\n Can be install with the package:\n    - ... TODO ..."
 | 
							self.help="OSS : Linux Open Sound System\n Can be install with the package:\n    - ... TODO ..."
 | 
				
			||||||
@@ -13,7 +13,7 @@ from lutin import tools
 | 
				
			|||||||
import os
 | 
					import os
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class System(system.System):
 | 
					class System(system.System):
 | 
				
			||||||
	def __init__(self):
 | 
						def __init__(self, target):
 | 
				
			||||||
		system.System.__init__(self)
 | 
							system.System.__init__(self)
 | 
				
			||||||
		# create some HELP:
 | 
							# create some HELP:
 | 
				
			||||||
		self.help="PULSE : The Linux PulseAudio\n Can be install with the package:\n    - libpulse-dev"
 | 
							self.help="PULSE : The Linux PulseAudio\n Can be install with the package:\n    - libpulse-dev"
 | 
				
			||||||
@@ -13,7 +13,7 @@ from lutin import tools
 | 
				
			|||||||
import os
 | 
					import os
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class System(system.System):
 | 
					class System(system.System):
 | 
				
			||||||
	def __init__(self):
 | 
						def __init__(self, target):
 | 
				
			||||||
		system.System.__init__(self)
 | 
							system.System.__init__(self)
 | 
				
			||||||
		# create some HELP:
 | 
							# create some HELP:
 | 
				
			||||||
		self.help="Z : z library \n Can be install with the package:\n    - zlib1g-dev"
 | 
							self.help="Z : z library \n Can be install with the package:\n    - zlib1g-dev"
 | 
				
			||||||
@@ -13,7 +13,7 @@ from lutin import tools
 | 
				
			|||||||
import os
 | 
					import os
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class System(system.System):
 | 
					class System(system.System):
 | 
				
			||||||
	def __init__(self):
 | 
						def __init__(self, target):
 | 
				
			||||||
		system.System.__init__(self)
 | 
							system.System.__init__(self)
 | 
				
			||||||
		# create some HELP:
 | 
							# create some HELP:
 | 
				
			||||||
		self.help="CoreAudio : MacOs interface for audio (all time present, just system interface)"
 | 
							self.help="CoreAudio : MacOs interface for audio (all time present, just system interface)"
 | 
				
			||||||
							
								
								
									
										0
									
								
								lutin/z_system/lutinSystem_Windows_asio.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								lutin/z_system/lutinSystem_Windows_asio.py
									
									
									
									
									
										Normal file
									
								
							@@ -13,7 +13,7 @@ from lutin import tools
 | 
				
			|||||||
import os
 | 
					import os
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class System(system.System):
 | 
					class System(system.System):
 | 
				
			||||||
	def __init__(self):
 | 
						def __init__(self, target):
 | 
				
			||||||
		system.System.__init__(self)
 | 
							system.System.__init__(self)
 | 
				
			||||||
		# create some HELP:
 | 
							# create some HELP:
 | 
				
			||||||
		self.help="DirectSound : Direct sound API for windows audio interface"
 | 
							self.help="DirectSound : Direct sound API for windows audio interface"
 | 
				
			||||||
							
								
								
									
										0
									
								
								lutin/z_target/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								lutin/z_target/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										446
									
								
								lutin/z_target/lutinTarget_Android.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										446
									
								
								lutin/z_target/lutinTarget_Android.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,446 @@
 | 
				
			|||||||
 | 
					#!/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 target
 | 
				
			||||||
 | 
					from lutin import tools
 | 
				
			||||||
 | 
					from lutin import image
 | 
				
			||||||
 | 
					from lutin import multiprocess
 | 
				
			||||||
 | 
					from lutin import host
 | 
				
			||||||
 | 
					import os
 | 
				
			||||||
 | 
					import sys
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class Target(target.Target):
 | 
				
			||||||
 | 
						def __init__(self, config):
 | 
				
			||||||
 | 
							#processor type selection (auto/arm/ppc/x86)
 | 
				
			||||||
 | 
							if config["arch"] == "auto":
 | 
				
			||||||
 | 
								config["arch"] = "arm"
 | 
				
			||||||
 | 
							#bus size selection (auto/32/64)
 | 
				
			||||||
 | 
							if config["bus-size"] == "auto":
 | 
				
			||||||
 | 
								config["bus-size"] = "32"
 | 
				
			||||||
 | 
							arch = ""
 | 
				
			||||||
 | 
							target.Target.__init__(self, "Android", config, arch)
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							if config["bus-size"] == "32":
 | 
				
			||||||
 | 
								arch="armv7"
 | 
				
			||||||
 | 
							else:
 | 
				
			||||||
 | 
								arch="arm64"
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							self.folder_ndk = os.getenv('PROJECT_NDK', "AUTO")
 | 
				
			||||||
 | 
							self.folder_sdk = os.getenv('PROJECT_SDK', "AUTO")
 | 
				
			||||||
 | 
							# auto search NDK
 | 
				
			||||||
 | 
							if self.folder_ndk == "AUTO":
 | 
				
			||||||
 | 
								for folder in os.listdir("."):
 | 
				
			||||||
 | 
									if os.path.isdir(folder)==True:
 | 
				
			||||||
 | 
										if folder=="android":
 | 
				
			||||||
 | 
											self.folder_ndk = folder + "/ndk"
 | 
				
			||||||
 | 
								if self.folder_ndk == "AUTO":
 | 
				
			||||||
 | 
									self.folder_ndk = tools.get_run_folder() + "/../android/ndk"
 | 
				
			||||||
 | 
							# auto search SDK
 | 
				
			||||||
 | 
							if self.folder_sdk == "AUTO":
 | 
				
			||||||
 | 
								for folder in os.listdir("."):
 | 
				
			||||||
 | 
									if os.path.isdir(folder)==True:
 | 
				
			||||||
 | 
										if folder=="android":
 | 
				
			||||||
 | 
											self.folder_sdk = folder + "/sdk"
 | 
				
			||||||
 | 
								if self.folder_sdk == "AUTO":
 | 
				
			||||||
 | 
									self.folder_sdk = tools.get_run_folder() + "/../android/sdk"
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							if not os.path.isdir(self.folder_ndk):
 | 
				
			||||||
 | 
								debug.error("NDK path not set !!! set env : PROJECT_NDK on the NDK path")
 | 
				
			||||||
 | 
							if not os.path.isdir(self.folder_sdk):
 | 
				
			||||||
 | 
								debug.error("SDK path not set !!! set env : PROJECT_SDK on the SDK path")
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							tmpOsVal = "64"
 | 
				
			||||||
 | 
							gccVersion = "4.9"
 | 
				
			||||||
 | 
							if host.BUS_SIZE==64:
 | 
				
			||||||
 | 
								tmpOsVal = "_64"
 | 
				
			||||||
 | 
							if self.config["compilator"] == "clang":
 | 
				
			||||||
 | 
								self.set_cross_base(self.folder_ndk + "/toolchains/llvm-3.6/prebuilt/linux-x86" + tmpOsVal + "/bin/")
 | 
				
			||||||
 | 
							else:
 | 
				
			||||||
 | 
								baseFolderArm = self.folder_ndk + "/toolchains/arm-linux-androideabi-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/"
 | 
				
			||||||
 | 
								baseFolderMips = self.folder_ndk + "/toolchains/mipsel-linux-android-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/"
 | 
				
			||||||
 | 
								baseFolderX86 = self.folder_ndk + "/toolchains/x86-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/"
 | 
				
			||||||
 | 
								self.set_cross_base(baseFolderArm + "arm-linux-androideabi-")
 | 
				
			||||||
 | 
								if not os.path.isdir(baseFolderArm):
 | 
				
			||||||
 | 
									debug.error("Gcc Arm path does not exist !!!")
 | 
				
			||||||
 | 
								if not os.path.isdir(baseFolderMips):
 | 
				
			||||||
 | 
									debug.info("Gcc Mips path does not exist !!!")
 | 
				
			||||||
 | 
								if not os.path.isdir(baseFolderX86):
 | 
				
			||||||
 | 
									debug.info("Gcc x86 path does not exist !!!")
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							self.folder_bin="/mustNotCreateBinary"
 | 
				
			||||||
 | 
							self.folder_lib="/data/lib/armeabi"
 | 
				
			||||||
 | 
							self.folder_data="/data/assets"
 | 
				
			||||||
 | 
							self.folder_doc="/doc"
 | 
				
			||||||
 | 
							self.suffix_package='.pkg'
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							# board id at 14 is for android 4.0 and more ...
 | 
				
			||||||
 | 
							self.boardId = 14
 | 
				
			||||||
 | 
							self.global_flags_cc.append("-D__ANDROID_BOARD_ID__=" + str(self.boardId))
 | 
				
			||||||
 | 
							if arch == "armv5" or arch == "armv7":
 | 
				
			||||||
 | 
								self.global_include_cc.append("-I" + self.folder_ndk +"/platforms/android-" + str(self.boardId) + "/arch-arm/usr/include/")
 | 
				
			||||||
 | 
							elif arch == "mips":
 | 
				
			||||||
 | 
								self.global_include_cc.append("-I" + self.folder_ndk +"/platforms/android-" + str(self.boardId) + "/arch-mips/usr/include/")
 | 
				
			||||||
 | 
							elif arch == "x86":
 | 
				
			||||||
 | 
								self.global_include_cc.append("-I" + self.folder_ndk +"/platforms/android-" + str(self.boardId) + "/arch-x86/usr/include/")
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							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.folder_ndk +"/sources/android/support/include")
 | 
				
			||||||
 | 
									self.global_include_cc.append("-I" + self.folder_ndk +"/sources/android/support/include")
 | 
				
			||||||
 | 
									self.global_include_cc.append("-I" + self.folder_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/include/")
 | 
				
			||||||
 | 
									if arch == "armv5":
 | 
				
			||||||
 | 
										stdCppBasePath = self.folder_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.folder_ndk +"/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/"
 | 
				
			||||||
 | 
										self.global_flags_ld.append(         stdCppBasePath + "thumb/libc++_static.a")
 | 
				
			||||||
 | 
										self.global_flags_ld.append("-target armv7-none-linux-androideabi")
 | 
				
			||||||
 | 
										self.global_flags_ld.append("-Wl,--fix-cortex-a8")
 | 
				
			||||||
 | 
										self.global_flags_ld.append("-Wl,--no-warn-mismatch")
 | 
				
			||||||
 | 
										self.global_flags_ld.append("-lm_hard")
 | 
				
			||||||
 | 
									elif arch == "mips":
 | 
				
			||||||
 | 
										stdCppBasePath = self.folder_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.folder_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.folder_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/include/")
 | 
				
			||||||
 | 
									self.global_include_cc.append("-I" + self.folder_ndk +"/sources/android/support/include/")
 | 
				
			||||||
 | 
									if arch == "armv5":
 | 
				
			||||||
 | 
										stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/libs/armeabi/"
 | 
				
			||||||
 | 
										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.folder_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.folder_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.folder_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.folder_ndk +"/sources/cxx-stl/system/include/")
 | 
				
			||||||
 | 
								self.global_include_cc.append("-I" + self.folder_ndk +"/sources/cxx-stl/stlport/stlport/")
 | 
				
			||||||
 | 
								self.global_flags_ld.append(self.folder_ndk +"/platforms/android-" + str(self.boardId) + "/arch-arm/usr/lib/libstdc++.a")
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							self.global_sysroot = "--sysroot=" + self.folder_ndk +"/platforms/android-" + str(self.boardId) + "/arch-arm"
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							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":
 | 
				
			||||||
 | 
								if self.arch == "armv5":
 | 
				
			||||||
 | 
									# -----------------------
 | 
				
			||||||
 | 
									# -- arm V5 :
 | 
				
			||||||
 | 
									# -----------------------
 | 
				
			||||||
 | 
									self.global_flags_cc.append("-march=armv5te")
 | 
				
			||||||
 | 
									self.global_flags_cc.append("-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__")
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							# 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")
 | 
				
			||||||
 | 
							# -----------------------
 | 
				
			||||||
 | 
							# -- Common flags :
 | 
				
			||||||
 | 
							# -----------------------
 | 
				
			||||||
 | 
							self.global_flags_cc.append("-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")
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						def check_right_package(self, pkgProperties, value):
 | 
				
			||||||
 | 
							for val in pkgProperties["RIGHT"]:
 | 
				
			||||||
 | 
								if value == val:
 | 
				
			||||||
 | 
									return True
 | 
				
			||||||
 | 
							return False
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						def get_staging_folder_data(self, binaryName):
 | 
				
			||||||
 | 
							return self.get_staging_folder(binaryName) + self.folder_data
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						def make_package(self, pkgName, pkgProperties, basePkgPath, heritage):
 | 
				
			||||||
 | 
							# http://alp.developpez.com/tutoriels/debian/creer-paquet/
 | 
				
			||||||
 | 
							debug.debug("------------------------------------------------------------------------")
 | 
				
			||||||
 | 
							debug.info("Generate package '" + pkgName + "'")
 | 
				
			||||||
 | 
							debug.debug("------------------------------------------------------------------------")
 | 
				
			||||||
 | 
							pkgNameApplicationName = pkgName
 | 
				
			||||||
 | 
							if self.config["mode"] == "debug":
 | 
				
			||||||
 | 
								pkgNameApplicationName += "debug"
 | 
				
			||||||
 | 
							# FINAL_FOLDER_JAVA_PROJECT
 | 
				
			||||||
 | 
							self.folder_javaProject=   self.get_staging_folder(pkgName) \
 | 
				
			||||||
 | 
							                         + "/src/" \
 | 
				
			||||||
 | 
							                         + pkgProperties["COMPAGNY_TYPE"] \
 | 
				
			||||||
 | 
							                         + "/" + pkgProperties["COMPAGNY_NAME2"] \
 | 
				
			||||||
 | 
							                         + "/" + pkgNameApplicationName + "/"
 | 
				
			||||||
 | 
							#FINAL_FILE_ABSTRACTION
 | 
				
			||||||
 | 
							self.file_finalAbstraction = self.folder_javaProject + "/" + pkgNameApplicationName + ".java"
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							compleatePackageName = pkgProperties["COMPAGNY_TYPE"]+"."+pkgProperties["COMPAGNY_NAME2"]+"." + pkgNameApplicationName
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							if "ADMOD_ID" in pkgProperties:
 | 
				
			||||||
 | 
								pkgProperties["RIGHT"].append("INTERNET")
 | 
				
			||||||
 | 
								pkgProperties["RIGHT"].append("ACCESS_NETWORK_STATE")
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							debug.print_element("pkg", "absractionFile", "<==", "dynamic file")
 | 
				
			||||||
 | 
							# Create folder :
 | 
				
			||||||
 | 
							tools.create_directory_of_file(self.file_finalAbstraction)
 | 
				
			||||||
 | 
							# Create file :
 | 
				
			||||||
 | 
							# java ==> done by ewol wrapper ... (and compiled in the normal compilation system ==> must be find in the dependency list of jar ...
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							tools.create_directory_of_file(self.get_staging_folder(pkgName) + "/res/drawable/icon.png");
 | 
				
			||||||
 | 
							if     "ICON" in pkgProperties.keys() \
 | 
				
			||||||
 | 
							   and pkgProperties["ICON"] != "":
 | 
				
			||||||
 | 
								image.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/res/drawable/icon.png", 256, 256)
 | 
				
			||||||
 | 
							else:
 | 
				
			||||||
 | 
								# to be sure that we have all time a resource ...
 | 
				
			||||||
 | 
								tmpFile = open(self.get_staging_folder(pkgName) + "/res/drawable/plop.txt", 'w')
 | 
				
			||||||
 | 
								tmpFile.write('plop\n')
 | 
				
			||||||
 | 
								tmpFile.flush()
 | 
				
			||||||
 | 
								tmpFile.close()
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							if pkgProperties["ANDROID_MANIFEST"]!="":
 | 
				
			||||||
 | 
								debug.print_element("pkg", "AndroidManifest.xml", "<==", pkgProperties["ANDROID_MANIFEST"])
 | 
				
			||||||
 | 
								tools.copy_file(pkgProperties["ANDROID_MANIFEST"], self.get_staging_folder(pkgName) + "/AndroidManifest.xml", force=True)
 | 
				
			||||||
 | 
							else:
 | 
				
			||||||
 | 
								debug.error("missing parameter 'ANDROID_MANIFEST' in the properties ... ")
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							#add properties on wallpaper : 
 | 
				
			||||||
 | 
							# myModule.pkg_add("ANDROID_WALLPAPER_PROPERTIES", ["list", key, title, summary, [["key","value display"],["key2","value display 2"]])
 | 
				
			||||||
 | 
							# myModule.pkg_add("ANDROID_WALLPAPER_PROPERTIES", ["list", "testpattern", "Select test pattern", "Choose which test pattern to display", [["key","value display"],["key2","value display 2"]]])
 | 
				
			||||||
 | 
							# myModule.pkg_add("ANDROID_WALLPAPER_PROPERTIES", ["bool", key, title, summary, ["enable string", "disable String"])
 | 
				
			||||||
 | 
							# myModule.pkg_add("ANDROID_WALLPAPER_PROPERTIES", ["bool", "movement", "Motion", "Apply movement to test pattern", ["Moving test pattern", "Still test pattern"]
 | 
				
			||||||
 | 
							#copy needed resources :
 | 
				
			||||||
 | 
							for res_source, res_dest in pkgProperties["ANDROID_RESOURCES"]:
 | 
				
			||||||
 | 
								if res_source == "":
 | 
				
			||||||
 | 
									continue
 | 
				
			||||||
 | 
								tools.copy_file(res_source , self.get_staging_folder(pkgName) + "/res/" + res_dest + "/" + os.path.basename(res_source), force=True)
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							# Doc :
 | 
				
			||||||
 | 
							# 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(self.get_staging_folder(pkgName) + "/src/noFile")
 | 
				
			||||||
 | 
							androidToolPath = self.folder_sdk + "/build-tools/"
 | 
				
			||||||
 | 
							# find android tool version
 | 
				
			||||||
 | 
							dirnames = tools.get_list_sub_folder(androidToolPath)
 | 
				
			||||||
 | 
							if len(dirnames) != 1:
 | 
				
			||||||
 | 
								debug.error("an error occured when getting the tools for android")
 | 
				
			||||||
 | 
							androidToolPath += dirnames[0] + "/"
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							# this is to create resource file for android ... (we did not use aset in jar with ewol ...
 | 
				
			||||||
 | 
							adModResouceFolder = ""
 | 
				
			||||||
 | 
							if "ADMOD_ID" in pkgProperties:
 | 
				
			||||||
 | 
								adModResouceFolder = " -S " + self.folder_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/res/ "
 | 
				
			||||||
 | 
							cmdLine = androidToolPath + "aapt p -f " \
 | 
				
			||||||
 | 
							          + "-M " + self.get_staging_folder(pkgName) + "/AndroidManifest.xml " \
 | 
				
			||||||
 | 
							          + "-F " + self.get_staging_folder(pkgName) + "/resources.res " \
 | 
				
			||||||
 | 
							          + "-I " + self.folder_sdk + "/platforms/android-" + str(self.boardId) + "/android.jar "\
 | 
				
			||||||
 | 
							          + "-S " + self.get_staging_folder(pkgName) + "/res/ " \
 | 
				
			||||||
 | 
							          + adModResouceFolder \
 | 
				
			||||||
 | 
							          + "-J " + self.get_staging_folder(pkgName) + "/src/ "
 | 
				
			||||||
 | 
							multiprocess.run_command(cmdLine)
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							tools.create_directory_of_file(self.get_staging_folder(pkgName) + "/build/classes/noFile")
 | 
				
			||||||
 | 
							debug.print_element("pkg", "*.class", "<==", "*.java")
 | 
				
			||||||
 | 
							#generate android java files:
 | 
				
			||||||
 | 
							filesString=""
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							"""
 | 
				
			||||||
 | 
							old : 
 | 
				
			||||||
 | 
							if "ADMOD_ID" in pkgProperties:
 | 
				
			||||||
 | 
								# TODO : check this I do not think it is really usefull ... ==> write for IDE only ...
 | 
				
			||||||
 | 
								filesString += self.folder_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/src/android/UnusedStub.java "
 | 
				
			||||||
 | 
							if len(pkgProperties["ANDROID_WALLPAPER_PROPERTIES"])!=0:
 | 
				
			||||||
 | 
								filesString += self.folder_javaProject + pkgNameApplicationName + "Settings.java "
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							adModJarFile = ""
 | 
				
			||||||
 | 
							if "ADMOD_ID" in pkgProperties:
 | 
				
			||||||
 | 
								adModJarFile = ":" + self.folder_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar"
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							cmdLine = "javac " \
 | 
				
			||||||
 | 
							          + "-d " + self.get_staging_folder(pkgName) + "/build/classes " \
 | 
				
			||||||
 | 
							          + "-classpath " + self.folder_sdk + "/platforms/android-" + str(self.boardId) + "/android.jar" \
 | 
				
			||||||
 | 
							          + adModJarFile + " " \
 | 
				
			||||||
 | 
							          + filesString \
 | 
				
			||||||
 | 
							          + self.file_finalAbstraction + " "  \
 | 
				
			||||||
 | 
							          + self.get_staging_folder(pkgName) + "/src/R.java "
 | 
				
			||||||
 | 
							multiprocess.run_command(cmdLine)
 | 
				
			||||||
 | 
							"""
 | 
				
			||||||
 | 
							debug.verbose("heritage .so=" + str(tools.filter_extention(heritage.src, ["so"])))
 | 
				
			||||||
 | 
							debug.verbose("heritage .jar=" + str(tools.filter_extention(heritage.src, ["jar"])))
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							class_extern = ""
 | 
				
			||||||
 | 
							upper_jar = tools.filter_extention(heritage.src, ["jar"])
 | 
				
			||||||
 | 
							#debug.warning("ploppppp = " + str(upper_jar))
 | 
				
			||||||
 | 
							for elem in upper_jar:
 | 
				
			||||||
 | 
								if len(class_extern) > 0:
 | 
				
			||||||
 | 
									class_extern += ":"
 | 
				
			||||||
 | 
								class_extern += elem
 | 
				
			||||||
 | 
							# create enpoint element :
 | 
				
			||||||
 | 
							cmdLine = "javac " \
 | 
				
			||||||
 | 
							          + "-d " + self.get_staging_folder(pkgName) + "/build/classes " \
 | 
				
			||||||
 | 
							          + "-classpath " + class_extern + " " \
 | 
				
			||||||
 | 
							          + self.get_staging_folder(pkgName) + "/src/R.java "
 | 
				
			||||||
 | 
							multiprocess.run_command(cmdLine)
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							debug.print_element("pkg", ".dex", "<==", "*.class")
 | 
				
			||||||
 | 
							cmdLine = androidToolPath + "dx " \
 | 
				
			||||||
 | 
							          + "--dex --no-strict " \
 | 
				
			||||||
 | 
							          + "--output=" + self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + ".dex " \
 | 
				
			||||||
 | 
							          + self.get_staging_folder(pkgName) + "/build/classes/ "
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							if "ADMOD_ID" in pkgProperties:
 | 
				
			||||||
 | 
								cmdLine += self.folder_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar "
 | 
				
			||||||
 | 
							# add element to dexification:
 | 
				
			||||||
 | 
							for elem in upper_jar:
 | 
				
			||||||
 | 
								# remove android sdk:
 | 
				
			||||||
 | 
								if elem[-len("android.jar"):] != "android.jar":
 | 
				
			||||||
 | 
									cmdLine += elem + " "
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							multiprocess.run_command(cmdLine)
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							debug.print_element("pkg", ".apk", "<==", ".dex, assets, .so, res")
 | 
				
			||||||
 | 
							#builderDebug="-agentlib:jdwp=transport=dt_socket,server=y,address=8050,suspend=y "
 | 
				
			||||||
 | 
							builderDebug=""
 | 
				
			||||||
 | 
							# note : set -u not signed application...
 | 
				
			||||||
 | 
							#+ ":" + self.folder_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar "
 | 
				
			||||||
 | 
							cmdLine =   "java -Xmx128M " \
 | 
				
			||||||
 | 
							          + " -classpath " + self.folder_sdk + "/tools/lib/sdklib.jar " \
 | 
				
			||||||
 | 
							          + builderDebug \
 | 
				
			||||||
 | 
							          + " com.android.sdklib.build.ApkBuilderMain " \
 | 
				
			||||||
 | 
							          + self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \
 | 
				
			||||||
 | 
							          + " -u " \
 | 
				
			||||||
 | 
							          + " -z " + self.get_staging_folder(pkgName) + "/resources.res " \
 | 
				
			||||||
 | 
							          + " -f " + self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + ".dex " \
 | 
				
			||||||
 | 
							          + " -rf " + self.get_staging_folder(pkgName) + "/data "
 | 
				
			||||||
 | 
							multiprocess.run_command(cmdLine)
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							# doc :
 | 
				
			||||||
 | 
							# http://developer.android.com/tools/publishing/app-signing.html
 | 
				
			||||||
 | 
							# Create a key for signing your application:
 | 
				
			||||||
 | 
							# keytool -genkeypair -v -keystore AndroidKey.jks -storepass Pass__AndroidDebugKey -alias alias__AndroidDebugKey -keypass PassKey__AndroidDebugKey -keyalg RSA -validity 36500
 | 
				
			||||||
 | 
							if self.config["mode"] == "debug":
 | 
				
			||||||
 | 
								debug.print_element("pkg", ".apk(signed debug)", "<==", ".apk (not signed)")
 | 
				
			||||||
 | 
								# verbose mode : 
 | 
				
			||||||
 | 
								#debugOption = "-verbose -certs "
 | 
				
			||||||
 | 
								debugOption = ""
 | 
				
			||||||
 | 
								cmdLine = "jarsigner " \
 | 
				
			||||||
 | 
								    + debugOption \
 | 
				
			||||||
 | 
								    + "-keystore " + tools.get_current_path(__file__) + "/AndroidDebugKey.jks " \
 | 
				
			||||||
 | 
								    + " -sigalg SHA1withRSA -digestalg SHA1 " \
 | 
				
			||||||
 | 
								    + " -storepass Pass__AndroidDebugKey " \
 | 
				
			||||||
 | 
								    + " -keypass PassKey__AndroidDebugKey " \
 | 
				
			||||||
 | 
								    + self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \
 | 
				
			||||||
 | 
								    + " alias__AndroidDebugKey"
 | 
				
			||||||
 | 
								multiprocess.run_command(cmdLine)
 | 
				
			||||||
 | 
								tmpFile = open("tmpPass.boo", 'w')
 | 
				
			||||||
 | 
								tmpFile.write("\n")
 | 
				
			||||||
 | 
								tmpFile.flush()
 | 
				
			||||||
 | 
								tmpFile.close()
 | 
				
			||||||
 | 
							else:
 | 
				
			||||||
 | 
								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 " + basePkgPath + "/AndroidKey.jks " \
 | 
				
			||||||
 | 
								    + " -sigalg SHA1withRSA -digestalg SHA1 " \
 | 
				
			||||||
 | 
								    + self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \
 | 
				
			||||||
 | 
								    + " " + pkgNameApplicationName
 | 
				
			||||||
 | 
								multiprocess.run_command(cmdLine)
 | 
				
			||||||
 | 
								cmdLine = "jarsigner " \
 | 
				
			||||||
 | 
								    + " -verify -verbose -certs " \
 | 
				
			||||||
 | 
								    + " -sigalg SHA1withRSA -digestalg SHA1 " \
 | 
				
			||||||
 | 
								    + self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk "
 | 
				
			||||||
 | 
								multiprocess.run_command(cmdLine)
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							debug.print_element("pkg", ".apk(aligned)", "<==", ".apk (not aligned)")
 | 
				
			||||||
 | 
							tools.remove_file(self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk")
 | 
				
			||||||
 | 
							# verbose mode : -v
 | 
				
			||||||
 | 
							cmdLine = androidToolPath + "zipalign 4 " \
 | 
				
			||||||
 | 
							          + self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \
 | 
				
			||||||
 | 
							          + self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk "
 | 
				
			||||||
 | 
							multiprocess.run_command(cmdLine)
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							# copy file in the final stage :
 | 
				
			||||||
 | 
							tools.copy_file(self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk",
 | 
				
			||||||
 | 
							                self.get_final_folder() + "/" + pkgNameApplicationName + ".apk",
 | 
				
			||||||
 | 
							                force=True)
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						def install_package(self, pkgName):
 | 
				
			||||||
 | 
							debug.debug("------------------------------------------------------------------------")
 | 
				
			||||||
 | 
							debug.info("Install package '" + pkgName + "'")
 | 
				
			||||||
 | 
							debug.debug("------------------------------------------------------------------------")
 | 
				
			||||||
 | 
							pkgNameApplicationName = pkgName
 | 
				
			||||||
 | 
							if self.config["mode"] == "debug":
 | 
				
			||||||
 | 
								pkgNameApplicationName += "debug"
 | 
				
			||||||
 | 
							cmdLine = self.folder_sdk + "/platform-tools/adb install -r " \
 | 
				
			||||||
 | 
							          + self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk "
 | 
				
			||||||
 | 
							multiprocess.run_command(cmdLine)
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						def un_install_package(self, pkgName):
 | 
				
			||||||
 | 
							debug.debug("------------------------------------------------------------------------")
 | 
				
			||||||
 | 
							debug.info("Un-Install package '" + pkgName + "'")
 | 
				
			||||||
 | 
							debug.debug("------------------------------------------------------------------------")
 | 
				
			||||||
 | 
							pkgNameApplicationName = pkgName
 | 
				
			||||||
 | 
							if self.config["mode"] == "debug":
 | 
				
			||||||
 | 
								pkgNameApplicationName += "debug"
 | 
				
			||||||
 | 
							cmdLine = self.folder_sdk + "/platform-tools/adb uninstall " + pkgNameApplicationName
 | 
				
			||||||
 | 
							Rmultiprocess.run_command(cmdLine)
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						def Log(self, pkgName):
 | 
				
			||||||
 | 
							debug.debug("------------------------------------------------------------------------")
 | 
				
			||||||
 | 
							debug.info("logcat of android board")
 | 
				
			||||||
 | 
							debug.debug("------------------------------------------------------------------------")
 | 
				
			||||||
 | 
							debug.info("cmd: " + self.folder_sdk + "/platform-tools/adb shell logcat ")
 | 
				
			||||||
 | 
							cmdLine = self.folder_sdk + "/platform-tools/adb shell logcat "
 | 
				
			||||||
 | 
							multiprocess.run_command(cmdLine)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -62,6 +62,7 @@ class Target(target.Target):
 | 
				
			|||||||
			self.global_flags_ld.append("-miphoneos-version-min=8.0")
 | 
								self.global_flags_ld.append("-miphoneos-version-min=8.0")
 | 
				
			||||||
			self.global_flags_cc.append("-miphoneos-version-min=8.0")
 | 
								self.global_flags_cc.append("-miphoneos-version-min=8.0")
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
 | 
							self.global_flags_cc.append("-D__STDCPP_LLVM__")
 | 
				
			||||||
		self.global_flags_ld.append([
 | 
							self.global_flags_ld.append([
 | 
				
			||||||
			"-Xlinker",
 | 
								"-Xlinker",
 | 
				
			||||||
			"-objc_abi_version",
 | 
								"-objc_abi_version",
 | 
				
			||||||
@@ -315,7 +316,10 @@ class Target(target.Target):
 | 
				
			|||||||
			tmpFile.write("<plist version=\"1.0\">\n")
 | 
								tmpFile.write("<plist version=\"1.0\">\n")
 | 
				
			||||||
			tmpFile.write("    <dict>\n")
 | 
								tmpFile.write("    <dict>\n")
 | 
				
			||||||
			tmpFile.write("        <key>application-identifier</key>\n")
 | 
								tmpFile.write("        <key>application-identifier</key>\n")
 | 
				
			||||||
			tmpFile.write("        <string>" + pkgProperties["APPLE_APPLICATION_IOS_ID"] + "." + pkgProperties["COMPAGNY_TYPE"] + "." + pkgProperties["COMPAGNY_NAME2"] + "." + pkgName + "</string>\n")
 | 
								try:
 | 
				
			||||||
 | 
									tmpFile.write("        <string>" + pkgProperties["APPLE_APPLICATION_IOS_ID"] + "." + pkgProperties["COMPAGNY_TYPE"] + "." + pkgProperties["COMPAGNY_NAME2"] + "." + pkgName + "</string>\n")
 | 
				
			||||||
 | 
								except:
 | 
				
			||||||
 | 
									debug.error("Missing package property : APPLE_APPLICATION_IOS_ID")
 | 
				
			||||||
			tmpFile.write("        <key>get-task-allow</key>\n")
 | 
								tmpFile.write("        <key>get-task-allow</key>\n")
 | 
				
			||||||
			tmpFile.write("        <true/>\n")
 | 
								tmpFile.write("        <true/>\n")
 | 
				
			||||||
			tmpFile.write("        <key>keychain-access-groups</key>\n")
 | 
								tmpFile.write("        <key>keychain-access-groups</key>\n")
 | 
				
			||||||
@@ -33,6 +33,8 @@ class Target(target.Target):
 | 
				
			|||||||
			if host.BUS_SIZE != 32:
 | 
								if host.BUS_SIZE != 32:
 | 
				
			||||||
				self.global_flags_cc.append("-m32")
 | 
									self.global_flags_cc.append("-m32")
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
 | 
							self.global_flags_cc.append("-D__STDCPP_GNU__")
 | 
				
			||||||
 | 
						
 | 
				
			||||||
	def generate_list_separate_coma(self, list):
 | 
						def generate_list_separate_coma(self, list):
 | 
				
			||||||
		result = ""
 | 
							result = ""
 | 
				
			||||||
		fistTime = True
 | 
							fistTime = True
 | 
				
			||||||
@@ -11,8 +11,10 @@ from lutin import debug
 | 
				
			|||||||
from lutin import target
 | 
					from lutin import target
 | 
				
			||||||
from lutin import tools
 | 
					from lutin import tools
 | 
				
			||||||
from lutin import host
 | 
					from lutin import host
 | 
				
			||||||
 | 
					from lutin import multiprocess
 | 
				
			||||||
import os
 | 
					import os
 | 
				
			||||||
import stat
 | 
					import stat
 | 
				
			||||||
 | 
					import shutil
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Target(target.Target):
 | 
					class Target(target.Target):
 | 
				
			||||||
	def __init__(self, config):
 | 
						def __init__(self, config):
 | 
				
			||||||
@@ -36,6 +38,8 @@ class Target(target.Target):
 | 
				
			|||||||
		self.suffix_binary=''
 | 
							self.suffix_binary=''
 | 
				
			||||||
		self.suffix_package=''
 | 
							self.suffix_package=''
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
 | 
							self.global_flags_cc.append("-D__STDCPP_LLVM__")
 | 
				
			||||||
 | 
							
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	def get_staging_folder(self, binaryName):
 | 
						def get_staging_folder(self, binaryName):
 | 
				
			||||||
		return tools.get_run_folder() + self.folder_out + self.folder_staging + "/" + binaryName + ".app/Contents/"
 | 
							return tools.get_run_folder() + self.folder_out + self.folder_staging + "/" + binaryName + ".app/Contents/"
 | 
				
			||||||
@@ -82,23 +86,52 @@ class Target(target.Target):
 | 
				
			|||||||
		tmpFile.flush()
 | 
							tmpFile.flush()
 | 
				
			||||||
		tmpFile.close()
 | 
							tmpFile.close()
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		# Must create the tarball of the application 
 | 
							# Create a simple interface to localy install the aplication for the shell (a shell command line interface)
 | 
				
			||||||
		#cd $(TARGET_OUT_FINAL)/; tar -cf $(PROJECT_NAME).tar $(PROJECT_NAME).app
 | 
							shell_file_name=self.get_staging_folder(pkgName) + "/shell/" + pkgName
 | 
				
			||||||
		#cd $(TARGET_OUT_FINAL)/; tar -czf $(PROJECT_NAME).tar.gz $(PROJECT_NAME).app
 | 
							# Create the info file
 | 
				
			||||||
 | 
							tools.create_directory_of_file(shell_file_name)
 | 
				
			||||||
 | 
							tmpFile = open(shell_file_name, 'w')
 | 
				
			||||||
 | 
							tmpFile.write("#!/bin/bash\n")
 | 
				
			||||||
 | 
							tmpFile.write("# Simply open the real application in the correct way (a link does not work ...)\n")
 | 
				
			||||||
 | 
							tmpFile.write("/Applications/" + pkgName + ".app/Contents/MacOS/" + pkgName + " $*\n")
 | 
				
			||||||
 | 
							#tmpFile.write("open -n /Applications/edn.app --args -AppCommandLineArg $*\n")
 | 
				
			||||||
 | 
							tmpFile.flush()
 | 
				
			||||||
 | 
							tmpFile.close()
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							# Must create the disk image of the application 
 | 
				
			||||||
 | 
							debug.info("Generate disk image for '" + pkgName + "'")
 | 
				
			||||||
 | 
							output_file_name = self.get_final_folder() + "/" + pkgName + ".dmg"
 | 
				
			||||||
 | 
							cmd = "hdiutil create -volname "
 | 
				
			||||||
 | 
							cmd += pkgName + " -srcfolder "
 | 
				
			||||||
 | 
							cmd += tools.get_run_folder() + self.folder_out + self.folder_staging + "/" + pkgName + ".app"
 | 
				
			||||||
 | 
							cmd += " -ov -format UDZO "
 | 
				
			||||||
 | 
							cmd += output_file_name
 | 
				
			||||||
 | 
							tools.create_directory_of_file(output_file_name)
 | 
				
			||||||
 | 
							multiprocess.run_command_direct(cmd)
 | 
				
			||||||
 | 
							debug.info("disk image: " + output_file_name)
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							debug.info("You can have an shell interface by executing : ")
 | 
				
			||||||
 | 
							debug.info("    sudo cp " + shell_file_name + " /usr/local/bin")
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	def install_package(self, pkgName):
 | 
						def install_package(self, pkgName):
 | 
				
			||||||
		debug.debug("------------------------------------------------------------------------")
 | 
							debug.debug("------------------------------------------------------------------------")
 | 
				
			||||||
		debug.info("Install package '" + pkgName + "'")
 | 
							debug.info("Install package '" + pkgName + "'")
 | 
				
			||||||
		debug.debug("------------------------------------------------------------------------")
 | 
							debug.debug("------------------------------------------------------------------------")
 | 
				
			||||||
		debug.warning("    ==> TODO")
 | 
							debug.info("copy " + tools.get_run_folder() + self.folder_out + self.folder_staging + "/" + pkgName + ".app in /Applications/")
 | 
				
			||||||
		#sudo dpkg -i $(TARGET_OUT_FINAL)/$(PROJECT_NAME) + self.suffix_package
 | 
							if os.path.exists("/Applications/" + pkgName + ".app") == True:
 | 
				
			||||||
 | 
								shutil.rmtree("/Applications/" + pkgName + ".app")
 | 
				
			||||||
 | 
							# copy the application in the basic application folder : /Applications/xxx.app
 | 
				
			||||||
 | 
							shutil.copytree(tools.get_run_folder() + self.folder_out + self.folder_staging + "/" + pkgName + ".app", "/Applications/" + pkgName + ".app")
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	def un_install_package(self, pkgName):
 | 
						def un_install_package(self, pkgName):
 | 
				
			||||||
		debug.debug("------------------------------------------------------------------------")
 | 
							debug.debug("------------------------------------------------------------------------")
 | 
				
			||||||
		debug.info("Un-Install package '" + pkgName + "'")
 | 
							debug.info("Un-Install package '" + pkgName + "'")
 | 
				
			||||||
		debug.debug("------------------------------------------------------------------------")
 | 
							debug.debug("------------------------------------------------------------------------")
 | 
				
			||||||
		debug.warning("    ==> TODO")
 | 
							debug.info("remove OLD application /Applications/" + pkgName + ".app")
 | 
				
			||||||
		#sudo dpkg -r $(TARGET_OUT_FINAL)/$(PROJECT_NAME) + self.suffix_package
 | 
							# Remove the application in the basic application folder : /Applications/xxx.app
 | 
				
			||||||
 | 
							if os.path.exists("/Applications/" + pkgName + ".app") == True:
 | 
				
			||||||
 | 
								shutil.rmtree("/Applications/" + pkgName + ".app")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -59,6 +59,7 @@ class Target(target.Target):
 | 
				
			|||||||
		self.suffix_lib_dynamic='.dll'
 | 
							self.suffix_lib_dynamic='.dll'
 | 
				
			||||||
		self.suffix_binary='.exe'
 | 
							self.suffix_binary='.exe'
 | 
				
			||||||
		self.suffix_package=''
 | 
							self.suffix_package=''
 | 
				
			||||||
 | 
							self.global_flags_cc.append("-D__STDCPP_GNU__")
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	def get_staging_folder_data(self, binaryName):
 | 
						def get_staging_folder_data(self, binaryName):
 | 
				
			||||||
							
								
								
									
										12
									
								
								setup.py
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								setup.py
									
									
									
									
									
								
							@@ -7,7 +7,7 @@ def readme():
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
 | 
					# https://pypi.python.org/pypi?%3Aaction=list_classifiers
 | 
				
			||||||
setup(name='lutin',
 | 
					setup(name='lutin',
 | 
				
			||||||
      version='0.5.7',
 | 
					      version='0.6.2',
 | 
				
			||||||
      description='Lutin generic builder',
 | 
					      description='Lutin generic builder',
 | 
				
			||||||
      long_description=readme(),
 | 
					      long_description=readme(),
 | 
				
			||||||
      url='http://github.com/HeeroYui/lutin',
 | 
					      url='http://github.com/HeeroYui/lutin',
 | 
				
			||||||
@@ -15,10 +15,9 @@ setup(name='lutin',
 | 
				
			|||||||
      author_email='yui.heero@gmail.com',
 | 
					      author_email='yui.heero@gmail.com',
 | 
				
			||||||
      license='APACHE-2',
 | 
					      license='APACHE-2',
 | 
				
			||||||
      packages=['lutin',
 | 
					      packages=['lutin',
 | 
				
			||||||
                'lutin/builder',
 | 
					                'lutin/z_builder',
 | 
				
			||||||
                'lutin/system',
 | 
					                'lutin/z_system',
 | 
				
			||||||
                'lutin/target'
 | 
					                'lutin/z_target'],
 | 
				
			||||||
               ],
 | 
					 | 
				
			||||||
      classifiers=[
 | 
					      classifiers=[
 | 
				
			||||||
        'Development Status :: 3 - Alpha',
 | 
					        'Development Status :: 3 - Alpha',
 | 
				
			||||||
        'License :: OSI Approved :: Apache Software License',
 | 
					        'License :: OSI Approved :: Apache Software License',
 | 
				
			||||||
@@ -27,6 +26,9 @@ setup(name='lutin',
 | 
				
			|||||||
      ],
 | 
					      ],
 | 
				
			||||||
      keywords='builder c++ c android ios macos makefile cmake',
 | 
					      keywords='builder c++ c android ios macos makefile cmake',
 | 
				
			||||||
      scripts=['bin/lutin'],
 | 
					      scripts=['bin/lutin'],
 | 
				
			||||||
 | 
					      data_file=[
 | 
				
			||||||
 | 
					          ('/etc/bash_completion.d', ['bash-autocompletion/lutin']),
 | 
				
			||||||
 | 
					      ],
 | 
				
			||||||
      include_package_data = True,
 | 
					      include_package_data = True,
 | 
				
			||||||
      zip_safe=False)
 | 
					      zip_safe=False)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user