1#
2# Copyright OpenEmbedded Contributors
3#
4# SPDX-License-Identifier: MIT
5#
6
7inherit python3native
8
9DEPENDS += "python3-scons-native"
10
11EXTRA_OESCONS ?= ""
12# This value below is derived from $(getconf ARG_MAX)
13SCONS_MAXLINELENGTH ?= "MAXLINELENGTH=2097152"
14EXTRA_OESCONS:append = " ${SCONS_MAXLINELENGTH}"
15do_configure() {
16	if [ -n "${CONFIGURESTAMPFILE}" -a "${S}" = "${B}" ]; then
17		if [ -e "${CONFIGURESTAMPFILE}" -a "`cat ${CONFIGURESTAMPFILE}`" != "${BB_TASKHASH}" -a "${CLEANBROKEN}" != "1" ]; then
18			${STAGING_BINDIR_NATIVE}/scons --directory=${S} --clean PREFIX=${prefix} prefix=${prefix} ${EXTRA_OESCONS}
19		fi
20
21		mkdir -p `dirname ${CONFIGURESTAMPFILE}`
22		echo ${BB_TASKHASH} > ${CONFIGURESTAMPFILE}
23	fi
24}
25
26scons_do_compile() {
27	${STAGING_BINDIR_NATIVE}/scons --directory=${S} ${PARALLEL_MAKE} PREFIX=${prefix} prefix=${prefix} ${EXTRA_OESCONS} || \
28	die "scons build execution failed."
29}
30
31scons_do_install() {
32	${STAGING_BINDIR_NATIVE}/scons --directory=${S} install_root=${D}${prefix} PREFIX=${prefix} prefix=${prefix} ${EXTRA_OESCONS} install || \
33	die "scons install execution failed."
34}
35
36do_configure[vardepsexclude] = "SCONS_MAXLINELENGTH"
37do_compile[vardepsexclude] = "SCONS_MAXLINELENGTH"
38do_install[vardepsexclude] = "SCONS_MAXLINELENGTH"
39
40EXPORT_FUNCTIONS do_compile do_install
41