summaryrefslogtreecommitdiffstats
path: root/meta/classes/sip.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/sip.bbclass')
-rw-r--r--meta/classes/sip.bbclass63
1 files changed, 63 insertions, 0 deletions
diff --git a/meta/classes/sip.bbclass b/meta/classes/sip.bbclass
new file mode 100644
index 0000000..711f851
--- /dev/null
+++ b/meta/classes/sip.bbclass
@@ -0,0 +1,63 @@
1# Build Class for Sip based Python Bindings
2# (C) Michael 'Mickey' Lauer <mickey@Vanille.de>
3#
4STAGING_SIPDIR ?= "${STAGING_DATADIR_NATIVE}/sip"
5
6DEPENDS =+ "sip-native"
7RDEPENDS_${PN} += "python-sip"
8
9# default stuff, do not uncomment
10# EXTRA_SIPTAGS = "-tWS_X11 -tQt_4_3_0"
11
12# do_generate is before do_configure so ensure that sip_native is populated in sysroot before executing it
13do_generate[depends] += "sip-native:do_populate_sysroot"
14
15sip_do_generate() {
16 if [ -z "${SIP_MODULES}" ]; then
17 MODULES="`ls sip/*mod.sip`"
18 else
19 MODULES="${SIP_MODULES}"
20 fi
21
22 if [ -z "$MODULES" ]; then
23 die "SIP_MODULES not set and no modules found in $PWD"
24 else
25 bbnote "using modules '${SIP_MODULES}' and tags '${EXTRA_SIPTAGS}'"
26 fi
27
28 if [ -z "${EXTRA_SIPTAGS}" ]; then
29 die "EXTRA_SIPTAGS needs to be set!"
30 else
31 SIPTAGS="${EXTRA_SIPTAGS}"
32 fi
33
34 if [ ! -z "${SIP_FEATURES}" ]; then
35 FEATURES="-z ${SIP_FEATURES}"
36 bbnote "sip feature file: ${SIP_FEATURES}"
37 fi
38
39 for module in $MODULES
40 do
41 install -d ${module}/
42 echo "calling 'sip4 -I sip -I ${STAGING_SIPDIR} ${SIPTAGS} ${FEATURES} -c ${module} -b ${module}/${module}.pro.in sip/${module}/${module}mod.sip'"
43 sip4 -I ${STAGING_SIPDIR} -I sip ${SIPTAGS} ${FEATURES} -c ${module} -b ${module}/${module}.sbf \
44 sip/${module}/${module}mod.sip || die "Error calling sip on ${module}"
45 cat ${module}/${module}.sbf | sed s,target,TARGET, \
46 | sed s,sources,SOURCES, \
47 | sed s,headers,HEADERS, \
48 | sed s,"moc_HEADERS =","HEADERS +=", \
49 >${module}/${module}.pro
50 echo "TEMPLATE=lib" >>${module}/${module}.pro
51 [ "${module}" = "qt" ] && echo "" >>${module}/${module}.pro
52 [ "${module}" = "qtcanvas" ] && echo "" >>${module}/${module}.pro
53 [ "${module}" = "qttable" ] && echo "" >>${module}/${module}.pro
54 [ "${module}" = "qwt" ] && echo "" >>${module}/${module}.pro
55 [ "${module}" = "qtpe" ] && echo "" >>${module}/${module}.pro
56 [ "${module}" = "qtpe" ] && echo "LIBS+=-lqpe" >>${module}/${module}.pro
57 true
58 done
59}
60
61EXPORT_FUNCTIONS do_generate
62
63addtask generate after do_unpack do_patch before do_configure