[DEV] android package is OK and Windows generation is ok

This commit is contained in:
Edouard DUPIN 2013-04-23 21:48:36 +02:00
parent dff9cb1393
commit 78d74b125f
9 changed files with 439 additions and 30 deletions

View File

@ -41,19 +41,21 @@ def NeedReBuild(dst, src, dependFile):
for curLine in file.readlines():
# normal file : end with : ": \\n"
curLine = curLine[:len(curLine)-1]
# removing last \ ...
if curLine[len(curLine)-1:] == '\\' :
curLine = curLine[len(curLine)-1:]
# remove white space :
curLine = curLine.strip()
testFile=""
if curLine[len(curLine)-3:] == ': \\' \
or curLine[len(curLine)-2:] == ': ' \
or curLine[len(curLine)-1:] == ':':
if curLine[len(curLine)-1:] == ':':
debug.verbose(" Line (no check (already done) : '" + curLine + "'");
elif curLine[len(curLine)-2:] == ' \\':
testFile = curLine[1:len(curLine)-2]
debug.verbose(" Line (might check1) : '" + testFile + "'");
elif len(curLine) == 0:
elif len(curLine) == 0 \
or curLine == '\\':
debug.verbose(" Line (Not parsed) : '" + curLine + "'");
else:
testFile = curLine[1:]
debug.verbose(" Line (might check2) : '" + testFile + "'");
testFile = curLine
debug.verbose(" Line (might check) : '" + testFile + "'");
# really check files:
if testFile!="":
debug.verbose(" ==> test");

View File

@ -1,6 +1,8 @@
#!/usr/bin/python
import lutinDebug as debug
forceMode=False
def SetForceMode(val):

View File

@ -82,12 +82,16 @@ class module:
self.packageProp = { "COMPAGNY_TYPE" : set(""),
"COMPAGNY_NAME" : set(""),
"COMPAGNY_NAME2" : set(""),
"MAINTAINER" : set([]),
"ICON" : set(""),
"SECTION" : set([]),
"PRIORITY" : set(""),
"DESCRIPTION" : set(""),
"VERSION" : set("0.0.0")}
"VERSION" : set("0.0.0"),
"NAME" : set("no-name"), # name of the application
"RIGHT" : []
}
###############################################################################
@ -557,6 +561,11 @@ class module:
self.packageProp[variable] = value
elif "COMPAGNY_NAME" == variable:
self.packageProp[variable] = value
val2 = value.lower()
val2 = val2.replace(' ', '')
val2 = val2.replace('-', '')
val2 = val2.replace('_', '')
self.packageProp["COMPAGNY_NAME2"] = val2
elif "ICON" == variable:
self.packageProp[variable] = value
elif "MAINTAINER" == variable:
@ -588,9 +597,14 @@ class module:
self.packageProp[variable] = value
elif "VERSION" == variable:
self.packageProp[variable] = value
elif "NAME" == variable:
self.packageProp[variable] = value
else:
debug.error("not know pak element : '" + variable + "'")
def pkgAddRight(self, value):
self.packageProp["RIGHT"].append(value)
@ -621,7 +635,10 @@ def LoadModule(target, name):
theModule = __import__(__startModuleName + name)
#try:
tmpElement = theModule.Create(target)
target.AddModule(tmpElement)
if (tmpElement == None) :
debug.debug("Request load module '" + name + "' not define for this platform")
else:
target.AddModule(tmpElement)
#except:
# debug.error(" no function 'Create' in the module : " + mod[0] + " from:'" + mod[1] + "'")

View File

@ -26,7 +26,7 @@ class Target:
# Target global variables.
###############################################################################
self.global_include_cc=[]
self.global_flags_cc=['-D__TARGET_OS__'+self.name, "-DBUILD_TIME=\"\\\""+str(datetime.datetime.now())+"\\\"\""]
self.global_flags_cc=['-D__TARGET_OS__'+self.name]
self.global_flags_xx=[]
self.global_flags_mm=[]
self.global_flags_m=[]
@ -63,6 +63,10 @@ class Target:
self.buildTreeDone=[]
self.moduleList=[]
# TODO : Remove this hack ... ==> really bad ... but usefull
def SetEwolFolder(self, folder):
self.folder_ewol = folder
"""
return a list of 3 elements :
0 : sources files (can be a list)
@ -177,7 +181,17 @@ class Target:
mod.Clean(self)
else:
myLen = len(name)
if name[myLen-5:] == "-dump":
if name[myLen-8:] == "-install":
tmpName = name[:myLen-8]
self.Build(tmpName + "-build")
self.InstallPackage(tmpName)
elif name[myLen-10:] == "-uninstall":
tmpName = name[:myLen-10]
self.UnInstallPackage(tmpName)
elif name[myLen-4:] == "-log":
tmpName = name[:myLen-4]
self.Log(tmpName)
elif name[myLen-5:] == "-dump":
tmpName = name[:myLen-5]
self.LoadIfNeeded(tmpName)
# clean requested
@ -198,13 +212,16 @@ class Target:
return
debug.error("not know module name : '" + cleanName + "' to clean it")
else:
tmpName = name
if name[myLen-6:] == "-build":
tmpName = name[:myLen-6]
# Build requested
self.LoadIfNeeded(name)
self.LoadIfNeeded(tmpName)
for mod in self.moduleList:
if mod.name == name:
debug.info("Build module '" + name + "'")
if mod.name == tmpName:
debug.info("Build module '" + tmpName + "'")
return mod.Build(self, None)
debug.error("not know module name : '" + name + "' to build it")
debug.error("not know module name : '" + tmpName + "' to build it")
__startTargetName="lutinTarget"

View File

@ -5,11 +5,22 @@ import lutinTarget
import lutinTools
import os
def RunCommand(cmdLine):
debug.debug(cmdLine)
ret = os.system(cmdLine)
# TODO : Use "subprocess" instead ==> permit to pipline the renderings ...
if ret != 0:
if ret == 2:
debug.error("can not execute cmdLine ... [keyboard interrrupt]")
else:
debug.error("can not execute cmdLine ... ret : " + str(ret))
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/")
self.folder_sdk = os.getenv('PROJECT_SDK', lutinTools.GetRunFolder() + "/../android/sdk/")
arch = "ARMv7"
cross = self.folder_ndk + "/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-"
@ -18,6 +29,14 @@ class Target(lutinTarget.Target):
lutinTarget.Target.__init__(self, "Android", "gcc", debugMode, arch, cross)
self.folder_bin="/mustNotCreateBinary"
self.folder_lib="/data/lib/armeabi"
self.folder_data="/data/assets"
self.folder_doc="/doc"
self.suffix_package='.pkg'
# board id at 14 is for android 4.0 and more ...
self.boardId = 14
self.global_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/")
@ -62,11 +81,234 @@ class Target(lutinTarget.Target):
self.global_flags_xx.append("-fno-rtti")
self.global_flags_xx.append("-Wa,--noexecstack")
def CheckRightPackage(self, pkgProperties, value):
for val in pkgProperties["RIGHT"]:
if value == val:
return True
return False
def MakePackage(self, moduleName, pkgProperties):
None # ...
def MakePackage(self, pkgName, pkgProperties):
# http://alp.developpez.com/tutoriels/debian/creer-paquet/
debug.debug("------------------------------------------------------------------------")
debug.info("Generate package '" + pkgName + "'")
debug.debug("------------------------------------------------------------------------")
# FINAL_FOLDER_JAVA_PROJECT
self.folder_javaProject= self.GetStagingFolder(pkgName) \
+ "/src/" \
+ pkgProperties["COMPAGNY_TYPE"] \
+ "/" + pkgProperties["COMPAGNY_NAME2"] \
+ "/" + pkgName + "/"
#FINAL_FILE_ABSTRACTION
self.file_finalAbstraction = self.folder_javaProject + "/" + pkgName + ".java"
lutinTools.CopyFile(self.folder_ewol + "/sources/android/PROJECT_NAME.java", self.file_finalAbstraction, True)
os.system("sed -i \"s|__PROJECT_ORG_TYPE__|"+pkgProperties["COMPAGNY_TYPE"]+"|\" " + self.file_finalAbstraction)
os.system("sed -i \"s|__PROJECT_VENDOR__|"+pkgProperties["COMPAGNY_NAME2"]+"|\" " + self.file_finalAbstraction)
os.system("sed -i \"s|__PROJECT_NAME__|" + pkgName + "|\" "+ self.file_finalAbstraction)
os.system("sed -i \"s|__PROJECT_PACKAGE__|" + pkgName + "|\" " + self.file_finalAbstraction)
os.system("sed -i \"s|__CONF_OGL_ES_V__|2|\" " + self.file_finalAbstraction)
lutinTools.CopyFile(pkgProperties["ICON"], self.GetStagingFolder(pkgName) + "/res/drawable/icon.png", True)
debug.printElement("pkg", "AndroidManifest.xml", "<==", "package configurations")
tmpFile = open(self.GetStagingFolder(pkgName) + "/AndroidManifest.xml", 'w')
tmpFile.write( "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
tmpFile.write( "<!-- Manifest is autoGenerated with Ewol ... do not patch it-->\n")
tmpFile.write( "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" \n")
tmpFile.write( " package=\""+pkgProperties["COMPAGNY_TYPE"]+"."+pkgProperties["COMPAGNY_NAME2"]+"." + pkgName + "\" \n")
tmpFile.write( " android:versionCode=\"1\" \n")
tmpFile.write( " android:versionName=\""+pkgProperties["VERSION"]+"\"> \n")
tmpFile.write( " <uses-feature android:glEsVersion=\"0x00020000\" android:required=\"true\" />\n")
tmpFile.write( " <uses-sdk android:minSdkVersion=\"" + str(self.boardId) + "\" /> \n")
tmpFile.write( " \n")
tmpFile.write( " <application android:label=\"" + pkgName + "\" \n")
tmpFile.write( " android:icon=\"@drawable/icon\" >\n")
tmpFile.write( " <activity android:name=\"." + pkgName + "\" \n")
if "debug"==self.buildMode:
tmpFile.write( " android:label=\"" + pkgProperties["NAME"] + "-debug\" \n")
else:
tmpFile.write( " android:label=\"" + pkgProperties["NAME"] + "\" \n")
tmpFile.write( " android:icon=\"@drawable/icon\" \n")
tmpFile.write( " android:hardwareAccelerated=\"true\" \n")
tmpFile.write( " android:configChanges=\"orientation\"> \n")
tmpFile.write( " <intent-filter> \n")
tmpFile.write( " <action android:name=\"android.intent.action.MAIN\" /> \n")
tmpFile.write( " <category android:name=\"android.intent.category.LAUNCHER\" /> \n")
tmpFile.write( " </intent-filter> \n")
tmpFile.write( " </activity> \n")
tmpFile.write( " </application> \n")
if True==self.CheckRightPackage(pkgProperties, "WRITE_EXTERNAL_STORAGE"):
tmpFile.write( " <uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\" /> \n")
if True==self.CheckRightPackage(pkgProperties, "CAMERA"):
tmpFile.write( " <uses-permission android:name=\"android.permission.CAMERA\" /> \n")
if True==self.CheckRightPackage(pkgProperties, "INTERNET"):
tmpFile.write( " <uses-permission android:name=\"android.permission.INTERNET\" /> \n")
if True==self.CheckRightPackage(pkgProperties, "MODIFY_AUDIO_SETTINGS"):
tmpFile.write( " <uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\" /> \n")
if True==self.CheckRightPackage(pkgProperties, "READ_CALENDAR"):
tmpFile.write( " <uses-permission android:name=\"android.permission.READ_CALENDAR\" /> \n")
if True==self.CheckRightPackage(pkgProperties, "READ_CONTACTS"):
tmpFile.write( " <uses-permission android:name=\"android.permission.READ_CONTACTS\" /> \n")
if True==self.CheckRightPackage(pkgProperties, "READ_FRAME_BUFFER"):
tmpFile.write( " <uses-permission android:name=\"android.permission.READ_FRAME_BUFFER\" /> \n")
if True==self.CheckRightPackage(pkgProperties, "READ_PROFILE"):
tmpFile.write( " <uses-permission android:name=\"android.permission.READ_PROFILE\" /> \n")
if True==self.CheckRightPackage(pkgProperties, "RECORD_AUDIO"):
tmpFile.write( " <uses-permission android:name=\"android.permission.RECORD_AUDIO\" /> \n")
if True==self.CheckRightPackage(pkgProperties, "SET_ORIENTATION"):
tmpFile.write( " <uses-permission android:name=\"android.permission.SET_ORIENTATION\" /> \n")
if True==self.CheckRightPackage(pkgProperties, "VIBRATE"):
tmpFile.write( " <uses-permission android:name=\"android.permission.VIBRATE\" /> \n")
if True==self.CheckRightPackage(pkgProperties, "ACCESS_COARSE_LOCATION"):
tmpFile.write( " <uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\" /> \n")
if True==self.CheckRightPackage(pkgProperties, "ACCESS_FINE_LOCATION"):
tmpFile.write( " <uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\" /> \n")
tmpFile.write( "</manifest>\n\n")
tmpFile.flush()
tmpFile.close()
# Doc :
# http://asantoso.wordpress.com/2009/09/15/how-to-build-android-application-package-apk-from-the-command-line-using-the-sdk-tools-continuously-integrated-using-cruisecontrol/
debug.printElement("pkg", "R.java", "<==", "Resources files")
cmdLine = self.folder_sdk + "/platform-tools/aapt p -f " \
+ "-M " + self.GetStagingFolder(pkgName) + "/AndroidManifest.xml " \
+ "-F " + self.GetStagingFolder(pkgName) + "/resources.res " \
+ "-I " + self.folder_sdk + "/platforms/android-" + str(self.boardId) + "/android.jar "\
+ "-S " + self.GetStagingFolder(pkgName) + "/res/ " \
+ "-J " + self.GetStagingFolder(pkgName) + "/src "
RunCommand(cmdLine)
#aapt package -f -M ${manifest.file} -F ${packaged.resource.file} -I ${path.to.android-jar.library}
# -S ${android-resource-directory} [-m -J ${folder.to.output.the.R.java}]
lutinTools.CreateDirectoryOfFile(self.GetStagingFolder(pkgName) + "/build/classes/noFile")
debug.printElement("pkg", "*.class", "<==", "*.java")
# more information with : -Xlint
cmdLine = "javac " \
+ "-d " + self.GetStagingFolder(pkgName) + "/build/classes " \
+ "-classpath " + self.folder_sdk + "/platforms/android-" + str(self.boardId) + "/android.jar " \
+ self.file_finalAbstraction + " "\
+ self.folder_ewol + "/sources/android/src/org/ewol/interfaceJNI.java " \
+ self.folder_ewol + "/sources/android/src/org/ewol/interfaceOpenGL.java " \
+ self.folder_ewol + "/sources/android/src/org/ewol/interfaceSurfaceView.java " \
+ self.folder_ewol + "/sources/android/src/org/ewol/interfaceAudio.java " \
+ self.GetStagingFolder(pkgName) + "/src/R.java "
RunCommand(cmdLine)
debug.printElement("pkg", ".dex", "<==", "*.class")
cmdLine = self.folder_sdk + "/platform-tools/dx " \
+ "--dex --no-strict " \
+ "--output=" + self.GetStagingFolder(pkgName) + "/build/" + pkgName + ".dex " \
+ self.GetStagingFolder(pkgName) + "/build/classes/ "
RunCommand(cmdLine)
debug.printElement("pkg", ".apk", "<==", ".dex, assets, .so, res")
cmdLine = self.folder_sdk + "/tools/apkbuilder " \
+ self.GetStagingFolder(pkgName) + "/build/" + pkgName + "-unalligned.apk " \
+ "-u " \
+ "-z " + self.GetStagingFolder(pkgName) + "/resources.res " \
+ "-f " + self.GetStagingFolder(pkgName) + "/build/" + pkgName + ".dex " \
+ "-rf " + self.GetStagingFolder(pkgName) + "/data "
RunCommand(cmdLine)
# doc :
# http://developer.android.com/tools/publishing/app-signing.html
if "debug"==self.buildMode:
# To create the debug Key ==> for all ...
#keytool -genkeypair -v -keystore $(BUILD_SYSTEM)/AndroidDebugKey.jks -storepass Pass__AndroidDebugKey -alias alias__AndroidDebugKey -keypass PassKey__AndroidDebugKey -keyalg RSA -validity 36500
# use default common generic debug key:
# generate the pass file (debug mode does not request to have a complicated key) :
tmpFile = open("tmpPass.boo", 'w')
tmpFile.write("Pass__AndroidDebugKey\n")
tmpFile.write("PassKey__AndroidDebugKey\n")
tmpFile.flush()
tmpFile.close()
# verbose mode : -verbose
cmdLine = "jarsigner " \
+ "-keystore " + lutinTools.GetCurrentPath(__file__) + "/core/AndroidDebugKey.jks " \
+ self.GetStagingFolder(pkgName) + "/build/" + pkgName + "-unalligned.apk " \
+ " alias__AndroidDebugKey " \
+ " < tmpPass.boo"
RunCommand(cmdLine)
print("")
else:
# keytool is situated in $(JAVA_HOME)/bin ...
#TODO : call the user the pass and the loggin he want ...
#$(if $(wildcard ./config/AndroidKey_$(PROJECT_NAME2).jks),$(empty), \
# $(Q)echo "./config/$(PROJECT_NAME2).jks <== dynamic key (NOTE : It might ask some question to generate the key for android)" ; \
# $(Q)keytool -genkeypair -v \
# -keystore ./config/$(PROJECT_NAME2).jks \
# -alias alias_$(PROJECT_NAME2) \
# -keyalg RSA \
# -validity 365 \
#)
# note we can add : -storepass Pass$(PROJECT_NAME2)
# note we can add : -keypass PassK$(PROJECT_NAME2)
# Question poser a ce moment, les automatiser ...
# Quels sont vos prenom et nom ?
# EdoGetRunFolderuard DUPIN
# [Unknown] : Quel est le nom de votre unite organisationnelle ?
# org
# [Unknown] : Quelle est le nom de votre organisation ?
# EWOL
# [Unknown] : Quel est le nom de votre ville de residence ?
# Paris
# [Unknown] : Quel est le nom de votre etat ou province ?
# France
# [Unknown] : Quel est le code de pays a deux lettres pour cette unite ?
# FR
# [Unknown] : Est-ce CN=Edouard DUPIN, OU=org, O=EWOL, L=Paris, ST=France, C=FR ?
# oui
# [non] :
# Generation d'une paire de clees RSA de a 024 bits et d'un certificat autosigne (SHA1withRSA) d'une validite de 365 jours
# pour : CN=Edouard DUPIN, OU=org, O=EWOL, L=Paris, ST=France, C=FR
# keytool is situated in $(JAVA_HOME)/bin ...
#echo "apk(Signed) <== apk"
# sign the application request loggin and password :
#jarsigner \
# -keystore ./config/AndroidKey_$(PROJECT_NAME2).jks \
# $(TARGET_OUT_STAGING)/build/$(PROJECT_NAME2)-unalligned.apk \
# alias_$(PROJECT_NAME2)
debug.warning("TODO ...")
debug.printElement("pkg", ".apk(aligned)", "<==", ".apk")
lutinTools.RemoveFile(self.GetStagingFolder(pkgName) + "/" + pkgName + ".apk")
# verbose mode : -v
cmdLine = self.folder_sdk + "/tools/zipalign 4 " \
+ self.GetStagingFolder(pkgName) + "/build/" + pkgName + "-unalligned.apk " \
+ self.GetStagingFolder(pkgName) + "/" + pkgName + ".apk "
RunCommand(cmdLine)
# copy file in the final stage :
lutinTools.CopyFile(self.GetStagingFolder(pkgName) + "/" + pkgName + ".apk",
self.GetFinalFolder() + "/" + pkgName + ".apk",
True)
def InstallPackage(self, pkgName):
debug.debug("------------------------------------------------------------------------")
debug.info("Install package '" + pkgName + "'")
debug.debug("------------------------------------------------------------------------")
cmdLine = self.folder_sdk + "/platform-tools/adb install -r " \
+ self.GetStagingFolder(pkgName) + "/" + pkgName + ".apk "
RunCommand(cmdLine)
def UnInstallPackage(self, pkgName):
debug.debug("------------------------------------------------------------------------")
debug.info("Un-Install package '" + pkgName + "'")
debug.debug("------------------------------------------------------------------------")
cmdLine = self.folder_sdk + "/platform-tools/adb uninstall " + pkgName
RunCommand(cmdLine)
def Log(self, pkgName):
debug.debug("------------------------------------------------------------------------")
debug.info("logcat of android board")
debug.debug("------------------------------------------------------------------------")
cmdLine = self.folder_sdk + "/platform-tools/adb shell logcat "
RunCommand(cmdLine)

View File

@ -43,7 +43,8 @@ class Target(lutinTarget.Target):
tmpFile.write("Maintainer: " + self.generateListSeparateComa(pkgProperties["MAINTAINER"]) + "\n")
tmpFile.write("Description: " + pkgProperties["DESCRIPTION"] + "\n")
tmpFile.write("\n")
tmpFile.closed
tmpFile.flush()
tmpFile.close()
## Create the PostRm
tmpFile = open(finalFilepostRm, 'w')
tmpFile.write("#!/bin/bash\n")
@ -51,7 +52,8 @@ class Target(lutinTarget.Target):
if pkgName != "":
tmpFile.write("rm -r ~/.local/" + pkgName + "\n")
tmpFile.write("\n")
tmpFile.closed
tmpFile.flush()
tmpFile.close()
## Enable Execution in script
os.chmod(finalFilepostRm, stat.S_IRWXU + stat.S_IRGRP + stat.S_IXGRP + stat.S_IROTH + stat.S_IXOTH);
# copy licence and information :
@ -61,16 +63,16 @@ class Target(lutinTarget.Target):
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")
lutinTools.CopyFile(self.GetStagingFolder(pkgName) + "/" + pkgName + self.suffix_package, self.GetFinalFolder() + "/" + pkgName + self.suffix_package)
def InstallPackage(self, pkgName):
debug.debug("------------------------------------------------------------------------")
debug.info("Install package '" + pkgName + "'")
debug.debug("------------------------------------------------------------------------")
#sudo dpkg -i $(TARGET_OUT_FINAL)/$(PROJECT_NAME).deb
os.system("sudo dpkg -i " + self.GetFinalFolder() + "/" + pkgName + self.suffix_package)
def InstallPackage(self, pkgName):
def UnInstallPackage(self, pkgName):
debug.debug("------------------------------------------------------------------------")
debug.info("Un-Install package '" + pkgName + "'")
debug.debug("------------------------------------------------------------------------")
#sudo dpkg -r $(TARGET_OUT_FINAL)/$(PROJECT_NAME).deb
os.system("sudo dpkg -r " + self.GetFinalFolder() + "/" + pkgName + self.suffix_package)

View File

@ -1 +1,76 @@
#!/usr/bin/python
import lutinDebug as debug
import lutinTarget
import lutinTools
import os
import stat
class Target(lutinTarget.Target):
def __init__(self, typeCompilator, debugMode):
cross = ""
# http://biolpc22.york.ac.uk/pub/linux-mac-cross/
# http://devs.openttd.org/~truebrain/compile-farm/apple-darwin9.txt
lutinTarget.Target.__init__(self, "Windows", typeCompilator, debugMode, "", cross)
self.folder_bin="/MacOS"
self.folder_lib="/lib"
self.folder_data="/Resources"
self.folder_doc="/doc"
self.suffix_lib_static='.a'
self.suffix_lib_dynamic='.dll'
self.suffix_binary='.exe'
self.suffix_package=''
def GetStagingFolder(self, binaryName):
return lutinTools.GetRunFolder() + self.folder_out + self.folder_staging + "/" + binaryName + ".app/Contents/"
def MakePackage(self, pkgName, pkgProperties):
debug.debug("------------------------------------------------------------------------")
debug.info("Generate package '" + pkgName + "'")
debug.debug("------------------------------------------------------------------------")
# http://www.sandroid.org/imcross/#Deployment
infoFile=self.GetStagingFolder(pkgName) + "/Info.plist"
# Create the info file
tmpFile = open(infoFile, 'w')
tmpFile.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
tmpFile.write("<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n")
tmpFile.write("<plist version=\"1.0\">\n")
tmpFile.write(" <dict>\n")
tmpFile.write(" <key>CFBundleExecutableFile</key>\n")
tmpFile.write(" <string>"+pkgName+"</string>\n")
tmpFile.write(" <key>CFBundleName</key>\n")
tmpFile.write(" <string>"+pkgName+"</string>\n")
tmpFile.write(" <key>CFBundleIdentifier</key>\n")
tmpFile.write(" <string>com."+pkgProperties["COMPAGNY_NAME2"]+"."+pkgName+"</string>\n")
tmpFile.write(" <key>CFBundleIconFile</key>\n")
tmpFile.write(" <string>"+pkgName+".icns</string>\n")
tmpFile.write(" </dict>\n")
tmpFile.write("</plist>\n")
tmpFile.write("\n\n")
tmpFile.flush()
tmpFile.close()
# Must create the tarball of the application
#cd $(TARGET_OUT_FINAL)/; tar -cf $(PROJECT_NAME).tar $(PROJECT_NAME).app
#cd $(TARGET_OUT_FINAL)/; tar -czf $(PROJECT_NAME).tar.gz $(PROJECT_NAME).app
def InstallPackage(self, pkgName):
debug.debug("------------------------------------------------------------------------")
debug.info("Install package '" + pkgName + "'")
debug.debug("------------------------------------------------------------------------")
debug.warning(" ==> TODO")
#sudo dpkg -i $(TARGET_OUT_FINAL)/$(PROJECT_NAME) + self.suffix_package
def UnInstallPackage(self, pkgName):
debug.debug("------------------------------------------------------------------------")
debug.info("Un-Install package '" + pkgName + "'")
debug.debug("------------------------------------------------------------------------")
debug.warning(" ==> TODO")
#sudo dpkg -r $(TARGET_OUT_FINAL)/$(PROJECT_NAME) + self.suffix_package

View File

@ -1 +1,47 @@
#!/usr/bin/python
import lutinDebug as debug
import lutinTarget
import lutinTools
import os
import stat
class Target(lutinTarget.Target):
def __init__(self, typeCompilator, debugMode):
cross = "i586-mingw32msvc-"
if typeCompilator!="gcc":
debug.error("Android does not support '" + typeCompilator + "' compilator ... availlable : [gcc]")
lutinTarget.Target.__init__(self, "Windows", typeCompilator, debugMode, "", cross)
self.folder_bin=""
self.folder_lib="/lib"
self.folder_data="/data"
self.folder_doc="/doc"
self.suffix_lib_static='.a'
self.suffix_lib_dynamic='.dll'
self.suffix_binary='.exe'
self.suffix_package=''
def MakePackage(self, pkgName, pkgProperties):
debug.debug("------------------------------------------------------------------------")
debug.info("Generate package '" + pkgName + "'")
debug.debug("------------------------------------------------------------------------")
debug.warning(" ==> TODO")
def InstallPackage(self, pkgName):
debug.debug("------------------------------------------------------------------------")
debug.info("Install package '" + pkgName + "'")
debug.debug("------------------------------------------------------------------------")
debug.warning(" ==> TODO")
#sudo dpkg -i $(TARGET_OUT_FINAL)/$(PROJECT_NAME) + self.suffix_package
def UnInstallPackage(self, pkgName):
debug.debug("------------------------------------------------------------------------")
debug.info("Un-Install package '" + pkgName + "'")
debug.debug("------------------------------------------------------------------------")
debug.warning(" ==> TODO")
#sudo dpkg -r $(TARGET_OUT_FINAL)/$(PROJECT_NAME) + self.suffix_package

View File

@ -31,6 +31,9 @@ def RemoveFolderAndSubFolder(path):
debug.verbose("remove folder : '" + path + "'")
shutil.rmtree(path)
def RemoveFile(path):
if os.path.isfile(path):
os.remove(path)
def ListToStr(list):
@ -57,9 +60,12 @@ def AddPrefix(prefix,list):
result.append(prefix+elem)
return result
def CopyFile(src, dst):
def CopyFile(src, dst, force=False):
if os.path.exists(src)==False:
debug.error("Request a copy a file that does not existed : '" + src + "'")
if os.path.exists(dst):
if os.path.getmtime(dst) > os.path.getmtime(src):
if force==False \
and os.path.getmtime(dst) > os.path.getmtime(src):
return
debug.printElement("copy file", src, "==>", dst)
CreateDirectoryOfFile(dst)