diff options
author | Alexey Neyman <stilor@att.net> | 2016-11-29 00:55:22 (GMT) |
---|---|---|
committer | Alexey Neyman <stilor@att.net> | 2016-12-02 23:03:15 (GMT) |
commit | cf86df688a8e7aeba28767ae0f841022a2e8347b (patch) | |
tree | 1a66218983063c9531b00724d19967cbe5ceed8a /scripts/build/companion_tools/100-m4.sh | |
parent | 3f7fbd7beda5d840cd9a15189a94aaad4a802d37 (diff) |
Add 'companion tools for host' step.
Signed-off-by: Alexey Neyman <stilor@att.net>
Diffstat (limited to 'scripts/build/companion_tools/100-m4.sh')
-rw-r--r-- | scripts/build/companion_tools/100-m4.sh | 57 |
1 files changed, 48 insertions, 9 deletions
diff --git a/scripts/build/companion_tools/100-m4.sh b/scripts/build/companion_tools/100-m4.sh index 6300dd1..96cde39 100644 --- a/scripts/build/companion_tools/100-m4.sh +++ b/scripts/build/companion_tools/100-m4.sh @@ -11,20 +11,59 @@ do_companion_tools_m4_extract() { } do_companion_tools_m4_for_build() { - CT_DoStep EXTRA "Installing m4" - mkdir -p "${CT_BUILD_DIR}/build-m4" - CT_Pushd "${CT_BUILD_DIR}/build-m4" - + CT_DoStep EXTRA "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 EXTRA "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 + + 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" + esac + CT_DoLog EXTRA "Configuring m4" CT_DoExecLog CFG \ - "${CT_SRC_DIR}/m4-${CT_M4_VERSION}/configure" \ - --prefix="${CT_BUILDTOOLS_PREFIX_DIR}" + CFLAGS="${cflags}" \ + LDFLAGS="${ldflags}" \ + "${CT_SRC_DIR}/m4-${CT_M4_VERSION}/configure" \ + --host="${host}" \ + --prefix="${prefix}" CT_DoLog EXTRA "Building m4" CT_DoExecLog ALL make - CT_DoLog EXTRA "Building m4" + CT_DoLog EXTRA "Installing m4" CT_DoExecLog ALL make install - CT_Popd - CT_EndStep } |