Compare commits
27 Commits
Author | SHA1 | Date | |
---|---|---|---|
055a37bcd5 | |||
6c3f96c2a9 | |||
1200434b97 | |||
6c431ad300 | |||
8a72df67c6 | |||
7360adce0b | |||
5065c7b6ee | |||
b497e09dd0 | |||
75d1490a59 | |||
ddff6f82b9 | |||
4067d6266e | |||
fcd357e452 | |||
3c186dc92e | |||
0b33c94680 | |||
6c416c9fef | |||
fc6493f441 | |||
16c019ac5b | |||
328681d44b | |||
fbf7d2dbad | |||
5f008a153e | |||
4d82e31d40 | |||
c913e19ccf | |||
62ac51e78b | |||
ce407605c9 | |||
8336411ec2 | |||
fd58b31c26 | |||
fa1b618896 |
69
.travis.yml
Normal file
69
.travis.yml
Normal file
@@ -0,0 +1,69 @@
|
||||
#language: python
|
||||
|
||||
sudo: false
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- dev
|
||||
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-4.9
|
||||
- expect
|
||||
- binutils-mingw-w64-i686 # 32bit MinGW
|
||||
- gcc-mingw-w64-i686
|
||||
- g++-mingw-w64-i686
|
||||
- binutils-mingw-w64-x86-64 # 64bit MinGW
|
||||
- gcc-mingw-w64-x86-64
|
||||
- g++-mingw-w64-x86-64
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
env: CONF=release BUILDER=gcc TARGET=Linux TAG=Linux
|
||||
compiler: gcc
|
||||
- os: linux
|
||||
env: CONF=debug BUILDER=clang TARGET=Linux
|
||||
compiler: clang
|
||||
- os: linux
|
||||
env: CONF=release BUILDER=gcc TARGET=Windows TAG=Mingw
|
||||
compiler: gcc
|
||||
- os: linux
|
||||
env: CONF=release BUILDER=gcc TARGET=Android TAG=Android DISABLE_PACKAGE=-p
|
||||
compiler: gcc
|
||||
- os: osx
|
||||
env: CONF=release BUILDER=clang TARGET=MacOs TAG=MacOs
|
||||
compiler: clang
|
||||
- os: osx
|
||||
env: CONF=release BUILDER=clang TARGET=IOs TAG=IOs
|
||||
compiler: clang
|
||||
|
||||
install:
|
||||
- cd ..
|
||||
# download NDK
|
||||
- if [ "$TAG" == "Android" ]; then
|
||||
git clone --depth 1 --branch master https://github.com/HeeroYui/android-download-tool;
|
||||
./android-download-tool/dl-android.sh;
|
||||
fi
|
||||
- git clone --depth 1 --branch master https://github.com/atria-soft/ci.git
|
||||
- cd -
|
||||
|
||||
before_script:
|
||||
- ./setup.py build
|
||||
- export PYTHONPATH=$PYTHONPATH:./lutin/build/lib.linux-x86_64-2.7/:./lutin/build/lib.linux-x86_64-2.7/lutin/:./lutin/build/lib:./lutin/build/lib/lutin/
|
||||
- cd ..
|
||||
- pwd
|
||||
- ls -l *
|
||||
- ./ci/build_send.py --tag=$TAG --status=START;
|
||||
|
||||
script:
|
||||
- ./lutin/build/scripts-2.7/lutin -w -j4 -C -P -t$TARGET -c $BUILDER $COMPILATOR_OPTION $BUS -m $CONF $GCOV $DISABLE_PACKAGE test-c; STATUS=$?
|
||||
- ./ci/build_send.py --tag=$TAG --status="$STATUS";
|
||||
|
||||
notifications:
|
||||
email:
|
||||
- yui.heero@gmail.com
|
43
README.rst
43
README.rst
@@ -3,9 +3,52 @@ Lutin
|
||||
|
||||
`lutin` is a generic builder and package maker is a FREE software tool.
|
||||
|
||||
|
||||
.. image:: https://badge.fury.io/py/lutin.png
|
||||
:target: https://pypi.python.org/pypi/lutin
|
||||
|
||||
Release (master)
|
||||
----------------
|
||||
|
||||
.. image:: https://travis-ci.org/HeeroYui/lutin.svg?branch=master
|
||||
:target: https://travis-ci.org/HeeroYui/lutin
|
||||
|
||||
|
||||
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=master&tag=Linux
|
||||
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=master&tag=MacOs
|
||||
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=master&tag=Mingw
|
||||
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||
|
||||
|
||||
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=master&tag=Android
|
||||
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=master&tag=IOs
|
||||
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||
|
||||
|
||||
Developement (dev)
|
||||
------------------
|
||||
|
||||
.. image:: https://travis-ci.org/HeeroYui/lutin.svg?branch=dev
|
||||
:target: https://travis-ci.org/HeeroYui/lutin
|
||||
|
||||
|
||||
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=dev&tag=Linux
|
||||
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=dev&tag=MacOs
|
||||
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=dev&tag=Mingw
|
||||
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||
|
||||
|
||||
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=dev&tag=Android
|
||||
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||
.. image:: http://atria-soft.com/ci/build/HeeroYui/lutin.svg?branch=dev&tag=IOs
|
||||
:target: http://atria-soft.com/ci/HeeroYui/lutin
|
||||
|
||||
|
||||
Instructions
|
||||
------------
|
||||
|
||||
|
42
bin/lutin
42
bin/lutin
@@ -17,6 +17,7 @@ import lutin.module as module
|
||||
import lutin.target as target
|
||||
import lutin.env as env
|
||||
import lutin.multiprocess as multiprocess
|
||||
import lutin.tools as tools
|
||||
|
||||
myArgs = arguments.LutinArg()
|
||||
myArgs.add(arguments.ArgDefine("h", "help", desc="Display this help"))
|
||||
@@ -66,7 +67,8 @@ def usage(full=False):
|
||||
for mod in listOfAllModule:
|
||||
data_print = " "
|
||||
if full == False:
|
||||
if mod["type"][:6] == "BINARY":
|
||||
if mod["type"] != None \
|
||||
and mod["type"][:6] == "BINARY":
|
||||
data_print += color['blue']
|
||||
if mod["sub-type"] == "":
|
||||
data_print += "* "
|
||||
@@ -78,9 +80,11 @@ def usage(full=False):
|
||||
data_print += "S "
|
||||
else:
|
||||
data_print += " "
|
||||
elif mod["type"] == "PACKAGE":
|
||||
elif mod["type"] != None \
|
||||
and mod["type"] == "PACKAGE":
|
||||
data_print += color['red'] + "# "
|
||||
elif mod["type"][:7] == "LIBRARY":
|
||||
elif mod["type"] != None \
|
||||
and mod["type"][:7] == "LIBRARY":
|
||||
data_print += color['yellow'] + " "
|
||||
else:
|
||||
data_print += color['default'] + " "
|
||||
@@ -89,9 +93,11 @@ def usage(full=False):
|
||||
data_print += mod["name"] + color['default']
|
||||
if full == False:
|
||||
data_print += "\r\t\t\t\t\t\t\t"
|
||||
if mod["license"] != "":
|
||||
if mod["license"] != None \
|
||||
and mod["license"] != "":
|
||||
data_print += color['yellow'] + " [" + mod["license"] + "]" + color['default']
|
||||
if mod["version"] != []:
|
||||
if mod["version"] != None \
|
||||
and mod["version"] != []:
|
||||
version_ID = tools.version_to_string(mod["version"])
|
||||
data_print += color['blue'] + " (" + version_ID + ")" + color['default']
|
||||
"""
|
||||
@@ -106,11 +112,14 @@ def usage(full=False):
|
||||
if mod["description"] != "":
|
||||
print(" " + mod["description"])
|
||||
if full == True:
|
||||
if mod["type"] != "":
|
||||
if mod["type"] != None \
|
||||
and mod["type"] != "":
|
||||
print(" Type: " + mod["type"])
|
||||
if mod["sub-type"] != "":
|
||||
if mod["sub-type"] != None \
|
||||
and mod["sub-type"] != "":
|
||||
print(" Sub-Type: " + mod["sub-type"])
|
||||
if mod["version"] != []:
|
||||
if mod["version"] != None \
|
||||
and mod["version"] != []:
|
||||
version_ID = ""
|
||||
for id in mod["version"]:
|
||||
if len(version_ID) != 0:
|
||||
@@ -120,14 +129,19 @@ def usage(full=False):
|
||||
version_ID+="."
|
||||
version_ID += str(id)
|
||||
print(" version: " + color['blue'] + version_ID + color['default'])
|
||||
if mod["compagny-type"] != "" \
|
||||
if mod["compagny-type"] != None \
|
||||
and mod["compagny-name"] != None \
|
||||
and mod["compagny-type"] != "" \
|
||||
and mod["compagny-name"] != "":
|
||||
print(" compagny: " + color['purple'] + mod["compagny-type"] + "/" + mod["compagny-name"] + color['default'])
|
||||
elif mod["compagny-name"] != "":
|
||||
elif mod["compagny-name"] != None \
|
||||
and mod["compagny-name"] != "":
|
||||
print(" compagny: " + color['purple'] + mod["compagny-name"] + color['default'])
|
||||
if mod["license"] != "":
|
||||
if mod["license"] != None \
|
||||
and mod["license"] != "":
|
||||
print(" license: " + color['yellow'] + mod["license"] + color['default'])
|
||||
if mod["maintainer"] != []:
|
||||
if mod["maintainer"] != None \
|
||||
and mod["maintainer"] != []:
|
||||
print(" maintainers:")
|
||||
for elem in mod["maintainer"]:
|
||||
print(" " + str(elem))
|
||||
@@ -178,7 +192,7 @@ def parseGenericArg(argument, active):
|
||||
if active==True:
|
||||
debug.enable_color()
|
||||
return True
|
||||
elif argument.get_option_name() == "force":
|
||||
elif argument.get_option_name() == "force-build":
|
||||
if active==True:
|
||||
env.set_force_mode(True)
|
||||
return True
|
||||
@@ -270,7 +284,7 @@ for argument in localArgument:
|
||||
my_target = None
|
||||
else:
|
||||
if argument.get_option_name() != "":
|
||||
debug.warning("Can not understand argument : '" + argument.get_option_nName() + "'")
|
||||
debug.warning("Can not understand argument : '" + argument.get_option_name() + "'")
|
||||
usage()
|
||||
else:
|
||||
#load the target if needed :
|
||||
|
@@ -40,7 +40,7 @@ def resize(src_file, dest_file, x, y, cmd_file=None):
|
||||
if os.path.exists(src_file) == False:
|
||||
debug.error("Request a resize an image that does not existed : '" + src_file + "'")
|
||||
cmd_line = "resize Image : " + src_file + " ==> " + dest_file + " newSize=(" + str(x) + "x" + str(y) + ")"
|
||||
if False==depend.need_re_build(dest_file, src_file, file_cmd=cmd_file , cmd_line=cmd_line):
|
||||
if depend.need_re_build(dest_file, src_file, file_cmd=cmd_file , cmd_line=cmd_line) == False:
|
||||
return
|
||||
# add cmdLine ...
|
||||
x = get_pow_2_multiple(x)
|
||||
|
179
lutin/module.py
179
lutin/module.py
@@ -82,18 +82,18 @@ class Module:
|
||||
self.origin_file = file;
|
||||
self.origin_path = tools.get_current_path(self.origin_file)
|
||||
self.local_heritage = heritage.heritage(self, None)
|
||||
|
||||
self.package_prop = { "COMPAGNY_TYPE" : set(""),
|
||||
"COMPAGNY_NAME" : set(""),
|
||||
"COMPAGNY_NAME2" : set(""),
|
||||
"MAINTAINER" : set([]),
|
||||
# TODO : Do a better dynamic property system => not really versatil
|
||||
self.package_prop = { "COMPAGNY_TYPE" : "",
|
||||
"COMPAGNY_NAME" : "",
|
||||
"COMPAGNY_NAME2" : "",
|
||||
"MAINTAINER" : [],
|
||||
#"ICON" : set(""),
|
||||
"SECTION" : set([]),
|
||||
"PRIORITY" : set(""),
|
||||
"DESCRIPTION" : set(""),
|
||||
"SECTION" : [],
|
||||
"PRIORITY" : "",
|
||||
"DESCRIPTION" : "",
|
||||
"VERSION" : [0,0,0],
|
||||
"VERSION_CODE" : "",
|
||||
"NAME" : set("no-name"), # name of the application
|
||||
"NAME" : "no-name", # name of the application
|
||||
"ANDROID_MANIFEST" : "", # By default generate the manifest
|
||||
"ANDROID_RESOURCES" : [],
|
||||
"ANDROID_APPL_TYPE" : "APPL", # the other mode is "WALLPAPER" ... and later "WIDGET"
|
||||
@@ -135,9 +135,10 @@ class Module:
|
||||
"-Wreturn-type",
|
||||
#"-Wint-to-pointer-cast",
|
||||
"-Wno-write-strings",
|
||||
"-Woverloaded-virtual",
|
||||
"-Wnon-virtual-dtor",
|
||||
"-Wno-unused-variable"]);
|
||||
self.compile_flags('c++', [
|
||||
"-Woverloaded-virtual",
|
||||
"-Wnon-virtual-dtor"]);
|
||||
#only for gcc : "-Wunused-variable", "-Wunused-but-set-variable",
|
||||
|
||||
##
|
||||
@@ -386,22 +387,23 @@ class Module:
|
||||
# ----------------------------------------------------
|
||||
# -- Generic library help --
|
||||
# ----------------------------------------------------
|
||||
package_version_string = tools.version_to_string(self.package_prop["VERSION"]);
|
||||
if self.type == 'PREBUILD':
|
||||
debug.print_element("Prebuild", self.name, "", "")
|
||||
if self.type == 'LIBRARY':
|
||||
debug.print_element("Library", self.name, "", "")
|
||||
if self.type == 'LIBRARY_DYNAMIC':
|
||||
debug.print_element("Library(dynamic)", self.name, "", "")
|
||||
if self.type == 'LIBRARY_STATIC':
|
||||
debug.print_element("Library(static)", self.name, "", "")
|
||||
if self.type == 'BINARY':
|
||||
debug.print_element("Binary(auto)", self.name, "", "")
|
||||
if self.type == 'BINARY_SHARED':
|
||||
debug.print_element("Binary (shared)", self.name, "", "")
|
||||
if self.type == 'BINARY_STAND_ALONE':
|
||||
debug.print_element("Binary (stand alone)", self.name, "", "")
|
||||
if self.type == 'PACKAGE':
|
||||
debug.print_element("Package", self.name, "", "")
|
||||
debug.print_element("Prebuild", self.name, "-", package_version_string)
|
||||
elif self.type == 'LIBRARY':
|
||||
debug.print_element("Library", self.name, "-", package_version_string)
|
||||
elif self.type == 'LIBRARY_DYNAMIC':
|
||||
debug.print_element("Library(dynamic)", self.name, "-", package_version_string)
|
||||
elif self.type == 'LIBRARY_STATIC':
|
||||
debug.print_element("Library(static)", self.name, "-", package_version_string)
|
||||
elif self.type == 'BINARY':
|
||||
debug.print_element("Binary(auto)", self.name, "-", package_version_string)
|
||||
elif self.type == 'BINARY_SHARED':
|
||||
debug.print_element("Binary (shared)", self.name, "-", package_version_string)
|
||||
elif self.type == 'BINARY_STAND_ALONE':
|
||||
debug.print_element("Binary (stand alone)", self.name, "-", package_version_string)
|
||||
elif self.type == 'PACKAGE':
|
||||
debug.print_element("Package", self.name, "-", package_version_string)
|
||||
# ----------------------------------------------------
|
||||
# -- Sources compilation --
|
||||
# ----------------------------------------------------
|
||||
@@ -476,26 +478,29 @@ class Module:
|
||||
package_name,
|
||||
target,
|
||||
self.sub_heritage_list,
|
||||
flags = self.flags,
|
||||
name = self.name,
|
||||
basic_path = self.origin_path)
|
||||
self.local_heritage.add_lib_static(res_file)
|
||||
except ValueError:
|
||||
debug.error(" UN-SUPPORTED link format: '.a'")
|
||||
if self.type == 'LIBRARY' \
|
||||
or self.type == 'LIBRARY_DYNAMIC':
|
||||
try:
|
||||
tmp_builder = builder.get_builder_with_output("so");
|
||||
list_file = tools.filter_extention(list_sub_file_needed_to_build, tmp_builder.get_input_type())
|
||||
if len(list_file) > 0:
|
||||
res_file = tmp_builder.link(list_file,
|
||||
package_name,
|
||||
target,
|
||||
self.sub_heritage_list,
|
||||
name = self.name,
|
||||
basic_path = self.origin_path)
|
||||
self.local_heritage.add_lib_dynamic(res_file)
|
||||
except ValueError:
|
||||
debug.error(" UN-SUPPORTED link format: '.so'/'.dynlib'/'.dll'")
|
||||
if target.support_dynamic_link == True:
|
||||
if self.type == 'LIBRARY' \
|
||||
or self.type == 'LIBRARY_DYNAMIC':
|
||||
try:
|
||||
tmp_builder = builder.get_builder_with_output("so");
|
||||
list_file = tools.filter_extention(list_sub_file_needed_to_build, tmp_builder.get_input_type())
|
||||
if len(list_file) > 0:
|
||||
res_file = tmp_builder.link(list_file,
|
||||
package_name,
|
||||
target,
|
||||
self.sub_heritage_list,
|
||||
flags = self.flags,
|
||||
name = self.name,
|
||||
basic_path = self.origin_path)
|
||||
self.local_heritage.add_lib_dynamic(res_file)
|
||||
except ValueError:
|
||||
debug.error(" UN-SUPPORTED link format: '.so'/'.dynlib'/'.dll'")
|
||||
try:
|
||||
tmp_builder = builder.get_builder_with_output("jar");
|
||||
list_file = tools.filter_extention(list_sub_file_needed_to_build, tmp_builder.get_input_type())
|
||||
@@ -504,6 +509,7 @@ class Module:
|
||||
package_name,
|
||||
target,
|
||||
self.sub_heritage_list,
|
||||
flags = self.flags,
|
||||
name = self.name,
|
||||
basic_path = self.origin_path)
|
||||
self.local_heritage.add_lib_interpreted('java', res_file)
|
||||
@@ -513,7 +519,7 @@ class Module:
|
||||
or self.type == 'BINARY_SHARED' \
|
||||
or self.type == 'BINARY_STAND_ALONE':
|
||||
shared_mode = False
|
||||
if target.name=="Android":
|
||||
if target.name == "Android":
|
||||
debug.warning("Android mode ...")
|
||||
# special case for android ...
|
||||
for elem in self.sub_heritage_list.src['src']:
|
||||
@@ -523,8 +529,9 @@ class Module:
|
||||
shared_mode = True
|
||||
break;
|
||||
static_mode = True
|
||||
if self.type == 'BINARY_SHARED':
|
||||
static_mode = False
|
||||
if target.support_dynamic_link == True:
|
||||
if self.type == 'BINARY_SHARED':
|
||||
static_mode = False
|
||||
if shared_mode == True:
|
||||
try:
|
||||
tmp_builder = builder.get_builder_with_output("so");
|
||||
@@ -533,6 +540,7 @@ class Module:
|
||||
package_name,
|
||||
target,
|
||||
self.sub_heritage_list,
|
||||
flags = self.flags,
|
||||
name = self.name,
|
||||
basic_path = self.origin_path,
|
||||
static = static_mode)
|
||||
@@ -547,6 +555,7 @@ class Module:
|
||||
package_name,
|
||||
target,
|
||||
self.sub_heritage_list,
|
||||
flags = self.flags,
|
||||
name = self.name,
|
||||
basic_path = self.origin_path)
|
||||
self.local_heritage.add_sources(res_file)
|
||||
@@ -559,13 +568,14 @@ class Module:
|
||||
package_name,
|
||||
target,
|
||||
self.sub_heritage_list,
|
||||
flags = self.flags,
|
||||
name = self.name,
|
||||
basic_path = self.origin_path,
|
||||
static = static_mode)
|
||||
except ValueError:
|
||||
debug.error(" UN-SUPPORTED link format: '.bin'")
|
||||
elif self.type == "PACKAGE":
|
||||
if target.name=="Android":
|
||||
if target.name == "Android":
|
||||
# special case for android wrapper:
|
||||
try:
|
||||
tmp_builder = builder.get_builder_with_output("so");
|
||||
@@ -574,6 +584,7 @@ class Module:
|
||||
package_name,
|
||||
target,
|
||||
self.sub_heritage_list,
|
||||
flags = self.flags,
|
||||
name = "lib" + self.name,
|
||||
basic_path = self.origin_path)
|
||||
self.local_heritage.add_sources(res_file)
|
||||
@@ -587,6 +598,7 @@ class Module:
|
||||
package_name,
|
||||
target,
|
||||
self.sub_heritage_list,
|
||||
flags = self.flags,
|
||||
name = self.name,
|
||||
basic_path = self.origin_path)
|
||||
self.local_heritage.add_sources(res_file)
|
||||
@@ -599,6 +611,7 @@ class Module:
|
||||
package_name,
|
||||
target,
|
||||
self.sub_heritage_list,
|
||||
flags = self.flags,
|
||||
name = self.name,
|
||||
basic_path = self.origin_path)
|
||||
except ValueError:
|
||||
@@ -614,11 +627,19 @@ class Module:
|
||||
include_path = target.get_build_path_include(self.name)
|
||||
for file in self.header:
|
||||
src_path = os.path.join(self.origin_path, file["src"])
|
||||
dst_path = os.path.join(include_path, file["dst"])
|
||||
tools.copy_file(src_path,
|
||||
dst_path,
|
||||
force_identical=True,
|
||||
in_list=copy_list)
|
||||
if "multi-dst" in file:
|
||||
dst_path = os.path.join(include_path, file["multi-dst"])
|
||||
tools.copy_anything(src_path,
|
||||
dst_path,
|
||||
recursive=False,
|
||||
force_identical=True,
|
||||
in_list=copy_list)
|
||||
else:
|
||||
dst_path = os.path.join(include_path, file["dst"])
|
||||
tools.copy_file(src_path,
|
||||
dst_path,
|
||||
force_identical=True,
|
||||
in_list=copy_list)
|
||||
#real copy files
|
||||
tools.copy_list(copy_list)
|
||||
# remove unneded files (NOT folder ...)
|
||||
@@ -677,48 +698,21 @@ class Module:
|
||||
else:
|
||||
debug.error("Dit not know the element type ... (impossible case) type=" + self.type)
|
||||
|
||||
def append_and_check(self, listout, newElement, order):
|
||||
for element in listout:
|
||||
if element==newElement:
|
||||
return
|
||||
listout.append(newElement)
|
||||
if True==order:
|
||||
listout.sort()
|
||||
|
||||
def append_to_internal_list2(self, listout, module, list, order=False):
|
||||
# add list in the Map
|
||||
if module not in listout:
|
||||
listout[module] = []
|
||||
# add elements...
|
||||
self.append_to_internal_list(listout[module], list, order)
|
||||
|
||||
def append_to_internal_list(self, out_list, in_list, order=False):
|
||||
if type(in_list) == str:
|
||||
self.append_and_check(out_list, in_list, order)
|
||||
elif type(in_list) == list:
|
||||
# mulyiple imput in the list ...
|
||||
for elem in in_list:
|
||||
self.append_and_check(out_list, elem, order)
|
||||
elif type(in_list) == dict:
|
||||
self.append_and_check(out_list, in_list, order)
|
||||
else:
|
||||
debug.warning("can not add in list other than {list/dict/str} : " + str(type(in_list)))
|
||||
|
||||
def add_module_depend(self, list):
|
||||
self.append_to_internal_list(self.depends, list, True)
|
||||
tools.list_append_to(self.depends, list, True)
|
||||
|
||||
def add_optionnal_module_depend(self, module_name, compilation_flags=["", ""], export=False):
|
||||
self.append_and_check(self.depends_optionnal, [module_name, compilation_flags, export], True)
|
||||
tools.list_append_and_check(self.depends_optionnal, [module_name, compilation_flags, export], True)
|
||||
|
||||
def add_path(self, list, type='c'):
|
||||
self.append_to_internal_list2(self.path["local"], type, list)
|
||||
tools.list_append_to_2(self.path["local"], type, list)
|
||||
|
||||
def add_export_flag(self, type, list):
|
||||
self.append_to_internal_list2(self.flags["export"], type, list)
|
||||
tools.list_append_to_2(self.flags["export"], type, list)
|
||||
|
||||
# add the link flag at the module
|
||||
def compile_flags(self, type, list):
|
||||
self.append_to_internal_list2(self.flags["local"], type, list)
|
||||
tools.list_append_to_2(self.flags["local"], type, list)
|
||||
|
||||
def compile_version(self, compilator_type, version, same_as_api=True, gnu=False):
|
||||
if compilator_type == "c++" \
|
||||
@@ -755,23 +749,28 @@ class Module:
|
||||
debug.warning("Can not set version of compilator:" + str(compilator_type));
|
||||
|
||||
def add_src_file(self, list):
|
||||
self.append_to_internal_list(self.src, list, True)
|
||||
tools.list_append_to(self.src, list, True)
|
||||
|
||||
def add_header_file(self, list, destination_path=None):
|
||||
if destination_path != None:
|
||||
debug.verbose("Change destination PATH: " + str(destination_path))
|
||||
debug.verbose("Change destination PATH: '" + str(destination_path) + "'")
|
||||
new_list = []
|
||||
for elem in list:
|
||||
if destination_path != None:
|
||||
new_list.append({"src":elem,
|
||||
"dst":os.path.join(destination_path, os.path.basename(elem))})
|
||||
base = os.path.basename(elem)
|
||||
if '*' in base or '[' in base or '(' in base:
|
||||
new_list.append({"src":elem,
|
||||
"multi-dst":destination_path})
|
||||
else:
|
||||
new_list.append({"src":elem,
|
||||
"dst":os.path.join(destination_path, base)})
|
||||
else:
|
||||
new_list.append({"src":elem,
|
||||
"dst":elem})
|
||||
self.append_to_internal_list(self.header, new_list, True)
|
||||
tools.list_append_to(self.header, new_list, True)
|
||||
|
||||
def add_export_path(self, list, type='c'):
|
||||
self.append_to_internal_list2(self.path["export"], type, list)
|
||||
tools.list_append_to_2(self.path["export"], type, list)
|
||||
|
||||
def copy_image(self, source, destination='', sizeX=-1, sizeY=-1):
|
||||
self.image_to_copy.append([source, destination, sizeX, sizeY])
|
||||
@@ -945,7 +944,7 @@ def import_path(path):
|
||||
module_name = filename.replace('.py', '')
|
||||
module_name = module_name.replace(__start_module_name, '')
|
||||
debug.debug("MODULE: Integrate module: '" + module_name + "' from '" + os.path.join(root, filename) + "'")
|
||||
module_list.append([module_name,os.path.join(root, filename)])
|
||||
module_list.append([module_name, os.path.join(root, filename)])
|
||||
debug.verbose("New list module: ")
|
||||
for mod in module_list:
|
||||
debug.verbose(" " + str(mod[0]))
|
||||
@@ -1040,7 +1039,7 @@ def get_module_option(the_module, name):
|
||||
if "get_type" in dir(the_module):
|
||||
type = the_module.get_type()
|
||||
else:
|
||||
debug.debug(" fundtion get_type() must be provided in the module: " + name)
|
||||
debug.debug(" function get_type() must be provided in the module: " + name)
|
||||
|
||||
if "get_sub_type" in dir(the_module):
|
||||
sub_type = the_module.get_sub_type()
|
||||
|
@@ -15,60 +15,33 @@ import datetime
|
||||
# Local import
|
||||
from . import debug
|
||||
from . import module
|
||||
from . import tools
|
||||
|
||||
class System:
|
||||
def __init__(self):
|
||||
self.valid=False;
|
||||
self.help="";
|
||||
self.include_cc=[]
|
||||
self.export_flags_cc=[]
|
||||
self.export_flags_xx=[]
|
||||
self.export_flags_mm=[]
|
||||
self.export_flags_m=[]
|
||||
self.export_flags_ar=[]
|
||||
self.export_flags_ld=[]
|
||||
self.export_flags_ld_shared=[]
|
||||
self.export_libs_ld=[]
|
||||
self.export_libs_ld_shared=[]
|
||||
self.export_depends=[]
|
||||
self.export_flags={}
|
||||
self.export_src=[]
|
||||
self.export_path=[]
|
||||
self.action_on_state={}
|
||||
|
||||
def append_and_check(self, listout, newElement, order):
|
||||
for element in listout:
|
||||
if element==newElement:
|
||||
return
|
||||
listout.append(newElement)
|
||||
if True==order:
|
||||
listout.sort()
|
||||
|
||||
def append_to_internal_list(self, listout, list, order=False):
|
||||
if type(list) == type(str()):
|
||||
self.append_and_check(listout, list, order)
|
||||
else:
|
||||
# mulyiple imput in the list ...
|
||||
for elem in list:
|
||||
self.append_and_check(listout, elem, order)
|
||||
def add_export_sources(self, list):
|
||||
tools.list_append_to(self.export_src, list)
|
||||
|
||||
def add_export_flag_LD(self, list):
|
||||
self.append_to_internal_list(self.export_flags_ld, list)
|
||||
# todo : add other than C ...
|
||||
def add_export_path(self, list):
|
||||
tools.list_append_to(self.export_path, list)
|
||||
|
||||
def add_export_flag_CC(self, list):
|
||||
self.append_to_internal_list(self.export_flags_cc, list)
|
||||
def add_module_depend(self, list):
|
||||
tools.list_append_to(self.export_depends, list, True)
|
||||
|
||||
def add_export_flag_XX(self, list):
|
||||
self.append_to_internal_list(self.export_flags_xx, list)
|
||||
|
||||
def add_export_flag_M(self, list):
|
||||
self.append_to_internal_list(self.export_flags_m, list)
|
||||
|
||||
def add_export_flag_MM(self, list):
|
||||
self.append_to_internal_list(self.export_flags_mm, list)
|
||||
|
||||
def add_export_SRC(self, list):
|
||||
self.append_to_internal_list(self.export_src, list)
|
||||
def add_export_flag(self, type, list):
|
||||
tools.list_append_to_2(self.export_flags, type, list)
|
||||
|
||||
def add_action(self, name_of_state="PACKAGE", level=5, name="no-name", action=None):
|
||||
if name_of_state not in self.action_on_state:
|
||||
if name_of_state not in self.action_on_add_src_filestate:
|
||||
self.action_on_state[name_of_state] = [[level, name, action]]
|
||||
else:
|
||||
self.action_on_state[name_of_state].append([level, name, action])
|
||||
@@ -76,16 +49,19 @@ class System:
|
||||
|
||||
|
||||
|
||||
def createModuleFromSystem(target, dict):
|
||||
def create_module_from_system(target, dict):
|
||||
myModule = module.Module(dict["path"], dict["name"], 'PREBUILD')
|
||||
|
||||
myModule.add_export_flag('c', dict["system"].export_flags_cc)
|
||||
myModule.add_export_flag('link', dict["system"].export_flags_ld)
|
||||
myModule.add_export_flag('c++', dict["system"].export_flags_xx)
|
||||
myModule.add_export_flag('m', dict["system"].export_flags_m)
|
||||
myModule.add_export_flag('mm', dict["system"].export_flags_mm)
|
||||
# add element flags to export
|
||||
for elem in dict["system"].export_flags:
|
||||
debug.verbose("add element :" + str(elem) + " elems=" + str(dict["system"].export_flags[elem]))
|
||||
myModule.add_export_flag(elem, dict["system"].export_flags[elem])
|
||||
# add module dependency
|
||||
myModule.add_module_depend(dict["system"].export_depends)
|
||||
# add exporting sources
|
||||
myModule.add_src_file(dict["system"].export_src)
|
||||
|
||||
# add export path
|
||||
myModule.add_export_path(dict["system"].export_path)
|
||||
# Export all actions ...
|
||||
for elem in dict["system"].action_on_state:
|
||||
level, name, action = dict["system"].action_on_state[elem]
|
||||
target.add_action(elem, level, name, action)
|
||||
@@ -172,7 +148,7 @@ def load(target, lib_name, target_name):
|
||||
debug.error("you must call this function after checking of the system exist() !2!")
|
||||
if data["module"] == None:
|
||||
# create a module from the system interface...
|
||||
data["module"] = createModuleFromSystem(target, data)
|
||||
data["module"] = create_module_from_system(target, data)
|
||||
data["loaded"] = True
|
||||
target.add_module(data["module"])
|
||||
return
|
||||
|
@@ -54,11 +54,11 @@ class Target:
|
||||
# Target global variables.
|
||||
###############################################################################
|
||||
self.global_include_cc=[]
|
||||
"""
|
||||
self.global_flags_cc=['-D__TARGET_OS__'+self.name,
|
||||
'-D__TARGET_ARCH__'+self.select_arch,
|
||||
'-D__TARGET_ADDR__'+self.select_bus + 'BITS',
|
||||
'-D_REENTRANT']
|
||||
|
||||
self.global_flags_xx=[]
|
||||
self.global_flags_mm=[]
|
||||
if self.name == "Windows":
|
||||
@@ -68,6 +68,9 @@ class Target:
|
||||
self.global_flags_ar=['rcs']
|
||||
self.global_flags_ld=[]
|
||||
self.global_flags_ld_shared=[]
|
||||
"""
|
||||
self.global_flags={}
|
||||
|
||||
self.global_libs_ld=[]
|
||||
self.global_libs_ld_shared=[]
|
||||
|
||||
@@ -86,28 +89,42 @@ class Target:
|
||||
self.path_generate_code="/generate_header"
|
||||
self.path_arch="/" + self.name
|
||||
|
||||
self.add_flag("c", [
|
||||
'-D__TARGET_OS__' + self.name,
|
||||
'-D__TARGET_ARCH__' + self.select_arch,
|
||||
'-D__TARGET_ADDR__' + self.select_bus + 'BITS',
|
||||
'-D_REENTRANT'
|
||||
])
|
||||
self.add_flag("c++", "-nostdlib")
|
||||
self.add_flag("ar", 'rcs')
|
||||
|
||||
if self.name == "Windows":
|
||||
self.add_flag("c++", ['-static-libgcc', '-static-libstdc++'])
|
||||
|
||||
if "debug" == self.config["mode"]:
|
||||
self.global_flags_cc.append("-g")
|
||||
self.global_flags_cc.append("-DDEBUG")
|
||||
self.global_flags_cc.append("-O0")
|
||||
self.add_flag("c", [
|
||||
"-g",
|
||||
"-DDEBUG",
|
||||
"-O0"
|
||||
])
|
||||
else:
|
||||
self.global_flags_cc.append("-DNDEBUG")
|
||||
self.global_flags_cc.append("-O3")
|
||||
self.add_flag("c", [
|
||||
"-DNDEBUG",
|
||||
"-O3"
|
||||
])
|
||||
|
||||
## To add code coverate on build result system
|
||||
if self.config["gcov"] == True:
|
||||
self.global_flags_cc.append("-fprofile-arcs")
|
||||
self.global_flags_cc.append("-ftest-coverage")
|
||||
self.global_flags_ld.append("-fprofile-arcs")
|
||||
self.global_flags_ld.append("-ftest-coverage")
|
||||
self.add_flag("c", [
|
||||
"-fprofile-arcs",
|
||||
"-ftest-coverage"
|
||||
])
|
||||
self.add_flag("link", [
|
||||
"-fprofile-arcs",
|
||||
"-ftest-coverage"
|
||||
])
|
||||
|
||||
self.update_path_tree()
|
||||
"""
|
||||
self.path_bin="usr/bin"
|
||||
self.path_lib="usr/lib"
|
||||
self.path_data="usr/share"
|
||||
self.path_doc="usr/share/doc"
|
||||
"""
|
||||
self.path_bin="bin"
|
||||
self.path_lib="lib"
|
||||
self.path_data="share"
|
||||
@@ -134,6 +151,11 @@ class Target:
|
||||
self.pkg_path_readme_file = "readme.txt"
|
||||
self.pkg_path_change_log_file = "changelog.txt"
|
||||
|
||||
# special case for IOS (example) no build dynamicly ...
|
||||
self.support_dynamic_link = True
|
||||
|
||||
def add_flag(self, type, list):
|
||||
tools.list_append_to_2(self.global_flags, type, list)
|
||||
|
||||
def update_path_tree(self):
|
||||
self.path_out = os.path.join("out", self.name + "_" + self.config["arch"] + "_" + self.config["bus-size"], self.config["mode"])
|
||||
@@ -142,6 +164,9 @@ class Target:
|
||||
self.path_build = os.path.join("build", self.config["compilator"])
|
||||
|
||||
def create_number_from_version_string(self, data):
|
||||
tmp_data = data.split("-")
|
||||
if len(tmp_data) > 1:
|
||||
data = tmp_data[0]
|
||||
list = data.split(".")
|
||||
if len(list) == 1:
|
||||
list.append("0")
|
||||
@@ -528,9 +553,9 @@ class Target:
|
||||
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)
|
||||
self.make_package_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)
|
||||
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");
|
||||
return
|
||||
|
@@ -50,6 +50,8 @@ def remove_path_and_sub_path(path):
|
||||
def remove_file(path):
|
||||
if os.path.isfile(path):
|
||||
os.remove(path)
|
||||
elif os.path.islink(path):
|
||||
os.remove(path)
|
||||
|
||||
def file_size(path):
|
||||
if not os.path.isfile(path):
|
||||
@@ -91,6 +93,7 @@ def file_write_data(path, data, only_if_new=False):
|
||||
if old_data == data:
|
||||
return
|
||||
#real write of data:
|
||||
create_directory_of_file(path)
|
||||
file = open(path, "w")
|
||||
file.write(data)
|
||||
file.close()
|
||||
@@ -297,3 +300,31 @@ def store_warning(file, output, err):
|
||||
file2.close()
|
||||
|
||||
|
||||
## List tools:
|
||||
def list_append_and_check(listout, newElement, order):
|
||||
for element in listout:
|
||||
if element==newElement:
|
||||
return
|
||||
listout.append(newElement)
|
||||
if order == True:
|
||||
if type(newElement) is not dict:
|
||||
listout.sort()
|
||||
|
||||
def list_append_to(out_list, in_list, order=False):
|
||||
if type(in_list) == str:
|
||||
list_append_and_check(out_list, in_list, order)
|
||||
elif type(in_list) == list:
|
||||
# mulyiple imput in the list ...
|
||||
for elem in in_list:
|
||||
list_append_and_check(out_list, elem, order)
|
||||
elif type(in_list) == dict:
|
||||
list_append_and_check(out_list, in_list, order)
|
||||
else:
|
||||
debug.warning("can not add in list other than {list/dict/str} : " + str(type(in_list)))
|
||||
|
||||
def list_append_to_2(listout, module, list, order=False):
|
||||
# add list in the Map
|
||||
if module not in listout:
|
||||
listout[module] = []
|
||||
# add elements...
|
||||
list_append_to(listout[module], list, order)
|
@@ -40,7 +40,7 @@ def get_output_type():
|
||||
##
|
||||
## @brief Commands for running gcc to link an executable.
|
||||
##
|
||||
def link(file, binary, target, depancy, name, basic_path, static = False):
|
||||
def link(file, binary, target, depancy, flags, name, basic_path, static = False):
|
||||
file_src, file_dst, file_depend, file_cmd, file_warning = target.generate_file(binary, name, basic_path, file, "bin")
|
||||
debug.extreme_verbose("list files = " + str(depancy.src))
|
||||
list_static = []
|
||||
@@ -99,9 +99,10 @@ 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)]
|
||||
cmd.append("-L" + lib_path)
|
||||
cmd.append("-l" + lib_name)
|
||||
if len(list_dynamic) > 0:
|
||||
cmd.append("-Wl,-R$ORIGIN/../lib/")
|
||||
pass
|
||||
if target.name != "MacOs" \
|
||||
and target.name != "Android":
|
||||
if len(list_dynamic) > 0:
|
||||
cmd.append("-Wl,-R$ORIGIN/../lib/")
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
|
@@ -68,7 +68,7 @@ def compile(file, binary, target, depancy, flags, path, name, basic_path, module
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
cmd.append(target.global_flags_cc)
|
||||
cmd.append(target.global_flags["c"])
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
|
@@ -36,6 +36,13 @@ def get_input_type():
|
||||
def get_output_type():
|
||||
return ["o"]
|
||||
|
||||
def remove_element(data, to_remove):
|
||||
out = []
|
||||
for elem in data:
|
||||
if elem not in to_remove:
|
||||
out.append(elem)
|
||||
return out;
|
||||
|
||||
##
|
||||
## @brief Commands for running gcc to compile a C++ file in object file.
|
||||
##
|
||||
@@ -68,29 +75,53 @@ def compile(file, binary, target, depancy, flags, path, name, basic_path, module
|
||||
cmd.append(get_version_compilation_flags(flags, depancy.flags))
|
||||
except:
|
||||
pass
|
||||
list_flags = [];
|
||||
try:
|
||||
cmd.append(target.global_flags_cc)
|
||||
list_flags.append(target.global_flags["c"])
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
cmd.append(target.global_flags_xx)
|
||||
list_flags.append(target.global_flags["c++"])
|
||||
except:
|
||||
pass
|
||||
for type in ["c", "c++"]:
|
||||
try:
|
||||
cmd.append(depancy.flags[type])
|
||||
list_flags.append(depancy.flags[type])
|
||||
except:
|
||||
pass
|
||||
for view in ["local", "export"]:
|
||||
for type in ["c", "c++"]:
|
||||
try:
|
||||
cmd.append(flags[view][type])
|
||||
list_flags.append(flags[view][type])
|
||||
except:
|
||||
pass
|
||||
# get blacklist of flags
|
||||
list_flags_blacklist = [];
|
||||
try:
|
||||
list_flags_blacklist.append(target.global_flags["c-remove"])
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
list_flags_blacklist.append(target.global_flags["c++-remove"])
|
||||
except:
|
||||
pass
|
||||
for type in ["c-remove", "c++-remove"]:
|
||||
try:
|
||||
list_flags_blacklist.append(depancy.flags[type])
|
||||
except:
|
||||
pass
|
||||
for view in ["local", "export"]:
|
||||
for type in ["c-remove", "c++-remove"]:
|
||||
try:
|
||||
list_flags_blacklist.append(flags[view][type])
|
||||
except:
|
||||
pass
|
||||
# apply blacklisting of data and add it on the cmdLine
|
||||
cmd.append(remove_element(list_flags, list_flags_blacklist));
|
||||
cmd.append(["-c", "-MMD", "-MP"])
|
||||
cmd.append(file_src)
|
||||
# Create cmd line
|
||||
cmdLine=tools.list_to_str(cmd)
|
||||
cmdLine = tools.list_to_str(cmd)
|
||||
# check the dependency for this file :
|
||||
if depend.need_re_build(file_dst, file_src, file_depend, file_cmd, cmdLine) == False:
|
||||
return {"action":"add", "file":file_dst}
|
||||
|
@@ -38,7 +38,7 @@ def get_output_type():
|
||||
##
|
||||
## @brief Commands for running gcc to link a shared library.
|
||||
##
|
||||
def link(file, binary, target, depancy, name, basic_path):
|
||||
def link(file, binary, target, depancy, flags, name, basic_path):
|
||||
file_src, file_dst, file_depend, file_cmd, file_warning = target.generate_file(binary, name, basic_path, file, "jar")
|
||||
#create command Line
|
||||
cmd = [
|
||||
|
@@ -38,7 +38,7 @@ def get_output_type():
|
||||
##
|
||||
## @brief Commands for running gcc to link a shared library.
|
||||
##
|
||||
def link(file, binary, target, depancy, name, basic_path, static=False):
|
||||
def link(file, binary, target, depancy, flags, name, basic_path, static=False):
|
||||
file_src, file_dst, file_depend, file_cmd, file_warning = target.generate_file(binary, name, basic_path, file, "lib-shared")
|
||||
list_static = []
|
||||
list_dynamic = []
|
||||
@@ -91,7 +91,7 @@ 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)]
|
||||
cmd.append("-L" + lib_path)
|
||||
cmd.append("-l" + lib_name)
|
||||
if target != "MacOs" \
|
||||
if target.name != "MacOs" \
|
||||
and target.name != "Android":
|
||||
if len(list_dynamic) > 0:
|
||||
cmd.append("-Wl,-R$ORIGIN/../lib/")
|
||||
@@ -101,12 +101,16 @@ def link(file, binary, target, depancy, name, basic_path, static=False):
|
||||
cmd.append(flags["local"]["link"])
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
cmd.append(flags["export"]["link"])
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
cmd.append(depancy.flags["link"])
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
cmd.append(target.global_flags_ld)
|
||||
cmd.append(target.global_flags["link"])
|
||||
except:
|
||||
pass
|
||||
cmdLine=tools.list_to_str(cmd)
|
||||
@@ -123,9 +127,15 @@ def link(file, binary, target, depancy, name, basic_path, static=False):
|
||||
# get the file size of the non strip file
|
||||
originSize = tools.file_size(file_dst);
|
||||
debug.print_element("SharedLib(strip)", name, "", "")
|
||||
cmdLineStrip=tools.list_to_str([
|
||||
target.strip,
|
||||
file_dst])
|
||||
if target.name == "MacOs":
|
||||
cmdLineStrip=tools.list_to_str([
|
||||
target.strip,
|
||||
"-u",
|
||||
file_dst])
|
||||
else:
|
||||
cmdLineStrip=tools.list_to_str([
|
||||
target.strip,
|
||||
file_dst])
|
||||
multiprocess.run_command(cmdLineStrip, store_output_file=file_warning)
|
||||
# get the stip size of the binary
|
||||
stripSize = tools.file_size(file_dst)
|
||||
|
@@ -38,14 +38,14 @@ def get_output_type():
|
||||
##
|
||||
## @brief Commands for running ar.
|
||||
##
|
||||
def link(file, binary, target, depancy, name, basic_path):
|
||||
def link(file, binary, target, depancy, flags, name, basic_path):
|
||||
file_src, file_dst, file_depend, file_cmd, file_warning = target.generate_file(binary, name, basic_path, file, "lib-static")
|
||||
#$(Q)$(TARGET_AR) $(TARGET_GLOBAL_ARFLAGS) $(PRIVATE_ARFLAGS) $@ $(PRIVATE_ALL_OBJECTS)
|
||||
cmd = [
|
||||
target.ar
|
||||
]
|
||||
try:
|
||||
cmd.append(target.global_flags_ar)
|
||||
cmd.append(target.global_flags["ar"])
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
|
@@ -70,11 +70,11 @@ def compile(file, binary, target, depancy, flags, path, name, basic_path, module
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
cmd.append(target.global_flags_cc)
|
||||
cmd.append(target.global_flags["c"])
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
cmd.append(target.global_flags_m)
|
||||
cmd.append(target.global_flags["m"])
|
||||
except:
|
||||
pass
|
||||
for type in ["c", "m"]:
|
||||
|
@@ -69,14 +69,11 @@ def compile(file, binary, target, depancy, flags, path, name, basic_path, module
|
||||
cmd.append(local_ref_on_builder_cpp.get_version_compilation_flags(flags, depancy.flags))
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
cmd.append(target.global_flags_cc)
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
cmd.append(target.global_flags_mm)
|
||||
except:
|
||||
pass
|
||||
for type in ["c", "c++", "m", "mm"]:
|
||||
try:
|
||||
cmd.append(target.global_flags[type])
|
||||
except:
|
||||
pass
|
||||
for type in ["c", "c++", "m", "mm"]:
|
||||
try:
|
||||
cmd.append(depancy.flags[type])
|
||||
|
@@ -20,7 +20,7 @@ class System(system.System):
|
||||
# todo : Check if present ...
|
||||
self.valid = True
|
||||
# todo : create a searcher of the presence of the library:
|
||||
self.add_export_SRC(target.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar")
|
||||
self.add_export_sources(target.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/libs/google-play-services.jar")
|
||||
self.add_action("PACKAGE", 10, "admod-auto-wrapper", tool_generate_main_java_class)
|
||||
|
||||
|
||||
|
@@ -17,12 +17,14 @@ class System(system.System):
|
||||
system.System.__init__(self)
|
||||
# create some HELP:
|
||||
self.help="SDK: Android SDK basic interface java\n"
|
||||
# jar file:
|
||||
jar_file_path=os.path.join(target.path_sdk, "platforms", "android-" + str(target.board_id), "android.jar")
|
||||
# TODO : Check if the android sdk android.jar is present ...
|
||||
self.valid = True
|
||||
# todo : create a searcher of the presence of the library:
|
||||
self.add_export_SRC(target.path_sdk + "/platforms/android-" + str(target.boardId) + "/android.jar")
|
||||
self.add_export_flag_LD("-ldl")
|
||||
self.add_export_flag_LD("-llog")
|
||||
self.add_export_flag_LD("-landroid")
|
||||
self.add_export_sources(jar_file_path)
|
||||
self.add_export_flag("link", "-ldl")
|
||||
self.add_export_flag("link", "-llog")
|
||||
self.add_export_flag("link", "-landroid")
|
||||
|
||||
|
||||
|
74
lutin/z_system/lutinSystem_Android_cxx.py
Normal file
74
lutin/z_system/lutinSystem_Android_cxx.py
Normal file
@@ -0,0 +1,74 @@
|
||||
#!/usr/bin/python
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||
##
|
||||
## @license APACHE v2.0 (see license file)
|
||||
##
|
||||
|
||||
from lutin import debug
|
||||
from lutin import system
|
||||
from lutin import tools
|
||||
import os
|
||||
|
||||
class System(system.System):
|
||||
def __init__(self, target):
|
||||
system.System.__init__(self)
|
||||
# create some HELP:
|
||||
self.help = "CXX: Generic C++ library"
|
||||
self.valid = True
|
||||
if target.config["compilator"] == "clang":
|
||||
if target.board_id < 21:
|
||||
debug.error("Clang work only with the board wersion >= 21 : android 5.x.x")
|
||||
self.valid = False
|
||||
return
|
||||
self.add_export_flag("c++", "-D__STDCPP_LLVM__")
|
||||
# llvm is BSD-like licence
|
||||
self.add_export_path(os.path.join(target.path_ndk, "sources", "cxx-stl", "llvm-libc++", "libcxx", "include"))
|
||||
if target.type_arch == "armv5":
|
||||
stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "llvm-libc++", "libcxx", "libs", "armeabi")
|
||||
self.add_export_path( os.path.join(stdCppBasePath, "include"))
|
||||
self.add_export_flag("link", os.path.join(stdCppBasePath, "libc++_static.a"))
|
||||
elif target.type_arch == "armv7":
|
||||
stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "llvm-libc++", "libs", "armeabi-v7a")
|
||||
self.add_export_path( os.path.join(stdCppBasePath + "include"))
|
||||
self.add_export_flag("link", os.path.join(stdCppBasePath, "thumb", "libc++_static.a"))
|
||||
elif target.type_arch == "mips":
|
||||
stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "llvm-libc++", "libcxx", "libs", "mips")
|
||||
self.add_export_path( os.path.join(stdCppBasePath + "include"))
|
||||
self.add_export_flag("link", os.path.join(stdCppBasePath + "libc++_static.a"))
|
||||
elif target.type_arch == "x86":
|
||||
stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "llvm-libc++", "libcxx", "libs", "x86")
|
||||
self.add_export_path( os.path.join(stdCppBasePath, "include"))
|
||||
self.add_export_flag("link", os.path.join(stdCppBasePath, "libc++_static.a"))
|
||||
else:
|
||||
debug.warning("unknow architecture: '" + str(target.arch) + "'");
|
||||
else:
|
||||
self.add_export_flag("c++", "-D__STDCPP_GNU__")
|
||||
self.add_export_flag("c++-remove","-nostdlib")
|
||||
# GPL v3 (+ exception link for gcc compilator)
|
||||
self.add_export_path(os.path.join(target.path_ndk, "sources", "cxx-stl", "gnu-libstdc++", target.compilator_version, "include"))
|
||||
if target.type_arch == "armv5":
|
||||
stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "gnu-libstdc++", target.compilator_version, "libs", "armeabi")
|
||||
self.add_export_path( os.path.join(stdCppBasePath, "include"))
|
||||
self.add_export_flag("link", os.path.join(stdCppBasePath, "thumb", "libgnustl_static.a"))
|
||||
self.add_export_flag("link", os.path.join(stdCppBasePath, "thumb", "libsupc++.a"))
|
||||
elif target.type_arch == "armv7":
|
||||
stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "gnu-libstdc++", target.compilator_version, "libs", "armeabi-v7a")
|
||||
self.add_export_path( os.path.join(stdCppBasePath, "include"))
|
||||
self.add_export_flag("link", os.path.join(stdCppBasePath, "thumb", "libgnustl_static.a"))
|
||||
self.add_export_flag("link", os.path.join(stdCppBasePath, "thumb", "libsupc++.a"))
|
||||
elif target.type_arch == "mips":
|
||||
stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "gnu-libstdc++", target.compilator_version, "libs", "mips")
|
||||
self.add_export_path( os.path.join(stdCppBasePath, "include/"))
|
||||
self.add_export_flag("link", os.path.join(stdCppBasePath, "libgnustl_static.a"))
|
||||
self.add_export_flag("link", os.path.join(stdCppBasePath, "libsupc++.a"))
|
||||
elif target.type_arch == "x86":
|
||||
stdCppBasePath = os.path.join(target.path_ndk, "sources", "cxx-stl", "gnu-libstdc++", target.compilator_version, "libs", "x86")
|
||||
self.add_export_path( os.path.join(stdCppBasePath, "include"))
|
||||
self.add_export_flag("link", os.path.join(stdCppBasePath, "libgnustl_static.a"))
|
||||
self.add_export_flag("link", os.path.join(stdCppBasePath, "libsupc++.a"))
|
||||
else:
|
||||
debug.warning("unknow architecture: '" + str(target.arch) + "'");
|
||||
debug.warning("plop")
|
@@ -19,7 +19,7 @@ class System(system.System):
|
||||
self.help="CoreAudio : Ios interface for audio (all time present, just system interface)"
|
||||
self.valid = True
|
||||
# todo : create a searcher of the presence of the library:
|
||||
self.add_export_flag_LD("-framework CoreAudio")
|
||||
self.add_export_flag_LD("-framework AudioToolbox")
|
||||
self.add_export_flag("link", "-framework CoreAudio")
|
||||
self.add_export_flag("link", "-framework AudioToolbox")
|
||||
|
||||
|
||||
|
25
lutin/z_system/lutinSystem_IOs_cxx.py
Normal file
25
lutin/z_system/lutinSystem_IOs_cxx.py
Normal file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/python
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||
##
|
||||
## @license APACHE v2.0 (see license file)
|
||||
##
|
||||
|
||||
from lutin import debug
|
||||
from lutin import system
|
||||
from lutin import tools
|
||||
import os
|
||||
|
||||
class System(system.System):
|
||||
def __init__(self, target):
|
||||
system.System.__init__(self)
|
||||
# create some HELP:
|
||||
self.help = "CXX: Generic C++ library"
|
||||
self.valid = True
|
||||
# no check needed ==> just add this:
|
||||
self.add_export_flag("c++","-D__STDCPP_LLVM__")
|
||||
self.add_export_flag("c++-remove","-nostdlib")
|
||||
|
||||
|
@@ -24,6 +24,6 @@ class System(system.System):
|
||||
return;
|
||||
self.valid = True
|
||||
# todo : create a searcher of the presence of the library:
|
||||
self.add_export_flag_LD("-lasound")
|
||||
self.add_export_flag("link", "-lasound")
|
||||
|
||||
|
||||
|
@@ -23,7 +23,7 @@ class System(system.System):
|
||||
return;
|
||||
self.valid = True
|
||||
# todo : create a searcher of the presence of the library:
|
||||
self.add_export_flag_LD([
|
||||
self.add_export_flag("link", [
|
||||
"-lboost_system",
|
||||
"-lboost_thread",
|
||||
"-lboost_chrono"
|
||||
|
25
lutin/z_system/lutinSystem_Linux_cxx.py
Normal file
25
lutin/z_system/lutinSystem_Linux_cxx.py
Normal file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/python
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||
##
|
||||
## @license APACHE v2.0 (see license file)
|
||||
##
|
||||
|
||||
from lutin import debug
|
||||
from lutin import system
|
||||
from lutin import tools
|
||||
import os
|
||||
|
||||
class System(system.System):
|
||||
def __init__(self, target):
|
||||
system.System.__init__(self)
|
||||
# create some HELP:
|
||||
self.help = "CXX: Generic C++ library"
|
||||
self.valid = True
|
||||
# no check needed ==> just add this:
|
||||
self.add_export_flag("c++","-D__STDCPP_GNU__")
|
||||
self.add_export_flag("c++-remove","-nostdlib")
|
||||
|
||||
|
@@ -23,6 +23,6 @@ class System(system.System):
|
||||
return;
|
||||
self.valid = True
|
||||
# todo : create a searcher of the presence of the library:
|
||||
self.add_export_flag_LD("-ljack")
|
||||
self.add_export_flag("link", "-ljack")
|
||||
|
||||
|
||||
|
@@ -24,7 +24,7 @@ class System(system.System):
|
||||
return;
|
||||
self.valid = True
|
||||
# todo : create a searcher of the presence of the library:
|
||||
self.add_export_flag_CC("-ljack")
|
||||
self.add_export_flag("link", "-ljack")
|
||||
"""
|
||||
|
||||
|
||||
|
@@ -23,6 +23,6 @@ class System(system.System):
|
||||
return;
|
||||
self.valid = True
|
||||
# todo : create a searcher of the presence of the library:
|
||||
self.add_export_flag_LD(["-lpulse-simple", "-lpulse"])
|
||||
self.add_export_flag("link", ["-lpulse-simple", "-lpulse"])
|
||||
|
||||
|
||||
|
@@ -23,6 +23,6 @@ class System(system.System):
|
||||
return;
|
||||
self.valid = True
|
||||
# todo : create a searcher of the presence of the library:
|
||||
self.add_export_flag_LD(["-lz"])
|
||||
self.add_export_flag("link", "-lz")
|
||||
|
||||
|
||||
|
@@ -19,6 +19,6 @@ class System(system.System):
|
||||
self.help="CoreAudio : MacOs interface for audio (all time present, just system interface)"
|
||||
self.valid = True
|
||||
# todo : create a searcher of the presence of the library:
|
||||
self.add_export_flag_LD("-framework CoreAudio")
|
||||
self.add_export_flag_LD("-framework CoreFoundation")
|
||||
self.add_export_flag("link", "-framework CoreAudio")
|
||||
self.add_export_flag("link", "-framework CoreFoundation")
|
||||
|
||||
|
25
lutin/z_system/lutinSystem_MacOs_cxx.py
Normal file
25
lutin/z_system/lutinSystem_MacOs_cxx.py
Normal file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/python
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||
##
|
||||
## @license APACHE v2.0 (see license file)
|
||||
##
|
||||
|
||||
from lutin import debug
|
||||
from lutin import system
|
||||
from lutin import tools
|
||||
import os
|
||||
|
||||
class System(system.System):
|
||||
def __init__(self, target):
|
||||
system.System.__init__(self)
|
||||
# create some HELP:
|
||||
self.help = "CXX: Generic C++ library"
|
||||
self.valid = True
|
||||
# no check needed ==> just add this:
|
||||
self.add_export_flag("c++","-D__STDCPP_LLVM__")
|
||||
self.add_export_flag("c++-remove","-nostdlib")
|
||||
|
||||
|
31
lutin/z_system/lutinSystem_Windows_cxx.py
Normal file
31
lutin/z_system/lutinSystem_Windows_cxx.py
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/python
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||
##
|
||||
## @license APACHE v2.0 (see license file)
|
||||
##
|
||||
|
||||
from lutin import debug
|
||||
from lutin import system
|
||||
from lutin import tools
|
||||
import os
|
||||
|
||||
class System(system.System):
|
||||
def __init__(self, target):
|
||||
system.System.__init__(self)
|
||||
# create some HELP:
|
||||
self.help = "CXX: Generic C++ library"
|
||||
self.valid = True
|
||||
# no check needed ==> just add this:
|
||||
self.add_export_flag("c++","-D__STDCPP_GNU__")
|
||||
self.add_export_flag("c++-remove","-nostdlib")
|
||||
# force static link to prenvent many errors ...
|
||||
self.add_export_flag("link", [
|
||||
"-static-libgcc",
|
||||
"-static-libstdc++",
|
||||
"-static"
|
||||
])
|
||||
|
||||
|
@@ -23,9 +23,10 @@ class System(system.System):
|
||||
return;
|
||||
self.valid = True
|
||||
# todo : create a searcher of the presence of the library:
|
||||
self.add_export_flag_LD(["-ldsound",
|
||||
"-lwinmm",
|
||||
"-lole32"
|
||||
])
|
||||
self.add_export_flag("link",[
|
||||
"-ldsound",
|
||||
"-lwinmm",
|
||||
"-lole32"
|
||||
])
|
||||
|
||||
|
||||
|
@@ -25,13 +25,14 @@ class Target(target.Target):
|
||||
#bus size selection (auto/32/64)
|
||||
if config["bus-size"] == "auto":
|
||||
config["bus-size"] = "32"
|
||||
arch = ""
|
||||
target.Target.__init__(self, "Android", config, arch)
|
||||
self.type_arch = ""
|
||||
target.Target.__init__(self, "Android", config, self.type_arch)
|
||||
|
||||
debug.warning("plop " + str(self.ar))
|
||||
if config["bus-size"] == "32":
|
||||
arch="armv7"
|
||||
self.type_arch="armv7"
|
||||
else:
|
||||
arch="arm64"
|
||||
self.type_arch="arm64"
|
||||
|
||||
self.path_ndk = os.getenv('PROJECT_NDK', "AUTO")
|
||||
self.path_sdk = os.getenv('PROJECT_SDK', "AUTO")
|
||||
@@ -60,10 +61,14 @@ class Target(target.Target):
|
||||
|
||||
tmpOsVal = "64"
|
||||
gccVersion = "4.9"
|
||||
# TODO : Remove this or set it better ...
|
||||
self.compilator_version = gccVersion
|
||||
if host.BUS_SIZE==64:
|
||||
tmpOsVal = "_64"
|
||||
if self.config["compilator"] == "clang":
|
||||
self.set_cross_base(self.path_ndk + "/toolchains/llvm-3.6/prebuilt/linux-x86" + tmpOsVal + "/bin/")
|
||||
# Patch for LLVM AR tool
|
||||
self.ar = self.cross + "llvm-ar"
|
||||
else:
|
||||
basepathArm = self.path_ndk + "/toolchains/arm-linux-androideabi-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/"
|
||||
basepathMips = self.path_ndk + "/toolchains/mipsel-linux-android-" + gccVersion + "/prebuilt/linux-x86" + tmpOsVal + "/bin/"
|
||||
@@ -87,120 +92,119 @@ class Target(target.Target):
|
||||
self.pkg_path_lib = "data/lib/armeabi"
|
||||
self.pkg_path_license = "license"
|
||||
|
||||
# board id at 15 is for android 4.0.3 and more ... (note: API 14 has been removed ...)
|
||||
self.boardId = 15
|
||||
self.global_flags_cc.append("-D__ANDROID_BOARD_ID__=" + str(self.boardId))
|
||||
if arch == "armv5" or arch == "armv7":
|
||||
self.global_include_cc.append("-I" + self.path_ndk +"/platforms/android-" + str(self.boardId) + "/arch-arm/usr/include/")
|
||||
elif arch == "mips":
|
||||
self.global_include_cc.append("-I" + self.path_ndk +"/platforms/android-" + str(self.boardId) + "/arch-mips/usr/include/")
|
||||
elif arch == "x86":
|
||||
self.global_include_cc.append("-I" + self.path_ndk +"/platforms/android-" + str(self.boardId) + "/arch-x86/usr/include/")
|
||||
# If the env variable is not define, find the newest version of the BOARD_ID (Note: 0: autofind)
|
||||
self.board_id = int(os.getenv('PROJECT_NDK_BOARD_ID', "0"))
|
||||
if self.board_id != 0:
|
||||
# check if element existed :
|
||||
if not os.path.isdir(self.path_sdk +"/platforms/android-" + str(self.board_id)):
|
||||
debug.error("Specify PROJECT_NDK_BOARD_ID env variable and the BOARD_ID does not exit ... : " + str(self.board_id) + "==> auto-search")
|
||||
self.board_id = 0
|
||||
if self.board_id == 0:
|
||||
debug.debug("Auto-search BOARD-ID")
|
||||
for iii in reversed(range(0, 50)):
|
||||
debug.debug("try: " + os.path.join(self.path_sdk, "platforms", "android-" + str(iii)))
|
||||
if os.path.isdir(os.path.join(self.path_sdk, "platforms", "android-" + str(iii))):
|
||||
debug.debug("Find BOARD-ID : " + str(iii))
|
||||
self.board_id = iii
|
||||
break;
|
||||
if self.board_id == 0:
|
||||
debug.error("Can not find BOARD-ID ==> update your android SDK")
|
||||
|
||||
if True:
|
||||
if self.config["compilator"] == "clang":
|
||||
if self.boardId < 21:
|
||||
debug.error("Clang work only with the board wersion >= 21 : android 5.x.x")
|
||||
self.global_flags_cc.append("-D__STDCPP_LLVM__")
|
||||
# llvm-libc++ : BSD | MIT
|
||||
self.global_include_cc.append("-gcc-toolchain " + self.path_ndk +"/sources/android/support/include")
|
||||
self.global_include_cc.append("-I" + self.path_ndk +"/sources/android/support/include")
|
||||
self.global_include_cc.append("-I" + self.path_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/include/")
|
||||
if arch == "armv5":
|
||||
stdCppBasePath = self.path_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/libs/armeabi/"
|
||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
||||
self.global_flags_ld.append( stdCppBasePath + "libc++_static.a")
|
||||
elif arch == "armv7":
|
||||
# The only one tested ... ==> but we have link error ...
|
||||
self.global_flags_cc.append("-target armv7-none-linux-androideabi")
|
||||
self.global_flags_cc.append("-march=armv7-a")
|
||||
self.global_flags_cc.append("-mfpu=vfpv3-d16")
|
||||
self.global_flags_cc.append("-mhard-float")
|
||||
stdCppBasePath = self.path_ndk +"/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/"
|
||||
self.global_flags_ld.append( stdCppBasePath + "thumb/libc++_static.a")
|
||||
self.global_flags_ld.append("-target armv7-none-linux-androideabi")
|
||||
self.global_flags_ld.append("-Wl,--fix-cortex-a8")
|
||||
self.global_flags_ld.append("-Wl,--no-warn-mismatch")
|
||||
self.global_flags_ld.append("-lm_hard")
|
||||
elif arch == "mips":
|
||||
stdCppBasePath = self.path_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/libs/mips/"
|
||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
||||
self.global_flags_ld.append( stdCppBasePath + "libc++_static.a")
|
||||
elif arch == "x86":
|
||||
stdCppBasePath = self.path_ndk +"/sources/cxx-stl/llvm-libc++/libcxx/libs/x86/"
|
||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
||||
self.global_flags_ld.append( stdCppBasePath + "libc++_static.a")
|
||||
else:
|
||||
self.global_flags_cc.append("-D__STDCPP_GNU__")
|
||||
# GPL v3 (+ exception link for gcc compilator)
|
||||
self.global_include_cc.append("-I" + self.path_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/include/")
|
||||
self.global_include_cc.append("-I" + self.path_ndk +"/sources/android/support/include/")
|
||||
if arch == "armv5":
|
||||
stdCppBasePath = self.path_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/libs/armeabi/"
|
||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
||||
self.global_flags_ld.append( stdCppBasePath + "thumb/libgnustl_static.a")
|
||||
self.global_flags_ld.append( stdCppBasePath + "thumb/libsupc++.a")
|
||||
elif arch == "armv7":
|
||||
stdCppBasePath = self.path_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/libs/armeabi-v7a/"
|
||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
||||
self.global_flags_ld.append( stdCppBasePath + "thumb/libgnustl_static.a")
|
||||
self.global_flags_ld.append( stdCppBasePath + "thumb/libsupc++.a")
|
||||
elif arch == "mips":
|
||||
stdCppBasePath = self.path_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/libs/mips/"
|
||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
||||
self.global_flags_ld.append( stdCppBasePath + "libgnustl_static.a")
|
||||
self.global_flags_ld.append( stdCppBasePath + "libsupc++.a")
|
||||
elif arch == "x86":
|
||||
stdCppBasePath = self.path_ndk +"/sources/cxx-stl/gnu-libstdc++/" + gccVersion + "/libs/x86/"
|
||||
self.global_include_cc.append("-I" + stdCppBasePath + "include/")
|
||||
self.global_flags_ld.append( stdCppBasePath + "libgnustl_static.a")
|
||||
self.global_flags_ld.append( stdCppBasePath + "libsupc++.a")
|
||||
else :
|
||||
self.global_include_cc.append("-I" + self.path_ndk +"/sources/cxx-stl/system/include/")
|
||||
self.global_include_cc.append("-I" + self.path_ndk +"/sources/cxx-stl/stlport/stlport/")
|
||||
self.global_flags_ld.append(self.path_ndk +"/platforms/android-" + str(self.boardId) + "/arch-arm/usr/lib/libstdc++.a")
|
||||
self.add_flag("c", "-D__ANDROID_BOARD_ID__=" + str(self.board_id))
|
||||
if self.type_arch == "armv5" or self.type_arch == "armv7":
|
||||
self.global_include_cc.append("-I" + os.path.join(self.path_ndk, "platforms", "android-" + str(self.board_id), "arch-arm", "usr", "include"))
|
||||
elif self.type_arch == "mips":
|
||||
self.global_include_cc.append("-I" + os.path.join(self.path_ndk, "platforms", "android-" + str(self.board_id), "arch-mips", "usr", "include"))
|
||||
elif self.type_arch == "x86":
|
||||
self.global_include_cc.append("-I" + os.path.join(self.path_ndk, "platforms", "android-" + str(self.board_id), "arch-x86", "usr", "include"))
|
||||
|
||||
self.global_sysroot = "--sysroot=" + self.path_ndk +"/platforms/android-" + str(self.boardId) + "/arch-arm"
|
||||
self.global_include_cc.append("-I" + os.path.join(self.path_ndk, "sources", "android", "support", "include"))
|
||||
|
||||
self.global_flags_cc.append("-D__ARM_ARCH_5__")
|
||||
self.global_flags_cc.append("-D__ARM_ARCH_5T__")
|
||||
self.global_flags_cc.append("-D__ARM_ARCH_5E__")
|
||||
self.global_flags_cc.append("-D__ARM_ARCH_5TE__")
|
||||
if self.config["compilator"] == "clang":
|
||||
self.global_include_cc.append("-gcc-toolchain " + os.path.join(self.path_ndk, "sources", "android", "support", "include"))
|
||||
if self.type_arch == "armv5":
|
||||
pass
|
||||
elif self.type_arch == "armv7":
|
||||
# The only one tested ... ==> but we have link error ...
|
||||
self.add_flag("c", [
|
||||
"-target armv7-none-linux-androideabi",
|
||||
"-march=armv7-a",
|
||||
"-mfpu=vfpv3-d16",
|
||||
"-mhard-float"
|
||||
])
|
||||
self.add_flag("link", [
|
||||
"-target armv7-none-linux-androideabi",
|
||||
"-Wl,--fix-cortex-a8",
|
||||
"-Wl,--no-warn-mismatch",
|
||||
"-lm_hard"
|
||||
])
|
||||
elif self.type_arch == "mips":
|
||||
pass
|
||||
elif self.type_arch == "x86":
|
||||
pass
|
||||
else:
|
||||
if self.type_arch == "armv5":
|
||||
pass
|
||||
elif self.type_arch == "armv7":
|
||||
pass
|
||||
elif self.type_arch == "mips":
|
||||
pass
|
||||
elif self.type_arch == "x86":
|
||||
pass
|
||||
|
||||
self.global_sysroot = "--sysroot=" + os.path.join(self.path_ndk, "platforms", "android-" + str(self.board_id), "arch-arm")
|
||||
|
||||
self.add_flag("c", [
|
||||
"-D__ARM_ARCH_5__",
|
||||
"-D__ARM_ARCH_5T__",
|
||||
"-D__ARM_ARCH_5E__",
|
||||
"-D__ARM_ARCH_5TE__"
|
||||
])
|
||||
if self.config["compilator"] != "clang":
|
||||
if self.arch == "armv5":
|
||||
if self.type_arch == "armv5":
|
||||
# -----------------------
|
||||
# -- arm V5 :
|
||||
# -----------------------
|
||||
self.global_flags_cc.append("-march=armv5te")
|
||||
self.global_flags_cc.append("-msoft-float")
|
||||
self.add_flag("c", [
|
||||
"-march=armv5te",
|
||||
"-msoft-float"
|
||||
])
|
||||
else:
|
||||
# -----------------------
|
||||
# -- arm V7 (Neon) :
|
||||
# -----------------------
|
||||
self.global_flags_cc.append("-mfpu=neon")
|
||||
self.global_flags_cc.append("-mfloat-abi=softfp")
|
||||
self.global_flags_ld.append("-mfpu=neon")
|
||||
self.global_flags_ld.append("-mfloat-abi=softfp")
|
||||
self.global_flags_cc.append("-D__ARM_ARCH_7__")
|
||||
self.global_flags_cc.append("-D__ARM_NEON__")
|
||||
self.add_flag("c", [
|
||||
"-mfpu=neon",
|
||||
"-mfloat-abi=softfp",
|
||||
"-D__ARM_ARCH_7__",
|
||||
"-D__ARM_NEON__"
|
||||
])
|
||||
self.add_flag("link", [
|
||||
"-mfpu=neon",
|
||||
"-mfloat-abi=softfp"
|
||||
])
|
||||
|
||||
# the -mthumb must be set for all the android produc, some ot the not work coretly without this one ... (all android code is generated with this flags)
|
||||
self.global_flags_cc.append("-mthumb")
|
||||
self.add_flag("c", "-mthumb")
|
||||
# -----------------------
|
||||
# -- Common flags :
|
||||
# -----------------------
|
||||
self.global_flags_cc.append("-fpic")
|
||||
self.add_flag("c", "-fpic")
|
||||
if self.config["compilator"] != "clang":
|
||||
self.global_flags_cc.append("-ffunction-sections")
|
||||
self.global_flags_cc.append("-funwind-tables")
|
||||
self.global_flags_cc.append("-fstack-protector")
|
||||
self.global_flags_cc.append("-Wno-psabi")
|
||||
self.global_flags_cc.append("-mtune=xscale")
|
||||
self.global_flags_cc.append("-fomit-frame-pointer")
|
||||
self.global_flags_cc.append("-fno-strict-aliasing")
|
||||
self.global_flags_xx.append("-frtti")
|
||||
self.global_flags_cc.append("-fexceptions")
|
||||
self.global_flags_xx.append("-Wa,--noexecstack")
|
||||
self.add_flag("c", [
|
||||
"-ffunction-sections",
|
||||
"-funwind-tables",
|
||||
"-fstack-protector",
|
||||
"-Wno-psabi",
|
||||
"-mtune=xscale",
|
||||
"-fomit-frame-pointer",
|
||||
"-fno-strict-aliasing"
|
||||
])
|
||||
self.add_flag("c++", [
|
||||
"-frtti",
|
||||
"-fexceptions",
|
||||
"-Wa,--noexecstack"
|
||||
])
|
||||
|
||||
def check_right_package(self, pkg_properties, value):
|
||||
for val in pkg_properties["RIGHT"]:
|
||||
@@ -208,12 +212,19 @@ class Target(target.Target):
|
||||
return True
|
||||
return False
|
||||
|
||||
def convert_name_application(self, pkg_name):
|
||||
value = pkg_name.lower()
|
||||
value = value.replace(' ', '')
|
||||
value = value.replace('-', '')
|
||||
value = value.replace('_', '')
|
||||
return value
|
||||
|
||||
"""
|
||||
def get_staging_path_data(self, binary_name):
|
||||
return self.get_staging_path(binary_name) + self.path_data
|
||||
"""
|
||||
|
||||
def make_package_generic_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static):
|
||||
def make_package_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Generate package '" + pkg_name + "' v" + tools.version_to_string(pkg_properties["VERSION"]))
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
@@ -266,16 +277,27 @@ class Target(target.Target):
|
||||
pkg_name_application_name = pkg_name
|
||||
if self.config["mode"] == "debug":
|
||||
pkg_name_application_name += "debug"
|
||||
debug.info("ploppppp: " + str(pkg_properties))
|
||||
# FINAL_path_JAVA_PROJECT
|
||||
self.path_java_project = os.path.join(target_outpath,
|
||||
"src",
|
||||
pkg_properties["COMPAGNY_TYPE"],
|
||||
pkg_properties["COMPAGNY_NAME2"],
|
||||
"src")
|
||||
if pkg_properties["COMPAGNY_TYPE"] != "":
|
||||
self.path_java_project = os.path.join(self.path_java_project,
|
||||
pkg_properties["COMPAGNY_TYPE"])
|
||||
if pkg_properties["COMPAGNY_NAME2"] != "":
|
||||
self.path_java_project = os.path.join(self.path_java_project,
|
||||
pkg_properties["COMPAGNY_NAME2"])
|
||||
self.path_java_project = os.path.join(self.path_java_project,
|
||||
pkg_name_application_name)
|
||||
#FINAL_FILE_ABSTRACTION
|
||||
self.file_final_abstraction = os.path.join(self.path_java_project, pkg_name_application_name + ".java")
|
||||
|
||||
compleatePackageName = pkg_properties["COMPAGNY_TYPE"]+"."+pkg_properties["COMPAGNY_NAME2"]+"." + pkg_name_application_name
|
||||
compleatePackageName = ""
|
||||
if pkg_properties["COMPAGNY_TYPE"] != "":
|
||||
compleatePackageName += pkg_properties["COMPAGNY_TYPE"] + "."
|
||||
if pkg_properties["COMPAGNY_NAME2"] != "":
|
||||
compleatePackageName += pkg_properties["COMPAGNY_NAME2"] + "."
|
||||
compleatePackageName += pkg_name_application_name
|
||||
|
||||
if "ADMOD_ID" in pkg_properties:
|
||||
pkg_properties["RIGHT"].append("INTERNET")
|
||||
@@ -321,21 +343,25 @@ class Target(target.Target):
|
||||
# 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")
|
||||
tools.create_directory_of_file(target_outpath + "/src/noFile")
|
||||
androidToolPath = self.path_sdk + "/build-tools/"
|
||||
android_tool_path = self.path_sdk + "/build-tools/"
|
||||
# find android tool version
|
||||
dirnames = tools.get_list_sub_path(androidToolPath)
|
||||
if len(dirnames) != 1:
|
||||
debug.error("an error occured when getting the tools for android")
|
||||
androidToolPath += dirnames[0] + "/"
|
||||
dirnames = tools.get_list_sub_path(android_tool_path)
|
||||
if len(dirnames) == 0:
|
||||
debug.warning("This does not comport directory: '" + android_tool_path + "'")
|
||||
debug.error("An error occured when getting the tools for android")
|
||||
elif len(dirnames) > 1:
|
||||
dirnames = sorted(dirnames, reverse=True)
|
||||
debug.debug("sort tools directory: '" + str(dirnames) + "' ==> select : " + str(dirnames[0]))
|
||||
android_tool_path += dirnames[0] + "/"
|
||||
|
||||
# this is to create resource file for android ... (we did not use aset in jar with ewol ...
|
||||
adModResoucepath = ""
|
||||
if "ADMOD_ID" in pkg_properties:
|
||||
adModResoucepath = " -S " + self.path_sdk + "/extras/google/google_play_services/libproject/google-play-services_lib/res/ "
|
||||
cmdLine = androidToolPath + "aapt p -f " \
|
||||
cmdLine = android_tool_path + "aapt p -f " \
|
||||
+ "-M " + target_outpath + "/AndroidManifest.xml " \
|
||||
+ "-F " + target_outpath + "/resources.res " \
|
||||
+ "-I " + self.path_sdk + "/platforms/android-" + str(self.boardId) + "/android.jar "\
|
||||
+ "-I " + self.path_sdk + "/platforms/android-" + str(self.board_id) + "/android.jar "\
|
||||
+ "-S " + target_outpath + "/res/ " \
|
||||
+ adModResoucepath \
|
||||
+ "-J " + target_outpath + "/src/ "
|
||||
@@ -360,7 +386,7 @@ class Target(target.Target):
|
||||
|
||||
cmdLine = "javac " \
|
||||
+ "-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.board_id) + "/android.jar" \
|
||||
+ adModJarFile + " " \
|
||||
+ filesString \
|
||||
+ self.file_final_abstraction + " " \
|
||||
@@ -385,7 +411,7 @@ class Target(target.Target):
|
||||
multiprocess.run_command(cmdLine)
|
||||
|
||||
debug.print_element("pkg", ".dex", "<==", "*.class")
|
||||
cmdLine = androidToolPath + "dx " \
|
||||
cmdLine = android_tool_path + "dx " \
|
||||
+ "--dex --no-strict " \
|
||||
+ "--output=" + target_outpath + "/build/" + pkg_name_application_name + ".dex " \
|
||||
+ target_outpath + "/build/classes/ "
|
||||
@@ -456,7 +482,7 @@ class Target(target.Target):
|
||||
debug.print_element("pkg", ".apk(aligned)", "<==", ".apk (not aligned)")
|
||||
tools.remove_file(target_outpath + "/" + pkg_name_application_name + ".apk")
|
||||
# verbose mode : -v
|
||||
cmdLine = androidToolPath + "zipalign 4 " \
|
||||
cmdLine = android_tool_path + "zipalign 4 " \
|
||||
+ target_outpath + "/build/" + pkg_name_application_name + "-unalligned.apk " \
|
||||
+ target_outpath + "/" + pkg_name_application_name + ".apk "
|
||||
multiprocess.run_command(cmdLine)
|
||||
|
199
lutin/z_target/lutinTarget_Debian.py
Normal file
199
lutin/z_target/lutinTarget_Debian.py
Normal file
@@ -0,0 +1,199 @@
|
||||
#!/usr/bin/python
|
||||
##
|
||||
## @author Edouard DUPIN
|
||||
##
|
||||
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||
##
|
||||
## @license APACHE v2.0 (see license file)
|
||||
##
|
||||
|
||||
from lutin import debug
|
||||
from lutin import target
|
||||
from lutin import tools
|
||||
import os
|
||||
import stat
|
||||
import re
|
||||
from lutin import host
|
||||
from lutin import multiprocess
|
||||
|
||||
class Target(target.Target):
|
||||
def __init__(self, config):
|
||||
#processor type selection (auto/arm/ppc/x86)
|
||||
if config["arch"] == "auto":
|
||||
config["arch"] = "x86"
|
||||
#bus size selection (auto/32/64)
|
||||
if config["bus-size"] == "auto":
|
||||
config["bus-size"] = str(host.BUS_SIZE)
|
||||
target.Target.__init__(self, "Linux", config, "")
|
||||
if self.config["bus-size"] == "64":
|
||||
# 64 bits
|
||||
if host.BUS_SIZE != 64:
|
||||
self.add_flag("c", "-m64")
|
||||
else:
|
||||
# 32 bits
|
||||
if host.BUS_SIZE != 32:
|
||||
self.add_flag("c", "-m32")
|
||||
|
||||
self.add_flag("c", "-fpic")
|
||||
|
||||
self.pkg_path_data = "share"
|
||||
self.pkg_path_bin = "bin"
|
||||
self.pkg_path_lib = "lib"
|
||||
self.pkg_path_license = "license"
|
||||
|
||||
"""
|
||||
.local/application
|
||||
*--> applName -> applName.app/bin/applName
|
||||
*--> applName.app
|
||||
*--> appl_description.txt
|
||||
*--> appl_name.txt
|
||||
*--> changelog.txt
|
||||
*--> copyright.txt
|
||||
*--> readme.txt
|
||||
*--> version.txt
|
||||
*--> website.txt
|
||||
*--> icon.png
|
||||
*--> bin
|
||||
* *--> applName
|
||||
*--> doc
|
||||
* *--> applName
|
||||
*--> lib
|
||||
* *--> XX.so
|
||||
* *--> YY.so
|
||||
*--> license
|
||||
* *--> applName.txt
|
||||
* *--> libXX.txt
|
||||
* *--> libYY.txt
|
||||
*--> man
|
||||
*--> share
|
||||
* *--> applName
|
||||
* *--> XX
|
||||
* *--> YY
|
||||
*--> sources
|
||||
"""
|
||||
def make_package_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Generate generic '" + pkg_name + "' v" + tools.version_to_string(pkg_properties["VERSION"]))
|
||||
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:
|
||||
self.make_package_binary_data(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
|
||||
|
||||
## copy binary files:
|
||||
self.make_package_binary_bin(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
|
||||
|
||||
## Create libraries:
|
||||
self.make_package_binary_lib(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
|
||||
|
||||
## Create generic files:
|
||||
self.make_package_generic_files(target_outpath, pkg_properties, pkg_name, base_pkg_path, heritage_list, static)
|
||||
|
||||
## create the package:
|
||||
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")
|
||||
#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.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, pkg_properties, base_pkg_path, heritage_list):
|
||||
# http://alp.developpez.com/tutoriels/debian/creer-paquet/
|
||||
debianpkg_name = re.sub("_", "-", pkg_name)
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Generate package '" + debianpkg_name + "' v"+pkg_properties["VERSION"])
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
self.get_staging_path(pkg_name)
|
||||
target_outpathDebian = self.get_staging_path(pkg_name) + "/DEBIAN/"
|
||||
finalFileControl = target_outpathDebian + "control"
|
||||
finalFilepostRm = target_outpathDebian + "postrm"
|
||||
# create the paths :
|
||||
tools.create_directory_of_file(finalFileControl)
|
||||
tools.create_directory_of_file(finalFilepostRm)
|
||||
## Create the control file
|
||||
tools.create_directory_of_file(finalFileControl)
|
||||
tmpFile = open(finalFileControl, 'w')
|
||||
tmpFile.write("Package: " + debianpkg_name + "\n")
|
||||
tmpFile.write("Version: " + pkg_properties["VERSION"] + "\n")
|
||||
tmpFile.write("Section: " + self.generate_list_separate_coma(pkg_properties["SECTION"]) + "\n")
|
||||
tmpFile.write("Priority: " + pkg_properties["PRIORITY"] + "\n")
|
||||
tmpFile.write("Architecture: all\n")
|
||||
tmpFile.write("Depends: bash\n")
|
||||
tmpFile.write("Maintainer: " + self.generate_list_separate_coma(pkg_properties["MAINTAINER"]) + "\n")
|
||||
tmpFile.write("Description: " + pkg_properties["DESCRIPTION"] + "\n")
|
||||
tmpFile.write("\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## Create the PostRm
|
||||
tmpFile = open(finalFilepostRm, 'w')
|
||||
tmpFile.write("#!/bin/bash\n")
|
||||
tmpFile.write("touch ~/." + pkg_name + "\n")
|
||||
if pkg_name != "":
|
||||
tmpFile.write("touch ~/.local/share/" + pkg_name + "\n")
|
||||
tmpFile.write("rm -r ~/.local/share/" + pkg_name + "\n")
|
||||
tmpFile.write("\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## Enable Execution in script
|
||||
os.chmod(finalFilepostRm, stat.S_IRWXU + stat.S_IRGRP + stat.S_IXGRP + stat.S_IROTH + stat.S_IXOTH);
|
||||
## Readme donumentation
|
||||
readmeFileDest = self.get_staging_path(pkg_name) + "/usr/share/doc/"+ debianpkg_name + "/README"
|
||||
tools.create_directory_of_file(readmeFileDest)
|
||||
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()
|
||||
## licence file
|
||||
license_file_dest = self.get_staging_path(pkg_name) + "/usr/share/doc/"+ debianpkg_name + "/copyright"
|
||||
tools.create_directory_of_file(license_file_dest)
|
||||
if os.path.exists(base_pkg_path + "/license.txt")==True:
|
||||
tools.copy_file(base_pkg_path + "/license.txt", license_file_dest)
|
||||
else:
|
||||
debug.info("no file 'license.txt' ==> generate an empty one")
|
||||
tmpFile = open(license_file_dest, 'w')
|
||||
tmpFile.write("No license define by the developper for " + pkg_name + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
##changeLog file
|
||||
change_log_file_dest = self.get_staging_path(pkg_name) + "/usr/share/doc/"+ debianpkg_name + "/changelog"
|
||||
tools.create_directory_of_file(change_log_file_dest)
|
||||
if os.path.exists(base_pkg_path + "/changelog")==True:
|
||||
tools.copy_file(base_pkg_path + "/changelog", change_log_file_dest)
|
||||
else:
|
||||
debug.info("no file 'changelog' ==> generate an empty one")
|
||||
tmpFile = open(change_log_file_dest, 'w')
|
||||
tmpFile.write("No changelog data " + pkg_name + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## create the package :
|
||||
debug.debug("package : " + self.get_staging_path(pkg_name) + "/" + debianpkg_name + ".deb")
|
||||
os.system("cd " + self.get_staging_path("") + " ; dpkg-deb --build " + pkg_name)
|
||||
tools.create_directory_of_file(self.get_final_path())
|
||||
tools.copy_file(self.get_staging_path("") + "/" + pkg_name + self.suffix_package, self.get_final_path() + "/" + pkg_name + self.suffix_package)
|
||||
|
||||
def install_package(self, pkg_name):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Install package '" + pkg_name + "'")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
os.system("sudo dpkg -i " + self.get_final_path() + "/" + pkg_name + self.suffix_package)
|
||||
|
||||
def un_install_package(self, pkg_name):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Un-Install package '" + pkg_name + "'")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
os.system("sudo dpkg -r " + self.get_final_path() + "/" + pkg_name + self.suffix_package)
|
||||
|
||||
|
||||
|
@@ -56,32 +56,34 @@ class Target(target.Target):
|
||||
|
||||
if self.sumulator == True:
|
||||
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_cc.append("-mios-simulator-version-min=8.0")
|
||||
self.add_flag("link", "-mios-simulator-version-min=8.0")
|
||||
self.add_flag("c", "-mios-simulator-version-min=8.0")
|
||||
else:
|
||||
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_cc.append("-miphoneos-version-min=8.0")
|
||||
self.add_flag("link", "-miphoneos-version-min=8.0")
|
||||
self.add_flag("c", "-miphoneos-version-min=8.0")
|
||||
|
||||
self.global_flags_cc.append("-D__STDCPP_LLVM__")
|
||||
self.global_flags_ld.append([
|
||||
"-Xlinker",
|
||||
"-objc_abi_version",
|
||||
"-Xlinker 2",
|
||||
"-Xlinker",
|
||||
"-no_implicit_dylibs",
|
||||
"-stdlib=libc++",
|
||||
"-fobjc-arc",
|
||||
"-fobjc-link-runtime"])
|
||||
self.add_flag("link", [
|
||||
"-Xlinker",
|
||||
"-objc_abi_version",
|
||||
"-Xlinker 2",
|
||||
"-Xlinker",
|
||||
"-no_implicit_dylibs",
|
||||
"-stdlib=libc++",
|
||||
"-fobjc-arc",
|
||||
"-fobjc-link-runtime"
|
||||
])
|
||||
|
||||
self.global_flags_m.append("-fobjc-arc")
|
||||
#self.global_flags_m.append("-fmodules")
|
||||
self.add_flag("m", ["-fobjc-arc")
|
||||
#self.add_flag("m", ["-fmodules")
|
||||
|
||||
self.pkg_path_data = "share"
|
||||
self.pkg_path_bin = ""
|
||||
self.pkg_path_lib = "lib"
|
||||
self.pkg_path_license = "license"
|
||||
|
||||
# Disable capabiliteis to compile in shared mode
|
||||
self.support_dynamic_link = False
|
||||
|
||||
def make_package_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
@@ -109,23 +111,23 @@ class Target(target.Target):
|
||||
# Resize all icon needed for Ios ...
|
||||
# TODO : Do not regenerate if source resource is not availlable
|
||||
# TODO : Add a colored background ...
|
||||
debug.print_element("pkg", "iTunesArtwork.png", "<==", pkg_properties["ICON"])
|
||||
debug.print_element("pkg", os.path.relpath(pkg_properties["ICON"]), "==>", "iTunesArtwork.png")
|
||||
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", os.path.relpath(pkg_properties["ICON"]), "==>", "iTunesArtwork@2x.png")
|
||||
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", os.path.relpath(pkg_properties["ICON"]), "==>", "Icon-60@2x.png")
|
||||
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", os.path.relpath(pkg_properties["ICON"]), "==>", "Icon-76.png")
|
||||
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", os.path.relpath(pkg_properties["ICON"]), "==>", "Icon-76@2x.png")
|
||||
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", os.path.relpath(pkg_properties["ICON"]), "==>", "Icon-Small-40.png")
|
||||
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", os.path.relpath(pkg_properties["ICON"]), "==>", "Icon-Small-40@2x.png")
|
||||
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", os.path.relpath(pkg_properties["ICON"]), "==>", "Icon-Small.png")
|
||||
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", os.path.relpath(pkg_properties["ICON"]), "==>", "Icon-Small@2x.png")
|
||||
image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "Icon-Small@2x.png"), 58, 58)
|
||||
|
||||
## Create the info file:
|
||||
@@ -177,9 +179,9 @@ class Target(target.Target):
|
||||
data_file += " </array>\n"
|
||||
data_file += " \n"
|
||||
data_file += " <key>CFBundleShortVersionString</key>\n"
|
||||
data_file += " <string>"+pkg_properties["VERSION"]+"</string>\n"
|
||||
data_file += " <string>"+tools.version_to_string(pkg_properties["VERSION"])+"</string>\n"
|
||||
data_file += " <key>CFBundleVersion</key>\n"
|
||||
data_file += " <string>"+pkg_properties["VERSION_CODE"]+"</string>\n"
|
||||
data_file += " <string>"+str(pkg_properties["VERSION_CODE"])+"</string>\n"
|
||||
data_file += " \n"
|
||||
data_file += " <key>CFBundleResourceSpecification</key>\n"
|
||||
data_file += " <string>ResourceRules.plist</string>\n"
|
||||
@@ -312,8 +314,10 @@ class Target(target.Target):
|
||||
# Must create the tarball of the application
|
||||
#cd $(TARGET_OUT_FINAL)/; tar -cf $(PROJECT_NAME).tar $(PROJECT_NAME).app
|
||||
#cd $(TARGET_OUT_FINAL)/; tar -czf $(PROJECT_NAME).tar.gz $(PROJECT_NAME).app
|
||||
|
||||
if self.sumulator == False:
|
||||
if "APPLE_APPLICATION_IOS_ID" not in pkg_properties:
|
||||
pkg_properties["APPLE_APPLICATION_IOS_ID"] = "00000000"
|
||||
debug.warning("Missing package property : APPLE_APPLICATION_IOS_ID USE " + pkg_properties["APPLE_APPLICATION_IOS_ID"] + " ID ... ==> CAN NOT WORK ..." )
|
||||
# Create the info file
|
||||
tmpFile = open(os.path.join(target_outpath, pkg_name + ".xcent"), 'w')
|
||||
tmpFile.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
|
||||
@@ -321,15 +325,12 @@ class Target(target.Target):
|
||||
tmpFile.write("<plist version=\"1.0\">\n")
|
||||
tmpFile.write(" <dict>\n")
|
||||
tmpFile.write(" <key>application-identifier</key>\n")
|
||||
try:
|
||||
tmpFile.write(" <string>" + pkg_properties["APPLE_APPLICATION_IOS_ID"] + "." + pkg_properties["COMPAGNY_TYPE"] + "." + pkg_properties["COMPAGNY_NAME2"] + "." + pkg_name + "</string>\n")
|
||||
except:
|
||||
debug.error("Missing package property : APPLE_APPLICATION_IOS_ID")
|
||||
tmpFile.write(" <string>" + pkg_properties["APPLE_APPLICATION_IOS_ID"] + "." + pkg_properties["COMPAGNY_TYPE"] + "." + pkg_properties["COMPAGNY_NAME2"] + "." + pkg_name + "</string>\n")
|
||||
tmpFile.write(" <key>get-task-allow</key>\n")
|
||||
tmpFile.write(" <true/>\n")
|
||||
tmpFile.write(" <key>keychain-access-groups</key>\n")
|
||||
tmpFile.write(" <array>\n")
|
||||
tmpFile.write(" <string>" + pkg_properties["APPLE_APPLICATION_IOS_ID"] + ".atriasoft.worddown</string>\n")
|
||||
tmpFile.write(" <string>" + pkg_properties["APPLE_APPLICATION_IOS_ID"] + "." + pkg_properties["COMPAGNY_TYPE"] + "." + pkg_properties["COMPAGNY_NAME2"] + "." + pkg_name + "</string>\n")
|
||||
tmpFile.write(" </array>\n")
|
||||
tmpFile.write(" </dict>\n")
|
||||
tmpFile.write("</plist>\n")
|
||||
@@ -339,21 +340,17 @@ class Target(target.Target):
|
||||
debug.print_element("pkg(signed)", "pkg", "<==", "Signing application")
|
||||
iosDevelopperKeyFile = ".iosKey.txt"
|
||||
if tools.file_size(iosDevelopperKeyFile) < 10:
|
||||
debug.error("To sign an application we need to have a signing key in the file '" + iosDevelopperKeyFile + "' \n it is represented like: 'iPhone Developer: Francis DUGENOUX (YRRQE5KGTH)'\n you can obtain it with : 'certtool y | grep \"Developer\"'")
|
||||
signatureKey = tools.file_read_data(iosDevelopperKeyFile)
|
||||
signatureKey = re.sub('\n', '', signatureKey)
|
||||
cmdLine = 'codesign --force --sign '
|
||||
# to get this key ; certtool y | grep "Developer"
|
||||
cmdLine += ' "' + signatureKey + '" '
|
||||
cmdLine += ' --entitlements ' + self.get_build_path(pkg_name) + '/worddown.xcent'
|
||||
cmdLine += ' ' + self.get_staging_path(pkg_name)
|
||||
multiprocess.run_command(cmdLine)
|
||||
|
||||
# --force --sign "iPhone Developer: Edouard DUPIN (SDFGSDFGSDFG)"
|
||||
# --resource-rules=/Users/edouarddupin/Library/Developer/Xcode/DerivedData/worddown-cmuvjchgtiteexdiacyqoexsyadg/Build/Products/Debug-iphoneos/worddown.app/ResourceRules.plist
|
||||
# --entitlements /Users/edouarddupin/Library/Developer/Xcode/DerivedData/worddown-cmuvjchgtiteexdiacyqoexsyadg/Build/Intermediates/worddown.build/Debug-iphoneos/worddown.build/worddown.xcent
|
||||
# /Users/edouarddupin/Library/Developer/Xcode/DerivedData/worddown-cmuvjchgtiteexdiacyqoexsyadg/Build/Products/Debug-iphoneos/worddown.app
|
||||
|
||||
debug.warning("To sign an application we need to have a signing key in the file '" + iosDevelopperKeyFile + "' \n it is represented like: 'iPhone Developer: Francis DUGENOUX (YRRQE5KGTH)'\n you can obtain it with : 'certtool y | grep \"Developer\"'")
|
||||
debug.warning("Can not be install ... not runnable")
|
||||
else:
|
||||
signatureKey = tools.file_read_data(iosDevelopperKeyFile)
|
||||
signatureKey = re.sub('\n', '', signatureKey)
|
||||
cmdLine = 'codesign --force --sign '
|
||||
# to get this key ; certtool y | grep "Developer"
|
||||
cmdLine += ' "' + signatureKey + '" '
|
||||
cmdLine += ' --entitlements ' + self.get_build_path(pkg_name) + '/worddown.xcent'
|
||||
cmdLine += ' ' + self.get_staging_path(pkg_name)
|
||||
multiprocess.run_command(cmdLine)
|
||||
|
||||
def createRandomNumber(self, len):
|
||||
out = ""
|
||||
|
@@ -28,15 +28,13 @@ class Target(target.Target):
|
||||
if self.config["bus-size"] == "64":
|
||||
# 64 bits
|
||||
if host.BUS_SIZE != 64:
|
||||
self.global_flags_cc.append("-m64")
|
||||
self.add_flag("c", "-m64")
|
||||
else:
|
||||
# 32 bits
|
||||
if host.BUS_SIZE != 32:
|
||||
self.global_flags_cc.append("-m32")
|
||||
|
||||
self.global_flags_cc.append("-fpic")
|
||||
self.global_flags_cc.append("-D__STDCPP_GNU__")
|
||||
self.add_flag("c", "-m32")
|
||||
|
||||
self.add_flag("c", "-fpic")
|
||||
|
||||
self.pkg_path_data = "share"
|
||||
self.pkg_path_bin = "bin"
|
||||
@@ -73,7 +71,7 @@ class Target(target.Target):
|
||||
* *--> YY
|
||||
*--> sources
|
||||
"""
|
||||
def make_package_generic_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static):
|
||||
def make_package_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Generate generic '" + pkg_name + "' v" + tools.version_to_string(pkg_properties["VERSION"]))
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
@@ -94,221 +92,50 @@ class Target(target.Target):
|
||||
self.make_package_generic_files(target_outpath, pkg_properties, pkg_name, base_pkg_path, heritage_list, static)
|
||||
|
||||
## create the package:
|
||||
debug.debug("package : " + self.get_staging_path(pkg_name) + "/" + pkg_name + ".app.pkg")
|
||||
debug.debug("package : " + os.path.join(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")
|
||||
#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.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, pkg_properties, base_pkg_path, heritage_list):
|
||||
# http://alp.developpez.com/tutoriels/debian/creer-paquet/
|
||||
debianpkg_name = re.sub("_", "-", pkg_name)
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Generate package '" + debianpkg_name + "' v"+pkg_properties["VERSION"])
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
self.get_staging_path(pkg_name)
|
||||
target_outpathDebian = self.get_staging_path(pkg_name) + "/DEBIAN/"
|
||||
finalFileControl = target_outpathDebian + "control"
|
||||
finalFilepostRm = target_outpathDebian + "postrm"
|
||||
# create the paths :
|
||||
tools.create_directory_of_file(finalFileControl)
|
||||
tools.create_directory_of_file(finalFilepostRm)
|
||||
## Create the control file
|
||||
tools.create_directory_of_file(finalFileControl)
|
||||
tmpFile = open(finalFileControl, 'w')
|
||||
tmpFile.write("Package: " + debianpkg_name + "\n")
|
||||
tmpFile.write("Version: " + pkg_properties["VERSION"] + "\n")
|
||||
tmpFile.write("Section: " + self.generate_list_separate_coma(pkg_properties["SECTION"]) + "\n")
|
||||
tmpFile.write("Priority: " + pkg_properties["PRIORITY"] + "\n")
|
||||
tmpFile.write("Architecture: all\n")
|
||||
tmpFile.write("Depends: bash\n")
|
||||
tmpFile.write("Maintainer: " + self.generate_list_separate_coma(pkg_properties["MAINTAINER"]) + "\n")
|
||||
tmpFile.write("Description: " + pkg_properties["DESCRIPTION"] + "\n")
|
||||
tmpFile.write("\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## Create the PostRm
|
||||
tmpFile = open(finalFilepostRm, 'w')
|
||||
tmpFile.write("#!/bin/bash\n")
|
||||
tmpFile.write("touch ~/." + pkg_name + "\n")
|
||||
if pkg_name != "":
|
||||
tmpFile.write("touch ~/.local/share/" + pkg_name + "\n")
|
||||
tmpFile.write("rm -r ~/.local/share/" + pkg_name + "\n")
|
||||
tmpFile.write("\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## Enable Execution in script
|
||||
os.chmod(finalFilepostRm, stat.S_IRWXU + stat.S_IRGRP + stat.S_IXGRP + stat.S_IROTH + stat.S_IXOTH);
|
||||
## Readme donumentation
|
||||
readmeFileDest = self.get_staging_path(pkg_name) + "/usr/share/doc/"+ debianpkg_name + "/README"
|
||||
tools.create_directory_of_file(readmeFileDest)
|
||||
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()
|
||||
## licence file
|
||||
license_file_dest = self.get_staging_path(pkg_name) + "/usr/share/doc/"+ debianpkg_name + "/copyright"
|
||||
tools.create_directory_of_file(license_file_dest)
|
||||
if os.path.exists(base_pkg_path + "/license.txt")==True:
|
||||
tools.copy_file(base_pkg_path + "/license.txt", license_file_dest)
|
||||
else:
|
||||
debug.info("no file 'license.txt' ==> generate an empty one")
|
||||
tmpFile = open(license_file_dest, 'w')
|
||||
tmpFile.write("No license define by the developper for " + pkg_name + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
##changeLog file
|
||||
change_log_file_dest = self.get_staging_path(pkg_name) + "/usr/share/doc/"+ debianpkg_name + "/changelog"
|
||||
tools.create_directory_of_file(change_log_file_dest)
|
||||
if os.path.exists(base_pkg_path + "/changelog")==True:
|
||||
tools.copy_file(base_pkg_path + "/changelog", change_log_file_dest)
|
||||
else:
|
||||
debug.info("no file 'changelog' ==> generate an empty one")
|
||||
tmpFile = open(change_log_file_dest, 'w')
|
||||
tmpFile.write("No changelog data " + pkg_name + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## create the package :
|
||||
debug.debug("package : " + self.get_staging_path(pkg_name) + "/" + debianpkg_name + ".deb")
|
||||
os.system("cd " + self.get_staging_path("") + " ; dpkg-deb --build " + pkg_name)
|
||||
tools.create_directory_of_file(self.get_final_path())
|
||||
tools.copy_file(self.get_staging_path("") + "/" + pkg_name + self.suffix_package, self.get_final_path() + "/" + pkg_name + self.suffix_package)
|
||||
tools.copy_file(os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app.tar.gz"), os.path.join(self.get_final_path(), pkg_name + ".app.gpkg"))
|
||||
|
||||
def install_package(self, pkg_name):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Install package '" + pkg_name + "'")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
os.system("sudo dpkg -i " + self.get_final_path() + "/" + pkg_name + self.suffix_package)
|
||||
# this is temporary ... Will call:
|
||||
if False:
|
||||
os.system("lutin-pkg -i " + os.path.join(self.get_final_path(), + pkg_name + ".app.gpkg"))
|
||||
else:
|
||||
#Copy directly from staging path:
|
||||
appl_path = os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app")
|
||||
target_path = os.path.join(os.path.expanduser("~"), ".local", "application", pkg_name + ".app")
|
||||
target_bin_path = os.path.join(os.path.expanduser("~"), ".local", "application", pkg_name + ".app", "bin", pkg_name)
|
||||
target_bin_link = os.path.join(os.path.expanduser("~"), ".local", "application", pkg_name)
|
||||
# remove output path:
|
||||
tools.remove_path_and_sub_path(target_path)
|
||||
# remove executable link version:
|
||||
tools.remove_file(target_bin_link)
|
||||
# copy result:
|
||||
tools.copy_anything(appl_path, target_path, recursive=True)
|
||||
# create synbolic link:
|
||||
debug.info("kkk " + "ln -s " + target_bin_path + " " + target_bin_link)
|
||||
os.symlink(target_bin_path, target_bin_link)
|
||||
|
||||
def un_install_package(self, pkg_name):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Un-Install package '" + pkg_name + "'")
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
os.system("sudo dpkg -r " + self.get_final_path() + "/" + pkg_name + self.suffix_package)
|
||||
# this is temporary ... Will call:
|
||||
if False:
|
||||
os.system("lutin-pkg -r " + pkg_name)
|
||||
else:
|
||||
#Copy directly from staging path:
|
||||
target_path = os.path.join(os.path.expanduser("~"), ".local", "application", pkg_name + ".app")
|
||||
target_bin_link = os.path.join(os.path.expanduser("~"), ".local", "application", pkg_name)
|
||||
# remove output path:
|
||||
tools.remove_path_and_sub_path(target_path)
|
||||
# remove executable link version:
|
||||
tools.remove_file(target_bin_link)
|
||||
|
||||
"""
|
||||
.local/application
|
||||
*--> applName -> applName.app/bin/applName
|
||||
*--> applName.app
|
||||
*--> appl_description.txt
|
||||
*--> appl_name.txt
|
||||
*--> changelog.txt
|
||||
*--> copyright.txt
|
||||
*--> readme.txt
|
||||
*--> version.txt
|
||||
*--> website.txt
|
||||
*--> icon.png
|
||||
*--> bin
|
||||
* *--> applName
|
||||
*--> doc
|
||||
* *--> applName
|
||||
*--> lib
|
||||
* *--> XX.so
|
||||
* *--> YY.so
|
||||
*--> license
|
||||
* *--> applName.txt
|
||||
* *--> libXX.txt
|
||||
* *--> libYY.txt
|
||||
*--> man
|
||||
*--> share
|
||||
* *--> applName
|
||||
* *--> XX
|
||||
* *--> YY
|
||||
*--> sources
|
||||
"""
|
||||
def make_package_generic(self, pkg_name, pkg_properties, base_pkg_path, heritage_list):
|
||||
debug.warning("heritage for " + str(pkg_name) + ":")
|
||||
for heritage in heritage_list.list_heritage:
|
||||
debug.warning("heritage .... " + str(heritage.name) + " : " + str(heritage.depends))
|
||||
debianpkg_name = re.sub("_", "-", pkg_name)
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Generate generic '" + debianpkg_name + "' v"+pkg_properties["VERSION"])
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
target_outpath = self.get_staging_path(pkg_name) + "/edn.app/"
|
||||
tools.create_directory_of_file(target_outpath)
|
||||
## 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
|
||||
license_file_dest = target_outpath + "/license/"+ debianpkg_name + ".txt"
|
||||
tools.create_directory_of_file(license_file_dest)
|
||||
if os.path.exists(base_pkg_path + "/license.txt")==True:
|
||||
tools.copy_file(base_pkg_path + "/license.txt", license_file_dest)
|
||||
else:
|
||||
debug.info("no file 'license.txt' ==> generate an empty one")
|
||||
tmpFile = open(license_file_dest, 'w')
|
||||
tmpFile.write("No license define by the developper for " + pkg_name + "\n")
|
||||
tmpFile.flush()
|
||||
tmpFile.close()
|
||||
## Create changeLog file
|
||||
change_log_file_dest = target_outpath + "/changelog.txt"
|
||||
if os.path.exists(base_pkg_path + "/changelog") == True:
|
||||
tools.copy_file(base_pkg_path + "/changelog", change_log_file_dest)
|
||||
else:
|
||||
debug.info("no file 'changelog' ==> generate an empty one")
|
||||
tmpFile = open(change_log_file_dest, 'w')
|
||||
tmpFile.write("No changelog data " + pkg_name + "\n")
|
||||
tmpFile.flush()
|
||||
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:
|
||||
debug.debug("package : " + self.get_staging_path(pkg_name) + "/" + debianpkg_name + ".app.pkg")
|
||||
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")
|
||||
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")
|
||||
|
||||
|
||||
|
||||
|
@@ -38,8 +38,6 @@ class Target(target.Target):
|
||||
#self.suffix_binary=''
|
||||
#self.suffix_package=''
|
||||
|
||||
self.global_flags_cc.append("-D__STDCPP_LLVM__")
|
||||
|
||||
self.pkg_path_data = "Resources"
|
||||
self.pkg_path_bin = "MacOS"
|
||||
self.pkg_path_lib = "lib"
|
||||
@@ -110,7 +108,6 @@ class Target(target.Target):
|
||||
data_file = "#!/bin/bash\n"
|
||||
data_file += "# Simply open the real application in the correct way (a link does not work ...)\n"
|
||||
data_file += "/Applications/" + pkg_name + ".app/Contents/MacOS/" + pkg_name + " $*\n"
|
||||
#tmpFile.write("open -n /Applications/edn.app --args -AppCommandLineArg $*\n")
|
||||
tools.file_write_data(os.path.join(target_outpath, "shell", pkg_name),
|
||||
data_file,
|
||||
only_if_new=True)
|
||||
@@ -128,8 +125,8 @@ class Target(target.Target):
|
||||
debug.info("disk image: " + output_file_name)
|
||||
|
||||
## user information:
|
||||
debug.info("You can have an shell interface by executing : ")
|
||||
debug.info(" sudo cp " + shell_file_name + " /usr/local/bin")
|
||||
#debug.info("You can have an shell interface by executing : ")
|
||||
#debug.info(" sudo cp " + shell_file_name + " /usr/local/bin")
|
||||
|
||||
def install_package(self, pkg_name):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
|
@@ -45,15 +45,6 @@ class Target(target.Target):
|
||||
else:
|
||||
# 32 bits
|
||||
self.set_cross_base("i686-w64-mingw32-")
|
||||
# force static link to prenvent many errors ...
|
||||
self.global_flags_ld.append(["-static-libgcc",
|
||||
"-static-libstdc++",
|
||||
"-static"])
|
||||
|
||||
#self.path_bin=""
|
||||
#self.path_lib="lib"
|
||||
#self.path_data="data"
|
||||
#self.path_doc="doc"
|
||||
|
||||
self.pkg_path_data = "data"
|
||||
self.pkg_path_bin = ""
|
||||
@@ -64,13 +55,12 @@ class Target(target.Target):
|
||||
self.suffix_lib_dynamic='.dll'
|
||||
self.suffix_binary='.exe'
|
||||
#self.suffix_package=''
|
||||
self.global_flags_cc.append("-D__STDCPP_GNU__")
|
||||
|
||||
|
||||
def get_staging_path_data(self, binary_name, heritage_list):
|
||||
return self.get_staging_path(binary_name) + self.path_data
|
||||
|
||||
def make_package_generic_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static):
|
||||
def make_package_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static):
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
debug.info("Generate package '" + pkg_name + "' v" + tools.version_to_string(pkg_properties["VERSION"]))
|
||||
debug.debug("------------------------------------------------------------------------")
|
||||
|
9
setup.py
9
setup.py
@@ -7,8 +7,8 @@ def readme():
|
||||
|
||||
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
|
||||
setup(name='lutin',
|
||||
version='0.7.1',
|
||||
description='Lutin generic builder',
|
||||
version='1.0.0',
|
||||
description='Lutin generic builder (might replace makefile, CMake ...)',
|
||||
long_description=readme(),
|
||||
url='http://github.com/HeeroYui/lutin',
|
||||
author='Edouard DUPIN',
|
||||
@@ -19,7 +19,7 @@ setup(name='lutin',
|
||||
'lutin/z_system',
|
||||
'lutin/z_target'],
|
||||
classifiers=[
|
||||
'Development Status :: 3 - Alpha',
|
||||
'Development Status :: 4 - Beta',
|
||||
'License :: OSI Approved :: Apache Software License',
|
||||
'Programming Language :: Python',
|
||||
'Topic :: Software Development :: Compilers',
|
||||
@@ -33,6 +33,7 @@ setup(name='lutin',
|
||||
include_package_data = True,
|
||||
zip_safe=False)
|
||||
|
||||
#To developp: ./setup.py install/develop
|
||||
#To developp: sudo ./setup.py install
|
||||
# sudo ./setup.py develop
|
||||
#TO register all in pip: ./setup.py register sdist upload
|
||||
|
||||
|
22
test/test-c/lutin_test-c.py
Normal file
22
test/test-c/lutin_test-c.py
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/python
|
||||
import lutin.module as module
|
||||
import lutin.tools as tools
|
||||
import lutin.debug as debug
|
||||
import os
|
||||
|
||||
def get_type():
|
||||
return "BINARY"
|
||||
|
||||
def get_desc():
|
||||
return "Text C compilation"
|
||||
|
||||
def create(target, module_name):
|
||||
my_module = module.Module(__file__, module_name, get_type())
|
||||
my_module.add_extra_compile_flags()
|
||||
my_module.add_src_file([
|
||||
'test.c'
|
||||
])
|
||||
if target.name=="Android":
|
||||
my_module.compile_version("c", 1999)
|
||||
return my_module
|
||||
|
6
test/test-c/test.c
Normal file
6
test/test-c/test.c
Normal file
@@ -0,0 +1,6 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int _argc, char* _argv[]) {
|
||||
printf("Hello World\n");
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user