aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Rothenpieler <timo@rothenpieler.org>2023-05-30 13:47:19 +0200
committerChris Packham <judge.packham@gmail.com>2023-06-04 10:03:32 +1200
commit0160064f00b158a0a672a04f25fbb0968ac59cdf (patch)
tree6e5a76c493bc51a4b97e094e82320554bc5985db
parentd855363eee3848fd5c5f3aa1477a7d03fa4886c0 (diff)
downloadcrosstool-ng-0160064f00b158a0a672a04f25fbb0968ac59cdf.tar.gz
crosstool-ng-0160064f00b158a0a672a04f25fbb0968ac59cdf.tar.bz2
crosstool-ng-0160064f00b158a0a672a04f25fbb0968ac59cdf.zip
Add default msvcrt options for mingw-w64
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
-rw-r--r--config/libc/mingw-w64.in36
-rw-r--r--scripts/build/libc/mingw-w64.sh20
2 files changed, 55 insertions, 1 deletions
diff --git a/config/libc/mingw-w64.in b/config/libc/mingw-w64.in
index 2531fef7..58bb4e8c 100644
--- a/config/libc/mingw-w64.in
+++ b/config/libc/mingw-w64.in
@@ -17,6 +17,42 @@ config MINGW_SECURE_API
bool "Expose secure API prototypes"
default y
+choice
+ bool
+ prompt "Default C Runtime to use"
+ default MINGW_DEFAULT_MSVCRT_DEFAULT
+ help
+ See mingw-w64 help for full list of possible values.
+ Most commonly one would want to upgrade this to ucrt
+ for a more modern C runtime.
+ Targeting specific older/newer MSVC versions is possible
+ as well though.
+
+config MINGW_DEFAULT_MSVCRT_DEFAULT
+ bool
+ prompt "Default"
+ help
+ Don't set a default msvcrt, leave decision to mingw.
+
+config MINGW_DEFAULT_MSVCRT_MSVCRT
+ bool
+ prompt "msvcrt"
+
+config MINGW_DEFAULT_MSVCRT_UCRT
+ bool
+ prompt "ucrt"
+
+config MINGW_DEFAULT_MSVCRT_CUSTOM
+ bool
+ prompt "Custom"
+
+endchoice
+
+config MINGW_DEFAULT_MSVCRT
+ string "Custom default C Runtime to use"
+ depends on MINGW_DEFAULT_MSVCRT_CUSTOM
+ default ""
+
config MINGW_DIRECTX
bool "Include DirectX development files"
diff --git a/scripts/build/libc/mingw-w64.sh b/scripts/build/libc/mingw-w64.sh
index 54e8d07c..d4f3634f 100644
--- a/scripts/build/libc/mingw-w64.sh
+++ b/scripts/build/libc/mingw-w64.sh
@@ -25,6 +25,14 @@ mingw_w64_headers() {
sdk_opts+=( "--enable-secure-api" )
fi
+ if [ "${CT_MINGW_DEFAULT_MSVCRT_MSVCRT}" = "y" ]; then
+ sdk_opts+=( "--with-default-msvcrt=msvcrt" )
+ elif [ "${CT_MINGW_DEFAULT_MSVCRT_UCRT}" = "y" ]; then
+ sdk_opts+=( "--with-default-msvcrt=ucrt" )
+ elif [ -n "${CT_MINGW_DEFAULT_MSVCRT}" ]; then
+ sdk_opts+=( "--with-default-msvcrt=${CT_MINGW_DEFAULT_MSVCRT}" )
+ fi
+
CT_mkdir_pushd "${CT_BUILD_DIR}/build-mingw-w64-headers"
CT_DoLog EXTRA "Configuring Headers"
@@ -174,6 +182,7 @@ mingw_w64_main()
{
# Used when iterating over libwinpthread
local default_libprefix
+ local -a crt_opts
do_check_mingw_vendor_tuple
@@ -183,6 +192,14 @@ mingw_w64_main()
CT_mkdir_pushd "${CT_BUILD_DIR}/build-mingw-w64-crt"
+ if [ "${CT_MINGW_DEFAULT_MSVCRT_MSVCRT}" = "y" ]; then
+ crt_opts+=( "--with-default-msvcrt=msvcrt" )
+ elif [ "${CT_MINGW_DEFAULT_MSVCRT_UCRT}" = "y" ]; then
+ crt_opts+=( "--with-default-msvcrt=ucrt" )
+ elif [ -n "${CT_MINGW_DEFAULT_MSVCRT}" ]; then
+ crt_opts+=( "--with-default-msvcrt=${CT_MINGW_DEFAULT_MSVCRT}" )
+ fi
+
mingw_w64_set_install_prefix
CT_DoExecLog CFG \
${CONFIG_SHELL} \
@@ -190,7 +207,8 @@ mingw_w64_main()
--with-sysroot=${CT_SYSROOT_DIR} \
--prefix=${MINGW_INSTALL_PREFIX} \
--build=${CT_BUILD} \
- --host=${CT_TARGET}
+ --host=${CT_TARGET} \
+ "${crt_opts[@]}"
# mingw-w64-crt has a missing dependency occasionally breaking the
# parallel build. See https://github.com/crosstool-ng/crosstool-ng/issues/246