Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | # Build Class for Sip based Python Bindings |
| 2 | # (C) Michael 'Mickey' Lauer <mickey@Vanille.de> |
| 3 | # |
| 4 | STAGING_SIPDIR ?= "${STAGING_DATADIR_NATIVE}/sip" |
| 5 | |
| 6 | DEPENDS =+ "sip-native" |
| 7 | RDEPENDS_${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 |
| 13 | do_generate[depends] += "sip-native:do_populate_sysroot" |
| 14 | |
| 15 | sip_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 | sed -e 's,target,TARGET,' -e 's,sources,SOURCES,' -e 's,headers,HEADERS,' \ |
| 46 | ${module}/${module}.sbf | sed s,"moc_HEADERS =","HEADERS +=", \ |
| 47 | >${module}/${module}.pro |
| 48 | echo "TEMPLATE=lib" >>${module}/${module}.pro |
| 49 | [ "${module}" = "qt" ] && echo "" >>${module}/${module}.pro |
| 50 | [ "${module}" = "qtcanvas" ] && echo "" >>${module}/${module}.pro |
| 51 | [ "${module}" = "qttable" ] && echo "" >>${module}/${module}.pro |
| 52 | [ "${module}" = "qwt" ] && echo "" >>${module}/${module}.pro |
| 53 | [ "${module}" = "qtpe" ] && echo "" >>${module}/${module}.pro |
| 54 | [ "${module}" = "qtpe" ] && echo "LIBS+=-lqpe" >>${module}/${module}.pro |
| 55 | true |
| 56 | done |
| 57 | } |
| 58 | |
| 59 | EXPORT_FUNCTIONS do_generate |
| 60 | |
| 61 | addtask generate after do_unpack do_patch before do_configure |