Compare commits

...

15 Commits
0.2.0 ... 0.4.0

20 changed files with 576 additions and 165 deletions

View File

@@ -1,4 +1,12 @@
#!/usr/bin/python #!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
# for path inspection: # for path inspection:
import sys import sys
import os import os
@@ -21,11 +29,14 @@ myLutinArg.add(lutinArg.ArgDefine("j", "jobs", haveParam=True, desc="Specifies t
myLutinArg.add(lutinArg.ArgDefine("s", "force-strip", desc="Force the stripping of the compile elements")) myLutinArg.add(lutinArg.ArgDefine("s", "force-strip", desc="Force the stripping of the compile elements"))
myLutinArg.add_section("properties", "keep in the sequency of the cible") myLutinArg.add_section("properties", "keep in the sequency of the cible")
myLutinArg.add(lutinArg.ArgDefine("t", "target", list=[["Android",""],["Linux",""],["MacOs",""],["IOs",""],["Windows",""]], desc="Select a target (by default the platform is the computer that compile this")) myLutinArg.add(lutinArg.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'"))
myLutinArg.add(lutinArg.ArgDefine("c", "compilator", list=[["clang",""],["gcc",""]], desc="Compile with clang or Gcc mode (by default gcc will be used)")) myLutinArg.add(lutinArg.ArgDefine("c", "compilator", list=[["clang",""],["gcc",""]], desc="Compile with clang or Gcc mode (by default gcc will be used)"))
myLutinArg.add(lutinArg.ArgDefine("m", "mode", list=[["debug",""],["release",""]], desc="Compile in release or debug mode (default release)")) myLutinArg.add(lutinArg.ArgDefine("m", "mode", list=[["debug",""],["release",""]], desc="Compile in release or debug mode (default release)"))
myLutinArg.add(lutinArg.ArgDefine("a", "arch", list=[["auto","Automatic choice"],["arm","Arm processer"],["x86","Generic PC : AMD/Intel"],["ppc","Power PC"]], desc="Architecture to compile"))
myLutinArg.add(lutinArg.ArgDefine("b", "bus", list=[["auto","Automatic choice"],["32","32 bits"],["64","64 bits"]], desc="Adressing size (Bus size)"))
myLutinArg.add(lutinArg.ArgDefine("r", "prj", desc="Use external project management (not build with lutin...")) myLutinArg.add(lutinArg.ArgDefine("r", "prj", desc="Use external project management (not build with lutin..."))
myLutinArg.add(lutinArg.ArgDefine("p", "package", desc="Disable the package generation (usefull when just compile for test on linux ...)")) myLutinArg.add(lutinArg.ArgDefine("p", "package", desc="Disable the package generation (usefull when just compile for test on linux ...)"))
myLutinArg.add(lutinArg.ArgDefine("g", "gcov", desc="Enable code coverage intrusion in code"))
myLutinArg.add(lutinArg.ArgDefine("", "simulation", desc="simulater mode (availlable only for IOS)")) myLutinArg.add(lutinArg.ArgDefine("", "simulation", desc="simulater mode (availlable only for IOS)"))
myLutinArg.add(lutinArg.ArgDefine("", "list-target", desc="list all availlables targets ==> for auto completion")) myLutinArg.add(lutinArg.ArgDefine("", "list-target", desc="list all availlables targets ==> for auto completion"))
myLutinArg.add(lutinArg.ArgDefine("", "list-module", desc="list all availlables module ==> for auto completion")) myLutinArg.add(lutinArg.ArgDefine("", "list-module", desc="list all availlables module ==> for auto completion"))
@@ -124,50 +135,63 @@ import lutinTools
def Start(): def Start():
#available target : Linux / MacOs / Windows / Android ... #available target : Linux / MacOs / Windows / Android ...
targetName=lutinHost.OS targetName=lutinHost.OS
#compilation base config = {
compilator="gcc" "compilator":"gcc",
# build mode "mode":"release",
mode="release" "bus-size":"auto",
# package generationMode "arch":"auto",
generatePackage=True "generate-package":True,
"simulation":False,
"extern-build":False,
"gcov":False
}
# load the default target : # load the default target :
target = None target = None
simulationMode=False
actionDone=False actionDone=False
#build with extern tool
externBuild=False
# parse all argument # parse all argument
for argument in localArgument: for argument in localArgument:
if True==parseGenericArg(argument, False): if True==parseGenericArg(argument, False):
continue continue
elif argument.get_option_nName() == "package": elif argument.get_option_nName() == "package":
generatePackage=False config["generate-package"]=False
elif argument.get_option_nName() == "simulation": elif argument.get_option_nName() == "simulation":
simulationMode=True config["simulation"]=True
elif argument.get_option_nName() == "gcov":
config["gcov"]=True
elif argument.get_option_nName() == "prj": elif argument.get_option_nName() == "prj":
externBuild=True config["extern-build"]=True
elif argument.get_option_nName() == "bus":
config["bus-size"]=argument.get_arg()
elif argument.get_option_nName() == "arch":
config["arch"]=argument.get_arg()
elif argument.get_option_nName() == "compilator": elif argument.get_option_nName() == "compilator":
if compilator!=argument.get_arg(): if config["compilator"] != argument.get_arg():
debug.debug("change compilator ==> " + argument.get_arg()) debug.debug("change compilator ==> " + argument.get_arg())
compilator=argument.get_arg() config["compilator"] = argument.get_arg()
#remove previous target #remove previous target
target = None target = None
elif argument.get_option_nName() == "target": elif argument.get_option_nName() == "target":
# No check input ==> this will be verify automaticly chen the target will be loaded # No check input ==> this will be verify automaticly chen the target will be loaded
if targetName!=argument.get_arg(): if targetName!=argument.get_arg():
targetName=argument.get_arg() targetName=argument.get_arg()
debug.debug("change target ==> " + targetName + " & reset mode : gcc&release") debug.debug("change target ==> '" + targetName + "' & reset mode : gcc&release")
#reset properties by defauult: #reset properties by defauult:
compilator="gcc" config = {
mode="release" "compilator":"gcc",
generatePackage=True "mode":"release",
simulationMode=False "bus-size":"auto",
"arch":"auto",
"generate-package":True,
"simulation":False,
"extern-build":False,
"gcov":False
}
#remove previous target #remove previous target
target = None target = None
elif argument.get_option_nName() == "mode": elif argument.get_option_nName() == "mode":
if mode!=argument.get_arg(): if config["mode"]!=argument.get_arg():
mode = argument.get_arg() config["mode"] = argument.get_arg()
debug.debug("change mode ==> " + mode) debug.debug("change mode ==> " + config["mode"])
#remove previous target #remove previous target
target = None target = None
else: else:
@@ -177,14 +201,14 @@ def Start():
else: else:
#load the target if needed : #load the target if needed :
if target == None: if target == None:
target = lutinTarget.target_load(targetName, compilator, mode, generatePackage, externBuild, simulationMode) target = lutinTarget.load_target(targetName, config)
target.build(argument.get_arg()) target.build(argument.get_arg())
actionDone=True actionDone=True
# if no action done : we do "all" ... # if no action done : we do "all" ...
if actionDone==False: if actionDone==False:
#load the target if needed : #load the target if needed :
if target == None: if target == None:
target = lutinTarget.target_load(targetName, compilator, mode, generatePackage, externBuild, simulationMode) target = lutinTarget.load_target(targetName, config)
target.build("all") target.build("all")
# stop all started threads # stop all started threads
lutinMultiprocess.un_init() lutinMultiprocess.un_init()
@@ -208,6 +232,7 @@ if __name__ == '__main__':
and folder.lower()!="out" : and folder.lower()!="out" :
debug.debug("Automatic load path: '" + folder + "'") debug.debug("Automatic load path: '" + folder + "'")
lutinModule.import_path(folder) lutinModule.import_path(folder)
lutinTarget.import_path(folder)
Start() Start()

View File

@@ -1,4 +1,12 @@
#!/usr/bin/python #!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import sys import sys
import lutinDebug as debug import lutinDebug as debug

View File

@@ -1,8 +1,17 @@
#!/usr/bin/python #!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import os import os
import thread import thread
import lutinMultiprocess import lutinMultiprocess
import threading import threading
import re
debugLevel=3 debugLevel=3
debugColor=False debugColor=False
@@ -41,45 +50,51 @@ def enable_color():
global color_cyan global color_cyan
color_cyan = "\033[36m" color_cyan = "\033[36m"
def verbose(input): def verbose(input, force=False):
global debugLock global debugLock
global debugLevel global debugLevel
if debugLevel >= 5: if debugLevel >= 5 \
or force == True:
debugLock.acquire() debugLock.acquire()
print(color_blue + input + color_default) print(color_blue + input + color_default)
debugLock.release() debugLock.release()
def debug(input): def debug(input, force=False):
global debugLock global debugLock
global debugLevel global debugLevel
if debugLevel >= 4: if debugLevel >= 4 \
or force == True:
debugLock.acquire() debugLock.acquire()
print(color_green + input + color_default) print(color_green + input + color_default)
debugLock.release() debugLock.release()
def info(input): def info(input, force=False):
global debugLock global debugLock
global debugLevel global debugLevel
if debugLevel >= 3: if debugLevel >= 3 \
or force == True:
debugLock.acquire() debugLock.acquire()
print(input + color_default) print(input + color_default)
debugLock.release() debugLock.release()
def warning(input): def warning(input, force=False):
global debugLock global debugLock
global debugLevel global debugLevel
if debugLevel >= 2: if debugLevel >= 2 \
or force == True:
debugLock.acquire() debugLock.acquire()
print(color_purple + "[WARNING] " + input + color_default) print(color_purple + "[WARNING] " + input + color_default)
debugLock.release() debugLock.release()
def error(input, threadID=-1): def error(input, threadID=-1, force=False, crash=True):
global debugLock global debugLock
global debugLevel global debugLevel
if debugLevel >= 1: if debugLevel >= 1 \
or force == True:
debugLock.acquire() debugLock.acquire()
print(color_red + "[ERROR] " + input + color_default) print(color_red + "[ERROR] " + input + color_default)
debugLock.release() debugLock.release()
if crash==True:
lutinMultiprocess.error_occured() lutinMultiprocess.error_occured()
if threadID != -1: if threadID != -1:
thread.interrupt_main() thread.interrupt_main()
@@ -87,12 +102,28 @@ def error(input, threadID=-1):
#os_exit(-1) #os_exit(-1)
#raise "error happend" #raise "error happend"
def print_element(type, lib, dir, name): def print_element(type, lib, dir, name, force=False):
global debugLock global debugLock
global debugLevel global debugLevel
if debugLevel >= 3: if debugLevel >= 3 \
or force == True:
debugLock.acquire() debugLock.acquire()
print(color_cyan + type + color_default + " : " + color_yellow + lib + color_default + " " + dir + " " + color_blue + name + color_default) print(color_cyan + type + color_default + " : " + color_yellow + lib + color_default + " " + dir + " " + color_blue + name + color_default)
debugLock.release() debugLock.release()
def print_compilator(myString):
global debugColor
global debugLock
if debugColor == True:
myString = myString.replace('\\n', '\n')
myString = myString.replace('\\t', '\t')
myString = myString.replace('error:', color_red+'error:'+color_default)
myString = myString.replace('warning:', color_purple+'warning:'+color_default)
myString = myString.replace('note:', color_green+'note:'+color_default)
myString = re.sub(r'([/\w_-]+\.\w+):', r'-COLORIN-\1-COLOROUT-:', myString)
myString = myString.replace('-COLORIN-', color_yellow)
myString = myString.replace('-COLOROUT-', color_default)
debugLock.acquire()
print(myString)
debugLock.release()

View File

@@ -1,4 +1,12 @@
#!/usr/bin/python #!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import os import os
import lutinDebug as debug import lutinDebug as debug
import lutinEnv as environement import lutinEnv as environement
@@ -21,6 +29,11 @@ def need_re_build(dst, src, dependFile=None, file_cmd="", cmdLine=""):
and os.path.exists(dst) == False: and os.path.exists(dst) == False:
debug.verbose(" ==> must rebuild (dst does not exist)") debug.verbose(" ==> must rebuild (dst does not exist)")
return True return True
if dst != "" \
and dst != None \
and os.path.exists(src) == False:
debug.warning(" ==> unexistant file :'" + src + "'")
return True
# chek the basic date if the 2 files # chek the basic date if the 2 files
if dst != "" \ if dst != "" \
and dst != None \ and dst != None \

View File

@@ -1,4 +1,12 @@
#!/usr/bin/python #!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import lutinDebug as debug import lutinDebug as debug
@@ -21,7 +29,7 @@ printPrettyMode=False
def set_print_pretty_mode(val): def set_print_pretty_mode(val):
global printPrettyMode global printPrettyMode
if val==True: if val == True:
printPrettyMode = True printPrettyMode = True
else: else:
printPrettyMode = False printPrettyMode = False
@@ -30,9 +38,10 @@ def get_print_pretty_mode():
global printPrettyMode global printPrettyMode
return printPrettyMode return printPrettyMode
def print_pretty(myString): def print_pretty(myString, force=False):
global printPrettyMode global printPrettyMode
if True==printPrettyMode: if printPrettyMode == 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 :

View File

@@ -1,4 +1,12 @@
#!/usr/bin/python #!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import lutinDebug as debug import lutinDebug as debug
import datetime import datetime
import lutinTools import lutinTools

View File

@@ -1,4 +1,12 @@
#!/usr/bin/python #!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import lutinDebug as debug import lutinDebug as debug
import datetime import datetime
import lutinTools as tools import lutinTools as tools

View File

@@ -1,4 +1,12 @@
#!/usr/bin/python #!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import sys import sys
import lutinDebug as debug import lutinDebug as debug

View File

@@ -1,4 +1,12 @@
#!/usr/bin/python #!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import platform import platform
import sys import sys
import lutinDebug as debug import lutinDebug as debug
@@ -13,8 +21,13 @@ elif platform.system() == "Darwin":
else: else:
debug.error("Unknow the Host OS ... '" + platform.system() + "'") debug.error("Unknow the Host OS ... '" + platform.system() + "'")
debug.debug(" host.OS = " + OS) debug.debug("host.OS = " + OS)
OS64BITS = sys.maxsize > 2**32 if sys.maxsize > 2**32:
OS32BITS = OS64BITS==False BUS_SIZE = 64
else:
BUS_SIZE = 32
debug.debug("host.BUS_SIZE = " + str(BUS_SIZE))

View File

@@ -1,15 +1,27 @@
#!/usr/bin/python #!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import lutinDebug as debug import lutinDebug as debug
import lutinTools as tools import lutinTools as tools
import platform import platform
import os import os
import lutinMultiprocess import lutinMultiprocess
import lutinDepend as dependency import lutinDepend as dependency
enableResizeImage = True
if platform.system() == "Darwin": try:
if platform.system() == "Darwin":
import CoreGraphics import CoreGraphics
else: else:
from PIL import Image from PIL import Image
except:
enableResizeImage = False
debug.warning("Missing python tools : CoreGraphics (MacOs) or PIL")
def get_pow_2_multiple(size): def get_pow_2_multiple(size):
base = 2 base = 2
@@ -22,6 +34,8 @@ def get_pow_2_multiple(size):
# check if time change # check if time change
# check if command line change # check if command line change
def resize(srcFile, destFile, x, y, cmd_file=None): def resize(srcFile, destFile, x, y, cmd_file=None):
if enableResizeImage == False:
return
if os.path.exists(srcFile) == False: if os.path.exists(srcFile) == False:
debug.error("Request a resize an image that does not existed : '" + srcFile + "'") debug.error("Request a resize an image that does not existed : '" + srcFile + "'")
cmd_line = "resize Image : " + srcFile + " ==> " + destFile + " newSize=(" + str(x) + "x" + str(y) + ")" cmd_line = "resize Image : " + srcFile + " ==> " + destFile + " newSize=(" + str(x) + "x" + str(y) + ")"

View File

@@ -1,4 +1,12 @@
#!/usr/bin/python #!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import sys import sys
import os import os
import inspect import inspect
@@ -318,7 +326,7 @@ class Module:
lutinTools.create_directory_of_file(file_dst) lutinTools.create_directory_of_file(file_dst)
debug.print_element("SharedLib", libName, "==>", file_dst) debug.print_element("SharedLib", libName, "==>", file_dst)
lutinMultiprocess.run_command(cmdLine) lutinMultiprocess.run_command(cmdLine)
if "release"==target.buildMode \ if target.config["mode"] == "release" \
or lutinEnv.get_force_strip_mode()==True: or lutinEnv.get_force_strip_mode()==True:
# get the file size of the non strip file # get the file size of the non strip file
originSize = lutinTools.file_size(file_dst); originSize = lutinTools.file_size(file_dst);
@@ -360,7 +368,7 @@ class Module:
debug.print_element("Executable", self.name, "==>", file_dst) debug.print_element("Executable", self.name, "==>", file_dst)
lutinMultiprocess.run_command(cmdLine) lutinMultiprocess.run_command(cmdLine)
if "release"==target.buildMode \ if "release"==target.config["mode"] \
or lutinEnv.get_force_strip_mode()==True: or lutinEnv.get_force_strip_mode()==True:
# get the file size of the non strip file # get the file size of the non strip file
originSize = lutinTools.file_size(file_dst); originSize = lutinTools.file_size(file_dst);
@@ -420,7 +428,7 @@ class Module:
## ##
def folders_to_staging(self, binaryName, target): def folders_to_staging(self, binaryName, target):
for source, destination in self.folders: for source, destination in self.folders:
debug.verbose("Might copy folder : " + source + "==>" + destination) debug.debug("Might copy folder : " + source + "==>" + destination)
lutinTools.copy_anything_target(target, self.originFolder + "/" + source, destination) lutinTools.copy_anything_target(target, self.originFolder + "/" + source, destination)
# call here to build the module # call here to build the module
@@ -463,7 +471,9 @@ class Module:
or fileExt == "cxx" \ or fileExt == "cxx" \
or fileExt == "CXX" \ or fileExt == "CXX" \
or fileExt == "xx" \ or fileExt == "xx" \
or fileExt == "XX": or fileExt == "XX" \
or fileExt == "CC" \
or fileExt == "cc":
resFile = self.compile_xx_to_o(file, packageName, target, self.subHeritageList) resFile = self.compile_xx_to_o(file, packageName, target, self.subHeritageList)
listSubFileNeededTobuild.append(resFile) listSubFileNeededTobuild.append(resFile)
elif fileExt == "mm" \ elif fileExt == "mm" \
@@ -475,7 +485,7 @@ class Module:
resFile = self.compile_m_to_o(file, packageName, target, self.subHeritageList) resFile = self.compile_m_to_o(file, packageName, target, self.subHeritageList)
listSubFileNeededTobuild.append(resFile) listSubFileNeededTobuild.append(resFile)
else: else:
debug.verbose(" TODO : gcc " + self.originFolder + "/" + file) debug.warning(" UN-SUPPORTED file format: '" + self.originFolder + "/" + file + "'")
# when multiprocess availlable, we need to synchronize here ... # when multiprocess availlable, we need to synchronize here ...
lutinMultiprocess.pool_synchrosize() lutinMultiprocess.pool_synchrosize()

View File

@@ -1,4 +1,12 @@
#!/usr/bin/python #!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import sys import sys
import lutinDebug as debug import lutinDebug as debug
import threading import threading
@@ -8,11 +16,21 @@ import os
import subprocess import subprocess
import lutinTools import lutinTools
import lutinEnv import lutinEnv
import shlex
queueLock = threading.Lock() queueLock = threading.Lock()
workQueue = Queue.Queue() workQueue = Queue.Queue()
currentThreadWorking = 0 currentThreadWorking = 0
threads = [] threads = []
# To know the first error arrive in the pool ==> to display all the time the same error file when multiple compilation
currentIdExecution = 0
errorExecution = {
"id":-1,
"cmd":"",
"return":0,
"err":"",
"out":"",
}
exitFlag = False # resuest stop of the thread exitFlag = False # resuest stop of the thread
isinit = False # the thread are initialized isinit = False # the thread are initialized
@@ -32,30 +50,65 @@ def store_command(cmdLine, file):
file2.close() file2.close()
def run_command(cmdLine, storeCmdLine=""): def run_command(cmdLine, storeCmdLine="", buildId=-1, file=""):
debug.debug(lutinEnv.print_pretty(cmdLine))
try:
retcode = subprocess.call(cmdLine, shell=True)
except OSError as e:
print >>sys.stderr, "Execution failed:", e
if retcode != 0:
global errorOccured global errorOccured
errorOccured = True
global exitFlag global exitFlag
global currentIdExecution
# prepare command line:
args = shlex.split(cmdLine)
#debug.verbose("cmd = " + str(args))
try:
# create the subprocess
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
except subprocess.CalledProcessError as e:
debug.error("subprocess.CalledProcessError : TODO ...")
# launch the subprocess:
output, err = p.communicate()
# Check error :
if p.returncode == 0:
debug.debug(lutinEnv.print_pretty(cmdLine))
queueLock.acquire()
# TODO : Print the output all the time .... ==> to show warnings ...
if buildId >= 0 and (output != "" or err != ""):
debug.warning("output in subprocess compiling: '" + file + "'")
if output != "":
debug.print_compilator(output)
if err != "":
debug.print_compilator(err)
queueLock.release()
else:
errorOccured = True
exitFlag = True exitFlag = True
if retcode == 2: # if No ID : Not in a multiprocess mode ==> just stop here
if buildId < 0:
debug.debug(lutinEnv.print_pretty(cmdLine), force=True)
debug.print_compilator(output)
debug.print_compilator(err)
if p.returncode == 2:
debug.error("can not compile file ... [keyboard interrrupt]") debug.error("can not compile file ... [keyboard interrrupt]")
else: else:
debug.error("can not compile file ... ret : " + str(retcode)) debug.error("can not compile file ... ret : " + str(p.returncode))
else:
# in multiprocess interface
queueLock.acquire()
# if an other write an error before, check if the current process is started before ==> then is the first error
if errorExecution["id"] >= buildId:
# nothing to do ...
queueLock.release()
return;
errorExecution["id"] = buildId
errorExecution["cmd"] = cmdLine
errorExecution["return"] = p.returncode
errorExecution["err"] = err,
errorExecution["out"] = output,
queueLock.release()
# not write the command file...
return return
# write cmd line only after to prevent errors ... # write cmd line only after to prevent errors ...
store_command(cmdLine, storeCmdLine) store_command(cmdLine, storeCmdLine)
class myThread(threading.Thread): class myThread(threading.Thread):
def __init__(self, threadID, lock, queue): def __init__(self, threadID, lock, queue):
threading.Thread.__init__(self) threading.Thread.__init__(self)
@@ -68,7 +121,7 @@ class myThread(threading.Thread):
global exitFlag global exitFlag
global currentThreadWorking global currentThreadWorking
workingSet = False workingSet = False
while False==exitFlag: while exitFlag == False:
self.lock.acquire() self.lock.acquire()
if not self.queue.empty(): if not self.queue.empty():
if workingSet==False: if workingSet==False:
@@ -81,8 +134,8 @@ class myThread(threading.Thread):
comment = data[2] comment = data[2]
cmdLine = data[1] cmdLine = data[1]
cmdStoreFile = data[3] cmdStoreFile = data[3]
debug.print_element( "[" + str(self.threadID) + "] " + comment[0], comment[1], comment[2], comment[3]) debug.print_element( "[" + str(data[4]) + "][" + str(self.threadID) + "] " + comment[0], comment[1], comment[2], comment[3])
run_command(cmdLine, cmdStoreFile) run_command(cmdLine, cmdStoreFile, buildId=data[4], file=comment[3])
else: else:
debug.warning("unknow request command : " + data[0]) debug.warning("unknow request command : " + data[0])
else: else:
@@ -138,21 +191,24 @@ def un_init():
def run_in_pool(cmdLine, comment, storeCmdLine=""): def run_in_pool(cmdLine, comment, storeCmdLine=""):
global currentIdExecution
if processorAvaillable <= 1: if processorAvaillable <= 1:
debug.print_element(comment[0], comment[1], comment[2], comment[3]) debug.print_element(comment[0], comment[1], comment[2], comment[3])
run_command(cmdLine, storeCmdLine) run_command(cmdLine, storeCmdLine, file=comment[3])
return return
# multithreaded mode # multithreaded mode
init() init()
# Fill the queue # Fill the queue
queueLock.acquire() queueLock.acquire()
debug.verbose("add : in pool cmdLine") debug.verbose("add : in pool cmdLine")
workQueue.put(["cmdLine", cmdLine, comment, storeCmdLine]) workQueue.put(["cmdLine", cmdLine, comment, storeCmdLine, currentIdExecution])
currentIdExecution +=1;
queueLock.release() queueLock.release()
def pool_synchrosize(): def pool_synchrosize():
global errorOccured global errorOccured
global errorExecution
if processorAvaillable <= 1: if processorAvaillable <= 1:
#in this case : nothing to synchronise #in this case : nothing to synchronise
return return
@@ -171,7 +227,17 @@ def pool_synchrosize():
if False==errorOccured: if False==errorOccured:
debug.verbose("queue is empty") debug.verbose("queue is empty")
else: else:
debug.debug("Thread return with error ... ==> stop all the pool")
un_init() un_init()
debug.error("Pool error occured ...") debug.debug("Thread return with error ... ==> stop all the pool")
if errorExecution["id"] == -1:
debug.error("Pool error occured ... (No return information on Pool)")
return
debug.error("Error in an pool element : [" + str(errorExecution["id"]) + "]", crash=False)
debug.debug(lutinEnv.print_pretty(errorExecution["cmd"]), force=True)
debug.print_compilator(str(errorExecution["out"][0]))
debug.print_compilator(str(errorExecution["err"][0]))
if errorExecution["return"] == 2:
debug.error("can not compile file ... [keyboard interrrupt]")
else:
debug.error("can not compile file ... return value : " + str(errorExecution["return"]))

View File

@@ -1,50 +1,67 @@
#!/usr/bin/python #!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import sys
import os
import inspect
import fnmatch
import lutinDebug as debug import lutinDebug as debug
import datetime import datetime
import lutinTools import lutinTools
import lutinModule import lutinModule
import lutinImage import lutinImage
import lutinHost
class Target: class Target:
def __init__(self, name, typeCompilator, debugMode, generatePackage, arch, cross, sumulator=False): def __init__(self, name, config, arch):
self.config = config
#processor type selection (auto/arm/ppc/x86)
self.selectArch = config["arch"]; # TODO : Remove THIS ...
#bus size selection (auto/32/64)
self.selectBus = config["bus-size"]; # TODO : Remove THIS ...
if config["bus-size"] == "auto":
debug.error("system error ==> must generate the default 'bus-size' config")
if config["arch"] == "auto":
debug.error("system error ==> must generate the default 'bus-size' config")
debug.debug("config=" + str(config))
if arch != "": if arch != "":
self.arch = "-arch " + arch self.arch = "-arch " + arch
else: else:
self.arch = "" self.arch = ""
self.sumulator = sumulator
self.cross = cross # todo : remove this :
self.sumulator = config["simulation"]
self.name=name self.name=name
self.endGeneratePackage = generatePackage self.endGeneratePackage = config["generate-package"]
debug.info("================================="); debug.info("=================================");
debug.info("== Target='" + self.name + "'"); debug.info("== Target='" + self.name + "' " + config["bus-size"] + " bits for arch '" + config["arch"] + "'");
debug.info("================================="); debug.info("=================================");
self.ar=self.cross + "ar"
self.ranlib=self.cross + "ranlib" self.set_cross_base()
if typeCompilator == "clang":
self.cc=self.cross + "clang"
self.xx=self.cross + "clang++"
#self.ar=self.cross + "llvm-ar"
#self.ranlib="ls"
else:
self.cc=self.cross + "gcc"
self.xx=self.cross + "g++"
#self.ar=self.cross + "ar"
#self.ranlib=self.cross + "ranlib"
self.ld=self.cross + "ld"
self.nm=self.cross + "nm"
self.strip=self.cross + "strip"
self.dlltool=self.cross + "dlltool"
############################################################################### ###############################################################################
# Target global variables. # Target global variables.
############################################################################### ###############################################################################
self.global_include_cc=[] self.global_include_cc=[]
self.global_flags_cc=['-D__TARGET_OS__'+self.name, self.global_flags_cc=['-D__TARGET_OS__'+self.name,
'-D__TARGET_ARCH__'+self.selectArch,
'-D__TARGET_ADDR__'+self.selectBus + 'BITS',
'-D_REENTRANT'] '-D_REENTRANT']
if self.name != "Windows": if self.name != "Windows":
self.global_flags_xx=['-std=c++11'] self.global_flags_xx=['-std=c++11']
self.global_flags_mm=['-std=c++11'] self.global_flags_mm=['-std=c++11']
else: else:
self.global_flags_xx=['-static-libgcc', '-static-libstdc++', '-L', '-std=c++11'] self.global_flags_xx=['-static-libgcc', '-static-libstdc++', '-std=c++11']
self.global_flags_mm=[] self.global_flags_mm=[]
self.global_flags_m=[] self.global_flags_m=[]
self.global_flags_ar=['rcs'] self.global_flags_ar=['rcs']
@@ -65,19 +82,22 @@ class Target:
self.folder_arch="/" + self.name self.folder_arch="/" + self.name
if "debug" == debugMode: if "debug" == self.config["mode"]:
self.buildMode = "debug"
self.global_flags_cc.append("-g") self.global_flags_cc.append("-g")
self.global_flags_cc.append("-DDEBUG") self.global_flags_cc.append("-DDEBUG")
self.global_flags_cc.append("-O0") self.global_flags_cc.append("-O0")
else: else:
self.buildMode = "release"
self.global_flags_cc.append("-DNDEBUG") self.global_flags_cc.append("-DNDEBUG")
self.global_flags_cc.append("-O3") self.global_flags_cc.append("-O3")
self.folder_out="/out" + self.folder_arch + "/" + self.buildMode
self.folder_final="/final/" + typeCompilator ## To add code coverate on build result system
self.folder_staging="/staging/" + typeCompilator if self.config["gcov"] == True:
self.folder_build="/build/" + typeCompilator self.global_flags_cc.append("-fprofile-arcs")
self.global_flags_cc.append("-ftest-coverage")
self.global_flags_ld.append("-fprofile-arcs")
self.global_flags_ld.append("-ftest-coverage")
self.update_folder_tree()
self.folder_bin="/usr/bin" self.folder_bin="/usr/bin"
self.folder_lib="/usr/lib" self.folder_lib="/usr/lib"
self.folder_data="/usr/share" self.folder_data="/usr/share"
@@ -92,6 +112,33 @@ class Target:
self.externProjectManager = None self.externProjectManager = None
def update_folder_tree(self):
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_staging="/staging/" + self.config["compilator"]
self.folder_build="/build/" + self.config["compilator"]
def set_cross_base(self, cross=""):
self.cross = cross
debug.debug("== Target='" + self.cross + "'");
self.ar = self.cross + "ar"
self.ranlib = self.cross + "ranlib"
if self.config["compilator"] == "clang":
self.cc = self.cross + "clang"
self.xx = self.cross + "clang++"
#self.ar=self.cross + "llvm-ar"
#self.ranlib="ls"
else:
self.cc = self.cross + "gcc"
self.xx = self.cross + "g++"
#self.ar=self.cross + "ar"
#self.ranlib=self.cross + "ranlib"
self.ld = self.cross + "ld"
self.nm = self.cross + "nm"
self.strip = self.cross + "strip"
self.dlltool = self.cross + "dlltool"
self.update_folder_tree()
def set_use_of_extern_build_tool(self, mode): def set_use_of_extern_build_tool(self, mode):
if mode == True: if mode == True:
if self.externProjectManager == None: if self.externProjectManager == None:
@@ -101,7 +148,7 @@ class Target:
self.externProjectManager = None self.externProjectManager = None
def get_build_mode(self): def get_build_mode(self):
return self.buildMode return self.config["mode"]
def add_image_staging(self, inputFile, outputFile, sizeX, sizeY, cmdFile=None): def add_image_staging(self, inputFile, outputFile, sizeX, sizeY, cmdFile=None):
for source, dst, x, y, cmdFile2 in self.listFinalFile: for source, dst, x, y, cmdFile2 in self.listFinalFile:
@@ -321,17 +368,61 @@ class Target:
debug.error("not know module name : '" + moduleName + "' to '" + actionName + "' it") debug.error("not know module name : '" + moduleName + "' to '" + actionName + "' it")
__startTargetName="lutinTarget" targetList=[]
__startTargetName="lutinTarget_"
def import_path(path):
global targetList
matches = []
debug.debug('Start find sub File : "%s"' %path)
for root, dirnames, filenames in os.walk(path):
tmpList = fnmatch.filter(filenames, __startTargetName + "*.py")
# Import the module :
for filename in tmpList:
debug.debug(' Find a file : "%s"' %os.path.join(root, filename))
#matches.append(os.path.join(root, filename))
sys.path.append(os.path.dirname(os.path.join(root, filename)) )
targetName = filename.replace('.py', '')
targetName = targetName.replace(__startTargetName, '')
debug.debug("integrate module: '" + targetName + "' from '" + os.path.join(root, filename) + "'")
targetList.append([targetName,os.path.join(root, filename)])
def load_target(name, config):
global targetList
debug.debug("load target: " + name)
if len(targetList) == 0:
debug.error("No target to compile !!!")
debug.debug("list target: " + str(targetList))
for mod in targetList:
if mod[0] == name:
debug.verbose("add to path: '" + os.path.dirname(mod[1]) + "'")
sys.path.append(os.path.dirname(mod[1]))
debug.verbose("import target : '" + __startTargetName + name + "'")
theTarget = __import__(__startTargetName + name)
#create the target
tmpTarget = theTarget.Target(config)
#tmpTarget.set_use_of_extern_build_tool(externBuild)
return tmpTarget
def list_all_target(): def list_all_target():
tmpListName = ["Android", "Linux", "MacOs", "IOs", "Windows" ] global targetList
tmpListName = []
for mod in targetList:
tmpListName.append(mod[0])
return tmpListName return tmpListName
def target_load(targetName, compilator, mode, generatePackage, externBuild, simulationMode): def list_all_target_with_desc():
theTarget = __import__(__startTargetName + targetName) global targetList
#try: tmpList = []
tmpTarget = theTarget.Target(compilator, mode, generatePackage, simulationMode) for mod in targetList:
tmpTarget.set_use_of_extern_build_tool(externBuild) sys.path.append(os.path.dirname(mod[1]))
return tmpTarget theTarget = __import__(__startTargetName + mod[0])
#except: try:
# debug.error("Can not create the Target : '" + targetName + "'") tmpdesc = theTarget.get_desc()
tmpList.append([mod[0], tmpdesc])
except:
debug.warning("has no name : " + mod[0])
tmpList.append([mod[0], ""])
return tmpList

View File

@@ -1,4 +1,12 @@
#!/usr/bin/python #!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import os import os
import shutil import shutil
import errno import errno
@@ -97,25 +105,34 @@ def copy_anything(src, dst):
tmpPath = os.path.dirname(os.path.realpath(src)) tmpPath = os.path.dirname(os.path.realpath(src))
tmpRule = os.path.basename(src) tmpRule = os.path.basename(src)
for root, dirnames, filenames in os.walk(tmpPath): for root, dirnames, filenames in os.walk(tmpPath):
debug.verbose(" root='" + str(root) + "' dir='" + str(dirnames) + "' filenames=" + str(filenames))
tmpList = filenames tmpList = filenames
if len(tmpRule)>0: if len(tmpRule)>0:
tmpList = fnmatch.filter(filenames, tmpRule) tmpList = fnmatch.filter(filenames, tmpRule)
# Import the module : # Import the module :
for cycleFile in tmpList: for cycleFile in tmpList:
#for cycleFile in filenames: #for cycleFile in filenames:
#debug.info("Might copy : '" + tmpPath+cycleFile + "' ==> '" + dst + "'") debug.verbose("Might copy : '" + tmpPath+cycleFile + "' ==> '" + dst + "'")
copy_file(tmpPath+"/"+cycleFile,dst+"/"+cycleFile) copy_file(tmpPath+"/"+cycleFile, dst+"/"+cycleFile)
def copy_anything_target(target, src, dst): def copy_anything_target(target, src, dst):
tmpPath = os.path.dirname(os.path.realpath(src)) tmpPath = os.path.dirname(os.path.realpath(src))
tmpRule = os.path.basename(src) tmpRule = os.path.basename(src)
for root, dirnames, filenames in os.walk(tmpPath): for root, dirnames, filenames in os.walk(tmpPath):
debug.verbose(" root='" + str(root) + "' dir='" + str(dirnames) + "' filenames=" + str(filenames))
tmpList = filenames tmpList = filenames
if len(tmpRule)>0: if len(tmpRule)>0:
tmpList = fnmatch.filter(filenames, tmpRule) tmpList = fnmatch.filter(filenames, tmpRule)
# Import the module : # Import the module :
for cycleFile in tmpList: for cycleFile in tmpList:
#for cycleFile in filenames: #for cycleFile in filenames:
#debug.info("Might copy : '" + tmpPath+cycleFile + "' ==> '" + dst + "'") newDst = dst
target.add_file_staging(tmpPath+"/"+cycleFile,dst+"/"+cycleFile) if len(newDst) != 0 and newDst[-1] != "/":
newDst += "/"
if root[len(src)-1:] != "":
newDst += root[len(src)-1:]
if len(newDst) != 0 and newDst[-1] != "/":
newDst += "/"
debug.verbose("Might copy : '" + root+"/"+cycleFile + "' ==> '" + newDst+cycleFile + "'" )
target.add_file_staging(root+"/"+cycleFile, newDst+cycleFile)

View File

@@ -1,4 +1,12 @@
#!/usr/bin/python #!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import lutinDebug as debug import lutinDebug as debug
import lutinTarget import lutinTarget
@@ -6,11 +14,21 @@ import lutinTools
import lutinHost import lutinHost
import lutinImage import lutinImage
import lutinMultiprocess import lutinMultiprocess
import lutinHost
import os import os
import sys import sys
class Target(lutinTarget.Target): class Target(lutinTarget.Target):
def __init__(self, typeCompilator, debugMode, generatePackage, sumulator=False): 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"
lutinTarget.Target.__init__(self, "Android", config, arch)
self.folder_ndk = os.getenv('PROJECT_NDK', "AUTO") self.folder_ndk = os.getenv('PROJECT_NDK', "AUTO")
self.folder_sdk = os.getenv('PROJECT_SDK', "AUTO") self.folder_sdk = os.getenv('PROJECT_SDK', "AUTO")
@@ -36,18 +54,18 @@ class Target(lutinTarget.Target):
if not os.path.isdir(self.folder_sdk): if not os.path.isdir(self.folder_sdk):
debug.error("SDK path not set !!! set env : PROJECT_SDK on the SDK path") debug.error("SDK path not set !!! set env : PROJECT_SDK on the SDK path")
arch = ""#"ARMv7"
tmpOsVal = "64" tmpOsVal = "64"
gccVersion = "4.8" gccVersion = "4.8"
if lutinHost.OS64BITS==True: if lutinHost.BUS_SIZE==64:
tmpOsVal = "_64" tmpOsVal = "_64"
if typeCompilator == "clang": if self.config["compilator"] == "clang":
cross = self.folder_ndk + "/toolchains/llvm-3.3/prebuilt/linux-x86_64/bin/" self.set_cross_base(self.folder_ndk + "/toolchains/llvm-3.3/prebuilt/linux-x86_64/bin/")
else: else:
baseFolderArm = self.folder_ndk + "/toolchains/arm-linux-androideabi-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/" 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/" 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/" baseFolderX86 = self.folder_ndk + "/toolchains/x86-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/"
cross = baseFolderArm + "arm-linux-androideabi-" self.set_cross_base(baseFolderArm + "arm-linux-androideabi-")
if not os.path.isdir(baseFolderArm): if not os.path.isdir(baseFolderArm):
debug.error("Gcc Arm path does not exist !!!") debug.error("Gcc Arm path does not exist !!!")
if not os.path.isdir(baseFolderMips): if not os.path.isdir(baseFolderMips):
@@ -55,7 +73,6 @@ class Target(lutinTarget.Target):
if not os.path.isdir(baseFolderX86): if not os.path.isdir(baseFolderX86):
debug.info("Gcc x86 path does not exist !!!") debug.info("Gcc x86 path does not exist !!!")
lutinTarget.Target.__init__(self, "Android", typeCompilator, debugMode, generatePackage, arch, cross, sumulator)
arch = "ARMv7" arch = "ARMv7"
# for gcc : # for gcc :
@@ -78,7 +95,7 @@ class Target(lutinTarget.Target):
self.global_include_cc.append("-I" + self.folder_ndk +"/platforms/android-" + str(self.boardId) + "/arch-x86/usr/include/") self.global_include_cc.append("-I" + self.folder_ndk +"/platforms/android-" + str(self.boardId) + "/arch-x86/usr/include/")
if True: if True:
if typeCompilator == "clang": if self.config["compilator"] == "clang":
self.global_include_cc.append("-I" + self.folder_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/include/") self.global_include_cc.append("-I" + self.folder_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/include/")
if arch == "ARMv5": if arch == "ARMv5":
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/libs/armeabi/" stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/libs/armeabi/"
@@ -182,7 +199,7 @@ class Target(lutinTarget.Target):
debug.info("Generate package '" + pkgName + "'") debug.info("Generate package '" + pkgName + "'")
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
pkgNameApplicationName = pkgName pkgNameApplicationName = pkgName
if "debug"==self.buildMode: if self.config["mode"] == "debug":
pkgNameApplicationName += "debug" pkgNameApplicationName += "debug"
# FINAL_FOLDER_JAVA_PROJECT # FINAL_FOLDER_JAVA_PROJECT
self.folder_javaProject= self.get_staging_folder(pkgName) \ self.folder_javaProject= self.get_staging_folder(pkgName) \
@@ -346,7 +363,7 @@ class Target(lutinTarget.Target):
tmpFile.write( ' <application android:label="' + pkgNameApplicationName + '" \n') tmpFile.write( ' <application android:label="' + pkgNameApplicationName + '" \n')
if "ICON" in pkgProperties.keys(): if "ICON" in pkgProperties.keys():
tmpFile.write( ' android:icon="@drawable/icon" \n') tmpFile.write( ' android:icon="@drawable/icon" \n')
if "debug"==self.buildMode: if self.config["mode"] == "debug":
tmpFile.write( ' android:debuggable="true" \n') tmpFile.write( ' android:debuggable="true" \n')
tmpFile.write( ' >\n') tmpFile.write( ' >\n')
if "ADMOD_ID" in pkgProperties: if "ADMOD_ID" in pkgProperties:
@@ -355,7 +372,7 @@ class Target(lutinTarget.Target):
tmpFile.write( ' <activity android:name=".' + pkgNameApplicationName + '" \n') tmpFile.write( ' <activity android:name=".' + pkgNameApplicationName + '" \n')
tmpFile.write( ' android:label="' + pkgProperties['NAME']) tmpFile.write( ' android:label="' + pkgProperties['NAME'])
if "debug"==self.buildMode: if self.config["mode"] == "debug":
tmpFile.write("-debug") tmpFile.write("-debug")
tmpFile.write( '"\n') tmpFile.write( '"\n')
if "ICON" in pkgProperties.keys(): if "ICON" in pkgProperties.keys():
@@ -380,7 +397,7 @@ class Target(lutinTarget.Target):
tmpFile.write( ' >\n') tmpFile.write( ' >\n')
tmpFile.write( ' <service android:name=".' + pkgNameApplicationName + '" \n') tmpFile.write( ' <service android:name=".' + pkgNameApplicationName + '" \n')
tmpFile.write( ' android:label="' + pkgProperties['NAME']) tmpFile.write( ' android:label="' + pkgProperties['NAME'])
if "debug"==self.buildMode: if self.config["mode"] == "debug":
tmpFile.write("-debug") tmpFile.write("-debug")
tmpFile.write( '"\n') tmpFile.write( '"\n')
if "ICON" in pkgProperties.keys(): if "ICON" in pkgProperties.keys():
@@ -562,7 +579,7 @@ class Target(lutinTarget.Target):
# http://asantoso.wordpress.com/2009/09/15/how-to-build-android-application-package-apk-from-the-command-line-using-the-sdk-tools-continuously-integrated-using-cruisecontrol/ # 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") debug.print_element("pkg", "R.java", "<==", "Resources files")
lutinTools.create_directory_of_file(self.get_staging_folder(pkgName) + "/src/noFile") lutinTools.create_directory_of_file(self.get_staging_folder(pkgName) + "/src/noFile")
androidToolPath = self.folder_sdk + "/build-tools/19.0.3/" androidToolPath = self.folder_sdk + "/build-tools/20.0.0/"
adModResouceFolder = "" adModResouceFolder = ""
if "ADMOD_ID" in pkgProperties: if "ADMOD_ID" in pkgProperties:
adModResouceFolder = " -S " + self.folder_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/res/ " adModResouceFolder = " -S " + self.folder_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/res/ "
@@ -647,7 +664,7 @@ class Target(lutinTarget.Target):
# http://developer.android.com/tools/publishing/app-signing.html # http://developer.android.com/tools/publishing/app-signing.html
# Create a key for signing your application: # 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 # keytool -genkeypair -v -keystore AndroidKey.jks -storepass Pass__AndroidDebugKey -alias alias__AndroidDebugKey -keypass PassKey__AndroidDebugKey -keyalg RSA -validity 36500
if "debug"==self.buildMode: if self.config["mode"] == "debug":
tmpFile = open("tmpPass.boo", 'w') tmpFile = open("tmpPass.boo", 'w')
tmpFile.write("Pass__AndroidDebugKey\n") tmpFile.write("Pass__AndroidDebugKey\n")
tmpFile.write("PassKey__AndroidDebugKey\n") tmpFile.write("PassKey__AndroidDebugKey\n")
@@ -686,7 +703,7 @@ class Target(lutinTarget.Target):
debug.print_element("pkg", ".apk(aligned)", "<==", ".apk (not aligned)") debug.print_element("pkg", ".apk(aligned)", "<==", ".apk (not aligned)")
lutinTools.remove_file(self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk") lutinTools.remove_file(self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk")
# verbose mode : -v # verbose mode : -v
cmdLine = self.folder_sdk + "/tools/zipalign 4 " \ cmdLine = androidToolPath + "zipalign 4 " \
+ self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \ + self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \
+ self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk " + self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk "
lutinMultiprocess.run_command(cmdLine) lutinMultiprocess.run_command(cmdLine)
@@ -701,7 +718,7 @@ class Target(lutinTarget.Target):
debug.info("Install package '" + pkgName + "'") debug.info("Install package '" + pkgName + "'")
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
pkgNameApplicationName = pkgName pkgNameApplicationName = pkgName
if "debug"==self.buildMode: if self.config["mode"] == "debug":
pkgNameApplicationName += "debug" pkgNameApplicationName += "debug"
cmdLine = self.folder_sdk + "/platform-tools/adb install -r " \ cmdLine = self.folder_sdk + "/platform-tools/adb install -r " \
+ self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk " + self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk "
@@ -712,7 +729,7 @@ class Target(lutinTarget.Target):
debug.info("Un-Install package '" + pkgName + "'") debug.info("Un-Install package '" + pkgName + "'")
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
pkgNameApplicationName = pkgName pkgNameApplicationName = pkgName
if "debug"==self.buildMode: if self.config["mode"] == "debug":
pkgNameApplicationName += "debug" pkgNameApplicationName += "debug"
cmdLine = self.folder_sdk + "/platform-tools/adb uninstall " + pkgNameApplicationName cmdLine = self.folder_sdk + "/platform-tools/adb uninstall " + pkgNameApplicationName
RlutinMultiprocess.unCommand(cmdLine) RlutinMultiprocess.unCommand(cmdLine)

View File

@@ -1,4 +1,12 @@
#!/usr/bin/python #!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import lutinDebug as debug import lutinDebug as debug
import lutinTarget import lutinTarget
import lutinTools import lutinTools
@@ -7,24 +15,34 @@ import os
import stat import stat
import lutinExtProjectGeneratorXCode import lutinExtProjectGeneratorXCode
import lutinMultiprocess import lutinMultiprocess
import lutinHost
import random import random
import re import re
class Target(lutinTarget.Target): class Target(lutinTarget.Target):
def __init__(self, typeCompilator, debugMode, generatePackage, sumulator=False): def __init__(self, config):
if typeCompilator == "gcc": if config["compilator"] == "gcc":
debug.info("compile only with clang for IOs"); debug.info("compile only with clang for IOs");
typeCompilator = "clang" config["compilator"] = "clang"
#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"] = "64"
# http://biolpc22.york.ac.uk/pub/linux-mac-cross/ # http://biolpc22.york.ac.uk/pub/linux-mac-cross/
# http://devs.openttd.org/~truebrain/compile-farm/apple-darwin9.txt # http://devs.openttd.org/~truebrain/compile-farm/apple-darwin9.txt
if sumulator == True: if sumulator == True:
arch = "i386" arch = "i386"
cross = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/"
else: else:
arch="arm64" # for ipad air arch="arm64" # for ipad air
#arch="armv7" # for Iphone 4 #arch="armv7" # for Iphone 4
cross = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/" lutinTarget.Target.__init__(self, "IOs", config, arch)
lutinTarget.Target.__init__(self, "IOs", typeCompilator, debugMode, generatePackage, arch, cross, sumulator) if self.config["simulation"] == True:
self.set_cross_base("/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/")
else:
self.set_cross_base("/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/")
# remove unneeded ranlib ... # remove unneeded ranlib ...
self.ranlib="" self.ranlib=""

View File

@@ -1,4 +1,12 @@
#!/usr/bin/python #!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import lutinDebug as debug import lutinDebug as debug
import lutinTarget import lutinTarget
import lutinTools as tools import lutinTools as tools
@@ -6,10 +14,25 @@ import os
import stat import stat
import re import re
import lutinMultiprocess import lutinMultiprocess
import lutinHost
class Target(lutinTarget.Target): class Target(lutinTarget.Target):
def __init__(self, typeCompilator, debugMode, generatePackage, sumulator=False): def __init__(self, config):
lutinTarget.Target.__init__(self, "Linux", typeCompilator, debugMode, generatePackage, "", "") #processor type selection (auto/arm/ppc/x86)
if config["arch"] == "auto":
config["arch"] = "x86"
#bus size selection (auto/32/64)
if config["bus-size"] == "auto":
config["bus-size"] = str(lutinHost.BUS_SIZE)
lutinTarget.Target.__init__(self, "Linux", config, "")
if self.config["bus-size"] == "64":
# 64 bits
if lutinHost.BUS_SIZE != 64:
self.global_flags_cc.append("-m64")
else:
# 32 bits
if lutinHost.BUS_SIZE != 32:
self.global_flags_cc.append("-m32")
def generate_list_separate_coma(self, list): def generate_list_separate_coma(self, list):
result = "" result = ""

View File

@@ -1,17 +1,30 @@
#!/usr/bin/python #!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import lutinDebug as debug import lutinDebug as debug
import lutinTarget import lutinTarget
import lutinTools import lutinTools
import lutinHost
import os import os
import stat import stat
class Target(lutinTarget.Target): class Target(lutinTarget.Target):
def __init__(self, typeCompilator, debugMode, generatePackage, sumulator=False): def __init__(self, config):
cross = "" #processor type selection (auto/arm/ppc/x86)
if config["arch"] == "auto":
config["arch"] = "x86"
#bus size selection (auto/32/64)
if config["bus-size"] == "auto":
config["bus-size"] = str(lutinHost.BUS_SIZE)
# http://biolpc22.york.ac.uk/pub/linux-mac-cross/ # http://biolpc22.york.ac.uk/pub/linux-mac-cross/
# http://devs.openttd.org/~truebrain/compile-farm/apple-darwin9.txt # http://devs.openttd.org/~truebrain/compile-farm/apple-darwin9.txt
lutinTarget.Target.__init__(self, "MacOs", typeCompilator, debugMode, generatePackage, "", cross) lutinTarget.Target.__init__(self, "MacOs", config, "")
self.folder_bin="/MacOS" self.folder_bin="/MacOS"
self.folder_lib="/lib" self.folder_lib="/lib"

View File

@@ -1,30 +1,49 @@
#!/usr/bin/python #!/usr/bin/python
##
## @author Edouard DUPIN
##
## @copyright 2012, Edouard DUPIN, all right reserved
##
## @license APACHE v2.0 (see license file)
##
import lutinDebug as debug import lutinDebug as debug
import lutinTarget import lutinTarget
import lutinTools import lutinTools
import lutinHost
import os import os
import stat import stat
import lutinHost
import sys import sys
class Target(lutinTarget.Target): class Target(lutinTarget.Target):
def __init__(self, typeCompilator, debugMode, generatePackage, sumulator=False): def __init__(self, config):
if config["compilator"] != "gcc":
debug.error("Windows does not support '" + config["compilator"] + "' compilator ... availlable : [gcc]")
config["compilator"] = "gcc"
#processor type selection (auto/arm/ppc/x86)
if config["arch"] == "auto":
config["arch"] = "x86"
#bus size selection (auto/32/64)
if config["bus-size"] == "auto":
config["bus-size"] = str(lutinHost.BUS_SIZE)
lutinTarget.Target.__init__(self, "Windows", config, "")
# on windows board the basic path is not correct # on windows board the basic path is not correct
# TODO : get external PATH for the minGW path # TODO : get external PATH for the minGW path
# TODO : Set the cyngwin path ... # TODO : Set the cyngwin path ...
if lutinHost.OS == "Windows": if lutinHost.OS == "Windows":
cross = "c:\\MinGW\\bin\\" self.set_cross_base("c:\\MinGW\\bin\\")
sys.path.append("c:\\MinGW\\bin" ) sys.path.append("c:\\MinGW\\bin" )
os.environ['PATH'] += ";c:\\MinGW\\bin\\" os.environ['PATH'] += ";c:\\MinGW\\bin\\"
else: else:
#cross = "i586-mingw32msvc-" if self.config["bus-size"] == "64":
cross = "x86_64-w64-mingw32-" # 64 bits
#cross = "i686-w64-mingw32-" self.set_cross_base("x86_64-w64-mingw32-")
else:
if typeCompilator!="gcc": # 32 bits
debug.error("Android does not support '" + typeCompilator + "' compilator ... availlable : [gcc]") self.set_cross_base("i686-w64-mingw32-")
lutinTarget.Target.__init__(self, "Windows", typeCompilator, debugMode, generatePackage, "", cross)
self.folder_bin="" self.folder_bin=""
self.folder_lib="/lib" self.folder_lib="/lib"