[DEV] Add target searching and multi processor compilation
This commit is contained in:
751
target/lutinTarget_Android.py
Normal file
751
target/lutinTarget_Android.py
Normal file
@@ -0,0 +1,751 @@
|
||||
#!/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 lutinTarget
|
||||
import lutinTools
|
||||
import lutinHost
|
||||
import lutinImage
|
||||
import lutinMultiprocess
|
||||
import lutinHost
|
||||
import os
|
||||
import sys
|
||||
|
||||
class Target(lutinTarget.Target):
|
||||
def __init__(self, config):
|
||||
#processor type selection (auto/arm/ppc/x86)
|
||||
if config["arch"] == "auto":
|
||||
config["arch"] = "arm"
|
||||
#bus size selection (auto/32/64)
|
||||
if config["bus-size"] == "auto":
|
||||
config["bus-size"] = "32"
|
||||
|
||||
arch = ""#"ARMv7"
|
||||
lutinTarget.Target.__init__(self, "Android", config, arch)
|
||||
|
||||
self.folder_ndk = os.getenv('PROJECT_NDK', "AUTO")
|
||||
self.folder_sdk = os.getenv('PROJECT_SDK', "AUTO")
|
||||
# auto search NDK
|
||||
if self.folder_ndk == "AUTO":
|
||||
for folder in os.listdir("."):
|
||||
if os.path.isdir(folder)==True:
|
||||
if folder=="android":
|
||||
self.folder_ndk = folder + "/ndk"
|
||||
if self.folder_ndk == "AUTO":
|
||||
self.folder_ndk = lutinTools.get_run_folder() + "/../android/ndk"
|
||||
# auto search SDK
|
||||
if self.folder_sdk == "AUTO":
|
||||
for folder in os.listdir("."):
|
||||
if os.path.isdir(folder)==True:
|
||||
if folder=="android":
|
||||
self.folder_sdk = folder + "/sdk"
|
||||
if self.folder_sdk == "AUTO":
|
||||
self.folder_sdk = lutinTools.get_run_folder() + "/../android/sdk"
|
||||
|
||||
if not os.path.isdir(self.folder_ndk):
|
||||
debug.error("NDK path not set !!! set env : PROJECT_NDK on the NDK path")
|
||||
if not os.path.isdir(self.folder_sdk):
|
||||
debug.error("SDK path not set !!! set env : PROJECT_SDK on the SDK path")
|
||||
|
||||
|
||||
tmpOsVal = "64"
|
||||
gccVersion = "4.8"
|
||||
if lutinHost.BUS_SIZE==64:
|
||||
tmpOsVal = "_64"
|
||||
if self.config["compilator"] == "clang":
|
||||
self.set_cross_base(self.folder_ndk + "/toolchains/llvm-3.3/prebuilt/linux-x86_64/bin/")
|
||||
else:
|
||||
baseFolderArm = self.folder_ndk + "/toolchains/arm-linux-androideabi-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/"
|
||||
baseFolderMips = self.folder_ndk + "/toolchains/mipsel-linux-android-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/"
|
||||
baseFolderX86 = self.folder_ndk + "/toolchains/x86-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/"
|
||||
self.set_cross_base(baseFolderArm + "arm-linux-androideabi-")
|
||||
if not os.path.isdir(baseFolderArm):
|
||||
debug.error("Gcc Arm path does not exist !!!")
|
||||
if not os.path.isdir(baseFolderMips):
|
||||
debug.info("Gcc Mips path does not exist !!!")
|
||||
if not os.path.isdir(baseFolderX86):
|
||||
debug.info("Gcc x86 path does not exist !!!")
|
||||
|
||||
arch = "ARMv7"
|
||||
|
||||
if self.selectBus = "auto":
|
||||
|
||||
|
||||
if self.selectArch = "auto":
|
||||
lutinHost.BUS_SIZE
|
||||
|
||||
# for gcc :
|
||||
|
||||
# for clang :
|
||||
|
||||
|
||||
self.folder_bin="/mustNotCreateBinary"
|
||||
self.folder_lib="/data/lib/armeabi"
|
||||
self.folder_data="/data/assets"
|
||||
self.folder_doc="/doc"
|
||||
self.suffix_package='.pkg'
|
||||
|
||||
# board id at 14 is for android 4.0 and more ...
|
||||
self.boardId = 14
|
||||
if arch == "ARMv5" or arch == "ARMv7":
|
||||
self.global_include_cc.append("-I" + self.folder_ndk +"/platforms/android-" + str(self.boardId) + "/arch-arm/usr/include/")
|
||||
elif arch == "mips":
|
||||
self.global_include_cc.append("-I" + self.folder_ndk +"/platforms/android-" + str(self.boardId) + "/arch-mips/usr/include/")
|
||||
elif arch == "x86":
|
||||
self.global_include_cc.append("-I" + self.folder_ndk +"/platforms/android-" + str(self.boardId) + "/arch-x86/usr/include/")
|
||||
|
||||
if True:
|
||||
if typeCompilator == "clang":
|
||||
self.global_include_cc.append("-I" + self.folder_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/include/")
|
||||
if arch == "ARMv5":
|
||||
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/libs/armeabi/"
|
||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
||||
self.global_flags_ld.append( stdCppBasePath + "libc++_static.a")
|
||||
elif arch == "ARMv7":
|
||||
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/libs/armeabi-v7a/"
|
||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
||||
self.global_flags_ld.append( stdCppBasePath + "libc++_static.a")
|
||||
elif arch == "mips":
|
||||
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/libs/mips/"
|
||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
||||
self.global_flags_ld.append( stdCppBasePath + "libc++_static.a")
|
||||
elif arch == "x86":
|
||||
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/libs/x86/"
|
||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
||||
self.global_flags_ld.append( stdCppBasePath + "libc++_static.a")
|
||||
else:
|
||||
self.global_include_cc.append("-I" + self.folder_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/include/")
|
||||
if arch == "ARMv5":
|
||||
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/libs/armeabi/"
|
||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
||||
self.global_flags_ld.append( stdCppBasePath + "thumb/libgnustl_static.a")
|
||||
self.global_flags_ld.append( stdCppBasePath + "thumb/libsupc++.a")
|
||||
elif arch == "ARMv7":
|
||||
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/libs/armeabi-v7a/"
|
||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
||||
self.global_flags_ld.append( stdCppBasePath + "thumb/libgnustl_static.a")
|
||||
self.global_flags_ld.append( stdCppBasePath + "thumb/libsupc++.a")
|
||||
elif arch == "mips":
|
||||
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/libs/mips/"
|
||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
||||
self.global_flags_ld.append( stdCppBasePath + "libgnustl_static.a")
|
||||
self.global_flags_ld.append( stdCppBasePath + "libsupc++.a")
|
||||
elif arch == "x86":
|
||||
stdCppBasePath = self.folder_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/libs/x86/"
|
||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
||||
self.global_flags_ld.append( stdCppBasePath + "libgnustl_static.a")
|
||||
self.global_flags_ld.append( stdCppBasePath + "libsupc++.a")
|
||||
else :
|
||||
self.global_include_cc.append("-I" + self.folder_ndk +"/sources/cxx-stl/system/include/")
|
||||
self.global_include_cc.append("-I" + self.folder_ndk +"/sources/cxx-stl/stlport/stlport/")
|
||||
self.global_flags_ld.append(self.folder_ndk +"/platforms/android-" + str(self.boardId) + "/arch-arm/usr/lib/libstdc++.a")
|
||||
|
||||
self.global_sysroot = "--sysroot=" + self.folder_ndk +"/platforms/android-" + str(self.boardId) + "/arch-arm"
|
||||
|
||||
self.global_flags_cc.append("-D__ARM_ARCH_5__")
|
||||
self.global_flags_cc.append("-D__ARM_ARCH_5T__")
|
||||
self.global_flags_cc.append("-D__ARM_ARCH_5E__")
|
||||
self.global_flags_cc.append("-D__ARM_ARCH_5TE__")
|
||||
if self.arch == "ARM":
|
||||
# -----------------------
|
||||
# -- arm V5 :
|
||||
# -----------------------
|
||||
self.global_flags_cc.append("-march=armv5te")
|
||||
self.global_flags_cc.append("-msoft-float")
|
||||
else:
|
||||
# -----------------------
|
||||
# -- arm V7 (Neon) :
|
||||
# -----------------------
|
||||
self.global_flags_cc.append("-mfpu=neon")
|
||||
self.global_flags_cc.append("-mfloat-abi=softfp")
|
||||
self.global_flags_ld.append("-mfpu=neon")
|
||||
self.global_flags_ld.append("-mfloat-abi=softfp")
|
||||
self.global_flags_cc.append("-D__ARM_ARCH_7__")
|
||||
self.global_flags_cc.append("-D__ARM_NEON__")
|
||||
|
||||
# the -mthumb must be set for all the android produc, some ot the not work coretly without this one ... (all android code is generated with this flags)
|
||||
self.global_flags_cc.append("-mthumb")
|
||||
# -----------------------
|
||||
# -- Common flags :
|
||||
# -----------------------
|
||||
self.global_flags_cc.append("-fpic")
|
||||
self.global_flags_cc.append("-ffunction-sections")
|
||||
self.global_flags_cc.append("-funwind-tables")
|
||||
self.global_flags_cc.append("-fstack-protector")
|
||||
self.global_flags_cc.append("-Wno-psabi")
|
||||
self.global_flags_cc.append("-mtune=xscale")
|
||||
self.global_flags_cc.append("-fexceptions")
|
||||
##self.global_flags_cc.append("-fno-exceptions")
|
||||
self.global_flags_cc.append("-fomit-frame-pointer")
|
||||
self.global_flags_cc.append("-fno-strict-aliasing")
|
||||
|
||||
self.global_flags_xx.append("-frtti")
|
||||
self.global_flags_xx.append("-Wa,--noexecstack")
|
||||
|
||||
|
||||
|
||||
def check_right_package(self, pkgProperties, value):
|
||||
for val in pkgProperties["RIGHT"]:
|
||||
if value == val:
|
||||
return True
|
||||
return False
|
||||
|
||||
def get_staging_folder_data(self, binaryName):
|
||||
return self.get_staging_folder(binaryName) + self.folder_data
|
||||
|
||||
def make_package(self, pkgName, pkgProperties, basePkgPath):
|
||||
# http://alp.developpez.com/tutoriels/debian/creer-paquet/
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Generate package '" + pkgName + "'")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
pkgNameApplicationName = pkgName
|
||||
if "debug"==self.buildMode:
|
||||
pkgNameApplicationName += "debug"
|
||||
# FINAL_FOLDER_JAVA_PROJECT
|
||||
self.folder_javaProject= self.get_staging_folder(pkgName) \
|
||||
+ "/src/" \
|
||||
+ pkgProperties["COMPAGNY_TYPE"] \
|
||||
+ "/" + pkgProperties["COMPAGNY_NAME2"] \
|
||||
+ "/" + pkgNameApplicationName + "/"
|
||||
#FINAL_FILE_ABSTRACTION
|
||||
self.file_finalAbstraction = self.folder_javaProject + "/" + pkgNameApplicationName + ".java"
|
||||
|
||||
compleatePackageName = pkgProperties["COMPAGNY_TYPE"]+"."+pkgProperties["COMPAGNY_NAME2"]+"." + pkgNameApplicationName
|
||||
|
||||
if "ADMOD_ID" in pkgProperties:
|
||||
pkgProperties["RIGHT"].append("INTERNET")
|
||||
pkgProperties["RIGHT"].append("ACCESS_NETWORK_STATE")
|
||||
|
||||
|
||||
debug.print_element("pkg", "absractionFile", "<==", "dynamic file")
|
||||
# Create folder :
|
||||
lutinTools.create_directory_of_file(self.file_finalAbstraction)
|
||||
# Create file :
|
||||
tmpFile = open(self.file_finalAbstraction, 'w')
|
||||
if pkgProperties["ANDROID_APPL_TYPE"]=="APPL":
|
||||
tmpFile.write( "/**\n")
|
||||
tmpFile.write( " * @author Edouard DUPIN, Kevin BILLONNEAU\n")
|
||||
tmpFile.write( " * @copyright 2011, Edouard DUPIN, all right reserved\n")
|
||||
tmpFile.write( " * @license APACHE v2.0 (see license file)\n")
|
||||
tmpFile.write( " * @note This file is autogenerate ==> see documantation to generate your own\n")
|
||||
tmpFile.write( " */\n")
|
||||
tmpFile.write( "package "+ compleatePackageName + ";\n")
|
||||
tmpFile.write( "import org.ewol.EwolActivity;\n")
|
||||
if "ADMOD_ID" in pkgProperties:
|
||||
tmpFile.write( "import com.google.android.gms.ads.AdRequest;\n")
|
||||
tmpFile.write( "import com.google.android.gms.ads.AdSize;\n")
|
||||
tmpFile.write( "import com.google.android.gms.ads.AdView;\n")
|
||||
tmpFile.write( "import android.widget.LinearLayout;\n")
|
||||
tmpFile.write( "import android.widget.Button;\n")
|
||||
tmpFile.write( "public class " + pkgNameApplicationName + " extends EwolActivity {\n")
|
||||
if "ADMOD_ID" in pkgProperties:
|
||||
tmpFile.write( " /** The view to show the ad. */\n")
|
||||
tmpFile.write( " private AdView adView;\n")
|
||||
tmpFile.write( " private LinearLayout mLayout = null;\n")
|
||||
tmpFile.write( " public void onCreate(android.os.Bundle savedInstanceState) {\n")
|
||||
tmpFile.write( " super.onCreate(savedInstanceState);\n")
|
||||
tmpFile.write( " initApkPath(\"" + pkgProperties["COMPAGNY_TYPE"]+"\", \""+pkgProperties["COMPAGNY_NAME2"]+"\", \"" + pkgNameApplicationName + "\");\n")
|
||||
if "ADMOD_ID" in pkgProperties:
|
||||
tmpFile.write( " mLayout = new LinearLayout(this);\n")
|
||||
tmpFile.write( " mLayout.setOrientation(android.widget.LinearLayout.VERTICAL);\n")
|
||||
tmpFile.write( " LinearLayout.LayoutParams paramsWindows = new LinearLayout.LayoutParams(\n")
|
||||
tmpFile.write( " LinearLayout.LayoutParams.FILL_PARENT,\n")
|
||||
tmpFile.write( " LinearLayout.LayoutParams.FILL_PARENT);\n")
|
||||
tmpFile.write( " \n")
|
||||
tmpFile.write( " setContentView(mLayout, paramsWindows);\n")
|
||||
tmpFile.write( " \n")
|
||||
tmpFile.write( " LinearLayout.LayoutParams paramsAdds = new LinearLayout.LayoutParams(\n")
|
||||
tmpFile.write( " LinearLayout.LayoutParams.FILL_PARENT,\n")
|
||||
tmpFile.write( " LinearLayout.LayoutParams.WRAP_CONTENT);\n")
|
||||
tmpFile.write( " paramsAdds.weight = 0;\n")
|
||||
tmpFile.write( " \n")
|
||||
tmpFile.write( " LinearLayout.LayoutParams paramsGLView = new LinearLayout.LayoutParams(\n")
|
||||
tmpFile.write( " LinearLayout.LayoutParams.FILL_PARENT,\n")
|
||||
tmpFile.write( " LinearLayout.LayoutParams.FILL_PARENT);\n")
|
||||
tmpFile.write( " paramsGLView.weight = 1;\n")
|
||||
tmpFile.write( " paramsGLView.height = 0;\n")
|
||||
tmpFile.write( " \n")
|
||||
tmpFile.write( " mLayout.setGravity(android.view.Gravity.TOP);\n")
|
||||
tmpFile.write( " \n")
|
||||
tmpFile.write( " // Create an adds.\n")
|
||||
tmpFile.write( " adView = new AdView(this);\n")
|
||||
tmpFile.write( " adView.setAdSize(AdSize.SMART_BANNER);\n")
|
||||
tmpFile.write( " adView.setAdUnitId(\"" + pkgProperties["ADMOD_ID"] + "\");\n")
|
||||
tmpFile.write( " \n")
|
||||
tmpFile.write( " // Create an ad request. Check logcat output for the hashed device ID to get test ads on a physical device.\n")
|
||||
tmpFile.write( " AdRequest adRequest = new AdRequest.Builder()\n")
|
||||
tmpFile.write( " .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)\n")
|
||||
tmpFile.write( " .build();\n")
|
||||
tmpFile.write( " \n")
|
||||
tmpFile.write( " // Add the AdView to the view hierarchy. The view will have no size until the ad is loaded.\n")
|
||||
if "ADMOD_POSITION" in pkgProperties.keys() \
|
||||
and pkgProperties["ADMOD_POSITION"] == "top":
|
||||
tmpFile.write( " mLayout.addView(adView, paramsAdds);\n")
|
||||
tmpFile.write( " mLayout.addView(mGLView, paramsGLView);\n")
|
||||
else:
|
||||
tmpFile.write( " mLayout.addView(mGLView, paramsGLView);\n")
|
||||
tmpFile.write( " mLayout.addView(adView, paramsAdds);\n")
|
||||
tmpFile.write( " \n")
|
||||
tmpFile.write( " // Start loading the ad in the background.\n")
|
||||
tmpFile.write( " adView.loadAd(adRequest);\n")
|
||||
tmpFile.write( " }\n")
|
||||
if "ADMOD_ID" in pkgProperties:
|
||||
tmpFile.write( " @Override protected void onResume() {\n")
|
||||
tmpFile.write( " super.onResume();\n")
|
||||
tmpFile.write( " if (adView != null) {\n")
|
||||
tmpFile.write( " adView.resume();\n")
|
||||
tmpFile.write( " }\n")
|
||||
tmpFile.write( " }\n")
|
||||
tmpFile.write( " @Override protected void onPause() {\n")
|
||||
tmpFile.write( " if (adView != null) {\n")
|
||||
tmpFile.write( " adView.pause();\n")
|
||||
tmpFile.write( " }\n")
|
||||
tmpFile.write( " super.onPause();\n")
|
||||
tmpFile.write( " }\n")
|
||||
tmpFile.write( " @Override protected void onDestroy() {\n")
|
||||
tmpFile.write( " // Destroy the AdView.\n")
|
||||
tmpFile.write( " if (adView != null) {\n")
|
||||
tmpFile.write( " adView.destroy();\n")
|
||||
tmpFile.write( " }\n")
|
||||
tmpFile.write( " super.onDestroy();\n")
|
||||
tmpFile.write( " }\n")
|
||||
tmpFile.write( "}\n")
|
||||
else :
|
||||
# wallpaper mode ...
|
||||
tmpFile.write( "/**\n")
|
||||
tmpFile.write( " * @author Edouard DUPIN, Kevin BILLONNEAU\n")
|
||||
tmpFile.write( " * @copyright 2011, Edouard DUPIN, all right reserved\n")
|
||||
tmpFile.write( " * @license APACHE v2.0 (see license file)\n")
|
||||
tmpFile.write( " * @note This file is autogenerate ==> see documantation to generate your own\n")
|
||||
tmpFile.write( " */\n")
|
||||
tmpFile.write( "package "+ compleatePackageName + ";\n")
|
||||
tmpFile.write( "import org.ewol.EwolWallpaper;\n")
|
||||
tmpFile.write( "public class " + pkgNameApplicationName + " extends EwolWallpaper {\n")
|
||||
tmpFile.write( " public static final String SHARED_PREFS_NAME = \"" + pkgNameApplicationName + "settings\";\n")
|
||||
tmpFile.write( " public Engine onCreateEngine() {\n")
|
||||
tmpFile.write( " Engine tmpEngine = super.onCreateEngine();\n")
|
||||
tmpFile.write( " initApkPath(\"" + pkgProperties["COMPAGNY_TYPE"]+"\", \""+pkgProperties["COMPAGNY_NAME2"]+"\", \"" + pkgNameApplicationName + "\");\n")
|
||||
tmpFile.write( " return tmpEngine;\n")
|
||||
tmpFile.write( " }\n")
|
||||
tmpFile.write( "}\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
|
||||
lutinTools.create_directory_of_file(self.get_staging_folder(pkgName) + "/res/drawable/icon.png");
|
||||
if "ICON" in pkgProperties.keys() \
|
||||
and pkgProperties["ICON"] != "":
|
||||
lutinImage.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/res/drawable/icon.png", 256, 256)
|
||||
else:
|
||||
# to be sure that we have all time a resource ...
|
||||
tmpFile = open(self.get_staging_folder(pkgName) + "/res/drawable/plop.txt", 'w')
|
||||
tmpFile.write('plop\n')
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
|
||||
if pkgProperties["ANDROID_MANIFEST"]!="":
|
||||
debug.print_element("pkg", "AndroidManifest.xml", "<==", pkgProperties["ANDROID_MANIFEST"])
|
||||
lutinTools.copy_file(pkgProperties["ANDROID_MANIFEST"], self.get_staging_folder(pkgName) + "/AndroidManifest.xml", force=True)
|
||||
else:
|
||||
if "VERSION_CODE" not in pkgProperties:
|
||||
pkgProperties["VERSION_CODE"] = "1"
|
||||
debug.print_element("pkg", "AndroidManifest.xml", "<==", "package configurations")
|
||||
tmpFile = open(self.get_staging_folder(pkgName) + "/AndroidManifest.xml", 'w')
|
||||
tmpFile.write( '<?xml version="1.0" encoding="utf-8"?>\n')
|
||||
tmpFile.write( '<!-- Manifest is autoGenerated with Ewol ... do not patch it-->\n')
|
||||
tmpFile.write( '<manifest xmlns:android="http://schemas.android.com/apk/res/android" \n')
|
||||
tmpFile.write( ' package="' + compleatePackageName + '" \n')
|
||||
tmpFile.write( ' android:versionCode="'+pkgProperties["VERSION_CODE"]+'" \n')
|
||||
tmpFile.write( ' android:versionName="'+pkgProperties["VERSION"]+'"> \n')
|
||||
tmpFile.write( ' <uses-feature android:glEsVersion="0x00020000" android:required="true" />\n')
|
||||
tmpFile.write( ' <uses-sdk android:minSdkVersion="' + str(self.boardId) + '" \n')
|
||||
tmpFile.write( ' android:targetSdkVersion="' + str(self.boardId) + '" /> \n')
|
||||
if pkgProperties["ANDROID_APPL_TYPE"]=="APPL":
|
||||
tmpFile.write( ' <application android:label="' + pkgNameApplicationName + '" \n')
|
||||
if "ICON" in pkgProperties.keys():
|
||||
tmpFile.write( ' android:icon="@drawable/icon" \n')
|
||||
if "debug"==self.buildMode:
|
||||
tmpFile.write( ' android:debuggable="true" \n')
|
||||
tmpFile.write( ' >\n')
|
||||
if "ADMOD_ID" in pkgProperties:
|
||||
tmpFile.write( ' <meta-data android:name="com.google.android.gms.version" \n')
|
||||
tmpFile.write( ' android:value="@integer/google_play_services_version"/>\n')
|
||||
|
||||
tmpFile.write( ' <activity android:name=".' + pkgNameApplicationName + '" \n')
|
||||
tmpFile.write( ' android:label="' + pkgProperties['NAME'])
|
||||
if "debug"==self.buildMode:
|
||||
tmpFile.write("-debug")
|
||||
tmpFile.write( '"\n')
|
||||
if "ICON" in pkgProperties.keys():
|
||||
tmpFile.write( ' android:icon="@drawable/icon" \n')
|
||||
tmpFile.write( ' android:hardwareAccelerated="true" \n')
|
||||
tmpFile.write( ' android:configChanges="keyboard|keyboardHidden|orientation|screenSize"> \n')
|
||||
tmpFile.write( ' <intent-filter> \n')
|
||||
tmpFile.write( ' <action android:name="android.intent.action.MAIN" /> \n')
|
||||
tmpFile.write( ' <category android:name="android.intent.category.LAUNCHER" /> \n')
|
||||
tmpFile.write( ' </intent-filter> \n')
|
||||
tmpFile.write( ' </activity> \n')
|
||||
if "ADMOD_ID" in pkgProperties:
|
||||
tmpFile.write( ' <activity android:name="com.google.android.gms.ads.AdActivity"\n')
|
||||
tmpFile.write( ' android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>\n')
|
||||
|
||||
tmpFile.write( ' </application>\n')
|
||||
else:
|
||||
tmpFile.write( ' <application android:label="' + pkgNameApplicationName + '" \n')
|
||||
tmpFile.write( ' android:permission="android.permission.BIND_WALLPAPER" \n')
|
||||
if "ICON" in pkgProperties.keys():
|
||||
tmpFile.write( ' android:icon="@drawable/icon"\n')
|
||||
tmpFile.write( ' >\n')
|
||||
tmpFile.write( ' <service android:name=".' + pkgNameApplicationName + '" \n')
|
||||
tmpFile.write( ' android:label="' + pkgProperties['NAME'])
|
||||
if "debug"==self.buildMode:
|
||||
tmpFile.write("-debug")
|
||||
tmpFile.write( '"\n')
|
||||
if "ICON" in pkgProperties.keys():
|
||||
tmpFile.write( ' android:icon="@drawable/icon"\n')
|
||||
tmpFile.write( ' >\n')
|
||||
tmpFile.write( ' <intent-filter>\n')
|
||||
tmpFile.write( ' <action android:name="android.service.wallpaper.WallpaperService" />\n')
|
||||
tmpFile.write( ' </intent-filter>\n')
|
||||
tmpFile.write( ' <meta-data android:name="android.service.wallpaper"\n')
|
||||
tmpFile.write( ' android:resource="@xml/' + pkgNameApplicationName + '_resource" />\n')
|
||||
tmpFile.write( ' </service>\n')
|
||||
if len(pkgProperties["ANDROID_WALLPAPER_PROPERTIES"])!=0:
|
||||
tmpFile.write( ' <activity android:label="Setting"\n')
|
||||
tmpFile.write( ' android:name=".' + pkgNameApplicationName + 'Settings"\n')
|
||||
tmpFile.write( ' android:theme="@android:style/Theme.Light.WallpaperSettings"\n')
|
||||
tmpFile.write( ' android:exported="true"\n')
|
||||
if "ICON" in pkgProperties.keys():
|
||||
tmpFile.write( ' android:icon="@drawable/icon"\n')
|
||||
tmpFile.write( ' >\n')
|
||||
tmpFile.write( ' </activity>\n')
|
||||
tmpFile.write( ' </application>\n')
|
||||
# write package autorisations :
|
||||
if True==self.check_right_package(pkgProperties, "WRITE_EXTERNAL_STORAGE"):
|
||||
tmpFile.write( ' <permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> \n')
|
||||
tmpFile.write( ' <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> \n')
|
||||
if True==self.check_right_package(pkgProperties, "CAMERA"):
|
||||
tmpFile.write( ' <permission android:name="android.permission.CAMERA" /> \n')
|
||||
tmpFile.write( ' <uses-permission android:name="android.permission.CAMERA" /> \n')
|
||||
if True==self.check_right_package(pkgProperties, "INTERNET"):
|
||||
tmpFile.write( ' <permission android:name="android.permission.INTERNET" /> \n')
|
||||
tmpFile.write( ' <uses-permission android:name="android.permission.INTERNET" /> \n')
|
||||
if True==self.check_right_package(pkgProperties, "ACCESS_NETWORK_STATE"):
|
||||
tmpFile.write( ' <permission android:name="android.permission.ACCESS_NETWORK_STATE" /> \n')
|
||||
tmpFile.write( ' <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> \n')
|
||||
if True==self.check_right_package(pkgProperties, "MODIFY_AUDIO_SETTINGS"):
|
||||
tmpFile.write( ' <permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> \n')
|
||||
tmpFile.write( ' <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> \n')
|
||||
if True==self.check_right_package(pkgProperties, "READ_CALENDAR"):
|
||||
tmpFile.write( ' <permission android:name="android.permission.READ_CALENDAR" /> \n')
|
||||
tmpFile.write( ' <uses-permission android:name="android.permission.READ_CALENDAR" /> \n')
|
||||
if True==self.check_right_package(pkgProperties, "READ_CONTACTS"):
|
||||
tmpFile.write( ' <permission android:name="android.permission.READ_CONTACTS" /> \n')
|
||||
tmpFile.write( ' <uses-permission android:name="android.permission.READ_CONTACTS" /> \n')
|
||||
if True==self.check_right_package(pkgProperties, "READ_FRAME_BUFFER"):
|
||||
tmpFile.write( ' <permission android:name="android.permission.READ_FRAME_BUFFER" /> \n')
|
||||
tmpFile.write( ' <uses-permission android:name="android.permission.READ_FRAME_BUFFER" /> \n')
|
||||
if True==self.check_right_package(pkgProperties, "READ_PROFILE"):
|
||||
tmpFile.write( ' <permission android:name="android.permission.READ_PROFILE" /> \n')
|
||||
tmpFile.write( ' <uses-permission android:name="android.permission.READ_PROFILE" /> \n')
|
||||
if True==self.check_right_package(pkgProperties, "RECORD_AUDIO"):
|
||||
tmpFile.write( ' <permission android:name="android.permission.RECORD_AUDIO" /> \n')
|
||||
tmpFile.write( ' <uses-permission android:name="android.permission.RECORD_AUDIO" /> \n')
|
||||
if True==self.check_right_package(pkgProperties, "SET_ORIENTATION"):
|
||||
tmpFile.write( ' <permission android:name="android.permission.SET_ORIENTATION" /> \n')
|
||||
tmpFile.write( ' <uses-permission android:name="android.permission.SET_ORIENTATION" /> \n')
|
||||
if True==self.check_right_package(pkgProperties, "VIBRATE"):
|
||||
tmpFile.write( ' <permission android:name="android.permission.VIBRATE" /> \n')
|
||||
tmpFile.write( ' <uses-permission android:name="android.permission.VIBRATE" /> \n')
|
||||
if True==self.check_right_package(pkgProperties, "ACCESS_COARSE_LOCATION"):
|
||||
tmpFile.write( ' <permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> \n')
|
||||
tmpFile.write( ' <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> \n')
|
||||
if True==self.check_right_package(pkgProperties, "ACCESS_FINE_LOCATION"):
|
||||
tmpFile.write( ' <permission android:name="android.permission.ACCESS_FINE_LOCATION" /> \n')
|
||||
tmpFile.write( ' <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> \n')
|
||||
tmpFile.write( '</manifest>\n\n')
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
# end generating android manifest
|
||||
|
||||
if pkgProperties["ANDROID_APPL_TYPE"]!="APPL":
|
||||
#create the Wallpaper sub files : (main element for the application
|
||||
debug.print_element("pkg", pkgNameApplicationName + "_resource.xml", "<==", "package configurations")
|
||||
lutinTools.create_directory_of_file(self.get_staging_folder(pkgName) + "/res/xml/" + pkgNameApplicationName + "_resource.xml")
|
||||
tmpFile = open(self.get_staging_folder(pkgName) + "/res/xml/" + pkgNameApplicationName + "_resource.xml", 'w')
|
||||
tmpFile.write( "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
|
||||
tmpFile.write( "<wallpaper xmlns:android=\"http://schemas.android.com/apk/res/android\"\n")
|
||||
if len(pkgProperties["ANDROID_WALLPAPER_PROPERTIES"])!=0:
|
||||
tmpFile.write( " android:settingsActivity=\""+compleatePackageName + "."+ pkgNameApplicationName + "Settings\"\n")
|
||||
if "ICON" in pkgProperties.keys():
|
||||
tmpFile.write( " android:thumbnail=\"@drawable/icon\"\n")
|
||||
tmpFile.write( " />\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
# create wallpaper setting if needed (class and config file)
|
||||
if len(pkgProperties["ANDROID_WALLPAPER_PROPERTIES"])!=0:
|
||||
lutinTools.create_directory_of_file(self.folder_javaProject + pkgNameApplicationName + "Settings.java")
|
||||
debug.print_element("pkg", self.folder_javaProject + pkgNameApplicationName + "Settings.java", "<==", "package configurations")
|
||||
tmpFile = open(self.folder_javaProject + pkgNameApplicationName + "Settings.java", 'w');
|
||||
tmpFile.write( "package " + compleatePackageName + ";\n")
|
||||
tmpFile.write( "\n")
|
||||
tmpFile.write( "import " + compleatePackageName + ".R;\n")
|
||||
tmpFile.write( "\n")
|
||||
tmpFile.write( "import android.content.SharedPreferences;\n")
|
||||
tmpFile.write( "import android.os.Bundle;\n")
|
||||
tmpFile.write( "import android.preference.PreferenceActivity;\n")
|
||||
tmpFile.write( "\n")
|
||||
tmpFile.write( "public class " + pkgNameApplicationName + "Settings extends PreferenceActivity implements SharedPreferences.OnSharedPreferenceChangeListener\n")
|
||||
tmpFile.write( "{\n")
|
||||
tmpFile.write( " @Override protected void onCreate(Bundle icicle) {\n")
|
||||
tmpFile.write( " super.onCreate(icicle);\n")
|
||||
tmpFile.write( " getPreferenceManager().setSharedPreferencesName("+ pkgNameApplicationName + ".SHARED_PREFS_NAME);\n")
|
||||
tmpFile.write( " addPreferencesFromResource(R.xml."+ pkgNameApplicationName + "_settings);\n")
|
||||
tmpFile.write( " getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);\n")
|
||||
tmpFile.write( " }\n")
|
||||
tmpFile.write( " @Override protected void onResume() {\n")
|
||||
tmpFile.write( " super.onResume();\n")
|
||||
tmpFile.write( " }\n")
|
||||
tmpFile.write( " @Override protected void onDestroy() {\n")
|
||||
tmpFile.write( " getPreferenceManager().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this);\n")
|
||||
tmpFile.write( " super.onDestroy();\n")
|
||||
tmpFile.write( " }\n")
|
||||
tmpFile.write( " public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,String key) { }\n")
|
||||
tmpFile.write( "}\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
|
||||
debug.print_element("pkg", self.get_staging_folder(pkgName) + "/res/xml/" + pkgNameApplicationName + "_settings.xml", "<==", "package configurations")
|
||||
lutinTools.create_directory_of_file(self.get_staging_folder(pkgName) + "/res/xml/" + pkgNameApplicationName + "_settings.xml")
|
||||
tmpFile = open(self.get_staging_folder(pkgName) + "/res/xml/" + pkgNameApplicationName + "_settings.xml", 'w');
|
||||
tmpFile.write( "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
|
||||
tmpFile.write( "<PreferenceScreen xmlns:android=\"http://schemas.android.com/apk/res/android\"\n")
|
||||
tmpFile.write( " android:title=\"Settings\"\n")
|
||||
tmpFile.write( " android:key=\"" + pkgNameApplicationName + "_settings\">\n")
|
||||
WALL_haveArray = False
|
||||
for WALL_type, WALL_key, WALL_title, WALL_summary, WALL_other in pkgProperties["ANDROID_WALLPAPER_PROPERTIES"]:
|
||||
debug.info("find : '" + WALL_type + "'");
|
||||
if WALL_type == "list":
|
||||
debug.info(" create : LIST");
|
||||
tmpFile.write( " <ListPreference android:key=\"" + pkgNameApplicationName + "_" + WALL_key + "\"\n")
|
||||
tmpFile.write( " android:title=\"" + WALL_title + "\"\n")
|
||||
tmpFile.write( " android:summary=\"" + WALL_summary + "\"\n")
|
||||
tmpFile.write( " android:entries=\"@array/" + pkgNameApplicationName + "_" + WALL_key + "_names\"\n")
|
||||
tmpFile.write( " android:entryValues=\"@array/" + pkgNameApplicationName + "_" + WALL_key + "_prefix\"/>\n")
|
||||
WALL_haveArray=True
|
||||
elif WALL_type == "bool":
|
||||
debug.info(" create : CHECKBOX");
|
||||
tmpFile.write( " <CheckBoxPreference android:key=\"" + pkgNameApplicationName + "_" + WALL_key + "\"\n")
|
||||
tmpFile.write( " android:title=\"" + WALL_title + "\"\n")
|
||||
tmpFile.write( " android:summary=\"" + WALL_summary + "\"\n")
|
||||
tmpFile.write( " android:summaryOn=\"" + WALL_other[0] + "\"\n")
|
||||
tmpFile.write( " android:summaryOff=\"" + WALL_other[1] + "\"/>\n")
|
||||
tmpFile.write( "</PreferenceScreen>\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
if WALL_haveArray==True:
|
||||
for WALL_type, WALL_key, WALL_title, WALL_summary, WALL_other in pkgProperties["ANDROID_WALLPAPER_PROPERTIES"]:
|
||||
if WALL_type == "list":
|
||||
debug.print_element("pkg", self.get_staging_folder(pkgName) + "/res/values/" + WALL_key + ".xml", "<==", "package configurations")
|
||||
lutinTools.create_directory_of_file(self.get_staging_folder(pkgName) + "/res/values/" + WALL_key + ".xml")
|
||||
tmpFile = open(self.get_staging_folder(pkgName) + "/res/values/" + WALL_key + ".xml", 'w');
|
||||
tmpFile.write( "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
|
||||
tmpFile.write( "<resources xmlns:xliff=\"urn:oasis:names:tc:xliff:document:1.2\">\n")
|
||||
tmpFile.write( " <string-array name=\"" + pkgNameApplicationName + "_" + WALL_key + "_names\">\n")
|
||||
for WALL_subKey, WALL_display in WALL_other:
|
||||
tmpFile.write( " <item>" + WALL_display + "</item>\n")
|
||||
tmpFile.write( " </string-array>\n")
|
||||
tmpFile.write( " <string-array name=\"" + pkgNameApplicationName + "_" + WALL_key + "_prefix\">\n")
|
||||
for WALL_subKey, WALL_display in WALL_other:
|
||||
tmpFile.write( " <item>" + WALL_subKey + "</item>\n")
|
||||
tmpFile.write( " </string-array>\n")
|
||||
tmpFile.write( "</resources>\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
|
||||
|
||||
#add properties on wallpaper :
|
||||
# myModule.pkg_add("ANDROID_WALLPAPER_PROPERTIES", ["list", key, title, summary, [["key","value display"],["key2","value display 2"]])
|
||||
# myModule.pkg_add("ANDROID_WALLPAPER_PROPERTIES", ["list", "testpattern", "Select test pattern", "Choose which test pattern to display", [["key","value display"],["key2","value display 2"]]])
|
||||
# myModule.pkg_add("ANDROID_WALLPAPER_PROPERTIES", ["bool", key, title, summary, ["enable string", "disable String"])
|
||||
# myModule.pkg_add("ANDROID_WALLPAPER_PROPERTIES", ["bool", "movement", "Motion", "Apply movement to test pattern", ["Moving test pattern", "Still test pattern"]
|
||||
#copy needed resources :
|
||||
for res_source, res_dest in pkgProperties["ANDROID_RESOURCES"]:
|
||||
if res_source == "":
|
||||
continue
|
||||
lutinTools.copy_file(res_source , self.get_staging_folder(pkgName) + "/res/" + res_dest + "/" + os.path.basename(res_source), force=True)
|
||||
|
||||
|
||||
# Doc :
|
||||
# http://asantoso.wordpress.com/2009/09/15/how-to-build-android-application-package-apk-from-the-command-line-using-the-sdk-tools-continuously-integrated-using-cruisecontrol/
|
||||
debug.print_element("pkg", "R.java", "<==", "Resources files")
|
||||
lutinTools.create_directory_of_file(self.get_staging_folder(pkgName) + "/src/noFile")
|
||||
androidToolPath = self.folder_sdk + "/build-tools/20.0.0/"
|
||||
adModResouceFolder = ""
|
||||
if "ADMOD_ID" in pkgProperties:
|
||||
adModResouceFolder = " -S " + self.folder_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/res/ "
|
||||
cmdLine = androidToolPath + "aapt p -f " \
|
||||
+ "-M " + self.get_staging_folder(pkgName) + "/AndroidManifest.xml " \
|
||||
+ "-F " + self.get_staging_folder(pkgName) + "/resources.res " \
|
||||
+ "-I " + self.folder_sdk + "/platforms/android-" + str(self.boardId) + "/android.jar "\
|
||||
+ "-S " + self.get_staging_folder(pkgName) + "/res/ " \
|
||||
+ adModResouceFolder \
|
||||
+ "-J " + self.get_staging_folder(pkgName) + "/src/ "
|
||||
lutinMultiprocess.run_command(cmdLine)
|
||||
#aapt package -f -M ${manifest.file} -F ${packaged.resource.file} -I ${path.to.android-jar.library}
|
||||
# -S ${android-resource-directory} [-m -J ${folder.to.output.the.R.java}]
|
||||
|
||||
lutinTools.create_directory_of_file(self.get_staging_folder(pkgName) + "/build/classes/noFile")
|
||||
debug.print_element("pkg", "*.class", "<==", "*.java")
|
||||
# more information with : -Xlint
|
||||
# + self.file_finalAbstraction + " "\ # this generate ex: out/Android/debug/staging/tethys/src/com/edouarddupin/tethys/edn.java
|
||||
|
||||
#generate android java files:
|
||||
filesString=""
|
||||
for element in pkgProperties["ANDROID_JAVA_FILES"]:
|
||||
if element=="DEFAULT":
|
||||
filesString += self.folder_ewol + "/sources/android/src/org/ewol/EwolAudioTask.java "
|
||||
filesString += self.folder_ewol + "/sources/android/src/org/ewol/EwolCallback.java "
|
||||
filesString += self.folder_ewol + "/sources/android/src/org/ewol/EwolConstants.java "
|
||||
filesString += self.folder_ewol + "/sources/android/src/org/ewol/Ewol.java "
|
||||
filesString += self.folder_ewol + "/sources/android/src/org/ewol/EwolRendererGL.java "
|
||||
filesString += self.folder_ewol + "/sources/android/src/org/ewol/EwolSurfaceViewGL.java "
|
||||
filesString += self.folder_ewol + "/sources/android/src/org/ewol/EwolActivity.java "
|
||||
filesString += self.folder_ewol + "/sources/android/src/org/ewol/EwolWallpaper.java "
|
||||
else:
|
||||
filesString += element + " "
|
||||
|
||||
if "ADMOD_ID" in pkgProperties:
|
||||
filesString += self.folder_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/src/android/UnusedStub.java "
|
||||
|
||||
if len(pkgProperties["ANDROID_WALLPAPER_PROPERTIES"])!=0:
|
||||
filesString += self.folder_javaProject + pkgNameApplicationName + "Settings.java "
|
||||
|
||||
adModJarFile = ""
|
||||
if "ADMOD_ID" in pkgProperties:
|
||||
adModJarFile = ":" + self.folder_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar"
|
||||
|
||||
cmdLine = "javac " \
|
||||
+ "-d " + self.get_staging_folder(pkgName) + "/build/classes " \
|
||||
+ "-classpath " + self.folder_sdk + "/platforms/android-" + str(self.boardId) + "/android.jar" \
|
||||
+ adModJarFile + " " \
|
||||
+ filesString \
|
||||
+ self.file_finalAbstraction + " " \
|
||||
+ self.get_staging_folder(pkgName) + "/src/R.java "
|
||||
lutinMultiprocess.run_command(cmdLine)
|
||||
|
||||
debug.print_element("pkg", ".dex", "<==", "*.class")
|
||||
cmdLine = androidToolPath + "dx " \
|
||||
+ "--dex --no-strict " \
|
||||
+ "--output=" + self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + ".dex " \
|
||||
+ self.get_staging_folder(pkgName) + "/build/classes/ "
|
||||
|
||||
if "ADMOD_ID" in pkgProperties:
|
||||
cmdLine += self.folder_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar "
|
||||
|
||||
lutinMultiprocess.run_command(cmdLine)
|
||||
|
||||
debug.print_element("pkg", ".apk", "<==", ".dex, assets, .so, res")
|
||||
#builderDebug="-agentlib:jdwp=transport=dt_socket,server=y,address=8050,suspend=y "
|
||||
builderDebug=""
|
||||
# note : set -u not signed application...
|
||||
#+ ":" + self.folder_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar "
|
||||
cmdLine = "java -Xmx128M " \
|
||||
+ " -classpath " + self.folder_sdk + "/tools/lib/sdklib.jar " \
|
||||
+ builderDebug \
|
||||
+ " com.android.sdklib.build.ApkBuilderMain " \
|
||||
+ self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \
|
||||
+ " -u " \
|
||||
+ " -z " + self.get_staging_folder(pkgName) + "/resources.res " \
|
||||
+ " -f " + self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + ".dex " \
|
||||
+ " -rf " + self.get_staging_folder(pkgName) + "/data "
|
||||
lutinMultiprocess.run_command(cmdLine)
|
||||
|
||||
# doc :
|
||||
# http://developer.android.com/tools/publishing/app-signing.html
|
||||
# Create a key for signing your application:
|
||||
# keytool -genkeypair -v -keystore AndroidKey.jks -storepass Pass__AndroidDebugKey -alias alias__AndroidDebugKey -keypass PassKey__AndroidDebugKey -keyalg RSA -validity 36500
|
||||
if "debug"==self.buildMode:
|
||||
tmpFile = open("tmpPass.boo", 'w')
|
||||
tmpFile.write("Pass__AndroidDebugKey\n")
|
||||
tmpFile.write("PassKey__AndroidDebugKey\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
debug.print_element("pkg", ".apk(signed debug)", "<==", ".apk (not signed)")
|
||||
# verbose mode :
|
||||
#debugOption = "-verbose -certs "
|
||||
debugOption = ""
|
||||
cmdLine = "jarsigner " \
|
||||
+ debugOption \
|
||||
+ "-keystore " + lutinTools.get_current_path(__file__) + "/AndroidDebugKey.jks " \
|
||||
+ " -sigalg SHA1withRSA -digestalg SHA1 " \
|
||||
+ self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \
|
||||
+ " alias__AndroidDebugKey < tmpPass.boo"
|
||||
lutinMultiprocess.run_command(cmdLine)
|
||||
tmpFile = open("tmpPass.boo", 'w')
|
||||
tmpFile.write("\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
else:
|
||||
print("On release mode we need the file : and key an pasword to sign the application ...")
|
||||
debug.print_element("pkg", ".apk(signed debug)", "<==", ".apk (not signed)")
|
||||
cmdLine = "jarsigner " \
|
||||
+ " -keystore " + basePkgPath + "/AndroidKey.jks " \
|
||||
+ " -sigalg SHA1withRSA -digestalg SHA1 " \
|
||||
+ self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \
|
||||
+ " " + pkgNameApplicationName
|
||||
lutinMultiprocess.run_command(cmdLine)
|
||||
cmdLine = "jarsigner " \
|
||||
+ " -verify -verbose -certs " \
|
||||
+ " -sigalg SHA1withRSA -digestalg SHA1 " \
|
||||
+ self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk "
|
||||
lutinMultiprocess.run_command(cmdLine)
|
||||
|
||||
debug.print_element("pkg", ".apk(aligned)", "<==", ".apk (not aligned)")
|
||||
lutinTools.remove_file(self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk")
|
||||
# verbose mode : -v
|
||||
cmdLine = androidToolPath + "zipalign 4 " \
|
||||
+ self.get_staging_folder(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \
|
||||
+ self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk "
|
||||
lutinMultiprocess.run_command(cmdLine)
|
||||
|
||||
# copy file in the final stage :
|
||||
lutinTools.copy_file(self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk",
|
||||
self.get_final_folder() + "/" + pkgNameApplicationName + ".apk",
|
||||
force=True)
|
||||
|
||||
def install_package(self, pkgName):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Install package '" + pkgName + "'")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
pkgNameApplicationName = pkgName
|
||||
if "debug"==self.buildMode:
|
||||
pkgNameApplicationName += "debug"
|
||||
cmdLine = self.folder_sdk + "/platform-tools/adb install -r " \
|
||||
+ self.get_staging_folder(pkgName) + "/" + pkgNameApplicationName + ".apk "
|
||||
lutinMultiprocess.run_command(cmdLine)
|
||||
|
||||
def un_install_package(self, pkgName):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Un-Install package '" + pkgName + "'")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
pkgNameApplicationName = pkgName
|
||||
if "debug"==self.buildMode:
|
||||
pkgNameApplicationName += "debug"
|
||||
cmdLine = self.folder_sdk + "/platform-tools/adb uninstall " + pkgNameApplicationName
|
||||
RlutinMultiprocess.unCommand(cmdLine)
|
||||
|
||||
def Log(self, pkgName):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("logcat of android board")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
cmdLine = self.folder_sdk + "/platform-tools/adb shell logcat "
|
||||
lutinMultiprocess.run_command(cmdLine)
|
||||
|
||||
|
436
target/lutinTarget_IOs.py
Normal file
436
target/lutinTarget_IOs.py
Normal file
@@ -0,0 +1,436 @@
|
||||
#!/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 lutinTarget
|
||||
import lutinTools
|
||||
import lutinImage
|
||||
import os
|
||||
import stat
|
||||
import lutinExtProjectGeneratorXCode
|
||||
import lutinMultiprocess
|
||||
import lutinHost
|
||||
import random
|
||||
import re
|
||||
|
||||
class Target(lutinTarget.Target):
|
||||
def __init__(self, config):
|
||||
if config["compilator"] == "gcc":
|
||||
debug.info("compile only with clang for IOs");
|
||||
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://devs.openttd.org/~truebrain/compile-farm/apple-darwin9.txt
|
||||
if sumulator == True:
|
||||
arch = "i386"
|
||||
else:
|
||||
arch="arm64" # for ipad air
|
||||
#arch="armv7" # for Iphone 4
|
||||
lutinTarget.Target.__init__(self, "IOs", config, arch)
|
||||
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 ...
|
||||
self.ranlib=""
|
||||
self.folder_bin=""
|
||||
self.folder_data="/share"
|
||||
self.folder_doc="/doc"
|
||||
|
||||
self.suffix_lib_static='.a'
|
||||
self.suffix_lib_dynamic='.dylib'
|
||||
self.suffix_binary=''
|
||||
self.suffix_package=''
|
||||
if self.sumulator == True:
|
||||
self.sysroot = "-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk"
|
||||
self.global_flags_ld.append("-mios-simulator-version-min=7.0")
|
||||
self.global_flags_cc.append("-mios-simulator-version-min=7.0")
|
||||
else:
|
||||
self.sysroot = "-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk"
|
||||
self.global_flags_ld.append("-miphoneos-version-min=7.0")
|
||||
self.global_flags_cc.append("-miphoneos-version-min=7.0")
|
||||
|
||||
self.global_flags_ld.append([
|
||||
"-Xlinker",
|
||||
"-objc_abi_version",
|
||||
"-Xlinker 2",
|
||||
"-Xlinker",
|
||||
"-no_implicit_dylibs",
|
||||
"-stdlib=libc++",
|
||||
"-fobjc-arc",
|
||||
"-fobjc-link-runtime"])
|
||||
|
||||
self.global_flags_m.append("-fobjc-arc")
|
||||
#self.global_flags_m.append("-fmodules")
|
||||
|
||||
#add a project generator:
|
||||
self.externProjectManager = lutinExtProjectGeneratorXCode.ExtProjectGeneratorXCode()
|
||||
|
||||
def get_staging_folder(self, binaryName):
|
||||
return lutinTools.get_run_folder() + self.folder_out + self.folder_staging + "/" + binaryName + ".app/"
|
||||
|
||||
def get_staging_folder_data(self, binaryName):
|
||||
return self.get_staging_folder(binaryName) + self.folder_data + "/"
|
||||
|
||||
def make_package(self, pkgName, pkgProperties, basePkgPath):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Generate package '" + pkgName + "'")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
|
||||
if "ICON" in pkgProperties.keys() \
|
||||
and pkgProperties["ICON"] != "":
|
||||
# Resize all icon needed for Ios ...
|
||||
# TODO : Do not regenerate if source resource is not availlable
|
||||
# TODO : Add a colored background ...
|
||||
debug.print_element("pkg", "iTunesArtwork.png", "<==", pkgProperties["ICON"])
|
||||
lutinImage.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/iTunesArtwork.png", 512, 512)
|
||||
debug.print_element("pkg", "iTunesArtwork@2x.png", "<==", pkgProperties["ICON"])
|
||||
lutinImage.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/iTunesArtwork@2x.png", 1024, 1024)
|
||||
debug.print_element("pkg", "Icon-60@2x.png", "<==", pkgProperties["ICON"])
|
||||
lutinImage.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/Icon-60@2x.png", 120, 120)
|
||||
debug.print_element("pkg", "Icon-76.png", "<==", pkgProperties["ICON"])
|
||||
lutinImage.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/Icon-76.png", 76, 76)
|
||||
debug.print_element("pkg", "Icon-76@2x.png", "<==", pkgProperties["ICON"])
|
||||
lutinImage.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/Icon-76@2x.png", 152, 152)
|
||||
debug.print_element("pkg", "Icon-Small-40.png", "<==", pkgProperties["ICON"])
|
||||
lutinImage.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/Icon-Small-40.png", 40, 40)
|
||||
debug.print_element("pkg", "Icon-Small-40@2x.png", "<==", pkgProperties["ICON"])
|
||||
lutinImage.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/Icon-Small-40@2x.png", 80, 80)
|
||||
debug.print_element("pkg", "Icon-Small.png", "<==", pkgProperties["ICON"])
|
||||
lutinImage.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/Icon-Small.png", 29, 29)
|
||||
debug.print_element("pkg", "Icon-Small@2x.png", "<==", pkgProperties["ICON"])
|
||||
lutinImage.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/Icon-Small@2x.png", 58, 58)
|
||||
|
||||
debug.print_element("pkg", "PkgInfo", "<==", "APPL????")
|
||||
infoFile = self.get_staging_folder(pkgName) + "/PkgInfo"
|
||||
# Create the info file
|
||||
tmpFile = open(infoFile, 'w')
|
||||
tmpFile.write("APPL????")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
|
||||
debug.print_element("pkg", "Info.plist", "<==", "Package properties")
|
||||
# http://www.sandroid.org/imcross/#Deployment
|
||||
dataFile = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||
dataFile += "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
|
||||
dataFile += "<plist version=\"1.0\">\n"
|
||||
dataFile += " <dict>\n"
|
||||
dataFile += " <key>CFBundleDevelopmentRegion</key>\n"
|
||||
dataFile += " <string>en</string>\n"
|
||||
dataFile += " <key>CFBundleDisplayName</key>\n"
|
||||
dataFile += " <string>" + pkgProperties["NAME"] + "</string>\n"
|
||||
dataFile += " <key>CFBundleExecutable</key>\n"
|
||||
dataFile += " <string>" + pkgName + "</string>\n"
|
||||
dataFile += " <key>CFBundleIdentifier</key>\n"
|
||||
dataFile += " <string>com." + pkgProperties["COMPAGNY_NAME2"] + "." + pkgName + "</string>\n"
|
||||
|
||||
dataFile += " <key>CFBundleIconFiles</key>\n"
|
||||
dataFile += " <array>\n"
|
||||
dataFile += " <string>Icon-60@2x.png</string>\n"
|
||||
dataFile += " <string>Icon-76.png</string>\n"
|
||||
dataFile += " <string>Icon-76@2x.png</string>\n"
|
||||
dataFile += " <string>Icon-Small-40.png</string>\n"
|
||||
dataFile += " <string>Icon-Small-40@2x.png</string>\n"
|
||||
dataFile += " <string>Icon-Small.png</string>\n"
|
||||
dataFile += " <string>Icon-Small@2x.png</string>\n"
|
||||
dataFile += " <string>iTunesArtwork.png</string>\n"
|
||||
dataFile += " <string>iTunesArtwork@2x.png</string>\n"
|
||||
dataFile += " </array>\n"
|
||||
|
||||
dataFile += " <key>CFBundleInfoDictionaryVersion</key>\n"
|
||||
dataFile += " <string>6.0</string>\n"
|
||||
dataFile += " <key>CFBundleName</key>\n"
|
||||
dataFile += " <string>" + pkgName + "</string>\n"
|
||||
dataFile += " <key>CFBundlePackageType</key>\n"
|
||||
dataFile += " <string>APPL</string>\n"
|
||||
dataFile += " <key>CFBundleSignature</key>\n"
|
||||
dataFile += " <string>????</string>\n"
|
||||
dataFile += " <key>CFBundleSupportedPlatforms</key>\n"
|
||||
dataFile += " <array>\n"
|
||||
dataFile += " <string>iPhoneSimulator</string>\n"
|
||||
dataFile += " </array>\n"
|
||||
dataFile += " \n"
|
||||
dataFile += " <key>CFBundleShortVersionString</key>\n"
|
||||
dataFile += " <string>"+pkgProperties["VERSION"]+"</string>\n"
|
||||
dataFile += " <key>CFBundleVersion</key>\n"
|
||||
dataFile += " <string>"+pkgProperties["VERSION_CODE"]+"</string>\n"
|
||||
dataFile += " \n"
|
||||
dataFile += " <key>CFBundleResourceSpecification</key>\n"
|
||||
dataFile += " <string>ResourceRules.plist</string>\n"
|
||||
if self.sumulator == False:
|
||||
dataFile += " <key>LSRequiresIPhoneOS</key>\n"
|
||||
dataFile += " <true/>\n"
|
||||
else:
|
||||
dataFile += " <key>DTPlatformName</key>\n"
|
||||
dataFile += " <string>iphonesimulator</string>\n"
|
||||
dataFile += " <key>DTSDKName</key>\n"
|
||||
dataFile += " <string>iphonesimulator7.0</string>\n"
|
||||
dataFile += " \n"
|
||||
dataFile += " <key>UIDeviceFamily</key>\n"
|
||||
dataFile += " <array>\n"
|
||||
dataFile += " <integer>1</integer>\n"
|
||||
dataFile += " <integer>2</integer>\n"
|
||||
dataFile += " </array>\n"
|
||||
dataFile += " <key>UIRequiredDeviceCapabilities</key>\n"
|
||||
dataFile += " <array>\n"
|
||||
dataFile += " <string>armv7</string>\n"
|
||||
dataFile += " </array>\n"
|
||||
dataFile += " <key>UIStatusBarHidden</key>\n"
|
||||
dataFile += " <true/>\n"
|
||||
dataFile += " <key>UISupportedInterfaceOrientations</key>\n"
|
||||
dataFile += " <array>\n"
|
||||
dataFile += " <string>UIInterfaceOrientationPortrait</string>\n"
|
||||
dataFile += " <string>UIInterfaceOrientationPortraitUpsideDown</string>\n"
|
||||
dataFile += " <string>UIInterfaceOrientationLandscapeLeft</string>\n"
|
||||
dataFile += " <string>UIInterfaceOrientationLandscapeRight</string>\n"
|
||||
dataFile += " </array>\n"
|
||||
dataFile += " <key>UISupportedInterfaceOrientations~ipad</key>\n"
|
||||
dataFile += " <array>\n"
|
||||
dataFile += " <string>UIInterfaceOrientationPortrait</string>\n"
|
||||
dataFile += " <string>UIInterfaceOrientationPortraitUpsideDown</string>\n"
|
||||
dataFile += " <string>UIInterfaceOrientationLandscapeLeft</string>\n"
|
||||
dataFile += " <string>UIInterfaceOrientationLandscapeRight</string>\n"
|
||||
dataFile += " </array>\n"
|
||||
dataFile += " </dict>\n"
|
||||
dataFile += "</plist>\n"
|
||||
dataFile += "\n\n"
|
||||
|
||||
infoFile = self.get_staging_folder(pkgName) + "/Info.plist"
|
||||
# Create the info file
|
||||
tmpFile = open(infoFile, 'w')
|
||||
tmpFile.write(dataFile)
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
"""
|
||||
infoFile = self.get_staging_folder(pkgName) + "/" + pkgName + "-Info.plist"
|
||||
# Create the info file
|
||||
tmpFile = open(infoFile, 'w')
|
||||
tmpFile.write(dataFile)
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
cmdLine = "builtin-infoPlistUtility "
|
||||
cmdLine += " " + self.get_staging_folder(pkgName) + "/" + pkgName + "-Info.plist "
|
||||
cmdLine += " -genpkginfo " + self.get_staging_folder(pkgName) + "/PkgInfo"
|
||||
cmdLine += " -expandbuildsettings "
|
||||
cmdLine += " -format binary "
|
||||
if self.sumulator == False:
|
||||
cmdLine += " -platform iphonesimulator "
|
||||
else:
|
||||
cmdLine += " -platform iphoneos "
|
||||
cmdLine += " -o " + self.get_staging_folder(pkgName) + "/" + "Info.plist"
|
||||
lutinMultiprocess.run_command(cmdLine)
|
||||
"""
|
||||
"""
|
||||
|
||||
/Users/edouarddupin/dev/exampleProjectXcode/projectName/projectName/projectName-Info.plist
|
||||
-genpkginfo
|
||||
/Users/edouarddupin/Library/Developer/Xcode/DerivedData/projectName-gwycnyyzohokcmalgodeucqppxro/Build/Products/Debug-iphonesimulator/projectName.app/PkgInfo
|
||||
-expandbuildsettings
|
||||
-format binary
|
||||
-platform iphonesimulator
|
||||
-additionalcontentfile /Users/edouarddupin/Library/Developer/Xcode/DerivedData/projectName-gwycnyyzohokcmalgodeucqppxro/Build/Intermediates/projectName.build/Debug-iphonesimulator/projectName.build/assetcatalog_generated_info.plist
|
||||
-o /Users/edouarddupin/Library/Developer/Xcode/DerivedData/projectName-gwycnyyzohokcmalgodeucqppxro/Build/Products/Debug-iphonesimulator/projectName.app/Info.plist
|
||||
-additionalcontentfile /Users/edouarddupin/Library/Developer/Xcode/DerivedData/zdzdzd-bjuyukzpzhnyerdmxohjyuxfdllv/Build/Intermediates/zdzdzd.build/Debug-iphoneos/zdzdzd.build/assetcatalog_generated_info.plist -o /Users/edouarddupin/Library/Developer/Xcode/DerivedData/zdzdzd-bjuyukzpzhnyerdmxohjyuxfdllv/Build/Products/Debug-iphoneos/zdzdzd.app/Info.plist
|
||||
|
||||
"""
|
||||
#/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil /Users/edouarddupin/Library/Developer/Xcode/DerivedData/projectName-gwycnyyzohokcmalgodeucqppxro/Build/Products/Debug-iphonesimulator/projectName.app/projectName -o /Users/edouarddupin/Library/Developer/Xcode/DerivedData/projectName-gwycnyyzohokcmalgodeucqppxro/Build/Products/Debug-iphonesimulator/projectName.app.dSYM
|
||||
|
||||
debug.print_element("pkg", "ResourceRules.plist", "<==", "Resources autorisation")
|
||||
dataFile = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||
dataFile += "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
|
||||
dataFile += "<plist version=\"1.0\">\n"
|
||||
dataFile += " <dict>\n"
|
||||
dataFile += " <key>rules</key>\n"
|
||||
dataFile += " <dict>\n"
|
||||
dataFile += " <key>.*</key>\n"
|
||||
dataFile += " <true/>\n"
|
||||
dataFile += " <key>Info.plist</key>\n"
|
||||
dataFile += " <dict>\n"
|
||||
dataFile += " <key>omit</key>\n"
|
||||
dataFile += " <true/>\n"
|
||||
dataFile += " <key>weight</key>\n"
|
||||
dataFile += " <real>10</real>\n"
|
||||
dataFile += " </dict>\n"
|
||||
dataFile += " <key>ResourceRules.plist</key>\n"
|
||||
dataFile += " <dict>\n"
|
||||
dataFile += " <key>omit</key>\n"
|
||||
dataFile += " <true/>\n"
|
||||
dataFile += " <key>weight</key>\n"
|
||||
dataFile += " <real>100</real>\n"
|
||||
dataFile += " </dict>\n"
|
||||
dataFile += " </dict>\n"
|
||||
dataFile += " </dict>\n"
|
||||
dataFile += "</plist>\n"
|
||||
dataFile += "\n\n"
|
||||
|
||||
infoFile = self.get_staging_folder(pkgName) + "/ResourceRules.plist"
|
||||
# Create the info file
|
||||
tmpFile = open(infoFile, 'w')
|
||||
tmpFile.write(dataFile)
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
|
||||
debug.print_element("pkg", "Entitlements.plist", "<==", "application mode")
|
||||
dataFile = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||
dataFile += "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
|
||||
dataFile += "<plist version=\"1.0\">\n"
|
||||
dataFile += " <dict>\n"
|
||||
dataFile += " <key>get-task-allow</key>\n"
|
||||
dataFile += " <true/>\n"
|
||||
dataFile += " </dict>\n"
|
||||
dataFile += "</plist>\n"
|
||||
dataFile += "\n\n"
|
||||
|
||||
infoFile = self.get_staging_folder(pkgName) + "/Entitlements.plist"
|
||||
# Create the info file
|
||||
tmpFile = open(infoFile, 'w')
|
||||
tmpFile.write(dataFile)
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
|
||||
# Simulateur folder :
|
||||
#~/Library/Application\ Support/iPhone\ Simulator/7.0.3/Applications/
|
||||
# must have a 'uuidgen' UID generate value with this elemennt ...
|
||||
# get the bundle path : ==> maybe usefull in MocOS ...
|
||||
# NSLog(@"%@",[[NSBundle mainBundle] bundlePath]);
|
||||
|
||||
# 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
|
||||
|
||||
if self.sumulator == False:
|
||||
# Create the info file
|
||||
tmpFile = open(self.get_build_folder(pkgName) + "/worddown.xcent", 'w')
|
||||
tmpFile.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
|
||||
tmpFile.write("<!DOCTYPE plist PUBLIC \"-//Apple//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>application-identifier</key>\n")
|
||||
tmpFile.write(" <string>" + pkgProperties["APPLE_APPLICATION_IOS_ID"] + "." + pkgProperties["COMPAGNY_TYPE"] + "." + pkgProperties["COMPAGNY_NAME2"] + "." + pkgName + "</string>\n")
|
||||
tmpFile.write(" <key>get-task-allow</key>\n")
|
||||
tmpFile.write(" <true/>\n")
|
||||
tmpFile.write(" <key>keychain-access-groups</key>\n")
|
||||
tmpFile.write(" <array>\n")
|
||||
tmpFile.write(" <string>" + pkgProperties["APPLE_APPLICATION_IOS_ID"] + ".atriasoft.worddown</string>\n")
|
||||
tmpFile.write(" </array>\n")
|
||||
tmpFile.write(" </dict>\n")
|
||||
tmpFile.write("</plist>\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
# application signing :
|
||||
debug.print_element("pkg(signed)", "pkg", "<==", "Signing application")
|
||||
iosDevelopperKeyFile = ".iosKey.txt"
|
||||
if lutinTools.file_size(iosDevelopperKeyFile) < 10:
|
||||
debug.error("To sign an application we need to have a signing key in the file '" + iosDevelopperKeyFile + "' \n it is represented like: 'iPhone Developer: Francis DUGENOUX (YRRQE5KGTH)'\n you can obtain it with : 'certtool y | grep \"Developer\"'")
|
||||
signatureKey = lutinTools.file_read_data(iosDevelopperKeyFile)
|
||||
signatureKey = re.sub('\n', '', signatureKey)
|
||||
cmdLine = 'codesign --force --sign '
|
||||
# to get this key ; certtool y | grep "Developer"
|
||||
cmdLine += ' "' + signatureKey + '" '
|
||||
cmdLine += ' --entitlements ' + self.get_build_folder(pkgName) + '/worddown.xcent'
|
||||
cmdLine += ' ' + self.get_staging_folder(pkgName)
|
||||
lutinMultiprocess.run_command(cmdLine)
|
||||
|
||||
# --force --sign "iPhone Developer: Edouard DUPIN (SDFGSDFGSDFG)"
|
||||
# --resource-rules=/Users/edouarddupin/Library/Developer/Xcode/DerivedData/worddown-cmuvjchgtiteexdiacyqoexsyadg/Build/Products/Debug-iphoneos/worddown.app/ResourceRules.plist
|
||||
# --entitlements /Users/edouarddupin/Library/Developer/Xcode/DerivedData/worddown-cmuvjchgtiteexdiacyqoexsyadg/Build/Intermediates/worddown.build/Debug-iphoneos/worddown.build/worddown.xcent
|
||||
# /Users/edouarddupin/Library/Developer/Xcode/DerivedData/worddown-cmuvjchgtiteexdiacyqoexsyadg/Build/Products/Debug-iphoneos/worddown.app
|
||||
|
||||
|
||||
def createRandomNumber(self, len):
|
||||
out = ""
|
||||
for iii in range(0,len):
|
||||
out += random.choice(["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"])
|
||||
return out
|
||||
|
||||
def install_package(self, pkgName):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Install package '" + pkgName + "'")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
if self.sumulator == False:
|
||||
if lutinTools.file_size("ewol/ios-deploy/ios-deploy") == 0:
|
||||
debug.print_element("tool", "ios-deploy", "<==", "external sources")
|
||||
cmdLine = 'cd ewol/ios-deploy ; make ; cd ../.. '
|
||||
lutinMultiprocess.run_command(cmdLine)
|
||||
if lutinTools.file_size("ewol/ios-deploy/ios-deploy") == 0:
|
||||
debug.error("Can not create ios-deploy external software ...")
|
||||
debug.print_element("deploy", "iphone/ipad", "<==", "aplication")
|
||||
cmdLine = './ewol/ios-deploy/ios-deploy --bundle ' + self.get_staging_folder(pkgName)
|
||||
lutinMultiprocess.run_command(cmdLine)
|
||||
else:
|
||||
simulatorIdFile = ".iosSimutatorId_" + pkgName + ".txt"
|
||||
if lutinTools.file_size(simulatorIdFile) < 10:
|
||||
#create the file:
|
||||
tmpFile = open(simulatorIdFile, 'w')
|
||||
tmpFile.write(self.createRandomNumber(8))
|
||||
tmpFile.write("-")
|
||||
tmpFile.write(self.createRandomNumber(4))
|
||||
tmpFile.write("-")
|
||||
tmpFile.write(self.createRandomNumber(4))
|
||||
tmpFile.write("-")
|
||||
tmpFile.write(self.createRandomNumber(4))
|
||||
tmpFile.write("-")
|
||||
tmpFile.write(self.createRandomNumber(12))
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
simulatorId = lutinTools.file_read_data(simulatorIdFile)
|
||||
home = os.path.expanduser("~")
|
||||
destinationFolderBase = home + "/Library/Application\\ Support/iPhone\\ Simulator/7.1/Applications/" + simulatorId
|
||||
destinationFolder = home + "/Library/Application Support/iPhone Simulator/7.1/Applications/" + simulatorId + "/" + pkgName + ".app"
|
||||
destinationFolder2 = home + "/Library/Application\\ Support/iPhone\\ Simulator/7.1/Applications/" + simulatorId + "/" + pkgName + ".app"
|
||||
debug.info("install in simulator : " + destinationFolder)
|
||||
lutinTools.create_directory_of_file(destinationFolder + "/plop.txt")
|
||||
cmdLine = "cp -rf " + self.get_staging_folder(pkgName) + " " + destinationFolder2
|
||||
lutinMultiprocess.run_command(cmdLine)
|
||||
cmdLine = "touch " + destinationFolderBase
|
||||
lutinMultiprocess.run_command(cmdLine)
|
||||
|
||||
#sudo dpkg -i $(TARGET_OUT_FINAL)/$(PROJECT_NAME) + self.suffix_package
|
||||
|
||||
def un_install_package(self, pkgName):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Un-Install package '" + pkgName + "'")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
if self.sumulator == False:
|
||||
debug.warning("not implemented")
|
||||
else:
|
||||
simulatorIdFile = ".iosSimutatorId_" + pkgName + ".txt"
|
||||
if lutinTools.file_size(simulatorIdFile) < 10:
|
||||
debug.warning("Can not get simulation O_ID : " + simulatorIdFile)
|
||||
|
||||
#sudo dpkg -r $(TARGET_OUT_FINAL)/$(PROJECT_NAME) + self.suffix_package
|
||||
|
||||
def Log(self, pkgName):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("log of iOs board")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
if self.sumulator == False:
|
||||
if lutinTools.file_size("ewol/ios-deploy/ios-deploy") == 0:
|
||||
debug.print_element("tool", "ios-deploy", "<==", "external sources")
|
||||
cmdLine = 'cd ewol/ios-deploy ; make ; cd ../.. '
|
||||
lutinMultiprocess.run_command(cmdLine)
|
||||
if lutinTools.file_size("ewol/ios-deploy/ios-deploy") == 0:
|
||||
debug.error("Can not create ios-deploy external software ...")
|
||||
debug.print_element("deploy", "iphone/ipad", "<==", "aplication")
|
||||
cmdLine = './ewol/ios-deploy/ios-deploy --debug --bundle ' + self.get_staging_folder(pkgName)
|
||||
lutinMultiprocess.run_command(cmdLine)
|
||||
else:
|
||||
cmdLine = "tail -f ~/Library/Logs/iOS\ Simulator/7.1/system.log"
|
||||
lutinMultiprocess.run_command(cmdLine)
|
||||
|
||||
|
||||
|
||||
|
132
target/lutinTarget_Linux.py
Normal file
132
target/lutinTarget_Linux.py
Normal file
@@ -0,0 +1,132 @@
|
||||
#!/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 lutinTarget
|
||||
import lutinTools as tools
|
||||
import os
|
||||
import stat
|
||||
import re
|
||||
import lutinMultiprocess
|
||||
import lutinHost
|
||||
|
||||
class Target(lutinTarget.Target):
|
||||
def __init__(self, config):
|
||||
#processor type selection (auto/arm/ppc/x86)
|
||||
if config["arch"] == "auto":
|
||||
config["arch"] = "x86"
|
||||
#bus size selection (auto/32/64)
|
||||
if config["bus-size"] == "auto":
|
||||
config["bus-size"] = str(lutinHost.BUS_SIZE)
|
||||
lutinTarget.Target.__init__(self, "Linux", config, "")
|
||||
|
||||
def generate_list_separate_coma(self, list):
|
||||
result = ""
|
||||
fistTime = True
|
||||
for elem in list:
|
||||
if fistTime == True:
|
||||
fistTime = False
|
||||
else:
|
||||
result += ","
|
||||
result += elem
|
||||
return result
|
||||
|
||||
def make_package(self, pkgName, pkgProperties, basePkgPath):
|
||||
# http://alp.developpez.com/tutoriels/debian/creer-paquet/
|
||||
debianPkgName = re.sub("_", "-", pkgName)
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Generate package '" + debianPkgName + "' v"+pkgProperties["VERSION"])
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
self.get_staging_folder(pkgName)
|
||||
targetOutFolderDebian = self.get_staging_folder(pkgName) + "/DEBIAN/"
|
||||
finalFileControl = targetOutFolderDebian + "control"
|
||||
finalFilepostRm = targetOutFolderDebian + "postrm"
|
||||
# create the folders :
|
||||
tools.create_directory_of_file(finalFileControl)
|
||||
tools.create_directory_of_file(finalFilepostRm)
|
||||
## Create the control file
|
||||
tools.create_directory_of_file(finalFileControl)
|
||||
tmpFile = open(finalFileControl, 'w')
|
||||
tmpFile.write("Package: " + debianPkgName + "\n")
|
||||
tmpFile.write("Version: " + pkgProperties["VERSION"] + "\n")
|
||||
tmpFile.write("Section: " + self.generate_list_separate_coma(pkgProperties["SECTION"]) + "\n")
|
||||
tmpFile.write("Priority: " + pkgProperties["PRIORITY"] + "\n")
|
||||
tmpFile.write("Architecture: all\n")
|
||||
tmpFile.write("Depends: bash\n")
|
||||
tmpFile.write("Maintainer: " + self.generate_list_separate_coma(pkgProperties["MAINTAINER"]) + "\n")
|
||||
tmpFile.write("Description: " + pkgProperties["DESCRIPTION"] + "\n")
|
||||
tmpFile.write("\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## Create the PostRm
|
||||
tmpFile = open(finalFilepostRm, 'w')
|
||||
tmpFile.write("#!/bin/bash\n")
|
||||
tmpFile.write("touch ~/." + pkgName + "\n")
|
||||
if pkgName != "":
|
||||
tmpFile.write("touch ~/.local/share/" + pkgName + "\n")
|
||||
tmpFile.write("rm -r ~/.local/share/" + pkgName + "\n")
|
||||
tmpFile.write("\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## Enable Execution in script
|
||||
os.chmod(finalFilepostRm, stat.S_IRWXU + stat.S_IRGRP + stat.S_IXGRP + stat.S_IROTH + stat.S_IXOTH);
|
||||
## Readme donumentation
|
||||
readmeFileDest = self.get_staging_folder(pkgName) + "/usr/share/doc/"+ debianPkgName + "/README"
|
||||
tools.create_directory_of_file(readmeFileDest)
|
||||
if os.path.exists(basePkgPath + "/os-Linux/README")==True:
|
||||
tools.copy_file(basePkgPath + "/os-Linux/README", readmeFileDest)
|
||||
elif os.path.exists(basePkgPath + "/README")==True:
|
||||
tools.copy_file(basePkgPath + "/README", readmeFileDest)
|
||||
elif os.path.exists(basePkgPath + "/README.md")==True:
|
||||
tools.copy_file(basePkgPath + "/README.md", readmeFileDest)
|
||||
else:
|
||||
debug.info("no file 'README', 'README.md' or 'os-Linux/README' ==> generate an empty one")
|
||||
tmpFile = open(readmeFileDest, 'w')
|
||||
tmpFile.write("No documentation for " + pkgName + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## licence file
|
||||
licenseFileDest = self.get_staging_folder(pkgName) + "/usr/share/doc/"+ debianPkgName + "/copyright"
|
||||
tools.create_directory_of_file(licenseFileDest)
|
||||
if os.path.exists(basePkgPath + "/license.txt")==True:
|
||||
tools.copy_file(basePkgPath + "/license.txt", licenseFileDest)
|
||||
else:
|
||||
debug.info("no file 'license.txt' ==> generate an empty one")
|
||||
tmpFile = open(licenseFileDest, 'w')
|
||||
tmpFile.write("No license define by the developper for " + pkgName + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
##changeLog file
|
||||
changeLogFileDest = self.get_staging_folder(pkgName) + "/usr/share/doc/"+ debianPkgName + "/changelog"
|
||||
tools.create_directory_of_file(changeLogFileDest)
|
||||
if os.path.exists(basePkgPath + "/changelog")==True:
|
||||
tools.copy_file(basePkgPath + "/changelog", changeLogFileDest)
|
||||
else:
|
||||
debug.info("no file 'changelog' ==> generate an empty one")
|
||||
tmpFile = open(changeLogFileDest, 'w')
|
||||
tmpFile.write("No changelog data " + pkgName + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## create the package :
|
||||
debug.debug("package : " + self.get_staging_folder(pkgName) + "/" + debianPkgName + ".deb")
|
||||
os.system("cd " + self.get_staging_folder("") + " ; dpkg-deb --build " + pkgName)
|
||||
tools.create_directory_of_file(self.get_final_folder())
|
||||
tools.copy_file(self.get_staging_folder("") + "/" + pkgName + self.suffix_package, self.get_final_folder() + "/" + pkgName + self.suffix_package)
|
||||
|
||||
def install_package(self, pkgName):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Install package '" + pkgName + "'")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
os.system("sudo dpkg -i " + self.get_final_folder() + "/" + pkgName + self.suffix_package)
|
||||
|
||||
def un_install_package(self, pkgName):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Un-Install package '" + pkgName + "'")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
os.system("sudo dpkg -r " + self.get_final_folder() + "/" + pkgName + self.suffix_package)
|
105
target/lutinTarget_MacOs.py
Normal file
105
target/lutinTarget_MacOs.py
Normal file
@@ -0,0 +1,105 @@
|
||||
#!/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 lutinTarget
|
||||
import lutinTools
|
||||
import lutinHost
|
||||
import os
|
||||
import stat
|
||||
|
||||
class Target(lutinTarget.Target):
|
||||
def __init__(self, config):
|
||||
#processor type selection (auto/arm/ppc/x86)
|
||||
if config["arch"] == "auto":
|
||||
config["arch"] = "x86"
|
||||
#bus size selection (auto/32/64)
|
||||
if config["bus-size"] == "auto":
|
||||
config["bus-size"] = str(lutinHost.BUS_SIZE)
|
||||
# http://biolpc22.york.ac.uk/pub/linux-mac-cross/
|
||||
# http://devs.openttd.org/~truebrain/compile-farm/apple-darwin9.txt
|
||||
lutinTarget.Target.__init__(self, "MacOs", config, "")
|
||||
|
||||
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='.dylib'
|
||||
self.suffix_binary=''
|
||||
self.suffix_package=''
|
||||
|
||||
|
||||
def get_staging_folder(self, binaryName):
|
||||
return lutinTools.get_run_folder() + self.folder_out + self.folder_staging + "/" + binaryName + ".app/Contents/"
|
||||
|
||||
def get_staging_folder_data(self, binaryName):
|
||||
return self.get_staging_folder(binaryName) + self.folder_data + "/"
|
||||
|
||||
def make_package(self, pkgName, pkgProperties, basePkgPath):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Generate package '" + pkgName + "'")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
|
||||
if "ICON" in pkgProperties.keys() \
|
||||
and pkgProperties["ICON"] != "":
|
||||
lutinTools.copy_file(pkgProperties["ICON"], self.get_staging_folder_data(pkgName) + "/icon.icns", True)
|
||||
|
||||
# http://www.sandroid.org/imcross/#Deployment
|
||||
infoFile=self.get_staging_folder(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>" + pkgProperties["COMPAGNY_TYPE"] + "." + pkgProperties["COMPAGNY_NAME2"] + "." + pkgName + "</string>\n")
|
||||
tmpFile.write(" <key>CFBundleSignature</key>\n")
|
||||
tmpFile.write(" <string>????</string>\n")
|
||||
tmpFile.write(" <key>CFBundleIconFile</key>\n")
|
||||
tmpFile.write(" <string>icon.icns</string>\n")
|
||||
tmpFile.write(" </dict>\n")
|
||||
tmpFile.write("</plist>\n")
|
||||
tmpFile.write("\n\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
infoFile=self.get_staging_folder(pkgName) + "/PkgInfo"
|
||||
# Create the info file
|
||||
tmpFile = open(infoFile, 'w')
|
||||
tmpFile.write("APPL????")
|
||||
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 install_package(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 un_install_package(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
|
||||
|
||||
|
||||
|
||||
|
81
target/lutinTarget_Windows.py
Normal file
81
target/lutinTarget_Windows.py
Normal file
@@ -0,0 +1,81 @@
|
||||
#!/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 lutinTarget
|
||||
import lutinTools
|
||||
import lutinHost
|
||||
import os
|
||||
import stat
|
||||
import sys
|
||||
|
||||
class Target(lutinTarget.Target):
|
||||
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
|
||||
# TODO : get external PATH for the minGW path
|
||||
# TODO : Set the cyngwin path ...
|
||||
if lutinHost.OS == "Windows":
|
||||
self.set_cross_base("c:\\MinGW\\bin\\")
|
||||
sys.path.append("c:\\MinGW\\bin" )
|
||||
os.environ['PATH'] += ";c:\\MinGW\\bin\\"
|
||||
else:
|
||||
if self.config["bus-size"] == "64":
|
||||
# 64 bits
|
||||
self.set_cross_base("x86_64-w64-mingw32-")
|
||||
else:
|
||||
# 32 bits
|
||||
self.set_cross_base("i686-w64-mingw32-")
|
||||
|
||||
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 get_staging_folder_data(self, binaryName):
|
||||
return self.get_staging_folder(binaryName) + self.folder_data
|
||||
|
||||
def make_package(self, pkgName, pkgProperties, basePkgPath):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Generate package '" + pkgName + "'")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.warning(" ==> TODO")
|
||||
|
||||
def install_package(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 un_install_package(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
|
||||
|
Reference in New Issue
Block a user