mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2024-12-25 15:31:05 +00:00
1c93176e05
While building a canadian toolchain for windows host (any target), the build failed for m4 host companion_tool with a recent mingw-w64 (at least 7.0.0). m4 needs stack smashing protection which is not part of mingw-w64 c library and an explicit trigger to link w/ libssp is needed. Signed-off-by: Florent Valette <florent.valette@gmail.com>
82 lines
1.9 KiB
Bash
82 lines
1.9 KiB
Bash
# Build script for m4
|
|
|
|
do_companion_tools_m4_get()
|
|
{
|
|
CT_Fetch M4
|
|
}
|
|
|
|
do_companion_tools_m4_extract()
|
|
{
|
|
CT_ExtractPatch M4
|
|
}
|
|
|
|
do_companion_tools_m4_for_build()
|
|
{
|
|
CT_DoStep INFO "Installing m4 for build"
|
|
CT_mkdir_pushd "${CT_BUILD_DIR}/build-m4-build"
|
|
do_m4_backend \
|
|
host=${CT_BUILD} \
|
|
prefix="${CT_BUILD_COMPTOOLS_DIR}" \
|
|
cflags="${CT_CFLAGS_FOR_BUILD}" \
|
|
ldflags="${CT_LDFLAGS_FOR_BUILD}"
|
|
CT_Popd
|
|
CT_EndStep
|
|
}
|
|
|
|
do_companion_tools_m4_for_host()
|
|
{
|
|
CT_DoStep INFO "Installing m4 for host"
|
|
CT_mkdir_pushd "${CT_BUILD_DIR}/build-m4-host"
|
|
do_m4_backend \
|
|
host=${CT_HOST} \
|
|
prefix="${CT_PREFIX_DIR}" \
|
|
cflags="${CT_CFLAGS_FOR_HOST}" \
|
|
ldflags="${CT_LDFLAGS_FOR_HOST}"
|
|
CT_Popd
|
|
CT_EndStep
|
|
}
|
|
|
|
do_m4_backend()
|
|
{
|
|
local host
|
|
local prefix
|
|
local cflags
|
|
local ldflags
|
|
local libs
|
|
|
|
for arg in "$@"; do
|
|
eval "${arg// /\\ }"
|
|
done
|
|
|
|
case "${host}" in
|
|
*-uclibc)
|
|
# uClibc has posix_spawn in librt, but m4 configure only
|
|
# searches in libc. This leads to a later failure when
|
|
# it includes system <spawn.h> but expects a locally-built
|
|
# posix_spawn().
|
|
ldflags="${ldflags} -lrt"
|
|
;;
|
|
*-mingw32)
|
|
# m4 is built with stack smashing protection enabled which
|
|
# is not part of mingw-w64 c library in v7.0.0 and later.
|
|
libs="${libs} -lssp"
|
|
;;
|
|
esac
|
|
|
|
CT_DoLog EXTRA "Configuring m4"
|
|
CT_DoExecLog CFG \
|
|
CFLAGS="${cflags}" \
|
|
LDFLAGS="${ldflags}" \
|
|
LIBS="${libs}" \
|
|
${CONFIG_SHELL} \
|
|
"${CT_SRC_DIR}/m4/configure" \
|
|
--host="${host}" \
|
|
--prefix="${prefix}"
|
|
|
|
CT_DoLog EXTRA "Building m4"
|
|
CT_DoExecLog ALL make
|
|
|
|
CT_DoLog EXTRA "Installing m4"
|
|
CT_DoExecLog ALL make install
|
|
}
|