[DEV] set work compilation again on windows

This commit is contained in:
Edouard DUPIN 2015-09-16 16:58:01 +02:00
parent 6ac4cc45fa
commit 06481abcbf
6 changed files with 402 additions and 275 deletions

View File

@ -492,6 +492,19 @@ class Target:
self.action_on_state[name_of_state] = [[level, name, action]] self.action_on_state[name_of_state] = [[level, name, action]]
else: else:
self.action_on_state[name_of_state].append([level, name, action]) self.action_on_state[name_of_state].append([level, name, action])
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
targetList=[] targetList=[]

View File

@ -198,39 +198,39 @@ class Target(target.Target):
self.global_flags_cc.append("-fexceptions") self.global_flags_cc.append("-fexceptions")
self.global_flags_xx.append("-Wa,--noexecstack") self.global_flags_xx.append("-Wa,--noexecstack")
def check_right_package(self, pkgProperties, value): def check_right_package(self, pkg_properties, value):
for val in pkgProperties["RIGHT"]: for val in pkg_properties["RIGHT"]:
if value == val: if value == val:
return True return True
return False return False
""" """
def get_staging_path_data(self, binaryName): def get_staging_path_data(self, binary_name):
return self.get_staging_path(binaryName) + self.path_data return self.get_staging_path(binary_name) + self.path_data
""" """
def make_package(self, pkgName, pkgProperties, basePkgPath, heritage): def make_package(self, pkg_name, pkg_properties, base_pkg_path, heritage_list):
# http://alp.developpez.com/tutoriels/debian/creer-paquet/ # http://alp.developpez.com/tutoriels/debian/creer-paquet/
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("Generate package '" + pkgName + "'") debug.info("Generate package '" + pkg_name + "'")
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
pkgNameApplicationName = pkgName pkg_name_application_name = pkg_name
if self.config["mode"] == "debug": if self.config["mode"] == "debug":
pkgNameApplicationName += "debug" pkg_name_application_name += "debug"
# FINAL_path_JAVA_PROJECT # FINAL_path_JAVA_PROJECT
self.path_javaProject= self.get_staging_path(pkgName) \ self.path_javaProject= self.get_staging_path(pkg_name) \
+ "/src/" \ + "/src/" \
+ pkgProperties["COMPAGNY_TYPE"] \ + pkg_properties["COMPAGNY_TYPE"] \
+ "/" + pkgProperties["COMPAGNY_NAME2"] \ + "/" + pkg_properties["COMPAGNY_NAME2"] \
+ "/" + pkgNameApplicationName + "/" + "/" + pkg_name_application_name + "/"
#FINAL_FILE_ABSTRACTION #FINAL_FILE_ABSTRACTION
self.file_finalAbstraction = self.path_javaProject + "/" + pkgNameApplicationName + ".java" self.file_finalAbstraction = self.path_javaProject + "/" + pkg_name_application_name + ".java"
compleatePackageName = pkgProperties["COMPAGNY_TYPE"]+"."+pkgProperties["COMPAGNY_NAME2"]+"." + pkgNameApplicationName compleatePackageName = pkg_properties["COMPAGNY_TYPE"]+"."+pkg_properties["COMPAGNY_NAME2"]+"." + pkg_name_application_name
if "ADMOD_ID" in pkgProperties: if "ADMOD_ID" in pkg_properties:
pkgProperties["RIGHT"].append("INTERNET") pkg_properties["RIGHT"].append("INTERNET")
pkgProperties["RIGHT"].append("ACCESS_NETWORK_STATE") pkg_properties["RIGHT"].append("ACCESS_NETWORK_STATE")
debug.print_element("pkg", "absractionFile", "<==", "dynamic file") debug.print_element("pkg", "absractionFile", "<==", "dynamic file")
@ -239,20 +239,20 @@ class Target(target.Target):
# Create file : # Create file :
# java ==> done by ewol wrapper ... (and compiled in the normal compilation system ==> must be find in the dependency list of jar ... # java ==> done by ewol wrapper ... (and compiled in the normal compilation system ==> must be find in the dependency list of jar ...
tools.create_directory_of_file(self.get_staging_path(pkgName) + "/res/drawable/icon.png"); tools.create_directory_of_file(self.get_staging_path(pkg_name) + "/res/drawable/icon.png");
if "ICON" in pkgProperties.keys() \ if "ICON" in pkg_properties.keys() \
and pkgProperties["ICON"] != "": and pkg_properties["ICON"] != "":
image.resize(pkgProperties["ICON"], self.get_staging_path(pkgName) + "/res/drawable/icon.png", 256, 256) image.resize(pkg_properties["ICON"], self.get_staging_path(pkg_name) + "/res/drawable/icon.png", 256, 256)
else: else:
# to be sure that we have all time a resource ... # to be sure that we have all time a resource ...
tmpFile = open(self.get_staging_path(pkgName) + "/res/drawable/plop.txt", 'w') tmpFile = open(self.get_staging_path(pkg_name) + "/res/drawable/plop.txt", 'w')
tmpFile.write('plop\n') tmpFile.write('plop\n')
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
if pkgProperties["ANDROID_MANIFEST"]!="": if pkg_properties["ANDROID_MANIFEST"]!="":
debug.print_element("pkg", "AndroidManifest.xml", "<==", pkgProperties["ANDROID_MANIFEST"]) debug.print_element("pkg", "AndroidManifest.xml", "<==", pkg_properties["ANDROID_MANIFEST"])
tools.copy_file(pkgProperties["ANDROID_MANIFEST"], self.get_staging_path(pkgName) + "/AndroidManifest.xml", force=True) tools.copy_file(pkg_properties["ANDROID_MANIFEST"], self.get_staging_path(pkg_name) + "/AndroidManifest.xml", force=True)
else: else:
debug.error("missing parameter 'ANDROID_MANIFEST' in the properties ... ") debug.error("missing parameter 'ANDROID_MANIFEST' in the properties ... ")
@ -262,16 +262,16 @@ class Target(target.Target):
# myModule.pkg_add("ANDROID_WALLPAPER_PROPERTIES", ["bool", key, title, summary, ["enable string", "disable String"]) # 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"] # myModule.pkg_add("ANDROID_WALLPAPER_PROPERTIES", ["bool", "movement", "Motion", "Apply movement to test pattern", ["Moving test pattern", "Still test pattern"]
#copy needed resources : #copy needed resources :
for res_source, res_dest in pkgProperties["ANDROID_RESOURCES"]: for res_source, res_dest in pkg_properties["ANDROID_RESOURCES"]:
if res_source == "": if res_source == "":
continue continue
tools.copy_file(res_source , self.get_staging_path(pkgName) + "/res/" + res_dest + "/" + os.path.basename(res_source), force=True) tools.copy_file(res_source , self.get_staging_path(pkg_name) + "/res/" + res_dest + "/" + os.path.basename(res_source), force=True)
# Doc : # 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/ # http://asantoso.wordpress.com/2009/09/15/how-to-build-android-application-package-apk-from-the-command-line-using-the-sdk-tools-continuously-integrated-using-cruisecontrol/
debug.print_element("pkg", "R.java", "<==", "Resources files") debug.print_element("pkg", "R.java", "<==", "Resources files")
tools.create_directory_of_file(self.get_staging_path(pkgName) + "/src/noFile") tools.create_directory_of_file(self.get_staging_path(pkg_name) + "/src/noFile")
androidToolPath = self.path_sdk + "/build-tools/" androidToolPath = self.path_sdk + "/build-tools/"
# find android tool version # find android tool version
dirnames = tools.get_list_sub_path(androidToolPath) dirnames = tools.get_list_sub_path(androidToolPath)
@ -281,48 +281,48 @@ class Target(target.Target):
# this is to create resource file for android ... (we did not use aset in jar with ewol ... # this is to create resource file for android ... (we did not use aset in jar with ewol ...
adModResoucepath = "" adModResoucepath = ""
if "ADMOD_ID" in pkgProperties: if "ADMOD_ID" in pkg_properties:
adModResoucepath = " -S " + self.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/res/ " adModResoucepath = " -S " + self.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/res/ "
cmdLine = androidToolPath + "aapt p -f " \ cmdLine = androidToolPath + "aapt p -f " \
+ "-M " + self.get_staging_path(pkgName) + "/AndroidManifest.xml " \ + "-M " + self.get_staging_path(pkg_name) + "/AndroidManifest.xml " \
+ "-F " + self.get_staging_path(pkgName) + "/resources.res " \ + "-F " + self.get_staging_path(pkg_name) + "/resources.res " \
+ "-I " + self.path_sdk + "/platforms/android-" + str(self.boardId) + "/android.jar "\ + "-I " + self.path_sdk + "/platforms/android-" + str(self.boardId) + "/android.jar "\
+ "-S " + self.get_staging_path(pkgName) + "/res/ " \ + "-S " + self.get_staging_path(pkg_name) + "/res/ " \
+ adModResoucepath \ + adModResoucepath \
+ "-J " + self.get_staging_path(pkgName) + "/src/ " + "-J " + self.get_staging_path(pkg_name) + "/src/ "
multiprocess.run_command(cmdLine) multiprocess.run_command(cmdLine)
tools.create_directory_of_file(self.get_staging_path(pkgName) + "/build/classes/noFile") tools.create_directory_of_file(self.get_staging_path(pkg_name) + "/build/classes/noFile")
debug.print_element("pkg", "*.class", "<==", "*.java") debug.print_element("pkg", "*.class", "<==", "*.java")
#generate android java files: #generate android java files:
filesString="" filesString=""
""" """
old : old :
if "ADMOD_ID" in pkgProperties: if "ADMOD_ID" in pkg_properties:
# TODO : check this I do not think it is really usefull ... ==> write for IDE only ... # TODO : check this I do not think it is really usefull ... ==> write for IDE only ...
filesString += self.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/src/android/UnusedStub.java " filesString += self.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/src/android/UnusedStub.java "
if len(pkgProperties["ANDROID_WALLPAPER_PROPERTIES"])!=0: if len(pkg_properties["ANDROID_WALLPAPER_PROPERTIES"])!=0:
filesString += self.path_javaProject + pkgNameApplicationName + "Settings.java " filesString += self.path_javaProject + pkg_name_application_name + "Settings.java "
adModJarFile = "" adModJarFile = ""
if "ADMOD_ID" in pkgProperties: if "ADMOD_ID" in pkg_properties:
adModJarFile = ":" + self.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar" adModJarFile = ":" + self.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar"
cmdLine = "javac " \ cmdLine = "javac " \
+ "-d " + self.get_staging_path(pkgName) + "/build/classes " \ + "-d " + self.get_staging_path(pkg_name) + "/build/classes " \
+ "-classpath " + self.path_sdk + "/platforms/android-" + str(self.boardId) + "/android.jar" \ + "-classpath " + self.path_sdk + "/platforms/android-" + str(self.boardId) + "/android.jar" \
+ adModJarFile + " " \ + adModJarFile + " " \
+ filesString \ + filesString \
+ self.file_finalAbstraction + " " \ + self.file_finalAbstraction + " " \
+ self.get_staging_path(pkgName) + "/src/R.java " + self.get_staging_path(pkg_name) + "/src/R.java "
multiprocess.run_command(cmdLine) multiprocess.run_command(cmdLine)
""" """
debug.verbose("heritage .so=" + str(tools.filter_extention(heritage.src, ["so"]))) debug.verbose("heritage .so=" + str(tools.filter_extention(heritage_list.src, ["so"])))
debug.verbose("heritage .jar=" + str(tools.filter_extention(heritage.src, ["jar"]))) debug.verbose("heritage .jar=" + str(tools.filter_extention(heritage_list.src, ["jar"])))
class_extern = "" class_extern = ""
upper_jar = tools.filter_extention(heritage.src, ["jar"]) upper_jar = tools.filter_extention(heritage_list.src, ["jar"])
#debug.warning("ploppppp = " + str(upper_jar)) #debug.warning("ploppppp = " + str(upper_jar))
for elem in upper_jar: for elem in upper_jar:
if len(class_extern) > 0: if len(class_extern) > 0:
@ -330,18 +330,18 @@ class Target(target.Target):
class_extern += elem class_extern += elem
# create enpoint element : # create enpoint element :
cmdLine = "javac " \ cmdLine = "javac " \
+ "-d " + self.get_staging_path(pkgName) + "/build/classes " \ + "-d " + self.get_staging_path(pkg_name) + "/build/classes " \
+ "-classpath " + class_extern + " " \ + "-classpath " + class_extern + " " \
+ self.get_staging_path(pkgName) + "/src/R.java " + self.get_staging_path(pkg_name) + "/src/R.java "
multiprocess.run_command(cmdLine) multiprocess.run_command(cmdLine)
debug.print_element("pkg", ".dex", "<==", "*.class") debug.print_element("pkg", ".dex", "<==", "*.class")
cmdLine = androidToolPath + "dx " \ cmdLine = androidToolPath + "dx " \
+ "--dex --no-strict " \ + "--dex --no-strict " \
+ "--output=" + self.get_staging_path(pkgName) + "/build/" + pkgNameApplicationName + ".dex " \ + "--output=" + self.get_staging_path(pkg_name) + "/build/" + pkg_name_application_name + ".dex " \
+ self.get_staging_path(pkgName) + "/build/classes/ " + self.get_staging_path(pkg_name) + "/build/classes/ "
if "ADMOD_ID" in pkgProperties: if "ADMOD_ID" in pkg_properties:
cmdLine += self.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar " cmdLine += self.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar "
# add element to dexification: # add element to dexification:
for elem in upper_jar: for elem in upper_jar:
@ -360,11 +360,11 @@ class Target(target.Target):
+ " -classpath " + self.path_sdk + "/tools/lib/sdklib.jar " \ + " -classpath " + self.path_sdk + "/tools/lib/sdklib.jar " \
+ builderDebug \ + builderDebug \
+ " com.android.sdklib.build.ApkBuilderMain " \ + " com.android.sdklib.build.ApkBuilderMain " \
+ self.get_staging_path(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \ + self.get_staging_path(pkg_name) + "/build/" + pkg_name_application_name + "-unalligned.apk " \
+ " -u " \ + " -u " \
+ " -z " + self.get_staging_path(pkgName) + "/resources.res " \ + " -z " + self.get_staging_path(pkg_name) + "/resources.res " \
+ " -f " + self.get_staging_path(pkgName) + "/build/" + pkgNameApplicationName + ".dex " \ + " -f " + self.get_staging_path(pkg_name) + "/build/" + pkg_name_application_name + ".dex " \
+ " -rf " + self.get_staging_path(pkgName) + "/data " + " -rf " + self.get_staging_path(pkg_name) + "/data "
multiprocess.run_command(cmdLine) multiprocess.run_command(cmdLine)
# doc : # doc :
@ -382,7 +382,7 @@ class Target(target.Target):
+ " -sigalg SHA1withRSA -digestalg SHA1 " \ + " -sigalg SHA1withRSA -digestalg SHA1 " \
+ " -storepass Pass__AndroidDebugKey " \ + " -storepass Pass__AndroidDebugKey " \
+ " -keypass PassKey__AndroidDebugKey " \ + " -keypass PassKey__AndroidDebugKey " \
+ self.get_staging_path(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \ + self.get_staging_path(pkg_name) + "/build/" + pkg_name_application_name + "-unalligned.apk " \
+ " alias__AndroidDebugKey" + " alias__AndroidDebugKey"
multiprocess.run_command(cmdLine) multiprocess.run_command(cmdLine)
tmpFile = open("tmpPass.boo", 'w') tmpFile = open("tmpPass.boo", 'w')
@ -393,52 +393,52 @@ class Target(target.Target):
print("On release mode we need the file : and key an pasword to sign the application ...") 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)") debug.print_element("pkg", ".apk(signed debug)", "<==", ".apk (not signed)")
cmdLine = "jarsigner " \ cmdLine = "jarsigner " \
+ " -keystore " + basePkgPath + "/AndroidKey.jks " \ + " -keystore " + base_pkg_path + "/AndroidKey.jks " \
+ " -sigalg SHA1withRSA -digestalg SHA1 " \ + " -sigalg SHA1withRSA -digestalg SHA1 " \
+ self.get_staging_path(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \ + self.get_staging_path(pkg_name) + "/build/" + pkg_name_application_name + "-unalligned.apk " \
+ " " + pkgNameApplicationName + " " + pkg_name_application_name
multiprocess.run_command(cmdLine) multiprocess.run_command(cmdLine)
cmdLine = "jarsigner " \ cmdLine = "jarsigner " \
+ " -verify -verbose -certs " \ + " -verify -verbose -certs " \
+ " -sigalg SHA1withRSA -digestalg SHA1 " \ + " -sigalg SHA1withRSA -digestalg SHA1 " \
+ self.get_staging_path(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " + self.get_staging_path(pkg_name) + "/build/" + pkg_name_application_name + "-unalligned.apk "
multiprocess.run_command(cmdLine) multiprocess.run_command(cmdLine)
debug.print_element("pkg", ".apk(aligned)", "<==", ".apk (not aligned)") debug.print_element("pkg", ".apk(aligned)", "<==", ".apk (not aligned)")
tools.remove_file(self.get_staging_path(pkgName) + "/" + pkgNameApplicationName + ".apk") tools.remove_file(self.get_staging_path(pkg_name) + "/" + pkg_name_application_name + ".apk")
# verbose mode : -v # verbose mode : -v
cmdLine = androidToolPath + "zipalign 4 " \ cmdLine = androidToolPath + "zipalign 4 " \
+ self.get_staging_path(pkgName) + "/build/" + pkgNameApplicationName + "-unalligned.apk " \ + self.get_staging_path(pkg_name) + "/build/" + pkg_name_application_name + "-unalligned.apk " \
+ self.get_staging_path(pkgName) + "/" + pkgNameApplicationName + ".apk " + self.get_staging_path(pkg_name) + "/" + pkg_name_application_name + ".apk "
multiprocess.run_command(cmdLine) multiprocess.run_command(cmdLine)
# copy file in the final stage : # copy file in the final stage :
tools.copy_file(self.get_staging_path(pkgName) + "/" + pkgNameApplicationName + ".apk", tools.copy_file(self.get_staging_path(pkg_name) + "/" + pkg_name_application_name + ".apk",
self.get_final_path() + "/" + pkgNameApplicationName + ".apk", self.get_final_path() + "/" + pkg_name_application_name + ".apk",
force=True) force=True)
def install_package(self, pkgName): def install_package(self, pkg_name):
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("Install package '" + pkgName + "'") debug.info("Install package '" + pkg_name + "'")
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
pkgNameApplicationName = pkgName pkg_name_application_name = pkg_name
if self.config["mode"] == "debug": if self.config["mode"] == "debug":
pkgNameApplicationName += "debug" pkg_name_application_name += "debug"
cmdLine = self.path_sdk + "/platform-tools/adb install -r " \ cmdLine = self.path_sdk + "/platform-tools/adb install -r " \
+ self.get_staging_path(pkgName) + "/" + pkgNameApplicationName + ".apk " + self.get_staging_path(pkg_name) + "/" + pkg_name_application_name + ".apk "
multiprocess.run_command(cmdLine) multiprocess.run_command(cmdLine)
def un_install_package(self, pkgName): def un_install_package(self, pkg_name):
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("Un-Install package '" + pkgName + "'") debug.info("Un-Install package '" + pkg_name + "'")
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
pkgNameApplicationName = pkgName pkg_name_application_name = pkg_name
if self.config["mode"] == "debug": if self.config["mode"] == "debug":
pkgNameApplicationName += "debug" pkg_name_application_name += "debug"
cmdLine = self.path_sdk + "/platform-tools/adb uninstall " + pkgNameApplicationName cmdLine = self.path_sdk + "/platform-tools/adb uninstall " + pkg_name_application_name
Rmultiprocess.run_command(cmdLine) Rmultiprocess.run_command(cmdLine)
def Log(self, pkgName): def Log(self, pkg_name):
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("logcat of android board") debug.info("logcat of android board")
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")

View File

@ -45,14 +45,15 @@ class Target(target.Target):
# remove unneeded ranlib ... # remove unneeded ranlib ...
self.ranlib="" self.ranlib=""
self.path_bin="" #self.path_bin=""
self.path_data="share" #self.path_data="share"
self.path_doc="doc" #self.path_doc="doc"
self.suffix_lib_static='.a' self.suffix_lib_static='.a'
self.suffix_lib_dynamic='.dylib' self.suffix_lib_dynamic='.dylib'
self.suffix_binary='' #self.suffix_binary=''
self.suffix_package='' #self.suffix_package=''
if self.sumulator == True: if self.sumulator == True:
self.sysroot = "-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.3.sdk" self.sysroot = "-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.3.sdk"
self.global_flags_ld.append("-mios-simulator-version-min=8.0") self.global_flags_ld.append("-mios-simulator-version-min=8.0")
@ -76,43 +77,43 @@ class Target(target.Target):
self.global_flags_m.append("-fobjc-arc") self.global_flags_m.append("-fobjc-arc")
#self.global_flags_m.append("-fmodules") #self.global_flags_m.append("-fmodules")
def get_staging_path(self, binaryName): def get_staging_path(self, binary_name):
return tools.get_run_path() + self.path_out + self.path_staging + "/" + binaryName + ".app/" return tools.get_run_path() + self.path_out + self.path_staging + "/" + binary_name + ".app/"
def get_staging_path_data(self, binaryName): def get_staging_path_data(self, binary_name):
return self.get_staging_path(binaryName) + self.path_data + "/" return self.get_staging_path(binary_name) + self.path_data + "/"
def make_package(self, pkgName, pkgProperties, basePkgPath): def make_package(self, pkg_name, pkg_properties, basePkgPath, heritage_list):
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("Generate package '" + pkgName + "'") debug.info("Generate package '" + pkg_name + "'")
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
if "ICON" in pkgProperties.keys() \ if "ICON" in pkg_properties.keys() \
and pkgProperties["ICON"] != "": and pkg_properties["ICON"] != "":
# Resize all icon needed for Ios ... # Resize all icon needed for Ios ...
# TODO : Do not regenerate if source resource is not availlable # TODO : Do not regenerate if source resource is not availlable
# TODO : Add a colored background ... # TODO : Add a colored background ...
debug.print_element("pkg", "iTunesArtwork.png", "<==", pkgProperties["ICON"]) debug.print_element("pkg", "iTunesArtwork.png", "<==", pkg_properties["ICON"])
image.resize(pkgProperties["ICON"], self.get_staging_path(pkgName) + "/iTunesArtwork.png", 512, 512) image.resize(pkg_properties["ICON"], self.get_staging_path(pkg_name) + "/iTunesArtwork.png", 512, 512)
debug.print_element("pkg", "iTunesArtwork@2x.png", "<==", pkgProperties["ICON"]) debug.print_element("pkg", "iTunesArtwork@2x.png", "<==", pkg_properties["ICON"])
image.resize(pkgProperties["ICON"], self.get_staging_path(pkgName) + "/iTunesArtwork@2x.png", 1024, 1024) image.resize(pkg_properties["ICON"], self.get_staging_path(pkg_name) + "/iTunesArtwork@2x.png", 1024, 1024)
debug.print_element("pkg", "Icon-60@2x.png", "<==", pkgProperties["ICON"]) debug.print_element("pkg", "Icon-60@2x.png", "<==", pkg_properties["ICON"])
image.resize(pkgProperties["ICON"], self.get_staging_path(pkgName) + "/Icon-60@2x.png", 120, 120) image.resize(pkg_properties["ICON"], self.get_staging_path(pkg_name) + "/Icon-60@2x.png", 120, 120)
debug.print_element("pkg", "Icon-76.png", "<==", pkgProperties["ICON"]) debug.print_element("pkg", "Icon-76.png", "<==", pkg_properties["ICON"])
image.resize(pkgProperties["ICON"], self.get_staging_path(pkgName) + "/Icon-76.png", 76, 76) image.resize(pkg_properties["ICON"], self.get_staging_path(pkg_name) + "/Icon-76.png", 76, 76)
debug.print_element("pkg", "Icon-76@2x.png", "<==", pkgProperties["ICON"]) debug.print_element("pkg", "Icon-76@2x.png", "<==", pkg_properties["ICON"])
image.resize(pkgProperties["ICON"], self.get_staging_path(pkgName) + "/Icon-76@2x.png", 152, 152) image.resize(pkg_properties["ICON"], self.get_staging_path(pkg_name) + "/Icon-76@2x.png", 152, 152)
debug.print_element("pkg", "Icon-Small-40.png", "<==", pkgProperties["ICON"]) debug.print_element("pkg", "Icon-Small-40.png", "<==", pkg_properties["ICON"])
image.resize(pkgProperties["ICON"], self.get_staging_path(pkgName) + "/Icon-Small-40.png", 40, 40) image.resize(pkg_properties["ICON"], self.get_staging_path(pkg_name) + "/Icon-Small-40.png", 40, 40)
debug.print_element("pkg", "Icon-Small-40@2x.png", "<==", pkgProperties["ICON"]) debug.print_element("pkg", "Icon-Small-40@2x.png", "<==", pkg_properties["ICON"])
image.resize(pkgProperties["ICON"], self.get_staging_path(pkgName) + "/Icon-Small-40@2x.png", 80, 80) image.resize(pkg_properties["ICON"], self.get_staging_path(pkg_name) + "/Icon-Small-40@2x.png", 80, 80)
debug.print_element("pkg", "Icon-Small.png", "<==", pkgProperties["ICON"]) debug.print_element("pkg", "Icon-Small.png", "<==", pkg_properties["ICON"])
image.resize(pkgProperties["ICON"], self.get_staging_path(pkgName) + "/Icon-Small.png", 29, 29) image.resize(pkg_properties["ICON"], self.get_staging_path(pkg_name) + "/Icon-Small.png", 29, 29)
debug.print_element("pkg", "Icon-Small@2x.png", "<==", pkgProperties["ICON"]) debug.print_element("pkg", "Icon-Small@2x.png", "<==", pkg_properties["ICON"])
image.resize(pkgProperties["ICON"], self.get_staging_path(pkgName) + "/Icon-Small@2x.png", 58, 58) image.resize(pkg_properties["ICON"], self.get_staging_path(pkg_name) + "/Icon-Small@2x.png", 58, 58)
debug.print_element("pkg", "PkgInfo", "<==", "APPL????") debug.print_element("pkg", "PkgInfo", "<==", "APPL????")
infoFile = self.get_staging_path(pkgName) + "/PkgInfo" infoFile = self.get_staging_path(pkg_name) + "/PkgInfo"
# Create the info file # Create the info file
tmpFile = open(infoFile, 'w') tmpFile = open(infoFile, 'w')
tmpFile.write("APPL????") tmpFile.write("APPL????")
@ -128,11 +129,11 @@ class Target(target.Target):
dataFile += " <key>CFBundleDevelopmentRegion</key>\n" dataFile += " <key>CFBundleDevelopmentRegion</key>\n"
dataFile += " <string>en</string>\n" dataFile += " <string>en</string>\n"
dataFile += " <key>CFBundleDisplayName</key>\n" dataFile += " <key>CFBundleDisplayName</key>\n"
dataFile += " <string>" + pkgProperties["NAME"] + "</string>\n" dataFile += " <string>" + pkg_properties["NAME"] + "</string>\n"
dataFile += " <key>CFBundleExecutable</key>\n" dataFile += " <key>CFBundleExecutable</key>\n"
dataFile += " <string>" + pkgName + "</string>\n" dataFile += " <string>" + pkg_name + "</string>\n"
dataFile += " <key>CFBundleIdentifier</key>\n" dataFile += " <key>CFBundleIdentifier</key>\n"
dataFile += " <string>com." + pkgProperties["COMPAGNY_NAME2"] + "." + pkgName + "</string>\n" dataFile += " <string>com." + pkg_properties["COMPAGNY_NAME2"] + "." + pkg_name + "</string>\n"
dataFile += " <key>CFBundleIconFiles</key>\n" dataFile += " <key>CFBundleIconFiles</key>\n"
dataFile += " <array>\n" dataFile += " <array>\n"
@ -150,7 +151,7 @@ class Target(target.Target):
dataFile += " <key>CFBundleInfoDictionaryVersion</key>\n" dataFile += " <key>CFBundleInfoDictionaryVersion</key>\n"
dataFile += " <string>6.0</string>\n" dataFile += " <string>6.0</string>\n"
dataFile += " <key>CFBundleName</key>\n" dataFile += " <key>CFBundleName</key>\n"
dataFile += " <string>" + pkgName + "</string>\n" dataFile += " <string>" + pkg_name + "</string>\n"
dataFile += " <key>CFBundlePackageType</key>\n" dataFile += " <key>CFBundlePackageType</key>\n"
dataFile += " <string>APPL</string>\n" dataFile += " <string>APPL</string>\n"
dataFile += " <key>CFBundleSignature</key>\n" dataFile += " <key>CFBundleSignature</key>\n"
@ -161,9 +162,9 @@ class Target(target.Target):
dataFile += " </array>\n" dataFile += " </array>\n"
dataFile += " \n" dataFile += " \n"
dataFile += " <key>CFBundleShortVersionString</key>\n" dataFile += " <key>CFBundleShortVersionString</key>\n"
dataFile += " <string>"+pkgProperties["VERSION"]+"</string>\n" dataFile += " <string>"+pkg_properties["VERSION"]+"</string>\n"
dataFile += " <key>CFBundleVersion</key>\n" dataFile += " <key>CFBundleVersion</key>\n"
dataFile += " <string>"+pkgProperties["VERSION_CODE"]+"</string>\n" dataFile += " <string>"+pkg_properties["VERSION_CODE"]+"</string>\n"
dataFile += " \n" dataFile += " \n"
dataFile += " <key>CFBundleResourceSpecification</key>\n" dataFile += " <key>CFBundleResourceSpecification</key>\n"
dataFile += " <string>ResourceRules.plist</string>\n" dataFile += " <string>ResourceRules.plist</string>\n"
@ -205,29 +206,29 @@ class Target(target.Target):
dataFile += "</plist>\n" dataFile += "</plist>\n"
dataFile += "\n\n" dataFile += "\n\n"
infoFile = self.get_staging_path(pkgName) + "/Info.plist" infoFile = self.get_staging_path(pkg_name) + "/Info.plist"
# Create the info file # Create the info file
tmpFile = open(infoFile, 'w') tmpFile = open(infoFile, 'w')
tmpFile.write(dataFile) tmpFile.write(dataFile)
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
""" """
infoFile = self.get_staging_path(pkgName) + "/" + pkgName + "-Info.plist" infoFile = self.get_staging_path(pkg_name) + "/" + pkg_name + "-Info.plist"
# Create the info file # Create the info file
tmpFile = open(infoFile, 'w') tmpFile = open(infoFile, 'w')
tmpFile.write(dataFile) tmpFile.write(dataFile)
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
cmdLine = "builtin-infoPlistUtility " cmdLine = "builtin-infoPlistUtility "
cmdLine += " " + self.get_staging_path(pkgName) + "/" + pkgName + "-Info.plist " cmdLine += " " + self.get_staging_path(pkg_name) + "/" + pkg_name + "-Info.plist "
cmdLine += " -genpkginfo " + self.get_staging_path(pkgName) + "/PkgInfo" cmdLine += " -genpkginfo " + self.get_staging_path(pkg_name) + "/PkgInfo"
cmdLine += " -expandbuildsettings " cmdLine += " -expandbuildsettings "
cmdLine += " -format binary " cmdLine += " -format binary "
if self.sumulator == False: if self.sumulator == False:
cmdLine += " -platform iphonesimulator " cmdLine += " -platform iphonesimulator "
else: else:
cmdLine += " -platform iphoneos " cmdLine += " -platform iphoneos "
cmdLine += " -o " + self.get_staging_path(pkgName) + "/" + "Info.plist" cmdLine += " -o " + self.get_staging_path(pkg_name) + "/" + "Info.plist"
multiprocess.run_command(cmdLine) multiprocess.run_command(cmdLine)
""" """
""" """
@ -273,7 +274,7 @@ class Target(target.Target):
dataFile += "</plist>\n" dataFile += "</plist>\n"
dataFile += "\n\n" dataFile += "\n\n"
infoFile = self.get_staging_path(pkgName) + "/ResourceRules.plist" infoFile = self.get_staging_path(pkg_name) + "/ResourceRules.plist"
# Create the info file # Create the info file
tmpFile = open(infoFile, 'w') tmpFile = open(infoFile, 'w')
tmpFile.write(dataFile) tmpFile.write(dataFile)
@ -291,7 +292,7 @@ class Target(target.Target):
dataFile += "</plist>\n" dataFile += "</plist>\n"
dataFile += "\n\n" dataFile += "\n\n"
infoFile = self.get_staging_path(pkgName) + "/Entitlements.plist" infoFile = self.get_staging_path(pkg_name) + "/Entitlements.plist"
# Create the info file # Create the info file
tmpFile = open(infoFile, 'w') tmpFile = open(infoFile, 'w')
tmpFile.write(dataFile) tmpFile.write(dataFile)
@ -310,21 +311,21 @@ class Target(target.Target):
if self.sumulator == False: if self.sumulator == False:
# Create the info file # Create the info file
tmpFile = open(self.get_build_path(pkgName) + "/worddown.xcent", 'w') tmpFile = open(self.get_build_path(pkg_name) + "/worddown.xcent", 'w')
tmpFile.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n") 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("<!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("<plist version=\"1.0\">\n")
tmpFile.write(" <dict>\n") tmpFile.write(" <dict>\n")
tmpFile.write(" <key>application-identifier</key>\n") tmpFile.write(" <key>application-identifier</key>\n")
try: try:
tmpFile.write(" <string>" + pkgProperties["APPLE_APPLICATION_IOS_ID"] + "." + pkgProperties["COMPAGNY_TYPE"] + "." + pkgProperties["COMPAGNY_NAME2"] + "." + pkgName + "</string>\n") tmpFile.write(" <string>" + pkg_properties["APPLE_APPLICATION_IOS_ID"] + "." + pkg_properties["COMPAGNY_TYPE"] + "." + pkg_properties["COMPAGNY_NAME2"] + "." + pkg_name + "</string>\n")
except: except:
debug.error("Missing package property : APPLE_APPLICATION_IOS_ID") debug.error("Missing package property : APPLE_APPLICATION_IOS_ID")
tmpFile.write(" <key>get-task-allow</key>\n") tmpFile.write(" <key>get-task-allow</key>\n")
tmpFile.write(" <true/>\n") tmpFile.write(" <true/>\n")
tmpFile.write(" <key>keychain-access-groups</key>\n") tmpFile.write(" <key>keychain-access-groups</key>\n")
tmpFile.write(" <array>\n") tmpFile.write(" <array>\n")
tmpFile.write(" <string>" + pkgProperties["APPLE_APPLICATION_IOS_ID"] + ".atriasoft.worddown</string>\n") tmpFile.write(" <string>" + pkg_properties["APPLE_APPLICATION_IOS_ID"] + ".atriasoft.worddown</string>\n")
tmpFile.write(" </array>\n") tmpFile.write(" </array>\n")
tmpFile.write(" </dict>\n") tmpFile.write(" </dict>\n")
tmpFile.write("</plist>\n") tmpFile.write("</plist>\n")
@ -340,8 +341,8 @@ class Target(target.Target):
cmdLine = 'codesign --force --sign ' cmdLine = 'codesign --force --sign '
# to get this key ; certtool y | grep "Developer" # to get this key ; certtool y | grep "Developer"
cmdLine += ' "' + signatureKey + '" ' cmdLine += ' "' + signatureKey + '" '
cmdLine += ' --entitlements ' + self.get_build_path(pkgName) + '/worddown.xcent' cmdLine += ' --entitlements ' + self.get_build_path(pkg_name) + '/worddown.xcent'
cmdLine += ' ' + self.get_staging_path(pkgName) cmdLine += ' ' + self.get_staging_path(pkg_name)
multiprocess.run_command(cmdLine) multiprocess.run_command(cmdLine)
# --force --sign "iPhone Developer: Edouard DUPIN (SDFGSDFGSDFG)" # --force --sign "iPhone Developer: Edouard DUPIN (SDFGSDFGSDFG)"
@ -356,9 +357,9 @@ class Target(target.Target):
out += random.choice(["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"]) out += random.choice(["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"])
return out return out
def install_package(self, pkgName): def install_package(self, pkg_name):
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("Install package '" + pkgName + "'") debug.info("Install package '" + pkg_name + "'")
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
if self.sumulator == False: if self.sumulator == False:
if tools.file_size("ewol/ios-deploy/ios-deploy") == 0: if tools.file_size("ewol/ios-deploy/ios-deploy") == 0:
@ -368,10 +369,10 @@ class Target(target.Target):
if tools.file_size("ewol/ios-deploy/ios-deploy") == 0: if tools.file_size("ewol/ios-deploy/ios-deploy") == 0:
debug.error("Can not create ios-deploy external software ...") debug.error("Can not create ios-deploy external software ...")
debug.print_element("deploy", "iphone/ipad", "<==", "aplication") debug.print_element("deploy", "iphone/ipad", "<==", "aplication")
cmdLine = './ewol/ios-deploy/ios-deploy --bundle ' + self.get_staging_path(pkgName) cmdLine = './ewol/ios-deploy/ios-deploy --bundle ' + self.get_staging_path(pkg_name)
multiprocess.run_command(cmdLine) multiprocess.run_command(cmdLine)
else: else:
simulatorIdFile = ".iosSimutatorId_" + pkgName + ".txt" simulatorIdFile = ".iosSimutatorId_" + pkg_name + ".txt"
if tools.file_size(simulatorIdFile) < 10: if tools.file_size(simulatorIdFile) < 10:
#create the file: #create the file:
tmpFile = open(simulatorIdFile, 'w') tmpFile = open(simulatorIdFile, 'w')
@ -389,31 +390,31 @@ class Target(target.Target):
simulatorId = tools.file_read_data(simulatorIdFile) simulatorId = tools.file_read_data(simulatorIdFile)
home = os.path.expanduser("~") home = os.path.expanduser("~")
destinationpathBase = home + "/Library/Application\\ Support/iPhone\\ Simulator/7.1/Applications/" + simulatorId destinationpathBase = home + "/Library/Application\\ Support/iPhone\\ Simulator/7.1/Applications/" + simulatorId
destinationpath = home + "/Library/Application Support/iPhone Simulator/7.1/Applications/" + simulatorId + "/" + pkgName + ".app" destinationpath = home + "/Library/Application Support/iPhone Simulator/7.1/Applications/" + simulatorId + "/" + pkg_name + ".app"
destinationpath2 = home + "/Library/Application\\ Support/iPhone\\ Simulator/7.1/Applications/" + simulatorId + "/" + pkgName + ".app" destinationpath2 = home + "/Library/Application\\ Support/iPhone\\ Simulator/7.1/Applications/" + simulatorId + "/" + pkg_name + ".app"
debug.info("install in simulator : " + destinationpath) debug.info("install in simulator : " + destinationpath)
tools.create_directory_of_file(destinationpath + "/plop.txt") tools.create_directory_of_file(destinationpath + "/plop.txt")
cmdLine = "cp -rf " + self.get_staging_path(pkgName) + " " + destinationpath2 cmdLine = "cp -rf " + self.get_staging_path(pkg_name) + " " + destinationpath2
multiprocess.run_command(cmdLine) multiprocess.run_command(cmdLine)
cmdLine = "touch " + destinationpathBase cmdLine = "touch " + destinationpathBase
multiprocess.run_command(cmdLine) multiprocess.run_command(cmdLine)
#sudo dpkg -i $(TARGET_OUT_FINAL)/$(PROJECT_NAME) + self.suffix_package #sudo dpkg -i $(TARGET_OUT_FINAL)/$(PROJECT_NAME) + self.suffix_package
def un_install_package(self, pkgName): def un_install_package(self, pkg_name):
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("Un-Install package '" + pkgName + "'") debug.info("Un-Install package '" + pkg_name + "'")
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
if self.sumulator == False: if self.sumulator == False:
debug.warning("not implemented") debug.warning("not implemented")
else: else:
simulatorIdFile = ".iosSimutatorId_" + pkgName + ".txt" simulatorIdFile = ".iosSimutatorId_" + pkg_name + ".txt"
if tools.file_size(simulatorIdFile) < 10: if tools.file_size(simulatorIdFile) < 10:
debug.warning("Can not get simulation O_ID : " + simulatorIdFile) debug.warning("Can not get simulation O_ID : " + simulatorIdFile)
#sudo dpkg -r $(TARGET_OUT_FINAL)/$(PROJECT_NAME) + self.suffix_package #sudo dpkg -r $(TARGET_OUT_FINAL)/$(PROJECT_NAME) + self.suffix_package
def Log(self, pkgName): def Log(self, pkg_name):
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("log of iOs board") debug.info("log of iOs board")
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
@ -425,7 +426,7 @@ class Target(target.Target):
if tools.file_size("ewol/ios-deploy/ios-deploy") == 0: if tools.file_size("ewol/ios-deploy/ios-deploy") == 0:
debug.error("Can not create ios-deploy external software ...") debug.error("Can not create ios-deploy external software ...")
debug.print_element("deploy", "iphone/ipad", "<==", "aplication") debug.print_element("deploy", "iphone/ipad", "<==", "aplication")
cmdLine = './ewol/ios-deploy/ios-deploy --debug --bundle ' + self.get_staging_path(pkgName) cmdLine = './ewol/ios-deploy/ios-deploy --debug --bundle ' + self.get_staging_path(pkg_name)
multiprocess.run_command(cmdLine) multiprocess.run_command(cmdLine)
else: else:
cmdLine = "tail -f ~/Library/Logs/iOS\ Simulator/7.1/system.log" cmdLine = "tail -f ~/Library/Logs/iOS\ Simulator/7.1/system.log"

View File

@ -36,19 +36,14 @@ class Target(target.Target):
self.global_flags_cc.append("-fpic") self.global_flags_cc.append("-fpic")
self.global_flags_cc.append("-D__STDCPP_GNU__") self.global_flags_cc.append("-D__STDCPP_GNU__")
self.pkg_path_data = "share"
self.pkg_path_bin = "bin"
self.pkg_path_lib = "lib"
self.pkg_path_license = "license"
def generate_list_separate_coma(self, list): def make_package(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, type="generic"):
result = ""
fistTime = True
for elem in list:
if fistTime == True:
fistTime = False
else:
result += ","
result += elem
return result
def make_package(self, pkg_name, pkgProperties, basePkgPath, heritage_list, type="generic"):
#The package generated depend of the type of the element: #The package generated depend of the type of the element:
end_point_module_name = heritage_list.list_heritage[-1].name end_point_module_name = heritage_list.list_heritage[-1].name
module = self.get_module(end_point_module_name) module = self.get_module(end_point_module_name)
@ -64,18 +59,18 @@ class Target(target.Target):
return return
if module.get_type() == 'BINARY' \ if module.get_type() == 'BINARY' \
or module.get_type() == 'BINARY_STAND_ALONE': or module.get_type() == 'BINARY_STAND_ALONE':
self.make_package_generic_binary(pkg_name, pkgProperties, basePkgPath, heritage_list, static = True) self.make_package_generic_binary(pkg_name, pkg_properties, base_pkg_path, heritage_list, static = True)
if module.get_type() == 'BINARY_SHARED': if module.get_type() == 'BINARY_SHARED':
self.make_package_generic_binary(pkg_name, pkgProperties, basePkgPath, heritage_list, static = False) self.make_package_generic_binary(pkg_name, pkg_properties, base_pkg_path, heritage_list, static = False)
if module.get_type() == 'PACKAGE': if module.get_type() == 'PACKAGE':
debug.info("Can not create package for package"); debug.info("Can not create package for package");
return return
return return
if type == "debian": if type == "debian":
self.make_package_debian(pkg_name, pkgProperties, basePkgPath, heritage_list) self.make_package_debian(pkg_name, pkg_properties, base_pkg_path, heritage_list)
elif type == "generic": elif type == "generic":
self.make_package_generic(pkg_name, pkgProperties, basePkgPath, heritage_list) self.make_package_generic(pkg_name, pkg_properties, base_pkg_path, heritage_list)
""" """
@ -108,11 +103,9 @@ class Target(target.Target):
* *--> YY * *--> YY
*--> sources *--> sources
""" """
def make_package_generic_binary(self, pkg_name, pkgProperties, basePkgPath, heritage_list, static): def make_package_generic_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static):
debianpkg_name = re.sub("_", "-", pkg_name)
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("Generate generic '" + debianpkg_name + "' v"+pkgProperties["VERSION"]) debug.info("Generate generic '" + pkg_name + "' v"+pkg_properties["VERSION"])
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
#output path #output path
target_outpath = os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app") target_outpath = os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app")
@ -120,9 +113,9 @@ class Target(target.Target):
## Create share datas ## Create share datas
if static == True: if static == True:
target_outpath_data = os.path.join(target_outpath, "share", pkg_name) target_outpath_data = os.path.join(target_outpath, self.pkg_path_data, pkg_name)
else: else:
target_outpath_data = os.path.join(target_outpath, "share") target_outpath_data = os.path.join(target_outpath, self.pkg_path_data)
tools.create_directory_of_file(target_outpath_data) tools.create_directory_of_file(target_outpath_data)
debug.debug("heritage for " + str(pkg_name) + ":") debug.debug("heritage for " + str(pkg_name) + ":")
for heritage in heritage_list.list_heritage: for heritage in heritage_list.list_heritage:
@ -139,8 +132,8 @@ class Target(target.Target):
#copy all data: #copy all data:
tools.copy_anything(os.path.dirname(path_src), target_outpath_data, recursive=True, force_identical=True) tools.copy_anything(os.path.dirname(path_src), target_outpath_data, recursive=True, force_identical=True)
## Create share datas ## copy binary files
target_outpath_bin = os.path.join(target_outpath, "bin") target_outpath_bin = os.path.join(target_outpath, self.pkg_path_bin)
tools.create_directory_of_file(target_outpath_bin) tools.create_directory_of_file(target_outpath_bin)
path_src = self.get_build_file_bin(pkg_name) path_src = self.get_build_file_bin(pkg_name)
path_dst = os.path.join(target_outpath_bin, pkg_name + self.suffix_binary) path_dst = os.path.join(target_outpath_bin, pkg_name + self.suffix_binary)
@ -150,7 +143,7 @@ class Target(target.Target):
## Create libraries ## Create libraries
if static == False: if static == False:
#copy all shred libs... #copy all shred libs...
target_outpath_lib = os.path.join(target_outpath, "lib") target_outpath_lib = os.path.join(target_outpath, self.pkg_path_lib)
tools.create_directory_of_file(target_outpath_lib) tools.create_directory_of_file(target_outpath_lib)
debug.verbose("libs for " + str(pkg_name) + ":") debug.verbose("libs for " + str(pkg_name) + ":")
for heritage in heritage_list.list_heritage: for heritage in heritage_list.list_heritage:
@ -165,36 +158,36 @@ class Target(target.Target):
## Create version file ## Create version file
tmpFile = open(target_outpath + "/version.txt", 'w') tmpFile = open(target_outpath + "/version.txt", 'w')
tmpFile.write(pkgProperties["VERSION"]) tmpFile.write(pkg_properties["VERSION"])
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
## Create maintainer file ## Create maintainer file
tmpFile = open(target_outpath + "/maintainer.txt", 'w') tmpFile = open(target_outpath + "/maintainer.txt", 'w')
tmpFile.write(self.generate_list_separate_coma(pkgProperties["MAINTAINER"])) tmpFile.write(self.generate_list_separate_coma(pkg_properties["MAINTAINER"]))
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
## Create appl_name file ## Create appl_name file
tmpFile = open(target_outpath + "/appl_name.txt", 'w') tmpFile = open(target_outpath + "/appl_name.txt", 'w')
tmpFile.write("en_EN:" + pkgProperties["NAME"]) tmpFile.write("en_EN:" + pkg_properties["NAME"])
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
## Create appl_description file ## Create appl_description file
tmpFile = open(target_outpath + "/appl_description.txt", 'w') tmpFile = open(target_outpath + "/appl_description.txt", 'w')
tmpFile.write("en_EN:" + pkgProperties["DESCRIPTION"]) tmpFile.write("en_EN:" + pkg_properties["DESCRIPTION"])
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
## Create Readme file ## Create Readme file
readmeFileDest = target_outpath + "/readme.txt" readmeFileDest = target_outpath + "/readme.txt"
if os.path.exists(basePkgPath + "/os-Linux/README")==True: if os.path.exists(base_pkg_path + "/os-Linux/README")==True:
tools.copy_file(basePkgPath + "/os-Linux/README", readmeFileDest) tools.copy_file(base_pkg_path + "/os-Linux/README", readmeFileDest)
elif os.path.exists(basePkgPath + "/README")==True: elif os.path.exists(base_pkg_path + "/README")==True:
tools.copy_file(basePkgPath + "/README", readmeFileDest) tools.copy_file(base_pkg_path + "/README", readmeFileDest)
elif os.path.exists(basePkgPath + "/README.md")==True: elif os.path.exists(base_pkg_path + "/README.md")==True:
tools.copy_file(basePkgPath + "/README.md", readmeFileDest) tools.copy_file(base_pkg_path + "/README.md", readmeFileDest)
else: else:
debug.info("no file 'README', 'README.md' or 'os-Linux/README' ==> generate an empty one") debug.info("no file 'README', 'README.md' or 'os-Linux/README' ==> generate an empty one")
tmpFile = open(readmeFileDest, 'w') tmpFile = open(readmeFileDest, 'w')
@ -203,10 +196,10 @@ class Target(target.Target):
tmpFile.close() tmpFile.close()
## Create licence file ## Create licence file
licenseFileDest = target_outpath + "/license/"+ debianpkg_name + ".txt" licenseFileDest = os.path.join(target_outpath, self.pkg_path_license, pkg_name + ".txt")
tools.create_directory_of_file(licenseFileDest) tools.create_directory_of_file(licenseFileDest)
if os.path.exists(basePkgPath + "/license.txt")==True: if os.path.exists(base_pkg_path + "/license.txt")==True:
tools.copy_file(basePkgPath + "/license.txt", licenseFileDest) tools.copy_file(base_pkg_path + "/license.txt", licenseFileDest)
else: else:
debug.info("no file 'license.txt' ==> generate an empty one") debug.info("no file 'license.txt' ==> generate an empty one")
tmpFile = open(licenseFileDest, 'w') tmpFile = open(licenseFileDest, 'w')
@ -216,8 +209,8 @@ class Target(target.Target):
## Create changeLog file ## Create changeLog file
changeLogFileDest = target_outpath + "/changelog.txt" changeLogFileDest = target_outpath + "/changelog.txt"
if os.path.exists(basePkgPath + "/changelog") == True: if os.path.exists(base_pkg_path + "/changelog") == True:
tools.copy_file(basePkgPath + "/changelog", changeLogFileDest) tools.copy_file(base_pkg_path + "/changelog", changeLogFileDest)
else: else:
debug.info("no file 'changelog' ==> generate an empty one") debug.info("no file 'changelog' ==> generate an empty one")
tmpFile = open(changeLogFileDest, 'w') tmpFile = open(changeLogFileDest, 'w')
@ -225,30 +218,20 @@ class Target(target.Target):
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
## copy share path
#debug.info("plop:" + self.get_staging_path(pkg_name) + self.path_data)
if os.path.exists(self.get_staging_path(pkg_name) + self.path_data) == True:
tools.copy_anything(self.get_staging_path(pkg_name) + self.path_data + "/*", target_outpath + self.path_data, recursive=True)
## Create binary path:
bin_path = target_outpath + self.path_bin
#tools.create_directory_of_file(bin_path)
tools.copy_anything(self.get_staging_path(pkg_name) + self.path_bin + "/*",
bin_path)
## create the package: ## create the package:
debug.debug("package : " + self.get_staging_path(pkg_name) + "/" + debianpkg_name + ".app.pkg") debug.debug("package : " + self.get_staging_path(pkg_name) + "/" + pkg_name + ".app.pkg")
os.system("cd " + self.get_staging_path(pkg_name) + " ; tar -czf " + pkg_name + ".app.tar.gz " + pkg_name + ".app") os.system("cd " + self.get_staging_path(pkg_name) + " ; tar -czf " + pkg_name + ".app.tar.gz " + pkg_name + ".app")
#multiprocess.run_command("cd " + self.get_staging_path(pkg_name) + " ; tar -czf " + pkg_name + ".app.tar.gz " + pkg_name + ".app") #multiprocess.run_command("cd " + self.get_staging_path(pkg_name) + " ; tar -czf " + pkg_name + ".app.tar.gz " + pkg_name + ".app")
tools.create_directory_of_file(self.get_final_path()) tools.create_directory_of_file(self.get_final_path())
tools.copy_file(self.get_staging_path(pkg_name) + "/" + pkg_name + ".app.tar.gz", self.get_final_path() + "/" + pkg_name + ".app.gpkg") tools.copy_file(self.get_staging_path(pkg_name) + "/" + pkg_name + ".app.tar.gz", self.get_final_path() + "/" + pkg_name + ".app.gpkg")
def make_package_debian(self, pkg_name, pkgProperties, basePkgPath, heritage_list): def make_package_debian(self, pkg_name, pkg_properties, base_pkg_path, heritage_list):
# http://alp.developpez.com/tutoriels/debian/creer-paquet/ # http://alp.developpez.com/tutoriels/debian/creer-paquet/
debianpkg_name = re.sub("_", "-", pkg_name) debianpkg_name = re.sub("_", "-", pkg_name)
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("Generate package '" + debianpkg_name + "' v"+pkgProperties["VERSION"]) debug.info("Generate package '" + debianpkg_name + "' v"+pkg_properties["VERSION"])
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
self.get_staging_path(pkg_name) self.get_staging_path(pkg_name)
target_outpathDebian = self.get_staging_path(pkg_name) + "/DEBIAN/" target_outpathDebian = self.get_staging_path(pkg_name) + "/DEBIAN/"
@ -261,13 +244,13 @@ class Target(target.Target):
tools.create_directory_of_file(finalFileControl) tools.create_directory_of_file(finalFileControl)
tmpFile = open(finalFileControl, 'w') tmpFile = open(finalFileControl, 'w')
tmpFile.write("Package: " + debianpkg_name + "\n") tmpFile.write("Package: " + debianpkg_name + "\n")
tmpFile.write("Version: " + pkgProperties["VERSION"] + "\n") tmpFile.write("Version: " + pkg_properties["VERSION"] + "\n")
tmpFile.write("Section: " + self.generate_list_separate_coma(pkgProperties["SECTION"]) + "\n") tmpFile.write("Section: " + self.generate_list_separate_coma(pkg_properties["SECTION"]) + "\n")
tmpFile.write("Priority: " + pkgProperties["PRIORITY"] + "\n") tmpFile.write("Priority: " + pkg_properties["PRIORITY"] + "\n")
tmpFile.write("Architecture: all\n") tmpFile.write("Architecture: all\n")
tmpFile.write("Depends: bash\n") tmpFile.write("Depends: bash\n")
tmpFile.write("Maintainer: " + self.generate_list_separate_coma(pkgProperties["MAINTAINER"]) + "\n") tmpFile.write("Maintainer: " + self.generate_list_separate_coma(pkg_properties["MAINTAINER"]) + "\n")
tmpFile.write("Description: " + pkgProperties["DESCRIPTION"] + "\n") tmpFile.write("Description: " + pkg_properties["DESCRIPTION"] + "\n")
tmpFile.write("\n") tmpFile.write("\n")
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
@ -286,12 +269,12 @@ class Target(target.Target):
## Readme donumentation ## Readme donumentation
readmeFileDest = self.get_staging_path(pkg_name) + "/usr/share/doc/"+ debianpkg_name + "/README" readmeFileDest = self.get_staging_path(pkg_name) + "/usr/share/doc/"+ debianpkg_name + "/README"
tools.create_directory_of_file(readmeFileDest) tools.create_directory_of_file(readmeFileDest)
if os.path.exists(basePkgPath + "/os-Linux/README")==True: if os.path.exists(base_pkg_path + "/os-Linux/README")==True:
tools.copy_file(basePkgPath + "/os-Linux/README", readmeFileDest) tools.copy_file(base_pkg_path + "/os-Linux/README", readmeFileDest)
elif os.path.exists(basePkgPath + "/README")==True: elif os.path.exists(base_pkg_path + "/README")==True:
tools.copy_file(basePkgPath + "/README", readmeFileDest) tools.copy_file(base_pkg_path + "/README", readmeFileDest)
elif os.path.exists(basePkgPath + "/README.md")==True: elif os.path.exists(base_pkg_path + "/README.md")==True:
tools.copy_file(basePkgPath + "/README.md", readmeFileDest) tools.copy_file(base_pkg_path + "/README.md", readmeFileDest)
else: else:
debug.info("no file 'README', 'README.md' or 'os-Linux/README' ==> generate an empty one") debug.info("no file 'README', 'README.md' or 'os-Linux/README' ==> generate an empty one")
tmpFile = open(readmeFileDest, 'w') tmpFile = open(readmeFileDest, 'w')
@ -301,8 +284,8 @@ class Target(target.Target):
## licence file ## licence file
licenseFileDest = self.get_staging_path(pkg_name) + "/usr/share/doc/"+ debianpkg_name + "/copyright" licenseFileDest = self.get_staging_path(pkg_name) + "/usr/share/doc/"+ debianpkg_name + "/copyright"
tools.create_directory_of_file(licenseFileDest) tools.create_directory_of_file(licenseFileDest)
if os.path.exists(basePkgPath + "/license.txt")==True: if os.path.exists(base_pkg_path + "/license.txt")==True:
tools.copy_file(basePkgPath + "/license.txt", licenseFileDest) tools.copy_file(base_pkg_path + "/license.txt", licenseFileDest)
else: else:
debug.info("no file 'license.txt' ==> generate an empty one") debug.info("no file 'license.txt' ==> generate an empty one")
tmpFile = open(licenseFileDest, 'w') tmpFile = open(licenseFileDest, 'w')
@ -312,8 +295,8 @@ class Target(target.Target):
##changeLog file ##changeLog file
changeLogFileDest = self.get_staging_path(pkg_name) + "/usr/share/doc/"+ debianpkg_name + "/changelog" changeLogFileDest = self.get_staging_path(pkg_name) + "/usr/share/doc/"+ debianpkg_name + "/changelog"
tools.create_directory_of_file(changeLogFileDest) tools.create_directory_of_file(changeLogFileDest)
if os.path.exists(basePkgPath + "/changelog")==True: if os.path.exists(base_pkg_path + "/changelog")==True:
tools.copy_file(basePkgPath + "/changelog", changeLogFileDest) tools.copy_file(base_pkg_path + "/changelog", changeLogFileDest)
else: else:
debug.info("no file 'changelog' ==> generate an empty one") debug.info("no file 'changelog' ==> generate an empty one")
tmpFile = open(changeLogFileDest, 'w') tmpFile = open(changeLogFileDest, 'w')
@ -368,44 +351,44 @@ class Target(target.Target):
* *--> YY * *--> YY
*--> sources *--> sources
""" """
def make_package_generic(self, pkg_name, pkgProperties, basePkgPath, heritage_list): def make_package_generic(self, pkg_name, pkg_properties, base_pkg_path, heritage_list):
debug.warning("heritage for " + str(pkg_name) + ":") debug.warning("heritage for " + str(pkg_name) + ":")
for heritage in heritage_list.list_heritage: for heritage in heritage_list.list_heritage:
debug.warning("heritage .... " + str(heritage.name) + " : " + str(heritage.depends)) debug.warning("heritage .... " + str(heritage.name) + " : " + str(heritage.depends))
debianpkg_name = re.sub("_", "-", pkg_name) debianpkg_name = re.sub("_", "-", pkg_name)
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("Generate generic '" + debianpkg_name + "' v"+pkgProperties["VERSION"]) debug.info("Generate generic '" + debianpkg_name + "' v"+pkg_properties["VERSION"])
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
target_outpath = self.get_staging_path(pkg_name) + "/edn.app/" target_outpath = self.get_staging_path(pkg_name) + "/edn.app/"
tools.create_directory_of_file(target_outpath) tools.create_directory_of_file(target_outpath)
## Create version file ## Create version file
tmpFile = open(target_outpath + "/version.txt", 'w') tmpFile = open(target_outpath + "/version.txt", 'w')
tmpFile.write(pkgProperties["VERSION"]) tmpFile.write(pkg_properties["VERSION"])
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
## Create maintainer file ## Create maintainer file
tmpFile = open(target_outpath + "/maintainer.txt", 'w') tmpFile = open(target_outpath + "/maintainer.txt", 'w')
tmpFile.write(self.generate_list_separate_coma(pkgProperties["MAINTAINER"])) tmpFile.write(self.generate_list_separate_coma(pkg_properties["MAINTAINER"]))
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
## Create appl_name file ## Create appl_name file
tmpFile = open(target_outpath + "/appl_name.txt", 'w') tmpFile = open(target_outpath + "/appl_name.txt", 'w')
tmpFile.write("en_EN:" + pkgProperties["NAME"]) tmpFile.write("en_EN:" + pkg_properties["NAME"])
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
## Create appl_description file ## Create appl_description file
tmpFile = open(target_outpath + "/appl_description.txt", 'w') tmpFile = open(target_outpath + "/appl_description.txt", 'w')
tmpFile.write("en_EN:" + pkgProperties["DESCRIPTION"]) tmpFile.write("en_EN:" + pkg_properties["DESCRIPTION"])
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
## Create Readme file ## Create Readme file
readmeFileDest = target_outpath + "/readme.txt" readmeFileDest = target_outpath + "/readme.txt"
if os.path.exists(basePkgPath + "/os-Linux/README")==True: if os.path.exists(base_pkg_path + "/os-Linux/README")==True:
tools.copy_file(basePkgPath + "/os-Linux/README", readmeFileDest) tools.copy_file(base_pkg_path + "/os-Linux/README", readmeFileDest)
elif os.path.exists(basePkgPath + "/README")==True: elif os.path.exists(base_pkg_path + "/README")==True:
tools.copy_file(basePkgPath + "/README", readmeFileDest) tools.copy_file(base_pkg_path + "/README", readmeFileDest)
elif os.path.exists(basePkgPath + "/README.md")==True: elif os.path.exists(base_pkg_path + "/README.md")==True:
tools.copy_file(basePkgPath + "/README.md", readmeFileDest) tools.copy_file(base_pkg_path + "/README.md", readmeFileDest)
else: else:
debug.info("no file 'README', 'README.md' or 'os-Linux/README' ==> generate an empty one") debug.info("no file 'README', 'README.md' or 'os-Linux/README' ==> generate an empty one")
tmpFile = open(readmeFileDest, 'w') tmpFile = open(readmeFileDest, 'w')
@ -415,8 +398,8 @@ class Target(target.Target):
## Create licence file ## Create licence file
licenseFileDest = target_outpath + "/license/"+ debianpkg_name + ".txt" licenseFileDest = target_outpath + "/license/"+ debianpkg_name + ".txt"
tools.create_directory_of_file(licenseFileDest) tools.create_directory_of_file(licenseFileDest)
if os.path.exists(basePkgPath + "/license.txt")==True: if os.path.exists(base_pkg_path + "/license.txt")==True:
tools.copy_file(basePkgPath + "/license.txt", licenseFileDest) tools.copy_file(base_pkg_path + "/license.txt", licenseFileDest)
else: else:
debug.info("no file 'license.txt' ==> generate an empty one") debug.info("no file 'license.txt' ==> generate an empty one")
tmpFile = open(licenseFileDest, 'w') tmpFile = open(licenseFileDest, 'w')
@ -425,8 +408,8 @@ class Target(target.Target):
tmpFile.close() tmpFile.close()
## Create changeLog file ## Create changeLog file
changeLogFileDest = target_outpath + "/changelog.txt" changeLogFileDest = target_outpath + "/changelog.txt"
if os.path.exists(basePkgPath + "/changelog") == True: if os.path.exists(base_pkg_path + "/changelog") == True:
tools.copy_file(basePkgPath + "/changelog", changeLogFileDest) tools.copy_file(base_pkg_path + "/changelog", changeLogFileDest)
else: else:
debug.info("no file 'changelog' ==> generate an empty one") debug.info("no file 'changelog' ==> generate an empty one")
tmpFile = open(changeLogFileDest, 'w') tmpFile = open(changeLogFileDest, 'w')

View File

@ -28,36 +28,36 @@ class Target(target.Target):
# http://devs.openttd.org/~truebrain/compile-farm/apple-darwin9.txt # http://devs.openttd.org/~truebrain/compile-farm/apple-darwin9.txt
target.Target.__init__(self, "MacOs", config, "") target.Target.__init__(self, "MacOs", config, "")
self.path_bin="MacOS" #self.path_bin="MacOS"
self.path_lib="lib" #self.path_lib="lib"
self.path_data="Resources" #self.path_data="Resources"
self.path_doc="doc" #self.path_doc="doc"
self.suffix_lib_static='.a' self.suffix_lib_static='.a'
self.suffix_lib_dynamic='.dylib' self.suffix_lib_dynamic='.dylib'
self.suffix_binary='' #self.suffix_binary=''
self.suffix_package='' #self.suffix_package=''
self.global_flags_cc.append("-D__STDCPP_LLVM__") self.global_flags_cc.append("-D__STDCPP_LLVM__")
def get_staging_path(self, binaryName): def get_staging_path(self, binary_name):
return tools.get_run_path() + self.path_out + self.path_staging + "/" + binaryName + ".app/Contents/" return tools.get_run_path() + self.path_out + self.path_staging + "/" + binary_name + ".app/Contents/"
def get_staging_path_data(self, binaryName): def get_staging_path_data(self, binary_name):
return self.get_staging_path(binaryName) + self.path_data + "/" return self.get_staging_path(binary_name) + self.path_data + "/"
def make_package(self, pkgName, pkgProperties, basePkgPath): def make_package(self, pkg_name, pkg_properties, base_pkg_path, heritage_list):
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("Generate package '" + pkgName + "'") debug.info("Generate package '" + pkg_name + "'")
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
if "ICON" in pkgProperties.keys() \ if "ICON" in pkg_properties.keys() \
and pkgProperties["ICON"] != "": and pkg_properties["ICON"] != "":
tools.copy_file(pkgProperties["ICON"], self.get_staging_path_data(pkgName) + "/icon.icns", force=True) tools.copy_file(pkg_properties["ICON"], self.get_staging_path_data(pkg_name) + "/icon.icns", force=True)
# http://www.sandroid.org/imcross/#Deployment # http://www.sandroid.org/imcross/#Deployment
infoFile=self.get_staging_path(pkgName) + "/Info.plist" infoFile=self.get_staging_path(pkg_name) + "/Info.plist"
# Create the info file # Create the info file
tmpFile = open(infoFile, 'w') tmpFile = open(infoFile, 'w')
tmpFile.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n") tmpFile.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
@ -65,11 +65,11 @@ class Target(target.Target):
tmpFile.write("<plist version=\"1.0\">\n") tmpFile.write("<plist version=\"1.0\">\n")
tmpFile.write(" <dict>\n") tmpFile.write(" <dict>\n")
tmpFile.write(" <key>CFBundleExecutableFile</key>\n") tmpFile.write(" <key>CFBundleExecutableFile</key>\n")
tmpFile.write(" <string>"+pkgName+"</string>\n") tmpFile.write(" <string>"+pkg_name+"</string>\n")
tmpFile.write(" <key>CFBundleName</key>\n") tmpFile.write(" <key>CFBundleName</key>\n")
tmpFile.write(" <string>"+pkgName+"</string>\n") tmpFile.write(" <string>"+pkg_name+"</string>\n")
tmpFile.write(" <key>CFBundleIdentifier</key>\n") tmpFile.write(" <key>CFBundleIdentifier</key>\n")
tmpFile.write(" <string>" + pkgProperties["COMPAGNY_TYPE"] + "." + pkgProperties["COMPAGNY_NAME2"] + "." + pkgName + "</string>\n") tmpFile.write(" <string>" + pkg_properties["COMPAGNY_TYPE"] + "." + pkg_properties["COMPAGNY_NAME2"] + "." + pkg_name + "</string>\n")
tmpFile.write(" <key>CFBundleSignature</key>\n") tmpFile.write(" <key>CFBundleSignature</key>\n")
tmpFile.write(" <string>????</string>\n") tmpFile.write(" <string>????</string>\n")
tmpFile.write(" <key>CFBundleIconFile</key>\n") tmpFile.write(" <key>CFBundleIconFile</key>\n")
@ -79,7 +79,7 @@ class Target(target.Target):
tmpFile.write("\n\n") tmpFile.write("\n\n")
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
infoFile=self.get_staging_path(pkgName) + "/PkgInfo" infoFile=self.get_staging_path(pkg_name) + "/PkgInfo"
# Create the info file # Create the info file
tmpFile = open(infoFile, 'w') tmpFile = open(infoFile, 'w')
tmpFile.write("APPL????") tmpFile.write("APPL????")
@ -87,24 +87,24 @@ class Target(target.Target):
tmpFile.close() tmpFile.close()
# Create a simple interface to localy install the aplication for the shell (a shell command line interface) # Create a simple interface to localy install the aplication for the shell (a shell command line interface)
shell_file_name=self.get_staging_path(pkgName) + "/shell/" + pkgName shell_file_name=self.get_staging_path(pkg_name) + "/shell/" + pkg_name
# Create the info file # Create the info file
tools.create_directory_of_file(shell_file_name) tools.create_directory_of_file(shell_file_name)
tmpFile = open(shell_file_name, 'w') tmpFile = open(shell_file_name, 'w')
tmpFile.write("#!/bin/bash\n") tmpFile.write("#!/bin/bash\n")
tmpFile.write("# Simply open the real application in the correct way (a link does not work ...)\n") tmpFile.write("# Simply open the real application in the correct way (a link does not work ...)\n")
tmpFile.write("/Applications/" + pkgName + ".app/Contents/MacOS/" + pkgName + " $*\n") tmpFile.write("/Applications/" + pkg_name + ".app/Contents/MacOS/" + pkg_name + " $*\n")
#tmpFile.write("open -n /Applications/edn.app --args -AppCommandLineArg $*\n") #tmpFile.write("open -n /Applications/edn.app --args -AppCommandLineArg $*\n")
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
# Must create the disk image of the application # Must create the disk image of the application
debug.info("Generate disk image for '" + pkgName + "'") debug.info("Generate disk image for '" + pkg_name + "'")
output_file_name = self.get_final_path() + "/" + pkgName + ".dmg" output_file_name = self.get_final_path() + "/" + pkg_name + ".dmg"
cmd = "hdiutil create -volname " cmd = "hdiutil create -volname "
cmd += pkgName + " -srcpath " cmd += pkg_name + " -srcpath "
cmd += tools.get_run_path() + self.path_out + self.path_staging + "/" + pkgName + ".app" cmd += tools.get_run_path() + self.path_out + self.path_staging + "/" + pkg_name + ".app"
cmd += " -ov -format UDZO " cmd += " -ov -format UDZO "
cmd += output_file_name cmd += output_file_name
tools.create_directory_of_file(output_file_name) tools.create_directory_of_file(output_file_name)
@ -114,24 +114,24 @@ class Target(target.Target):
debug.info("You can have an shell interface by executing : ") debug.info("You can have an shell interface by executing : ")
debug.info(" sudo cp " + shell_file_name + " /usr/local/bin") debug.info(" sudo cp " + shell_file_name + " /usr/local/bin")
def install_package(self, pkgName): def install_package(self, pkg_name):
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("Install package '" + pkgName + "'") debug.info("Install package '" + pkg_name + "'")
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("copy " + tools.get_run_path() + self.path_out + self.path_staging + "/" + pkgName + ".app in /Applications/") debug.info("copy " + tools.get_run_path() + self.path_out + self.path_staging + "/" + pkg_name + ".app in /Applications/")
if os.path.exists("/Applications/" + pkgName + ".app") == True: if os.path.exists("/Applications/" + pkg_name + ".app") == True:
shutil.rmtree("/Applications/" + pkgName + ".app") shutil.rmtree("/Applications/" + pkg_name + ".app")
# copy the application in the basic application path : /Applications/xxx.app # copy the application in the basic application path : /Applications/xxx.app
shutil.copytree(tools.get_run_path() + self.path_out + self.path_staging + "/" + pkgName + ".app", "/Applications/" + pkgName + ".app") shutil.copytree(tools.get_run_path() + self.path_out + self.path_staging + "/" + pkg_name + ".app", "/Applications/" + pkg_name + ".app")
def un_install_package(self, pkgName): def un_install_package(self, pkg_name):
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("Un-Install package '" + pkgName + "'") debug.info("Un-Install package '" + pkg_name + "'")
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("remove OLD application /Applications/" + pkgName + ".app") debug.info("remove OLD application /Applications/" + pkg_name + ".app")
# Remove the application in the basic application path : /Applications/xxx.app # Remove the application in the basic application path : /Applications/xxx.app
if os.path.exists("/Applications/" + pkgName + ".app") == True: if os.path.exists("/Applications/" + pkg_name + ".app") == True:
shutil.rmtree("/Applications/" + pkgName + ".app") shutil.rmtree("/Applications/" + pkg_name + ".app")

View File

@ -50,38 +50,168 @@ class Target(target.Target):
"-static-libstdc++", "-static-libstdc++",
"-static"]) "-static"])
self.path_bin="" #self.path_bin=""
self.path_lib="lib" #self.path_lib="lib"
self.path_data="data" #self.path_data="data"
self.path_doc="doc" #self.path_doc="doc"
self.pkg_path_data = "data"
self.pkg_path_bin = ""
self.pkg_path_lib = "lib"
self.pkg_path_license = "license"
self.suffix_lib_static='.a' self.suffix_lib_static='.a'
self.suffix_lib_dynamic='.dll' self.suffix_lib_dynamic='.dll'
self.suffix_binary='.exe' self.suffix_binary='.exe'
self.suffix_package='' #self.suffix_package=''
self.global_flags_cc.append("-D__STDCPP_GNU__") self.global_flags_cc.append("-D__STDCPP_GNU__")
def get_staging_path_data(self, binaryName): def get_staging_path_data(self, binary_name, heritage_list):
return self.get_staging_path(binaryName) + self.path_data return self.get_staging_path(binary_name) + self.path_data
def make_package(self, pkgName, pkgProperties, basePkgPath): def make_package(self, pkg_name, pkg_properties, base_pkg_path, heritage_list):
#The package generated depend of the type of the element:
end_point_module_name = heritage_list.list_heritage[-1].name
module = self.get_module(end_point_module_name)
if module == None:
debug.error("can not create package ... ");
if module.get_type() == 'PREBUILD':
#nothing to do ...
return
if module.get_type() == 'LIBRARY' \
or module.get_type() == 'LIBRARY_DYNAMIC' \
or module.get_type() == 'LIBRARY_STATIC':
debug.info("Can not create package for library");
return
if module.get_type() == 'BINARY' \
or module.get_type() == 'BINARY_STAND_ALONE':
self.make_package_generic_binary(pkg_name, pkg_properties, base_pkg_path, heritage_list, static = True)
if module.get_type() == 'BINARY_SHARED':
self.make_package_generic_binary(pkg_name, pkg_properties, base_pkg_path, heritage_list, static = False)
if module.get_type() == 'PACKAGE':
debug.info("Can not create package for package");
return
return
def make_package_generic_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static):
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("Generate package '" + pkgName + "'") debug.info("Generate package '" + pkg_name + "'")
debug.debug("------------------------------------------------------------------------")
#output path
target_outpath = os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app")
tools.create_directory_of_file(target_outpath)
## Create share datas
if static == True:
target_outpath_data = os.path.join(target_outpath, self.pkg_path_data, pkg_name)
else:
target_outpath_data = os.path.join(target_outpath, self.pkg_path_data)
tools.create_directory_of_file(target_outpath_data)
debug.debug("heritage for " + str(pkg_name) + ":")
for heritage in heritage_list.list_heritage:
debug.debug("sub elements: " + str(heritage.name))
path_src = self.get_build_path_data(heritage.name)
debug.verbose(" has directory: " + path_src)
if os.path.isdir(path_src):
if static == True:
debug.debug(" need copy: " + path_src + " to " + target_outpath_data)
#copy all data:
tools.copy_anything(path_src, target_outpath_data, recursive=True, force_identical=True)
else:
debug.debug(" need copy: " + os.path.dirname(path_src) + " to " + target_outpath_data)
#copy all data:
tools.copy_anything(os.path.dirname(path_src), target_outpath_data, recursive=True, force_identical=True)
## copy binary files
target_outpath_bin = os.path.join(target_outpath, self.pkg_path_bin)
tools.create_directory_of_file(target_outpath_bin)
path_src = self.get_build_file_bin(pkg_name)
path_dst = os.path.join(target_outpath_bin, pkg_name + self.suffix_binary)
debug.verbose("path_dst: " + str(path_dst))
tools.copy_file(path_src, path_dst)
## Create version file
tmpFile = open(target_outpath + "/version.txt", 'w')
tmpFile.write(pkg_properties["VERSION"])
tmpFile.flush()
tmpFile.close()
## Create maintainer file
tmpFile = open(target_outpath + "/maintainer.txt", 'w')
tmpFile.write(self.generate_list_separate_coma(pkg_properties["MAINTAINER"]))
tmpFile.flush()
tmpFile.close()
## Create appl_name file
tmpFile = open(target_outpath + "/appl_name.txt", 'w')
tmpFile.write("en_EN:" + pkg_properties["NAME"])
tmpFile.flush()
tmpFile.close()
## Create appl_description file
tmpFile = open(target_outpath + "/appl_description.txt", 'w')
tmpFile.write("en_EN:" + pkg_properties["DESCRIPTION"])
tmpFile.flush()
tmpFile.close()
## Create Readme file
readmeFileDest = target_outpath + "/readme.txt"
if os.path.exists(base_pkg_path + "/os-Linux/README")==True:
tools.copy_file(base_pkg_path + "/os-Linux/README", readmeFileDest)
elif os.path.exists(base_pkg_path + "/README")==True:
tools.copy_file(base_pkg_path + "/README", readmeFileDest)
elif os.path.exists(base_pkg_path + "/README.md")==True:
tools.copy_file(base_pkg_path + "/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 " + pkg_name + "\n")
tmpFile.flush()
tmpFile.close()
## Create licence file
licenseFileDest = os.path.join(target_outpath, self.pkg_path_license, pkg_name + ".txt")
tools.create_directory_of_file(licenseFileDest)
if os.path.exists(base_pkg_path + "/license.txt")==True:
tools.copy_file(base_pkg_path + "/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 " + pkg_name + "\n")
tmpFile.flush()
tmpFile.close()
## Create changeLog file
changeLogFileDest = target_outpath + "/changelog.txt"
if os.path.exists(base_pkg_path + "/changelog") == True:
tools.copy_file(base_pkg_path + "/changelog", changeLogFileDest)
else:
debug.info("no file 'changelog' ==> generate an empty one")
tmpFile = open(changeLogFileDest, 'w')
tmpFile.write("No changelog data " + pkg_name + "\n")
tmpFile.flush()
tmpFile.close()
def make_package_single_file(self, pkg_name, pkg_properties, base_pkg_path, heritage_list):
debug.debug("------------------------------------------------------------------------")
debug.info("Generate package '" + pkg_name + "'")
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.print_element("zip", "data.zip", "<==", "data/*") debug.print_element("zip", "data.zip", "<==", "data/*")
zipPath = self.get_staging_path(pkgName) + "/data.zip" zipPath = self.get_staging_path(pkg_name) + "/data.zip"
zip.create_zip(self.get_staging_path_data(pkgName), zipPath) zip.create_zip(self.get_staging_path_data(pkg_name), zipPath)
binPath = self.get_staging_path(pkgName) + "/" + self.path_bin + "/" + pkgName + self.suffix_binary binPath = self.get_staging_path(pkg_name) + "/" + self.path_bin + "/" + pkg_name + self.suffix_binary
binSize = tools.file_size(binPath) binSize = tools.file_size(binPath)
debug.info("binarysize : " + str(binSize/1024) + " ko ==> " + str(binSize) + " octets") debug.info("binarysize : " + str(binSize/1024) + " ko ==> " + str(binSize) + " octets")
#now we create a simple bundle binary ==> all file is stored in one file ... #now we create a simple bundle binary ==> all file is stored in one file ...
self.get_staging_path(pkgName) self.get_staging_path(pkg_name)
finalBin = self.get_final_path() + "/" + pkgName + self.suffix_binary finalBin = self.get_final_path() + "/" + pkg_name + self.suffix_binary
tools.create_directory_of_file(finalBin); tools.create_directory_of_file(finalBin);
debug.print_element("pkg", finalBin, "<==", pkgName + self.suffix_binary) debug.print_element("pkg", finalBin, "<==", pkg_name + self.suffix_binary)
#open output file #open output file
tmpFile = open(finalBin, 'wb') tmpFile = open(finalBin, 'wb')
# read all executable binary # read all executable binary
@ -118,16 +248,16 @@ class Target(target.Target):
tmpFile.close() tmpFile.close()
debug.verbose("zip position=" + str(positionOfZip) + " = 0x" + h) debug.verbose("zip position=" + str(positionOfZip) + " = 0x" + h)
def install_package(self, pkgName): def install_package(self, pkg_name):
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("Install package '" + pkgName + "'") debug.info("Install package '" + pkg_name + "'")
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.warning(" ==> TODO") debug.warning(" ==> TODO")
#sudo dpkg -i $(TARGET_OUT_FINAL)/$(PROJECT_NAME) + self.suffix_package #sudo dpkg -i $(TARGET_OUT_FINAL)/$(PROJECT_NAME) + self.suffix_package
def un_install_package(self, pkgName): def un_install_package(self, pkg_name):
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("Un-Install package '" + pkgName + "'") debug.info("Un-Install package '" + pkg_name + "'")
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.warning(" ==> TODO") debug.warning(" ==> TODO")
#sudo dpkg -r $(TARGET_OUT_FINAL)/$(PROJECT_NAME) + self.suffix_package #sudo dpkg -r $(TARGET_OUT_FINAL)/$(PROJECT_NAME) + self.suffix_package