[DEV] target generate packager, .so and android build
This commit is contained in:
parent
f3b74bbc02
commit
dff9cb1393
119
lutin.py
119
lutin.py
@ -6,7 +6,7 @@ import inspect
|
|||||||
import fnmatch
|
import fnmatch
|
||||||
import lutinDebug as debug
|
import lutinDebug as debug
|
||||||
import lutinEnv
|
import lutinEnv
|
||||||
|
import lutinModule
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Display the help of this makefile
|
Display the help of this makefile
|
||||||
@ -16,19 +16,38 @@ def usage():
|
|||||||
print " " + sys.argv[0] + " [options] [cible/properties] ..."
|
print " " + sys.argv[0] + " [options] [cible/properties] ..."
|
||||||
print " [help] display this help"
|
print " [help] display this help"
|
||||||
print " [option] : keep the last set"
|
print " [option] : keep the last set"
|
||||||
print " [-h/--help] Display this help and break"
|
print " -h / --help"
|
||||||
print " [-v?/--verbose=?] Display makefile debug level (verbose) default =2"
|
print " Display this help and break"
|
||||||
print " [-c/--color] Display makefile output in color"
|
print " -v / -v? / --verbose=?"
|
||||||
print " [-f/--force] Force the rebuild without checking the dependency"
|
print " Display makefile debug level (verbose) default =2"
|
||||||
|
print " 0 : None"
|
||||||
|
print " 1 : error"
|
||||||
|
print " 2 : warning"
|
||||||
|
print " 3 : info"
|
||||||
|
print " 4 : debug"
|
||||||
|
print " 5 : verbose"
|
||||||
|
print " -c / --color"
|
||||||
|
print " Display makefile output in color"
|
||||||
|
print " -f / --force"
|
||||||
|
print " Force the rebuild without checking the dependency"
|
||||||
print " [properties] : keep in the sequency of the cible"
|
print " [properties] : keep in the sequency of the cible"
|
||||||
print " [-p=.../--platform=...] (Android/Linux/MacOs/Windows) Select a platform (by default the platform is the computer that compile this"
|
print " -t=... / --target=..."
|
||||||
print " [-t/--tool] (clang/gcc) Compile with clang or Gcc mode (by default gcc will be used)"
|
print " (Android/Linux/MacOs/Windows) Select a target (by default the platform is the computer that compile this"
|
||||||
print " [-m=.../--mode=...] (debug/release) Compile in release or debug mode (default release)"
|
print " -C= / --compilator="
|
||||||
|
print " (clang/gcc) Compile with clang or Gcc mode (by default gcc will be used)"
|
||||||
|
print " -m=... / --mode=..."
|
||||||
|
print " (debug/release) Compile in release or debug mode (default release)"
|
||||||
print " [cible] : generate in order set"
|
print " [cible] : generate in order set"
|
||||||
print " [dump] Dump all the module dependency and properties"
|
print " all"
|
||||||
print " [all] 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] Clean all (same as previous)"
|
print " clean"
|
||||||
print " ... You can add 'module name' with at end : -clean to clean only this element"
|
print " Clean all (same as previous)"
|
||||||
|
print " dump"
|
||||||
|
print " Dump all the module dependency and properties"
|
||||||
|
listOfAllModule = lutinModule.ListAllModuleWithDesc()
|
||||||
|
for mod in listOfAllModule:
|
||||||
|
print " " + mod[0] + " / " + mod[0] + "-clean / " + mod[0] + "-dump"
|
||||||
|
print " " + mod[1]
|
||||||
print " ex: " + sys.argv[0] + " all board=Android all board=Windows all help"
|
print " ex: " + sys.argv[0] + " all board=Android all board=Windows all help"
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
@ -36,7 +55,8 @@ def usage():
|
|||||||
def parseGenericArg(argument,active):
|
def parseGenericArg(argument,active):
|
||||||
if argument == "-h" or argument == "--help":
|
if argument == "-h" or argument == "--help":
|
||||||
#display help
|
#display help
|
||||||
usage()
|
if active==False:
|
||||||
|
usage()
|
||||||
return True
|
return True
|
||||||
elif argument[:2] == "-v":
|
elif argument[:2] == "-v":
|
||||||
if active==True:
|
if active==True:
|
||||||
@ -72,57 +92,82 @@ if __name__ == "__main__":
|
|||||||
parseGenericArg(argument, True)
|
parseGenericArg(argument, True)
|
||||||
|
|
||||||
# now import other standard module (must be done here and not before ...
|
# now import other standard module (must be done here and not before ...
|
||||||
import lutinModule as module
|
import lutinTarget
|
||||||
import lutinHost as host
|
import lutinHost
|
||||||
import lutinTools
|
import lutinTools
|
||||||
import lutinHost as host
|
|
||||||
import lutinList as buildList
|
|
||||||
|
|
||||||
import lutinTargetLinux
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Run everything that is needed in the system
|
Run everything that is needed in the system
|
||||||
"""
|
"""
|
||||||
def Start():
|
def Start():
|
||||||
target = lutinTargetLinux.TargetLinux("gcc", "debug")
|
#available target : Linux / MacOs / Windows / Android ...
|
||||||
|
targetName=lutinHost.OS
|
||||||
|
#compilation base
|
||||||
|
compilator="gcc"
|
||||||
|
# build mode
|
||||||
|
mode="release"
|
||||||
|
# load the default target :
|
||||||
|
target = None
|
||||||
actionDone=False
|
actionDone=False
|
||||||
# parse all argument
|
# parse all argument
|
||||||
for argument in sys.argv[1:]:
|
for argument in sys.argv[1:]:
|
||||||
if True==parseGenericArg(argument, False):
|
if True==parseGenericArg(argument, False):
|
||||||
None # nothing to do ...
|
None # nothing to do ...
|
||||||
elif argument[:11] == "--platform=" or argument[:3] == "-p=":
|
elif argument[:13] == "--compilator=" or argument[:3] == "-C=":
|
||||||
tmpArg=""
|
tmpArg=""
|
||||||
if argument[:3] == "-p=":
|
if argument[:3] == "-p=":
|
||||||
tmpArg=argument[3:]
|
tmpArg=argument[3:]
|
||||||
else:
|
else:
|
||||||
tmpArg=argument[11:]
|
tmpArg=argument[13:]
|
||||||
# TODO ...
|
# check input ...
|
||||||
|
if tmpArg=="gcc" or tmpArg=="clang":
|
||||||
|
if compilator!=tmpArg:
|
||||||
|
debug.debug("change compilator ==> " + tmpArg)
|
||||||
|
compilator=tmpArg
|
||||||
|
#remove previous target
|
||||||
|
target = None
|
||||||
|
else:
|
||||||
|
debug.error("Set --compilator/-C: '" + tmpArg + "' but only availlable : [gcc/clang]")
|
||||||
|
elif argument[:9] == "--target=" or argument[:3] == "-t=":
|
||||||
|
tmpArg=""
|
||||||
|
if argument[:3] == "-t=":
|
||||||
|
tmpArg=argument[3:]
|
||||||
|
else:
|
||||||
|
tmpArg=argument[9:]
|
||||||
|
# No check input ==> this will be verify automaticly chen the target will be loaded
|
||||||
|
if targetName!=tmpArg:
|
||||||
|
debug.debug("change target ==> " + tmpArg + " & reset mode : gcc&release")
|
||||||
|
targetName=tmpArg
|
||||||
|
#reset properties by defauult:
|
||||||
|
compilator="gcc"
|
||||||
|
mode="release"
|
||||||
|
#remove previous target
|
||||||
|
target = None
|
||||||
elif argument[:7] == "--mode=" or argument[:3] == "-m=":
|
elif argument[:7] == "--mode=" or argument[:3] == "-m=":
|
||||||
tmpArg=""
|
tmpArg=""
|
||||||
if argument[:3] == "-m=":
|
if argument[:3] == "-m=":
|
||||||
tmpArg=argument[3:]
|
tmpArg=argument[3:]
|
||||||
else:
|
else:
|
||||||
tmpArg=argument[11:]
|
tmpArg=argument[11:]
|
||||||
if "debug"==tmpArg:
|
if "debug"==tmpArg or "release"==tmpArg:
|
||||||
lutinEnv.SetDebugMode(1)
|
if mode!=tmpArg:
|
||||||
elif "release"==tmpArg:
|
debug.debug("change mode ==> " + tmpArg)
|
||||||
lutinEnv.SetDebugMode(0)
|
mode = tmpArg
|
||||||
|
#remove previous target
|
||||||
|
target = None
|
||||||
else:
|
else:
|
||||||
debug.error("not understand build mode : '" + val + "' can be [debug/release]")
|
debug.error("Set --mode/-m: '" + tmpArg + "' but only availlable : [debug/release]")
|
||||||
lutinEnv.SetDebugMode(0)
|
|
||||||
elif argument[:7] == "--tool=" or argument[:3] == "-t=":
|
|
||||||
tmpArg=""
|
|
||||||
if argument[:3] == "-t=":
|
|
||||||
tmpArg=argument[3:]
|
|
||||||
else:
|
|
||||||
tmpArg=argument[11:]
|
|
||||||
lutinEnv.SetCompileMode(tmpArg)
|
|
||||||
else:
|
else:
|
||||||
|
#load the target if needed :
|
||||||
|
if target == None:
|
||||||
|
target = lutinTarget.TargetLoad(targetName, compilator, mode)
|
||||||
target.Build(argument)
|
target.Build(argument)
|
||||||
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 :
|
||||||
|
if target == None:
|
||||||
|
target = lutinTarget.TargetLoad(targetName, compilator, mode)
|
||||||
target.Build("all")
|
target.Build("all")
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
29
lutinEnv.py
29
lutinEnv.py
@ -1,35 +1,6 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import lutinDebug as debug
|
import lutinDebug as debug
|
||||||
|
|
||||||
debugMode=0
|
|
||||||
|
|
||||||
def SetDebugMode(val):
|
|
||||||
global debugMode
|
|
||||||
if val==1:
|
|
||||||
debugMode = 1
|
|
||||||
else:
|
|
||||||
debugMode = 0
|
|
||||||
|
|
||||||
def GetDebugMode():
|
|
||||||
global debugMode
|
|
||||||
return debugMode
|
|
||||||
|
|
||||||
CompileMode="gcc"
|
|
||||||
|
|
||||||
def SetCompileMode(val):
|
|
||||||
global CompileMode
|
|
||||||
if val=="clang":
|
|
||||||
CompileMode = val
|
|
||||||
if val=="gcc":
|
|
||||||
CompileMode = val
|
|
||||||
else:
|
|
||||||
debug.error("not understand compiling tool mode : '" + val + "' can be [gcc/clang]")
|
|
||||||
CompileMode = "gcc"
|
|
||||||
|
|
||||||
def GetClangMode():
|
|
||||||
global CompileMode
|
|
||||||
return CompileMode
|
|
||||||
|
|
||||||
forceMode=False
|
forceMode=False
|
||||||
|
|
||||||
def SetForceMode(val):
|
def SetForceMode(val):
|
||||||
|
44
lutinList.py
44
lutinList.py
@ -1,44 +0,0 @@
|
|||||||
#!/usr/bin/python
|
|
||||||
import lutinDebug as debug
|
|
||||||
import lutinModule as module
|
|
||||||
import lutinTargetLinux
|
|
||||||
import lutinHost
|
|
||||||
|
|
||||||
availlable=[]
|
|
||||||
|
|
||||||
def AddModule(name, type):
|
|
||||||
global availlable
|
|
||||||
if type=="BINARY":
|
|
||||||
availlable.append([name,"Module", "bin"])
|
|
||||||
else:
|
|
||||||
availlable.append([name,"Module", "other"])
|
|
||||||
|
|
||||||
def AddPackage(name):
|
|
||||||
global availlable
|
|
||||||
availlable.append([name,"Package", "pkg"])
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
currentTarget=None
|
|
||||||
|
|
||||||
def SetTarget(name):
|
|
||||||
global currentTarget
|
|
||||||
if name=="Linux":
|
|
||||||
currentTarget = lutinTargetLinux.Target()
|
|
||||||
elif name=="Windows":
|
|
||||||
debug.error("TODO : create target type :'" + name + "'")
|
|
||||||
elif name=="MacOs":
|
|
||||||
debug.error("TODO : create target type :'" + name + "'")
|
|
||||||
elif name=="Android":
|
|
||||||
debug.error("TODO : create target type :'" + name + "'")
|
|
||||||
else:
|
|
||||||
debug.error("Unknow target type :'" + name + "'")
|
|
||||||
|
|
||||||
|
|
||||||
def GetCurrentTarget():
|
|
||||||
global currentTarget
|
|
||||||
if currentTarget==None:
|
|
||||||
SetTarget(lutinHost.OS)
|
|
||||||
|
|
||||||
return currentTarget
|
|
||||||
|
|
133
lutinModule.py
133
lutinModule.py
@ -16,8 +16,10 @@ def RunCommand(cmdLine):
|
|||||||
ret = os.system(cmdLine)
|
ret = os.system(cmdLine)
|
||||||
# TODO : Use "subprocess" instead ==> permit to pipline the renderings ...
|
# TODO : Use "subprocess" instead ==> permit to pipline the renderings ...
|
||||||
if ret != 0:
|
if ret != 0:
|
||||||
#print "result val = " + str(ret)
|
if ret == 2:
|
||||||
debug.error("can not compile file ... ")
|
debug.error("can not compile file ... [keyboard interrrupt]")
|
||||||
|
else:
|
||||||
|
debug.error("can not compile file ... ret : " + str(ret))
|
||||||
"""
|
"""
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@ -78,6 +80,16 @@ class module:
|
|||||||
self.name=moduleName
|
self.name=moduleName
|
||||||
self.localHeritage = heritage.heritage(self)
|
self.localHeritage = heritage.heritage(self)
|
||||||
|
|
||||||
|
self.packageProp = { "COMPAGNY_TYPE" : set(""),
|
||||||
|
"COMPAGNY_NAME" : set(""),
|
||||||
|
"MAINTAINER" : set([]),
|
||||||
|
"ICON" : set(""),
|
||||||
|
"SECTION" : set([]),
|
||||||
|
"PRIORITY" : set(""),
|
||||||
|
"DESCRIPTION" : set(""),
|
||||||
|
"VERSION" : set("0.0.0")}
|
||||||
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
## Commands for running gcc to compile a m++ file.
|
## Commands for running gcc to compile a m++ file.
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@ -134,6 +146,7 @@ class module:
|
|||||||
cmdLine=lutinTools.ListToStr([
|
cmdLine=lutinTools.ListToStr([
|
||||||
target.xx,
|
target.xx,
|
||||||
"-o", tmpList[1] ,
|
"-o", tmpList[1] ,
|
||||||
|
target.global_include_cc,
|
||||||
lutinTools.AddPrefix("-I",self.export_path),
|
lutinTools.AddPrefix("-I",self.export_path),
|
||||||
lutinTools.AddPrefix("-I",self.local_path),
|
lutinTools.AddPrefix("-I",self.local_path),
|
||||||
lutinTools.AddPrefix("-I",depancy.path),
|
lutinTools.AddPrefix("-I",depancy.path),
|
||||||
@ -172,6 +185,7 @@ class module:
|
|||||||
cmdLine=lutinTools.ListToStr([
|
cmdLine=lutinTools.ListToStr([
|
||||||
target.cc,
|
target.cc,
|
||||||
"-o", tmpList[1],
|
"-o", tmpList[1],
|
||||||
|
target.global_include_cc,
|
||||||
lutinTools.AddPrefix("-I",self.export_path),
|
lutinTools.AddPrefix("-I",self.export_path),
|
||||||
lutinTools.AddPrefix("-I",self.local_path),
|
lutinTools.AddPrefix("-I",self.local_path),
|
||||||
lutinTools.AddPrefix("-I",depancy.path),
|
lutinTools.AddPrefix("-I",depancy.path),
|
||||||
@ -237,10 +251,23 @@ class module:
|
|||||||
and False==dependency.NeedRePackage(tmpList[1], depancy.src, False):
|
and False==dependency.NeedRePackage(tmpList[1], depancy.src, False):
|
||||||
return tmpList[1]
|
return tmpList[1]
|
||||||
lutinTools.CreateDirectoryOfFile(tmpList[1])
|
lutinTools.CreateDirectoryOfFile(tmpList[1])
|
||||||
debug.error("SharedLib")# + self.name + " ==> " + dst)
|
debug.printElement("SharedLib", self.name, "==>", tmpList[1])
|
||||||
|
#$(Q)$(TARGET_AR) $(TARGET_GLOBAL_ARFLAGS) $(PRIVATE_ARFLAGS) $@ $(PRIVATE_ALL_OBJECTS)
|
||||||
|
cmdLine=lutinTools.ListToStr([
|
||||||
|
target.xx,
|
||||||
|
"-o", tmpList[1],
|
||||||
|
target.global_sysroot,
|
||||||
|
"-shared",
|
||||||
|
tmpList[0],
|
||||||
|
depancy.src,
|
||||||
|
self.flags_ld,
|
||||||
|
depancy.flags_ld,
|
||||||
|
target.global_flags_ld])
|
||||||
|
RunCommand(cmdLine)
|
||||||
#debug.printElement("SharedLib", self.name, "==>", tmpList[1])
|
#debug.printElement("SharedLib", self.name, "==>", tmpList[1])
|
||||||
"""$(Q)$(TARGET_CXX) \
|
"""$(Q)$(TARGET_CXX) \
|
||||||
-o $@ \
|
-o $@ \
|
||||||
|
target.global_sysroot,
|
||||||
$(TARGET_GLOBAL_LDFLAGS_SHARED) \
|
$(TARGET_GLOBAL_LDFLAGS_SHARED) \
|
||||||
-Wl,-Map -Wl,$(basename $@).map \
|
-Wl,-Map -Wl,$(basename $@).map \
|
||||||
-shared \
|
-shared \
|
||||||
@ -274,6 +301,7 @@ class module:
|
|||||||
cmdLine=lutinTools.ListToStr([
|
cmdLine=lutinTools.ListToStr([
|
||||||
target.xx,
|
target.xx,
|
||||||
"-o", tmpList[1],
|
"-o", tmpList[1],
|
||||||
|
target.global_sysroot,
|
||||||
tmpList[0],
|
tmpList[0],
|
||||||
depancy.src,
|
depancy.src,
|
||||||
self.flags_ld,
|
self.flags_ld,
|
||||||
@ -324,8 +352,9 @@ class module:
|
|||||||
if target.IsModuleBuild(self.name)==True:
|
if target.IsModuleBuild(self.name)==True:
|
||||||
return self.localHeritage
|
return self.localHeritage
|
||||||
|
|
||||||
if packageName==None \
|
if packageName==None \
|
||||||
and self.type=='BINARY':
|
and ( self.type=="BINARY" \
|
||||||
|
or self.type=="PACKAGE" ) :
|
||||||
# this is the endpoint binary ...
|
# this is the endpoint binary ...
|
||||||
packageName = self.name
|
packageName = self.name
|
||||||
else :
|
else :
|
||||||
@ -363,6 +392,15 @@ class module:
|
|||||||
resFile = self.Link_to_bin(listSubFileNeededToBuild, packageName, target, subHeritage)
|
resFile = self.Link_to_bin(listSubFileNeededToBuild, packageName, target, subHeritage)
|
||||||
# generate tree for this special binary
|
# generate tree for this special binary
|
||||||
self.BuildTree(target, self.name)
|
self.BuildTree(target, self.name)
|
||||||
|
elif self.type=="PACKAGE":
|
||||||
|
if target.name=="Android":
|
||||||
|
resFile = self.Link_to_so(listSubFileNeededToBuild, packageName, target, subHeritage)
|
||||||
|
else:
|
||||||
|
resFile = self.Link_to_bin(listSubFileNeededToBuild, packageName, target, subHeritage)
|
||||||
|
# generate tree for this special binary
|
||||||
|
self.BuildTree(target, self.name)
|
||||||
|
# generate the package with his properties ...
|
||||||
|
target.MakePackage(self.name, self.packageProp)
|
||||||
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)
|
||||||
|
|
||||||
@ -393,7 +431,8 @@ class module:
|
|||||||
folderBuild = target.GetBuildFolder(self.name)
|
folderBuild = target.GetBuildFolder(self.name)
|
||||||
debug.info("remove folder : '" + folderBuild + "'")
|
debug.info("remove folder : '" + folderBuild + "'")
|
||||||
lutinTools.RemoveFolderAndSubFolder(folderBuild)
|
lutinTools.RemoveFolderAndSubFolder(folderBuild)
|
||||||
elif self.type=='BINARY':
|
elif self.type=='BINARY' \
|
||||||
|
or self.type=='PACKAGE':
|
||||||
# remove folder of the lib ... for this targer
|
# remove folder of the lib ... for this targer
|
||||||
folderBuild = target.GetBuildFolder(self.name)
|
folderBuild = target.GetBuildFolder(self.name)
|
||||||
debug.info("remove folder : '" + folderBuild + "'")
|
debug.info("remove folder : '" + folderBuild + "'")
|
||||||
@ -495,23 +534,82 @@ class module:
|
|||||||
self.PrintList('export_flags_mm',self.export_flags_mm)
|
self.PrintList('export_flags_mm',self.export_flags_mm)
|
||||||
self.PrintList('local_path',self.local_path)
|
self.PrintList('local_path',self.local_path)
|
||||||
|
|
||||||
|
def pkgSet(self, variable, value):
|
||||||
|
if "COMPAGNY_TYPE" == variable:
|
||||||
|
# com : Commercial
|
||||||
|
# net : Network??
|
||||||
|
# org : Organisation
|
||||||
|
# gov : Governement
|
||||||
|
# mil : Military
|
||||||
|
# edu : Education
|
||||||
|
# pri : Private
|
||||||
|
# museum : ...
|
||||||
|
if "com" != value \
|
||||||
|
and "net" != value \
|
||||||
|
and "org" != value \
|
||||||
|
and "gov" != value \
|
||||||
|
and "mil" != value \
|
||||||
|
and "edu" != value \
|
||||||
|
and "pri" != value \
|
||||||
|
and "museum" != value:
|
||||||
|
debug.error("can not set the value for this Input : '" + variable + "' : '" + value + "'")
|
||||||
|
else:
|
||||||
|
self.packageProp[variable] = value
|
||||||
|
elif "COMPAGNY_NAME" == variable:
|
||||||
|
self.packageProp[variable] = value
|
||||||
|
elif "ICON" == variable:
|
||||||
|
self.packageProp[variable] = value
|
||||||
|
elif "MAINTAINER" == variable:
|
||||||
|
self.packageProp[variable] = value
|
||||||
|
elif "SECTION" == variable:
|
||||||
|
# project section : (must be separate by coma
|
||||||
|
# refer to : http://packages.debian.org/sid/
|
||||||
|
# admin cli-mono comm database debian-installer
|
||||||
|
# debug doc editors electronics devel embedded
|
||||||
|
# fonts games gnome gnu-r gnustep graphics
|
||||||
|
# hamradio haskell httpd interpreters java
|
||||||
|
# kde kernel libdevel libs lisp localization
|
||||||
|
# mail math misc net news ocaml oldlibs otherosfs
|
||||||
|
# perl php python ruby science shells sound tex
|
||||||
|
# text utils vcs video virtual web x11 xfce zope ...
|
||||||
|
self.packageProp[variable] = value
|
||||||
|
elif "PRIORITY" == variable:
|
||||||
|
#list = ["required","important","standard","optional","extra"]
|
||||||
|
#if isinstance(value, list):
|
||||||
|
if "required" != value \
|
||||||
|
and "important" != value \
|
||||||
|
and "standard" != value \
|
||||||
|
and "optional" != value \
|
||||||
|
and "extra" != value:
|
||||||
|
debug.error("can not set the value for this Input : '" + variable + "' : '" + value + "'")
|
||||||
|
else:
|
||||||
|
self.packageProp[variable] = value
|
||||||
|
elif "DESCRIPTION" == variable:
|
||||||
|
self.packageProp[variable] = value
|
||||||
|
elif "VERSION" == variable:
|
||||||
|
self.packageProp[variable] = value
|
||||||
|
else:
|
||||||
|
debug.error("not know pak element : '" + variable + "'")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
moduleList=[]
|
moduleList=[]
|
||||||
|
__startModuleName="lutin_"
|
||||||
|
|
||||||
def ImportPath(path):
|
def ImportPath(path):
|
||||||
global moduleList
|
global moduleList
|
||||||
matches = []
|
matches = []
|
||||||
debug.debug('Start find sub File : "%s"' %path)
|
debug.debug('Start find sub File : "%s"' %path)
|
||||||
for root, dirnames, filenames in os.walk(path):
|
for root, dirnames, filenames in os.walk(path):
|
||||||
tmpList = fnmatch.filter(filenames, 'lutin_*.py')
|
tmpList = fnmatch.filter(filenames, __startModuleName + "*.py")
|
||||||
# Import the module :
|
# Import the module :
|
||||||
for filename in tmpList:
|
for filename in tmpList:
|
||||||
debug.debug(' Find a file : "%s"' %os.path.join(root, filename))
|
debug.debug(' Find a file : "%s"' %os.path.join(root, filename))
|
||||||
#matches.append(os.path.join(root, filename))
|
#matches.append(os.path.join(root, filename))
|
||||||
sys.path.append(os.path.dirname(os.path.join(root, filename)) )
|
sys.path.append(os.path.dirname(os.path.join(root, filename)) )
|
||||||
moduleName = filename.replace('.py', '')
|
moduleName = filename.replace('.py', '')
|
||||||
moduleName = moduleName.replace('lutin_', '')
|
moduleName = moduleName.replace(__startModuleName, '')
|
||||||
debug.debug("integrate module: '" + moduleName + "' from '" + os.path.join(root, filename) + "'")
|
debug.debug("integrate module: '" + moduleName + "' from '" + os.path.join(root, filename) + "'")
|
||||||
moduleList.append([moduleName,os.path.join(root, filename)])
|
moduleList.append([moduleName,os.path.join(root, filename)])
|
||||||
|
|
||||||
@ -520,9 +618,12 @@ def LoadModule(target, name):
|
|||||||
for mod in moduleList:
|
for mod in moduleList:
|
||||||
if mod[0]==name:
|
if mod[0]==name:
|
||||||
sys.path.append(os.path.dirname(mod[1]))
|
sys.path.append(os.path.dirname(mod[1]))
|
||||||
theModule = __import__("lutin_" + name)
|
theModule = __import__(__startModuleName + name)
|
||||||
|
#try:
|
||||||
tmpElement = theModule.Create(target)
|
tmpElement = theModule.Create(target)
|
||||||
target.AddModule(tmpElement)
|
target.AddModule(tmpElement)
|
||||||
|
#except:
|
||||||
|
# debug.error(" no function 'Create' in the module : " + mod[0] + " from:'" + mod[1] + "'")
|
||||||
|
|
||||||
def ListAllModule():
|
def ListAllModule():
|
||||||
global moduleList
|
global moduleList
|
||||||
@ -531,4 +632,18 @@ def ListAllModule():
|
|||||||
tmpListName.append(mod[0])
|
tmpListName.append(mod[0])
|
||||||
return tmpListName
|
return tmpListName
|
||||||
|
|
||||||
|
def ListAllModuleWithDesc():
|
||||||
|
global moduleList
|
||||||
|
tmpList = []
|
||||||
|
for mod in moduleList:
|
||||||
|
sys.path.append(os.path.dirname(mod[1]))
|
||||||
|
theModule = __import__("lutin_" + mod[0])
|
||||||
|
try:
|
||||||
|
tmpdesc = theModule.GetDesc()
|
||||||
|
AddModule(tmpElement)
|
||||||
|
tmpList.append([mod[0], tmpdesc])
|
||||||
|
except:
|
||||||
|
tmpList.append([mod[0], "no description"])
|
||||||
|
return tmpList
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,34 +5,38 @@ import lutinTools
|
|||||||
import lutinModule
|
import lutinModule
|
||||||
|
|
||||||
class Target:
|
class Target:
|
||||||
def __init__(self, name, typeCompilator, debugMode):
|
def __init__(self, name, typeCompilator, debugMode, arch, cross):
|
||||||
|
self.arch = arch
|
||||||
|
self.cross = cross
|
||||||
self.name=name
|
self.name=name
|
||||||
debug.info("create board target : "+self.name);
|
debug.info("create board target : "+self.name);
|
||||||
if "clang"==typeCompilator:
|
if "clang"==typeCompilator:
|
||||||
self.cc='clang'
|
self.cc=self.cross + "clang"
|
||||||
self.xx='clang++'
|
self.xx=self.cross + "clang++"
|
||||||
else:
|
else:
|
||||||
self.cc='gcc'
|
self.cc=self.cross + "gcc"
|
||||||
self.xx='g++'
|
self.xx=self.cross + "g++"
|
||||||
self.ar='ar'
|
self.ar=self.cross + "ar"
|
||||||
self.ld='ld'
|
self.ld=self.cross + "ld"
|
||||||
self.nm='nm'
|
self.nm=self.cross + "nm"
|
||||||
self.strip='strip'
|
self.strip=self.cross + "strip"
|
||||||
self.ranlib='ranlib'
|
self.ranlib=self.cross + "ranlib"
|
||||||
self.dlltool='dlltool'
|
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__Linux', "-DBUILD_TIME=\"\\\""+str(datetime.datetime.now())+"\\\"\""]
|
self.global_flags_cc=['-D__TARGET_OS__'+self.name, "-DBUILD_TIME=\"\\\""+str(datetime.datetime.now())+"\\\"\""]
|
||||||
self.global_flags_xx=''
|
self.global_flags_xx=[]
|
||||||
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']
|
||||||
self.global_flags_ld=''
|
self.global_flags_ld=[]
|
||||||
self.global_flags_ld_shared=''
|
self.global_flags_ld_shared=[]
|
||||||
self.global_libs_ld=''
|
self.global_libs_ld=[]
|
||||||
self.global_libs_ld_shared=''
|
self.global_libs_ld_shared=[]
|
||||||
|
|
||||||
|
self.global_sysroot=""
|
||||||
|
|
||||||
self.suffix_dependence='.d'
|
self.suffix_dependence='.d'
|
||||||
self.suffix_obj='.o'
|
self.suffix_obj='.o'
|
||||||
@ -87,6 +91,9 @@ class Target:
|
|||||||
debug.error("unknow type : " + type)
|
debug.error("unknow type : " + type)
|
||||||
return list
|
return list
|
||||||
|
|
||||||
|
def GetFinalFolder(self):
|
||||||
|
return lutinTools.GetRunFolder() + self.folder_out + self.folder_final + "/"
|
||||||
|
|
||||||
def GetStagingFolder(self, binaryName):
|
def GetStagingFolder(self, binaryName):
|
||||||
return lutinTools.GetRunFolder() + self.folder_out + self.folder_staging + "/" + binaryName + "/"
|
return lutinTools.GetRunFolder() + self.folder_out + self.folder_staging + "/" + binaryName + "/"
|
||||||
|
|
||||||
@ -160,7 +167,8 @@ class Target:
|
|||||||
debug.info("Build all")
|
debug.info("Build all")
|
||||||
self.LoadAll()
|
self.LoadAll()
|
||||||
for mod in self.moduleList:
|
for mod in self.moduleList:
|
||||||
if mod.type == 'BINARY':
|
if mod.type == "BINARY" \
|
||||||
|
or mod.type == "PACKAGE":
|
||||||
mod.Build(self, None)
|
mod.Build(self, None)
|
||||||
elif name == "clean":
|
elif name == "clean":
|
||||||
debug.info("Clean all")
|
debug.info("Clean all")
|
||||||
@ -199,3 +207,12 @@ class Target:
|
|||||||
debug.error("not know module name : '" + name + "' to build it")
|
debug.error("not know module name : '" + name + "' to build it")
|
||||||
|
|
||||||
|
|
||||||
|
__startTargetName="lutinTarget"
|
||||||
|
|
||||||
|
def TargetLoad(targetName, compilator, mode):
|
||||||
|
theTarget = __import__(__startTargetName + targetName)
|
||||||
|
#try:
|
||||||
|
tmpTarget = theTarget.Target(compilator, mode)
|
||||||
|
return tmpTarget
|
||||||
|
#except:
|
||||||
|
# debug.error("Can not create the Target : '" + targetName + "'")
|
||||||
|
@ -1 +1,72 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
import lutinDebug as debug
|
||||||
|
import lutinTarget
|
||||||
|
import lutinTools
|
||||||
|
import os
|
||||||
|
|
||||||
|
class Target(lutinTarget.Target):
|
||||||
|
def __init__(self, typeCompilator, debugMode):
|
||||||
|
|
||||||
|
self.folder_ndk = os.getenv('PROJECT_NDK', lutinTools.GetRunFolder() + "/../android/ndk/")
|
||||||
|
self.folder_sdk = os.getenv('PROJECT_SDK', lutinTools.GetRunFolder() + "/../android/ndk/")
|
||||||
|
arch = "ARMv7"
|
||||||
|
cross = self.folder_ndk + "/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-"
|
||||||
|
|
||||||
|
if typeCompilator!="gcc":
|
||||||
|
debug.error("Android does not support '" + typeCompilator + "' compilator ... availlable : [gcc]")
|
||||||
|
|
||||||
|
lutinTarget.Target.__init__(self, "Android", "gcc", debugMode, arch, cross)
|
||||||
|
|
||||||
|
self.boardId = 14
|
||||||
|
self.global_include_cc.append("-I" + self.folder_ndk +"/platforms/android-" + str(self.boardId) + "/arch-arm/usr/include")
|
||||||
|
self.global_include_cc.append("-I" + self.folder_ndk +"/sources/cxx-stl/system/include/")
|
||||||
|
|
||||||
|
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("-fno-exceptions")
|
||||||
|
self.global_flags_cc.append("-fomit-frame-pointer")
|
||||||
|
self.global_flags_cc.append("-fno-strict-aliasing")
|
||||||
|
|
||||||
|
self.global_flags_xx.append("-fno-rtti")
|
||||||
|
self.global_flags_xx.append("-Wa,--noexecstack")
|
||||||
|
|
||||||
|
|
||||||
|
def MakePackage(self, moduleName, pkgProperties):
|
||||||
|
None # ...
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,12 +1,76 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import lutinDebug as debug
|
import lutinDebug as debug
|
||||||
import datetime
|
|
||||||
import lutinTools
|
|
||||||
import lutinEnv as environement
|
|
||||||
import lutinTarget
|
import lutinTarget
|
||||||
|
import lutinTools
|
||||||
|
import os
|
||||||
|
import stat
|
||||||
|
|
||||||
class TargetLinux(lutinTarget.Target):
|
class Target(lutinTarget.Target):
|
||||||
def __init__(self, typeCompilator, debugMode):
|
def __init__(self, typeCompilator, debugMode):
|
||||||
lutinTarget.Target.__init__(self, "Linux", typeCompilator, debugMode)
|
lutinTarget.Target.__init__(self, "Linux", typeCompilator, debugMode, "", "")
|
||||||
|
|
||||||
|
def generateListSeparateComa(self, list):
|
||||||
|
result = ""
|
||||||
|
fistTime = True
|
||||||
|
for elem in list:
|
||||||
|
if fistTime == True:
|
||||||
|
fistTime = False
|
||||||
|
else:
|
||||||
|
result += ","
|
||||||
|
result += elem
|
||||||
|
return result
|
||||||
|
|
||||||
|
def MakePackage(self, pkgName, pkgProperties):
|
||||||
|
# http://alp.developpez.com/tutoriels/debian/creer-paquet/
|
||||||
|
debug.debug("------------------------------------------------------------------------")
|
||||||
|
debug.info("Generate package '" + pkgName + "'")
|
||||||
|
debug.debug("------------------------------------------------------------------------")
|
||||||
|
self.GetStagingFolder(pkgName)
|
||||||
|
targetOutFolderDebian=self.GetStagingFolder(pkgName) + "/" + pkgName + "/DEBIAN/"
|
||||||
|
finalFileControl = targetOutFolderDebian + "control"
|
||||||
|
finalFilepostRm = targetOutFolderDebian + "postrm"
|
||||||
|
# create the folders :
|
||||||
|
lutinTools.CreateDirectoryOfFile(finalFileControl)
|
||||||
|
lutinTools.CreateDirectoryOfFile(finalFilepostRm)
|
||||||
|
## Create the control file
|
||||||
|
tmpFile = open(finalFileControl, 'w')
|
||||||
|
tmpFile.write("Package: " + pkgName + "\n")
|
||||||
|
tmpFile.write("Version: " + pkgProperties["VERSION"] + "\n")
|
||||||
|
tmpFile.write("Section: " + self.generateListSeparateComa(pkgProperties["SECTION"]) + "\n")
|
||||||
|
tmpFile.write("Priority: " + pkgProperties["PRIORITY"] + "\n")
|
||||||
|
tmpFile.write("Architecture: all\n")
|
||||||
|
tmpFile.write("Depends: bash\n")
|
||||||
|
tmpFile.write("Maintainer: " + self.generateListSeparateComa(pkgProperties["MAINTAINER"]) + "\n")
|
||||||
|
tmpFile.write("Description: " + pkgProperties["DESCRIPTION"] + "\n")
|
||||||
|
tmpFile.write("\n")
|
||||||
|
tmpFile.closed
|
||||||
|
## Create the PostRm
|
||||||
|
tmpFile = open(finalFilepostRm, 'w')
|
||||||
|
tmpFile.write("#!/bin/bash\n")
|
||||||
|
tmpFile.write("touch ~/." + pkgName + "\n")
|
||||||
|
if pkgName != "":
|
||||||
|
tmpFile.write("rm -r ~/.local/" + pkgName + "\n")
|
||||||
|
tmpFile.write("\n")
|
||||||
|
tmpFile.closed
|
||||||
|
## Enable Execution in script
|
||||||
|
os.chmod(finalFilepostRm, stat.S_IRWXU + stat.S_IRGRP + stat.S_IXGRP + stat.S_IROTH + stat.S_IXOTH);
|
||||||
|
# copy licence and information :
|
||||||
|
lutinTools.CopyFile("os-Linux/README", self.GetStagingFolder(pkgName) + "/usr/share/doc/README")
|
||||||
|
lutinTools.CopyFile("license.txt", self.GetStagingFolder(pkgName) + "/usr/share/doc/copyright")
|
||||||
|
lutinTools.CopyFile("changelog", self.GetStagingFolder(pkgName) + "/usr/share/doc/changelog")
|
||||||
|
debug.debug("pachage : " + self.GetStagingFolder(pkgName) + "/" + pkgName + ".deb")
|
||||||
|
os.system("cd " + self.GetStagingFolder(pkgName) + " ; dpkg-deb --build " + pkgName)
|
||||||
|
lutinTools.CreateDirectoryOfFile(self.GetFinalFolder())
|
||||||
|
lutinTools.CopyFile(self.GetStagingFolder(pkgName) + "/" + pkgName + ".deb", self.GetFinalFolder() + "/" + pkgName + ".deb")
|
||||||
|
|
||||||
|
def InstallPackage(self, pkgName):
|
||||||
|
debug.debug("------------------------------------------------------------------------")
|
||||||
|
debug.info("Install package '" + pkgName + "'")
|
||||||
|
debug.debug("------------------------------------------------------------------------")
|
||||||
|
#sudo dpkg -i $(TARGET_OUT_FINAL)/$(PROJECT_NAME).deb
|
||||||
|
|
||||||
|
def InstallPackage(self, pkgName):
|
||||||
|
debug.debug("------------------------------------------------------------------------")
|
||||||
|
debug.info("Un-Install package '" + pkgName + "'")
|
||||||
|
debug.debug("------------------------------------------------------------------------")
|
||||||
|
#sudo dpkg -r $(TARGET_OUT_FINAL)/$(PROJECT_NAME).deb
|
||||||
|
Loading…
x
Reference in New Issue
Block a user