diff options
Diffstat (limited to 'meta/classes/tmake.bbclass')
-rw-r--r-- | meta/classes/tmake.bbclass | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/meta/classes/tmake.bbclass b/meta/classes/tmake.bbclass new file mode 100644 index 0000000000..05b82e496d --- /dev/null +++ b/meta/classes/tmake.bbclass | |||
@@ -0,0 +1,77 @@ | |||
1 | DEPENDS_prepend="tmake " | ||
2 | |||
3 | python tmake_do_createpro() { | ||
4 | import glob, sys | ||
5 | from bb import note | ||
6 | out_vartranslate = { | ||
7 | "TMAKE_HEADERS": "HEADERS", | ||
8 | "TMAKE_INTERFACES": "INTERFACES", | ||
9 | "TMAKE_TEMPLATE": "TEMPLATE", | ||
10 | "TMAKE_CONFIG": "CONFIG", | ||
11 | "TMAKE_DESTDIR": "DESTDIR", | ||
12 | "TMAKE_SOURCES": "SOURCES", | ||
13 | "TMAKE_DEPENDPATH": "DEPENDPATH", | ||
14 | "TMAKE_INCLUDEPATH": "INCLUDEPATH", | ||
15 | "TMAKE_TARGET": "TARGET", | ||
16 | "TMAKE_LIBS": "LIBS", | ||
17 | } | ||
18 | s = data.getVar('S', d, 1) or "" | ||
19 | os.chdir(s) | ||
20 | profiles = (data.getVar('TMAKE_PROFILES', d, 1) or "").split() | ||
21 | if not profiles: | ||
22 | profiles = ["*.pro"] | ||
23 | for pro in profiles: | ||
24 | ppro = glob.glob(pro) | ||
25 | if ppro: | ||
26 | if ppro != [pro]: | ||
27 | del profiles[profiles.index(pro)] | ||
28 | profiles += ppro | ||
29 | continue | ||
30 | if ppro[0].find('*'): | ||
31 | del profiles[profiles.index(pro)] | ||
32 | continue | ||
33 | else: | ||
34 | del profiles[profiles.index(pro)] | ||
35 | if len(profiles) != 0: | ||
36 | return | ||
37 | |||
38 | # output .pro using this metadata store | ||
39 | try: | ||
40 | from __builtin__ import file | ||
41 | profile = file(data.expand('${PN}.pro', d), 'w') | ||
42 | except OSError: | ||
43 | raise FuncFailed("unable to open pro file for writing.") | ||
44 | |||
45 | # fd = sys.__stdout__ | ||
46 | fd = profile | ||
47 | for var in out_vartranslate.keys(): | ||
48 | val = data.getVar(var, d, 1) | ||
49 | if val: | ||
50 | fd.write("%s\t: %s\n" % (out_vartranslate[var], val)) | ||
51 | |||
52 | # if fd is not sys.__stdout__: | ||
53 | fd.close() | ||
54 | } | ||
55 | |||
56 | tmake_do_configure() { | ||
57 | paths="${STAGING_DATADIR}/tmake/qws/${TARGET_OS}-${TARGET_ARCH}-g++ $STAGING_DIR/share/tmake/$OS-g++" | ||
58 | if (echo "${TARGET_ARCH}"|grep -q 'i.86'); then | ||
59 | paths="${STAGING_DATADIR}/tmake/qws/${TARGET_OS}-x86-g++ $paths" | ||
60 | fi | ||
61 | for i in $paths; do | ||
62 | if test -e $i; then | ||
63 | export TMAKEPATH=$i | ||
64 | break | ||
65 | fi | ||
66 | done | ||
67 | |||
68 | if [ -z "${TMAKE_PROFILES}" ]; then | ||
69 | TMAKE_PROFILES="`ls *.pro`" | ||
70 | fi | ||
71 | tmake -o Makefile $TMAKE_PROFILES || die "Error calling tmake on ${TMAKE_PROFILES}" | ||
72 | } | ||
73 | |||
74 | EXPORT_FUNCTIONS do_configure do_createpro | ||
75 | |||
76 | addtask configure after do_unpack do_patch before do_compile | ||
77 | addtask createpro before do_configure after do_unpack do_patch | ||