[DEV] integrate new methode for IOs and MacOs

This commit is contained in:
Edouard DUPIN 2015-09-24 21:16:00 +02:00
parent 773a644ba1
commit 663188773d
7 changed files with 210 additions and 56 deletions

View File

@ -460,6 +460,7 @@ class Module:
self.local_heritage.add_lib_static(res_file) self.local_heritage.add_lib_static(res_file)
except ValueError: except ValueError:
debug.error(" UN-SUPPORTED link format: '.a'") debug.error(" UN-SUPPORTED link format: '.a'")
"""
if self.type == 'LIBRARY' \ if self.type == 'LIBRARY' \
or self.type == 'LIBRARY_DYNAMIC': or self.type == 'LIBRARY_DYNAMIC':
try: try:
@ -475,6 +476,7 @@ class Module:
self.local_heritage.add_lib_dynamic(res_file) self.local_heritage.add_lib_dynamic(res_file)
except ValueError: except ValueError:
debug.error(" UN-SUPPORTED link format: '.so'/'.dynlib'/'.dll'") debug.error(" UN-SUPPORTED link format: '.so'/'.dynlib'/'.dll'")
"""
try: try:
tmp_builder = builder.get_builder_with_output("jar"); tmp_builder = builder.get_builder_with_output("jar");
list_file = tools.filter_extention(list_sub_file_needed_to_build, tmp_builder.get_input_type()) list_file = tools.filter_extention(list_sub_file_needed_to_build, tmp_builder.get_input_type())

View File

@ -159,7 +159,7 @@ class Target:
if self.config["compilator"] == "clang": if self.config["compilator"] == "clang":
self.cc = self.cross + "clang" self.cc = self.cross + "clang"
self.xx = self.cross + "clang++" self.xx = self.cross + "clang++"
self.ar=self.cross + "llvm-ar" #self.ar=self.cross + "llvm-ar"
self.ranlib="" self.ranlib=""
else: else:
self.cc = self.cross + "gcc" self.cc = self.cross + "gcc"

View File

@ -91,8 +91,9 @@ def link(file, binary, target, depancy, name, basic_path, static=False):
lib_name = elem[len(lib_path)+len(target.prefix_lib)+1:-len(target.suffix_lib_dynamic)] lib_name = elem[len(lib_path)+len(target.prefix_lib)+1:-len(target.suffix_lib_dynamic)]
cmd.append("-L" + lib_path) cmd.append("-L" + lib_path)
cmd.append("-l" + lib_name) cmd.append("-l" + lib_name)
if len(list_dynamic) > 0: if target.name != "MacOs":
cmd.append("-Wl,-R$ORIGIN/../lib/") if len(list_dynamic) > 0:
cmd.append("-Wl,-R$ORIGIN/../lib/")
except: except:
pass pass
try: try:

View File

@ -55,11 +55,11 @@ class Target(target.Target):
#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/iPhoneSimulator.sdk"
self.global_flags_ld.append("-mios-simulator-version-min=8.0") self.global_flags_ld.append("-mios-simulator-version-min=8.0")
self.global_flags_cc.append("-mios-simulator-version-min=8.0") self.global_flags_cc.append("-mios-simulator-version-min=8.0")
else: else:
self.sysroot = "-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk" self.sysroot = "-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk"
self.global_flags_ld.append("-miphoneos-version-min=8.0") self.global_flags_ld.append("-miphoneos-version-min=8.0")
self.global_flags_cc.append("-miphoneos-version-min=8.0") self.global_flags_cc.append("-miphoneos-version-min=8.0")
@ -77,43 +77,115 @@ 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, binary_name): self.pkg_path_data = "share"
return tools.get_run_path() + self.path_out + self.path_staging + "/" + binary_name + ".app/" self.pkg_path_bin = ""
self.pkg_path_lib = "lib"
self.pkg_path_license = "license"
def get_staging_path_data(self, binary_name):
return self.get_staging_path(binary_name) + self.path_data + "/"
def make_package(self, pkg_name, pkg_properties, basePkgPath, heritage_list): 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_binary(pkg_name, pkg_properties, base_pkg_path, heritage_list, static = True)
if module.get_type() == 'BINARY_SHARED':
self.make_package_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");
def make_package_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static):
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("Generate package '" + pkg_name + "'") debug.info("Generate package '" + pkg_name + "'")
debug.debug("------------------------------------------------------------------------") 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 libraries:
if static == False:
#copy all shred libs...
target_outpath_lib = os.path.join(target_outpath, self.pkg_path_lib)
tools.create_directory_of_file(target_outpath_lib)
debug.verbose("libs for " + str(pkg_name) + ":")
for heritage in heritage_list.list_heritage:
debug.debug("sub elements: " + str(heritage.name))
file_src = self.get_build_file_dynamic(heritage.name)
debug.verbose(" has directory: " + file_src)
if os.path.isfile(file_src):
debug.debug(" need copy: " + file_src + " to " + target_outpath_lib)
#copy all data:
# TODO : We can have a problem when writing over library files ...
tools.copy_file(file_src, os.path.join(target_outpath_lib, os.path.basename(file_src)) )
## Create icon:
if "ICON" in pkg_properties.keys() \ if "ICON" in pkg_properties.keys() \
and pkg_properties["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", "<==", pkg_properties["ICON"]) debug.print_element("pkg", "iTunesArtwork.png", "<==", pkg_properties["ICON"])
image.resize(pkg_properties["ICON"], self.get_staging_path(pkg_name) + "/iTunesArtwork.png", 512, 512) image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "iTunesArtwork.png"), 512, 512)
debug.print_element("pkg", "iTunesArtwork@2x.png", "<==", pkg_properties["ICON"]) debug.print_element("pkg", "iTunesArtwork@2x.png", "<==", pkg_properties["ICON"])
image.resize(pkg_properties["ICON"], self.get_staging_path(pkg_name) + "/iTunesArtwork@2x.png", 1024, 1024) image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "iTunesArtwork@2x.png"), 1024, 1024)
debug.print_element("pkg", "Icon-60@2x.png", "<==", pkg_properties["ICON"]) debug.print_element("pkg", "Icon-60@2x.png", "<==", pkg_properties["ICON"])
image.resize(pkg_properties["ICON"], self.get_staging_path(pkg_name) + "/Icon-60@2x.png", 120, 120) image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "Icon-60@2x.png"), 120, 120)
debug.print_element("pkg", "Icon-76.png", "<==", pkg_properties["ICON"]) debug.print_element("pkg", "Icon-76.png", "<==", pkg_properties["ICON"])
image.resize(pkg_properties["ICON"], self.get_staging_path(pkg_name) + "/Icon-76.png", 76, 76) image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "Icon-76.png"), 76, 76)
debug.print_element("pkg", "Icon-76@2x.png", "<==", pkg_properties["ICON"]) debug.print_element("pkg", "Icon-76@2x.png", "<==", pkg_properties["ICON"])
image.resize(pkg_properties["ICON"], self.get_staging_path(pkg_name) + "/Icon-76@2x.png", 152, 152) image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "Icon-76@2x.png"), 152, 152)
debug.print_element("pkg", "Icon-Small-40.png", "<==", pkg_properties["ICON"]) debug.print_element("pkg", "Icon-Small-40.png", "<==", pkg_properties["ICON"])
image.resize(pkg_properties["ICON"], self.get_staging_path(pkg_name) + "/Icon-Small-40.png", 40, 40) image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "Icon-Small-40.png"), 40, 40)
debug.print_element("pkg", "Icon-Small-40@2x.png", "<==", pkg_properties["ICON"]) debug.print_element("pkg", "Icon-Small-40@2x.png", "<==", pkg_properties["ICON"])
image.resize(pkg_properties["ICON"], self.get_staging_path(pkg_name) + "/Icon-Small-40@2x.png", 80, 80) image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "Icon-Small-40@2x.png"), 80, 80)
debug.print_element("pkg", "Icon-Small.png", "<==", pkg_properties["ICON"]) debug.print_element("pkg", "Icon-Small.png", "<==", pkg_properties["ICON"])
image.resize(pkg_properties["ICON"], self.get_staging_path(pkg_name) + "/Icon-Small.png", 29, 29) image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "Icon-Small.png"), 29, 29)
debug.print_element("pkg", "Icon-Small@2x.png", "<==", pkg_properties["ICON"]) debug.print_element("pkg", "Icon-Small@2x.png", "<==", pkg_properties["ICON"])
image.resize(pkg_properties["ICON"], self.get_staging_path(pkg_name) + "/Icon-Small@2x.png", 58, 58) image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "Icon-Small@2x.png"), 58, 58)
debug.print_element("pkg", "PkgInfo", "<==", "APPL????") debug.print_element("pkg", "PkgInfo", "<==", "APPL????")
infoFile = self.get_staging_path(pkg_name) + "/PkgInfo" infoFile = os.path.join(target_outpath, "PkgInfo")
# Create the info file # Create the info file
tmpFile = open(infoFile, 'w') tmpFile = open(infoFile, 'w')
tmpFile.write("APPL????") tmpFile.write("APPL????")
@ -206,7 +278,7 @@ class Target(target.Target):
dataFile += "</plist>\n" dataFile += "</plist>\n"
dataFile += "\n\n" dataFile += "\n\n"
infoFile = self.get_staging_path(pkg_name) + "/Info.plist" infoFile = os.path.join(target_outpath, "Info.plist")
# Create the info file # Create the info file
tmpFile = open(infoFile, 'w') tmpFile = open(infoFile, 'w')
tmpFile.write(dataFile) tmpFile.write(dataFile)
@ -274,7 +346,7 @@ class Target(target.Target):
dataFile += "</plist>\n" dataFile += "</plist>\n"
dataFile += "\n\n" dataFile += "\n\n"
infoFile = self.get_staging_path(pkg_name) + "/ResourceRules.plist" infoFile = os.path.join(target_outpath, "ResourceRules.plist")
# Create the info file # Create the info file
tmpFile = open(infoFile, 'w') tmpFile = open(infoFile, 'w')
tmpFile.write(dataFile) tmpFile.write(dataFile)
@ -292,7 +364,7 @@ class Target(target.Target):
dataFile += "</plist>\n" dataFile += "</plist>\n"
dataFile += "\n\n" dataFile += "\n\n"
infoFile = self.get_staging_path(pkg_name) + "/Entitlements.plist" infoFile = os.path.join(target_outpath, "Entitlements.plist")
# Create the info file # Create the info file
tmpFile = open(infoFile, 'w') tmpFile = open(infoFile, 'w')
tmpFile.write(dataFile) tmpFile.write(dataFile)
@ -311,7 +383,7 @@ 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(pkg_name) + "/worddown.xcent", 'w') tmpFile = open(os.path.join(target_outpath, pkg_name + ".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")

View File

@ -111,7 +111,7 @@ class Target(target.Target):
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")
tools.create_directory_of_file(target_outpath) tools.create_directory_of_file(target_outpath)
## Create share datas ## Create share datas:
if static == True: if static == True:
target_outpath_data = os.path.join(target_outpath, self.pkg_path_data, pkg_name) target_outpath_data = os.path.join(target_outpath, self.pkg_path_data, pkg_name)
else: else:
@ -132,7 +132,7 @@ 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)
## copy binary files ## copy binary files:
target_outpath_bin = os.path.join(target_outpath, self.pkg_path_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)
@ -140,7 +140,7 @@ class Target(target.Target):
debug.verbose("path_dst: " + str(path_dst)) debug.verbose("path_dst: " + str(path_dst))
tools.copy_file(path_src, path_dst) tools.copy_file(path_src, path_dst)
## 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, self.pkg_path_lib) target_outpath_lib = os.path.join(target_outpath, self.pkg_path_lib)
@ -156,31 +156,31 @@ class Target(target.Target):
# TODO : We can have a problem when writing over library files ... # TODO : We can have a problem when writing over library files ...
tools.copy_file(file_src, os.path.join(target_outpath_lib, os.path.basename(file_src)) ) tools.copy_file(file_src, os.path.join(target_outpath_lib, os.path.basename(file_src)) )
## Create version file ## Create version file:
tmpFile = open(target_outpath + "/version.txt", 'w') tmpFile = open(target_outpath + "/version.txt", 'w')
tmpFile.write(pkg_properties["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(pkg_properties["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:" + pkg_properties["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:" + pkg_properties["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(base_pkg_path + "/os-Linux/README")==True: if os.path.exists(base_pkg_path + "/os-Linux/README")==True:
tools.copy_file(base_pkg_path + "/os-Linux/README", readmeFileDest) tools.copy_file(base_pkg_path + "/os-Linux/README", readmeFileDest)
@ -195,7 +195,7 @@ class Target(target.Target):
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
## Create licence file ## Create licence file:
licenseFileDest = os.path.join(target_outpath, self.pkg_path_license, pkg_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(base_pkg_path + "/license.txt")==True: if os.path.exists(base_pkg_path + "/license.txt")==True:
@ -207,7 +207,7 @@ class Target(target.Target):
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
## Create changeLog file ## Create changeLog file:
changeLogFileDest = target_outpath + "/changelog.txt" changeLogFileDest = target_outpath + "/changelog.txt"
if os.path.exists(base_pkg_path + "/changelog") == True: if os.path.exists(base_pkg_path + "/changelog") == True:
tools.copy_file(base_pkg_path + "/changelog", changeLogFileDest) tools.copy_file(base_pkg_path + "/changelog", changeLogFileDest)
@ -218,7 +218,6 @@ class Target(target.Target):
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
## create the package: ## create the package:
debug.debug("package : " + self.get_staging_path(pkg_name) + "/" + pkg_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")

View File

@ -40,24 +40,103 @@ class Target(target.Target):
self.global_flags_cc.append("-D__STDCPP_LLVM__") self.global_flags_cc.append("-D__STDCPP_LLVM__")
self.pkg_path_data = "Resources"
self.pkg_path_bin = "MacOS"
self.pkg_path_lib = "lib"
self.pkg_path_license = "license"
"""
def get_staging_path(self, binary_name): def get_staging_path(self, binary_name):
return tools.get_run_path() + self.path_out + self.path_staging + "/" + binary_name + ".app/Contents/" return tools.get_run_path() + self.path_out + self.path_staging + "/" + binary_name + ".app/Contents/"
def get_staging_path_data(self, binary_name): def get_staging_path_data(self, binary_name):
return self.get_staging_path(binary_name) + self.path_data + "/" return self.get_staging_path(binary_name) + self.path_data + "/"
"""
def make_package(self, pkg_name, pkg_properties, base_pkg_path, heritage_list): 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_binary(pkg_name, pkg_properties, base_pkg_path, heritage_list, static = True)
if module.get_type() == 'BINARY_SHARED':
self.make_package_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");
def make_package_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static):
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("Generate package '" + pkg_name + "'") debug.info("Generate package '" + pkg_name + "'")
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
#output path
target_outpath = os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app/Contents")
tools.create_directory_of_file(target_outpath)
if "ICON" in pkg_properties.keys() \ ## 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 libraries:
if static == False:
#copy all shred libs...
target_outpath_lib = os.path.join(target_outpath, self.pkg_path_lib)
tools.create_directory_of_file(target_outpath_lib)
debug.verbose("libs for " + str(pkg_name) + ":")
for heritage in heritage_list.list_heritage:
debug.debug("sub elements: " + str(heritage.name))
file_src = self.get_build_file_dynamic(heritage.name)
debug.verbose(" has directory: " + file_src)
if os.path.isfile(file_src):
debug.debug(" need copy: " + file_src + " to " + target_outpath_lib)
#copy all data:
# TODO : We can have a problem when writing over library files ...
tools.copy_file(file_src, os.path.join(target_outpath_lib, os.path.basename(file_src)) )
## Create icon (no convertion ==> TODO: must test if png is now supported):
if "ICON" in pkg_properties.keys() \
and pkg_properties["ICON"] != "": and pkg_properties["ICON"] != "":
tools.copy_file(pkg_properties["ICON"], self.get_staging_path_data(pkg_name) + "/icon.icns", force=True) tools.copy_file(pkg_properties["ICON"], os.path.join(target_outpath, "icon.icns"), force=True)
## Create info.plist file:
# http://www.sandroid.org/imcross/#Deployment # http://www.sandroid.org/imcross/#Deployment
infoFile=self.get_staging_path(pkg_name) + "/Info.plist" infoFile = os.path.join(target_outpath, "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")
@ -79,15 +158,17 @@ 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(pkg_name) + "/PkgInfo"
## Create PkgInfo file:
infoFile=os.path.join(target_outpath, "PkgInfo")
# Create the info file # Create the info file
tmpFile = open(infoFile, 'w') tmpFile = open(infoFile, 'w')
tmpFile.write("APPL????") tmpFile.write("APPL????")
tmpFile.flush() tmpFile.flush()
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(pkg_name) + "/shell/" + pkg_name shell_file_name = os.path.join(target_outpath, "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')
@ -98,19 +179,19 @@ class Target(target.Target):
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
## Create the disk image of the application:
# Must create the disk image of the application
debug.info("Generate disk image for '" + pkg_name + "'") debug.info("Generate disk image for '" + pkg_name + "'")
output_file_name = self.get_final_path() + "/" + pkg_name + ".dmg" output_file_name = os.path.join(self.get_final_path(), pkg_name + ".dmg")
cmd = "hdiutil create -volname " cmd = "hdiutil create -volname "
cmd += pkg_name + " -srcpath " cmd += pkg_name + " -srcpath "
cmd += tools.get_run_path() + self.path_out + self.path_staging + "/" + pkg_name + ".app" cmd += os.path.join(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)
multiprocess.run_command_direct(cmd) multiprocess.run_command_direct(cmd)
debug.info("disk image: " + output_file_name) debug.info("disk image: " + output_file_name)
## user information:
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")

View File

@ -102,7 +102,7 @@ class Target(target.Target):
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")
tools.create_directory_of_file(target_outpath) tools.create_directory_of_file(target_outpath)
## Create share datas ## Create share datas:
if static == True: if static == True:
target_outpath_data = os.path.join(target_outpath, self.pkg_path_data, pkg_name) target_outpath_data = os.path.join(target_outpath, self.pkg_path_data, pkg_name)
else: else:
@ -123,7 +123,7 @@ 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)
## copy binary files ## copy binary files:
target_outpath_bin = os.path.join(target_outpath, self.pkg_path_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)
@ -131,31 +131,31 @@ class Target(target.Target):
debug.verbose("path_dst: " + str(path_dst)) debug.verbose("path_dst: " + str(path_dst))
tools.copy_file(path_src, path_dst) tools.copy_file(path_src, path_dst)
## Create version file ## Create version file:
tmpFile = open(target_outpath + "/version.txt", 'w') tmpFile = open(target_outpath + "/version.txt", 'w')
tmpFile.write(pkg_properties["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(pkg_properties["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:" + pkg_properties["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:" + pkg_properties["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(base_pkg_path + "/os-Linux/README")==True: if os.path.exists(base_pkg_path + "/os-Linux/README")==True:
tools.copy_file(base_pkg_path + "/os-Linux/README", readmeFileDest) tools.copy_file(base_pkg_path + "/os-Linux/README", readmeFileDest)
@ -170,7 +170,7 @@ class Target(target.Target):
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
## Create licence file ## Create licence file:
licenseFileDest = os.path.join(target_outpath, self.pkg_path_license, pkg_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(base_pkg_path + "/license.txt")==True: if os.path.exists(base_pkg_path + "/license.txt")==True:
@ -182,7 +182,7 @@ class Target(target.Target):
tmpFile.flush() tmpFile.flush()
tmpFile.close() tmpFile.close()
## Create changeLog file ## Create changeLog file:
changeLogFileDest = target_outpath + "/changelog.txt" changeLogFileDest = target_outpath + "/changelog.txt"
if os.path.exists(base_pkg_path + "/changelog") == True: if os.path.exists(base_pkg_path + "/changelog") == True:
tools.copy_file(base_pkg_path + "/changelog", changeLogFileDest) tools.copy_file(base_pkg_path + "/changelog", changeLogFileDest)
@ -194,7 +194,6 @@ class Target(target.Target):
tmpFile.close() tmpFile.close()
def make_package_single_file(self, pkg_name, pkg_properties, base_pkg_path, heritage_list): def make_package_single_file(self, pkg_name, pkg_properties, base_pkg_path, heritage_list):
debug.debug("------------------------------------------------------------------------") debug.debug("------------------------------------------------------------------------")
debug.info("Generate package '" + pkg_name + "'") debug.info("Generate package '" + pkg_name + "'")