waf-samba.bbclass: add cross-answers option and files

--cross-execute uses qemu to run cross-compiled binaries,
it works fine for qemu supported targets, but it definitely
will fail if the target is not supported by qemu. So we need
to use the cross-answers option.

Added three methods and set 'answer' as default:

1. answers:
   Only --cross-answers - try the cross-answers file, and if
   there's no corresponding answer, add to the file and mark
   the configure process as unfinished.
2. exec:
   Only --cross-execute - get the answer from cross-execute,
   an emulator (qemu) is used to run cross-compiled binaries.
3. both:
   Try the cross-answers file first, and if there is no
   corresponding answer, use cross-execute to get an answer,
   and add that answer to the file.

The cross files in are all generated by qemu when the 'both'
mode is enabled, and are placed in a common directory
LAYERDIR/files/waf-cross-answers which is set as
WAF_CROSS_ANSWERS_PATH in layer.conf of meta-oe,
so that we don't have to put copies of them for each
package (there are 5 packages inerit waf-samba for now)

Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
This commit is contained in:
Jackie Huang
2016-01-06 14:42:48 +08:00
committed by Joe MacDonald
parent 0762fdd1f5
commit fe4106ca0d
12 changed files with 394 additions and 1 deletions

View File

@@ -20,7 +20,38 @@ CONFIGUREOPTS = " --prefix=${prefix} \
--mandir=${mandir} \
"
# Three methods for waf cross compile:
# 1. answers:
# Only --cross-answers - try the cross-answers file, and if
# there's no corresponding answer, add to the file and mark
# the configure process as unfinished.
# 2. exec:
# Only --cross-execute - get the answer from cross-execute,
# an emulator (qemu) is used to run cross-compiled binaries.
# 3. both:
# (notes: not supported in lower version of some packages,
# please check buildtools/wafsamba/samba_cross.py in the
# package source)
# Try the cross-answers file first, and if there is no
# corresponding answer, use cross-execute to get an answer,
# and add that answer to the file.
#
# The first one is preferred since it may fail with 2 or 3 if
# the target board is not suported by qemu, but we can use 2 or 3
# to help generate the cross answer when adding new board support.
CROSS_METHOD ?= "answer"
do_configure() {
# Prepare the cross-answers file
CROSS_ANSWERS="${B}/cross-answers-${TARGET_ARCH}.txt"
if [ -e ${CROSS_ANSWERS} ]; then
rm -f ${CROSS_ANSWERS}
fi
echo 'Checking uname machine type: "${TARGET_ARCH}"' >> ${CROSS_ANSWERS}
echo 'Checking uname release type: "${OLDEST_KERNEL}"' >> ${CROSS_ANSWERS}
cat ${WAF_CROSS_ANSWERS_PATH}/cross-answers-${TARGET_ARCH}.txt >> ${CROSS_ANSWERS}
qemu_binary="${@qemu_target_binary(d)}"
if [ "${qemu_binary}" = "qemu-allarch" ]; then
qemu_binary="qemuwrapper"
@@ -42,7 +73,17 @@ do_configure() {
export STAGING_INCDIR=${STAGING_INCDIR}
export PYTHONPATH=${STAGING_DIR_HOST}${PYTHON_SITEPACKAGES_DIR}
./configure ${CONFIGUREOPTS} ${EXTRA_OECONF} --cross-compile --cross-execute="${CROSS_EXEC}"
CONFIG_CMD="./configure ${CONFIGUREOPTS} ${EXTRA_OECONF} --cross-compile"
if [ "${CROSS_METHOD}" = "answer" ]; then
${CONFIG_CMD} --cross-answers="${CROSS_ANSWERS}"
elif [ "${CROSS_METHOD}" = "exec" ]; then
${CONFIG_CMD} --cross-exec="${CROSS_EXEC}"
elif [ "${CROSS_METHOD}" = "both" ]; then
${CONFIG_CMD} --cross-answers="${CROSS_ANSWERS}" --cross-exec="${CROSS_EXEC}"
else
echo "ERROR: ${CROSS_METHOD} is not valid for cross-compile!"
exit 1
fi
}
do_compile () {