summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Neyman <stilor@att.net>2017-03-29 20:26:13 (GMT)
committerAlexey Neyman <stilor@att.net>2017-03-31 02:11:33 (GMT)
commit7111f95dc3513e52ea0c69776432102fb6967498 (patch)
tree0397958e7a4080408e68602345cb4c9d90058d5e
parenta7edff1820d89b45449c7764644fbfa3562e3297 (diff)
MinGW-W64 fixes
- libpthread requires iteration over multilibs, unlike the core, it does not detect and build multilibs by itself. - Disable parallel builds for mingw-w64 components; until mingw-w64 core builds clean, I am not trusting it. - Make the list of tools to build configurable - Turn on multilib in x86_64 sample. - Make warnings about tuple less redundant. As in, "one WARN is enough, no need to shout it three times". - Messages about various steps/substeps are more aligned with the rest of the components. - Use 'make' instead of ${make} to invoke the companion make just built, if applicable. Signed-off-by: Alexey Neyman <stilor@att.net>
-rw-r--r--config/libc/mingw.in20
-rw-r--r--samples/x86_64-w64-mingw32/crosstool.config2
-rw-r--r--scripts/build/libc/glibc.sh2
-rw-r--r--scripts/build/libc/mingw.sh149
4 files changed, 112 insertions, 61 deletions
diff --git a/config/libc/mingw.in b/config/libc/mingw.in
index 936fd67..0f05845 100644
--- a/config/libc/mingw.in
+++ b/config/libc/mingw.in
@@ -129,16 +129,20 @@ config WINAPI_VERSION
Enter the version number of the Windows API files to use
config MINGW_DIRECTX
- bool
- prompt "Include DirectX development files"
+ bool "Include DirectX development files"
config MINGW_DDK
- bool
- prompt "Include DDK development files"
+ bool "Include DDK development files"
config MINGW_TOOLS
- bool
- prompt "Include the companion tools"
+ bool "Include the companion tools"
+ default y
+ help
+ Build the companion tools with mingw such as widl, gendef,
+ and genpeimg.
+
+config MINGW_TOOL_LIST_ARRAY
+ string "List of mingw-w64 tools to build"
+ default "gendef genidl genlib genpeimg widl"
help
- build the companion tools with mingw such as widl, gendef,
- and genpeimg
+ List of mingw-w64 tools to build.
diff --git a/samples/x86_64-w64-mingw32/crosstool.config b/samples/x86_64-w64-mingw32/crosstool.config
index 1e92289..253cb1c 100644
--- a/samples/x86_64-w64-mingw32/crosstool.config
+++ b/samples/x86_64-w64-mingw32/crosstool.config
@@ -1,12 +1,12 @@
CT_EXPERIMENTAL=y
CT_ARCH_x86=y
+CT_MULTILIB=y
CT_ARCH_64=y
CT_TARGET_VENDOR="w64"
CT_KERNEL_windows=y
CT_BINUTILS_PLUGINS=y
CT_MINGW_DIRECTX=y
CT_MINGW_DDK=y
-CT_MINGW_TOOLS=y
CT_THREADS_POSIX=y
CT_CC_LANG_CXX=y
CT_CC_LANG_FORTRAN=y
diff --git a/scripts/build/libc/glibc.sh b/scripts/build/libc/glibc.sh
index a630633..3eac3ba 100644
--- a/scripts/build/libc/glibc.sh
+++ b/scripts/build/libc/glibc.sh
@@ -158,7 +158,7 @@ do_libc_backend() {
# libc_mode : 'startfiles' or 'final' : string : (empty)
# multi_* : as defined in CT_IterateMultilibs : (varies) :
do_libc_backend_once() {
- local multi_flags multi_dir multi_os_dir multi_root multi_index multi_count
+ local multi_flags multi_dir multi_os_dir multi_root multi_index multi_count multi_target
local build_cflags build_cppflags build_ldflags
local startfiles_dir
local src_dir="${CT_SRC_DIR}/${CT_LIBC}-${CT_LIBC_VERSION}"
diff --git a/scripts/build/libc/mingw.sh b/scripts/build/libc/mingw.sh
index a2c25ec..3379d68 100644
--- a/scripts/build/libc/mingw.sh
+++ b/scripts/build/libc/mingw.sh
@@ -74,23 +74,27 @@ do_check_mingw_vendor_tuple()
if [[ ${CT_WINAPI_VERSION} == 4* ]]; then
CT_DoStep INFO "Checking vendor tuple configured in crosstool-ng .config"
if [[ ${CT_TARGET_VENDOR} == w64 ]]; then
- CT_DoLog EXTRA "The tuple is set to '${CT_TARGET_VENDOR}', as recommended by mingw-64 team."
+ CT_DoLog EXTRA "The tuple is set to '${CT_TARGET_VENDOR}', as recommended by mingw-64 developers."
else
- CT_DoLog WARN "WARNING! The tuple '${CT_TARGET_VENDOR}', is not equal to w64 and might break the toolchain! WARNING!"
+ CT_DoLog WARN "The tuple vendor is '${CT_TARGET_VENDOR}', not equal to 'w64' and might break the toolchain!"
fi
CT_EndStep
fi
}
-do_mingw_tools() {
- for f in gendef genidl genlib genpeimg widl
- do
- if [[ ! -d "${CT_SRC_DIR}/mingw-w64-${CT_WINAPI_VERSION_DOWNLOADED}/mingw-w64-tools/${f}" ]]; then
- continue;
+do_mingw_tools()
+{
+ local f
+
+ for f in "${CT_MINGW_TOOL_LIST_ARRAY[@]}"; do
+ CT_mkdir_pushd "${f}"
+ if [ ! -d "${CT_SRC_DIR}/mingw-w64-${CT_WINAPI_VERSION_DOWNLOADED}/mingw-w64-tools/${f}" ]; then
+ CT_DoLog WARN "Skipping ${f}: not found"
+ CT_Popd
+ continue
fi
- CT_mkdir_pushd "${CT_BUILD_DIR}/build-mingw-w64-tools/${f}"
-
+ CT_DoLog EXTRA "Configuring ${f}"
CT_DoExecLog CFG \
${CONFIG_SHELL} \
"${CT_SRC_DIR}/mingw-w64-${CT_WINAPI_VERSION_DOWNLOADED}/mingw-w64-tools/${f}/configure" \
@@ -100,31 +104,92 @@ do_mingw_tools() {
--program-prefix=${CT_TARGET}- \
--prefix="${CT_PREFIX_DIR}"
- CT_DoExecLog ALL ${make} ${JOBSFLAGS}
+ # mingw-w64 has issues with parallel builds, see do_libc
+ CT_DoLog EXTRA "Building ${f}"
+ CT_DoExecLog ALL make
+ CT_DoLog EXTRA "Installing ${f}"
+ CT_DoExecLog ALL make install
+ CT_Popd
+ done
+}
- CT_DoExecLog ALL ${make} install
+do_mingw_pthreads()
+{
+ local multi_flags multi_dir multi_os_dir multi_root multi_index multi_count multi_target
+ local libprefix
+ local rcflags dlltoolflags
- CT_Popd
+ for arg in "$@"; do
+ eval "${arg// /\\ }"
done
+
+ CT_DoStep INFO "Building for multilib ${multi_index}/${multi_count}: '${multi_flags}'"
+
+ libprefix="${MINGW_INSTALL_PREFIX}/lib/${multi_os_dir}"
+ CT_SanitizeVarDir libprefix
+
+ CT_SymlinkToolsMultilib
+
+ # DLLTOOLFLAGS does not appear to be currently used by winpthread package, but
+ # the master package uses this variable and describes this as one of the changes
+ # needed for i686 in mingw-w64-doc/howto-build/mingw-w64-howto-build-adv.txt
+ case "${multi_target}" in
+ i[3456]86-*)
+ rcflags="-F pe-i386"
+ dlltoolflags="-m i386"
+ ;;
+ x86_64-*)
+ rcflags="-F pe-x86-64"
+ dlltoolflags="-m i386:x86_64"
+ ;;
+ *)
+ CT_Abort "Tuple ${multi_target} is not supported by mingw-w64"
+ ;;
+ esac
+
+ CT_DoLog EXTRA "Configuring mingw-w64-winpthreads"
+
+ CT_DoExecLog CFG \
+ CFLAGS="${multi_flags}" \
+ CXXFLAGS="${multi_flags}" \
+ RCFLAGS="${rcflags}" \
+ DLLTOOLFLAGS="${dlltoolflags}" \
+ ${CONFIG_SHELL} \
+ "${CT_SRC_DIR}/mingw-w64-${CT_WINAPI_VERSION_DOWNLOADED}/mingw-w64-libraries/winpthreads/configure" \
+ --with-sysroot=${CT_SYSROOT_DIR} \
+ --prefix=${MINGW_INSTALL_PREFIX} \
+ --libdir=${libprefix} \
+ --build=${CT_BUILD} \
+ --host=${multi_target}
+
+ # mingw-w64 has issues with parallel builds, see do_libc
+ CT_DoLog EXTRA "Building mingw-w64-winpthreads"
+ CT_DoExecLog ALL make
+
+ CT_DoLog EXTRA "Installing mingw-w64-winpthreads"
+ CT_DoExecLog ALL make install DESTDIR=${CT_SYSROOT_DIR}
+
+ CT_EndStep
}
-do_libc() {
+do_libc()
+{
do_check_mingw_vendor_tuple
- CT_DoStep INFO "Building mingw-w64 files"
+ CT_DoStep INFO "Building mingw-w64"
CT_DoLog EXTRA "Configuring mingw-w64-crt"
CT_mkdir_pushd "${CT_BUILD_DIR}/build-mingw-w64-crt"
do_set_mingw_install_prefix
- CT_DoExecLog CFG \
- ${CONFIG_SHELL} \
+ CT_DoExecLog CFG \
+ ${CONFIG_SHELL} \
"${CT_SRC_DIR}/mingw-w64-${CT_WINAPI_VERSION_DOWNLOADED}/mingw-w64-crt/configure" \
- --with-sysroot=${CT_SYSROOT_DIR} \
- --prefix=${MINGW_INSTALL_PREFIX} \
- --build=${CT_BUILD} \
- --host=${CT_TARGET} \
+ --with-sysroot=${CT_SYSROOT_DIR} \
+ --prefix=${MINGW_INSTALL_PREFIX} \
+ --build=${CT_BUILD} \
+ --host=${CT_TARGET}
# mingw-w64-crt has a missing dependency occasionally breaking the
# parallel build. See https://github.com/crosstool-ng/crosstool-ng/issues/246
@@ -134,43 +199,25 @@ do_libc() {
CT_DoLog EXTRA "Installing mingw-w64-crt"
CT_DoExecLog ALL make install DESTDIR=${CT_SYSROOT_DIR}
-
- if [[ ${CT_MINGW_TOOLS} == "y" ]]; then
- CT_DoLog EXTRA "Installing mingw-w64 companion tools"
- do_mingw_tools
- fi
-
CT_EndStep
if [ "${CT_THREADS}" = "posix" ]; then
- do_pthreads
+ CT_DoStep INFO "Building mingw-w64-winpthreads"
+ CT_mkdir_pushd "${CT_BUILD_DIR}/build-mingw-w64-winpthreads"
+ CT_IterateMultilibs do_mingw_pthreads pthreads-multilib
+ CT_Popd
+ CT_EndStep
+ fi
+
+ if [ ${CT_MINGW_TOOLS} = "y" ]; then
+ CT_DoStep INFO "Installing mingw-w64 companion tools"
+ CT_mkdir_pushd "${CT_BUILD_DIR}/build-mingw-w64-tools"
+ do_mingw_tools
+ CT_Popd
+ CT_EndStep
fi
}
do_libc_post_cc() {
:
}
-
-do_pthreads() {
- CT_DoStep INFO "Building mingw-w64-winpthreads files"
-
- CT_DoLog EXTRA "Configuring mingw-w64-winpthreads"
-
- CT_mkdir_pushd "${CT_BUILD_DIR}/build-mingw-w64-winpthreads"
-
- CT_DoExecLog CFG \
- ${CONFIG_SHELL} \
- "${CT_SRC_DIR}/mingw-w64-${CT_WINAPI_VERSION_DOWNLOADED}/mingw-w64-libraries/winpthreads/configure" \
- --with-sysroot=${CT_SYSROOT_DIR} \
- --prefix=${MINGW_INSTALL_PREFIX} \
- --build=${CT_BUILD} \
- --host=${CT_TARGET} \
-
- CT_DoLog EXTRA "Building mingw-w64-winpthreads"
- CT_DoExecLog ALL make ${JOBSFLAGS}
-
- CT_DoLog EXTRA "Installing mingw-w64-winpthreads"
- CT_DoExecLog ALL make install DESTDIR=${CT_SYSROOT_DIR}
-
- CT_EndStep
-}