xmms: bump PR
[openembedded.git] / classes / tmake.bbclass
blobdbd0bf2763cd1f3a0cf6c3f18f60731a74844bf5
1 DEPENDS_prepend="tmake "
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
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.")
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))
52 #       if fd is not sys.__stdout__:
53         fd.close()
56 tmake_do_configure() {
57         paths="${STAGING_DATADIR}/tmake/qws/${TARGET_OS}-${TARGET_ARCH}-g++ ${STAGING_DATADIR}/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
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}"
74 EXPORT_FUNCTIONS do_configure do_createpro
76 addtask configure after do_unpack do_patch before do_compile
77 addtask createpro before do_configure after do_unpack do_patch