Compare commits
106 Commits
Author | SHA1 | Date | |
---|---|---|---|
dde9c9c280 | |||
598d301284 | |||
520f97c7f6 | |||
e4b69d17f4 | |||
42be4afd0a | |||
1fa860e5b3 | |||
87a4106101 | |||
1ec07b9446 | |||
5995effd9e | |||
43c0ec2535 | |||
31fb9818ff | |||
83d7154254 | |||
55609b904c | |||
4beda0dd23 | |||
236f19bf36 | |||
fe75da7ef9 | |||
e1728a4d8d | |||
c6ea16d046 | |||
b645f087f3 | |||
6e69681480 | |||
14114158aa | |||
618825ac76 | |||
2a0bdd9e90 | |||
3b2c888fad | |||
77358efa48 | |||
f069299a53 | |||
c962b4fb9f | |||
5d92a27738 | |||
c35e1d3a24 | |||
7c664f156d | |||
198513660e | |||
61db92894a | |||
a9dd50575a | |||
d21217bfc4 | |||
9b9c65d036 | |||
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 | |||
2dcbbe9639 | |||
242a086ba1 | |||
14fcfc1d54 | |||
4b091e964a | |||
64a6e47b37 | |||
f0fe760836 | |||
7d48e91b9b | |||
1ac0ecd5c5 | |||
54fddc82b5 | |||
663188773d | |||
773a644ba1 | |||
f1d6ad6ce8 | |||
dc921d651b | |||
06481abcbf | |||
6ac4cc45fa | |||
979e71c101 | |||
a070f64716 | |||
21af5be1a3 | |||
0afb15c5b3 | |||
7e5d8db361 | |||
a9f8ab7ea2 | |||
22965f5a57 | |||
10c0f98cef | |||
ca67cb4c26 | |||
836dee5cf8 | |||
d70b82683b | |||
93693ed0f0 | |||
eeb070e014 | |||
99927380d6 | |||
8fc81f1caa | |||
5f325c2d7e | |||
f65a5f58ee | |||
4020c70fc3 | |||
6cb2ef2bd2 | |||
aa120cde57 | |||
2604cd93be | |||
10055dd3c6 | |||
db0c2a8e11 | |||
2bb4e2d377 | |||
07058eda14 | |||
a4ddf8e81b | |||
c73a7a0df6 | |||
7e41e6f393 | |||
2e2143ebcf |
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
|
58
README.rst
58
README.rst
@@ -3,6 +3,52 @@ Lutin
|
|||||||
|
|
||||||
`lutin` is a generic builder and package maker is a FREE software tool.
|
`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
|
Instructions
|
||||||
------------
|
------------
|
||||||
|
|
||||||
@@ -31,11 +77,19 @@ Installation
|
|||||||
|
|
||||||
Requirements: ``Python >= 2.7`` and ``pip``
|
Requirements: ``Python >= 2.7`` and ``pip``
|
||||||
|
|
||||||
Just run::
|
Just run:
|
||||||
|
|
||||||
pip install lutin
|
pip install lutin
|
||||||
|
|
||||||
On mac-os you may install pip before:
|
Install pip on debian/ubuntu:
|
||||||
|
|
||||||
|
sudo apt-get install pip
|
||||||
|
|
||||||
|
Install pip on ARCH-linux:
|
||||||
|
|
||||||
|
sudo pacman -S pip
|
||||||
|
|
||||||
|
Install pip on MacOs:
|
||||||
|
|
||||||
sudo easy_install pip
|
sudo easy_install pip
|
||||||
|
|
||||||
|
284
bin/lutin
284
bin/lutin
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
@@ -10,6 +11,8 @@
|
|||||||
# for path inspection:
|
# for path inspection:
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
import copy
|
||||||
|
import lutin
|
||||||
import lutin.debug as debug
|
import lutin.debug as debug
|
||||||
import lutin.arg as arguments
|
import lutin.arg as arguments
|
||||||
import lutin.host as host
|
import lutin.host as host
|
||||||
@@ -17,28 +20,36 @@ import lutin.module as module
|
|||||||
import lutin.target as target
|
import lutin.target as target
|
||||||
import lutin.env as env
|
import lutin.env as env
|
||||||
import lutin.multiprocess as multiprocess
|
import lutin.multiprocess as multiprocess
|
||||||
|
import lutin.tools as tools
|
||||||
|
import lutin.host as lutinHost
|
||||||
|
import lutin.tools as lutinTools
|
||||||
|
|
||||||
myArgs = arguments.LutinArg()
|
myArgs = arguments.LutinArg()
|
||||||
myArgs.add(arguments.ArgDefine("h", "help", desc="display this help"))
|
myArgs.add(arguments.ArgDefine("h", "help", desc="Display this help"))
|
||||||
|
myArgs.add(arguments.ArgDefine("H", "HELP", desc="Display this help (with all compleate information)"))
|
||||||
myArgs.add_section("option", "Can be set one time in all case")
|
myArgs.add_section("option", "Can be set one time in all case")
|
||||||
myArgs.add(arguments.ArgDefine("v", "verbose", list=[["0","None"],["1","error"],["2","warning"],["3","info"],["4","debug"],["5","verbose"],["6","extreme_verbose"]], desc="display makefile debug level (verbose) default =2"))
|
myArgs.add(arguments.ArgDefine("v", "verbose", list=[["0","None"],["1","error"],["2","warning"],["3","info"],["4","debug"],["5","verbose"],["6","extreme_verbose"]], desc="display makefile debug level (verbose) default =2"))
|
||||||
myArgs.add(arguments.ArgDefine("C", "color", desc="display makefile output in color"))
|
myArgs.add(arguments.ArgDefine("C", "color", desc="Display makefile output in color"))
|
||||||
myArgs.add(arguments.ArgDefine("f", "force", desc="Force the rebuild without checking the dependency"))
|
myArgs.add(arguments.ArgDefine("B", "force-build", desc="Force the rebuild without checking the dependency"))
|
||||||
myArgs.add(arguments.ArgDefine("P", "pretty", desc="print the debug has pretty display"))
|
myArgs.add(arguments.ArgDefine("P", "pretty", desc="Print the debug has pretty display"))
|
||||||
myArgs.add(arguments.ArgDefine("j", "jobs", haveParam=True, desc="Specifies the number of jobs (commands) to run simultaneously"))
|
myArgs.add(arguments.ArgDefine("j", "jobs", haveParam=True, desc="Specifies the number of jobs (commands) to run simultaneously"))
|
||||||
|
myArgs.add(arguments.ArgDefine("d", "depth", haveParam=True, desc="Depth of the search of sub element lutin_*.py (default=" + str(env.get_parse_depth()) + ")"))
|
||||||
myArgs.add(arguments.ArgDefine("s", "force-strip", desc="Force the stripping of the compile elements"))
|
myArgs.add(arguments.ArgDefine("s", "force-strip", desc="Force the stripping of the compile elements"))
|
||||||
|
myArgs.add(arguments.ArgDefine("o", "force-optimisation", desc="Force optimisation of the build"))
|
||||||
|
myArgs.add(arguments.ArgDefine("w", "warning", desc="Store warning in a file build file"))
|
||||||
|
|
||||||
myArgs.add_section("properties", "keep in the sequency of the cible")
|
myArgs.add_section("properties", "keep in the sequency of the cible")
|
||||||
myArgs.add(arguments.ArgDefine("t", "target", haveParam=True, desc="Select a target (by default the platform is the computer that compile this) To know list : 'lutin.py --list-target'"))
|
myArgs.add(arguments.ArgDefine("t", "target", haveParam=True, desc="Select a target (by default the platform is the computer that compile this) To know list : 'lutin.py --list-target'"))
|
||||||
myArgs.add(arguments.ArgDefine("c", "compilator", list=[["clang",""],["gcc",""]], desc="Compile with clang or Gcc mode (by default gcc will be used)"))
|
myArgs.add(arguments.ArgDefine("c", "compilator", list=[["clang",""],["gcc",""]], desc="Compile with clang or Gcc mode (by default gcc will be used)"))
|
||||||
|
myArgs.add(arguments.ArgDefine("", "compilator-version", haveParam=True, desc="With travis we need to specify the name of the version if we want to compile with gcc 4.9 ==> --compilator-version=4.9"))
|
||||||
myArgs.add(arguments.ArgDefine("m", "mode", list=[["debug",""],["release",""]], desc="Compile in release or debug mode (default release)"))
|
myArgs.add(arguments.ArgDefine("m", "mode", list=[["debug",""],["release",""]], desc="Compile in release or debug mode (default release)"))
|
||||||
myArgs.add(arguments.ArgDefine("a", "arch", list=[["auto","Automatic choice"],["arm","Arm processer"],["x86","Generic PC : AMD/Intel"],["ppc","Power PC"]], desc="Architecture to compile"))
|
myArgs.add(arguments.ArgDefine("a", "arch", list=[["auto","Automatic choice"],["arm","Arm processer"],["x86","Generic PC : AMD/Intel"],["ppc","Power PC"]], desc="Architecture to compile"))
|
||||||
myArgs.add(arguments.ArgDefine("b", "bus", list=[["auto","Automatic choice"],["32","32 bits"],["64","64 bits"]], desc="Adressing size (Bus size)"))
|
myArgs.add(arguments.ArgDefine("b", "bus", list=[["auto","Automatic choice"],["32","32 bits"],["64","64 bits"]], desc="Adressing size (Bus size)"))
|
||||||
myArgs.add(arguments.ArgDefine("p", "package", desc="Disable the package generation (usefull when just compile for test on linux ...)"))
|
myArgs.add(arguments.ArgDefine("p", "package", desc="Disable the package generation (usefull when just compile for test on linux ...)"))
|
||||||
myArgs.add(arguments.ArgDefine("g", "gcov", desc="Enable code coverage intrusion in code"))
|
myArgs.add(arguments.ArgDefine("g", "gcov", desc="Enable code coverage intrusion in code"))
|
||||||
myArgs.add(arguments.ArgDefine("", "simulation", desc="simulater mode (availlable only for IOS)"))
|
myArgs.add(arguments.ArgDefine("", "simulation", desc="Simulater mode (availlable only for IOS)"))
|
||||||
myArgs.add(arguments.ArgDefine("", "list-target", desc="list all availlables targets ==> for auto completion"))
|
myArgs.add(arguments.ArgDefine("", "list-target", desc="List all availlables targets ==> for auto completion"))
|
||||||
myArgs.add(arguments.ArgDefine("", "list-module", desc="list all availlables module ==> for auto completion"))
|
myArgs.add(arguments.ArgDefine("", "list-module", desc="List all availlables module ==> for auto completion"))
|
||||||
|
|
||||||
myArgs.add_section("cible", "generate in order set")
|
myArgs.add_section("cible", "generate in order set")
|
||||||
localArgument = myArgs.parse()
|
localArgument = myArgs.parse()
|
||||||
@@ -46,32 +57,125 @@ localArgument = myArgs.parse()
|
|||||||
"""
|
"""
|
||||||
display the help of this makefile
|
display the help of this makefile
|
||||||
"""
|
"""
|
||||||
def usage():
|
def usage(full=False):
|
||||||
|
color = debug.get_color_set()
|
||||||
# generic argument displayed :
|
# generic argument displayed :
|
||||||
myArgs.display()
|
myArgs.display()
|
||||||
print(" All target can finish with '?clean' '?dump' ... ?action")
|
print(" All target can finish with '?clean' '?dump' '?gcov' ... ?action (@ can replace ?)" )
|
||||||
print(" all")
|
print(" " + color['green'] + "all" + color['default'])
|
||||||
print(" build all (only for the current selected board) (bynary and packages)")
|
print(" build all (only for the current selected board) (bynary and packages)")
|
||||||
print(" clean")
|
print(" " + color['green'] + "clean" + color['default'])
|
||||||
print(" clean all (same as previous)")
|
print(" clean all (same as previous)")
|
||||||
print(" dump")
|
print(" " + color['green'] + "dump" + color['default'])
|
||||||
print(" Dump all the module dependency and properties")
|
print(" Dump all the module dependency and properties")
|
||||||
|
print(" " + color['green'] + "gcov" + color['default'])
|
||||||
|
print(" Parse all the code of the library with the gcov resolution")
|
||||||
listOfAllModule = module.list_all_module_with_desc()
|
listOfAllModule = module.list_all_module_with_desc()
|
||||||
for mod in listOfAllModule:
|
for mod in listOfAllModule:
|
||||||
print(" " + mod[0])
|
data_print = " "
|
||||||
if mod[1] != "":
|
if full == False:
|
||||||
print(" " + mod[1])
|
if mod["type"] != None \
|
||||||
|
and mod["type"][:6] == "BINARY":
|
||||||
|
data_print += color['blue']
|
||||||
|
if mod["sub-type"] == "":
|
||||||
|
data_print += "* "
|
||||||
|
elif mod["sub-type"] == "TEST":
|
||||||
|
data_print += "T "
|
||||||
|
elif mod["sub-type"] == "TOOLS":
|
||||||
|
data_print += "U "
|
||||||
|
elif mod["sub-type"] == "SAMPLE":
|
||||||
|
data_print += "S "
|
||||||
|
else:
|
||||||
|
data_print += " "
|
||||||
|
elif mod["type"] != None \
|
||||||
|
and mod["type"] == "PACKAGE":
|
||||||
|
data_print += color['red'] + "# "
|
||||||
|
elif mod["type"] != None \
|
||||||
|
and mod["type"][:7] == "LIBRARY":
|
||||||
|
data_print += color['yellow'] + " "
|
||||||
|
else:
|
||||||
|
data_print += color['default'] + " "
|
||||||
|
else:
|
||||||
|
data_print += color['green']
|
||||||
|
data_print += mod["name"] + color['default']
|
||||||
|
if full == False:
|
||||||
|
data_print += "\r\t\t\t\t\t\t\t"
|
||||||
|
if mod["license"] != None \
|
||||||
|
and mod["license"] != "":
|
||||||
|
data_print += color['yellow'] + " [" + mod["license"] + "]" + color['default']
|
||||||
|
if mod["version"] != None \
|
||||||
|
and mod["version"] != []:
|
||||||
|
version_ID = tools.version_to_string(mod["version"])
|
||||||
|
data_print += color['blue'] + " (" + version_ID + ")" + color['default']
|
||||||
|
"""
|
||||||
|
if mod["compagny-type"] != "" \
|
||||||
|
and mod["compagny-name"] != "":
|
||||||
|
data_print += color['purple'] + " " + mod["compagny-type"] + "/" + mod["compagny-name"] + color['default']
|
||||||
|
elif mod["compagny-name"] != "":
|
||||||
|
data_print += color['purple'] + " " + mod["compagny-name"] + color['default']
|
||||||
|
"""
|
||||||
|
|
||||||
|
print(data_print)
|
||||||
|
if mod["description"] != "":
|
||||||
|
print(" " + mod["description"])
|
||||||
|
if full == True:
|
||||||
|
if mod["type"] != None \
|
||||||
|
and mod["type"] != "":
|
||||||
|
print(" Type: " + mod["type"])
|
||||||
|
if mod["sub-type"] != None \
|
||||||
|
and mod["sub-type"] != "":
|
||||||
|
print(" Sub-Type: " + mod["sub-type"])
|
||||||
|
if mod["version"] != None \
|
||||||
|
and mod["version"] != []:
|
||||||
|
version_ID = ""
|
||||||
|
for id in mod["version"]:
|
||||||
|
if len(version_ID) != 0:
|
||||||
|
if type(id) == str:
|
||||||
|
version_ID+="-"
|
||||||
|
else:
|
||||||
|
version_ID+="."
|
||||||
|
version_ID += str(id)
|
||||||
|
print(" version: " + color['blue'] + version_ID + color['default'])
|
||||||
|
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"] != None \
|
||||||
|
and mod["compagny-name"] != "":
|
||||||
|
print(" compagny: " + color['purple'] + mod["compagny-name"] + color['default'])
|
||||||
|
if mod["license"] != None \
|
||||||
|
and mod["license"] != "":
|
||||||
|
print(" license: " + color['yellow'] + mod["license"] + color['default'])
|
||||||
|
if mod["maintainer"] != None \
|
||||||
|
and mod["maintainer"] != []:
|
||||||
|
print(" maintainers:")
|
||||||
|
for elem in mod["maintainer"]:
|
||||||
|
print(" " + str(elem))
|
||||||
print(" ex: " + sys.argv[0] + " all --target=Android all -t Windows -m debug all")
|
print(" ex: " + sys.argv[0] + " all --target=Android all -t Windows -m debug all")
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
|
def check_boolean(value):
|
||||||
|
if value == "" \
|
||||||
|
or value == "1" \
|
||||||
|
or value == "true" \
|
||||||
|
or value == "True" \
|
||||||
|
or value == True:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
# preparse the argument to get the verbose element for debug mode
|
# preparse the argument to get the verbose element for debug mode
|
||||||
def parseGenericArg(argument, active):
|
def parseGenericArg(argument, active):
|
||||||
if argument.get_option_nName() == "help":
|
debug.extreme_verbose("parse arg : " + argument.get_option_name() + " " + argument.get_arg() + " active=" + str(active))
|
||||||
#display help
|
if argument.get_option_name() == "help":
|
||||||
if active==False:
|
if active==False:
|
||||||
usage()
|
usage()
|
||||||
return True
|
return True
|
||||||
if argument.get_option_nName() == "list-module":
|
if argument.get_option_name() == "HELP":
|
||||||
|
if active==False:
|
||||||
|
usage(True)
|
||||||
|
return True
|
||||||
|
if argument.get_option_name() == "list-module":
|
||||||
if active==False:
|
if active==False:
|
||||||
listOfModule = module.list_all_module()
|
listOfModule = module.list_all_module()
|
||||||
retValue = ""
|
retValue = ""
|
||||||
@@ -82,7 +186,7 @@ def parseGenericArg(argument, active):
|
|||||||
print(retValue)
|
print(retValue)
|
||||||
exit(0)
|
exit(0)
|
||||||
return True
|
return True
|
||||||
if argument.get_option_nName() == "list-target":
|
if argument.get_option_name() == "list-target":
|
||||||
if active==False:
|
if active==False:
|
||||||
listOfTarget = target.list_all_target()
|
listOfTarget = target.list_all_target()
|
||||||
retValue = ""
|
retValue = ""
|
||||||
@@ -93,42 +197,108 @@ def parseGenericArg(argument, active):
|
|||||||
print(retValue)
|
print(retValue)
|
||||||
exit(0)
|
exit(0)
|
||||||
return True
|
return True
|
||||||
elif argument.get_option_nName()=="jobs":
|
elif argument.get_option_name()=="jobs":
|
||||||
if active==True:
|
if active==True:
|
||||||
multiprocess.set_core_number(int(argument.get_arg()))
|
multiprocess.set_core_number(int(argument.get_arg()))
|
||||||
return True
|
return True
|
||||||
elif argument.get_option_nName() == "verbose":
|
elif argument.get_option_name()=="depth":
|
||||||
|
if active==True:
|
||||||
|
env.set_parse_depth(int(argument.get_arg()))
|
||||||
|
return True
|
||||||
|
elif argument.get_option_name() == "verbose":
|
||||||
if active==True:
|
if active==True:
|
||||||
debug.set_level(int(argument.get_arg()))
|
debug.set_level(int(argument.get_arg()))
|
||||||
return True
|
return True
|
||||||
elif argument.get_option_nName() == "color":
|
elif argument.get_option_name() == "color":
|
||||||
if active==True:
|
if active==True:
|
||||||
|
if check_boolean(argument.get_arg()) == True:
|
||||||
debug.enable_color()
|
debug.enable_color()
|
||||||
|
else:
|
||||||
|
debug.disable_color()
|
||||||
return True
|
return True
|
||||||
elif argument.get_option_nName() == "force":
|
elif argument.get_option_name() == "force-build":
|
||||||
if active==True:
|
if active==True:
|
||||||
|
if check_boolean(argument.get_arg()) == True:
|
||||||
env.set_force_mode(True)
|
env.set_force_mode(True)
|
||||||
|
else:
|
||||||
|
env.set_force_mode(False)
|
||||||
return True
|
return True
|
||||||
elif argument.get_option_nName() == "pretty":
|
elif argument.get_option_name() == "pretty":
|
||||||
if active==True:
|
if active==True:
|
||||||
|
if check_boolean(argument.get_arg()) == True:
|
||||||
env.set_print_pretty_mode(True)
|
env.set_print_pretty_mode(True)
|
||||||
|
else:
|
||||||
|
env.set_print_pretty_mode(False)
|
||||||
return True
|
return True
|
||||||
elif argument.get_option_nName() == "force-strip":
|
elif argument.get_option_name() == "force-optimisation":
|
||||||
if active==True:
|
if active==True:
|
||||||
|
if check_boolean(argument.get_arg()) == True:
|
||||||
|
env.set_force_optimisation(True)
|
||||||
|
else:
|
||||||
|
env.set_force_optimisation(False)
|
||||||
|
return True
|
||||||
|
elif argument.get_option_name() == "force-strip":
|
||||||
|
if active==True:
|
||||||
|
if check_boolean(argument.get_arg()) == True:
|
||||||
env.set_force_strip_mode(True)
|
env.set_force_strip_mode(True)
|
||||||
|
else:
|
||||||
|
env.set_force_strip_mode(False)
|
||||||
|
return True
|
||||||
|
elif argument.get_option_name() == "warning":
|
||||||
|
if active==True:
|
||||||
|
if check_boolean(argument.get_arg()) == True:
|
||||||
|
env.set_warning_mode(True)
|
||||||
|
else:
|
||||||
|
env.set_warning_mode(False)
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
# open configuration of lutin:
|
||||||
|
config_file_name = "lutinConfig.py"
|
||||||
|
config_file = os.path.join(tools.get_run_path(), config_file_name)
|
||||||
|
if os.path.isfile(config_file) == True:
|
||||||
|
sys.path.append(os.path.dirname(config_file))
|
||||||
|
debug.debug("Find basic configuration file: '" + config_file + "'")
|
||||||
|
# the file exist, we can open it and get the initial configuration:
|
||||||
|
configuration_file = __import__(config_file_name[:-3])
|
||||||
|
if "get_exclude_path" in dir(configuration_file):
|
||||||
|
data = configuration_file.get_exclude_path()
|
||||||
|
debug.debug(" get default config 'get_exclude_path' val='" + str(data) + "'")
|
||||||
|
env.set_exclude_search_path(data)
|
||||||
|
if "get_parsing_depth" in dir(configuration_file):
|
||||||
|
data = configuration_file.get_parsing_depth()
|
||||||
|
debug.debug(" get default config 'get_parsing_depth' val='" + str(data) + "'")
|
||||||
|
parseGenericArg(arguments.ArgElement("depth", str(data)), True)
|
||||||
|
|
||||||
|
if "get_default_jobs" in dir(configuration_file):
|
||||||
|
data = configuration_file.get_default_jobs()
|
||||||
|
debug.debug(" get default config 'get_default_jobs' val='" + str(data) + "'")
|
||||||
|
parseGenericArg(arguments.ArgElement("jobs", str(data)), True)
|
||||||
|
|
||||||
|
if "get_default_color" in dir(configuration_file):
|
||||||
|
data = configuration_file.get_default_color()
|
||||||
|
debug.debug(" get default config 'get_default_color' val='" + str(data) + "'")
|
||||||
|
parseGenericArg(arguments.ArgElement("color", str(data)), True)
|
||||||
|
|
||||||
|
if "get_default_debug_level" in dir(configuration_file):
|
||||||
|
data = configuration_file.get_default_debug_level()
|
||||||
|
debug.debug(" get default config 'get_default_debug_level' val='" + str(data) + "'")
|
||||||
|
parseGenericArg(arguments.ArgElement("verbose", str(data)), True)
|
||||||
|
|
||||||
|
if "get_default_print_pretty" in dir(configuration_file):
|
||||||
|
data = configuration_file.get_default_print_pretty()
|
||||||
|
debug.debug(" get default config 'get_default_print_pretty' val='" + str(data) + "'")
|
||||||
|
parseGenericArg(arguments.ArgElement("pretty", str(data)), True)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# parse default unique argument:
|
# parse default unique argument:
|
||||||
for argument in localArgument:
|
for argument in localArgument:
|
||||||
parseGenericArg(argument, True)
|
parseGenericArg(argument, True)
|
||||||
|
|
||||||
|
# initialize the system ...
|
||||||
import lutin
|
lutin.init()
|
||||||
|
|
||||||
|
|
||||||
import lutin.host as lutinHost
|
|
||||||
import lutin.tools as lutinTools
|
|
||||||
|
|
||||||
#available target : Linux / MacOs / Windows / Android ...
|
#available target : Linux / MacOs / Windows / Android ...
|
||||||
targetName = host.OS
|
targetName = host.OS
|
||||||
@@ -139,7 +309,8 @@ config = {
|
|||||||
"arch":"auto",
|
"arch":"auto",
|
||||||
"generate-package":True,
|
"generate-package":True,
|
||||||
"simulation":False,
|
"simulation":False,
|
||||||
"gcov":False
|
"gcov":False,
|
||||||
|
"compilator-version":""
|
||||||
}
|
}
|
||||||
# load the default target :
|
# load the default target :
|
||||||
my_target = None
|
my_target = None
|
||||||
@@ -148,23 +319,25 @@ actionDone=False
|
|||||||
for argument in localArgument:
|
for argument in localArgument:
|
||||||
if parseGenericArg(argument, False) == True:
|
if parseGenericArg(argument, False) == True:
|
||||||
continue
|
continue
|
||||||
elif argument.get_option_nName() == "package":
|
elif argument.get_option_name() == "compilator-version":
|
||||||
|
config["compilator-version"] = argument.get_arg()
|
||||||
|
elif argument.get_option_name() == "package":
|
||||||
config["generate-package"]=False
|
config["generate-package"]=False
|
||||||
elif argument.get_option_nName() == "simulation":
|
elif argument.get_option_name() == "simulation":
|
||||||
config["simulation"]=True
|
config["simulation"]=True
|
||||||
elif argument.get_option_nName() == "gcov":
|
elif argument.get_option_name() == "gcov":
|
||||||
config["gcov"]=True
|
config["gcov"]=True
|
||||||
elif argument.get_option_nName() == "bus":
|
elif argument.get_option_name() == "bus":
|
||||||
config["bus-size"]=argument.get_arg()
|
config["bus-size"]=argument.get_arg()
|
||||||
elif argument.get_option_nName() == "arch":
|
elif argument.get_option_name() == "arch":
|
||||||
config["arch"]=argument.get_arg()
|
config["arch"]=argument.get_arg()
|
||||||
elif argument.get_option_nName() == "compilator":
|
elif argument.get_option_name() == "compilator":
|
||||||
if config["compilator"] != argument.get_arg():
|
if config["compilator"] != argument.get_arg():
|
||||||
debug.debug("change compilator ==> " + argument.get_arg())
|
debug.debug("change compilator ==> " + argument.get_arg())
|
||||||
config["compilator"] = argument.get_arg()
|
config["compilator"] = argument.get_arg()
|
||||||
#remove previous target
|
#remove previous target
|
||||||
my_target = None
|
my_target = None
|
||||||
elif argument.get_option_nName() == "target":
|
elif argument.get_option_name() == "target":
|
||||||
# No check input ==> this will be verify automaticly chen the target will be loaded
|
# No check input ==> this will be verify automaticly chen the target will be loaded
|
||||||
if targetName != argument.get_arg():
|
if targetName != argument.get_arg():
|
||||||
targetName = argument.get_arg()
|
targetName = argument.get_arg()
|
||||||
@@ -177,25 +350,46 @@ for argument in localArgument:
|
|||||||
"arch":"auto",
|
"arch":"auto",
|
||||||
"generate-package":True,
|
"generate-package":True,
|
||||||
"simulation":False,
|
"simulation":False,
|
||||||
"gcov":False
|
"gcov":False,
|
||||||
|
"compilator-version":""
|
||||||
}
|
}
|
||||||
#remove previous target
|
#remove previous target
|
||||||
my_target = None
|
my_target = None
|
||||||
elif argument.get_option_nName() == "mode":
|
elif argument.get_option_name() == "mode":
|
||||||
if config["mode"] != argument.get_arg():
|
if config["mode"] != argument.get_arg():
|
||||||
config["mode"] = argument.get_arg()
|
config["mode"] = argument.get_arg()
|
||||||
debug.debug("change mode ==> " + config["mode"])
|
debug.debug("change mode ==> " + config["mode"])
|
||||||
#remove previous target
|
#remove previous target
|
||||||
my_target = None
|
my_target = None
|
||||||
else:
|
else:
|
||||||
if argument.get_option_nName() != "":
|
argument_value = argument.get_arg()
|
||||||
debug.warning("Can not understand argument : '" + argument.get_option_nName() + "'")
|
debug.debug("something request : '" + argument_value + "'")
|
||||||
|
if argument.get_option_name() != "":
|
||||||
|
debug.warning("Can not understand argument : '" + argument.get_option_name() + "'")
|
||||||
usage()
|
usage()
|
||||||
|
break;
|
||||||
|
name2 = argument_value.replace("@", "?")
|
||||||
|
gettedElement = name2.split("?")
|
||||||
|
module_name = gettedElement[0]
|
||||||
|
action_list = gettedElement[1:]
|
||||||
|
if len(action_list) == 0:
|
||||||
|
action_list = "build"
|
||||||
|
debug.debug("requested: '" + module_name + "' ? actions:'" + str(action_list) + "'")
|
||||||
|
multiple_module_list = []
|
||||||
|
if module_name[-1] == "*":
|
||||||
|
base_name = module_name[:-1]
|
||||||
|
for mod in module.list_all_module():
|
||||||
|
if mod[:len(base_name)] == base_name:
|
||||||
|
debug.verbose("need do it for: " + mod);
|
||||||
|
multiple_module_list.append(mod)
|
||||||
else:
|
else:
|
||||||
|
multiple_module_list.append(module_name)
|
||||||
|
debug.debug("Will do: '" + str(multiple_module_list) + "' ? actions:'" + str(action_list) + "'")
|
||||||
|
for module_name in multiple_module_list:
|
||||||
#load the target if needed :
|
#load the target if needed :
|
||||||
if my_target == None:
|
if my_target == None:
|
||||||
my_target = target.load_target(targetName, config)
|
my_target = target.load_target(targetName, copy.deepcopy(config))
|
||||||
my_target.build(argument.get_arg())
|
my_target.build(module_name, actions=action_list)
|
||||||
actionDone=True
|
actionDone=True
|
||||||
|
|
||||||
# if no action done : we do "all" ...
|
# if no action done : we do "all" ...
|
||||||
|
59
doc/010_basic_concept.bb
Normal file
59
doc/010_basic_concept.bb
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
=?= [center]Basic concept[/center] =?=
|
||||||
|
___________________________________________
|
||||||
|
|
||||||
|
Lutin is a compleate builder system. It is designed to answers all the application problems.
|
||||||
|
The library and the distribution problem are partially manage (no real use-case)
|
||||||
|
|
||||||
|
==Technologie==
|
||||||
|
|
||||||
|
Lutin is designed in Python 2.X or 3.X to answers at the multiplatform problesm. On Linux or MacOs, it is really easy to compile with Makefile, cmake, but on Windows it is an other problem.
|
||||||
|
The first version of Lutin has been designed in Makefile, but we need to wait 20 minutes before the first build. In Pytho it is fast as Linux.
|
||||||
|
|
||||||
|
Lutin is not based over an other builder, but request compilation itself.
|
||||||
|
|
||||||
|
==Features==
|
||||||
|
|
||||||
|
Lutin is designed to:
|
||||||
|
:** support many hardware platform (X86/X64/ARM...);
|
||||||
|
:** support many operation system (windows, Ios, Android ...);
|
||||||
|
:** support complex worktree and depedency;
|
||||||
|
:** build only when needed;
|
||||||
|
:** create platform specific packages (application bundle);
|
||||||
|
:**
|
||||||
|
|
||||||
|
|
||||||
|
==global overview==
|
||||||
|
|
||||||
|
Every build system is based on multiple concept depending of their own designed.
|
||||||
|
|
||||||
|
For lutin we can différentiate 4 basics concepts:
|
||||||
|
:** Mudule: Interface to create a part of an application, that contain binary, scipt, datas ...
|
||||||
|
:** Target: methode to creata an application or a library (may be internal: medium level)
|
||||||
|
:** Builder: Methode to transform element in other, for example: compile a cpp in object file, or object files in binary.
|
||||||
|
:** System: Many OS manage basic element contain in the OS, This part permit to find generic module availlable in the system.
|
||||||
|
|
||||||
|
===Module===
|
||||||
|
|
||||||
|
When you use lutin, you migth first create a module, This is the basis of the framework. It permit to describe your "module", all it contain, and the deendency.
|
||||||
|
|
||||||
|
We can separate a module in some part:
|
||||||
|
:** Binary:
|
||||||
|
:: A binary is an end point element.
|
||||||
|
:: It can be transform in a complete standalone bundle, or in an part instalable.
|
||||||
|
:** Library:
|
||||||
|
:: This represent an element that is used by other application
|
||||||
|
:** Package:
|
||||||
|
:: To Be Define.
|
||||||
|
|
||||||
|
|
||||||
|
===Target===
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
===Builder===
|
||||||
|
|
||||||
|
|
||||||
|
===System===
|
||||||
|
|
||||||
|
|
||||||
|
|
153
doc/020_Compile_a_module.bb
Normal file
153
doc/020_Compile_a_module.bb
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
=?= [center]Basic concept[/center] =?=
|
||||||
|
___________________________________________
|
||||||
|
|
||||||
|
Lutin permit simply to compile applications and library.
|
||||||
|
|
||||||
|
To simply understand the use, we will use a simple library:
|
||||||
|
|
||||||
|
[code style=bash]
|
||||||
|
git clone http://github.con/atria-soft/etk.git
|
||||||
|
[/code]
|
||||||
|
|
||||||
|
etk is a basic library that have drive the lutin project.
|
||||||
|
|
||||||
|
|
||||||
|
== compile a module ==
|
||||||
|
|
||||||
|
It is really simple:
|
||||||
|
|
||||||
|
[code style=bash]
|
||||||
|
lutin yourModuleName
|
||||||
|
#example:
|
||||||
|
lutin etk
|
||||||
|
[/code]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
== Option working ==
|
||||||
|
|
||||||
|
Lutin have a complex option methodologie. We can consider 3 part of the option:
|
||||||
|
:** Global option
|
||||||
|
:** target option
|
||||||
|
:** modules
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
== Generic options ==
|
||||||
|
|
||||||
|
=== Display help ===
|
||||||
|
|
||||||
|
Availlable everywhere ...
|
||||||
|
|
||||||
|
[code style=bash]
|
||||||
|
lutin -h
|
||||||
|
lutin --help
|
||||||
|
[/code]
|
||||||
|
|
||||||
|
You can see in this help that it take a litle time to react.
|
||||||
|
The first time you run lutin, it parse all the file in your sub-directory.
|
||||||
|
But the system keep the data in cash, then the next time it is faster.
|
||||||
|
|
||||||
|
At the end of the help you an see an help about the etk librery with the associated help.
|
||||||
|
|
||||||
|
=== Build in color ===
|
||||||
|
|
||||||
|
[code style=bash]
|
||||||
|
lutin -C
|
||||||
|
lutin --color
|
||||||
|
[/code]
|
||||||
|
|
||||||
|
=== Display build line in pretty print mode ===
|
||||||
|
|
||||||
|
when an error apear, the gcc or clang compile line can be really unreadable:
|
||||||
|
[code]
|
||||||
|
g++ -o /home/heero/dev/plop/out/Linux_x86_64/release/build/gcc/etk/obj/etk/Color.cpp.o -I/home/heero/dev/plop/etk -std=c++11 -D__CPP_VERSION__=2011 -D__TARGET_OS__Linux -D__TARGET_ARCH__x86 -D__TARGET_ADDR__64BITS -D_REENTRANT -DNDEBUG -O3 -fpic -D__STDCPP_GNU__ -Wall -Wsign-compare -Wreturn-type -Wno-write-strings -Woverloaded-virtual -Wnon-virtual-dtor -Wno-unused-variable -DMODE_RELEASE -c -MMD -MP /home/heero/dev/plop/etk/etk/Color.cpp
|
||||||
|
[/code]
|
||||||
|
|
||||||
|
whith this option you can transform this not obvious line in a readable line:
|
||||||
|
|
||||||
|
[code style=bash]
|
||||||
|
lutin -P
|
||||||
|
lutin --pretty
|
||||||
|
[/code]
|
||||||
|
|
||||||
|
result:
|
||||||
|
[code]
|
||||||
|
g++ \
|
||||||
|
-o /home/XXX/dev/out/Linux_x86_64/release/build/gcc/etk/obj/etk/Color.cpp.o \
|
||||||
|
-I/home/XXX/dev/etk \
|
||||||
|
-std=c++11 \
|
||||||
|
-D__CPP_VERSION__=2011 \
|
||||||
|
-D__TARGET_OS__Linux \
|
||||||
|
-D__TARGET_ARCH__x86 \
|
||||||
|
-D__TARGET_ADDR__64BITS \
|
||||||
|
-D_REENTRANT \
|
||||||
|
-DNDEBUG \
|
||||||
|
-O3 \
|
||||||
|
-fpic \
|
||||||
|
-D__STDCPP_GNU__ \
|
||||||
|
-Wall \
|
||||||
|
-Wsign-compare \
|
||||||
|
-Wreturn-type \
|
||||||
|
-Wno-write-strings \
|
||||||
|
-Woverloaded-virtual \
|
||||||
|
-Wnon-virtual-dtor \
|
||||||
|
-Wno-unused-variable \
|
||||||
|
-DMODE_RELEASE \
|
||||||
|
-c \
|
||||||
|
-MMD \
|
||||||
|
-MP \
|
||||||
|
/home/XXX/dev/etk/etk/Color.cpp
|
||||||
|
[/code]
|
||||||
|
|
||||||
|
=== lutin log ===
|
||||||
|
|
||||||
|
Lutin have an internal log system. To enable or disable it just select your debug level with the option:
|
||||||
|
|
||||||
|
[code style=bash]
|
||||||
|
lutin -v4
|
||||||
|
lutin --verbose 4
|
||||||
|
[/code]
|
||||||
|
|
||||||
|
The level availlables are:
|
||||||
|
:** 0: None
|
||||||
|
:** 1: error
|
||||||
|
:** 2: warning (default)
|
||||||
|
:** 3: info
|
||||||
|
:** 4: debug
|
||||||
|
:** 5: verbose
|
||||||
|
:** 6: extreme_verbose
|
||||||
|
|
||||||
|
=== select the number of CPU core used ===
|
||||||
|
|
||||||
|
By default lutin manage only 1 CPU core (faster to debug) but for speed requirement you can use use multiple core:
|
||||||
|
|
||||||
|
[code style=bash]
|
||||||
|
#for 5 core
|
||||||
|
lutin -j5
|
||||||
|
lutin --jobs 5
|
||||||
|
[/code]
|
||||||
|
|
||||||
|
=== Force rebuild all ===
|
||||||
|
|
||||||
|
Sometime it is needed to rebuild all the program, just do :
|
||||||
|
|
||||||
|
[code style=bash]
|
||||||
|
lutin -B
|
||||||
|
lutin --force-build
|
||||||
|
[/code]
|
||||||
|
|
||||||
|
=== Force rebuild all ===
|
||||||
|
|
||||||
|
Force strip of output binary (remove symboles)
|
||||||
|
|
||||||
|
[code style=bash]
|
||||||
|
lutin -s
|
||||||
|
lutin --force-strip
|
||||||
|
[/code]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-w / --warning
|
||||||
|
Store warning in a file build file
|
0
doc/030_Create_a_new_module.bb
Normal file
0
doc/030_Create_a_new_module.bb
Normal file
100
doc/index.bb
Normal file
100
doc/index.bb
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
=?= [center]Lutin Build system[/center] =?=
|
||||||
|
___________________________________________
|
||||||
|
|
||||||
|
===What is Lutin, and how can I use it?===
|
||||||
|
|
||||||
|
Lutin is an application/library builder, it is designed to concurence CMake, Makefile, Ant, graddle ...
|
||||||
|
|
||||||
|
Lutin is deveopped in Python 2.x and 3.x to permit many user to play with it.
|
||||||
|
|
||||||
|
Python permit to Lutin to be used in many environement in a fast way.
|
||||||
|
|
||||||
|
Lutin support can compile every thing you want, just add a builder that you need (not in the common way). Basicly Lutin support languages:
|
||||||
|
:** C (ainsi/89/99) ==> .o;
|
||||||
|
:** C++ (98/99/03/11/14/...) ==> .o;
|
||||||
|
:** .S (assembleur) ==> .o;
|
||||||
|
:** .java ==> .class;
|
||||||
|
:** .class ==> jar;
|
||||||
|
:** .o ==> .a;
|
||||||
|
:** .o ==> .so;
|
||||||
|
:** .o/.a ==> binary.
|
||||||
|
|
||||||
|
Some packege can be generate for some platform:
|
||||||
|
:** debian package;
|
||||||
|
:** windows application zip;
|
||||||
|
:** MacOs application .app;
|
||||||
|
:** iOs package;
|
||||||
|
:** Android Package .apk.
|
||||||
|
|
||||||
|
Compilation is availlable for:
|
||||||
|
:** gcc/g++;
|
||||||
|
:** clang/clang++.
|
||||||
|
|
||||||
|
Manage [b]workspace build[/b] (in oposition of CMake/make/...)
|
||||||
|
|
||||||
|
|
||||||
|
=== Install: ===
|
||||||
|
|
||||||
|
Requirements: ``Python >= 2.7`` and ``pip``
|
||||||
|
|
||||||
|
==== Install lutin: ===
|
||||||
|
Just run:
|
||||||
|
[code style=bash]
|
||||||
|
pip install lutin
|
||||||
|
[/code]
|
||||||
|
|
||||||
|
==== Install pip ====
|
||||||
|
Install pip on debian/ubuntu:
|
||||||
|
[code style=bash]
|
||||||
|
sudo apt-get install pip
|
||||||
|
[/code]
|
||||||
|
|
||||||
|
Install pip on ARCH-linux:
|
||||||
|
[code style=bash]
|
||||||
|
sudo pacman -S pip
|
||||||
|
[/code]
|
||||||
|
|
||||||
|
Install pip on MacOs:
|
||||||
|
[code style=bash]
|
||||||
|
sudo easy_install pip
|
||||||
|
[/code]
|
||||||
|
|
||||||
|
==== Install from sources ====
|
||||||
|
|
||||||
|
[code style=bash]
|
||||||
|
git clone http://github.com/HeeroYui/lutin.git
|
||||||
|
cd lutin
|
||||||
|
sudo ./setup.py install
|
||||||
|
[/code]
|
||||||
|
|
||||||
|
=== License (APACHE v2.0) ===
|
||||||
|
|
||||||
|
Copyright lutin Edouard DUPIN
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
|
||||||
|
|
||||||
|
=== History: ===
|
||||||
|
|
||||||
|
I work with some builder, Every one have theire own adventages, and their problems.
|
||||||
|
The main point I see, is that the polimorphisme of the worktree is really hard.
|
||||||
|
The second point is the generation on different platforms is hard too.
|
||||||
|
|
||||||
|
Some other problem example:
|
||||||
|
:** Makefile is too slow on windows mingw;
|
||||||
|
:** Cmake does not create end point package;
|
||||||
|
:** none is really simple to write.
|
||||||
|
|
||||||
|
Then I create a simple interface that manage all I need. and written in python to permit to be faster on every platform.
|
||||||
|
|
||||||
|
[tutorial[000_Build | Tutorials]]
|
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
@@ -8,6 +9,7 @@
|
|||||||
##
|
##
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import fnmatch
|
||||||
# Local import
|
# Local import
|
||||||
from . import target
|
from . import target
|
||||||
from . import builder
|
from . import builder
|
||||||
@@ -16,32 +18,138 @@ from . import host
|
|||||||
from . import tools
|
from . import tools
|
||||||
from . import debug
|
from . import debug
|
||||||
from . import module
|
from . import module
|
||||||
|
from . import env
|
||||||
is_init = False
|
is_init = False
|
||||||
|
|
||||||
if is_init == False:
|
|
||||||
debug.verbose("Use Make as a make stadard")
|
|
||||||
sys.path.append(tools.get_run_folder())
|
|
||||||
builder.import_path(tools.get_current_path(__file__))
|
|
||||||
module.import_path(tools.get_current_path(__file__))
|
|
||||||
system.import_path(tools.get_current_path(__file__))
|
|
||||||
target.import_path(tools.get_current_path(__file__))
|
|
||||||
|
|
||||||
debug.debug("missing file lutinBase.py ==> loading subPath...");
|
def filter_name_and_file(root, list_files, filter):
|
||||||
|
# filter elements:
|
||||||
|
tmp_list = fnmatch.filter(list_files, filter)
|
||||||
|
out = []
|
||||||
|
for elem in tmp_list:
|
||||||
|
if os.path.isfile(os.path.join(root, elem)) == True:
|
||||||
|
out.append(elem);
|
||||||
|
return out;
|
||||||
|
|
||||||
|
def filter_path(root, list_files):
|
||||||
|
out = []
|
||||||
|
for elem in list_files:
|
||||||
|
if len(elem) == 0 \
|
||||||
|
or elem[0] == '.':
|
||||||
|
continue
|
||||||
|
if os.path.isdir(os.path.join(root, elem)) == True:
|
||||||
|
out.append(elem);
|
||||||
|
return out;
|
||||||
|
|
||||||
|
def import_path_local(path, limit_sub_folder, exclude_path = [], base_name = ""):
|
||||||
|
out = []
|
||||||
|
debug.verbose("lutin files: " + str(path) + " [START]")
|
||||||
|
if limit_sub_folder == 0:
|
||||||
|
debug.debug("Subparsing limitation append ...")
|
||||||
|
return []
|
||||||
|
try:
|
||||||
|
list_files = os.listdir(path)
|
||||||
|
except:
|
||||||
|
# an error occure, maybe read error ...
|
||||||
|
debug.warning("error when getting subdirectory of '" + str(path) + "'")
|
||||||
|
return []
|
||||||
|
if path in exclude_path:
|
||||||
|
debug.debug("find '" + str(path) + "' in exclude_path=" + str(exclude_path))
|
||||||
|
return []
|
||||||
|
# filter elements:
|
||||||
|
tmp_list_lutin_file = filter_name_and_file(path, list_files, base_name + "*.py")
|
||||||
|
debug.verbose("lutin files: " + str(path) + " : " + str(tmp_list_lutin_file))
|
||||||
|
# Import the module:
|
||||||
|
for filename in tmp_list_lutin_file:
|
||||||
|
out.append(os.path.join(path, filename))
|
||||||
|
debug.extreme_verbose(" Find a file : '" + str(out[-1]) + "'")
|
||||||
|
need_parse_sub_folder = True
|
||||||
|
rm_value = -1
|
||||||
|
# check if we need to parse sub_folder
|
||||||
|
if len(tmp_list_lutin_file) != 0:
|
||||||
|
need_parse_sub_folder = False
|
||||||
|
# check if the file "lutin_parse_sub.py" is present ==> parse SubFolder (force and add +1 in the resursing
|
||||||
|
if base_name + "ParseSubFolders.txt" in list_files:
|
||||||
|
debug.debug("find SubParser ... " + str(base_name + "ParseSubFolders.txt") + " " + path)
|
||||||
|
data_file_sub = tools.file_read_data(os.path.join(path, base_name + "ParseSubFolders.txt"))
|
||||||
|
if data_file_sub == "":
|
||||||
|
debug.debug(" Empty file Load all subfolder in the worktree in '" + str(path) + "'")
|
||||||
|
need_parse_sub_folder = True
|
||||||
|
rm_value = 0
|
||||||
|
else:
|
||||||
|
list_sub = data_file_sub.split("\n")
|
||||||
|
debug.debug(" Parse selected folders " + str(list_sub) + " no parse local folder directory")
|
||||||
|
need_parse_sub_folder = False
|
||||||
|
for folder in list_sub:
|
||||||
|
if folder == "" \
|
||||||
|
or folder == "/":
|
||||||
|
continue;
|
||||||
|
tmp_out = import_path_local(os.path.join(path, folder),
|
||||||
|
1,
|
||||||
|
exclude_path,
|
||||||
|
base_name)
|
||||||
|
# add all the elements:
|
||||||
|
for elem in tmp_out:
|
||||||
|
out.append(elem)
|
||||||
|
if need_parse_sub_folder == True:
|
||||||
|
list_folders = filter_path(path, list_files)
|
||||||
|
for folder in list_folders:
|
||||||
|
tmp_out = import_path_local(os.path.join(path, folder),
|
||||||
|
limit_sub_folder - rm_value,
|
||||||
|
exclude_path,
|
||||||
|
base_name)
|
||||||
|
# add all the elements:
|
||||||
|
for elem in tmp_out:
|
||||||
|
out.append(elem)
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
def init():
|
||||||
|
global is_init;
|
||||||
|
if is_init == True:
|
||||||
|
return
|
||||||
|
debug.verbose("Use Make as a make stadard")
|
||||||
|
sys.path.append(tools.get_run_path())
|
||||||
|
# create the list of basic folder:
|
||||||
|
basic_folder_list = []
|
||||||
|
basic_folder_list.append([tools.get_current_path(__file__), True])
|
||||||
# Import all sub path without out and archive
|
# Import all sub path without out and archive
|
||||||
for folder in os.listdir("."):
|
for elem_path in os.listdir("."):
|
||||||
if os.path.isdir(folder)==True:
|
if os.path.isdir(elem_path) == False:
|
||||||
if folder.lower()!="android" \
|
continue
|
||||||
and folder.lower()!="archive" \
|
if elem_path.lower() == "android" \
|
||||||
and folder.lower()!="out" :
|
or elem_path == "out" :
|
||||||
debug.debug("Automatic load path: '" + folder + "'")
|
continue
|
||||||
builder.import_path(folder)
|
debug.debug("Automatic load path: '" + elem_path + "'")
|
||||||
module.import_path(folder)
|
basic_folder_list.append([elem_path, False])
|
||||||
system.import_path(folder)
|
|
||||||
target.import_path(folder)
|
# create in a single path the basic list of lutin files (all start with lutin and end with .py)
|
||||||
|
exclude_path = env.get_exclude_search_path()
|
||||||
|
limit_sub_folder = env.get_parse_depth()
|
||||||
|
list_of_lutin_files = []
|
||||||
|
for elem_path, is_system in basic_folder_list:
|
||||||
|
if is_system == True:
|
||||||
|
limit_sub_folder_tmp = 999999
|
||||||
|
else:
|
||||||
|
limit_sub_folder_tmp = limit_sub_folder
|
||||||
|
tmp_out = import_path_local(elem_path,
|
||||||
|
limit_sub_folder_tmp,
|
||||||
|
exclude_path,
|
||||||
|
env.get_build_system_base_name())
|
||||||
|
# add all the elements:
|
||||||
|
for elem in tmp_out:
|
||||||
|
list_of_lutin_files.append(elem)
|
||||||
|
|
||||||
|
debug.debug("Files specific lutin: ")
|
||||||
|
for elem_path in list_of_lutin_files:
|
||||||
|
debug.debug(" " + elem_path)
|
||||||
|
# simply import element from the basic list of files (single parse ...)
|
||||||
|
builder.import_path(list_of_lutin_files)
|
||||||
|
module.import_path(list_of_lutin_files)
|
||||||
|
system.import_path(list_of_lutin_files)
|
||||||
|
target.import_path(list_of_lutin_files)
|
||||||
|
|
||||||
builder.init()
|
builder.init()
|
||||||
|
|
||||||
is_init = True
|
is_init = True
|
||||||
|
|
||||||
|
|
||||||
|
96
lutin/arg.py
96
lutin/arg.py
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
@@ -12,22 +13,22 @@ from . import debug
|
|||||||
|
|
||||||
class ArgElement:
|
class ArgElement:
|
||||||
def __init__(self, option, value=""):
|
def __init__(self, option, value=""):
|
||||||
self.m_option = option;
|
self.option = option;
|
||||||
self.m_arg = value;
|
self.arg = value;
|
||||||
|
|
||||||
def get_option_nName(self):
|
def get_option_name(self):
|
||||||
return self.m_option
|
return self.option
|
||||||
|
|
||||||
def get_arg(self):
|
def get_arg(self):
|
||||||
return self.m_arg
|
return self.arg
|
||||||
|
|
||||||
def display(self):
|
def display(self):
|
||||||
if len(self.m_arg)==0:
|
if len(self.arg)==0:
|
||||||
debug.info("option : " + self.m_option)
|
debug.info("option : " + self.option)
|
||||||
elif len(self.m_option)==0:
|
elif len(self.option)==0:
|
||||||
debug.info("element : " + self.m_arg)
|
debug.info("element : " + self.arg)
|
||||||
else:
|
else:
|
||||||
debug.info("option : " + self.m_option + ":" + self.m_arg)
|
debug.info("option : " + self.option + ":" + self.arg)
|
||||||
|
|
||||||
|
|
||||||
class ArgDefine:
|
class ArgDefine:
|
||||||
@@ -37,61 +38,62 @@ class ArgDefine:
|
|||||||
list=[], # ["val", "description"]
|
list=[], # ["val", "description"]
|
||||||
desc="",
|
desc="",
|
||||||
haveParam=False):
|
haveParam=False):
|
||||||
self.m_optionSmall = smallOption;
|
self.option_small = smallOption;
|
||||||
self.m_optionBig = bigOption;
|
self.option_big = bigOption;
|
||||||
self.m_list = list;
|
self.list = list;
|
||||||
if len(self.m_list)!=0:
|
if len(self.list)!=0:
|
||||||
self.m_haveParam = True
|
self.have_param = True
|
||||||
else:
|
else:
|
||||||
if True==haveParam:
|
if True==haveParam:
|
||||||
self.m_haveParam = True
|
self.have_param = True
|
||||||
else:
|
else:
|
||||||
self.m_haveParam = False
|
self.have_param = False
|
||||||
self.m_description = desc;
|
self.description = desc;
|
||||||
|
|
||||||
def get_option_small(self):
|
def get_option_small(self):
|
||||||
return self.m_optionSmall
|
return self.option_small
|
||||||
|
|
||||||
def get_option_big(self):
|
def get_option_big(self):
|
||||||
return self.m_optionBig
|
return self.option_big
|
||||||
|
|
||||||
def need_parameters(self):
|
def need_parameters(self):
|
||||||
return self.m_haveParam
|
return self.have_param
|
||||||
|
|
||||||
def get_porperties(self):
|
def get_porperties(self):
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
def check_availlable(self, argument):
|
def check_availlable(self, argument):
|
||||||
if len(self.m_list)==0:
|
if len(self.list)==0:
|
||||||
return True
|
return True
|
||||||
for element,desc in self.m_list:
|
for element,desc in self.list:
|
||||||
if element == argument:
|
if element == argument:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def display(self):
|
def display(self):
|
||||||
if self.m_optionSmall != "" and self.m_optionBig != "":
|
color = debug.get_color_set()
|
||||||
print(" -" + self.m_optionSmall + " / --" + self.m_optionBig)
|
if self.option_small != "" and self.option_big != "":
|
||||||
elif self.m_optionSmall != "":
|
print(" " + color['red'] + "-" + self.option_small + "" + color['default'] + " / " + color['red'] + "--" + self.option_big + color['default'])
|
||||||
print(" -" + self.m_optionSmall)
|
elif self.option_small != "":
|
||||||
elif self.m_optionBig != "":
|
print(" " + color['red'] + "-" + self.option_small + color['default'])
|
||||||
print(" --" + self.m_optionBig)
|
elif self.option_big != "":
|
||||||
|
print(" " + color['red'] + "--" + self.option_big + color['default'])
|
||||||
else:
|
else:
|
||||||
print(" ???? ==> internal error ...")
|
print(" ???? ==> internal error ...")
|
||||||
if self.m_description != "":
|
if self.description != "":
|
||||||
print(" " + self.m_description)
|
print(" " + self.description)
|
||||||
if len(self.m_list)!=0:
|
if len(self.list)!=0:
|
||||||
hasDescriptiveElement=False
|
hasDescriptiveElement=False
|
||||||
for val,desc in self.m_list:
|
for val,desc in self.list:
|
||||||
if desc!="":
|
if desc!="":
|
||||||
hasDescriptiveElement=True
|
hasDescriptiveElement=True
|
||||||
break;
|
break;
|
||||||
if hasDescriptiveElement==True:
|
if hasDescriptiveElement==True:
|
||||||
for val,desc in self.m_list:
|
for val,desc in self.list:
|
||||||
print(" " + val + " : " + desc)
|
print(" " + val + " : " + desc)
|
||||||
else:
|
else:
|
||||||
tmpElementPrint = ""
|
tmpElementPrint = ""
|
||||||
for val,desc in self.m_list:
|
for val,desc in self.list:
|
||||||
if len(tmpElementPrint)!=0:
|
if len(tmpElementPrint)!=0:
|
||||||
tmpElementPrint += " / "
|
tmpElementPrint += " / "
|
||||||
tmpElementPrint += val
|
tmpElementPrint += val
|
||||||
@@ -105,8 +107,8 @@ class ArgSection:
|
|||||||
def __init__(self,
|
def __init__(self,
|
||||||
sectionName="",
|
sectionName="",
|
||||||
desc=""):
|
desc=""):
|
||||||
self.m_section = sectionName;
|
self.section = sectionName;
|
||||||
self.m_description = desc;
|
self.description = desc;
|
||||||
|
|
||||||
def get_option_small(self):
|
def get_option_small(self):
|
||||||
return ""
|
return ""
|
||||||
@@ -115,10 +117,12 @@ class ArgSection:
|
|||||||
return ""
|
return ""
|
||||||
|
|
||||||
def get_porperties(self):
|
def get_porperties(self):
|
||||||
return " [" + self.m_section + "]"
|
color = debug.get_color_set()
|
||||||
|
return " [" + color['blue'] + self.section + color['default'] + "]"
|
||||||
|
|
||||||
def display(self):
|
def display(self):
|
||||||
print(" [" + self.m_section + "] : " + self.m_description)
|
color = debug.get_color_set()
|
||||||
|
print(" [" + color['blue'] + self.section + color['default'] + "] : " + self.description)
|
||||||
|
|
||||||
def parse(self, argList, currentID):
|
def parse(self, argList, currentID):
|
||||||
return currentID;
|
return currentID;
|
||||||
@@ -126,13 +130,13 @@ class ArgSection:
|
|||||||
|
|
||||||
class LutinArg:
|
class LutinArg:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.m_listProperties = []
|
self.listProperties = []
|
||||||
|
|
||||||
def add(self, argument):
|
def add(self, argument):
|
||||||
self.m_listProperties.append(argument) #ArgDefine(smallOption, bigOption, haveParameter, parameterList, description));
|
self.listProperties.append(argument) #ArgDefine(smallOption, bigOption, haveParameter, parameterList, description));
|
||||||
|
|
||||||
def add_section(self, sectionName, sectionDesc):
|
def add_section(self, sectionName, sectionDesc):
|
||||||
self.m_listProperties.append(ArgSection(sectionName, sectionDesc))
|
self.listProperties.append(ArgSection(sectionName, sectionDesc))
|
||||||
|
|
||||||
def parse(self):
|
def parse(self):
|
||||||
listArgument = [] # composed of list element
|
listArgument = [] # composed of list element
|
||||||
@@ -155,7 +159,7 @@ class LutinArg:
|
|||||||
argumentFound=False;
|
argumentFound=False;
|
||||||
if option[:2]=="--":
|
if option[:2]=="--":
|
||||||
# big argument
|
# big argument
|
||||||
for prop in self.m_listProperties:
|
for prop in self.listProperties:
|
||||||
if prop.get_option_big()=="":
|
if prop.get_option_big()=="":
|
||||||
continue
|
continue
|
||||||
if prop.get_option_big() == option[2:]:
|
if prop.get_option_big() == option[2:]:
|
||||||
@@ -197,7 +201,7 @@ class LutinArg:
|
|||||||
debug.error("UNKNOW argument : '" + argument + "'")
|
debug.error("UNKNOW argument : '" + argument + "'")
|
||||||
elif option[:1]=="-":
|
elif option[:1]=="-":
|
||||||
# small argument
|
# small argument
|
||||||
for prop in self.m_listProperties:
|
for prop in self.listProperties:
|
||||||
if prop.get_option_small()=="":
|
if prop.get_option_small()=="":
|
||||||
continue
|
continue
|
||||||
if prop.get_option_small() == option[1:1+len(prop.get_option_small())]:
|
if prop.get_option_small() == option[1:1+len(prop.get_option_small())]:
|
||||||
@@ -251,8 +255,8 @@ class LutinArg:
|
|||||||
def display(self):
|
def display(self):
|
||||||
print("usage:")
|
print("usage:")
|
||||||
listOfPropertiesArg = "";
|
listOfPropertiesArg = "";
|
||||||
for element in self.m_listProperties :
|
for element in self.listProperties :
|
||||||
listOfPropertiesArg += element.get_porperties()
|
listOfPropertiesArg += element.get_porperties()
|
||||||
print(" " + sys.argv[0] + listOfPropertiesArg + " ...")
|
print(" " + sys.argv[0] + listOfPropertiesArg + " ...")
|
||||||
for element in self.m_listProperties :
|
for element in self.listProperties :
|
||||||
element.display()
|
element.display()
|
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
@@ -14,6 +15,7 @@ import datetime
|
|||||||
# Local import
|
# Local import
|
||||||
from . import debug
|
from . import debug
|
||||||
from . import heritage
|
from . import heritage
|
||||||
|
from . import env
|
||||||
|
|
||||||
##
|
##
|
||||||
## constitution of dictionnary:
|
## constitution of dictionnary:
|
||||||
@@ -23,26 +25,37 @@ from . import heritage
|
|||||||
## - "builder": pointer on the element
|
## - "builder": pointer on the element
|
||||||
##
|
##
|
||||||
builder_list=[]
|
builder_list=[]
|
||||||
__start_builder_name="lutinBuilder_"
|
__start_builder_name="Builder_"
|
||||||
|
|
||||||
|
|
||||||
def import_path(path):
|
def import_path(path_list):
|
||||||
global builder_list
|
global builder_list
|
||||||
matches = []
|
global_base = env.get_build_system_base_name()
|
||||||
debug.debug('BUILDER: Start find sub File : "%s"' %path)
|
debug.debug("BUILDER: Init with Files list:")
|
||||||
for root, dirnames, filenames in os.walk(path):
|
for elem in path_list:
|
||||||
tmpList = fnmatch.filter(filenames, __start_builder_name + "*.py")
|
sys.path.append(os.path.dirname(elem))
|
||||||
# Import the module :
|
# Get file name:
|
||||||
for filename in tmpList:
|
filename = os.path.basename(elem)
|
||||||
debug.debug('BUILDER: Find a file : "%s"' %os.path.join(root, filename))
|
# Remove .py at the end:
|
||||||
#matches.append(os.path.join(root, filename))
|
filename = filename[:-3]
|
||||||
sys.path.append(os.path.dirname(os.path.join(root, filename)) )
|
base_file_name = filename
|
||||||
builder_name = filename.replace('.py', '')
|
# Remove global base name:
|
||||||
the_builder = __import__(builder_name)
|
filename = filename[len(global_base):]
|
||||||
|
# Check if it start with the local patern:
|
||||||
|
if filename[:len(__start_builder_name)] != __start_builder_name:
|
||||||
|
debug.extreme_verbose("BUILDER: Integrate: '" + filename + "' from '" + elem + "' ==> rejected")
|
||||||
|
continue
|
||||||
|
# Remove local patern
|
||||||
|
builder_name = filename[len(__start_builder_name):]
|
||||||
|
debug.verbose("BUILDER: Integrate: '" + builder_name + "' from '" + elem + "'")
|
||||||
|
the_builder = __import__(base_file_name)
|
||||||
builder_list.append({"name":builder_name,
|
builder_list.append({"name":builder_name,
|
||||||
"element":the_builder
|
"element":the_builder
|
||||||
})
|
})
|
||||||
debug.debug('BUILDER: type=' + the_builder.get_type() + " in=" + str(the_builder.get_input_type()) + " out=" + str(the_builder.get_output_type()))
|
debug.debug('BUILDER: type=' + the_builder.get_type() + " in=" + str(the_builder.get_input_type()) + " out=" + str(the_builder.get_output_type()))
|
||||||
|
debug.verbose("List of BUILDER: ")
|
||||||
|
for elem in builder_list:
|
||||||
|
debug.verbose(" " + str(elem["name"]))
|
||||||
|
|
||||||
# we must have call all import before ...
|
# we must have call all import before ...
|
||||||
def init():
|
def init():
|
||||||
|
156
lutin/debug.py
156
lutin/debug.py
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
@@ -11,8 +12,8 @@ import os
|
|||||||
import threading
|
import threading
|
||||||
import re
|
import re
|
||||||
|
|
||||||
debugLevel=3
|
debug_level=3
|
||||||
debugColor=False
|
debug_color=False
|
||||||
|
|
||||||
color_default= ""
|
color_default= ""
|
||||||
color_red = ""
|
color_red = ""
|
||||||
@@ -23,20 +24,20 @@ color_purple = ""
|
|||||||
color_cyan = ""
|
color_cyan = ""
|
||||||
|
|
||||||
|
|
||||||
debugLock = threading.Lock()
|
debug_lock = threading.Lock()
|
||||||
|
|
||||||
def set_level(id):
|
def set_level(id):
|
||||||
global debugLevel
|
global debug_level
|
||||||
debugLevel = id
|
debug_level = id
|
||||||
#print "SetDebug level at " + str(debugLevel)
|
#print "SetDebug level at " + str(debug_level)
|
||||||
|
|
||||||
def get_level():
|
def get_level():
|
||||||
global debugLevel
|
global debug_level
|
||||||
return debugLevel
|
return debug_level
|
||||||
|
|
||||||
def enable_color():
|
def enable_color():
|
||||||
global debugColor
|
global debug_color
|
||||||
debugColor = True
|
debug_color = True
|
||||||
global color_default
|
global color_default
|
||||||
color_default= "\033[00m"
|
color_default= "\033[00m"
|
||||||
global color_red
|
global color_red
|
||||||
@@ -46,87 +47,114 @@ def enable_color():
|
|||||||
global color_yellow
|
global color_yellow
|
||||||
color_yellow = "\033[33m"
|
color_yellow = "\033[33m"
|
||||||
global color_blue
|
global color_blue
|
||||||
color_blue = "\033[34m"
|
color_blue = "\033[01;34m"
|
||||||
global color_purple
|
global color_purple
|
||||||
color_purple = "\033[35m"
|
color_purple = "\033[35m"
|
||||||
global color_cyan
|
global color_cyan
|
||||||
color_cyan = "\033[36m"
|
color_cyan = "\033[36m"
|
||||||
|
|
||||||
|
def disable_color():
|
||||||
|
global debug_color
|
||||||
|
debug_color = True
|
||||||
|
global color_default
|
||||||
|
color_default= ""
|
||||||
|
global color_red
|
||||||
|
color_red = ""
|
||||||
|
global color_green
|
||||||
|
color_green = ""
|
||||||
|
global color_yellow
|
||||||
|
color_yellow = ""
|
||||||
|
global color_blue
|
||||||
|
color_blue = ""
|
||||||
|
global color_purple
|
||||||
|
color_purple = ""
|
||||||
|
global color_cyan
|
||||||
|
color_cyan = ""
|
||||||
|
|
||||||
def extreme_verbose(input, force=False):
|
def extreme_verbose(input, force=False):
|
||||||
global debugLock
|
global debug_lock
|
||||||
global debugLevel
|
global debug_level
|
||||||
if debugLevel >= 6 \
|
if debug_level >= 6 \
|
||||||
or force == True:
|
or force == True:
|
||||||
debugLock.acquire()
|
debug_lock.acquire()
|
||||||
print(color_blue + input + color_default)
|
print(color_blue + input + color_default)
|
||||||
debugLock.release()
|
debug_lock.release()
|
||||||
|
|
||||||
def verbose(input, force=False):
|
def verbose(input, force=False):
|
||||||
global debugLock
|
global debug_lock
|
||||||
global debugLevel
|
global debug_level
|
||||||
if debugLevel >= 5 \
|
if debug_level >= 5 \
|
||||||
or force == True:
|
or force == True:
|
||||||
debugLock.acquire()
|
debug_lock.acquire()
|
||||||
print(color_blue + input + color_default)
|
print(color_blue + input + color_default)
|
||||||
debugLock.release()
|
debug_lock.release()
|
||||||
|
|
||||||
def debug(input, force=False):
|
def debug(input, force=False):
|
||||||
global debugLock
|
global debug_lock
|
||||||
global debugLevel
|
global debug_level
|
||||||
if debugLevel >= 4 \
|
if debug_level >= 4 \
|
||||||
or force == True:
|
or force == True:
|
||||||
debugLock.acquire()
|
debug_lock.acquire()
|
||||||
print(color_green + input + color_default)
|
print(color_green + input + color_default)
|
||||||
debugLock.release()
|
debug_lock.release()
|
||||||
|
|
||||||
def info(input, force=False):
|
def info(input, force=False):
|
||||||
global debugLock
|
global debug_lock
|
||||||
global debugLevel
|
global debug_level
|
||||||
if debugLevel >= 3 \
|
if debug_level >= 3 \
|
||||||
or force == True:
|
or force == True:
|
||||||
debugLock.acquire()
|
debug_lock.acquire()
|
||||||
print(input + color_default)
|
print(input + color_default)
|
||||||
debugLock.release()
|
debug_lock.release()
|
||||||
|
|
||||||
def warning(input, force=False):
|
def warning(input, force=False):
|
||||||
global debugLock
|
global debug_lock
|
||||||
global debugLevel
|
global debug_level
|
||||||
if debugLevel >= 2 \
|
if debug_level >= 2 \
|
||||||
or force == True:
|
or force == True:
|
||||||
debugLock.acquire()
|
debug_lock.acquire()
|
||||||
print(color_purple + "[WARNING] " + input + color_default)
|
print(color_purple + "[WARNING] " + input + color_default)
|
||||||
debugLock.release()
|
debug_lock.release()
|
||||||
|
|
||||||
def error(input, threadID=-1, force=False, crash=True):
|
def todo(input, force=False):
|
||||||
global debugLock
|
global debug_lock
|
||||||
global debugLevel
|
global debug_level
|
||||||
if debugLevel >= 1 \
|
if debug_level >= 3 \
|
||||||
or force == True:
|
or force == True:
|
||||||
debugLock.acquire()
|
debug_lock.acquire()
|
||||||
|
print(color_purple + "[TODO] " + input + color_default)
|
||||||
|
debug_lock.release()
|
||||||
|
|
||||||
|
def error(input, thread_id=-1, force=False, crash=True):
|
||||||
|
global debug_lock
|
||||||
|
global debug_level
|
||||||
|
if debug_level >= 1 \
|
||||||
|
or force == True:
|
||||||
|
debug_lock.acquire()
|
||||||
print(color_red + "[ERROR] " + input + color_default)
|
print(color_red + "[ERROR] " + input + color_default)
|
||||||
debugLock.release()
|
debug_lock.release()
|
||||||
if crash==True:
|
if crash == True:
|
||||||
from . import multiprocess
|
from . import multiprocess
|
||||||
multiprocess.error_occured()
|
multiprocess.set_error_occured()
|
||||||
if threadID != -1:
|
if thread_id != -1:
|
||||||
threading.interrupt_main()
|
threading.interrupt_main()
|
||||||
exit(-1)
|
exit(-1)
|
||||||
#os_exit(-1)
|
#os_exit(-1)
|
||||||
#raise "error happend"
|
#raise "error happend"
|
||||||
|
|
||||||
def print_element(type, lib, dir, name, force=False):
|
def print_element(type, lib, dir, name, force=False):
|
||||||
global debugLock
|
global debug_lock
|
||||||
global debugLevel
|
global debug_level
|
||||||
if debugLevel >= 3 \
|
if debug_level >= 3 \
|
||||||
or force == True:
|
or force == True:
|
||||||
debugLock.acquire()
|
debug_lock.acquire()
|
||||||
print(color_cyan + type + color_default + " : " + color_yellow + lib + color_default + " " + dir + " " + color_blue + name + color_default)
|
print(color_cyan + type + color_default + " : " + color_yellow + lib + color_default + " " + dir + " " + color_blue + name + color_default)
|
||||||
debugLock.release()
|
debug_lock.release()
|
||||||
|
|
||||||
def print_compilator(myString):
|
def print_compilator(myString):
|
||||||
global debugColor
|
global debug_color
|
||||||
global debugLock
|
global debug_lock
|
||||||
if debugColor == True:
|
if debug_color == True:
|
||||||
myString = myString.replace('\\n', '\n')
|
myString = myString.replace('\\n', '\n')
|
||||||
myString = myString.replace('\\t', '\t')
|
myString = myString.replace('\\t', '\t')
|
||||||
myString = myString.replace('error:', color_red+'error:'+color_default)
|
myString = myString.replace('error:', color_red+'error:'+color_default)
|
||||||
@@ -136,6 +164,24 @@ def print_compilator(myString):
|
|||||||
myString = myString.replace('-COLORIN-', color_yellow)
|
myString = myString.replace('-COLORIN-', color_yellow)
|
||||||
myString = myString.replace('-COLOROUT-', color_default)
|
myString = myString.replace('-COLOROUT-', color_default)
|
||||||
|
|
||||||
debugLock.acquire()
|
debug_lock.acquire()
|
||||||
print(myString)
|
print(myString)
|
||||||
debugLock.release()
|
debug_lock.release()
|
||||||
|
|
||||||
|
def get_color_set() :
|
||||||
|
global color_default
|
||||||
|
global color_red
|
||||||
|
global color_green
|
||||||
|
global color_yellow
|
||||||
|
global color_blue
|
||||||
|
global color_purple
|
||||||
|
global color_cyan
|
||||||
|
return {
|
||||||
|
"default": color_default,
|
||||||
|
"red": color_red,
|
||||||
|
"green": color_green,
|
||||||
|
"yellow": color_yellow,
|
||||||
|
"blue": color_blue,
|
||||||
|
"purple": color_purple,
|
||||||
|
"cyan": color_cyan,
|
||||||
|
}
|
||||||
|
174
lutin/depend.py
174
lutin/depend.py
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
@@ -11,12 +12,49 @@ import os
|
|||||||
from . import debug
|
from . import debug
|
||||||
from . import env
|
from . import env
|
||||||
|
|
||||||
def need_re_build(dst, src, dependFile=None, file_cmd="", cmdLine=""):
|
def _create_directory_of_file(file):
|
||||||
debug.extreme_verbose("Resuest check of dependency of :")
|
path = os.path.dirname(file)
|
||||||
|
try:
|
||||||
|
os.stat(path)
|
||||||
|
except:
|
||||||
|
os.makedirs(path)
|
||||||
|
|
||||||
|
def _file_write_data(path, data):
|
||||||
|
file = open(path, "w")
|
||||||
|
file.write(data)
|
||||||
|
file.close()
|
||||||
|
|
||||||
|
def _file_size(path):
|
||||||
|
if not os.path.isfile(path):
|
||||||
|
return 0
|
||||||
|
statinfo = os.stat(path)
|
||||||
|
return statinfo.st_size
|
||||||
|
|
||||||
|
def _file_read_data(path, binary=False):
|
||||||
|
if not os.path.isfile(path):
|
||||||
|
return ""
|
||||||
|
if binary == True:
|
||||||
|
file = open(path, "rb")
|
||||||
|
else:
|
||||||
|
file = open(path, "r")
|
||||||
|
data_file = file.read()
|
||||||
|
file.close()
|
||||||
|
return data_file
|
||||||
|
|
||||||
|
def create_dependency_file(depend_file, list_files):
|
||||||
|
data = ""
|
||||||
|
for elem in list_files:
|
||||||
|
data += elem + "\n"
|
||||||
|
_create_directory_of_file(depend_file)
|
||||||
|
_file_write_data(depend_file, data)
|
||||||
|
|
||||||
|
def need_re_build(dst, src, depend_file=None, file_cmd="", cmd_line="", force_identical=False):
|
||||||
|
debug.extreme_verbose("Request check of dependency of :")
|
||||||
debug.extreme_verbose(" dst='" + str(dst) + "'")
|
debug.extreme_verbose(" dst='" + str(dst) + "'")
|
||||||
debug.extreme_verbose(" str='" + str(src) + "'")
|
debug.extreme_verbose(" src='" + str(src) + "'")
|
||||||
debug.extreme_verbose(" dept='" + str(dependFile) + "'")
|
debug.extreme_verbose(" dept='" + str(depend_file) + "'")
|
||||||
debug.extreme_verbose(" cmd='" + str(file_cmd) + "'")
|
debug.extreme_verbose(" cmd='" + str(file_cmd) + "'")
|
||||||
|
debug.extreme_verbose(" force_identical='" + str(force_identical) + "'")
|
||||||
# if force mode selected ==> just force rebuild ...
|
# if force mode selected ==> just force rebuild ...
|
||||||
if env.get_force_mode():
|
if env.get_force_mode():
|
||||||
debug.extreme_verbose(" ==> must rebuild (force mode)")
|
debug.extreme_verbose(" ==> must rebuild (force mode)")
|
||||||
@@ -28,21 +66,23 @@ def need_re_build(dst, src, dependFile=None, file_cmd="", cmdLine=""):
|
|||||||
and os.path.exists(dst) == False:
|
and os.path.exists(dst) == False:
|
||||||
debug.extreme_verbose(" ==> must rebuild (dst does not exist)")
|
debug.extreme_verbose(" ==> must rebuild (dst does not exist)")
|
||||||
return True
|
return True
|
||||||
if dst != "" \
|
if src != "" \
|
||||||
and dst != None \
|
and src != None \
|
||||||
and os.path.exists(src) == False:
|
and os.path.exists(src) == False:
|
||||||
debug.warning(" ==> unexistant file :'" + src + "'")
|
debug.warning(" ==> unexistant file :'" + src + "'")
|
||||||
return True
|
return True
|
||||||
# chek the basic date if the 2 files
|
# Check the basic date if the 2 files
|
||||||
if dst != "" \
|
if dst != "" \
|
||||||
and dst != None \
|
and dst != None \
|
||||||
|
and src != "" \
|
||||||
|
and src != None \
|
||||||
and os.path.getmtime(src) > os.path.getmtime(dst):
|
and os.path.getmtime(src) > os.path.getmtime(dst):
|
||||||
debug.extreme_verbose(" ==> must rebuild (source time greater)")
|
debug.extreme_verbose(" ==> must rebuild (source time greater)")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if dependFile != "" \
|
if depend_file != "" \
|
||||||
and dependFile != None \
|
and depend_file != None \
|
||||||
and os.path.exists(dependFile) == False:
|
and os.path.exists(depend_file) == False:
|
||||||
debug.extreme_verbose(" ==> must rebuild (no depending file)")
|
debug.extreme_verbose(" ==> must rebuild (no depending file)")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -51,69 +91,95 @@ def need_re_build(dst, src, dependFile=None, file_cmd="", cmdLine=""):
|
|||||||
if os.path.exists(file_cmd) == False:
|
if os.path.exists(file_cmd) == False:
|
||||||
debug.extreme_verbose(" ==> must rebuild (no commandLine file)")
|
debug.extreme_verbose(" ==> must rebuild (no commandLine file)")
|
||||||
return True
|
return True
|
||||||
# check if the 2 cmdline are similar :
|
# check if the 2 cmd_line are similar :
|
||||||
file2 = open(file_cmd, "r")
|
file2 = open(file_cmd, "r")
|
||||||
firstAndUniqueLine = file2.read()
|
first_and_unique_line = file2.read()
|
||||||
if firstAndUniqueLine != cmdLine:
|
if first_and_unique_line != cmd_line:
|
||||||
debug.extreme_verbose(" ==> must rebuild (cmdLines are not identical)")
|
debug.extreme_verbose(" ==> must rebuild (cmd_lines are not identical)")
|
||||||
debug.extreme_verbose(" ==> '" + cmdLine + "'")
|
debug.extreme_verbose(" ==> '" + cmd_line + "'")
|
||||||
debug.extreme_verbose(" ==> '" + firstAndUniqueLine + "'")
|
debug.extreme_verbose(" ==> '" + first_and_unique_line + "'")
|
||||||
file2.close()
|
file2.close()
|
||||||
return True
|
return True
|
||||||
# the cmdfile is correct ...
|
# the cmdfile is correct ...
|
||||||
file2.close()
|
file2.close()
|
||||||
|
|
||||||
if dependFile != "" \
|
if depend_file != "" \
|
||||||
and dependFile != None:
|
and depend_file != None:
|
||||||
debug.extreme_verbose(" start parsing dependency file : '" + dependFile + "'")
|
debug.extreme_verbose(" start parsing dependency file : '" + depend_file + "'")
|
||||||
file = open(dependFile, "r")
|
file = open(depend_file, "r")
|
||||||
for curLine in file.readlines():
|
for cur_line in file.readlines():
|
||||||
# normal file : end with : ": \\n"
|
# normal file : end with : ": \\n"
|
||||||
curLine = curLine[:len(curLine)-1]
|
cur_line = cur_line[:len(cur_line)-1]
|
||||||
# removing last \ ...
|
# removing last \ ...
|
||||||
if curLine[len(curLine)-1:] == '\\' :
|
if cur_line[len(cur_line)-1:] == '\\' :
|
||||||
curLine = curLine[:len(curLine)-1]
|
cur_line = cur_line[:len(cur_line)-1]
|
||||||
# remove white space :
|
# remove white space :
|
||||||
#debug.verbose(" Line (read) : '" + curLine + "'");
|
#debug.verbose(" Line (read) : '" + cur_line + "'");
|
||||||
curLine = curLine.strip()
|
cur_line = cur_line.strip()
|
||||||
#debug.verbose(" Line (strip) : '" + curLine + "'");
|
#debug.verbose(" Line (strip) : '" + cur_line + "'");
|
||||||
|
|
||||||
testFile=""
|
test_file=""
|
||||||
if curLine[len(curLine)-1:] == ':':
|
if cur_line[len(cur_line)-1:] == ':':
|
||||||
debug.extreme_verbose(" Line (no check (already done) : '" + curLine + "'");
|
debug.extreme_verbose(" Line (no check (already done) : '" + cur_line + "'");
|
||||||
elif len(curLine) == 0 \
|
elif len(cur_line) == 0 \
|
||||||
or curLine == '\\':
|
or cur_line == '\\':
|
||||||
debug.extreme_verbose(" Line (Not parsed) : '" + curLine + "'");
|
debug.extreme_verbose(" Line (Not parsed) : '" + cur_line + "'");
|
||||||
else:
|
else:
|
||||||
testFile = curLine
|
test_file = cur_line
|
||||||
debug.extreme_verbose(" Line (might check) : '" + testFile + "'");
|
debug.extreme_verbose(" Line (might check) : '" + test_file + "'");
|
||||||
# really check files:
|
# really check files:
|
||||||
if testFile!="":
|
if test_file != "":
|
||||||
debug.extreme_verbose(" ==> test");
|
debug.extreme_verbose(" ==> test");
|
||||||
if False==os.path.exists(testFile):
|
if False==os.path.exists(test_file):
|
||||||
debug.extreme_verbose(" ==> must rebuild (a dependency file does not exist)")
|
debug.extreme_verbose(" ==> must rebuild (a dependency file does not exist)")
|
||||||
file.close()
|
file.close()
|
||||||
return True
|
return True
|
||||||
if os.path.getmtime(testFile) > os.path.getmtime(dst):
|
if os.path.getmtime(test_file) > os.path.getmtime(dst):
|
||||||
debug.extreme_verbose(" ==> must rebuild (a dependency file time is newer)")
|
debug.extreme_verbose(" ==> must rebuild (a dependency file time is newer)")
|
||||||
file.close()
|
file.close()
|
||||||
return True
|
return True
|
||||||
# close the current file :
|
# close the current file :
|
||||||
file.close()
|
file.close()
|
||||||
|
# check the 2 files are identical:
|
||||||
|
if force_identical == True:
|
||||||
|
# check if the 2 cmd_line are similar :
|
||||||
|
size_src = _file_size(src)
|
||||||
|
size_dst = _file_size(dst)
|
||||||
|
if size_src != size_dst:
|
||||||
|
debug.extreme_verbose(" Force Rewrite not the same size size_src=" + str(size_src) + " != size_dest=" + str(size_dst))
|
||||||
|
return True
|
||||||
|
data_src = _file_read_data(src, binary=True)
|
||||||
|
data_dst = _file_read_data(dst, binary=True)
|
||||||
|
if data_src != data_dst:
|
||||||
|
debug.extreme_verbose(" Force Rewrite not the same data")
|
||||||
|
return True
|
||||||
|
|
||||||
debug.extreme_verbose(" ==> Not rebuild (all dependency is OK)")
|
debug.extreme_verbose(" ==> Not rebuild (all dependency is OK)")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def need_re_package(dst, srcList, mustHaveSrc, file_cmd="", cmdLine=""):
|
def need_re_package(dst, src_list, must_have_src, file_cmd="", cmd_line=""):
|
||||||
debug.extreme_verbose("Resuest check of dependency of :")
|
debug.extreme_verbose("Request check of dependency of :")
|
||||||
debug.extreme_verbose(" dst='" + dst + "'")
|
debug.extreme_verbose(" dst='" + str(dst) + "'")
|
||||||
debug.extreme_verbose(" src()=")
|
compleate_list = []
|
||||||
for src in srcList:
|
debug.extreme_verbose(" src:")
|
||||||
debug.verbose(" '" + src + "'")
|
if type(src_list) == str:
|
||||||
|
compleate_list.append(src_list)
|
||||||
|
debug.extreme_verbose(" '" + src_list + "'")
|
||||||
|
elif type(src_list) == list:
|
||||||
|
for src in src_list:
|
||||||
|
compleate_list.append(src)
|
||||||
|
debug.extreme_verbose(" '" + str(src) + "'")
|
||||||
|
elif type(src_list) == dict:
|
||||||
|
for key in src_list:
|
||||||
|
debug.extreme_verbose(" '" + str(key) + "'")
|
||||||
|
for src in src_list[key]:
|
||||||
|
compleate_list.append(src)
|
||||||
|
debug.extreme_verbose(" '" + str(src) + "'")
|
||||||
|
|
||||||
if mustHaveSrc==False and len(srcList)==0:
|
if must_have_src == False \
|
||||||
|
and len(compleate_list) == 0:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# if force mode selected ==> just force rebuild ...
|
# if force mode selected ==> just force rebuild ...
|
||||||
@@ -122,14 +188,14 @@ def need_re_package(dst, srcList, mustHaveSrc, file_cmd="", cmdLine=""):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
# check if the destination existed:
|
# check if the destination existed:
|
||||||
if False==os.path.exists(dst):
|
if os.path.exists(dst) == False:
|
||||||
debug.extreme_verbose(" ==> must re-package (dst does not exist)")
|
debug.extreme_verbose(" ==> must re-package (dst does not exist)")
|
||||||
return True
|
return True
|
||||||
# chek the basic date if the 2 files
|
# chek the basic date if the 2 files
|
||||||
if len(srcList)==0:
|
if len(compleate_list) == 0:
|
||||||
debug.extreme_verbose(" ==> must re-package (no source ???)")
|
debug.extreme_verbose(" ==> must re-package (no source ???)")
|
||||||
return True
|
return True
|
||||||
for src in srcList:
|
for src in compleate_list:
|
||||||
if os.path.getmtime(src) > os.path.getmtime(dst):
|
if os.path.getmtime(src) > os.path.getmtime(dst):
|
||||||
debug.extreme_verbose(" ==> must re-package (source time greater) : '" + src + "'")
|
debug.extreme_verbose(" ==> must re-package (source time greater) : '" + src + "'")
|
||||||
return True
|
return True
|
||||||
@@ -138,13 +204,13 @@ def need_re_package(dst, srcList, mustHaveSrc, file_cmd="", cmdLine=""):
|
|||||||
if False==os.path.exists(file_cmd):
|
if False==os.path.exists(file_cmd):
|
||||||
debug.extreme_verbose(" ==> must rebuild (no commandLine file)")
|
debug.extreme_verbose(" ==> must rebuild (no commandLine file)")
|
||||||
return True
|
return True
|
||||||
# check if the 2 cmdline are similar :
|
# check if the 2 cmd_line are similar :
|
||||||
file2 = open(file_cmd, "r")
|
file2 = open(file_cmd, "r")
|
||||||
firstAndUniqueLine = file2.read()
|
first_and_unique_line = file2.read()
|
||||||
if firstAndUniqueLine != cmdLine:
|
if first_and_unique_line != cmd_line:
|
||||||
debug.extreme_verbose(" ==> must rebuild (cmdLines are not identical)")
|
debug.extreme_verbose(" ==> must rebuild (cmd_lines are not identical)")
|
||||||
debug.extreme_verbose(" ==> '" + cmdLine + "'")
|
debug.extreme_verbose(" ==> '" + cmd_line + "'")
|
||||||
debug.extreme_verbose(" ==> '" + firstAndUniqueLine + "'")
|
debug.extreme_verbose(" ==> '" + first_and_unique_line + "'")
|
||||||
file2.close()
|
file2.close()
|
||||||
return True
|
return True
|
||||||
# the cmdfile is correct ...
|
# the cmdfile is correct ...
|
||||||
|
184
lutin/env.py
184
lutin/env.py
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
@@ -12,87 +13,186 @@ from . import debug
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
forceMode=False
|
force_mode=False
|
||||||
|
|
||||||
def set_force_mode(val):
|
def set_force_mode(val):
|
||||||
global forceMode
|
global force_mode
|
||||||
if val==1:
|
if val==1:
|
||||||
forceMode = 1
|
force_mode = 1
|
||||||
else:
|
else:
|
||||||
forceMode = 0
|
force_mode = 0
|
||||||
|
|
||||||
def get_force_mode():
|
def get_force_mode():
|
||||||
global forceMode
|
global force_mode
|
||||||
return forceMode
|
return force_mode
|
||||||
|
|
||||||
|
force_optimisation=False
|
||||||
|
|
||||||
|
def set_force_optimisation(val):
|
||||||
|
global force_optimisation
|
||||||
|
if val==1:
|
||||||
|
force_optimisation = 1
|
||||||
|
else:
|
||||||
|
force_optimisation = 0
|
||||||
|
|
||||||
|
def get_force_optimisation():
|
||||||
|
global force_optimisation
|
||||||
|
return force_optimisation
|
||||||
|
|
||||||
|
parse_depth = 9999999
|
||||||
|
|
||||||
|
def set_parse_depth(val):
|
||||||
|
global parse_depth
|
||||||
|
parse_depth = val
|
||||||
|
debug.debug("Set depth search element: " + str(parse_depth))
|
||||||
|
|
||||||
|
def get_parse_depth():
|
||||||
|
global parse_depth
|
||||||
|
return parse_depth
|
||||||
|
|
||||||
|
exclude_search_path = []
|
||||||
|
|
||||||
|
def set_exclude_search_path(val):
|
||||||
|
global exclude_search_path
|
||||||
|
exclude_search_path = val
|
||||||
|
debug.debug("Set depth search element: " + str(exclude_search_path))
|
||||||
|
|
||||||
|
def get_exclude_search_path():
|
||||||
|
global exclude_search_path
|
||||||
|
return exclude_search_path
|
||||||
|
|
||||||
|
|
||||||
printPrettyMode=False
|
build_system_base_name = "lutin"
|
||||||
|
|
||||||
|
def set_build_system_base_name(val):
|
||||||
|
global build_system_base_name
|
||||||
|
build_system_base_name = val
|
||||||
|
debug.debug("Set basename: '" + str(build_system_base_name) + "'")
|
||||||
|
|
||||||
|
def get_build_system_base_name():
|
||||||
|
global build_system_base_name
|
||||||
|
return build_system_base_name
|
||||||
|
|
||||||
|
|
||||||
|
print_pretty_mode=False
|
||||||
|
|
||||||
def set_print_pretty_mode(val):
|
def set_print_pretty_mode(val):
|
||||||
global printPrettyMode
|
global print_pretty_mode
|
||||||
if val == True:
|
if val == True:
|
||||||
printPrettyMode = True
|
print_pretty_mode = True
|
||||||
else:
|
else:
|
||||||
printPrettyMode = False
|
print_pretty_mode = False
|
||||||
|
|
||||||
def get_print_pretty_mode():
|
def get_print_pretty_mode():
|
||||||
global printPrettyMode
|
global print_pretty_mode
|
||||||
return printPrettyMode
|
return print_pretty_mode
|
||||||
|
|
||||||
def print_pretty(myString, force=False):
|
store_warning=False
|
||||||
global printPrettyMode
|
def set_warning_mode(val):
|
||||||
if printPrettyMode == True \
|
global store_warning
|
||||||
|
if val == True:
|
||||||
|
store_warning = True
|
||||||
|
else:
|
||||||
|
store_warning = False
|
||||||
|
|
||||||
|
def get_warning_mode():
|
||||||
|
global store_warning
|
||||||
|
return store_warning
|
||||||
|
|
||||||
|
|
||||||
|
def end_with(name, list):
|
||||||
|
for appl in list:
|
||||||
|
#debug.info("pppppppp : " + str([name[-len(appl):], appl]))
|
||||||
|
if name[-len(appl):] == appl:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def print_pretty(my_string, force=False):
|
||||||
|
global print_pretty_mode
|
||||||
|
if print_pretty_mode == True \
|
||||||
or force == True:
|
or force == True:
|
||||||
if myString[len(myString)-1]==' ' :
|
if my_string[len(my_string)-1] == ' ':
|
||||||
tmpcmdLine = myString[:len(myString)-1]
|
tmpcmdLine = my_string[:len(my_string)-1]
|
||||||
else :
|
else:
|
||||||
tmpcmdLine = myString
|
tmpcmdLine = my_string
|
||||||
|
cmdApplication = tmpcmdLine.split(' ')[0]
|
||||||
tmpcmdLine = tmpcmdLine.replace(' ', '\n\t')
|
tmpcmdLine = tmpcmdLine.replace(' ', '\n\t')
|
||||||
tmpcmdLine = tmpcmdLine.replace('\n\t\n\t', '\n\t')
|
tmpcmdLine = tmpcmdLine.replace('\n\t\n\t', '\n\t')
|
||||||
tmpcmdLine = tmpcmdLine.replace('\n\t\n\t', '\n\t')
|
tmpcmdLine = tmpcmdLine.replace('\n\t\n\t', '\n\t')
|
||||||
tmpcmdLine = tmpcmdLine.replace('\n\t\n\t', '\n\t')
|
tmpcmdLine = tmpcmdLine.replace('\n\t\n\t', '\n\t')
|
||||||
baseElementList = ["-o",
|
baseElementList = []
|
||||||
|
if end_with(cmdApplication, ["javac"]) == True:
|
||||||
|
baseElementList = [
|
||||||
|
"-d",
|
||||||
|
"-D",
|
||||||
|
"-classpath",
|
||||||
|
"-sourcepath"
|
||||||
|
]
|
||||||
|
elif end_with(cmdApplication, ["java"]) == True:
|
||||||
|
baseElementList = [
|
||||||
|
"-z",
|
||||||
|
"-f",
|
||||||
|
"-rf"
|
||||||
|
]
|
||||||
|
elif end_with(cmdApplication, ["jarsigner"]) == True:
|
||||||
|
baseElementList = [
|
||||||
|
"-sigalg",
|
||||||
|
"-digestalg",
|
||||||
|
"-storepass",
|
||||||
|
"-keypass"
|
||||||
|
]
|
||||||
|
elif end_with(cmdApplication, ["jar"]) == True:
|
||||||
|
baseElementList = [
|
||||||
|
"cf",
|
||||||
|
"-C"
|
||||||
|
]
|
||||||
|
elif end_with(cmdApplication, ["aapt"]) == True:
|
||||||
|
baseElementList = [
|
||||||
|
"-M",
|
||||||
|
"-F",
|
||||||
|
"-I",
|
||||||
|
"-S",
|
||||||
|
"-J"
|
||||||
|
]
|
||||||
|
elif end_with(cmdApplication, ["g++", "gcc", "clang", "clang++", "ar", "ld", "ranlib"]) == True:
|
||||||
|
baseElementList = [
|
||||||
|
"-o",
|
||||||
"-D",
|
"-D",
|
||||||
"-I",
|
"-I",
|
||||||
"-L",
|
"-L",
|
||||||
"g++",
|
|
||||||
"gcc",
|
|
||||||
"clang",
|
|
||||||
"clang++",
|
|
||||||
"ar",
|
|
||||||
"ld",
|
|
||||||
"ranlib",
|
|
||||||
"-framework",
|
"-framework",
|
||||||
"-isysroot",
|
"-isysroot",
|
||||||
"-arch",
|
"-arch",
|
||||||
"-keystore",
|
"-keystore",
|
||||||
"-sigalg",
|
"-sigalg",
|
||||||
"-digestalg",
|
"-digestalg",
|
||||||
"<",
|
"-target",
|
||||||
"<<",
|
"-gcc-toolchain",
|
||||||
">",
|
"-current_version",
|
||||||
">>"]
|
"-compatibility_version"
|
||||||
|
]
|
||||||
|
|
||||||
for element in baseElementList:
|
for element in baseElementList:
|
||||||
tmpcmdLine = tmpcmdLine.replace(element+'\n\t', element+' ')
|
tmpcmdLine = tmpcmdLine.replace(element+'\n\t', element+' ')
|
||||||
baseElementList = ["g++", "gcc", "clang", "clang++", "ar", "ld", "ranlib"]
|
for element in ["<", "<<", ">", ">>"]:
|
||||||
for element in baseElementList:
|
tmpcmdLine = tmpcmdLine.replace(element+'\n\t', element+' ')
|
||||||
tmpcmdLine = tmpcmdLine.replace('/'+element+' ', '/'+element+'\n\t')
|
|
||||||
tmpcmdLine = tmpcmdLine.replace('\n\t', ' \\\n\t')
|
tmpcmdLine = tmpcmdLine.replace('\n\t', ' \\\n\t')
|
||||||
|
|
||||||
return tmpcmdLine
|
return tmpcmdLine
|
||||||
else:
|
else:
|
||||||
return myString
|
return my_string
|
||||||
|
|
||||||
forceStripMode=False
|
force_strip_mode=False
|
||||||
|
|
||||||
def set_force_strip_mode(val):
|
def set_force_strip_mode(val):
|
||||||
global forceStripMode
|
global force_strip_mode
|
||||||
if val==True:
|
if val == True:
|
||||||
forceStripMode = True
|
force_strip_mode = True
|
||||||
else:
|
else:
|
||||||
forceStripMode = False
|
force_strip_mode = False
|
||||||
|
|
||||||
def get_force_strip_mode():
|
def get_force_strip_mode():
|
||||||
global forceStripMode
|
global force_strip_mode
|
||||||
return forceStripMode
|
return force_strip_mode
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
@@ -12,26 +13,28 @@ import copy
|
|||||||
from . import debug
|
from . import debug
|
||||||
|
|
||||||
|
|
||||||
def append_to_list(listout, list):
|
def append_to_list(list_out, elem):
|
||||||
if type(list) == type(str()):
|
if type(elem) == str:
|
||||||
if list not in listout:
|
if elem not in list_out:
|
||||||
listout.append(list)
|
list_out.append(elem)
|
||||||
else:
|
else:
|
||||||
# mulyiple imput in the list ...
|
# mulyiple imput in the list ...
|
||||||
for elem in list:
|
for element in elem:
|
||||||
if elem not in listout:
|
if element not in list_out:
|
||||||
listout.append(elem)
|
list_out.append(element)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class HeritageList:
|
class HeritageList:
|
||||||
def __init__(self, heritage = None):
|
def __init__(self, heritage = None):
|
||||||
self.flags={}
|
self.flags = {}
|
||||||
# sources list:
|
# sources list:
|
||||||
self.src=[]
|
self.src = { 'src':[],
|
||||||
self.path=[]
|
'dynamic':[],
|
||||||
|
'static':[]
|
||||||
self.listHeritage=[]
|
}
|
||||||
|
self.path = {}
|
||||||
|
self.list_heritage = []
|
||||||
if heritage != None:
|
if heritage != None:
|
||||||
self.add_heritage(heritage)
|
self.add_heritage(heritage)
|
||||||
|
|
||||||
@@ -39,92 +42,113 @@ class HeritageList:
|
|||||||
if type(heritage) == type(None) \
|
if type(heritage) == type(None) \
|
||||||
or heritage.name == "":
|
or heritage.name == "":
|
||||||
return
|
return
|
||||||
for element in self.listHeritage:
|
for element in self.list_heritage:
|
||||||
if element.name == heritage.name:
|
if element.name == heritage.name:
|
||||||
return
|
return
|
||||||
self.listHeritage.append(heritage)
|
self.list_heritage.append(heritage)
|
||||||
self.regenerate_tree()
|
self.regenerate_tree()
|
||||||
|
|
||||||
def add_heritage_list(self, heritage_list):
|
def add_heritage_list(self, heritage_list):
|
||||||
if type(heritage_list) == type(None):
|
if type(heritage_list) == type(None):
|
||||||
return
|
return
|
||||||
for herit in heritage_list.listHeritage:
|
for herit in heritage_list.list_heritage:
|
||||||
find = False
|
find = False
|
||||||
for element in self.listHeritage:
|
for element in self.list_heritage:
|
||||||
if element.name == herit.name:
|
if element.name == herit.name:
|
||||||
find = True
|
find = True
|
||||||
if find == False:
|
if find == False:
|
||||||
self.listHeritage.append(herit)
|
self.list_heritage.append(herit)
|
||||||
self.regenerate_tree()
|
self.regenerate_tree()
|
||||||
|
|
||||||
def regenerate_tree(self):
|
def regenerate_tree(self):
|
||||||
self.flags={}
|
self.flags = {}
|
||||||
# sources list:
|
# sources list:
|
||||||
self.src=[]
|
self.src = { 'src':[],
|
||||||
self.path=[]
|
'dynamic':[],
|
||||||
|
'static':[]
|
||||||
|
}
|
||||||
|
self.path = {}
|
||||||
# reorder heritage list :
|
# reorder heritage list :
|
||||||
listHeritage = self.listHeritage
|
listHeritage = self.list_heritage
|
||||||
self.listHeritage = []
|
self.list_heritage = []
|
||||||
# first step : add all lib with no dependency:
|
# first step : add all lib with no dependency:
|
||||||
for herit in listHeritage:
|
for herit in listHeritage:
|
||||||
if len(herit.depends) == 0:
|
if len(herit.depends) == 0:
|
||||||
self.listHeritage.append(herit)
|
self.list_heritage.append(herit)
|
||||||
listHeritage.remove(herit)
|
listHeritage.remove(herit)
|
||||||
while len(listHeritage) > 0:
|
while len(listHeritage) > 0:
|
||||||
currentHeritageSize = len(listHeritage)
|
currentHeritageSize = len(listHeritage)
|
||||||
debug.verbose("list heritage = " + str([[x.name, x.depends] for x in listHeritage]))
|
debug.verbose("list heritage = " + str([[x.name, x.depends] for x in listHeritage]))
|
||||||
# Add element only when all dependence are resolved
|
# Add element only when all dependence are resolved
|
||||||
for herit in listHeritage:
|
for herit in listHeritage:
|
||||||
listDependsName = [y.name for y in self.listHeritage]
|
listDependsName = [y.name for y in self.list_heritage]
|
||||||
if all(x in listDependsName for x in herit.depends) == True:
|
if all(x in listDependsName for x in herit.depends) == True:
|
||||||
listHeritage.remove(herit)
|
listHeritage.remove(herit)
|
||||||
self.listHeritage.append(herit)
|
self.list_heritage.append(herit)
|
||||||
if currentHeritageSize == len(listHeritage):
|
if currentHeritageSize == len(listHeritage):
|
||||||
debug.warning("Not resolve dependency between the library ==> can be a cyclic dependency !!!")
|
debug.warning("Not resolve dependency between the library ==> can be a cyclic dependency !!!")
|
||||||
for herit in listHeritage:
|
for herit in listHeritage:
|
||||||
self.listHeritage.append(herit)
|
self.list_heritage.append(herit)
|
||||||
listHeritage = []
|
listHeritage = []
|
||||||
debug.warning("new heritage list:")
|
debug.warning("new heritage list:")
|
||||||
for element in self.listHeritage:
|
for element in self.list_heritage:
|
||||||
debug.warning(" " + element.name + " " + str(element.depends))
|
debug.warning(" " + element.name + " " + str(element.depends))
|
||||||
debug.verbose("new heritage list:")
|
debug.verbose("new heritage list:")
|
||||||
for element in self.listHeritage:
|
for element in self.list_heritage:
|
||||||
debug.verbose(" " + element.name + " " + str(element.depends))
|
debug.verbose(" " + element.name + " " + str(element.depends))
|
||||||
for element in reversed(self.listHeritage):
|
for element in reversed(self.list_heritage):
|
||||||
for flags in element.flags:
|
for flags in element.flags:
|
||||||
if flags in ["c-version", "c++-version"]:
|
# get value
|
||||||
continue
|
|
||||||
value = element.flags[flags]
|
value = element.flags[flags]
|
||||||
|
# if it is a list, simply add element on the previous one
|
||||||
|
if type(value) == list:
|
||||||
if flags not in self.flags:
|
if flags not in self.flags:
|
||||||
self.flags[flags] = value
|
self.flags[flags] = value
|
||||||
else:
|
else:
|
||||||
append_to_list(self.flags[flags], value)
|
append_to_list(self.flags[flags], value)
|
||||||
append_to_list(self.path, element.path)
|
elif type(value) == bool:
|
||||||
append_to_list(self.src, element.src)
|
if flags not in self.flags:
|
||||||
if "c-version" in element.flags:
|
self.flags[flags] = value
|
||||||
ver = element.flags["c-version"]
|
else:
|
||||||
if "c-version" in self.flags:
|
# keep only true, if false ==> bad case ...
|
||||||
if self.flags["c-version"] > ver:
|
if self.flags[flags] == True \
|
||||||
ver = self.flags["c-version"]
|
or value == True:
|
||||||
self.flags["c-version"] = ver
|
self.flags[flags] = True
|
||||||
if "c++-version" in element.flags:
|
elif type(value) == int:
|
||||||
ver = element.flags["c++-version"]
|
# case of "c-version", "c++-version"
|
||||||
if "c++-version" in self.flags:
|
if flags not in self.flags:
|
||||||
if self.flags["c++-version"] > ver:
|
self.flags[flags] = value
|
||||||
ver = self.flags["c++-version"]
|
else:
|
||||||
self.flags["c++-version"] = ver
|
# keep only true, if false ==> bad case ...
|
||||||
|
if self.flags[flags] < value:
|
||||||
|
self.flags[flags] = value
|
||||||
|
for ppp in element.path:
|
||||||
|
value = element.path[ppp]
|
||||||
|
if ppp not in self.path:
|
||||||
|
self.path[ppp] = value
|
||||||
|
else:
|
||||||
|
append_to_list(self.path[ppp], value)
|
||||||
|
append_to_list(self.src['src'], element.src['src'])
|
||||||
|
append_to_list(self.src['dynamic'], element.src['dynamic'])
|
||||||
|
append_to_list(self.src['static'], element.src['static'])
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "{HeritageList:" + str(self.list_heritage) + "}"
|
||||||
|
|
||||||
class heritage:
|
class heritage:
|
||||||
def __init__(self, module):
|
def __init__(self, module, target):
|
||||||
self.name=""
|
self.name = ""
|
||||||
self.depends=[]
|
self.depends = []
|
||||||
## Remove all variable to prevent error of multiple definition
|
## Remove all variable to prevent error of multiple definition
|
||||||
# all the parameter that the upper classe need when build
|
# all the parameter that the upper classe need when build
|
||||||
self.flags={}
|
self.flags = {}
|
||||||
# sources list:
|
# sources list:
|
||||||
self.src=[]
|
self.src = { 'src':[],
|
||||||
self.path=[]
|
'dynamic':[],
|
||||||
|
'static':[]
|
||||||
|
}
|
||||||
|
self.path = {}
|
||||||
|
self.include = ""
|
||||||
# update is set at true when data are newly created ==> force upper element to update
|
# update is set at true when data are newly created ==> force upper element to update
|
||||||
self.hasBeenUpdated=False
|
self.hasBeenUpdated=False
|
||||||
|
|
||||||
@@ -135,15 +159,44 @@ class heritage:
|
|||||||
# keep reference because the flags can change in time
|
# keep reference because the flags can change in time
|
||||||
self.flags = module.flags["export"]
|
self.flags = module.flags["export"]
|
||||||
self.path = module.path["export"]
|
self.path = module.path["export"]
|
||||||
|
# if the user install some header ==> they will ba autoamaticaly exported ...
|
||||||
|
if target != None:
|
||||||
|
if len(module.header) > 0:
|
||||||
|
self.include = target.get_build_path_include(module.name)
|
||||||
|
|
||||||
def add_depends(self, depend):
|
def add_depends(self, elements):
|
||||||
self.depends.append(depend)
|
self.depends.append(elements)
|
||||||
|
|
||||||
def add_import_path(self, list):
|
def add_import_path(self, list):
|
||||||
append_to_list(self.path, list)
|
append_to_list(self.path, list)
|
||||||
|
|
||||||
def add_sources(self, list):
|
def add_sources(self, elements):
|
||||||
append_to_list(self.src, list)
|
if type(elements) == type(None):
|
||||||
|
debug.error("try add element none in a list ...")
|
||||||
|
append_to_list(self.src['src'], elements)
|
||||||
|
|
||||||
|
def add_lib_static(self, elements):
|
||||||
|
if type(elements) == type(None):
|
||||||
|
debug.error("try add element none in a list ...")
|
||||||
|
append_to_list(self.src['static'], elements)
|
||||||
|
|
||||||
|
def add_lib_dynamic(self, elements):
|
||||||
|
if type(elements) == type(None):
|
||||||
|
debug.error("try add element none in a list ...")
|
||||||
|
append_to_list(self.src['dynamic'], elements)
|
||||||
|
|
||||||
|
def add_lib_interpreted(self, type_interpretation, elements):
|
||||||
|
# TODO : Think at a better methodologie ...
|
||||||
|
if type(elements) == type(None):
|
||||||
|
debug.error("try add element none in a list ...")
|
||||||
|
append_to_list(self.src['src'], elements)
|
||||||
|
|
||||||
|
def auto_add_build_header(self):
|
||||||
|
if self.include != "":
|
||||||
|
# TODO :Set it better :
|
||||||
|
if 'c' not in self.path:
|
||||||
|
self.path['c'] = []
|
||||||
|
self.path['c'].append(self.include)
|
||||||
|
|
||||||
def need_update(self, list):
|
def need_update(self, list):
|
||||||
self.hasBeenUpdated=True
|
self.hasBeenUpdated=True
|
||||||
@@ -175,4 +228,7 @@ class heritage:
|
|||||||
ver = self.flags["c++-version"]
|
ver = self.flags["c++-version"]
|
||||||
self.flags["c++-version"] = ver
|
self.flags["c++-version"] = ver
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "{Heritage:" + str(self.name) + " ... }"
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
@@ -14,14 +15,14 @@ from . import tools
|
|||||||
from . import multiprocess
|
from . import multiprocess
|
||||||
from . import depend
|
from . import depend
|
||||||
|
|
||||||
enableResizeImage = True
|
enable_resize_image = True
|
||||||
try:
|
try:
|
||||||
if platform.system() == "Darwin":
|
if platform.system() == "Darwin":
|
||||||
import CoreGraphics
|
import CoreGraphics
|
||||||
else:
|
else:
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
except:
|
except:
|
||||||
enableResizeImage = False
|
enable_resize_image = False
|
||||||
debug.warning("Missing python tools : CoreGraphics (MacOs) or PIL")
|
debug.warning("Missing python tools : CoreGraphics (MacOs) or PIL")
|
||||||
|
|
||||||
def get_pow_2_multiple(size):
|
def get_pow_2_multiple(size):
|
||||||
@@ -34,31 +35,34 @@ def get_pow_2_multiple(size):
|
|||||||
# check if force requested
|
# check if force requested
|
||||||
# check if time change
|
# check if time change
|
||||||
# check if command line change
|
# check if command line change
|
||||||
def resize(srcFile, destFile, x, y, cmd_file=None):
|
def resize(src_file, dest_file, x, y, cmd_file=None):
|
||||||
if enableResizeImage == False:
|
if os.path.exists(src_file) == False:
|
||||||
|
debug.error("Request a resize an image that does not existed : '" + src_file + "'")
|
||||||
return
|
return
|
||||||
if os.path.exists(srcFile) == False:
|
if enable_resize_image == False:
|
||||||
debug.error("Request a resize an image that does not existed : '" + srcFile + "'")
|
debug.warning("Can not resize image missing pillow or CoreGraphics : '" + src_file + "' (just copy)")
|
||||||
cmd_line = "resize Image : " + srcFile + " ==> " + destFile + " newSize=(" + str(x) + "x" + str(y) + ")"
|
tools.copy_file(src_file, dest_file)
|
||||||
if False==depend.need_re_build(destFile, srcFile, file_cmd=cmd_file , cmdLine=cmd_line):
|
return
|
||||||
|
cmd_line = "resize Image : " + src_file + " ==> " + dest_file + " newSize=(" + str(x) + "x" + str(y) + ")"
|
||||||
|
if depend.need_re_build(dest_file, src_file, file_cmd=cmd_file , cmd_line=cmd_line) == False:
|
||||||
return
|
return
|
||||||
# add cmdLine ...
|
# add cmdLine ...
|
||||||
x = get_pow_2_multiple(x)
|
x = get_pow_2_multiple(x)
|
||||||
extension = destFile[destFile.rfind('.'):]
|
extension = dest_file[dest_file.rfind('.'):]
|
||||||
if platform.system() == "Darwin":
|
if platform.system() == "Darwin":
|
||||||
source_image = CoreGraphics.CGImageImport(CoreGraphics.CGDataProviderCreateWithFilename(srcFile))
|
source_image = CoreGraphics.CGImageImport(CoreGraphics.CGDataProviderCreateWithFilename(src_file))
|
||||||
source_width = source_image.getWidth()
|
source_width = source_image.getWidth()
|
||||||
source_height = source_image.getHeight()
|
source_height = source_image.getHeight()
|
||||||
if source_width <= x:
|
if source_width <= x:
|
||||||
# for small image just copy:
|
# for small image just copy:
|
||||||
tools.copy_file(srcFile, destFile)
|
tools.copy_file(src_file, dest_file)
|
||||||
else:
|
else:
|
||||||
if y <= 0:
|
if y <= 0:
|
||||||
# keep ratio :
|
# keep ratio :
|
||||||
y = int(float(x) * float(source_height) / float(source_width))
|
y = int(float(x) * float(source_height) / float(source_width))
|
||||||
y = get_pow_2_multiple(y)
|
y = get_pow_2_multiple(y)
|
||||||
debug.print_element("resize Image (" + str(x) + "x" + str(y) + ")", srcFile, "==>", destFile)
|
debug.print_element("resize Image (" + str(x) + "x" + str(y) + ")", src_file, "==>", dest_file)
|
||||||
debug.debug("Resize image: " + srcFile + " size=(" + str(source_width) + "x" + str(source_height) + ") -> (" + str(x) + "x" + str(y) + ")")
|
debug.debug("Resize image: " + src_file + " size=(" + str(source_width) + "x" + str(source_height) + ") -> (" + str(x) + "x" + str(y) + ")")
|
||||||
source_image_rect = CoreGraphics.CGRectMake(0, 0, source_width, source_height)
|
source_image_rect = CoreGraphics.CGRectMake(0, 0, source_width, source_height)
|
||||||
new_image = source_image.createWithImageInRect(source_image_rect)
|
new_image = source_image.createWithImageInRect(source_image_rect)
|
||||||
colors_space = CoreGraphics.CGColorSpaceCreateDeviceRGB()
|
colors_space = CoreGraphics.CGColorSpaceCreateDeviceRGB()
|
||||||
@@ -67,27 +71,27 @@ def resize(srcFile, destFile, x, y, cmd_file=None):
|
|||||||
context.setInterpolationQuality(CoreGraphics.kCGInterpolationHigh)
|
context.setInterpolationQuality(CoreGraphics.kCGInterpolationHigh)
|
||||||
new_image_rect = CoreGraphics.CGRectMake(0, 0, x, y)
|
new_image_rect = CoreGraphics.CGRectMake(0, 0, x, y)
|
||||||
context.drawImage(new_image_rect, new_image)
|
context.drawImage(new_image_rect, new_image)
|
||||||
tools.create_directory_of_file(destFile)
|
tools.create_directory_of_file(dest_file)
|
||||||
if extension == ".jpeg":
|
if extension == ".jpeg":
|
||||||
context.writeToFile(destFile, CoreGraphics.kCGImageFormatJPEG)
|
context.writeToFile(dest_file, CoreGraphics.kCGImageFormatJPEG)
|
||||||
elif extension == ".png":
|
elif extension == ".png":
|
||||||
context.writeToFile(destFile, CoreGraphics.kCGImageFormatPNG)
|
context.writeToFile(dest_file, CoreGraphics.kCGImageFormatPNG)
|
||||||
else:
|
else:
|
||||||
debug.error(" can not manage extention ... : " + destFile)
|
debug.error(" can not manage extention ... : " + dest_file)
|
||||||
else:
|
else:
|
||||||
# open an image file (.bmp,.jpg,.png,.gif) you have in the working folder
|
# open an image file (.bmp,.jpg,.png,.gif) you have in the working path
|
||||||
im1 = Image.open(srcFile)
|
im1 = Image.open(src_file)
|
||||||
if im1.size[0] <= x:
|
if im1.size[0] <= x:
|
||||||
# for small image just copy:
|
# for small image just copy:
|
||||||
tools.copy_file(srcFile, destFile)
|
tools.copy_file(src_file, dest_file)
|
||||||
else:
|
else:
|
||||||
if y <= 0:
|
if y <= 0:
|
||||||
# keep ratio :
|
# keep ratio :
|
||||||
y = int(float(x) * float(im1.size[1]) / float(im1.size[0]))
|
y = int(float(x) * float(im1.size[1]) / float(im1.size[0]))
|
||||||
y = get_pow_2_multiple(y)
|
y = get_pow_2_multiple(y)
|
||||||
debug.print_element("resize Image (" + str(x) + "x" + str(y) + ")", srcFile, "==>", destFile)
|
debug.print_element("resize Image (" + str(x) + "x" + str(y) + ")", src_file, "==>", dest_file)
|
||||||
# use one of these filter options to resize the image
|
# use one of these filter options to resize the image
|
||||||
tmpImage = im1.resize((x, y), Image.ANTIALIAS)
|
tmpImage = im1.resize((x, y), Image.ANTIALIAS)
|
||||||
tools.create_directory_of_file(destFile)
|
tools.create_directory_of_file(dest_file)
|
||||||
tmpImage.save(destFile)
|
tmpImage.save(dest_file)
|
||||||
multiprocess.store_command(cmd_line, cmd_file)
|
tools.store_command(cmd_line, cmd_file)
|
||||||
|
101
lutin/license.py
Normal file
101
lutin/license.py
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##
|
||||||
|
## @author Edouard DUPIN
|
||||||
|
##
|
||||||
|
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||||
|
##
|
||||||
|
## @license APACHE v2.0 (see license file)
|
||||||
|
##
|
||||||
|
|
||||||
|
license_base = {
|
||||||
|
"APACHE-2": {
|
||||||
|
"generic":True,
|
||||||
|
"contaminate-static":False,
|
||||||
|
"contaminate-dynamic":False,
|
||||||
|
"redistribute-source":False,
|
||||||
|
"title":"APACHE v2.0 license",
|
||||||
|
"licence-file":"licence/apache-2.txt"
|
||||||
|
},
|
||||||
|
"GPL-2": {
|
||||||
|
"generic":True,
|
||||||
|
"contaminate-static":True,
|
||||||
|
"contaminate-dynamic":True,
|
||||||
|
"redistribute-source":True,
|
||||||
|
"title":"GPL: Gnu Public Licence v2.0",
|
||||||
|
"licence-file":"licence/GPL-2.txt"
|
||||||
|
},
|
||||||
|
"GPL-3": {
|
||||||
|
"generic":True,
|
||||||
|
"contaminate-static":True,
|
||||||
|
"contaminate-dynamic":True,
|
||||||
|
"redistribute-source":True,
|
||||||
|
"title":"GPL: GNU General Public License v3.0",
|
||||||
|
"licence-file":"licence/GPL-3.txt"
|
||||||
|
},
|
||||||
|
"LGPL-2": {
|
||||||
|
"generic":True,
|
||||||
|
"contaminate-static":False,
|
||||||
|
"contaminate-dynamic":False,
|
||||||
|
"redistribute-source":True,
|
||||||
|
"title":"LGPL: GNU Lesser General Public License v2.0",
|
||||||
|
"licence-file":"licence/LGPL-2.txt"
|
||||||
|
},
|
||||||
|
"LGPL-3": {
|
||||||
|
"generic":True,
|
||||||
|
"contaminate-static":True,
|
||||||
|
"contaminate-dynamic":False,
|
||||||
|
"redistribute-source":True,
|
||||||
|
"title":"LGPL: GNU Lesser General Public License v3.0",
|
||||||
|
"licence-file":"licence/LGPL-3.txt"
|
||||||
|
},
|
||||||
|
"MIT": {
|
||||||
|
"generic":True,
|
||||||
|
"contaminate-static":False,
|
||||||
|
"contaminate-dynamic":False,
|
||||||
|
"redistribute-source":False,
|
||||||
|
"title":"MIT: Massachusetts Institute of Technology License",
|
||||||
|
"licence-file":"licence/MIT.txt"
|
||||||
|
},
|
||||||
|
"BSD-2": {
|
||||||
|
"generic":True,
|
||||||
|
"contaminate-static":False,
|
||||||
|
"contaminate-dynamic":False,
|
||||||
|
"redistribute-source":False,
|
||||||
|
"title":"BSD 2-clauses: Berkeley Software Distribution License",
|
||||||
|
"licence-file":"licence/BSD-2.txt"
|
||||||
|
},
|
||||||
|
"BSD-3": {
|
||||||
|
"generic":True,
|
||||||
|
"contaminate-static":False,
|
||||||
|
"contaminate-dynamic":False,
|
||||||
|
"redistribute-source":False,
|
||||||
|
"title":"BSD 3-clauses: Berkeley Software Distribution License",
|
||||||
|
"licence-file":"licence/BSD-3.txt"
|
||||||
|
},
|
||||||
|
"BSD-4": {
|
||||||
|
"generic":True,
|
||||||
|
"contaminate-static":False,
|
||||||
|
"contaminate-dynamic":False,
|
||||||
|
"redistribute-source":False,
|
||||||
|
"title":"BSD 4-clauses: Berkeley Software Distribution License",
|
||||||
|
"licence-file":"licence/BSD-4.txt"
|
||||||
|
},
|
||||||
|
"PNG": {
|
||||||
|
"generic":True,
|
||||||
|
"contaminate-static":False,
|
||||||
|
"contaminate-dynamic":False,
|
||||||
|
"redistribute-source":False,
|
||||||
|
"title":"PNG License",
|
||||||
|
"licence-file":"licence/png.txt"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def get_basic_list():
|
||||||
|
global license_base
|
||||||
|
out = []
|
||||||
|
for name in license_base:
|
||||||
|
out.append(name)
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
1116
lutin/module.py
1116
lutin/module.py
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
@@ -20,16 +21,17 @@ import subprocess
|
|||||||
import shlex
|
import shlex
|
||||||
# Local import
|
# Local import
|
||||||
from . import debug
|
from . import debug
|
||||||
import tools
|
from . import tools
|
||||||
from . import env
|
from . import env
|
||||||
|
from . import depend
|
||||||
|
|
||||||
queueLock = threading.Lock()
|
queue_lock = threading.Lock()
|
||||||
workQueue = queue.Queue()
|
work_queue = queue.Queue()
|
||||||
currentThreadWorking = 0
|
current_thread_working = 0
|
||||||
threads = []
|
threads = []
|
||||||
# To know the first error arrive in the pool ==> to display all the time the same error file when multiple compilation
|
# To know the first error arrive in the pool ==> to display all the time the same error file when multiple compilation
|
||||||
currentIdExecution = 0
|
current_id_execution = 0
|
||||||
errorExecution = {
|
error_execution = {
|
||||||
"id":-1,
|
"id":-1,
|
||||||
"cmd":"",
|
"cmd":"",
|
||||||
"return":0,
|
"return":0,
|
||||||
@@ -37,35 +39,41 @@ errorExecution = {
|
|||||||
"out":"",
|
"out":"",
|
||||||
}
|
}
|
||||||
|
|
||||||
exitFlag = False # resuest stop of the thread
|
exit_flag = False # resuest stop of the thread
|
||||||
isinit = False # the thread are initialized
|
is_init = False # the thread are initialized
|
||||||
errorOccured = False # a thread have an error
|
error_occured = False # a thread have an error
|
||||||
processorAvaillable = 1 # number of CPU core availlable
|
processor_availlable = 1 # number of CPU core availlable
|
||||||
|
##
|
||||||
def store_command(cmdLine, file):
|
## @brief Execute the command with no get of output
|
||||||
# write cmd line only after to prevent errors ...
|
##
|
||||||
if file != "" \
|
def run_command_no_lock_out(cmd_line):
|
||||||
and file != None:
|
# prepare command line:
|
||||||
# Create directory:
|
args = shlex.split(cmd_line)
|
||||||
tools.create_directory_of_file(file)
|
debug.info("cmd = " + str(args))
|
||||||
# Store the command Line:
|
try:
|
||||||
file2 = open(file, "w")
|
# create the subprocess
|
||||||
file2.write(cmdLine)
|
p = subprocess.Popen(args)
|
||||||
file2.flush()
|
except subprocess.CalledProcessError as e:
|
||||||
file2.close()
|
debug.error("subprocess.CalledProcessError : " + str(args))
|
||||||
|
except:
|
||||||
|
debug.error("Exception on : " + str(args))
|
||||||
|
# launch the subprocess:
|
||||||
|
p.communicate()
|
||||||
|
|
||||||
##
|
##
|
||||||
## @brief Execute the command and ruturn generate data
|
## @brief Execute the command and ruturn generate data
|
||||||
##
|
##
|
||||||
def run_command_direct(cmdLine):
|
def run_command_direct(cmd_line):
|
||||||
# prepare command line:
|
# prepare command line:
|
||||||
args = shlex.split(cmdLine)
|
args = shlex.split(cmd_line)
|
||||||
debug.verbose("cmd = " + str(args))
|
debug.verbose("cmd = " + str(args))
|
||||||
try:
|
try:
|
||||||
# create the subprocess
|
# create the subprocess
|
||||||
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
debug.error("subprocess.CalledProcessError : " + str(args))
|
debug.error("subprocess.CalledProcessError : " + str(args))
|
||||||
|
except:
|
||||||
|
debug.error("Exception on : " + str(args))
|
||||||
# launch the subprocess:
|
# launch the subprocess:
|
||||||
output, err = p.communicate()
|
output, err = p.communicate()
|
||||||
if sys.version_info >= (3, 0):
|
if sys.version_info >= (3, 0):
|
||||||
@@ -80,41 +88,48 @@ def run_command_direct(cmdLine):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def run_command(cmdLine, storeCmdLine="", buildId=-1, file=""):
|
def run_command(cmd_line, store_cmd_line="", build_id=-1, file="", store_output_file="", depend_data=None):
|
||||||
global errorOccured
|
global error_occured
|
||||||
global exitFlag
|
global exit_flag
|
||||||
global currentIdExecution
|
global current_id_execution
|
||||||
|
global error_execution
|
||||||
# prepare command line:
|
# prepare command line:
|
||||||
args = shlex.split(cmdLine)
|
args = shlex.split(cmd_line)
|
||||||
debug.verbose("cmd = " + str(args))
|
debug.verbose("cmd = " + str(args))
|
||||||
try:
|
try:
|
||||||
# create the subprocess
|
# create the subprocess
|
||||||
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
debug.error("subprocess.CalledProcessError : TODO ...")
|
debug.error("subprocess.CalledProcessError : TODO ...")
|
||||||
|
except:
|
||||||
|
debug.error("Exception on : " + str(args))
|
||||||
# launch the subprocess:
|
# launch the subprocess:
|
||||||
output, err = p.communicate()
|
output, err = p.communicate()
|
||||||
if sys.version_info >= (3, 0):
|
if sys.version_info >= (3, 0):
|
||||||
output = output.decode("utf-8")
|
output = output.decode("utf-8")
|
||||||
err = err.decode("utf-8")
|
err = err.decode("utf-8")
|
||||||
|
# store error if needed:
|
||||||
|
tools.store_warning(store_output_file, output, err)
|
||||||
# Check error :
|
# Check error :
|
||||||
if p.returncode == 0:
|
if p.returncode == 0:
|
||||||
debug.debug(env.print_pretty(cmdLine))
|
debug.debug(env.print_pretty(cmd_line))
|
||||||
queueLock.acquire()
|
queue_lock.acquire()
|
||||||
|
if depend_data != None:
|
||||||
|
depend.create_dependency_file(depend_data['file'], depend_data['data'])
|
||||||
# TODO : Print the output all the time .... ==> to show warnings ...
|
# TODO : Print the output all the time .... ==> to show warnings ...
|
||||||
if buildId >= 0 and (output != "" or err != ""):
|
if build_id >= 0 and (output != "" or err != ""):
|
||||||
debug.warning("output in subprocess compiling: '" + file + "'")
|
debug.warning("output in subprocess compiling: '" + file + "'")
|
||||||
if output != "":
|
if output != "":
|
||||||
debug.print_compilator(output)
|
debug.print_compilator(output)
|
||||||
if err != "":
|
if err != "":
|
||||||
debug.print_compilator(err)
|
debug.print_compilator(err)
|
||||||
queueLock.release()
|
queue_lock.release()
|
||||||
else:
|
else:
|
||||||
errorOccured = True
|
error_occured = True
|
||||||
exitFlag = True
|
exit_flag = True
|
||||||
# if No ID : Not in a multiprocess mode ==> just stop here
|
# if No ID : Not in a multiprocess mode ==> just stop here
|
||||||
if buildId < 0:
|
if build_id < 0:
|
||||||
debug.debug(env.print_pretty(cmdLine), force=True)
|
debug.debug(env.print_pretty(cmd_line), force=True)
|
||||||
debug.print_compilator(output)
|
debug.print_compilator(output)
|
||||||
debug.print_compilator(err)
|
debug.print_compilator(err)
|
||||||
if p.returncode == 2:
|
if p.returncode == 2:
|
||||||
@@ -123,59 +138,67 @@ def run_command(cmdLine, storeCmdLine="", buildId=-1, file=""):
|
|||||||
debug.error("can not compile file ... ret : " + str(p.returncode))
|
debug.error("can not compile file ... ret : " + str(p.returncode))
|
||||||
else:
|
else:
|
||||||
# in multiprocess interface
|
# in multiprocess interface
|
||||||
queueLock.acquire()
|
queue_lock.acquire()
|
||||||
# if an other write an error before, check if the current process is started before ==> then is the first error
|
# if an other write an error before, check if the current process is started before ==> then is the first error
|
||||||
if errorExecution["id"] >= buildId:
|
if error_execution["id"] >= build_id:
|
||||||
# nothing to do ...
|
# nothing to do ...
|
||||||
queueLock.release()
|
queue_lock.release()
|
||||||
return;
|
return;
|
||||||
errorExecution["id"] = buildId
|
error_execution["id"] = build_id
|
||||||
errorExecution["cmd"] = cmdLine
|
error_execution["cmd"] = cmd_line
|
||||||
errorExecution["return"] = p.returncode
|
error_execution["return"] = p.returncode
|
||||||
errorExecution["err"] = err,
|
error_execution["err"] = err,
|
||||||
errorExecution["out"] = output,
|
error_execution["out"] = output,
|
||||||
queueLock.release()
|
queue_lock.release()
|
||||||
# not write the command file...
|
# not write the command file...
|
||||||
return
|
return
|
||||||
debug.verbose("done 3")
|
debug.verbose("done 3")
|
||||||
# write cmd line only after to prevent errors ...
|
# write cmd line only after to prevent errors ...
|
||||||
store_command(cmdLine, storeCmdLine)
|
tools.store_command(cmd_line, store_cmd_line)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class myThread(threading.Thread):
|
class myThread(threading.Thread):
|
||||||
def __init__(self, threadID, lock, queue):
|
def __init__(self, thread_id, lock, queue):
|
||||||
threading.Thread.__init__(self)
|
threading.Thread.__init__(self)
|
||||||
self.threadID = threadID
|
self.thread_id = thread_id
|
||||||
self.name = "Thread " + str(threadID)
|
self.name = "Thread " + str(thread_id)
|
||||||
self.queue = queue
|
self.queue = queue
|
||||||
self.lock = lock
|
self.lock = lock
|
||||||
def run(self):
|
def run(self):
|
||||||
debug.verbose("Starting " + self.name)
|
debug.verbose("Starting " + self.name)
|
||||||
global exitFlag
|
global exit_flag
|
||||||
global currentThreadWorking
|
global current_thread_working
|
||||||
workingSet = False
|
working_set = False
|
||||||
while exitFlag == False:
|
while exit_flag == False:
|
||||||
self.lock.acquire()
|
self.lock.acquire()
|
||||||
if not self.queue.empty():
|
if not self.queue.empty():
|
||||||
if workingSet==False:
|
if working_set == False:
|
||||||
currentThreadWorking += 1
|
current_thread_working += 1
|
||||||
workingSet = True
|
working_set = True
|
||||||
data = self.queue.get()
|
data = self.queue.get()
|
||||||
self.lock.release()
|
self.lock.release()
|
||||||
debug.verbose(self.name + " processing '" + data[0] + "'")
|
debug.verbose(self.name + " processing '" + data[0] + "'")
|
||||||
if data[0]=="cmdLine":
|
if data[0]=="cmd_line":
|
||||||
comment = data[2]
|
comment = data[2]
|
||||||
cmdLine = data[1]
|
cmd_line = data[1]
|
||||||
cmdStoreFile = data[3]
|
cmd_store_file = data[3]
|
||||||
debug.print_element( "[" + str(data[4]) + "][" + str(self.threadID) + "] " + comment[0], comment[1], comment[2], comment[3])
|
debug.print_element("[" + str(data[4]) + "][" + str(self.thread_id) + "] " + comment[0],
|
||||||
run_command(cmdLine, cmdStoreFile, buildId=data[4], file=comment[3])
|
comment[1],
|
||||||
|
comment[2],
|
||||||
|
comment[3])
|
||||||
|
run_command(cmd_line,
|
||||||
|
cmd_store_file,
|
||||||
|
build_id=data[4],
|
||||||
|
file=comment[3],
|
||||||
|
store_output_file=data[5],
|
||||||
|
depend_data=data[6])
|
||||||
else:
|
else:
|
||||||
debug.warning("unknow request command : " + data[0])
|
debug.warning("unknow request command : " + data[0])
|
||||||
else:
|
else:
|
||||||
if workingSet==True:
|
if working_set==True:
|
||||||
currentThreadWorking -= 1
|
current_thread_working -= 1
|
||||||
workingSet=False
|
working_set=False
|
||||||
# no element to parse, just wait ...
|
# no element to parse, just wait ...
|
||||||
self.lock.release()
|
self.lock.release()
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
@@ -183,39 +206,41 @@ class myThread(threading.Thread):
|
|||||||
debug.verbose("Exiting " + self.name)
|
debug.verbose("Exiting " + self.name)
|
||||||
|
|
||||||
|
|
||||||
def error_occured():
|
def set_error_occured():
|
||||||
global exitFlag
|
global exit_flag
|
||||||
exitFlag = True
|
exit_flag = True
|
||||||
|
|
||||||
def set_core_number(numberOfcore):
|
def set_core_number(number_of_core):
|
||||||
global processorAvaillable
|
global processor_availlable
|
||||||
processorAvaillable = numberOfcore
|
processor_availlable = number_of_core
|
||||||
debug.debug(" set number of core for multi process compilation : " + str(processorAvaillable))
|
debug.debug(" set number of core for multi process compilation : " + str(processor_availlable))
|
||||||
# nothing else to do
|
# nothing else to do
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
global exitFlag
|
global error_occured
|
||||||
global isinit
|
global exit_flag
|
||||||
if isinit==False:
|
global is_init
|
||||||
isinit=True
|
if is_init == False:
|
||||||
|
is_init = True
|
||||||
|
error_occured = False
|
||||||
global threads
|
global threads
|
||||||
global queueLock
|
global queue_lock
|
||||||
global workQueue
|
global work_queue
|
||||||
# Create all the new threads
|
# Create all the new threads
|
||||||
threadID = 0
|
thread_id = 0
|
||||||
while threadID < processorAvaillable:
|
while thread_id < processor_availlable:
|
||||||
thread = myThread(threadID, queueLock, workQueue)
|
thread = myThread(thread_id, queue_lock, work_queue)
|
||||||
thread.start()
|
thread.start()
|
||||||
threads.append(thread)
|
threads.append(thread)
|
||||||
threadID += 1
|
thread_id += 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def un_init():
|
def un_init():
|
||||||
global exitFlag
|
global exit_flag
|
||||||
# Notify threads it's time to exit
|
# Notify threads it's time to exit
|
||||||
exitFlag = True
|
exit_flag = True
|
||||||
if processorAvaillable > 1:
|
if processor_availlable > 1:
|
||||||
# Wait for all threads to complete
|
# Wait for all threads to complete
|
||||||
for tmp in threads:
|
for tmp in threads:
|
||||||
debug.verbose("join thread ...")
|
debug.verbose("join thread ...")
|
||||||
@@ -224,54 +249,54 @@ def un_init():
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
def run_in_pool(cmdLine, comment, storeCmdLine=""):
|
def run_in_pool(cmd_line, comment, store_cmd_line="", store_output_file="", depend_data=None):
|
||||||
global currentIdExecution
|
global current_id_execution
|
||||||
if processorAvaillable <= 1:
|
if processor_availlable <= 1:
|
||||||
debug.print_element(comment[0], comment[1], comment[2], comment[3])
|
debug.print_element(comment[0], comment[1], comment[2], comment[3])
|
||||||
run_command(cmdLine, storeCmdLine, file=comment[3])
|
run_command(cmd_line, store_cmd_line, file=comment[3], store_output_file=store_output_file, depend_data=depend_data)
|
||||||
return
|
return
|
||||||
# multithreaded mode
|
# multithreaded mode
|
||||||
init()
|
init()
|
||||||
# Fill the queue
|
# Fill the queue
|
||||||
queueLock.acquire()
|
queue_lock.acquire()
|
||||||
debug.verbose("add : in pool cmdLine")
|
debug.verbose("add : in pool cmd_line")
|
||||||
workQueue.put(["cmdLine", cmdLine, comment, storeCmdLine, currentIdExecution])
|
work_queue.put(["cmd_line", cmd_line, comment, store_cmd_line, current_id_execution, store_output_file, depend_data])
|
||||||
currentIdExecution +=1;
|
current_id_execution +=1;
|
||||||
queueLock.release()
|
queue_lock.release()
|
||||||
|
|
||||||
|
|
||||||
def pool_synchrosize():
|
def pool_synchrosize():
|
||||||
global errorOccured
|
global error_occured
|
||||||
global errorExecution
|
global error_execution
|
||||||
if processorAvaillable <= 1:
|
if processor_availlable <= 1:
|
||||||
#in this case : nothing to synchronise
|
#in this case : nothing to synchronise
|
||||||
return
|
return
|
||||||
|
|
||||||
debug.verbose("wait queue process ended\n")
|
debug.verbose("wait queue process ended\n")
|
||||||
# Wait for queue to empty
|
# Wait for queue to empty
|
||||||
while not workQueue.empty() \
|
while not work_queue.empty() \
|
||||||
and False==errorOccured:
|
and error_occured == False:
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
pass
|
pass
|
||||||
# Wait all thread have ended their current process
|
# Wait all thread have ended their current process
|
||||||
while currentThreadWorking != 0 \
|
while current_thread_working != 0 \
|
||||||
and False==errorOccured:
|
and error_occured == False:
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
pass
|
pass
|
||||||
if False==errorOccured:
|
if error_occured == False:
|
||||||
debug.verbose("queue is empty")
|
debug.verbose("queue is empty")
|
||||||
else:
|
else:
|
||||||
un_init()
|
un_init()
|
||||||
debug.debug("Thread return with error ... ==> stop all the pool")
|
debug.debug("Thread return with error ... ==> stop all the pool")
|
||||||
if errorExecution["id"] == -1:
|
if error_execution["id"] == -1:
|
||||||
debug.error("Pool error occured ... (No return information on Pool)")
|
debug.error("Pool error occured ... (No return information on Pool)")
|
||||||
return
|
return
|
||||||
debug.error("Error in an pool element : [" + str(errorExecution["id"]) + "]", crash=False)
|
debug.error("Error in an pool element : [" + str(error_execution["id"]) + "]", crash=False)
|
||||||
debug.debug(env.print_pretty(errorExecution["cmd"]), force=True)
|
debug.debug(env.print_pretty(error_execution["cmd"]), force=True)
|
||||||
debug.print_compilator(str(errorExecution["out"][0]))
|
debug.print_compilator(str(error_execution["out"][0]))
|
||||||
debug.print_compilator(str(errorExecution["err"][0]))
|
debug.print_compilator(str(error_execution["err"][0]))
|
||||||
if errorExecution["return"] == 2:
|
if error_execution["return"] == 2:
|
||||||
debug.error("can not compile file ... [keyboard interrrupt]")
|
debug.error("can not compile file ... [keyboard interrrupt]")
|
||||||
else:
|
else:
|
||||||
debug.error("can not compile file ... return value : " + str(errorExecution["return"]))
|
debug.error("can not compile file ... return value : " + str(error_execution["return"]))
|
||||||
|
|
||||||
|
177
lutin/system.py
177
lutin/system.py
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
@@ -15,66 +16,60 @@ import datetime
|
|||||||
# Local import
|
# Local import
|
||||||
from . import debug
|
from . import debug
|
||||||
from . import module
|
from . import module
|
||||||
|
from . import tools
|
||||||
|
from . import env
|
||||||
|
|
||||||
class System:
|
class System:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.valid=False;
|
self.valid=False;
|
||||||
self.help="";
|
self.help="";
|
||||||
self.include_cc=[]
|
self.export_depends=[]
|
||||||
self.export_flags_cc=[]
|
self.export_flags={}
|
||||||
self.export_flags_xx=[]
|
self.export_src=[]
|
||||||
self.export_flags_mm=[]
|
self.export_path=[]
|
||||||
self.export_flags_m=[]
|
self.action_on_state={}
|
||||||
self.export_flags_ar=[]
|
|
||||||
self.export_flags_ld=[]
|
|
||||||
self.export_flags_ld_shared=[]
|
|
||||||
self.export_libs_ld=[]
|
|
||||||
self.export_libs_ld_shared=[]
|
|
||||||
|
|
||||||
def append_and_check(self, listout, newElement, order):
|
def add_export_sources(self, list):
|
||||||
for element in listout:
|
tools.list_append_to(self.export_src, list)
|
||||||
if element==newElement:
|
|
||||||
return
|
|
||||||
listout.append(newElement)
|
|
||||||
if True==order:
|
|
||||||
listout.sort()
|
|
||||||
|
|
||||||
def append_to_internalList(self, listout, list, order=False):
|
# todo : add other than C ...
|
||||||
if type(list) == type(str()):
|
def add_export_path(self, list):
|
||||||
self.append_and_check(listout, list, order)
|
tools.list_append_to(self.export_path, list)
|
||||||
|
|
||||||
|
def add_module_depend(self, list):
|
||||||
|
tools.list_append_to(self.export_depends, list, True)
|
||||||
|
|
||||||
|
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_add_src_filestate:
|
||||||
|
self.action_on_state[name_of_state] = [[level, name, action]]
|
||||||
else:
|
else:
|
||||||
# mulyiple imput in the list ...
|
self.action_on_state[name_of_state].append([level, name, action])
|
||||||
for elem in list:
|
|
||||||
self.append_and_check(listout, elem, order)
|
|
||||||
|
|
||||||
def add_export_flag_LD(self, list):
|
def __repr__(self):
|
||||||
self.append_to_internalList(self.export_flags_ld, list)
|
return "{lutin.System}"
|
||||||
|
|
||||||
def add_export_flag_CC(self, list):
|
|
||||||
self.append_to_internalList(self.export_flags_cc, list)
|
|
||||||
|
|
||||||
def add_export_flag_XX(self, list):
|
|
||||||
self.append_to_internalList(self.export_flags_xx, list)
|
|
||||||
|
|
||||||
def add_export_flag_M(self, list):
|
|
||||||
self.append_to_internalList(self.export_flags_m, list)
|
|
||||||
|
|
||||||
def add_export_flag_MM(self, list):
|
|
||||||
self.append_to_internalList(self.export_flags_mm, list)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def create_module_from_system(target, dict):
|
||||||
|
|
||||||
def createModuleFromSystem(target, dict):
|
|
||||||
myModule = module.Module(dict["path"], dict["name"], 'PREBUILD')
|
myModule = module.Module(dict["path"], dict["name"], 'PREBUILD')
|
||||||
|
# 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)
|
||||||
|
|
||||||
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 the currrent module at the
|
|
||||||
return myModule
|
return myModule
|
||||||
|
|
||||||
|
|
||||||
@@ -82,79 +77,91 @@ def createModuleFromSystem(target, dict):
|
|||||||
|
|
||||||
# Dictionnaire of Target name
|
# Dictionnaire of Target name
|
||||||
# inside table of ["Name of the lib", "path of the lib", boolean loaded, module loaded]
|
# inside table of ["Name of the lib", "path of the lib", boolean loaded, module loaded]
|
||||||
systemList={}
|
system_list={}
|
||||||
__startSystemName="lutinSystem_"
|
__start_system_name="System_"
|
||||||
|
|
||||||
|
def import_path(path_list):
|
||||||
def import_path(path):
|
global system_list
|
||||||
global targetList
|
global_base = env.get_build_system_base_name()
|
||||||
matches = []
|
debug.debug("SYSTEM: Init with Files list:")
|
||||||
debug.debug('Start find sub File : "%s"' %path)
|
for elem in path_list:
|
||||||
for root, dirnames, filenames in os.walk(path):
|
sys.path.append(os.path.dirname(elem))
|
||||||
tmpList = fnmatch.filter(filenames, __startSystemName + "*.py")
|
# Get file name:
|
||||||
# Import the module :
|
filename = os.path.basename(elem)
|
||||||
for filename in tmpList:
|
# Remove .py at the end:
|
||||||
debug.verbose(' Find a file : "%s"' %os.path.join(root, filename))
|
filename = filename[:-3]
|
||||||
sys.path.append(os.path.dirname(os.path.join(root, filename)) )
|
# Remove global base name:
|
||||||
systemName = filename.replace('.py', '')
|
filename = filename[len(global_base):]
|
||||||
systemName = systemName.replace(__startSystemName, '')
|
# Check if it start with the local patern:
|
||||||
targetType, systemName = systemName.split('_')
|
if filename[:len(__start_system_name)] != __start_system_name:
|
||||||
debug.debug("integrate system: '" + targetType + "':'" + systemName + "' from '" + os.path.join(root, filename) + "'")
|
debug.extreme_verbose("SYSTEM: NOT-Integrate: '" + filename + "' from '" + elem + "' ==> rejected")
|
||||||
if targetType in systemList:
|
continue
|
||||||
systemList[targetType].append({"name":systemName,
|
# Remove local patern
|
||||||
"path":os.path.join(root, filename),
|
system_name = filename[len(__start_system_name):]
|
||||||
|
system_type, system_name = system_name.split('_')
|
||||||
|
debug.verbose("SYSTEM: Integrate: '" + system_type + "':'" + system_name + "' from '" + elem + "'")
|
||||||
|
if system_type in system_list:
|
||||||
|
system_list[system_type].append({"name":system_name,
|
||||||
|
"path":elem,
|
||||||
"system":None,
|
"system":None,
|
||||||
"loaded":False,
|
"loaded":False,
|
||||||
"exist":False,
|
"exist":False,
|
||||||
"module":None})
|
"module":None})
|
||||||
else:
|
else:
|
||||||
systemList[targetType] = [{"name":systemName,
|
system_list[system_type] = [{"name":system_name,
|
||||||
"path":os.path.join(root, filename),
|
"path":elem,
|
||||||
"system":None,
|
"system":None,
|
||||||
"loaded":False,
|
"loaded":False,
|
||||||
"exist":False,
|
"exist":False,
|
||||||
"module":None}]
|
"module":None}]
|
||||||
|
debug.verbose("New list system: ")
|
||||||
|
for elem in system_list:
|
||||||
|
debug.verbose(" " + str(elem))
|
||||||
|
for val in system_list[elem]:
|
||||||
|
debug.verbose(" " + str(val["name"]))
|
||||||
|
|
||||||
|
|
||||||
def display():
|
def display():
|
||||||
global systemList
|
global system_list
|
||||||
for elementName in systemList:
|
for elementName in system_list:
|
||||||
debug.info("integrate system: '" + elementName +"'")
|
debug.info("SYSTEM: Integrate system: '" + elementName +"'")
|
||||||
for data in systemList[elementName]:
|
for data in system_list[elementName]:
|
||||||
debug.info(" '" + data["name"] +"' in " + data["path"])
|
debug.info("SYSTEM: '" + data["name"] +"' in " + data["path"])
|
||||||
|
|
||||||
|
def exist(lib_name, target_name, target) :
|
||||||
def exist(lib_name, target_name) :
|
global system_list
|
||||||
global systemList
|
debug.verbose("exist= " + lib_name + " in " + target_name)
|
||||||
if target_name not in systemList:
|
if target_name not in system_list:
|
||||||
return False
|
return False
|
||||||
for data in systemList[target_name]:
|
for data in system_list[target_name]:
|
||||||
if data["name"] == lib_name:
|
if data["name"] == lib_name:
|
||||||
# we find it in the List ==> need to check if it is present in the system :
|
# we find it in the List ==> need to check if it is present in the system :
|
||||||
if data["loaded"] == False:
|
if data["loaded"] == False:
|
||||||
debug.verbose("add to path: '" + os.path.dirname(data["path"]) + "'")
|
debug.verbose("add to path: '" + os.path.dirname(data["path"]) + "'")
|
||||||
sys.path.append(os.path.dirname(data["path"]))
|
sys.path.append(os.path.dirname(data["path"]))
|
||||||
debug.verbose("import system : '" + data["name"] + "'")
|
debug.verbose("import system : '" + data["name"] + "'")
|
||||||
theSystem = __import__(__startSystemName + target_name + "_" + data["name"])
|
theSystem = __import__(env.get_build_system_base_name() + __start_system_name + target_name + "_" + data["name"])
|
||||||
#create the system module
|
#create the system module
|
||||||
try:
|
try:
|
||||||
data["system"] = theSystem.System()
|
debug.verbose("SYSTEM: request: " + data["name"])
|
||||||
|
data["system"] = theSystem.System(target)
|
||||||
data["exist"] = data["system"].valid
|
data["exist"] = data["system"].valid
|
||||||
except:
|
except:
|
||||||
debug.debug("Not find: '" + data["name"] + "'")
|
debug.warning("Not find: '" + data["name"] + "' ==> get exception")
|
||||||
return data["exist"]
|
return data["exist"]
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def load(target, lib_name, target_name):
|
def load(target, lib_name, target_name):
|
||||||
global systemList
|
global system_list
|
||||||
if target_name not in systemList:
|
if target_name not in system_list:
|
||||||
debug.error("you must call this function after checking of the system exist() !1!")
|
debug.error("you must call this function after checking of the system exist() !1!")
|
||||||
for data in systemList[target_name]:
|
for data in system_list[target_name]:
|
||||||
if data["name"] == lib_name:
|
if data["name"] == lib_name:
|
||||||
if data["exist"] == False:
|
if data["exist"] == False:
|
||||||
debug.error("you must call this function after checking of the system exist() !2!")
|
debug.error("you must call this function after checking of the system exist() !2!")
|
||||||
if data["module"] == None:
|
if data["module"] == None:
|
||||||
# create a module from the system interface...
|
# create a module from the system interface...
|
||||||
data["module"] = createModuleFromSystem(target, data)
|
data["module"] = create_module_from_system(target, data)
|
||||||
data["loaded"] = True
|
data["loaded"] = True
|
||||||
target.add_module(data["module"])
|
target.add_module(data["module"])
|
||||||
return
|
return
|
||||||
|
831
lutin/target.py
831
lutin/target.py
File diff suppressed because it is too large
Load Diff
291
lutin/tools.py
291
lutin/tools.py
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
@@ -11,15 +12,16 @@ import os
|
|||||||
import shutil
|
import shutil
|
||||||
import errno
|
import errno
|
||||||
import fnmatch
|
import fnmatch
|
||||||
|
import stat
|
||||||
# Local import
|
# Local import
|
||||||
from . import debug
|
from . import debug
|
||||||
from . import depend
|
from . import depend
|
||||||
import multiprocess
|
from . import env
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
"""
|
"""
|
||||||
def get_run_folder():
|
def get_run_path():
|
||||||
return os.getcwd()
|
return os.getcwd()
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@@ -29,26 +31,28 @@ def get_current_path(file):
|
|||||||
return os.path.dirname(os.path.realpath(file))
|
return os.path.dirname(os.path.realpath(file))
|
||||||
|
|
||||||
def create_directory_of_file(file):
|
def create_directory_of_file(file):
|
||||||
folder = os.path.dirname(file)
|
path = os.path.dirname(file)
|
||||||
try:
|
try:
|
||||||
os.stat(folder)
|
os.stat(path)
|
||||||
except:
|
except:
|
||||||
os.makedirs(folder)
|
os.makedirs(path)
|
||||||
|
|
||||||
def get_list_sub_folder(path):
|
def get_list_sub_path(path):
|
||||||
# TODO : os.listdir(path)
|
# TODO : os.listdir(path)
|
||||||
for dirname, dirnames, filenames in os.walk(path):
|
for dirname, dirnames, filenames in os.walk(path):
|
||||||
return dirnames
|
return dirnames
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def remove_folder_and_sub_folder(path):
|
def remove_path_and_sub_path(path):
|
||||||
if os.path.isdir(path):
|
if os.path.isdir(path):
|
||||||
debug.verbose("remove folder : '" + path + "'")
|
debug.verbose("remove path : '" + path + "'")
|
||||||
shutil.rmtree(path)
|
shutil.rmtree(path)
|
||||||
|
|
||||||
def remove_file(path):
|
def remove_file(path):
|
||||||
if os.path.isfile(path):
|
if os.path.isfile(path):
|
||||||
os.remove(path)
|
os.remove(path)
|
||||||
|
elif os.path.islink(path):
|
||||||
|
os.remove(path)
|
||||||
|
|
||||||
def file_size(path):
|
def file_size(path):
|
||||||
if not os.path.isfile(path):
|
if not os.path.isfile(path):
|
||||||
@@ -67,10 +71,36 @@ def file_read_data(path, binary=False):
|
|||||||
file.close()
|
file.close()
|
||||||
return data_file
|
return data_file
|
||||||
|
|
||||||
def file_write_data(path, data):
|
def version_to_string(version):
|
||||||
|
version_ID = ""
|
||||||
|
for id in version:
|
||||||
|
if len(version_ID) != 0:
|
||||||
|
if type(id) == str:
|
||||||
|
version_ID += "-"
|
||||||
|
else:
|
||||||
|
version_ID += "."
|
||||||
|
version_ID += str(id)
|
||||||
|
return version_ID
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Write data in a specific path.
|
||||||
|
## @param[in] path Path of the data might be written.
|
||||||
|
## @param[in] data Data To write in the file.
|
||||||
|
## @param[in] only_if_new (default: False) Write data only if data is different.
|
||||||
|
## @return True Something has been copied
|
||||||
|
## @return False Nothing has been copied
|
||||||
|
##
|
||||||
|
def file_write_data(path, data, only_if_new=False):
|
||||||
|
if only_if_new == True:
|
||||||
|
old_data = file_read_data(path)
|
||||||
|
if old_data == data:
|
||||||
|
return False
|
||||||
|
#real write of data:
|
||||||
|
create_directory_of_file(path)
|
||||||
file = open(path, "w")
|
file = open(path, "w")
|
||||||
file.write(data)
|
file.write(data)
|
||||||
file.close()
|
file.close()
|
||||||
|
return True
|
||||||
|
|
||||||
def list_to_str(list):
|
def list_to_str(list):
|
||||||
if type(list) == type(str()):
|
if type(list) == type(str()):
|
||||||
@@ -96,51 +126,226 @@ def add_prefix(prefix,list):
|
|||||||
result.append(prefix+elem)
|
result.append(prefix+elem)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def copy_file(src, dst, cmd_file=None, force=False):
|
##
|
||||||
|
## @brief Copy a specific file in a specific directory
|
||||||
|
## @param[in] src Input file path
|
||||||
|
## @param[in] dst Output file path
|
||||||
|
## @param[in] cmd_file (default None) Path of file to store the command line used
|
||||||
|
## @param[in] force (default False) Force copy of the file
|
||||||
|
## @param[in] force_identical (default False) Force file to be identical (read it in binary)
|
||||||
|
## @param[in,out] in_list (default None) Not real copy: set the request copy in the input list
|
||||||
|
## @return True Something has/must been copied
|
||||||
|
## @return False Nothing has/myst been copied
|
||||||
|
##
|
||||||
|
def copy_file(src, dst, cmd_file=None, force=False, force_identical=False, in_list=None):
|
||||||
if os.path.exists(src) == False:
|
if os.path.exists(src) == False:
|
||||||
debug.error("Request a copy a file that does not existed : '" + src + "'")
|
debug.error("Request a copy a file that does not existed : '" + src + "'")
|
||||||
cmd_line = "copy \"" + src + "\" \"" + dst + "\""
|
cmd_line = "copy \"" + src + "\" \"" + dst + "\""
|
||||||
if force == False \
|
if force == False \
|
||||||
and depend.need_re_build(dst, src, file_cmd=cmd_file , cmdLine=cmd_line) == False:
|
and depend.need_re_build(dst, src, file_cmd=cmd_file , cmd_line=cmd_line, force_identical=force_identical) == False:
|
||||||
return
|
debug.verbose("no need to copy ...")
|
||||||
debug.print_element("copy file", src, "==>", dst)
|
if in_list != None:
|
||||||
|
if dst in in_list:
|
||||||
|
debug.verbose("replace copy file " + os.path.relpath(src) + " ==> " + os.path.relpath(dst))
|
||||||
|
else:
|
||||||
|
debug.verbose("append copy file " + os.path.relpath(src) + " ==> " + os.path.relpath(dst))
|
||||||
|
# update element in dictionnary:
|
||||||
|
in_list[dst] = {"src":src,
|
||||||
|
"cmd_file":cmd_file,
|
||||||
|
"need_copy":False}
|
||||||
|
return False
|
||||||
|
if in_list == None:
|
||||||
|
debug.print_element("copy file ", os.path.relpath(src), "==>", os.path.relpath(dst))
|
||||||
create_directory_of_file(dst)
|
create_directory_of_file(dst)
|
||||||
shutil.copyfile(src, dst)
|
shutil.copyfile(src, dst)
|
||||||
multiprocess.store_command(cmd_line, cmd_file)
|
# copy property of the permition of the file ...
|
||||||
|
stat_info = os.stat(src)
|
||||||
|
os.chmod(dst, stat_info.st_mode)
|
||||||
|
store_command(cmd_line, cmd_file)
|
||||||
|
else:
|
||||||
|
debug.verbose("append copy file " + os.path.relpath(src) + " ==> " + os.path.relpath(dst))
|
||||||
|
# update element in dictionnary:
|
||||||
|
in_list[dst] = {"src":src,
|
||||||
|
"cmd_file":cmd_file,
|
||||||
|
"need_copy":True}
|
||||||
|
return True
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Copy a compleate directory in a specific folder
|
||||||
|
## @param[in] src Input folder path
|
||||||
|
## @param[in] dst Output folder path
|
||||||
|
## @param[in] recursive (default False) Copy folder with all his dependency
|
||||||
|
## @param[in] force (default False) Force copy of the file
|
||||||
|
## @param[in,out] in_list (default None) Not real copy: set the request copy in the input list
|
||||||
|
##
|
||||||
|
def copy_anything(src, dst, recursive = False, force_identical=False, in_list=None):
|
||||||
|
debug.verbose(" copy anything : '" + str(src) + "'")
|
||||||
|
debug.verbose(" to : '" + str(dst) + "'")
|
||||||
|
if os.path.isdir(os.path.realpath(src)):
|
||||||
|
tmp_path = os.path.realpath(src)
|
||||||
|
tmp_rule = ""
|
||||||
|
else:
|
||||||
|
tmp_path = os.path.dirname(os.path.realpath(src))
|
||||||
|
tmp_rule = os.path.basename(src)
|
||||||
|
|
||||||
def copy_anything(src, dst):
|
debug.verbose(" " + str(tmp_path) + ":")
|
||||||
tmpPath = os.path.dirname(os.path.realpath(src))
|
for root, dirnames, filenames in os.walk(tmp_path):
|
||||||
tmpRule = os.path.basename(src)
|
deltaRoot = root[len(tmp_path):]
|
||||||
for root, dirnames, filenames in os.walk(tmpPath):
|
while len(deltaRoot) > 0 \
|
||||||
debug.verbose(" root='" + str(root) + "' dir='" + str(dirnames) + "' filenames=" + str(filenames))
|
and ( deltaRoot[0] == '/' \
|
||||||
|
or deltaRoot[0] == '\\' ):
|
||||||
|
deltaRoot = deltaRoot[1:]
|
||||||
|
if recursive == False \
|
||||||
|
and deltaRoot != "":
|
||||||
|
return
|
||||||
|
debug.verbose(" root='" + str(deltaRoot) + "'")
|
||||||
|
debug.verbose(" files=" + str(filenames))
|
||||||
tmpList = filenames
|
tmpList = filenames
|
||||||
if len(tmpRule)>0:
|
if len(tmp_rule) > 0:
|
||||||
tmpList = fnmatch.filter(filenames, tmpRule)
|
tmpList = fnmatch.filter(filenames, tmp_rule)
|
||||||
# Import the module :
|
# Import the module :
|
||||||
for cycleFile in tmpList:
|
for cycleFile in tmpList:
|
||||||
#for cycleFile in filenames:
|
#for cycleFile in filenames:
|
||||||
debug.verbose("Might copy : '" + tmpPath+cycleFile + "' ==> '" + dst + "'")
|
debug.verbose(" '" + cycleFile + "'")
|
||||||
copy_file(tmpPath+"/"+cycleFile, dst+"/"+cycleFile)
|
debug.extreme_verbose("Might copy : '" + tmp_path + " " + deltaRoot + " " + cycleFile + "' ==> '" + dst + "'")
|
||||||
|
copy_file(os.path.join(tmp_path, deltaRoot, cycleFile),
|
||||||
|
os.path.join(dst, deltaRoot, cycleFile),
|
||||||
|
force_identical=force_identical,
|
||||||
|
in_list=in_list)
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief real copy of files in a specific dictionnary list
|
||||||
|
## @param[in] in_list Dictionnary of file to copy
|
||||||
|
## @return True Something has been copied
|
||||||
|
## @return False Nothing has been copied
|
||||||
|
##
|
||||||
|
def copy_list(in_list):
|
||||||
|
has_file_copied = False
|
||||||
|
for dst in in_list:
|
||||||
|
if in_list[dst]["need_copy"] == False:
|
||||||
|
continue
|
||||||
|
# note we force the copy to disable the check of needed of copy (already done)
|
||||||
|
copy_file(in_list[dst]["src"], dst, cmd_file=in_list[dst]["cmd_file"], force=True)
|
||||||
|
has_file_copied = True
|
||||||
|
return has_file_copied
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Clean a path from all un-needed element in a directory
|
||||||
|
## @param[in] path Path to clean
|
||||||
|
## @param[in] normal_list List of all files/path in the path
|
||||||
|
## @return True Something has been removed
|
||||||
|
## @return False Nothing has been removed
|
||||||
|
##
|
||||||
|
def clean_directory(path, normal_list):
|
||||||
|
has_file_removed = False
|
||||||
|
# get a list of all element in the path:
|
||||||
|
for root, dirnames, filenames in os.walk(path):
|
||||||
|
for file in filenames:
|
||||||
|
file_name = os.path.join(root, file)
|
||||||
|
if file_name not in normal_list:
|
||||||
|
debug.print_element("remove file ", os.path.relpath(file_name), "==>", "---")
|
||||||
|
os.remove(file_name)
|
||||||
|
has_file_removed = True
|
||||||
|
return has_file_removed
|
||||||
|
|
||||||
|
def filter_extention(list_files, extentions, invert=False):
|
||||||
|
out = []
|
||||||
|
for file in list_files:
|
||||||
|
in_list = False
|
||||||
|
for ext in extentions:
|
||||||
|
if file[-len(ext):] == ext:
|
||||||
|
in_list = True
|
||||||
|
if in_list == True \
|
||||||
|
and invert == False:
|
||||||
|
out.append(file)
|
||||||
|
elif in_list == False \
|
||||||
|
and invert == True:
|
||||||
|
out.append(file)
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
def copy_anything_target(target, src, dst):
|
def move_if_needed(src, dst):
|
||||||
tmpPath = os.path.dirname(os.path.realpath(src))
|
if not os.path.isfile(src):
|
||||||
tmpRule = os.path.basename(src)
|
debug.error("request move if needed, but file does not exist: '" + str(src) + "' to '" + str(dst) + "'")
|
||||||
for root, dirnames, filenames in os.walk(tmpPath):
|
return
|
||||||
debug.verbose(" root='" + str(root) + "' dir='" + str(dirnames) + "' filenames=" + str(filenames))
|
src_data = file_read_data(src)
|
||||||
tmpList = filenames
|
if os.path.isfile(dst):
|
||||||
if len(tmpRule)>0:
|
# file exist ==> must check ...
|
||||||
tmpList = fnmatch.filter(filenames, tmpRule)
|
dst_data = file_read_data(dst)
|
||||||
# Import the module :
|
if src_data == dst_data:
|
||||||
for cycleFile in tmpList:
|
# nothing to do ...
|
||||||
#for cycleFile in filenames:
|
return
|
||||||
newDst = dst
|
file_write_data(dst, src_data)
|
||||||
if len(newDst) != 0 and newDst[-1] != "/":
|
remove_file(src)
|
||||||
newDst += "/"
|
|
||||||
if root[len(src)-1:] != "":
|
def store_command(cmd_line, file):
|
||||||
newDst += root[len(src)-1:]
|
# write cmd line only after to prevent errors ...
|
||||||
if len(newDst) != 0 and newDst[-1] != "/":
|
if file == "" \
|
||||||
newDst += "/"
|
or file == None:
|
||||||
debug.verbose("Might copy : '" + root+"/"+cycleFile + "' ==> '" + newDst+cycleFile + "'" )
|
return;
|
||||||
target.add_file_staging(root+"/"+cycleFile, newDst+cycleFile)
|
debug.verbose("create cmd file: " + file)
|
||||||
|
# Create directory:
|
||||||
|
create_directory_of_file(file)
|
||||||
|
# Store the command Line:
|
||||||
|
file2 = open(file, "w")
|
||||||
|
file2.write(cmd_line)
|
||||||
|
file2.flush()
|
||||||
|
file2.close()
|
||||||
|
|
||||||
|
def store_warning(file, output, err):
|
||||||
|
# write warning line only after to prevent errors ...
|
||||||
|
if file == "" \
|
||||||
|
or file == None:
|
||||||
|
return;
|
||||||
|
if env.get_warning_mode() == False:
|
||||||
|
debug.verbose("remove warning file: " + file)
|
||||||
|
# remove file if exist...
|
||||||
|
remove_file(file);
|
||||||
|
return;
|
||||||
|
debug.verbose("create warning file: " + file)
|
||||||
|
# Create directory:
|
||||||
|
create_directory_of_file(file)
|
||||||
|
# Store the command Line:
|
||||||
|
file2 = open(file, "w")
|
||||||
|
file2.write("===== output =====\n")
|
||||||
|
file2.write(output)
|
||||||
|
file2.write("\n\n")
|
||||||
|
file2.write("===== error =====\n")
|
||||||
|
file2.write(err)
|
||||||
|
file2.write("\n\n")
|
||||||
|
file2.flush()
|
||||||
|
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):
|
||||||
|
# sepcial cse of bool
|
||||||
|
if type(list) == bool:
|
||||||
|
listout[module] = list
|
||||||
|
return
|
||||||
|
# add list in the Map
|
||||||
|
if module not in listout:
|
||||||
|
listout[module] = []
|
||||||
|
# add elements...
|
||||||
|
list_append_to(listout[module], list, order)
|
@@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##
|
||||||
|
## @author Edouard DUPIN
|
||||||
|
##
|
||||||
|
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||||
|
##
|
||||||
|
## @license APACHE v2.0 (see license file)
|
||||||
|
##
|
||||||
|
@@ -1,3 +1,13 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##
|
||||||
|
## @author Edouard DUPIN
|
||||||
|
##
|
||||||
|
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||||
|
##
|
||||||
|
## @license APACHE v2.0 (see license file)
|
||||||
|
##
|
||||||
|
|
||||||
##
|
##
|
||||||
## Executable/binary builder
|
## Executable/binary builder
|
||||||
##
|
##
|
||||||
@@ -36,16 +46,47 @@ def get_input_type():
|
|||||||
def get_output_type():
|
def get_output_type():
|
||||||
return ["", "exe", "bin"]
|
return ["", "exe", "bin"]
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Get builder support multi-threading or not
|
||||||
|
## @return True Multithreading supported
|
||||||
|
## @return False Multithreading NOT supported
|
||||||
|
##
|
||||||
|
def get_support_multithreading():
|
||||||
|
return False
|
||||||
|
|
||||||
##
|
##
|
||||||
## @brief Commands for running gcc to link an executable.
|
## @brief Commands for running gcc to link an executable.
|
||||||
##
|
##
|
||||||
def link(file, binary, target, depancy, name, basic_folder):
|
def link(file, binary, target, depancy, flags, name, basic_path, static = False):
|
||||||
file_src, file_dst, file_depend, file_cmd = target.generate_file(binary, name, basic_folder, file, "bin")
|
file_src, file_dst, file_depend, file_cmd, file_warning = target.generate_file(binary, name, basic_path, file, "bin")
|
||||||
#create comdLine :
|
debug.extreme_verbose("list files = " + str(depancy.src))
|
||||||
cmd = [
|
list_static = []
|
||||||
target.xx
|
list_dynamic = []
|
||||||
]
|
if static == True:
|
||||||
|
#get all parent static libs
|
||||||
|
list_static = depancy.src['static']
|
||||||
|
# get only parent shared that is not static
|
||||||
|
for elem in depancy.src['dynamic']:
|
||||||
|
lib_name = elem[:-len(target.suffix_lib_dynamic)] + target.suffix_lib_static
|
||||||
|
if lib_name not in depancy.src['static']:
|
||||||
|
list_dynamic.append(elem)
|
||||||
|
else:
|
||||||
|
#get all parent dynamic libs
|
||||||
|
list_dynamic = depancy.src['dynamic']
|
||||||
|
# get only parent shared that is not static
|
||||||
|
for elem in depancy.src['static']:
|
||||||
|
lib_name = elem[:-len(target.suffix_lib_static)] + target.suffix_lib_dynamic
|
||||||
|
if lib_name not in depancy.src['dynamic']:
|
||||||
|
list_static.append(elem)
|
||||||
|
#create comand line:
|
||||||
|
cmd = []
|
||||||
|
# a specific case to not depend on the libstdc++ automaticly added by the G++ or clang++ compilator ==> then need to compile with GCC or CLANG if use libcxx from llvm or other ...
|
||||||
|
if "need-libstdc++" in depancy.flags \
|
||||||
|
and depancy.flags["need-libstdc++"] == True:
|
||||||
|
cmd.append(target.xx)
|
||||||
|
else:
|
||||||
|
cmd.append(target.cc)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
cmd.append(target.arch)
|
cmd.append(target.arch)
|
||||||
except:
|
except:
|
||||||
@@ -67,7 +108,23 @@ def link(file, binary, target, depancy, name, basic_folder):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
cmd.append(depancy.src)
|
cmd.append(depancy.src['src'])
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
cmd.append(list_static)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
for elem in list_dynamic:
|
||||||
|
lib_path = os.path.dirname(elem)
|
||||||
|
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.name != "MacOs" \
|
||||||
|
and target.name != "Android":
|
||||||
|
if len(list_dynamic) > 0:
|
||||||
|
cmd.append("-Wl,-R$ORIGIN/../lib/")
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
@@ -79,30 +136,42 @@ def link(file, binary, target, depancy, name, basic_folder):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
cmd.append(target.global_flags_ld)
|
cmd.append(target.global_flags["link"])
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
cmdLine=tools.list_to_str(cmd)
|
for view in ["local", "export"]:
|
||||||
|
if view not in flags:
|
||||||
|
continue
|
||||||
|
for type in ["link-lib"]:
|
||||||
|
if type in flags[view]:
|
||||||
|
cmd.append([("-l" + sss).replace("-l/", "/") for sss in flags[view][type] ])
|
||||||
|
for type in ["link-lib"]:
|
||||||
|
if type in depancy.flags:
|
||||||
|
cmd.append([("-l" + sss).replace("-l/", "/") for sss in depancy.flags[type] ])
|
||||||
|
for type in ["link-lib"]:
|
||||||
|
if type in target.global_flags:
|
||||||
|
cmd.append([("-l" + sss).replace("-l/", "/") for sss in target.global_flags[type] ])
|
||||||
|
cmd_line = tools.list_to_str(cmd)
|
||||||
# check the dependency for this file :
|
# check the dependency for this file :
|
||||||
if depend.need_re_package(file_dst, file_src, True, file_cmd, cmdLine) == False \
|
if depend.need_re_package(file_dst, file_src, True, file_cmd=file_cmd, cmd_line=cmd_line) == False \
|
||||||
and depend.need_re_package(file_dst, depancy.src, False, file_cmd, cmdLine) == False:
|
and depend.need_re_package(file_dst, depancy.src, False, file_cmd=file_cmd, cmd_line=cmd_line) == False:
|
||||||
return file_dst
|
return file_dst
|
||||||
tools.create_directory_of_file(file_dst)
|
tools.create_directory_of_file(file_dst)
|
||||||
debug.print_element("Executable", name, "==>", file_dst)
|
debug.print_element("Executable", name, "==>", os.path.relpath(file_dst))
|
||||||
|
|
||||||
multiprocess.run_command(cmdLine)
|
multiprocess.run_command(cmd_line, store_output_file=file_warning)
|
||||||
if target.config["mode"] == "release"\
|
if target.config["mode"] == "release"\
|
||||||
or env.get_force_strip_mode() == True:
|
or env.get_force_strip_mode() == True:
|
||||||
# get the file size of the non strip file
|
# get the file size of the non strip file
|
||||||
originSize = tools.file_size(file_dst);
|
originSize = tools.file_size(file_dst);
|
||||||
debug.print_element("Executable(strip)", name, "", "")
|
debug.print_element("Executable(strip)", name, "", "")
|
||||||
cmdLineStrip=tools.list_to_str([
|
cmd_lineStrip=tools.list_to_str([
|
||||||
target.strip,
|
target.strip,
|
||||||
file_dst])
|
file_dst])
|
||||||
multiprocess.run_command(cmdLineStrip)
|
multiprocess.run_command(cmd_lineStrip, store_output_file=file_warning)
|
||||||
# get the stip size of the binary
|
# get the stip size of the binary
|
||||||
stripSize = tools.file_size(file_dst)
|
strip_size = tools.file_size(file_dst)
|
||||||
debug.debug("file reduce size : " + str(originSize/1024) + "ko ==> " + str(stripSize/1024) + "ko")
|
debug.debug("file reduce size : " + str(originSize/1024) + "ko ==> " + str(strip_size/1024) + "ko")
|
||||||
# write cmd line only after to prevent errors ...
|
# write cmd line only after to prevent errors ...
|
||||||
multiprocess.store_command(cmdLine, file_cmd)
|
tools.store_command(cmd_line, file_cmd)
|
||||||
|
|
@@ -1,3 +1,13 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##
|
||||||
|
## @author Edouard DUPIN
|
||||||
|
##
|
||||||
|
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||||
|
##
|
||||||
|
## @license APACHE v2.0 (see license file)
|
||||||
|
##
|
||||||
|
|
||||||
##
|
##
|
||||||
## C builder
|
## C builder
|
||||||
##
|
##
|
||||||
@@ -37,11 +47,23 @@ def get_input_type():
|
|||||||
def get_output_type():
|
def get_output_type():
|
||||||
return ["o"]
|
return ["o"]
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Get builder support multi-threading or not
|
||||||
|
## @return True Multithreading supported
|
||||||
|
## @return False Multithreading NOT supported
|
||||||
|
##
|
||||||
|
def get_support_multithreading():
|
||||||
|
return True
|
||||||
|
|
||||||
##
|
##
|
||||||
## @brief Commands for running gcc to compile a C file in object file.
|
## @brief Commands for running gcc to compile a C file in object file.
|
||||||
##
|
##
|
||||||
def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
def compile(file, binary, target, depancy, flags, path, name, basic_path, module_src):
|
||||||
file_src, file_dst, file_depend, file_cmd = target.file_generate_object(binary, name, basic_folder,file)
|
file_src = target.get_full_name_source(basic_path, file)
|
||||||
|
file_cmd = target.get_full_name_cmd(name, basic_path, file)
|
||||||
|
file_dst = target.get_full_name_destination(name, basic_path, file, get_output_type())
|
||||||
|
file_depend = target.get_full_dependency(name, basic_path, file)
|
||||||
|
file_warning = target.get_full_name_warning(name, basic_path, file)
|
||||||
|
|
||||||
# create the command line befor requesting start:
|
# create the command line befor requesting start:
|
||||||
cmd = [
|
cmd = [
|
||||||
@@ -50,16 +72,13 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
|||||||
target.arch,
|
target.arch,
|
||||||
target.sysroot,
|
target.sysroot,
|
||||||
target.global_include_cc]
|
target.global_include_cc]
|
||||||
|
for view in ["export", "local"]:
|
||||||
try:
|
try:
|
||||||
cmd.append(tools.add_prefix("-I", path["export"]))
|
cmd.append(tools.add_prefix("-I", path[view]["c"]))
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
cmd.append(tools.add_prefix("-I", path["local"]))
|
cmd.append(tools.add_prefix("-I", depancy.path["c"]))
|
||||||
except:
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
cmd.append(tools.add_prefix("-I", depancy.path))
|
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
@@ -67,19 +86,16 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
cmd.append(target.global_flags_cc)
|
cmd.append(target.global_flags["c"])
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
cmd.append(depancy.flags["c"])
|
cmd.append(depancy.flags["c"])
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
for view in ["local", "export"]:
|
||||||
try:
|
try:
|
||||||
cmd.append(flags["local"]["c"])
|
cmd.append(flags[view]["c"])
|
||||||
except:
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
cmd.append(flags["export"]["c"])
|
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
cmd.append("-c")
|
cmd.append("-c")
|
||||||
@@ -90,12 +106,12 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
|||||||
cmdLine=tools.list_to_str(cmd)
|
cmdLine=tools.list_to_str(cmd)
|
||||||
# check the dependency for this file :
|
# check the dependency for this file :
|
||||||
if depend.need_re_build(file_dst, file_src, file_depend, file_cmd, cmdLine) == False:
|
if depend.need_re_build(file_dst, file_src, file_depend, file_cmd, cmdLine) == False:
|
||||||
return file_dst
|
return {"action":"add", "file":file_dst}
|
||||||
tools.create_directory_of_file(file_dst)
|
tools.create_directory_of_file(file_dst)
|
||||||
comment = ["c", name, "<==", file]
|
comment = ["c", name, "<==", file]
|
||||||
# process element
|
# process element
|
||||||
multiprocess.run_in_pool(cmdLine, comment, file_cmd)
|
multiprocess.run_in_pool(cmdLine, comment, file_cmd, store_output_file=file_warning)
|
||||||
return file_dst
|
return {"action":"add", "file":file_dst}
|
||||||
|
|
||||||
|
|
||||||
def get_version_compilation_flags(flags, dependency_flags):
|
def get_version_compilation_flags(flags, dependency_flags):
|
||||||
|
@@ -1,3 +1,13 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##
|
||||||
|
## @author Edouard DUPIN
|
||||||
|
##
|
||||||
|
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||||
|
##
|
||||||
|
## @license APACHE v2.0 (see license file)
|
||||||
|
##
|
||||||
|
|
||||||
##
|
##
|
||||||
## C++ builder
|
## C++ builder
|
||||||
##
|
##
|
||||||
@@ -36,12 +46,30 @@ def get_input_type():
|
|||||||
def get_output_type():
|
def get_output_type():
|
||||||
return ["o"]
|
return ["o"]
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Get builder support multi-threading or not
|
||||||
|
## @return True Multithreading supported
|
||||||
|
## @return False Multithreading NOT supported
|
||||||
|
##
|
||||||
|
def get_support_multithreading():
|
||||||
|
return True
|
||||||
|
|
||||||
|
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.
|
## @brief Commands for running gcc to compile a C++ file in object file.
|
||||||
##
|
##
|
||||||
def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
def compile(file, binary, target, depancy, flags, path, name, basic_path, module_src):
|
||||||
file_src, file_dst, file_depend, file_cmd = target.file_generate_object(binary, name, basic_folder, file)
|
file_src = target.get_full_name_source(basic_path, file)
|
||||||
|
file_cmd = target.get_full_name_cmd(name, basic_path, file)
|
||||||
|
file_dst = target.get_full_name_destination(name, basic_path, file, get_output_type())
|
||||||
|
file_depend = target.get_full_dependency(name, basic_path, file)
|
||||||
|
file_warning = target.get_full_name_warning(name, basic_path, file)
|
||||||
# create the command line befor requesting start:
|
# create the command line befor requesting start:
|
||||||
cmd = [
|
cmd = [
|
||||||
target.xx,
|
target.xx,
|
||||||
@@ -50,67 +78,76 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
|||||||
target.sysroot,
|
target.sysroot,
|
||||||
target.global_include_cc
|
target.global_include_cc
|
||||||
]
|
]
|
||||||
|
for view in ["export", "local"]:
|
||||||
|
for type in ["c", "c++"]:
|
||||||
try:
|
try:
|
||||||
cmd.append(tools.add_prefix("-I",path["export"]))
|
cmd.append(tools.add_prefix("-I",path[view][type]))
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
for type in ["c", "c++"]:
|
||||||
try:
|
try:
|
||||||
cmd.append(tools.add_prefix("-I",path["local"]))
|
cmd.append(tools.add_prefix("-I",depancy.path[type]))
|
||||||
except:
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
cmd.append(tools.add_prefix("-I",depancy.path))
|
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
cmd.append(get_version_compilation_flags(flags, depancy.flags))
|
cmd.append(get_version_compilation_flags(flags, depancy.flags))
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
list_flags = [];
|
||||||
try:
|
try:
|
||||||
cmd.append(target.global_flags_cc)
|
list_flags.append(target.global_flags["c"])
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
cmd.append(target.global_flags_xx)
|
list_flags.append(target.global_flags["c++"])
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
for type in ["c", "c++"]:
|
||||||
|
try:
|
||||||
|
list_flags.append(depancy.flags[type])
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
for view in ["local", "export"]:
|
||||||
|
for type in ["c", "c++"]:
|
||||||
|
try:
|
||||||
|
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:
|
except:
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
cmd.append(depancy.flags["c"])
|
list_flags_blacklist.append(target.global_flags["c++-remove"])
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
for type in ["c-remove", "c++-remove"]:
|
||||||
try:
|
try:
|
||||||
cmd.append(depancy.flags["c++"])
|
list_flags_blacklist.append(depancy.flags[type])
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
for view in ["local", "export"]:
|
||||||
|
for type in ["c-remove", "c++-remove"]:
|
||||||
try:
|
try:
|
||||||
cmd.append(flags["local"]["c"])
|
list_flags_blacklist.append(flags[view][type])
|
||||||
except:
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
cmd.append(flags["local"]["c++"])
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
cmd.append(flags["export"]["c"])
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
cmd.append(flags["export"]["c++"])
|
|
||||||
except:
|
except:
|
||||||
pass
|
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(["-c", "-MMD", "-MP"])
|
||||||
cmd.append(file_src)
|
cmd.append(file_src)
|
||||||
# Create cmd line
|
# Create cmd line
|
||||||
cmdLine=tools.list_to_str(cmd)
|
cmdLine = tools.list_to_str(cmd)
|
||||||
|
|
||||||
# check the dependency for this file :
|
# check the dependency for this file :
|
||||||
if depend.need_re_build(file_dst, file_src, file_depend, file_cmd, cmdLine) == False:
|
if depend.need_re_build(file_dst, file_src, file_depend, file_cmd, cmdLine) == False:
|
||||||
return file_dst
|
return {"action":"add", "file":file_dst}
|
||||||
tools.create_directory_of_file(file_dst)
|
tools.create_directory_of_file(file_dst)
|
||||||
comment = ["c++", name, "<==", file]
|
comment = ["c++", name, "<==", file]
|
||||||
#process element
|
#process element
|
||||||
multiprocess.run_in_pool(cmdLine, comment, file_cmd)
|
multiprocess.run_in_pool(cmdLine, comment, file_cmd, store_output_file=file_warning)
|
||||||
return file_dst
|
return {"action":"add", "file":file_dst}
|
||||||
|
|
||||||
def get_version_compilation_flags(flags, dependency_flags):
|
def get_version_compilation_flags(flags, dependency_flags):
|
||||||
try:
|
try:
|
||||||
@@ -127,8 +164,13 @@ def get_version_compilation_flags(flags, dependency_flags):
|
|||||||
is_gnu = default_version_gnu
|
is_gnu = default_version_gnu
|
||||||
|
|
||||||
version = max(version_local, dependency_version)
|
version = max(version_local, dependency_version)
|
||||||
|
if version == 2017:
|
||||||
|
debug.error("not supported flags for X17 ...");
|
||||||
|
if is_gnu == True:
|
||||||
|
out = ["-std=gnu++17", "-D__CPP_VERSION__=2017"]
|
||||||
|
else:
|
||||||
|
out = ["-std=c++17", "-D__CPP_VERSION__=2017"]
|
||||||
if version == 2014:
|
if version == 2014:
|
||||||
debug.error("not supported flags for X14 ...");
|
|
||||||
if is_gnu == True:
|
if is_gnu == True:
|
||||||
out = ["-std=gnu++14", "-D__CPP_VERSION__=2014"]
|
out = ["-std=gnu++14", "-D__CPP_VERSION__=2014"]
|
||||||
else:
|
else:
|
||||||
|
91
lutin/z_builder/lutinBuilder_jar.py
Normal file
91
lutin/z_builder/lutinBuilder_jar.py
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##
|
||||||
|
## @author Edouard DUPIN
|
||||||
|
##
|
||||||
|
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||||
|
##
|
||||||
|
## @license APACHE v2.0 (see license file)
|
||||||
|
##
|
||||||
|
|
||||||
|
##
|
||||||
|
## Dynamic library builder
|
||||||
|
##
|
||||||
|
from lutin import multiprocess
|
||||||
|
from lutin import tools
|
||||||
|
from lutin import debug
|
||||||
|
from lutin import depend
|
||||||
|
from lutin import env
|
||||||
|
import os
|
||||||
|
|
||||||
|
##
|
||||||
|
## Initialize the builder, if needed ... to get dependency between builder (for example)
|
||||||
|
##
|
||||||
|
def init():
|
||||||
|
pass
|
||||||
|
|
||||||
|
##
|
||||||
|
## Get the current builder type.
|
||||||
|
## Return the type of builder
|
||||||
|
##
|
||||||
|
def get_type():
|
||||||
|
return "linker"
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Get builder input file type
|
||||||
|
## @return List of extention supported
|
||||||
|
##
|
||||||
|
def get_input_type():
|
||||||
|
return ["class"]
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Get builder output file type
|
||||||
|
## @return List of extention supported
|
||||||
|
##
|
||||||
|
def get_output_type():
|
||||||
|
return ["jar"]
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Get builder support multi-threading or not
|
||||||
|
## @return True Multithreading supported
|
||||||
|
## @return False Multithreading NOT supported
|
||||||
|
##
|
||||||
|
def get_support_multithreading():
|
||||||
|
return False
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Commands for running gcc to link a shared library.
|
||||||
|
##
|
||||||
|
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 = [
|
||||||
|
target.jar,
|
||||||
|
"cf", file_dst,
|
||||||
|
]
|
||||||
|
for file in file_src:
|
||||||
|
path = ""
|
||||||
|
for elem in ["org/", "com/"]:
|
||||||
|
pos = file.find(elem);
|
||||||
|
if pos > 0:
|
||||||
|
path = file[:pos]
|
||||||
|
file = file[pos:]
|
||||||
|
cmd.append("-C")
|
||||||
|
cmd.append(path)
|
||||||
|
cmd.append(file)
|
||||||
|
cmdLine=tools.list_to_str(cmd)
|
||||||
|
"""
|
||||||
|
# check the dependency for this file :
|
||||||
|
if depend.need_re_package(file_dst, file_src, True, file_cmd, cmdLine) == False:
|
||||||
|
return tmpList[1]
|
||||||
|
"""
|
||||||
|
tools.create_directory_of_file(file_dst)
|
||||||
|
debug.print_element("jar", name, "==>", file_dst)
|
||||||
|
multiprocess.run_command(cmdLine, store_output_file=file_warning)
|
||||||
|
# write cmd line only after to prevent errors ...
|
||||||
|
tools.store_command(cmdLine, file_cmd)
|
||||||
|
#debug.print_element("SharedLib", self.name, "==>", tmpList[1])
|
||||||
|
return file_dst
|
||||||
|
|
||||||
|
|
||||||
|
|
@@ -1,3 +1,13 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##
|
||||||
|
## @author Edouard DUPIN
|
||||||
|
##
|
||||||
|
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||||
|
##
|
||||||
|
## @license APACHE v2.0 (see license file)
|
||||||
|
##
|
||||||
|
|
||||||
##
|
##
|
||||||
## Java builder
|
## Java builder
|
||||||
##
|
##
|
||||||
@@ -32,3 +42,100 @@ def get_input_type():
|
|||||||
##
|
##
|
||||||
def get_output_type():
|
def get_output_type():
|
||||||
return ["class"]
|
return ["class"]
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Get builder support multi-threading or not
|
||||||
|
## @return True Multithreading supported
|
||||||
|
## @return False Multithreading NOT supported
|
||||||
|
##
|
||||||
|
def get_support_multithreading():
|
||||||
|
return False
|
||||||
|
|
||||||
|
def create_dependency_files(target, src, heritage_src, basic_path):
|
||||||
|
depend = []
|
||||||
|
for elem in src:
|
||||||
|
extention = elem.split('.')[-1]
|
||||||
|
if extention == 'jar' \
|
||||||
|
or extention == 'java':
|
||||||
|
debug.extreme_verbose("add java depedence ... " + elem)
|
||||||
|
depend.append(target.get_full_name_source(basic_path, elem))
|
||||||
|
|
||||||
|
for elem in heritage_src:
|
||||||
|
extention = elem.split('.')[-1]
|
||||||
|
if extention == 'jar' \
|
||||||
|
or extention == 'java':
|
||||||
|
debug.extreme_verbose("add java depedence ... " + elem)
|
||||||
|
depend.append(elem)
|
||||||
|
return depend
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Commands for running gcc to compile a C++ file in object file.
|
||||||
|
##
|
||||||
|
def compile(file, binary, target, depancy, flags, path, name, basic_path, module_src):
|
||||||
|
file_src = target.get_full_name_source(basic_path, file)
|
||||||
|
file_cmd = target.get_full_name_cmd(name, basic_path, file)
|
||||||
|
file_dst = target.get_full_name_destination(name, basic_path, file, get_output_type(), remove_suffix=True)
|
||||||
|
file_depend = target.get_full_dependency(name, basic_path, file)
|
||||||
|
file_warning = target.get_full_name_warning(name, basic_path, file)
|
||||||
|
depend_files = create_dependency_files(target, module_src, depancy.src['src'], basic_path)
|
||||||
|
"""
|
||||||
|
debug.warning("file_src = " + file_src)
|
||||||
|
debug.warning("file_cmd = " + file_cmd)
|
||||||
|
debug.warning("file_dst = " + file_dst)
|
||||||
|
debug.warning("file_depend = " + file_depend)
|
||||||
|
debug.warning("file_warning = " + file_warning)
|
||||||
|
"""
|
||||||
|
# create the command line befor requesting start:
|
||||||
|
cmd = [
|
||||||
|
target.java,
|
||||||
|
"-d", target.get_build_path_object(name)
|
||||||
|
]
|
||||||
|
# add source dependency:
|
||||||
|
list_sources_path = []
|
||||||
|
for view in ["export", "local"]:
|
||||||
|
try:
|
||||||
|
list = path[view]["java"]
|
||||||
|
for elem in list:
|
||||||
|
list_sources_path.append(elem)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
if len(list_sources_path) > 0:
|
||||||
|
cmd.append("-sourcepath")
|
||||||
|
out = ""
|
||||||
|
for elem in list_sources_path:
|
||||||
|
if len(out) > 0:
|
||||||
|
out += ":"
|
||||||
|
out += elem
|
||||||
|
cmd.append(out)
|
||||||
|
class_extern = []
|
||||||
|
upper_jar = tools.filter_extention(depancy.src['src'], ["jar"])
|
||||||
|
#debug.warning("ploppppp = " + str(upper_jar))
|
||||||
|
for elem in upper_jar:
|
||||||
|
class_extern.append(elem)
|
||||||
|
if len(class_extern) > 0:
|
||||||
|
cmd.append("-classpath")
|
||||||
|
out = ""
|
||||||
|
for elem in class_extern:
|
||||||
|
if len(out) > 0:
|
||||||
|
out += ":"
|
||||||
|
out += elem
|
||||||
|
cmd.append(out)
|
||||||
|
|
||||||
|
cmd.append(file_src)
|
||||||
|
# Create cmd line
|
||||||
|
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}
|
||||||
|
tools.create_directory_of_file(file_dst)
|
||||||
|
comment = ["java", name, "<==", file]
|
||||||
|
#process element
|
||||||
|
multiprocess.run_in_pool(cmdLine,
|
||||||
|
comment,
|
||||||
|
file_cmd,
|
||||||
|
store_output_file = file_warning,
|
||||||
|
depend_data = {"file":file_depend,
|
||||||
|
"data":depend_files})
|
||||||
|
return {"action":"add", "file":file_dst}
|
||||||
|
|
||||||
|
113
lutin/z_builder/lutinBuilder_javah.py
Normal file
113
lutin/z_builder/lutinBuilder_javah.py
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##
|
||||||
|
## @author Edouard DUPIN
|
||||||
|
##
|
||||||
|
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||||
|
##
|
||||||
|
## @license APACHE v2.0 (see license file)
|
||||||
|
##
|
||||||
|
|
||||||
|
##
|
||||||
|
## Java builder
|
||||||
|
##
|
||||||
|
from lutin import multiprocess
|
||||||
|
from lutin import tools
|
||||||
|
from lutin import debug
|
||||||
|
from lutin import depend
|
||||||
|
|
||||||
|
##
|
||||||
|
## Initialize the builder, if needed ... to get dependency between builder (for example)
|
||||||
|
##
|
||||||
|
def init():
|
||||||
|
pass
|
||||||
|
|
||||||
|
##
|
||||||
|
## Get the current builder type.
|
||||||
|
## Return the type of builder
|
||||||
|
##
|
||||||
|
def get_type():
|
||||||
|
return "compiler"
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Get builder input file type
|
||||||
|
## @return List of extention supported
|
||||||
|
##
|
||||||
|
def get_input_type():
|
||||||
|
return ["javah"]
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Get builder output file type
|
||||||
|
## @return List of extention supported
|
||||||
|
##
|
||||||
|
def get_output_type():
|
||||||
|
return ["h"]
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Get builder support multi-threading or not
|
||||||
|
## @return True Multithreading supported
|
||||||
|
## @return False Multithreading NOT supported
|
||||||
|
##
|
||||||
|
def get_support_multithreading():
|
||||||
|
return False
|
||||||
|
|
||||||
|
def create_dependency_files(target, src, heritage_src, basic_path):
|
||||||
|
depend = []
|
||||||
|
for elem in src:
|
||||||
|
extention = elem.split('.')[-1]
|
||||||
|
if extention == 'jar' \
|
||||||
|
or extention == 'java':
|
||||||
|
debug.extreme_verbose("add java depedence ... " + elem)
|
||||||
|
depend.append(target.get_full_name_source(basic_path, elem))
|
||||||
|
|
||||||
|
for elem in heritage_src:
|
||||||
|
extention = elem.split('.')[-1]
|
||||||
|
if extention == 'jar' \
|
||||||
|
or extention == 'java':
|
||||||
|
debug.extreme_verbose("add java depedence ... " + elem)
|
||||||
|
depend.append(elem)
|
||||||
|
return depend
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Commands for running gcc to compile a C++ file in object file.
|
||||||
|
##
|
||||||
|
def compile(file, binary, target, depancy, flags, path, name, basic_path, module_src):
|
||||||
|
# file_src = target.get_full_name_source(basic_path, file)
|
||||||
|
file_cmd = target.get_full_name_cmd(name, basic_path, file)
|
||||||
|
# file_dst = target.get_full_name_destination(name, basic_path, file, get_output_type())
|
||||||
|
file_depend = target.get_full_dependency(name, basic_path, file)
|
||||||
|
file_warning = target.get_full_name_warning(name, basic_path, file)
|
||||||
|
depend_files = create_dependency_files(target, module_src, depancy.src['src'], basic_path)
|
||||||
|
# create the command line befor requesting start:
|
||||||
|
cmd = [
|
||||||
|
target.javah,
|
||||||
|
"-d", target.get_build_path(name) + target.path_generate_code
|
||||||
|
]
|
||||||
|
|
||||||
|
if debug.get_level() >= 5:
|
||||||
|
cmd.append("-verbose")
|
||||||
|
|
||||||
|
cmd.append("-classpath")
|
||||||
|
cmd.append(target.get_build_path_object(name))
|
||||||
|
class_to_build = file[:-6]
|
||||||
|
cmd.append(class_to_build)
|
||||||
|
# Create cmd line
|
||||||
|
cmd_line = tools.list_to_str(cmd)
|
||||||
|
|
||||||
|
file_dst = target.get_build_path(name) + "/generate_header/" + class_to_build.replace(".", "_") + ".h"
|
||||||
|
# check the dependency for this file :
|
||||||
|
if depend.need_re_build(file_dst, None, file_depend, file_cmd, cmd_line) == False:
|
||||||
|
return {"action":"path", "path":target.get_build_path(name) + target.path_generate_code}
|
||||||
|
#tools.create_directory_of_file(file_dst)
|
||||||
|
comment = ["javah", class_to_build.replace(".", "_") + ".h", "<==", class_to_build]
|
||||||
|
#process element
|
||||||
|
multiprocess.run_in_pool(cmd_line,
|
||||||
|
comment,
|
||||||
|
file_cmd,
|
||||||
|
store_output_file = file_warning,
|
||||||
|
depend_data = {"file":file_depend,
|
||||||
|
"data":depend_files})
|
||||||
|
debug.verbose("file= " + file_dst)
|
||||||
|
#return file_dst
|
||||||
|
return {"action":"path", "path":target.get_build_path(name) + target.path_generate_code}
|
||||||
|
|
@@ -1,3 +1,13 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##
|
||||||
|
## @author Edouard DUPIN
|
||||||
|
##
|
||||||
|
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||||
|
##
|
||||||
|
## @license APACHE v2.0 (see license file)
|
||||||
|
##
|
||||||
|
|
||||||
##
|
##
|
||||||
## Dynamic library builder
|
## Dynamic library builder
|
||||||
##
|
##
|
||||||
@@ -26,7 +36,7 @@ def get_type():
|
|||||||
## @return List of extention supported
|
## @return List of extention supported
|
||||||
##
|
##
|
||||||
def get_input_type():
|
def get_input_type():
|
||||||
return ["o"]
|
return ["o", "a"]
|
||||||
|
|
||||||
##
|
##
|
||||||
## @brief Get builder output file type
|
## @brief Get builder output file type
|
||||||
@@ -35,16 +45,47 @@ def get_input_type():
|
|||||||
def get_output_type():
|
def get_output_type():
|
||||||
return ["so", "dynlib", "dll"]
|
return ["so", "dynlib", "dll"]
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Get builder support multi-threading or not
|
||||||
|
## @return True Multithreading supported
|
||||||
|
## @return False Multithreading NOT supported
|
||||||
|
##
|
||||||
|
def get_support_multithreading():
|
||||||
|
return False
|
||||||
|
|
||||||
##
|
##
|
||||||
## @brief Commands for running gcc to link a shared library.
|
## @brief Commands for running gcc to link a shared library.
|
||||||
##
|
##
|
||||||
def link(file, binary, target, depancy, name, basic_folder):
|
def link(file, binary, target, depancy, flags, name, basic_path, static=False):
|
||||||
file_src, file_dst, file_depend, file_cmd = target.generate_file(binary, name, basic_folder, file, "lib-shared")
|
file_src, file_dst, file_depend, file_cmd, file_warning = target.generate_file(binary, name, basic_path, file, "lib-shared")
|
||||||
|
list_static = []
|
||||||
|
list_dynamic = []
|
||||||
|
if static == True:
|
||||||
|
#get all parent static libs
|
||||||
|
list_static = depancy.src['static']
|
||||||
|
# get only parent shared that is not static
|
||||||
|
for elem in depancy.src['dynamic']:
|
||||||
|
lib_name = elem[:-len(target.suffix_lib_dynamic)] + target.suffix_lib_static
|
||||||
|
if lib_name not in depancy.src['static']:
|
||||||
|
list_dynamic.append(elem)
|
||||||
|
else:
|
||||||
|
#get all parent dynamic libs
|
||||||
|
list_dynamic = depancy.src['dynamic']
|
||||||
|
# get only parent shared that is not static
|
||||||
|
for elem in depancy.src['static']:
|
||||||
|
lib_name = elem[:-len(target.suffix_lib_static)] + target.suffix_lib_dynamic
|
||||||
|
if lib_name not in depancy.src['dynamic']:
|
||||||
|
list_static.append(elem)
|
||||||
#create command Line
|
#create command Line
|
||||||
cmd = [
|
cmd = []
|
||||||
target.xx,
|
# a specific case to not depend on the libstdc++ automaticly added by the G++ or clang++ compilator ==> then need to compile with GCC or CLANG if use libcxx from llvm or other ...
|
||||||
"-o", file_dst
|
if "need-libstdc++" in depancy.flags \
|
||||||
]
|
and depancy.flags["need-libstdc++"] == True:
|
||||||
|
cmd.append(target.xx)
|
||||||
|
else:
|
||||||
|
cmd.append(target.cc)
|
||||||
|
|
||||||
|
cmd.append(["-o", file_dst])
|
||||||
try:
|
try:
|
||||||
cmd.append(target.global_sysroot)
|
cmd.append(target.global_sysroot)
|
||||||
except:
|
except:
|
||||||
@@ -59,42 +100,75 @@ def link(file, binary, target, depancy, name, basic_folder):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
cmd.append(depancy.src)
|
cmd.append(list_static)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
for view in ["local", "export"]:
|
||||||
|
if view not in flags:
|
||||||
|
continue
|
||||||
|
for type in ["link", "link-dynamic"]:
|
||||||
|
if type in flags[view]:
|
||||||
|
cmd.append(flags[view][type])
|
||||||
|
for type in ["link", "link-dynamic"]:
|
||||||
|
if type in depancy.flags:
|
||||||
|
cmd.append(depancy.flags[type])
|
||||||
|
for type in ["link", "link-dynamic"]:
|
||||||
|
if type in target.global_flags:
|
||||||
|
cmd.append(target.global_flags[type])
|
||||||
|
if 'src' in depancy.src:
|
||||||
|
cmd.append(tools.filter_extention(depancy.src['src'], get_input_type()))
|
||||||
try:
|
try:
|
||||||
cmd.append(flags["local"]["link"])
|
for elem in list_dynamic:
|
||||||
except:
|
lib_path = os.path.dirname(elem)
|
||||||
pass
|
lib_name = elem[len(lib_path)+len(target.prefix_lib)+1:-len(target.suffix_lib_dynamic)]
|
||||||
try:
|
cmd.append("-L" + lib_path)
|
||||||
cmd.append(depancy.flags["link"])
|
cmd.append("-l" + lib_name)
|
||||||
except:
|
if target.name != "MacOs" \
|
||||||
pass
|
and target.name != "Android":
|
||||||
try:
|
if len(list_dynamic) > 0:
|
||||||
cmd.append(target.global_flags_ld)
|
cmd.append("-Wl,-R$ORIGIN/../lib/")
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
for view in ["local", "export"]:
|
||||||
|
if view not in flags:
|
||||||
|
continue
|
||||||
|
for type in ["link-lib"]:
|
||||||
|
if type in flags[view]:
|
||||||
|
cmd.append([("-l" + sss).replace("-l/", "/") for sss in flags[view][type] ])
|
||||||
|
for type in ["link-lib"]:
|
||||||
|
if type in depancy.flags:
|
||||||
|
cmd.append([("-l" + sss).replace("-l/", "/") for sss in depancy.flags[type] ])
|
||||||
|
for type in ["link-lib"]:
|
||||||
|
if type in target.global_flags:
|
||||||
|
cmd.append([("-l" + sss).replace("-l/", "/") for sss in target.global_flags[type] ])
|
||||||
cmdLine=tools.list_to_str(cmd)
|
cmdLine=tools.list_to_str(cmd)
|
||||||
# check the dependency for this file :
|
# check the dependency for this file :
|
||||||
if depend.need_re_package(file_dst, file_src, True, file_cmd, cmdLine) == False \
|
if depend.need_re_package(file_dst, file_src, True, file_cmd, cmdLine) == False \
|
||||||
and depend.need_re_package(file_dst, depancy.src, False, file_cmd, cmdLine) == False:
|
and depend.need_re_package(file_dst, depancy.src, False, file_cmd, cmdLine) == False:
|
||||||
return tmpList[1]
|
return file_dst
|
||||||
tools.create_directory_of_file(file_dst)
|
tools.create_directory_of_file(file_dst)
|
||||||
debug.print_element("SharedLib", name, "==>", file_dst)
|
debug.print_element("SharedLib", name, "==>", os.path.relpath(file_dst))
|
||||||
multiprocess.run_command(cmdLine)
|
multiprocess.run_command(cmdLine, store_output_file=file_warning)
|
||||||
# strip the output file:
|
# strip the output file:
|
||||||
if target.config["mode"] == "release" \
|
if target.config["mode"] == "release" \
|
||||||
or env.get_force_strip_mode() == True:
|
or env.get_force_strip_mode() == True:
|
||||||
# get the file size of the non strip file
|
# get the file size of the non strip file
|
||||||
originSize = tools.file_size(file_dst);
|
originSize = tools.file_size(file_dst);
|
||||||
debug.print_element("SharedLib(strip)", name, "", "")
|
debug.print_element("SharedLib(strip)", name, "", "")
|
||||||
|
if target.name == "MacOs":
|
||||||
|
cmdLineStrip=tools.list_to_str([
|
||||||
|
target.strip,
|
||||||
|
"-u",
|
||||||
|
file_dst])
|
||||||
|
else:
|
||||||
cmdLineStrip=tools.list_to_str([
|
cmdLineStrip=tools.list_to_str([
|
||||||
target.strip,
|
target.strip,
|
||||||
file_dst])
|
file_dst])
|
||||||
multiprocess.run_command(cmdLineStrip)
|
multiprocess.run_command(cmdLineStrip, store_output_file=file_warning)
|
||||||
# get the stip size of the binary
|
# get the stip size of the binary
|
||||||
stripSize = tools.file_size(file_dst)
|
stripSize = tools.file_size(file_dst)
|
||||||
debug.debug("file reduce size : " + str(originSize/1024) + "ko ==> " + str(stripSize/1024) + "ko")
|
debug.debug("file reduce size : " + str(originSize/1024) + "ko ==> " + str(stripSize/1024) + "ko")
|
||||||
# write cmd line only after to prevent errors ...
|
# write cmd line only after to prevent errors ...
|
||||||
multiprocess.store_command(cmdLine, file_cmd)
|
tools.store_command(cmdLine, file_cmd)
|
||||||
#debug.print_element("SharedLib", self.name, "==>", tmpList[1])
|
#debug.print_element("SharedLib", self.name, "==>", tmpList[1])
|
||||||
|
return file_dst
|
||||||
|
@@ -1,3 +1,13 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##
|
||||||
|
## @author Edouard DUPIN
|
||||||
|
##
|
||||||
|
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||||
|
##
|
||||||
|
## @license APACHE v2.0 (see license file)
|
||||||
|
##
|
||||||
|
|
||||||
##
|
##
|
||||||
## Static library builder
|
## Static library builder
|
||||||
##
|
##
|
||||||
@@ -26,7 +36,7 @@ def get_type():
|
|||||||
## @return List of extention supported
|
## @return List of extention supported
|
||||||
##
|
##
|
||||||
def get_input_type():
|
def get_input_type():
|
||||||
return ["o"]
|
return ["o", "a"]
|
||||||
|
|
||||||
##
|
##
|
||||||
## @brief Get builder output file type
|
## @brief Get builder output file type
|
||||||
@@ -35,17 +45,25 @@ def get_input_type():
|
|||||||
def get_output_type():
|
def get_output_type():
|
||||||
return ["a"]
|
return ["a"]
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Get builder support multi-threading or not
|
||||||
|
## @return True Multithreading supported
|
||||||
|
## @return False Multithreading NOT supported
|
||||||
|
##
|
||||||
|
def get_support_multithreading():
|
||||||
|
return False
|
||||||
|
|
||||||
##
|
##
|
||||||
## @brief Commands for running ar.
|
## @brief Commands for running ar.
|
||||||
##
|
##
|
||||||
def link(file, binary, target, depancy, name, basic_folder):
|
def link(file, binary, target, depancy, flags, name, basic_path):
|
||||||
file_src, file_dst, file_depend, file_cmd = target.generate_file(binary, name, basic_folder, file, "lib-static")
|
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)
|
#$(Q)$(TARGET_AR) $(TARGET_GLOBAL_ARFLAGS) $(PRIVATE_ARFLAGS) $@ $(PRIVATE_ALL_OBJECTS)
|
||||||
cmd = [
|
cmd = [
|
||||||
target.ar
|
target.ar
|
||||||
]
|
]
|
||||||
try:
|
try:
|
||||||
cmd.append(target.global_flags_ar)
|
cmd.append(target.global_flags["ar"])
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
@@ -65,18 +83,19 @@ def link(file, binary, target, depancy, name, basic_folder):
|
|||||||
if depend.need_re_package(file_dst, file_src, True, file_cmd, cmdLine) == False \
|
if depend.need_re_package(file_dst, file_src, True, file_cmd, cmdLine) == False \
|
||||||
and depend.need_re_package(file_dst, depancy.src, False, file_cmd, cmdLine) == False:
|
and depend.need_re_package(file_dst, depancy.src, False, file_cmd, cmdLine) == False:
|
||||||
return file_dst
|
return file_dst
|
||||||
|
|
||||||
tools.create_directory_of_file(file_dst)
|
tools.create_directory_of_file(file_dst)
|
||||||
debug.print_element("StaticLib", name, "==>", file_dst)
|
debug.print_element("StaticLib", name, "==>", os.path.relpath(file_dst))
|
||||||
# explicitly remove the destination to prevent error ...
|
# explicitly remove the destination to prevent error ...
|
||||||
if os.path.exists(file_dst) and os.path.isfile(file_dst):
|
if os.path.exists(file_dst) and os.path.isfile(file_dst):
|
||||||
os.remove(file_dst)
|
os.remove(file_dst)
|
||||||
multiprocess.run_command(cmdLine)
|
multiprocess.run_command(cmdLine, store_output_file=file_warning)
|
||||||
#$(Q)$(TARGET_RANLIB) $@
|
#$(Q)$(TARGET_RANLIB) $@
|
||||||
if target.ranlib != "":
|
if target.ranlib != "":
|
||||||
cmdLineRanLib=tools.list_to_str([
|
cmdLineRanLib=tools.list_to_str([
|
||||||
target.ranlib,
|
target.ranlib,
|
||||||
file_dst ])
|
file_dst ])
|
||||||
multiprocess.run_command(cmdLineRanLib)
|
multiprocess.run_command(cmdLineRanLib, store_output_file=file_warning)
|
||||||
# write cmd line only after to prevent errors ...
|
# write cmd line only after to prevent errors ...
|
||||||
multiprocess.store_command(cmdLine, file_cmd)
|
tools.store_command(cmdLine, file_cmd)
|
||||||
return file_dst
|
return file_dst
|
||||||
|
@@ -1,3 +1,13 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##
|
||||||
|
## @author Edouard DUPIN
|
||||||
|
##
|
||||||
|
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||||
|
##
|
||||||
|
## @license APACHE v2.0 (see license file)
|
||||||
|
##
|
||||||
|
|
||||||
##
|
##
|
||||||
## Objective-C builder
|
## Objective-C builder
|
||||||
##
|
##
|
||||||
@@ -38,11 +48,23 @@ def get_input_type():
|
|||||||
def get_output_type():
|
def get_output_type():
|
||||||
return ["o"]
|
return ["o"]
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Get builder support multi-threading or not
|
||||||
|
## @return True Multithreading supported
|
||||||
|
## @return False Multithreading NOT supported
|
||||||
|
##
|
||||||
|
def get_support_multithreading():
|
||||||
|
return True
|
||||||
|
|
||||||
##
|
##
|
||||||
## @brief Commands for running gcc to compile a m file in object file.
|
## @brief Commands for running gcc to compile a m file in object file.
|
||||||
##
|
##
|
||||||
def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
def compile(file, binary, target, depancy, flags, path, name, basic_path, module_src):
|
||||||
file_src, file_dst, file_depend, file_cmd = target.file_generate_object(binary, name, basic_folder, file)
|
file_src = target.get_full_name_source(basic_path, file)
|
||||||
|
file_cmd = target.get_full_name_cmd(name, basic_path, file)
|
||||||
|
file_dst = target.get_full_name_destination(name, basic_path, file, get_output_type())
|
||||||
|
file_depend = target.get_full_dependency(name, basic_path, file)
|
||||||
|
file_warning = target.get_full_name_warning(name, basic_path, file)
|
||||||
# create the command line befor requesting start:
|
# create the command line befor requesting start:
|
||||||
cmd = [
|
cmd = [
|
||||||
target.cc,
|
target.cc,
|
||||||
@@ -50,16 +72,15 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
|||||||
target.arch,
|
target.arch,
|
||||||
target.sysroot,
|
target.sysroot,
|
||||||
target.global_include_cc]
|
target.global_include_cc]
|
||||||
|
for view in ["export", "local"]:
|
||||||
|
for type in ["c", "m"]:
|
||||||
try:
|
try:
|
||||||
cmd.append(tools.add_prefix("-I",path["export"]))
|
cmd.append(tools.add_prefix("-I",path[view][type]))
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
for type in ["c", "m"]:
|
||||||
try:
|
try:
|
||||||
cmd.append(tools.add_prefix("-I",path["local"]))
|
cmd.append(tools.add_prefix("-I",depancy.path[type]))
|
||||||
except:
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
cmd.append(tools.add_prefix("-I",depancy.path))
|
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
@@ -67,35 +88,22 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
cmd.append(target.global_flags_cc)
|
cmd.append(target.global_flags["c"])
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
cmd.append(target.global_flags_m)
|
cmd.append(target.global_flags["m"])
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
for type in ["c", "m"]:
|
||||||
try:
|
try:
|
||||||
cmd.append(depancy.flags["c"])
|
cmd.append(depancy.flags[type])
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
for view in ["local", "export"]:
|
||||||
|
for type in ["c", "m"]:
|
||||||
try:
|
try:
|
||||||
cmd.append(depancy.flags["m"])
|
cmd.append(flags[view][type])
|
||||||
except:
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
cmd.append(flags["local"]["c"])
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
cmd.append(flags["local"]["m"])
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
cmd.append(flags["export"]["c"])
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
cmd.append(flags["export"]["m"])
|
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
cmd.append("-c -MMD -MP")
|
cmd.append("-c -MMD -MP")
|
||||||
@@ -104,11 +112,11 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
|||||||
# Create cmd line
|
# Create cmd line
|
||||||
cmdLine=tools.list_to_str(cmd)
|
cmdLine=tools.list_to_str(cmd)
|
||||||
# check the dependency for this file :
|
# check the dependency for this file :
|
||||||
if False==depend.need_re_build(file_dst, file_src, file_depend, file_cmd, cmdLine):
|
if depend.need_re_build(file_dst, file_src, file_depend, file_cmd, cmdLine) == False:
|
||||||
return file_dst
|
return {"action":"add", "file":file_dst}
|
||||||
tools.create_directory_of_file(file_dst)
|
tools.create_directory_of_file(file_dst)
|
||||||
comment = ["m", name, "<==", file]
|
comment = ["m", name, "<==", file]
|
||||||
#process element
|
#process element
|
||||||
multiprocess.run_in_pool(cmdLine, comment, file_cmd)
|
multiprocess.run_in_pool(cmdLine, comment, file_cmd, store_output_file=file_warning)
|
||||||
return file_dst
|
return {"action":"add", "file":file_dst}
|
||||||
|
|
||||||
|
@@ -1,3 +1,13 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##
|
||||||
|
## @author Edouard DUPIN
|
||||||
|
##
|
||||||
|
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||||
|
##
|
||||||
|
## @license APACHE v2.0 (see license file)
|
||||||
|
##
|
||||||
|
|
||||||
##
|
##
|
||||||
## Objective C++ builder
|
## Objective C++ builder
|
||||||
##
|
##
|
||||||
@@ -38,11 +48,23 @@ def get_input_type():
|
|||||||
def get_output_type():
|
def get_output_type():
|
||||||
return ["o"]
|
return ["o"]
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Get builder support multi-threading or not
|
||||||
|
## @return True Multithreading supported
|
||||||
|
## @return False Multithreading NOT supported
|
||||||
|
##
|
||||||
|
def get_support_multithreading():
|
||||||
|
return True
|
||||||
|
|
||||||
##
|
##
|
||||||
## @brief Commands for running gcc to compile a m++ file in object file.
|
## @brief Commands for running gcc to compile a m++ file in object file.
|
||||||
##
|
##
|
||||||
def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
def compile(file, binary, target, depancy, flags, path, name, basic_path, module_src):
|
||||||
file_src, file_dst, file_depend, file_cmd = target.file_generate_object(binary, name, basic_folder, file)
|
file_src = target.get_full_name_source(basic_path, file)
|
||||||
|
file_cmd = target.get_full_name_cmd(name, basic_path, file)
|
||||||
|
file_dst = target.get_full_name_destination(name, basic_path, file, get_output_type())
|
||||||
|
file_depend = target.get_full_dependency(name, basic_path, file)
|
||||||
|
file_warning = target.get_full_name_warning(name, basic_path, file)
|
||||||
# create the command line befor requesting start:
|
# create the command line befor requesting start:
|
||||||
cmd = [
|
cmd = [
|
||||||
target.xx,
|
target.xx,
|
||||||
@@ -50,64 +72,35 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
|||||||
target.arch,
|
target.arch,
|
||||||
target.sysroot,
|
target.sysroot,
|
||||||
target.global_include_cc]
|
target.global_include_cc]
|
||||||
|
for view in ["export", "local"]:
|
||||||
|
for type in ["c", "c++", "m", "mm"]:
|
||||||
try:
|
try:
|
||||||
cmd.append(tools.add_prefix("-I",path["export"]))
|
cmd.append(tools.add_prefix("-I",path[view][type]))
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
for type in ["c", "c++", "m", "mm"]:
|
||||||
try:
|
try:
|
||||||
cmd.append(tools.add_prefix("-I",path["local"]))
|
cmd.append(tools.add_prefix("-I",depancy.path[type]))
|
||||||
except:
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
cmd.append(tools.add_prefix("-I",depancy.path))
|
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
try:
|
try:
|
||||||
cmd.append(local_ref_on_builder_cpp.get_version_compilation_flags(flags, depancy.flags))
|
cmd.append(local_ref_on_builder_cpp.get_version_compilation_flags(flags, depancy.flags))
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
for type in ["c", "c++", "m", "mm"]:
|
||||||
try:
|
try:
|
||||||
cmd.append(target.global_flags_cc)
|
cmd.append(target.global_flags[type])
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
for type in ["c", "c++", "m", "mm"]:
|
||||||
try:
|
try:
|
||||||
cmd.append(target.global_flags_mm)
|
cmd.append(depancy.flags[type])
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
for view in ["export", "local"]:
|
||||||
|
for type in ["c", "c++", "m", "mm"]:
|
||||||
try:
|
try:
|
||||||
cmd.append(depancy.flags["c"])
|
cmd.append(flags[view][type])
|
||||||
except:
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
cmd.append(depancy.flags["c++"])
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
cmd.append(depancy.flags["mm"])
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
cmd.append(flags["local"]["c"])
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
cmd.append(flags["local"]["c++"])
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
cmd.append(flags["local"]["mm"])
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
cmd.append(flags["export"]["c"])
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
cmd.append(flags["export"]["c++"])
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
try:
|
|
||||||
cmd.append(flags["export"]["mm"])
|
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
cmd.append("-c -MMD -MP")
|
cmd.append("-c -MMD -MP")
|
||||||
@@ -117,9 +110,9 @@ def compile(file, binary, target, depancy, flags, path, name, basic_folder):
|
|||||||
cmdLine=tools.list_to_str(cmd)
|
cmdLine=tools.list_to_str(cmd)
|
||||||
# check the dependency for this file :
|
# check the dependency for this file :
|
||||||
if False==depend.need_re_build(file_dst, file_src, file_depend, file_cmd, cmdLine):
|
if False==depend.need_re_build(file_dst, file_src, file_depend, file_cmd, cmdLine):
|
||||||
return file_dst
|
return {"action":"add", "file":file_dst}
|
||||||
tools.create_directory_of_file(file_dst)
|
tools.create_directory_of_file(file_dst)
|
||||||
comment = ["m++", name, "<==", file]
|
comment = ["m++", name, "<==", file]
|
||||||
#process element
|
#process element
|
||||||
multiprocess.run_in_pool(cmdLine, comment, file_cmd)
|
multiprocess.run_in_pool(cmdLine, comment, file_cmd, store_output_file=file_warning)
|
||||||
return file_dst
|
return {"action":"add", "file":file_dst}
|
||||||
|
@@ -1,3 +1,13 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##
|
||||||
|
## @author Edouard DUPIN
|
||||||
|
##
|
||||||
|
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||||
|
##
|
||||||
|
## @license APACHE v2.0 (see license file)
|
||||||
|
##
|
||||||
|
|
||||||
##
|
##
|
||||||
## ASM builder
|
## ASM builder
|
||||||
##
|
##
|
||||||
@@ -31,3 +41,11 @@ def get_input_type():
|
|||||||
##
|
##
|
||||||
def get_output_type():
|
def get_output_type():
|
||||||
return ["o"]
|
return ["o"]
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Get builder support multi-threading or not
|
||||||
|
## @return True Multithreading supported
|
||||||
|
## @return False Multithreading NOT supported
|
||||||
|
##
|
||||||
|
def get_support_multithreading():
|
||||||
|
return True
|
||||||
|
@@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##
|
||||||
|
## @author Edouard DUPIN
|
||||||
|
##
|
||||||
|
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||||
|
##
|
||||||
|
## @license APACHE v2.0 (see license file)
|
||||||
|
##
|
||||||
|
116
lutin/z_system/lutinSystem_Android_ADMOD.py
Normal file
116
lutin/z_system/lutinSystem_Android_ADMOD.py
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##
|
||||||
|
## @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="ADMOD: Android SDK ad-mod interface (auto-create interface for admod)\n"
|
||||||
|
# todo : Check if present ...
|
||||||
|
self.valid = True
|
||||||
|
# todo : create a searcher of the presence of the library:
|
||||||
|
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)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##################################################################
|
||||||
|
##
|
||||||
|
## Android specific section
|
||||||
|
##
|
||||||
|
##################################################################
|
||||||
|
def tool_generate_main_java_class(target, module, package_name):
|
||||||
|
if "ADMOD_ID" not in module.package_prop:
|
||||||
|
debug.warning("Missing parameter ADMOD_ID wen you resuested dependency of ADMOD")
|
||||||
|
return
|
||||||
|
|
||||||
|
module.package_prop["RIGHT"].append("INTERNET")
|
||||||
|
module.package_prop["RIGHT"].append("ACCESS_NETWORK_STATE")
|
||||||
|
|
||||||
|
module.pkg_add("GENERATE_SECTION__IMPORT", [
|
||||||
|
"import com.google.android.gms.ads.AdRequest;",
|
||||||
|
"import com.google.android.gms.ads.AdSize;",
|
||||||
|
"import com.google.android.gms.ads.AdView;",
|
||||||
|
"import android.widget.LinearLayout;",
|
||||||
|
"import android.widget.Button;"
|
||||||
|
])
|
||||||
|
module.pkg_add("GENERATE_SECTION__DECLARE", [
|
||||||
|
"/** The view to show the ad. */",
|
||||||
|
"private AdView adView;",
|
||||||
|
"private LinearLayout mLayout = null;"
|
||||||
|
])
|
||||||
|
list_create = [
|
||||||
|
"mLayout = new LinearLayout(this);"
|
||||||
|
"mLayout.setOrientation(android.widget.LinearLayout.VERTICAL);",
|
||||||
|
"LinearLayout.LayoutParams paramsWindows = new LinearLayout.LayoutParams(",
|
||||||
|
" LinearLayout.LayoutParams.FILL_PARENT,",
|
||||||
|
" LinearLayout.LayoutParams.FILL_PARENT);",
|
||||||
|
"",
|
||||||
|
"setContentView(mLayout, paramsWindows);",
|
||||||
|
"",
|
||||||
|
"LinearLayout.LayoutParams paramsAdds = new LinearLayout.LayoutParams(",
|
||||||
|
" LinearLayout.LayoutParams.FILL_PARENT,",
|
||||||
|
" LinearLayout.LayoutParams.WRAP_CONTENT);",
|
||||||
|
"paramsAdds.weight = 0;",
|
||||||
|
"",
|
||||||
|
"LinearLayout.LayoutParams paramsGLView = new LinearLayout.LayoutParams(",
|
||||||
|
" LinearLayout.LayoutParams.FILL_PARENT,",
|
||||||
|
" LinearLayout.LayoutParams.FILL_PARENT);",
|
||||||
|
"paramsGLView.weight = 1;",
|
||||||
|
"paramsGLView.height = 0;",
|
||||||
|
"",
|
||||||
|
"mLayout.setGravity(android.view.Gravity.TOP);",
|
||||||
|
"",
|
||||||
|
"// Create an adds.",
|
||||||
|
"adView = new AdView(this);",
|
||||||
|
"adView.setAdSize(AdSize.SMART_BANNER);",
|
||||||
|
"adView.setAdUnitId(\"" + module.package_prop["ADMOD_ID"] + "\");",
|
||||||
|
"",
|
||||||
|
"// Create an ad request. Check logcat output for the hashed device ID to get test ads on a physical device.",
|
||||||
|
"AdRequest adRequest = new AdRequest.Builder()",
|
||||||
|
" .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)",
|
||||||
|
" .build();",
|
||||||
|
"",
|
||||||
|
"// Add the AdView to the view hierarchy. The view will have no size until the ad is loaded."]
|
||||||
|
if "ADMOD_POSITION" in module.package_prop \
|
||||||
|
and module.package_prop["ADMOD_POSITION"] == "top":
|
||||||
|
list_create.append("mLayout.addView(adView, paramsAdds);")
|
||||||
|
list_create.append("mLayout.addView(mGLView, paramsGLView);")
|
||||||
|
else:
|
||||||
|
list_create.append("mLayout.addView(mGLView, paramsGLView);")
|
||||||
|
list_create.append("mLayout.addView(adView, paramsAdds);")
|
||||||
|
list_create.append("")
|
||||||
|
list_create.append("// Start loading the ad in the background.")
|
||||||
|
list_create.append("adView.loadAd(adRequest);")
|
||||||
|
module.pkg_add("GENERATE_SECTION__ON_CREATE", list_create)
|
||||||
|
module.pkg_add("GENERATE_SECTION__ON_RESUME", [
|
||||||
|
"if (adView != null) {",
|
||||||
|
" adView.resume();",
|
||||||
|
"}"
|
||||||
|
])
|
||||||
|
module.pkg_add("GENERATE_SECTION__ON_PAUSE", [
|
||||||
|
"if (adView != null) {",
|
||||||
|
" adView.pause();",
|
||||||
|
"}"
|
||||||
|
])
|
||||||
|
module.pkg_add("GENERATE_SECTION__ON_DESTROY", [
|
||||||
|
"// Destroy the AdView.",
|
||||||
|
"if (adView != null) {",
|
||||||
|
" adView.destroy();",
|
||||||
|
"}"
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|
31
lutin/z_system/lutinSystem_Android_SDK.py
Normal file
31
lutin/z_system/lutinSystem_Android_SDK.py
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##
|
||||||
|
## @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="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_sources(jar_file_path)
|
||||||
|
self.add_export_flag("link-lib", "dl")
|
||||||
|
self.add_export_flag("link-lib", "log")
|
||||||
|
self.add_export_flag("link-lib", "android")
|
||||||
|
|
||||||
|
|
76
lutin/z_system/lutinSystem_Android_cxx.py
Normal file
76
lutin/z_system/lutinSystem_Android_cxx.py
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##
|
||||||
|
## @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")
|
||||||
|
self.add_export_flag("need-libstdc++", True)
|
||||||
|
# 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")
|
26
lutin/z_system/lutinSystem_Android_m.py
Normal file
26
lutin/z_system/lutinSystem_Android_m.py
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##
|
||||||
|
## @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="M : m library \n base of std libs (availlagle in GNU C lib and bionic"
|
||||||
|
# No check ==> on the basic std libs:
|
||||||
|
self.valid = True
|
||||||
|
# todo : create a searcher of the presence of the library:
|
||||||
|
self.add_export_flag("link-lib", "m")
|
||||||
|
|
||||||
|
|
28
lutin/z_system/lutinSystem_Android_z.py
Normal file
28
lutin/z_system/lutinSystem_Android_z.py
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
#!/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="Z : z library \n Can be install with the package:\n - zlib1g-dev"
|
||||||
|
# check if the library exist:
|
||||||
|
if not os.path.isfile("/usr/include/zlib.h"):
|
||||||
|
# we did not find the library reqiested (just return) (automaticly set at false)
|
||||||
|
return;
|
||||||
|
self.valid = True
|
||||||
|
# todo : create a searcher of the presence of the library:
|
||||||
|
self.add_export_flag("link-lib", "z")
|
||||||
|
|
||||||
|
|
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
@@ -13,13 +14,13 @@ from lutin import tools
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
class System(system.System):
|
class System(system.System):
|
||||||
def __init__(self):
|
def __init__(self, target):
|
||||||
system.System.__init__(self)
|
system.System.__init__(self)
|
||||||
# create some HELP:
|
# create some HELP:
|
||||||
self.help="CoreAudio : Ios interface for audio (all time present, just system interface)"
|
self.help="CoreAudio : Ios interface for audio (all time present, just system interface)"
|
||||||
self.valid = True
|
self.valid = True
|
||||||
# todo : create a searcher of the presence of the library:
|
# todo : create a searcher of the presence of the library:
|
||||||
self.add_export_flag_LD("-framework CoreAudio")
|
self.add_export_flag("link", "-framework CoreAudio")
|
||||||
self.add_export_flag_LD("-framework AudioToolbox")
|
self.add_export_flag("link", "-framework AudioToolbox")
|
||||||
|
|
||||||
|
|
||||||
|
27
lutin/z_system/lutinSystem_IOs_cxx.py
Normal file
27
lutin/z_system/lutinSystem_IOs_cxx.py
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##
|
||||||
|
## @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")
|
||||||
|
self.add_export_flag("need-libstdc++", True)
|
||||||
|
|
||||||
|
|
26
lutin/z_system/lutinSystem_IOs_m.py
Normal file
26
lutin/z_system/lutinSystem_IOs_m.py
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##
|
||||||
|
## @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="M : m library \n base of std libs (availlagle in GNU C lib and bionic"
|
||||||
|
# No check ==> on the basic std libs:
|
||||||
|
self.valid = True
|
||||||
|
# todo : create a searcher of the presence of the library:
|
||||||
|
self.add_export_flag("link-lib", "m")
|
||||||
|
|
||||||
|
|
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
@@ -13,7 +14,7 @@ from lutin import tools
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
class System(system.System):
|
class System(system.System):
|
||||||
def __init__(self):
|
def __init__(self, target):
|
||||||
system.System.__init__(self)
|
system.System.__init__(self)
|
||||||
# create some HELP:
|
# create some HELP:
|
||||||
self.help="ALSA : Advanced Linux Sound Architecture\n Can be install with the package:\n - libasound2-dev"
|
self.help="ALSA : Advanced Linux Sound Architecture\n Can be install with the package:\n - libasound2-dev"
|
||||||
@@ -24,6 +25,6 @@ class System(system.System):
|
|||||||
return;
|
return;
|
||||||
self.valid = True
|
self.valid = True
|
||||||
# todo : create a searcher of the presence of the library:
|
# todo : create a searcher of the presence of the library:
|
||||||
self.add_export_flag_LD("-lasound")
|
self.add_export_flag("link-lib", "asound")
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
@@ -13,7 +14,7 @@ from lutin import tools
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
class System(system.System):
|
class System(system.System):
|
||||||
def __init__(self):
|
def __init__(self, target):
|
||||||
system.System.__init__(self)
|
system.System.__init__(self)
|
||||||
# create some HELP:
|
# create some HELP:
|
||||||
self.help="BOOST : Boost interface (need when we have not all c++ feature\n Can be install with the package:\n - libboost-all-dev"
|
self.help="BOOST : Boost interface (need when we have not all c++ feature\n Can be install with the package:\n - libboost-all-dev"
|
||||||
@@ -23,10 +24,10 @@ class System(system.System):
|
|||||||
return;
|
return;
|
||||||
self.valid = True
|
self.valid = True
|
||||||
# todo : create a searcher of the presence of the library:
|
# todo : create a searcher of the presence of the library:
|
||||||
self.add_export_flag_LD([
|
self.add_export_flag("link-lib", [
|
||||||
"-lboost_system",
|
"boost_system",
|
||||||
"-lboost_thread",
|
"boost_thread",
|
||||||
"-lboost_chrono"
|
"boost_chrono"
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
27
lutin/z_system/lutinSystem_Linux_cxx.py
Normal file
27
lutin/z_system/lutinSystem_Linux_cxx.py
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##
|
||||||
|
## @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")
|
||||||
|
self.add_export_flag("need-libstdc++", True)
|
||||||
|
|
||||||
|
|
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
@@ -13,7 +14,7 @@ from lutin import tools
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
class System(system.System):
|
class System(system.System):
|
||||||
def __init__(self):
|
def __init__(self, target):
|
||||||
system.System.__init__(self)
|
system.System.__init__(self)
|
||||||
# create some HELP:
|
# create some HELP:
|
||||||
self.help="JACK : Jack Low-Latency Audio Server\n Can be install with the package:\n - libjack-jackd2-dev (new)\n - libjack-dev (old)"
|
self.help="JACK : Jack Low-Latency Audio Server\n Can be install with the package:\n - libjack-jackd2-dev (new)\n - libjack-dev (old)"
|
||||||
@@ -23,6 +24,6 @@ class System(system.System):
|
|||||||
return;
|
return;
|
||||||
self.valid = True
|
self.valid = True
|
||||||
# todo : create a searcher of the presence of the library:
|
# todo : create a searcher of the presence of the library:
|
||||||
self.add_export_flag_LD("-ljack")
|
self.add_export_flag("link-lib", "jack")
|
||||||
|
|
||||||
|
|
||||||
|
26
lutin/z_system/lutinSystem_Linux_m.py
Normal file
26
lutin/z_system/lutinSystem_Linux_m.py
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##
|
||||||
|
## @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="M : m library \n base of std libs (availlagle in GNU C lib and bionic"
|
||||||
|
# No check ==> on the basic std libs:
|
||||||
|
self.valid = True
|
||||||
|
# todo : create a searcher of the presence of the library:
|
||||||
|
self.add_export_flag("link-lib", "m")
|
||||||
|
|
||||||
|
|
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
@@ -13,7 +14,7 @@ from lutin import tools
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
class System(system.System):
|
class System(system.System):
|
||||||
def __init__(self):
|
def __init__(self, target):
|
||||||
system.System.__init__(self)
|
system.System.__init__(self)
|
||||||
# create some HELP:
|
# create some HELP:
|
||||||
self.help="OSS : Linux Open Sound System\n Can be install with the package:\n - ... TODO ..."
|
self.help="OSS : Linux Open Sound System\n Can be install with the package:\n - ... TODO ..."
|
||||||
@@ -24,7 +25,7 @@ class System(system.System):
|
|||||||
return;
|
return;
|
||||||
self.valid = True
|
self.valid = True
|
||||||
# todo : create a searcher of the presence of the library:
|
# todo : create a searcher of the presence of the library:
|
||||||
self.add_export_flag_CC("-ljack")
|
self.add_export_flag("link-lib", "oss")
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
@@ -13,7 +14,7 @@ from lutin import tools
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
class System(system.System):
|
class System(system.System):
|
||||||
def __init__(self):
|
def __init__(self, target):
|
||||||
system.System.__init__(self)
|
system.System.__init__(self)
|
||||||
# create some HELP:
|
# create some HELP:
|
||||||
self.help="PULSE : The Linux PulseAudio\n Can be install with the package:\n - libpulse-dev"
|
self.help="PULSE : The Linux PulseAudio\n Can be install with the package:\n - libpulse-dev"
|
||||||
@@ -23,6 +24,6 @@ class System(system.System):
|
|||||||
return;
|
return;
|
||||||
self.valid = True
|
self.valid = True
|
||||||
# todo : create a searcher of the presence of the library:
|
# todo : create a searcher of the presence of the library:
|
||||||
self.add_export_flag_LD(["-lpulse-simple", "-lpulse"])
|
self.add_export_flag("link-lib", ["pulse-simple", "pulse"])
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
@@ -13,7 +14,7 @@ from lutin import tools
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
class System(system.System):
|
class System(system.System):
|
||||||
def __init__(self):
|
def __init__(self, target):
|
||||||
system.System.__init__(self)
|
system.System.__init__(self)
|
||||||
# create some HELP:
|
# create some HELP:
|
||||||
self.help="Z : z library \n Can be install with the package:\n - zlib1g-dev"
|
self.help="Z : z library \n Can be install with the package:\n - zlib1g-dev"
|
||||||
@@ -23,6 +24,6 @@ class System(system.System):
|
|||||||
return;
|
return;
|
||||||
self.valid = True
|
self.valid = True
|
||||||
# todo : create a searcher of the presence of the library:
|
# todo : create a searcher of the presence of the library:
|
||||||
self.add_export_flag_LD(["-lz"])
|
self.add_export_flag("link-lib", "z")
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
@@ -13,12 +14,12 @@ from lutin import tools
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
class System(system.System):
|
class System(system.System):
|
||||||
def __init__(self):
|
def __init__(self, target):
|
||||||
system.System.__init__(self)
|
system.System.__init__(self)
|
||||||
# create some HELP:
|
# create some HELP:
|
||||||
self.help="CoreAudio : MacOs interface for audio (all time present, just system interface)"
|
self.help="CoreAudio : MacOs interface for audio (all time present, just system interface)"
|
||||||
self.valid = True
|
self.valid = True
|
||||||
# todo : create a searcher of the presence of the library:
|
# todo : create a searcher of the presence of the library:
|
||||||
self.add_export_flag_LD("-framework CoreAudio")
|
self.add_export_flag("link", "-framework CoreAudio")
|
||||||
self.add_export_flag_LD("-framework CoreFoundation")
|
self.add_export_flag("link", "-framework CoreFoundation")
|
||||||
|
|
||||||
|
27
lutin/z_system/lutinSystem_MacOs_cxx.py
Normal file
27
lutin/z_system/lutinSystem_MacOs_cxx.py
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##
|
||||||
|
## @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")
|
||||||
|
self.add_export_flag("need-libstdc++", True)
|
||||||
|
|
||||||
|
|
26
lutin/z_system/lutinSystem_MacOs_m.py
Normal file
26
lutin/z_system/lutinSystem_MacOs_m.py
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##
|
||||||
|
## @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="M : m library \n base of std libs (availlagle in GNU C lib and bionic"
|
||||||
|
# No check ==> on the basic std libs:
|
||||||
|
self.valid = True
|
||||||
|
# todo : create a searcher of the presence of the library:
|
||||||
|
self.add_export_flag("link-lib", "m")
|
||||||
|
|
||||||
|
|
@@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##
|
||||||
|
## @author Edouard DUPIN
|
||||||
|
##
|
||||||
|
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||||
|
##
|
||||||
|
## @license APACHE v2.0 (see license file)
|
||||||
|
##
|
||||||
|
33
lutin/z_system/lutinSystem_Windows_cxx.py
Normal file
33
lutin/z_system/lutinSystem_Windows_cxx.py
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##
|
||||||
|
## @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"
|
||||||
|
])
|
||||||
|
self.add_export_flag("need-libstdc++", True)
|
||||||
|
|
||||||
|
|
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
@@ -13,7 +14,7 @@ from lutin import tools
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
class System(system.System):
|
class System(system.System):
|
||||||
def __init__(self):
|
def __init__(self, target):
|
||||||
system.System.__init__(self)
|
system.System.__init__(self)
|
||||||
# create some HELP:
|
# create some HELP:
|
||||||
self.help="DirectSound : Direct sound API for windows audio interface"
|
self.help="DirectSound : Direct sound API for windows audio interface"
|
||||||
@@ -23,9 +24,10 @@ class System(system.System):
|
|||||||
return;
|
return;
|
||||||
self.valid = True
|
self.valid = True
|
||||||
# todo : create a searcher of the presence of the library:
|
# todo : create a searcher of the presence of the library:
|
||||||
self.add_export_flag_LD(["-ldsound",
|
self.add_export_flag("link-lib",[
|
||||||
"-lwinmm",
|
"dsound",
|
||||||
"-lole32"
|
"winmm",
|
||||||
|
"ole32"
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
26
lutin/z_system/lutinSystem_Windows_m.py
Normal file
26
lutin/z_system/lutinSystem_Windows_m.py
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##
|
||||||
|
## @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="M : m library \n base of std libs (availlagle in GNU C lib and bionic"
|
||||||
|
# No check ==> on the basic std libs:
|
||||||
|
self.valid = True
|
||||||
|
# todo : create a searcher of the presence of the library:
|
||||||
|
self.add_export_flag("link-lib", "m")
|
||||||
|
|
||||||
|
|
@@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##
|
||||||
|
## @author Edouard DUPIN
|
||||||
|
##
|
||||||
|
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||||
|
##
|
||||||
|
## @license APACHE v2.0 (see license file)
|
||||||
|
##
|
||||||
|
File diff suppressed because it is too large
Load Diff
200
lutin/z_target/lutinTarget_Debian.py
Normal file
200
lutin/z_target/lutinTarget_Debian.py
Normal file
@@ -0,0 +1,200 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##
|
||||||
|
## @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)
|
||||||
|
|
||||||
|
|
||||||
|
|
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
@@ -45,24 +46,25 @@ class Target(target.Target):
|
|||||||
|
|
||||||
# remove unneeded ranlib ...
|
# remove unneeded ranlib ...
|
||||||
self.ranlib=""
|
self.ranlib=""
|
||||||
self.folder_bin=""
|
#self.path_bin=""
|
||||||
self.folder_data="/share"
|
#self.path_data="share"
|
||||||
self.folder_doc="/doc"
|
#self.path_doc="doc"
|
||||||
|
|
||||||
self.suffix_lib_static='.a'
|
self.suffix_lib_static='.a'
|
||||||
self.suffix_lib_dynamic='.dylib'
|
self.suffix_lib_dynamic='.dylib'
|
||||||
self.suffix_binary=''
|
#self.suffix_binary=''
|
||||||
self.suffix_package=''
|
#self.suffix_package=''
|
||||||
if self.sumulator == True:
|
|
||||||
self.sysroot = "-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.3.sdk"
|
|
||||||
self.global_flags_ld.append("-mios-simulator-version-min=8.0")
|
|
||||||
self.global_flags_cc.append("-mios-simulator-version-min=8.0")
|
|
||||||
else:
|
|
||||||
self.sysroot = "-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk"
|
|
||||||
self.global_flags_ld.append("-miphoneos-version-min=8.0")
|
|
||||||
self.global_flags_cc.append("-miphoneos-version-min=8.0")
|
|
||||||
|
|
||||||
self.global_flags_ld.append([
|
if self.sumulator == True:
|
||||||
|
self.sysroot = "-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk"
|
||||||
|
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.add_flag("link", "-miphoneos-version-min=8.0")
|
||||||
|
self.add_flag("c", "-miphoneos-version-min=8.0")
|
||||||
|
|
||||||
|
self.add_flag("link", [
|
||||||
"-Xlinker",
|
"-Xlinker",
|
||||||
"-objc_abi_version",
|
"-objc_abi_version",
|
||||||
"-Xlinker 2",
|
"-Xlinker 2",
|
||||||
@@ -70,163 +72,178 @@ class Target(target.Target):
|
|||||||
"-no_implicit_dylibs",
|
"-no_implicit_dylibs",
|
||||||
"-stdlib=libc++",
|
"-stdlib=libc++",
|
||||||
"-fobjc-arc",
|
"-fobjc-arc",
|
||||||
"-fobjc-link-runtime"])
|
"-fobjc-link-runtime"
|
||||||
|
])
|
||||||
|
|
||||||
self.global_flags_m.append("-fobjc-arc")
|
self.add_flag("m", ["-fobjc-arc"])
|
||||||
#self.global_flags_m.append("-fmodules")
|
#self.add_flag("m", ["-fmodules"])
|
||||||
|
|
||||||
def get_staging_folder(self, binaryName):
|
self.pkg_path_data = "share"
|
||||||
return tools.get_run_folder() + self.folder_out + self.folder_staging + "/" + binaryName + ".app/"
|
self.pkg_path_bin = ""
|
||||||
|
self.pkg_path_lib = "lib"
|
||||||
|
self.pkg_path_license = "license"
|
||||||
|
|
||||||
def get_staging_folder_data(self, binaryName):
|
# Disable capabiliteis to compile in shared mode
|
||||||
return self.get_staging_folder(binaryName) + self.folder_data + "/"
|
self.support_dynamic_link = False
|
||||||
|
|
||||||
def make_package(self, pkgName, pkgProperties, basePkgPath):
|
def make_package_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static):
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
debug.info("Generate package '" + pkgName + "'")
|
debug.info("Generate package '" + pkg_name + "' v" + tools.version_to_string(pkg_properties["VERSION"]))
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
|
#output path
|
||||||
|
target_outpath = os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app")
|
||||||
|
tools.create_directory_of_file(target_outpath)
|
||||||
|
|
||||||
if "ICON" in pkgProperties.keys() \
|
## Create share datas:
|
||||||
and pkgProperties["ICON"] != "":
|
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 icon:
|
||||||
|
if "ICON" in pkg_properties.keys() \
|
||||||
|
and pkg_properties["ICON"] != "":
|
||||||
# Resize all icon needed for Ios ...
|
# Resize all icon needed for Ios ...
|
||||||
# TODO : Do not regenerate if source resource is not availlable
|
# TODO : Do not regenerate if source resource is not availlable
|
||||||
# TODO : Add a colored background ...
|
# TODO : Add a colored background ...
|
||||||
debug.print_element("pkg", "iTunesArtwork.png", "<==", pkgProperties["ICON"])
|
debug.print_element("pkg", os.path.relpath(pkg_properties["ICON"]), "==>", "iTunesArtwork.png")
|
||||||
image.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/iTunesArtwork.png", 512, 512)
|
image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "iTunesArtwork.png"), 512, 512)
|
||||||
debug.print_element("pkg", "iTunesArtwork@2x.png", "<==", pkgProperties["ICON"])
|
debug.print_element("pkg", os.path.relpath(pkg_properties["ICON"]), "==>", "iTunesArtwork@2x.png")
|
||||||
image.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/iTunesArtwork@2x.png", 1024, 1024)
|
image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "iTunesArtwork@2x.png"), 1024, 1024)
|
||||||
debug.print_element("pkg", "Icon-60@2x.png", "<==", pkgProperties["ICON"])
|
debug.print_element("pkg", os.path.relpath(pkg_properties["ICON"]), "==>", "Icon-60@2x.png")
|
||||||
image.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/Icon-60@2x.png", 120, 120)
|
image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "Icon-60@2x.png"), 120, 120)
|
||||||
debug.print_element("pkg", "Icon-76.png", "<==", pkgProperties["ICON"])
|
debug.print_element("pkg", os.path.relpath(pkg_properties["ICON"]), "==>", "Icon-76.png")
|
||||||
image.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/Icon-76.png", 76, 76)
|
image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "Icon-76.png"), 76, 76)
|
||||||
debug.print_element("pkg", "Icon-76@2x.png", "<==", pkgProperties["ICON"])
|
debug.print_element("pkg", os.path.relpath(pkg_properties["ICON"]), "==>", "Icon-76@2x.png")
|
||||||
image.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/Icon-76@2x.png", 152, 152)
|
image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "Icon-76@2x.png"), 152, 152)
|
||||||
debug.print_element("pkg", "Icon-Small-40.png", "<==", pkgProperties["ICON"])
|
debug.print_element("pkg", os.path.relpath(pkg_properties["ICON"]), "==>", "Icon-Small-40.png")
|
||||||
image.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/Icon-Small-40.png", 40, 40)
|
image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "Icon-Small-40.png"), 40, 40)
|
||||||
debug.print_element("pkg", "Icon-Small-40@2x.png", "<==", pkgProperties["ICON"])
|
debug.print_element("pkg", os.path.relpath(pkg_properties["ICON"]), "==>", "Icon-Small-40@2x.png")
|
||||||
image.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/Icon-Small-40@2x.png", 80, 80)
|
image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "Icon-Small-40@2x.png"), 80, 80)
|
||||||
debug.print_element("pkg", "Icon-Small.png", "<==", pkgProperties["ICON"])
|
debug.print_element("pkg", os.path.relpath(pkg_properties["ICON"]), "==>", "Icon-Small.png")
|
||||||
image.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/Icon-Small.png", 29, 29)
|
image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "Icon-Small.png"), 29, 29)
|
||||||
debug.print_element("pkg", "Icon-Small@2x.png", "<==", pkgProperties["ICON"])
|
debug.print_element("pkg", os.path.relpath(pkg_properties["ICON"]), "==>", "Icon-Small@2x.png")
|
||||||
image.resize(pkgProperties["ICON"], self.get_staging_folder(pkgName) + "/Icon-Small@2x.png", 58, 58)
|
image.resize(pkg_properties["ICON"], os.path.join(target_outpath, "Icon-Small@2x.png"), 58, 58)
|
||||||
|
|
||||||
|
## Create the info file:
|
||||||
debug.print_element("pkg", "PkgInfo", "<==", "APPL????")
|
debug.print_element("pkg", "PkgInfo", "<==", "APPL????")
|
||||||
infoFile = self.get_staging_folder(pkgName) + "/PkgInfo"
|
tools.file_write_data(os.path.join(target_outpath, "PkgInfo"),
|
||||||
# Create the info file
|
"APPL????",
|
||||||
tmpFile = open(infoFile, 'w')
|
only_if_new=True)
|
||||||
tmpFile.write("APPL????")
|
|
||||||
tmpFile.flush()
|
|
||||||
tmpFile.close()
|
|
||||||
|
|
||||||
|
## Create Info.plist (in XML mode)
|
||||||
debug.print_element("pkg", "Info.plist", "<==", "Package properties")
|
debug.print_element("pkg", "Info.plist", "<==", "Package properties")
|
||||||
# http://www.sandroid.org/imcross/#Deployment
|
# http://www.sandroid.org/imcross/#Deployment
|
||||||
dataFile = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
data_file = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||||
dataFile += "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
|
data_file += "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
|
||||||
dataFile += "<plist version=\"1.0\">\n"
|
data_file += "<plist version=\"1.0\">\n"
|
||||||
dataFile += " <dict>\n"
|
data_file += " <dict>\n"
|
||||||
dataFile += " <key>CFBundleDevelopmentRegion</key>\n"
|
data_file += " <key>CFBundleDevelopmentRegion</key>\n"
|
||||||
dataFile += " <string>en</string>\n"
|
data_file += " <string>en</string>\n"
|
||||||
dataFile += " <key>CFBundleDisplayName</key>\n"
|
data_file += " <key>CFBundleDisplayName</key>\n"
|
||||||
dataFile += " <string>" + pkgProperties["NAME"] + "</string>\n"
|
data_file += " <string>" + pkg_properties["NAME"] + "</string>\n"
|
||||||
dataFile += " <key>CFBundleExecutable</key>\n"
|
data_file += " <key>CFBundleExecutable</key>\n"
|
||||||
dataFile += " <string>" + pkgName + "</string>\n"
|
data_file += " <string>" + pkg_name + "</string>\n"
|
||||||
dataFile += " <key>CFBundleIdentifier</key>\n"
|
data_file += " <key>CFBundleIdentifier</key>\n"
|
||||||
dataFile += " <string>com." + pkgProperties["COMPAGNY_NAME2"] + "." + pkgName + "</string>\n"
|
data_file += " <string>com." + pkg_properties["COMPAGNY_NAME2"] + "." + pkg_name + "</string>\n"
|
||||||
|
|
||||||
dataFile += " <key>CFBundleIconFiles</key>\n"
|
data_file += " <key>CFBundleIconFiles</key>\n"
|
||||||
dataFile += " <array>\n"
|
data_file += " <array>\n"
|
||||||
dataFile += " <string>Icon-60@2x.png</string>\n"
|
data_file += " <string>Icon-60@2x.png</string>\n"
|
||||||
dataFile += " <string>Icon-76.png</string>\n"
|
data_file += " <string>Icon-76.png</string>\n"
|
||||||
dataFile += " <string>Icon-76@2x.png</string>\n"
|
data_file += " <string>Icon-76@2x.png</string>\n"
|
||||||
dataFile += " <string>Icon-Small-40.png</string>\n"
|
data_file += " <string>Icon-Small-40.png</string>\n"
|
||||||
dataFile += " <string>Icon-Small-40@2x.png</string>\n"
|
data_file += " <string>Icon-Small-40@2x.png</string>\n"
|
||||||
dataFile += " <string>Icon-Small.png</string>\n"
|
data_file += " <string>Icon-Small.png</string>\n"
|
||||||
dataFile += " <string>Icon-Small@2x.png</string>\n"
|
data_file += " <string>Icon-Small@2x.png</string>\n"
|
||||||
dataFile += " <string>iTunesArtwork.png</string>\n"
|
data_file += " <string>iTunesArtwork.png</string>\n"
|
||||||
dataFile += " <string>iTunesArtwork@2x.png</string>\n"
|
data_file += " <string>iTunesArtwork@2x.png</string>\n"
|
||||||
dataFile += " </array>\n"
|
data_file += " </array>\n"
|
||||||
|
|
||||||
dataFile += " <key>CFBundleInfoDictionaryVersion</key>\n"
|
data_file += " <key>CFBundleInfoDictionaryVersion</key>\n"
|
||||||
dataFile += " <string>6.0</string>\n"
|
data_file += " <string>6.0</string>\n"
|
||||||
dataFile += " <key>CFBundleName</key>\n"
|
data_file += " <key>CFBundleName</key>\n"
|
||||||
dataFile += " <string>" + pkgName + "</string>\n"
|
data_file += " <string>" + pkg_name + "</string>\n"
|
||||||
dataFile += " <key>CFBundlePackageType</key>\n"
|
data_file += " <key>CFBundlePackageType</key>\n"
|
||||||
dataFile += " <string>APPL</string>\n"
|
data_file += " <string>APPL</string>\n"
|
||||||
dataFile += " <key>CFBundleSignature</key>\n"
|
data_file += " <key>CFBundleSignature</key>\n"
|
||||||
dataFile += " <string>????</string>\n"
|
data_file += " <string>????</string>\n"
|
||||||
dataFile += " <key>CFBundleSupportedPlatforms</key>\n"
|
data_file += " <key>CFBundleSupportedPlatforms</key>\n"
|
||||||
dataFile += " <array>\n"
|
data_file += " <array>\n"
|
||||||
dataFile += " <string>iPhoneSimulator</string>\n"
|
data_file += " <string>iPhoneSimulator</string>\n"
|
||||||
dataFile += " </array>\n"
|
data_file += " </array>\n"
|
||||||
dataFile += " \n"
|
data_file += " \n"
|
||||||
dataFile += " <key>CFBundleShortVersionString</key>\n"
|
data_file += " <key>CFBundleShortVersionString</key>\n"
|
||||||
dataFile += " <string>"+pkgProperties["VERSION"]+"</string>\n"
|
data_file += " <string>"+tools.version_to_string(pkg_properties["VERSION"])+"</string>\n"
|
||||||
dataFile += " <key>CFBundleVersion</key>\n"
|
data_file += " <key>CFBundleVersion</key>\n"
|
||||||
dataFile += " <string>"+pkgProperties["VERSION_CODE"]+"</string>\n"
|
data_file += " <string>"+str(pkg_properties["VERSION_CODE"])+"</string>\n"
|
||||||
dataFile += " \n"
|
data_file += " \n"
|
||||||
dataFile += " <key>CFBundleResourceSpecification</key>\n"
|
data_file += " <key>CFBundleResourceSpecification</key>\n"
|
||||||
dataFile += " <string>ResourceRules.plist</string>\n"
|
data_file += " <string>ResourceRules.plist</string>\n"
|
||||||
if self.sumulator == False:
|
if self.sumulator == False:
|
||||||
dataFile += " <key>LSRequiresIPhoneOS</key>\n"
|
data_file += " <key>LSRequiresIPhoneOS</key>\n"
|
||||||
dataFile += " <true/>\n"
|
data_file += " <true/>\n"
|
||||||
else:
|
else:
|
||||||
dataFile += " <key>DTPlatformName</key>\n"
|
data_file += " <key>DTPlatformName</key>\n"
|
||||||
dataFile += " <string>iphonesimulator</string>\n"
|
data_file += " <string>iphonesimulator</string>\n"
|
||||||
dataFile += " <key>DTSDKName</key>\n"
|
data_file += " <key>DTSDKName</key>\n"
|
||||||
dataFile += " <string>iphonesimulator7.0</string>\n"
|
data_file += " <string>iphonesimulator7.0</string>\n"
|
||||||
dataFile += " \n"
|
data_file += " \n"
|
||||||
dataFile += " <key>UIDeviceFamily</key>\n"
|
data_file += " <key>UIDeviceFamily</key>\n"
|
||||||
dataFile += " <array>\n"
|
data_file += " <array>\n"
|
||||||
dataFile += " <integer>1</integer>\n"
|
data_file += " <integer>1</integer>\n"
|
||||||
dataFile += " <integer>2</integer>\n"
|
data_file += " <integer>2</integer>\n"
|
||||||
dataFile += " </array>\n"
|
data_file += " </array>\n"
|
||||||
dataFile += " <key>UIRequiredDeviceCapabilities</key>\n"
|
data_file += " <key>UIRequiredDeviceCapabilities</key>\n"
|
||||||
dataFile += " <array>\n"
|
data_file += " <array>\n"
|
||||||
dataFile += " <string>armv7</string>\n"
|
data_file += " <string>armv7</string>\n"
|
||||||
dataFile += " </array>\n"
|
data_file += " </array>\n"
|
||||||
dataFile += " <key>UIStatusBarHidden</key>\n"
|
data_file += " <key>UIStatusBarHidden</key>\n"
|
||||||
dataFile += " <true/>\n"
|
data_file += " <true/>\n"
|
||||||
dataFile += " <key>UISupportedInterfaceOrientations</key>\n"
|
data_file += " <key>UISupportedInterfaceOrientations</key>\n"
|
||||||
dataFile += " <array>\n"
|
data_file += " <array>\n"
|
||||||
dataFile += " <string>UIInterfaceOrientationPortrait</string>\n"
|
data_file += " <string>UIInterfaceOrientationPortrait</string>\n"
|
||||||
dataFile += " <string>UIInterfaceOrientationPortraitUpsideDown</string>\n"
|
data_file += " <string>UIInterfaceOrientationPortraitUpsideDown</string>\n"
|
||||||
dataFile += " <string>UIInterfaceOrientationLandscapeLeft</string>\n"
|
data_file += " <string>UIInterfaceOrientationLandscapeLeft</string>\n"
|
||||||
dataFile += " <string>UIInterfaceOrientationLandscapeRight</string>\n"
|
data_file += " <string>UIInterfaceOrientationLandscapeRight</string>\n"
|
||||||
dataFile += " </array>\n"
|
data_file += " </array>\n"
|
||||||
dataFile += " <key>UISupportedInterfaceOrientations~ipad</key>\n"
|
data_file += " <key>UISupportedInterfaceOrientations~ipad</key>\n"
|
||||||
dataFile += " <array>\n"
|
data_file += " <array>\n"
|
||||||
dataFile += " <string>UIInterfaceOrientationPortrait</string>\n"
|
data_file += " <string>UIInterfaceOrientationPortrait</string>\n"
|
||||||
dataFile += " <string>UIInterfaceOrientationPortraitUpsideDown</string>\n"
|
data_file += " <string>UIInterfaceOrientationPortraitUpsideDown</string>\n"
|
||||||
dataFile += " <string>UIInterfaceOrientationLandscapeLeft</string>\n"
|
data_file += " <string>UIInterfaceOrientationLandscapeLeft</string>\n"
|
||||||
dataFile += " <string>UIInterfaceOrientationLandscapeRight</string>\n"
|
data_file += " <string>UIInterfaceOrientationLandscapeRight</string>\n"
|
||||||
dataFile += " </array>\n"
|
data_file += " </array>\n"
|
||||||
dataFile += " </dict>\n"
|
data_file += " </dict>\n"
|
||||||
dataFile += "</plist>\n"
|
data_file += "</plist>\n"
|
||||||
dataFile += "\n\n"
|
data_file += "\n\n"
|
||||||
|
tools.file_write_data(os.path.join(target_outpath, "Info.plist"),
|
||||||
|
data_file,
|
||||||
|
only_if_new=True)
|
||||||
|
|
||||||
infoFile = self.get_staging_folder(pkgName) + "/Info.plist"
|
|
||||||
# Create the info file
|
|
||||||
tmpFile = open(infoFile, 'w')
|
|
||||||
tmpFile.write(dataFile)
|
|
||||||
tmpFile.flush()
|
|
||||||
tmpFile.close()
|
|
||||||
"""
|
"""
|
||||||
infoFile = self.get_staging_folder(pkgName) + "/" + pkgName + "-Info.plist"
|
infoFile = self.get_staging_path(pkg_name) + "/" + pkg_name + "-Info.plist"
|
||||||
# Create the info file
|
# Create the info file
|
||||||
tmpFile = open(infoFile, 'w')
|
tmpFile = open(infoFile, 'w')
|
||||||
tmpFile.write(dataFile)
|
tmpFile.write(data_file)
|
||||||
tmpFile.flush()
|
tmpFile.flush()
|
||||||
tmpFile.close()
|
tmpFile.close()
|
||||||
cmdLine = "builtin-infoPlistUtility "
|
cmdLine = "builtin-infoPlistUtility "
|
||||||
cmdLine += " " + self.get_staging_folder(pkgName) + "/" + pkgName + "-Info.plist "
|
cmdLine += " " + self.get_staging_path(pkg_name) + "/" + pkg_name + "-Info.plist "
|
||||||
cmdLine += " -genpkginfo " + self.get_staging_folder(pkgName) + "/PkgInfo"
|
cmdLine += " -genpkginfo " + self.get_staging_path(pkg_name) + "/PkgInfo"
|
||||||
cmdLine += " -expandbuildsettings "
|
cmdLine += " -expandbuildsettings "
|
||||||
cmdLine += " -format binary "
|
cmdLine += " -format binary "
|
||||||
if self.sumulator == False:
|
if self.sumulator == False:
|
||||||
cmdLine += " -platform iphonesimulator "
|
cmdLine += " -platform iphonesimulator "
|
||||||
else:
|
else:
|
||||||
cmdLine += " -platform iphoneos "
|
cmdLine += " -platform iphoneos "
|
||||||
cmdLine += " -o " + self.get_staging_folder(pkgName) + "/" + "Info.plist"
|
cmdLine += " -o " + self.get_staging_path(pkg_name) + "/" + "Info.plist"
|
||||||
multiprocess.run_command(cmdLine)
|
multiprocess.run_command(cmdLine)
|
||||||
"""
|
"""
|
||||||
"""
|
"""
|
||||||
@@ -245,59 +262,51 @@ class Target(target.Target):
|
|||||||
#/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil /Users/edouarddupin/Library/Developer/Xcode/DerivedData/projectName-gwycnyyzohokcmalgodeucqppxro/Build/Products/Debug-iphonesimulator/projectName.app/projectName -o /Users/edouarddupin/Library/Developer/Xcode/DerivedData/projectName-gwycnyyzohokcmalgodeucqppxro/Build/Products/Debug-iphonesimulator/projectName.app.dSYM
|
#/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil /Users/edouarddupin/Library/Developer/Xcode/DerivedData/projectName-gwycnyyzohokcmalgodeucqppxro/Build/Products/Debug-iphonesimulator/projectName.app/projectName -o /Users/edouarddupin/Library/Developer/Xcode/DerivedData/projectName-gwycnyyzohokcmalgodeucqppxro/Build/Products/Debug-iphonesimulator/projectName.app.dSYM
|
||||||
|
|
||||||
debug.print_element("pkg", "ResourceRules.plist", "<==", "Resources autorisation")
|
debug.print_element("pkg", "ResourceRules.plist", "<==", "Resources autorisation")
|
||||||
dataFile = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
data_file = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||||
dataFile += "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
|
data_file += "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
|
||||||
dataFile += "<plist version=\"1.0\">\n"
|
data_file += "<plist version=\"1.0\">\n"
|
||||||
dataFile += " <dict>\n"
|
data_file += " <dict>\n"
|
||||||
dataFile += " <key>rules</key>\n"
|
data_file += " <key>rules</key>\n"
|
||||||
dataFile += " <dict>\n"
|
data_file += " <dict>\n"
|
||||||
dataFile += " <key>.*</key>\n"
|
data_file += " <key>.*</key>\n"
|
||||||
dataFile += " <true/>\n"
|
data_file += " <true/>\n"
|
||||||
dataFile += " <key>Info.plist</key>\n"
|
data_file += " <key>Info.plist</key>\n"
|
||||||
dataFile += " <dict>\n"
|
data_file += " <dict>\n"
|
||||||
dataFile += " <key>omit</key>\n"
|
data_file += " <key>omit</key>\n"
|
||||||
dataFile += " <true/>\n"
|
data_file += " <true/>\n"
|
||||||
dataFile += " <key>weight</key>\n"
|
data_file += " <key>weight</key>\n"
|
||||||
dataFile += " <real>10</real>\n"
|
data_file += " <real>10</real>\n"
|
||||||
dataFile += " </dict>\n"
|
data_file += " </dict>\n"
|
||||||
dataFile += " <key>ResourceRules.plist</key>\n"
|
data_file += " <key>ResourceRules.plist</key>\n"
|
||||||
dataFile += " <dict>\n"
|
data_file += " <dict>\n"
|
||||||
dataFile += " <key>omit</key>\n"
|
data_file += " <key>omit</key>\n"
|
||||||
dataFile += " <true/>\n"
|
data_file += " <true/>\n"
|
||||||
dataFile += " <key>weight</key>\n"
|
data_file += " <key>weight</key>\n"
|
||||||
dataFile += " <real>100</real>\n"
|
data_file += " <real>100</real>\n"
|
||||||
dataFile += " </dict>\n"
|
data_file += " </dict>\n"
|
||||||
dataFile += " </dict>\n"
|
data_file += " </dict>\n"
|
||||||
dataFile += " </dict>\n"
|
data_file += " </dict>\n"
|
||||||
dataFile += "</plist>\n"
|
data_file += "</plist>\n"
|
||||||
dataFile += "\n\n"
|
data_file += "\n\n"
|
||||||
|
tools.file_write_data(os.path.join(target_outpath, "ResourceRules.plist"),
|
||||||
infoFile = self.get_staging_folder(pkgName) + "/ResourceRules.plist"
|
data_file,
|
||||||
# Create the info file
|
only_if_new=True)
|
||||||
tmpFile = open(infoFile, 'w')
|
|
||||||
tmpFile.write(dataFile)
|
|
||||||
tmpFile.flush()
|
|
||||||
tmpFile.close()
|
|
||||||
|
|
||||||
debug.print_element("pkg", "Entitlements.plist", "<==", "application mode")
|
debug.print_element("pkg", "Entitlements.plist", "<==", "application mode")
|
||||||
dataFile = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
data_file = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||||
dataFile += "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
|
data_file += "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
|
||||||
dataFile += "<plist version=\"1.0\">\n"
|
data_file += "<plist version=\"1.0\">\n"
|
||||||
dataFile += " <dict>\n"
|
data_file += " <dict>\n"
|
||||||
dataFile += " <key>get-task-allow</key>\n"
|
data_file += " <key>get-task-allow</key>\n"
|
||||||
dataFile += " <true/>\n"
|
data_file += " <true/>\n"
|
||||||
dataFile += " </dict>\n"
|
data_file += " </dict>\n"
|
||||||
dataFile += "</plist>\n"
|
data_file += "</plist>\n"
|
||||||
dataFile += "\n\n"
|
data_file += "\n\n"
|
||||||
|
tools.file_write_data(os.path.join(target_outpath, "Entitlements.plist"),
|
||||||
|
data_file,
|
||||||
|
only_if_new=True)
|
||||||
|
|
||||||
infoFile = self.get_staging_folder(pkgName) + "/Entitlements.plist"
|
# Simulateur path :
|
||||||
# Create the info file
|
|
||||||
tmpFile = open(infoFile, 'w')
|
|
||||||
tmpFile.write(dataFile)
|
|
||||||
tmpFile.flush()
|
|
||||||
tmpFile.close()
|
|
||||||
|
|
||||||
# Simulateur folder :
|
|
||||||
#~/Library/Application\ Support/iPhone\ Simulator/7.0.3/Applications/
|
#~/Library/Application\ Support/iPhone\ Simulator/7.0.3/Applications/
|
||||||
# must have a 'uuidgen' UID generate value with this elemennt ...
|
# must have a 'uuidgen' UID generate value with this elemennt ...
|
||||||
# get the bundle path : ==> maybe usefull in MocOS ...
|
# get the bundle path : ==> maybe usefull in MocOS ...
|
||||||
@@ -306,24 +315,23 @@ class Target(target.Target):
|
|||||||
# Must create the tarball of the application
|
# Must create the tarball of the application
|
||||||
#cd $(TARGET_OUT_FINAL)/; tar -cf $(PROJECT_NAME).tar $(PROJECT_NAME).app
|
#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
|
#cd $(TARGET_OUT_FINAL)/; tar -czf $(PROJECT_NAME).tar.gz $(PROJECT_NAME).app
|
||||||
|
|
||||||
if self.sumulator == False:
|
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
|
# Create the info file
|
||||||
tmpFile = open(self.get_build_folder(pkgName) + "/worddown.xcent", 'w')
|
tmpFile = open(os.path.join(target_outpath, pkg_name + ".xcent"), 'w')
|
||||||
tmpFile.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
|
tmpFile.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
|
||||||
tmpFile.write("<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n")
|
tmpFile.write("<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n")
|
||||||
tmpFile.write("<plist version=\"1.0\">\n")
|
tmpFile.write("<plist version=\"1.0\">\n")
|
||||||
tmpFile.write(" <dict>\n")
|
tmpFile.write(" <dict>\n")
|
||||||
tmpFile.write(" <key>application-identifier</key>\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")
|
||||||
tmpFile.write(" <string>" + pkgProperties["APPLE_APPLICATION_IOS_ID"] + "." + pkgProperties["COMPAGNY_TYPE"] + "." + pkgProperties["COMPAGNY_NAME2"] + "." + pkgName + "</string>\n")
|
|
||||||
except:
|
|
||||||
debug.error("Missing package property : APPLE_APPLICATION_IOS_ID")
|
|
||||||
tmpFile.write(" <key>get-task-allow</key>\n")
|
tmpFile.write(" <key>get-task-allow</key>\n")
|
||||||
tmpFile.write(" <true/>\n")
|
tmpFile.write(" <true/>\n")
|
||||||
tmpFile.write(" <key>keychain-access-groups</key>\n")
|
tmpFile.write(" <key>keychain-access-groups</key>\n")
|
||||||
tmpFile.write(" <array>\n")
|
tmpFile.write(" <array>\n")
|
||||||
tmpFile.write(" <string>" + pkgProperties["APPLE_APPLICATION_IOS_ID"] + ".atriasoft.worddown</string>\n")
|
tmpFile.write(" <string>" + pkg_properties["APPLE_APPLICATION_IOS_ID"] + "." + pkg_properties["COMPAGNY_TYPE"] + "." + pkg_properties["COMPAGNY_NAME2"] + "." + pkg_name + "</string>\n")
|
||||||
tmpFile.write(" </array>\n")
|
tmpFile.write(" </array>\n")
|
||||||
tmpFile.write(" </dict>\n")
|
tmpFile.write(" </dict>\n")
|
||||||
tmpFile.write("</plist>\n")
|
tmpFile.write("</plist>\n")
|
||||||
@@ -333,31 +341,27 @@ class Target(target.Target):
|
|||||||
debug.print_element("pkg(signed)", "pkg", "<==", "Signing application")
|
debug.print_element("pkg(signed)", "pkg", "<==", "Signing application")
|
||||||
iosDevelopperKeyFile = ".iosKey.txt"
|
iosDevelopperKeyFile = ".iosKey.txt"
|
||||||
if tools.file_size(iosDevelopperKeyFile) < 10:
|
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\"'")
|
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 = tools.file_read_data(iosDevelopperKeyFile)
|
||||||
signatureKey = re.sub('\n', '', signatureKey)
|
signatureKey = re.sub('\n', '', signatureKey)
|
||||||
cmdLine = 'codesign --force --sign '
|
cmdLine = 'codesign --force --sign '
|
||||||
# to get this key ; certtool y | grep "Developer"
|
# to get this key ; certtool y | grep "Developer"
|
||||||
cmdLine += ' "' + signatureKey + '" '
|
cmdLine += ' "' + signatureKey + '" '
|
||||||
cmdLine += ' --entitlements ' + self.get_build_folder(pkgName) + '/worddown.xcent'
|
cmdLine += ' --entitlements ' + self.get_build_path(pkg_name) + '/worddown.xcent'
|
||||||
cmdLine += ' ' + self.get_staging_folder(pkgName)
|
cmdLine += ' ' + self.get_staging_path(pkg_name)
|
||||||
multiprocess.run_command(cmdLine)
|
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
|
|
||||||
|
|
||||||
|
|
||||||
def createRandomNumber(self, len):
|
def createRandomNumber(self, len):
|
||||||
out = ""
|
out = ""
|
||||||
for iii in range(0,len):
|
for iii in range(0,len):
|
||||||
out += random.choice(["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"])
|
out += random.choice(["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"])
|
||||||
return out
|
return out
|
||||||
|
|
||||||
def install_package(self, pkgName):
|
def install_package(self, pkg_name):
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
debug.info("Install package '" + pkgName + "'")
|
debug.info("Install package '" + pkg_name + "'")
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
if self.sumulator == False:
|
if self.sumulator == False:
|
||||||
if tools.file_size("ewol/ios-deploy/ios-deploy") == 0:
|
if tools.file_size("ewol/ios-deploy/ios-deploy") == 0:
|
||||||
@@ -367,10 +371,10 @@ class Target(target.Target):
|
|||||||
if tools.file_size("ewol/ios-deploy/ios-deploy") == 0:
|
if tools.file_size("ewol/ios-deploy/ios-deploy") == 0:
|
||||||
debug.error("Can not create ios-deploy external software ...")
|
debug.error("Can not create ios-deploy external software ...")
|
||||||
debug.print_element("deploy", "iphone/ipad", "<==", "aplication")
|
debug.print_element("deploy", "iphone/ipad", "<==", "aplication")
|
||||||
cmdLine = './ewol/ios-deploy/ios-deploy --bundle ' + self.get_staging_folder(pkgName)
|
cmdLine = './ewol/ios-deploy/ios-deploy --bundle ' + self.get_staging_path(pkg_name)
|
||||||
multiprocess.run_command(cmdLine)
|
multiprocess.run_command(cmdLine)
|
||||||
else:
|
else:
|
||||||
simulatorIdFile = ".iosSimutatorId_" + pkgName + ".txt"
|
simulatorIdFile = ".iosSimutatorId_" + pkg_name + ".txt"
|
||||||
if tools.file_size(simulatorIdFile) < 10:
|
if tools.file_size(simulatorIdFile) < 10:
|
||||||
#create the file:
|
#create the file:
|
||||||
tmpFile = open(simulatorIdFile, 'w')
|
tmpFile = open(simulatorIdFile, 'w')
|
||||||
@@ -387,32 +391,32 @@ class Target(target.Target):
|
|||||||
tmpFile.close()
|
tmpFile.close()
|
||||||
simulatorId = tools.file_read_data(simulatorIdFile)
|
simulatorId = tools.file_read_data(simulatorIdFile)
|
||||||
home = os.path.expanduser("~")
|
home = os.path.expanduser("~")
|
||||||
destinationFolderBase = home + "/Library/Application\\ Support/iPhone\\ Simulator/7.1/Applications/" + simulatorId
|
destinationpathBase = home + "/Library/Application\\ Support/iPhone\\ Simulator/7.1/Applications/" + simulatorId
|
||||||
destinationFolder = home + "/Library/Application Support/iPhone Simulator/7.1/Applications/" + simulatorId + "/" + pkgName + ".app"
|
destinationpath = home + "/Library/Application Support/iPhone Simulator/7.1/Applications/" + simulatorId + "/" + pkg_name + ".app"
|
||||||
destinationFolder2 = home + "/Library/Application\\ Support/iPhone\\ Simulator/7.1/Applications/" + simulatorId + "/" + pkgName + ".app"
|
destinationpath2 = home + "/Library/Application\\ Support/iPhone\\ Simulator/7.1/Applications/" + simulatorId + "/" + pkg_name + ".app"
|
||||||
debug.info("install in simulator : " + destinationFolder)
|
debug.info("install in simulator : " + destinationpath)
|
||||||
tools.create_directory_of_file(destinationFolder + "/plop.txt")
|
tools.create_directory_of_file(destinationpath + "/plop.txt")
|
||||||
cmdLine = "cp -rf " + self.get_staging_folder(pkgName) + " " + destinationFolder2
|
cmdLine = "cp -rf " + self.get_staging_path(pkg_name) + " " + destinationpath2
|
||||||
multiprocess.run_command(cmdLine)
|
multiprocess.run_command(cmdLine)
|
||||||
cmdLine = "touch " + destinationFolderBase
|
cmdLine = "touch " + destinationpathBase
|
||||||
multiprocess.run_command(cmdLine)
|
multiprocess.run_command(cmdLine)
|
||||||
|
|
||||||
#sudo dpkg -i $(TARGET_OUT_FINAL)/$(PROJECT_NAME) + self.suffix_package
|
#sudo dpkg -i $(TARGET_OUT_FINAL)/$(PROJECT_NAME) + self.suffix_package
|
||||||
|
|
||||||
def un_install_package(self, pkgName):
|
def un_install_package(self, pkg_name):
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
debug.info("Un-Install package '" + pkgName + "'")
|
debug.info("Un-Install package '" + pkg_name + "'")
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
if self.sumulator == False:
|
if self.sumulator == False:
|
||||||
debug.warning("not implemented")
|
debug.warning("not implemented")
|
||||||
else:
|
else:
|
||||||
simulatorIdFile = ".iosSimutatorId_" + pkgName + ".txt"
|
simulatorIdFile = ".iosSimutatorId_" + pkg_name + ".txt"
|
||||||
if tools.file_size(simulatorIdFile) < 10:
|
if tools.file_size(simulatorIdFile) < 10:
|
||||||
debug.warning("Can not get simulation O_ID : " + simulatorIdFile)
|
debug.warning("Can not get simulation O_ID : " + simulatorIdFile)
|
||||||
|
|
||||||
#sudo dpkg -r $(TARGET_OUT_FINAL)/$(PROJECT_NAME) + self.suffix_package
|
#sudo dpkg -r $(TARGET_OUT_FINAL)/$(PROJECT_NAME) + self.suffix_package
|
||||||
|
|
||||||
def Log(self, pkgName):
|
def Log(self, pkg_name):
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
debug.info("log of iOs board")
|
debug.info("log of iOs board")
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
@@ -424,7 +428,7 @@ class Target(target.Target):
|
|||||||
if tools.file_size("ewol/ios-deploy/ios-deploy") == 0:
|
if tools.file_size("ewol/ios-deploy/ios-deploy") == 0:
|
||||||
debug.error("Can not create ios-deploy external software ...")
|
debug.error("Can not create ios-deploy external software ...")
|
||||||
debug.print_element("deploy", "iphone/ipad", "<==", "aplication")
|
debug.print_element("deploy", "iphone/ipad", "<==", "aplication")
|
||||||
cmdLine = './ewol/ios-deploy/ios-deploy --debug --bundle ' + self.get_staging_folder(pkgName)
|
cmdLine = './ewol/ios-deploy/ios-deploy --debug --bundle ' + self.get_staging_path(pkg_name)
|
||||||
multiprocess.run_command(cmdLine)
|
multiprocess.run_command(cmdLine)
|
||||||
else:
|
else:
|
||||||
cmdLine = "tail -f ~/Library/Logs/iOS\ Simulator/7.1/system.log"
|
cmdLine = "tail -f ~/Library/Logs/iOS\ Simulator/7.1/system.log"
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
@@ -14,6 +15,7 @@ import os
|
|||||||
import stat
|
import stat
|
||||||
import re
|
import re
|
||||||
from lutin import host
|
from lutin import host
|
||||||
|
from lutin import multiprocess
|
||||||
|
|
||||||
class Target(target.Target):
|
class Target(target.Target):
|
||||||
def __init__(self, config):
|
def __init__(self, config):
|
||||||
@@ -27,113 +29,130 @@ class Target(target.Target):
|
|||||||
if self.config["bus-size"] == "64":
|
if self.config["bus-size"] == "64":
|
||||||
# 64 bits
|
# 64 bits
|
||||||
if host.BUS_SIZE != 64:
|
if host.BUS_SIZE != 64:
|
||||||
self.global_flags_cc.append("-m64")
|
self.add_flag("c", "-m64")
|
||||||
else:
|
else:
|
||||||
# 32 bits
|
# 32 bits
|
||||||
if host.BUS_SIZE != 32:
|
if host.BUS_SIZE != 32:
|
||||||
self.global_flags_cc.append("-m32")
|
self.add_flag("c", "-m32")
|
||||||
|
|
||||||
def generate_list_separate_coma(self, list):
|
self.add_flag("c", "-fpic")
|
||||||
result = ""
|
|
||||||
fistTime = True
|
|
||||||
for elem in list:
|
|
||||||
if fistTime == True:
|
|
||||||
fistTime = False
|
|
||||||
else:
|
|
||||||
result += ","
|
|
||||||
result += elem
|
|
||||||
return result
|
|
||||||
|
|
||||||
def make_package(self, pkgName, pkgProperties, basePkgPath):
|
self.pkg_path_data = "share"
|
||||||
# http://alp.developpez.com/tutoriels/debian/creer-paquet/
|
self.pkg_path_bin = "bin"
|
||||||
debianPkgName = re.sub("_", "-", pkgName)
|
self.pkg_path_lib = "lib"
|
||||||
debug.debug("------------------------------------------------------------------------")
|
self.pkg_path_license = "license"
|
||||||
debug.info("Generate package '" + debianPkgName + "' v"+pkgProperties["VERSION"])
|
|
||||||
debug.debug("------------------------------------------------------------------------")
|
|
||||||
self.get_staging_folder(pkgName)
|
|
||||||
targetOutFolderDebian = self.get_staging_folder(pkgName) + "/DEBIAN/"
|
|
||||||
finalFileControl = targetOutFolderDebian + "control"
|
|
||||||
finalFilepostRm = targetOutFolderDebian + "postrm"
|
|
||||||
# create the folders :
|
|
||||||
tools.create_directory_of_file(finalFileControl)
|
|
||||||
tools.create_directory_of_file(finalFilepostRm)
|
|
||||||
## Create the control file
|
|
||||||
tools.create_directory_of_file(finalFileControl)
|
|
||||||
tmpFile = open(finalFileControl, 'w')
|
|
||||||
tmpFile.write("Package: " + debianPkgName + "\n")
|
|
||||||
tmpFile.write("Version: " + pkgProperties["VERSION"] + "\n")
|
|
||||||
tmpFile.write("Section: " + self.generate_list_separate_coma(pkgProperties["SECTION"]) + "\n")
|
|
||||||
tmpFile.write("Priority: " + pkgProperties["PRIORITY"] + "\n")
|
|
||||||
tmpFile.write("Architecture: all\n")
|
|
||||||
tmpFile.write("Depends: bash\n")
|
|
||||||
tmpFile.write("Maintainer: " + self.generate_list_separate_coma(pkgProperties["MAINTAINER"]) + "\n")
|
|
||||||
tmpFile.write("Description: " + pkgProperties["DESCRIPTION"] + "\n")
|
|
||||||
tmpFile.write("\n")
|
|
||||||
tmpFile.flush()
|
|
||||||
tmpFile.close()
|
|
||||||
## Create the PostRm
|
|
||||||
tmpFile = open(finalFilepostRm, 'w')
|
|
||||||
tmpFile.write("#!/bin/bash\n")
|
|
||||||
tmpFile.write("touch ~/." + pkgName + "\n")
|
|
||||||
if pkgName != "":
|
|
||||||
tmpFile.write("touch ~/.local/share/" + pkgName + "\n")
|
|
||||||
tmpFile.write("rm -r ~/.local/share/" + pkgName + "\n")
|
|
||||||
tmpFile.write("\n")
|
|
||||||
tmpFile.flush()
|
|
||||||
tmpFile.close()
|
|
||||||
## Enable Execution in script
|
|
||||||
os.chmod(finalFilepostRm, stat.S_IRWXU + stat.S_IRGRP + stat.S_IXGRP + stat.S_IROTH + stat.S_IXOTH);
|
|
||||||
## Readme donumentation
|
|
||||||
readmeFileDest = self.get_staging_folder(pkgName) + "/usr/share/doc/"+ debianPkgName + "/README"
|
|
||||||
tools.create_directory_of_file(readmeFileDest)
|
|
||||||
if os.path.exists(basePkgPath + "/os-Linux/README")==True:
|
|
||||||
tools.copy_file(basePkgPath + "/os-Linux/README", readmeFileDest)
|
|
||||||
elif os.path.exists(basePkgPath + "/README")==True:
|
|
||||||
tools.copy_file(basePkgPath + "/README", readmeFileDest)
|
|
||||||
elif os.path.exists(basePkgPath + "/README.md")==True:
|
|
||||||
tools.copy_file(basePkgPath + "/README.md", readmeFileDest)
|
|
||||||
else:
|
|
||||||
debug.info("no file 'README', 'README.md' or 'os-Linux/README' ==> generate an empty one")
|
|
||||||
tmpFile = open(readmeFileDest, 'w')
|
|
||||||
tmpFile.write("No documentation for " + pkgName + "\n")
|
|
||||||
tmpFile.flush()
|
|
||||||
tmpFile.close()
|
|
||||||
## licence file
|
|
||||||
licenseFileDest = self.get_staging_folder(pkgName) + "/usr/share/doc/"+ debianPkgName + "/copyright"
|
|
||||||
tools.create_directory_of_file(licenseFileDest)
|
|
||||||
if os.path.exists(basePkgPath + "/license.txt")==True:
|
|
||||||
tools.copy_file(basePkgPath + "/license.txt", licenseFileDest)
|
|
||||||
else:
|
|
||||||
debug.info("no file 'license.txt' ==> generate an empty one")
|
|
||||||
tmpFile = open(licenseFileDest, 'w')
|
|
||||||
tmpFile.write("No license define by the developper for " + pkgName + "\n")
|
|
||||||
tmpFile.flush()
|
|
||||||
tmpFile.close()
|
|
||||||
##changeLog file
|
|
||||||
changeLogFileDest = self.get_staging_folder(pkgName) + "/usr/share/doc/"+ debianPkgName + "/changelog"
|
|
||||||
tools.create_directory_of_file(changeLogFileDest)
|
|
||||||
if os.path.exists(basePkgPath + "/changelog")==True:
|
|
||||||
tools.copy_file(basePkgPath + "/changelog", changeLogFileDest)
|
|
||||||
else:
|
|
||||||
debug.info("no file 'changelog' ==> generate an empty one")
|
|
||||||
tmpFile = open(changeLogFileDest, 'w')
|
|
||||||
tmpFile.write("No changelog data " + pkgName + "\n")
|
|
||||||
tmpFile.flush()
|
|
||||||
tmpFile.close()
|
|
||||||
## create the package :
|
|
||||||
debug.debug("package : " + self.get_staging_folder(pkgName) + "/" + debianPkgName + ".deb")
|
|
||||||
os.system("cd " + self.get_staging_folder("") + " ; dpkg-deb --build " + pkgName)
|
|
||||||
tools.create_directory_of_file(self.get_final_folder())
|
|
||||||
tools.copy_file(self.get_staging_folder("") + "/" + pkgName + self.suffix_package, self.get_final_folder() + "/" + pkgName + self.suffix_package)
|
|
||||||
|
|
||||||
def install_package(self, pkgName):
|
"""
|
||||||
|
.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.debug("------------------------------------------------------------------------")
|
||||||
debug.info("Install package '" + pkgName + "'")
|
debug.debug("-- Generate generic '" + pkg_name + "' v" + tools.version_to_string(pkg_properties["VERSION"]))
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
os.system("sudo dpkg -i " + self.get_final_folder() + "/" + pkgName + self.suffix_package)
|
#output path
|
||||||
|
target_outpath = os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app")
|
||||||
|
tools.create_directory_of_file(target_outpath)
|
||||||
|
|
||||||
def un_install_package(self, pkgName):
|
## Create share datas:
|
||||||
|
ret_share = self.make_package_binary_data(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
|
||||||
|
|
||||||
|
## copy binary files:
|
||||||
|
ret_bin = self.make_package_binary_bin(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
|
||||||
|
|
||||||
|
## Create libraries:
|
||||||
|
ret_lib = self.make_package_binary_lib(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
|
||||||
|
|
||||||
|
## Create generic files:
|
||||||
|
ret_file = self.make_package_generic_files(target_outpath, pkg_properties, pkg_name, base_pkg_path, heritage_list, static)
|
||||||
|
|
||||||
|
## create the package:
|
||||||
|
if ret_share \
|
||||||
|
or ret_bin \
|
||||||
|
or ret_lib \
|
||||||
|
or ret_file:
|
||||||
|
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(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.debug("------------------------------------------------------------------------")
|
||||||
debug.info("Un-Install package '" + pkgName + "'")
|
debug.info("-- Install package '" + pkg_name + "'")
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
os.system("sudo dpkg -r " + self.get_final_folder() + "/" + pkgName + 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("------------------------------------------------------------------------")
|
||||||
|
# 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)
|
||||||
|
|
||||||
|
def run(self, pkg_name, option_list):
|
||||||
|
debug.debug("------------------------------------------------------------------------")
|
||||||
|
debug.info("-- Run package '" + pkg_name + "' + option: " + str(option_list))
|
||||||
|
debug.debug("------------------------------------------------------------------------")
|
||||||
|
appl_path = os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app", "bin", pkg_name)
|
||||||
|
cmd = appl_path + " "
|
||||||
|
for elem in option_list:
|
||||||
|
cmd += elem + " "
|
||||||
|
multiprocess.run_command_no_lock_out(cmd)
|
||||||
|
debug.debug("------------------------------------------------------------------------")
|
||||||
|
debug.info("-- Run package '" + pkg_name + "' Finished")
|
||||||
|
debug.debug("------------------------------------------------------------------------")
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
@@ -28,108 +29,139 @@ class Target(target.Target):
|
|||||||
# http://devs.openttd.org/~truebrain/compile-farm/apple-darwin9.txt
|
# http://devs.openttd.org/~truebrain/compile-farm/apple-darwin9.txt
|
||||||
target.Target.__init__(self, "MacOs", config, "")
|
target.Target.__init__(self, "MacOs", config, "")
|
||||||
|
|
||||||
self.folder_bin="/MacOS"
|
#self.path_bin="MacOS"
|
||||||
self.folder_lib="/lib"
|
#self.path_lib="lib"
|
||||||
self.folder_data="/Resources"
|
#self.path_data="Resources"
|
||||||
self.folder_doc="/doc"
|
#self.path_doc="doc"
|
||||||
|
|
||||||
self.suffix_lib_static='.a'
|
self.suffix_lib_static='.a'
|
||||||
self.suffix_lib_dynamic='.dylib'
|
self.suffix_lib_dynamic='.dylib'
|
||||||
self.suffix_binary=''
|
#self.suffix_binary=''
|
||||||
self.suffix_package=''
|
#self.suffix_package=''
|
||||||
|
|
||||||
|
self.pkg_path_data = "Resources"
|
||||||
|
self.pkg_path_bin = "MacOS"
|
||||||
|
self.pkg_path_lib = "lib"
|
||||||
|
self.pkg_path_license = "license"
|
||||||
|
|
||||||
def get_staging_folder(self, binaryName):
|
"""
|
||||||
return tools.get_run_folder() + self.folder_out + self.folder_staging + "/" + binaryName + ".app/Contents/"
|
def get_staging_path(self, binary_name):
|
||||||
|
return tools.get_run_path() + self.path_out + self.path_staging + "/" + binary_name + ".app/Contents/"
|
||||||
|
|
||||||
def get_staging_folder_data(self, binaryName):
|
def get_staging_path_data(self, binary_name):
|
||||||
return self.get_staging_folder(binaryName) + self.folder_data + "/"
|
return self.get_staging_path(binary_name) + self.path_data + "/"
|
||||||
|
"""
|
||||||
|
|
||||||
def make_package(self, pkgName, pkgProperties, basePkgPath):
|
def make_package_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static):
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
debug.info("Generate package '" + pkgName + "'")
|
debug.info("Generate package '" + pkg_name + "' v" + tools.version_to_string(pkg_properties["VERSION"]))
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
|
#output path
|
||||||
|
target_outpath = os.path.join(self.get_staging_path(pkg_name), pkg_name + ".app/Contents")
|
||||||
|
tools.create_directory_of_file(target_outpath)
|
||||||
|
|
||||||
if "ICON" in pkgProperties.keys() \
|
## Create share datas:
|
||||||
and pkgProperties["ICON"] != "":
|
self.make_package_binary_data(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
|
||||||
tools.copy_file(pkgProperties["ICON"], self.get_staging_folder_data(pkgName) + "/icon.icns", force=True)
|
|
||||||
|
|
||||||
|
## 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 icon (no convertion ==> TODO: must test if png is now supported):
|
||||||
|
if "ICON" in pkg_properties.keys() \
|
||||||
|
and pkg_properties["ICON"] != "":
|
||||||
|
tools.copy_file(pkg_properties["ICON"], os.path.join(target_outpath, "icon.icns"), force=True)
|
||||||
|
|
||||||
|
## Create info.plist file:
|
||||||
# http://www.sandroid.org/imcross/#Deployment
|
# http://www.sandroid.org/imcross/#Deployment
|
||||||
infoFile=self.get_staging_folder(pkgName) + "/Info.plist"
|
data_file = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||||
# Create the info file
|
data_file += "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
|
||||||
tmpFile = open(infoFile, 'w')
|
data_file += "<plist version=\"1.0\">\n"
|
||||||
tmpFile.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
|
data_file += " <dict>\n"
|
||||||
tmpFile.write("<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n")
|
data_file += " <key>CFBundleExecutableFile</key>\n"
|
||||||
tmpFile.write("<plist version=\"1.0\">\n")
|
data_file += " <string>"+pkg_name+"</string>\n"
|
||||||
tmpFile.write(" <dict>\n")
|
data_file += " <key>CFBundleName</key>\n"
|
||||||
tmpFile.write(" <key>CFBundleExecutableFile</key>\n")
|
data_file += " <string>"+pkg_name+"</string>\n"
|
||||||
tmpFile.write(" <string>"+pkgName+"</string>\n")
|
data_file += " <key>CFBundleIdentifier</key>\n"
|
||||||
tmpFile.write(" <key>CFBundleName</key>\n")
|
data_file += " <string>" + pkg_properties["COMPAGNY_TYPE"] + "." + pkg_properties["COMPAGNY_NAME2"] + "." + pkg_name + "</string>\n"
|
||||||
tmpFile.write(" <string>"+pkgName+"</string>\n")
|
data_file += " <key>CFBundleSignature</key>\n"
|
||||||
tmpFile.write(" <key>CFBundleIdentifier</key>\n")
|
data_file += " <string>????</string>\n"
|
||||||
tmpFile.write(" <string>" + pkgProperties["COMPAGNY_TYPE"] + "." + pkgProperties["COMPAGNY_NAME2"] + "." + pkgName + "</string>\n")
|
data_file += " <key>CFBundleIconFile</key>\n"
|
||||||
tmpFile.write(" <key>CFBundleSignature</key>\n")
|
data_file += " <string>icon.icns</string>\n"
|
||||||
tmpFile.write(" <string>????</string>\n")
|
data_file += " </dict>\n"
|
||||||
tmpFile.write(" <key>CFBundleIconFile</key>\n")
|
data_file += "</plist>\n"
|
||||||
tmpFile.write(" <string>icon.icns</string>\n")
|
data_file += "\n\n"
|
||||||
tmpFile.write(" </dict>\n")
|
tools.file_write_data(os.path.join(target_outpath, "Info.plist"),
|
||||||
tmpFile.write("</plist>\n")
|
data_file,
|
||||||
tmpFile.write("\n\n")
|
only_if_new=True)
|
||||||
tmpFile.flush()
|
|
||||||
tmpFile.close()
|
|
||||||
infoFile=self.get_staging_folder(pkgName) + "/PkgInfo"
|
|
||||||
# Create the info file
|
|
||||||
tmpFile = open(infoFile, 'w')
|
|
||||||
tmpFile.write("APPL????")
|
|
||||||
tmpFile.flush()
|
|
||||||
tmpFile.close()
|
|
||||||
|
|
||||||
# Create a simple interface to localy install the aplication for the shell (a shell command line interface)
|
## Create PkgInfo file:
|
||||||
shell_file_name=self.get_staging_folder(pkgName) + "/shell/" + pkgName
|
tools.file_write_data(os.path.join(target_outpath, "PkgInfo"),
|
||||||
# Create the info file
|
"APPL????",
|
||||||
tools.create_directory_of_file(shell_file_name)
|
only_if_new=True)
|
||||||
tmpFile = open(shell_file_name, 'w')
|
|
||||||
tmpFile.write("#!/bin/bash\n")
|
|
||||||
tmpFile.write("# Simply open the real application in the correct way (a link does not work ...)\n")
|
|
||||||
tmpFile.write("/Applications/" + pkgName + ".app/Contents/MacOS/" + pkgName + " $*\n")
|
|
||||||
#tmpFile.write("open -n /Applications/edn.app --args -AppCommandLineArg $*\n")
|
|
||||||
tmpFile.flush()
|
|
||||||
tmpFile.close()
|
|
||||||
|
|
||||||
|
## Create a simple interface to localy install the aplication for the shell (a shell command line interface):
|
||||||
|
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"
|
||||||
|
tools.file_write_data(os.path.join(target_outpath, "shell", pkg_name),
|
||||||
|
data_file,
|
||||||
|
only_if_new=True)
|
||||||
|
|
||||||
# Must create the disk image of the application
|
## Create the disk image of the application:
|
||||||
debug.info("Generate disk image for '" + pkgName + "'")
|
debug.info("Generate disk image for '" + pkg_name + "'")
|
||||||
output_file_name = self.get_final_folder() + "/" + pkgName + ".dmg"
|
output_file_name = os.path.join(self.get_final_path(), pkg_name + ".dmg")
|
||||||
cmd = "hdiutil create -volname "
|
cmd = "hdiutil create -volname "
|
||||||
cmd += pkgName + " -srcfolder "
|
cmd += pkg_name + " -srcpath "
|
||||||
cmd += tools.get_run_folder() + self.folder_out + self.folder_staging + "/" + pkgName + ".app"
|
cmd += os.path.join(tools.get_run_path(), self.path_out, self.path_staging, pkg_name + ".app")
|
||||||
cmd += " -ov -format UDZO "
|
cmd += " -ov -format UDZO "
|
||||||
cmd += output_file_name
|
cmd += output_file_name
|
||||||
tools.create_directory_of_file(output_file_name)
|
tools.create_directory_of_file(output_file_name)
|
||||||
multiprocess.run_command_direct(cmd)
|
multiprocess.run_command_direct(cmd)
|
||||||
debug.info("disk image: " + output_file_name)
|
debug.info("disk image: " + output_file_name)
|
||||||
|
|
||||||
debug.info("You can have an shell interface by executing : ")
|
## user information:
|
||||||
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, pkgName):
|
def install_package(self, pkg_name):
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
debug.info("Install package '" + pkgName + "'")
|
debug.info("Install package '" + pkg_name + "'")
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
debug.info("copy " + tools.get_run_folder() + self.folder_out + self.folder_staging + "/" + pkgName + ".app in /Applications/")
|
debug.info("copy " + tools.get_run_path() + self.path_out + self.path_staging + "/" + pkg_name + ".app in /Applications/")
|
||||||
if os.path.exists("/Applications/" + pkgName + ".app") == True:
|
if os.path.exists("/Applications/" + pkg_name + ".app") == True:
|
||||||
shutil.rmtree("/Applications/" + pkgName + ".app")
|
shutil.rmtree("/Applications/" + pkg_name + ".app")
|
||||||
# copy the application in the basic application folder : /Applications/xxx.app
|
# copy the application in the basic application path : /Applications/xxx.app
|
||||||
shutil.copytree(tools.get_run_folder() + self.folder_out + self.folder_staging + "/" + pkgName + ".app", "/Applications/" + pkgName + ".app")
|
shutil.copytree(os.path.join(tools.get_run_path(),self.path_out,self.path_staging,pkg_name + ".app"), os.path.join("/Applications", pkg_name + ".app"))
|
||||||
|
|
||||||
def un_install_package(self, pkgName):
|
def un_install_package(self, pkg_name):
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
debug.info("Un-Install package '" + pkgName + "'")
|
debug.info("Un-Install package '" + pkg_name + "'")
|
||||||
|
debug.debug("------------------------------------------------------------------------")
|
||||||
|
debug.info("remove OLD application /Applications/" + pkg_name + ".app")
|
||||||
|
# Remove the application in the basic application path : /Applications/xxx.app
|
||||||
|
if os.path.exists("/Applications/" + pkg_name + ".app") == True:
|
||||||
|
shutil.rmtree("/Applications/" + pkg_name + ".app")
|
||||||
|
|
||||||
|
def run(self, pkg_name, option_list):
|
||||||
|
debug.debug("------------------------------------------------------------------------")
|
||||||
|
debug.info("-- Run package '" + pkg_name + "'")
|
||||||
|
debug.debug("------------------------------------------------------------------------")
|
||||||
|
appl_path = os.path.join(tools.get_run_path(),self.path_out,self.path_staging,pkg_name + ".app", "bin", pkg_name)
|
||||||
|
cmd = appl_path + " "
|
||||||
|
for elem in option_list:
|
||||||
|
cmd += elem + " "
|
||||||
|
multiprocess.run_command_no_lock_out(cmd)
|
||||||
|
debug.debug("------------------------------------------------------------------------")
|
||||||
|
debug.info("-- Run package '" + pkg_name + "' Finished")
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
debug.info("remove OLD application /Applications/" + pkgName + ".app")
|
|
||||||
# Remove the application in the basic application folder : /Applications/xxx.app
|
|
||||||
if os.path.exists("/Applications/" + pkgName + ".app") == True:
|
|
||||||
shutil.rmtree("/Applications/" + pkgName + ".app")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
@@ -45,42 +46,65 @@ class Target(target.Target):
|
|||||||
else:
|
else:
|
||||||
# 32 bits
|
# 32 bits
|
||||||
self.set_cross_base("i686-w64-mingw32-")
|
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.folder_bin=""
|
self.pkg_path_data = "data"
|
||||||
self.folder_lib="/lib"
|
self.pkg_path_bin = ""
|
||||||
self.folder_data="/data"
|
self.pkg_path_lib = "lib"
|
||||||
self.folder_doc="/doc"
|
self.pkg_path_license = "license"
|
||||||
|
|
||||||
self.suffix_lib_static='.a'
|
self.suffix_lib_static='.a'
|
||||||
self.suffix_lib_dynamic='.dll'
|
self.suffix_lib_dynamic='.dll'
|
||||||
self.suffix_binary='.exe'
|
self.suffix_binary='.exe'
|
||||||
self.suffix_package=''
|
#self.suffix_package=''
|
||||||
|
|
||||||
|
|
||||||
def get_staging_folder_data(self, binaryName):
|
def get_staging_path_data(self, binary_name, heritage_list):
|
||||||
return self.get_staging_folder(binaryName) + self.folder_data
|
return self.get_staging_path(binary_name) + self.path_data
|
||||||
|
|
||||||
def make_package(self, pkgName, pkgProperties, basePkgPath):
|
def make_package_binary(self, pkg_name, pkg_properties, base_pkg_path, heritage_list, static):
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
debug.info("Generate package '" + pkgName + "'")
|
debug.debug("Generate package '" + 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:
|
||||||
|
ret_share = self.make_package_binary_data(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
|
||||||
|
|
||||||
|
## copy binary files:
|
||||||
|
ret_bin = self.make_package_binary_bin(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
|
||||||
|
|
||||||
|
## Create libraries:
|
||||||
|
ret_lib = self.make_package_binary_lib(target_outpath, pkg_name, base_pkg_path, heritage_list, static)
|
||||||
|
|
||||||
|
## Create generic files:
|
||||||
|
ret_file = self.make_package_generic_files(target_outpath, pkg_properties, pkg_name, base_pkg_path, heritage_list, static)
|
||||||
|
|
||||||
|
## create the package:
|
||||||
|
if ret_share \
|
||||||
|
or ret_bin \
|
||||||
|
or ret_lib \
|
||||||
|
or ret_file:
|
||||||
|
debug.info("TODO: create a windows pkg ...")
|
||||||
|
|
||||||
|
def make_package_single_file(self, pkg_name, pkg_properties, base_pkg_path, heritage_list):
|
||||||
|
debug.debug("------------------------------------------------------------------------")
|
||||||
|
debug.info("Generate package '" + pkg_name + "'")
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
debug.print_element("zip", "data.zip", "<==", "data/*")
|
debug.print_element("zip", "data.zip", "<==", "data/*")
|
||||||
zipPath = self.get_staging_folder(pkgName) + "/data.zip"
|
zipPath = self.get_staging_path(pkg_name) + "/data.zip"
|
||||||
zip.create_zip(self.get_staging_folder_data(pkgName), zipPath)
|
zip.create_zip(self.get_staging_path_data(pkg_name), zipPath)
|
||||||
|
|
||||||
binPath = self.get_staging_folder(pkgName) + "/" + self.folder_bin + "/" + pkgName + self.suffix_binary
|
binPath = self.get_staging_path(pkg_name) + "/" + self.path_bin + "/" + pkg_name + self.suffix_binary
|
||||||
binSize = tools.file_size(binPath)
|
binSize = tools.file_size(binPath)
|
||||||
debug.info("binarysize : " + str(binSize/1024) + " ko ==> " + str(binSize) + " octets")
|
debug.info("binarysize : " + str(binSize/1024) + " ko ==> " + str(binSize) + " octets")
|
||||||
|
|
||||||
#now we create a simple bundle binary ==> all file is stored in one file ...
|
#now we create a simple bundle binary ==> all file is stored in one file ...
|
||||||
self.get_staging_folder(pkgName)
|
self.get_staging_path(pkg_name)
|
||||||
finalBin = self.get_final_folder() + "/" + pkgName + self.suffix_binary
|
finalBin = self.get_final_path() + "/" + pkg_name + self.suffix_binary
|
||||||
tools.create_directory_of_file(finalBin);
|
tools.create_directory_of_file(finalBin);
|
||||||
debug.print_element("pkg", finalBin, "<==", pkgName + self.suffix_binary)
|
debug.print_element("pkg", finalBin, "<==", pkg_name + self.suffix_binary)
|
||||||
#open output file
|
#open output file
|
||||||
tmpFile = open(finalBin, 'wb')
|
tmpFile = open(finalBin, 'wb')
|
||||||
# read all executable binary
|
# read all executable binary
|
||||||
@@ -117,16 +141,16 @@ class Target(target.Target):
|
|||||||
tmpFile.close()
|
tmpFile.close()
|
||||||
debug.verbose("zip position=" + str(positionOfZip) + " = 0x" + h)
|
debug.verbose("zip position=" + str(positionOfZip) + " = 0x" + h)
|
||||||
|
|
||||||
def install_package(self, pkgName):
|
def install_package(self, pkg_name):
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
debug.info("Install package '" + pkgName + "'")
|
debug.info("Install package '" + pkg_name + "'")
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
debug.warning(" ==> TODO")
|
debug.warning(" ==> TODO")
|
||||||
#sudo dpkg -i $(TARGET_OUT_FINAL)/$(PROJECT_NAME) + self.suffix_package
|
#sudo dpkg -i $(TARGET_OUT_FINAL)/$(PROJECT_NAME) + self.suffix_package
|
||||||
|
|
||||||
def un_install_package(self, pkgName):
|
def un_install_package(self, pkg_name):
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
debug.info("Un-Install package '" + pkgName + "'")
|
debug.info("Un-Install package '" + pkg_name + "'")
|
||||||
debug.debug("------------------------------------------------------------------------")
|
debug.debug("------------------------------------------------------------------------")
|
||||||
debug.warning(" ==> TODO")
|
debug.warning(" ==> TODO")
|
||||||
#sudo dpkg -r $(TARGET_OUT_FINAL)/$(PROJECT_NAME) + self.suffix_package
|
#sudo dpkg -r $(TARGET_OUT_FINAL)/$(PROJECT_NAME) + self.suffix_package
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
##
|
##
|
||||||
## @author Edouard DUPIN
|
## @author Edouard DUPIN
|
||||||
##
|
##
|
||||||
@@ -6,6 +7,7 @@
|
|||||||
##
|
##
|
||||||
## @license APACHE v2.0 (see license file)
|
## @license APACHE v2.0 (see license file)
|
||||||
##
|
##
|
||||||
|
|
||||||
import platform
|
import platform
|
||||||
import os
|
import os
|
||||||
import zipfile
|
import zipfile
|
||||||
|
28
setup.py
28
setup.py
@@ -1,4 +1,13 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##
|
||||||
|
## @author Edouard DUPIN
|
||||||
|
##
|
||||||
|
## @copyright 2012, Edouard DUPIN, all right reserved
|
||||||
|
##
|
||||||
|
## @license APACHE v2.0 (see license file)
|
||||||
|
##
|
||||||
|
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
|
|
||||||
def readme():
|
def readme():
|
||||||
@@ -7,8 +16,8 @@ def readme():
|
|||||||
|
|
||||||
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
|
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
|
||||||
setup(name='lutin',
|
setup(name='lutin',
|
||||||
version='0.5.12',
|
version='1.2.3',
|
||||||
description='Lutin generic builder',
|
description='Lutin generic builder (might replace makefile, CMake ...)',
|
||||||
long_description=readme(),
|
long_description=readme(),
|
||||||
url='http://github.com/HeeroYui/lutin',
|
url='http://github.com/HeeroYui/lutin',
|
||||||
author='Edouard DUPIN',
|
author='Edouard DUPIN',
|
||||||
@@ -19,22 +28,21 @@ setup(name='lutin',
|
|||||||
'lutin/z_system',
|
'lutin/z_system',
|
||||||
'lutin/z_target'],
|
'lutin/z_target'],
|
||||||
classifiers=[
|
classifiers=[
|
||||||
'Development Status :: 3 - Alpha',
|
'Development Status :: 4 - Beta',
|
||||||
'License :: OSI Approved :: Apache Software License',
|
'License :: OSI Approved :: Apache Software License',
|
||||||
'Programming Language :: Python',
|
'Programming Language :: Python',
|
||||||
'Topic :: Software Development :: Compilers',
|
'Topic :: Software Development :: Compilers',
|
||||||
],
|
],
|
||||||
keywords='builder c++ c android ios macos makefile cmake',
|
keywords='builder c++ c android ios macos makefile cmake',
|
||||||
scripts=['bin/lutin'],
|
scripts=['bin/lutin'],
|
||||||
data_file=[
|
# Does not work on MacOs
|
||||||
('/etc/bash_completion.d', ['bash-autocompletion/lutin']),
|
#data_file=[
|
||||||
],
|
# ('/etc/bash_completion.d', ['bash-autocompletion/lutin']),
|
||||||
|
#],
|
||||||
include_package_data = True,
|
include_package_data = True,
|
||||||
install_requires=[
|
|
||||||
'PIL>=1.0.0'
|
|
||||||
],
|
|
||||||
zip_safe=False)
|
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
|
#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