| Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 1 | # waf is a build system which is used by samba related project. | 
 | 2 | # Obtain details from https://wiki.samba.org/index.php/Waf | 
 | 3 | #  | 
 | 4 | inherit qemu pythonnative | 
 | 5 |  | 
 | 6 | DEPENDS += "qemu-native libxslt-native docbook-xsl-stylesheets-native python" | 
 | 7 |  | 
 | 8 | CONFIGUREOPTS = " --prefix=${prefix} \ | 
 | 9 |                   --bindir=${bindir} \ | 
 | 10 |                   --sbindir=${sbindir} \ | 
 | 11 |                   --libexecdir=${libexecdir} \ | 
 | 12 |                   --datadir=${datadir} \ | 
 | 13 |                   --sysconfdir=${sysconfdir} \ | 
 | 14 |                   --sharedstatedir=${sharedstatedir} \ | 
 | 15 |                   --localstatedir=${localstatedir} \ | 
 | 16 |                   --libdir=${libdir} \ | 
 | 17 |                   --includedir=${includedir} \ | 
 | 18 |                   --oldincludedir=${oldincludedir} \ | 
 | 19 |                   --infodir=${infodir} \ | 
 | 20 |                   --mandir=${mandir} \ | 
| Patrick Williams | ddad1a1 | 2017-02-23 20:36:32 -0600 | [diff] [blame] | 21 |                   ${PACKAGECONFIG_CONFARGS} \ | 
| Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 22 |                 " | 
 | 23 |  | 
 | 24 | # Three methods for waf cross compile: | 
 | 25 | # 1. answers: | 
 | 26 | #    Only --cross-answers - try the cross-answers file, and if | 
 | 27 | #    there's no corresponding answer, add to the file and mark | 
 | 28 | #    the configure process as unfinished. | 
 | 29 | # 2. exec: | 
 | 30 | #    Only --cross-execute - get the answer from cross-execute, | 
 | 31 | #    an emulator (qemu) is used to run cross-compiled binaries. | 
 | 32 | # 3. both: | 
 | 33 | #    (notes: not supported in lower version of some packages, | 
 | 34 | #     please check buildtools/wafsamba/samba_cross.py in the | 
 | 35 | #     package source) | 
 | 36 | #    Try the cross-answers file first, and if there is no | 
 | 37 | #    corresponding answer, use cross-execute to get an answer, | 
 | 38 | #    and add that answer to the file. | 
 | 39 | # | 
 | 40 | # The first one is preferred since it may fail with 2 or 3 if | 
 | 41 | # the target board is not suported by qemu, but we can use 2 or 3 | 
 | 42 | # to help generate the cross answer when adding new board support. | 
 | 43 | CROSS_METHOD ?= "answer" | 
 | 44 |  | 
 | 45 | do_configure() { | 
 | 46 |  | 
 | 47 |     # Prepare the cross-answers file | 
 | 48 |     CROSS_ANSWERS="${B}/cross-answers-${TARGET_ARCH}.txt" | 
 | 49 |     if [ -e ${CROSS_ANSWERS} ]; then | 
 | 50 |         rm -f ${CROSS_ANSWERS} | 
 | 51 |     fi | 
 | 52 |     echo 'Checking uname machine type: "${TARGET_ARCH}"' >> ${CROSS_ANSWERS} | 
 | 53 |     echo 'Checking uname release type: "${OLDEST_KERNEL}"' >> ${CROSS_ANSWERS} | 
 | 54 |     cat ${WAF_CROSS_ANSWERS_PATH}/cross-answers-${TARGET_ARCH}.txt >> ${CROSS_ANSWERS} | 
 | 55 |  | 
 | 56 |     qemu_binary="${@qemu_target_binary(d)}" | 
 | 57 |     if [ "${qemu_binary}" = "qemu-allarch" ]; then | 
 | 58 |         qemu_binary="qemuwrapper" | 
 | 59 |     fi | 
 | 60 |  | 
 | 61 |     libdir_qemu="${STAGING_DIR_HOST}/${libdir}" | 
 | 62 |     base_libdir_qemu="${STAGING_DIR_HOST}/${base_libdir}" | 
 | 63 |  | 
 | 64 |     CROSS_EXEC="${qemu_binary} \ | 
 | 65 |                 ${QEMU_OPTIONS} \ | 
 | 66 |                 -L ${STAGING_DIR_HOST} \ | 
 | 67 |                 -E LD_LIBRARY_PATH=${libdir_qemu}:${base_libdir_qemu}" | 
 | 68 |  | 
| Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 69 |     export BUILD_ARCH=${BUILD_ARCH} | 
 | 70 |     export HOST_ARCH=${HOST_ARCH} | 
 | 71 |     export STAGING_LIBDIR=${STAGING_LIBDIR} | 
 | 72 |     export STAGING_INCDIR=${STAGING_INCDIR} | 
 | 73 |     export PYTHONPATH=${STAGING_DIR_HOST}${PYTHON_SITEPACKAGES_DIR} | 
 | 74 |  | 
 | 75 |     CONFIG_CMD="./configure ${CONFIGUREOPTS} ${EXTRA_OECONF} --cross-compile" | 
 | 76 |     if [ "${CROSS_METHOD}" = "answer" ]; then | 
 | 77 |         ${CONFIG_CMD} --cross-answers="${CROSS_ANSWERS}" | 
 | 78 |     elif [ "${CROSS_METHOD}" = "exec" ]; then | 
 | 79 |         ${CONFIG_CMD} --cross-exec="${CROSS_EXEC}" | 
 | 80 |     elif [ "${CROSS_METHOD}" = "both" ]; then | 
 | 81 |         ${CONFIG_CMD} --cross-answers="${CROSS_ANSWERS}" --cross-exec="${CROSS_EXEC}" | 
 | 82 |     else | 
 | 83 |         echo "ERROR: ${CROSS_METHOD} is not valid for cross-compile!" | 
 | 84 |         exit 1 | 
 | 85 |     fi | 
 | 86 | } | 
 | 87 |  | 
 | 88 | do_compile () { | 
 | 89 |     python ./buildtools/bin/waf ${PARALLEL_MAKE} | 
 | 90 | } | 
 | 91 |  | 
 | 92 | do_install() { | 
 | 93 |     oe_runmake install DESTDIR=${D} | 
 | 94 | } |