mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2025-01-20 03:36:37 +00:00
kernel: add mingw
Add the option to build a cross-compiler for kernel type 'mingw'. The resulting cross-compiler can be used to build applications on a Linux host that can be run on a Windows target. Compiler is build using the mingwrt and w32-api packages aviable from the MinGW project (http://sourceforge.net/projects/mingw). The windows headers (w32-api package) are extracting with the kernel_headers step The libraries and other headers from both packages are build and installed in the various steps of libc Signed-off-by: Bart vdr Meulen <bartvdrmeulen@gmail.com> [yann.morin.1998@anciens.enib.fr: fix kernel headers comment, don't "return 0"] Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
This commit is contained in:
parent
7707f0fb54
commit
b81d232a9b
@ -8,6 +8,10 @@ config BARE_METAL
|
||||
bool
|
||||
default n
|
||||
|
||||
config MINGW32
|
||||
bool
|
||||
default n
|
||||
|
||||
# Each target OS (aka kernel) that support shared libraries can select
|
||||
# this, so the user can decide whether or not to build a shared library
|
||||
# enabled toolchain
|
||||
|
32
config/kernel/mingw32.in
Normal file
32
config/kernel/mingw32.in
Normal file
@ -0,0 +1,32 @@
|
||||
# mingw32 config options
|
||||
|
||||
config KERNEL_mingw32
|
||||
select MINGW32
|
||||
help
|
||||
Build a toolchain targeting systems running Windows as host
|
||||
|
||||
choice
|
||||
bool
|
||||
prompt "Windows api version"
|
||||
|
||||
# Don't remove next line
|
||||
# CT_INSERT_VERSION_BELOW
|
||||
config W32API_V_3_14
|
||||
bool
|
||||
prompt "3.14"
|
||||
|
||||
config W32API_V_select
|
||||
bool
|
||||
prompt "Other version"
|
||||
|
||||
endchoice
|
||||
|
||||
config W32API_VERSION
|
||||
string
|
||||
prompt "W32 api version" if W32API_V_select
|
||||
# Don't remove next line
|
||||
# CT_INSERT_VERSION_STRING_BELOW
|
||||
default "3.14" if W32API_V_3_14
|
||||
help
|
||||
Enter the version number of the windows api files to use
|
||||
|
@ -35,10 +35,16 @@ config LIBC_SUPPORT_LINUXTHREADS
|
||||
default n
|
||||
select LIBC_SUPPORT_THREADS_ANY
|
||||
|
||||
config LIBC_SUPPORT_WIN32THREADS
|
||||
bool
|
||||
default n
|
||||
select LIBC_SUPPORT_THREADS_ANY
|
||||
|
||||
config THREADS
|
||||
string
|
||||
default "nptl" if THREADS_NPTL
|
||||
default "linuxthreads" if THREADS_LINUXTHREADS
|
||||
default "win32" if THREADS_WIN32THREADS
|
||||
default "none" if THREADS_NONE || LIBC_none
|
||||
# No C library, no threads!
|
||||
|
||||
@ -51,6 +57,7 @@ choice
|
||||
prompt "Threading implementation to use:"
|
||||
default THREADS_NPTL if LIBC_SUPPORT_NPTL
|
||||
default THREADS_LINUXTHREADS if LIBC_SUPPORT_LINUXTHREADS && ! LIBC_SUPPORT_NPTL
|
||||
default THREADS_WIN32 if LIBC_SUPPORT_WIN32THREADS
|
||||
default THREADS_NONE if ! LIBC_SUPPORT_THREADS_ANY
|
||||
|
||||
config THREADS_NPTL
|
||||
@ -63,6 +70,11 @@ config THREADS_LINUXTHREADS
|
||||
prompt "linuxthreads"
|
||||
depends on LIBC_SUPPORT_LINUXTHREADS
|
||||
|
||||
config THREADS_WIN32THREADS
|
||||
bool
|
||||
prompt "win32"
|
||||
depends on LIBC_SUPPORT_WIN32THREADS
|
||||
|
||||
config THREADS_NONE
|
||||
bool
|
||||
prompt "none"
|
||||
|
@ -1,5 +1,5 @@
|
||||
# eglibc options
|
||||
# depends on ! BARE_METAL && ARCH_USE_MMU
|
||||
# depends on ! MINGW32 && ! BARE_METAL && ARCH_USE_MMU
|
||||
|
||||
config LIBC_eglibc
|
||||
select LIBC_SUPPORT_NPTL
|
||||
|
@ -1,5 +1,5 @@
|
||||
# glibc options
|
||||
# depends on ! BARE_METAL && ARCH_USE_MMU
|
||||
# depends on ! MINGW32 && ! BARE_METAL && ARCH_USE_MMU
|
||||
|
||||
config LIBC_glibc
|
||||
select LIBC_SUPPORT_NPTL
|
||||
|
34
config/libc/mingw.in
Normal file
34
config/libc/mingw.in
Normal file
@ -0,0 +1,34 @@
|
||||
# mingw options
|
||||
# depends on MINGW32
|
||||
|
||||
config LIBC_mingw
|
||||
bool
|
||||
select LIBC_SUPPORT_WIN32THREADS
|
||||
help
|
||||
The de-facto standard for Mingw distributions.
|
||||
|
||||
choice
|
||||
bool
|
||||
prompt "Mingw runtime version"
|
||||
|
||||
# Don't remove next line
|
||||
# CT_INSERT_VERSION_BELOW
|
||||
config MINGWRT_V_3_18
|
||||
bool
|
||||
prompt "3.18"
|
||||
|
||||
config MINGWRT_V_select
|
||||
bool
|
||||
prompt "Other version"
|
||||
|
||||
endchoice
|
||||
|
||||
config MINGWRT_VERSION
|
||||
string
|
||||
prompt "Mingw runtime version" if MINGWRT_V_select
|
||||
# Don't remove next line
|
||||
# CT_INSERT_VERSION_STRING_BELOW
|
||||
default "3.18" if MINGWRT_V_3_18
|
||||
help
|
||||
Enter the version number of the mingw runtime files to use
|
||||
|
@ -1,5 +1,5 @@
|
||||
# uClibc options
|
||||
# depends on ! BARE_METAL
|
||||
# depends on ! MINGW32 && ! BARE_METAL
|
||||
|
||||
config LIBC_uClibc
|
||||
select LIBC_SUPPORT_LINUXTHREADS
|
||||
|
@ -68,6 +68,8 @@ do_cc_core_pass_2() {
|
||||
,,nptl)
|
||||
do_cc_core mode=shared build_libgcc=yes
|
||||
;;
|
||||
,,win32) do_cc_core mode=static build_libgcc=yes
|
||||
;;
|
||||
*) if [ "${CT_CC_GCC_4_3_or_later}" = "y" ]; then
|
||||
do_cc_core mode=static build_libgcc=yes
|
||||
else
|
||||
@ -361,7 +363,12 @@ do_cc() {
|
||||
extra_config+=("--disable-libgomp")
|
||||
fi
|
||||
else
|
||||
extra_config+=("--enable-threads=posix")
|
||||
if [ "${CT_THREADS}" = "win32" ]; then
|
||||
extra_config+=("--enable-threads=win32")
|
||||
extra_config+=("--disable-win32-registry")
|
||||
else
|
||||
extra_config+=("--enable-threads=posix")
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${CT_CC_GCC_ENABLE_TARGET_OPTSPACE}" = "y" ]; then
|
||||
|
27
scripts/build/kernel/mingw32.sh
Normal file
27
scripts/build/kernel/mingw32.sh
Normal file
@ -0,0 +1,27 @@
|
||||
# This file declares functions to install the kernel headers for mingw
|
||||
# Copyright 2009 Bart vdr. Meulen
|
||||
# Licensed under the GPL v2. See COPYING in the root of this package
|
||||
|
||||
CT_DoKernelTupleValues() {
|
||||
CT_TARGET_KERNEL="mingw32"
|
||||
CT_TARGET_SYS=
|
||||
}
|
||||
|
||||
do_kernel_get() {
|
||||
CT_GetFile "w32api-${CT_W32API_VERSION}-mingw32-src" \
|
||||
http://downloads.sourceforge.net/sourceforge/mingw
|
||||
}
|
||||
|
||||
do_kernel_extract() {
|
||||
CT_Extract "w32api-${CT_W32API_VERSION}-mingw32-src"
|
||||
}
|
||||
|
||||
do_kernel_headers() {
|
||||
CT_DoStep INFO "Installing kernel headers"
|
||||
|
||||
mkdir -p "${CT_SYSROOT_DIR}/include"
|
||||
cp -r ${CT_SRC_DIR}/w32api-${CT_W32API_VERSION}-mingw32/include \
|
||||
${CT_SYSROOT_DIR}
|
||||
|
||||
CT_EndStep
|
||||
}
|
74
scripts/build/libc/mingw.sh
Normal file
74
scripts/build/libc/mingw.sh
Normal file
@ -0,0 +1,74 @@
|
||||
do_libc_get() {
|
||||
CT_GetFile "mingwrt-${CT_MINGWRT_VERSION}-mingw32-src" \
|
||||
http://downloads.sourceforge.net/sourceforge/mingw
|
||||
}
|
||||
|
||||
do_libc_extract() {
|
||||
CT_Extract "mingwrt-${CT_MINGWRT_VERSION}-mingw32-src"
|
||||
}
|
||||
|
||||
do_libc_check_config() {
|
||||
:
|
||||
}
|
||||
|
||||
do_libc_headers() {
|
||||
CT_DoStep INFO "Installing C library headers"
|
||||
|
||||
CT_DoLog EXTRA "Installing MinGW Runtime headers"
|
||||
mkdir -p "${CT_SYSROOT_DIR}/include"
|
||||
cp -r ${CT_SRC_DIR}/mingwrt-${CT_MINGWRT_VERSION}-mingw32/include \
|
||||
${CT_SYSROOT_DIR}
|
||||
|
||||
CT_EndStep
|
||||
}
|
||||
|
||||
do_libc_start_files() {
|
||||
:
|
||||
}
|
||||
|
||||
do_libc() {
|
||||
CT_DoStep INFO "Building MinGW files"
|
||||
|
||||
CT_DoLog EXTRA "Configuring W32-API"
|
||||
|
||||
mkdir -p "${CT_BUILD_DIR}/build-w32api"
|
||||
cd "${CT_BUILD_DIR}/build-w32api"
|
||||
|
||||
CFLAGS="-I${CT_SYSROOT_DIR}/include" \
|
||||
LDFLAGS="-L${CT_SYSROOT_DIR}/lib" \
|
||||
CT_DoExecLog ALL \
|
||||
"${CT_SRC_DIR}/w32api-${CT_W32API_VERSION}-mingw32/configure" \
|
||||
--prefix=${CT_SYSROOT_DIR} \
|
||||
--host=${CT_TARGET}
|
||||
|
||||
CT_DoLog EXTRA "Building W32-API"
|
||||
CT_DoExecLog ALL make ${PARALLELMFLAGS}
|
||||
|
||||
CT_DoLog EXTRA "Installing W32-API"
|
||||
CT_DoExecLog ALL make install
|
||||
|
||||
CT_DoLog EXTRA "Configuring MinGW Runtime"
|
||||
|
||||
mkdir -p "${CT_BUILD_DIR}/build-mingwrt"
|
||||
cd "${CT_BUILD_DIR}/build-mingwrt"
|
||||
|
||||
CFLAGS="-I${CT_SYSROOT_DIR}/include" \
|
||||
LDFLAGS="-L${CT_SYSROOT_DIR}/lib" \
|
||||
CT_DoExecLog ALL \
|
||||
"${CT_SRC_DIR}/mingwrt-${CT_MINGWRT_VERSION}-mingw32/configure" \
|
||||
--prefix=${CT_SYSROOT_DIR}/ \
|
||||
--host=${CT_TARGET}
|
||||
|
||||
CT_DoLog EXTRA "Building MinGW Runtime"
|
||||
CT_DoExecLog ALL make ${PARALLELMFLAGS}
|
||||
|
||||
CT_DoLog EXTRA "Installing MinGW Runtime"
|
||||
CT_DoExecLog ALL make install
|
||||
|
||||
CT_EndStep
|
||||
}
|
||||
|
||||
do_libc_finish() {
|
||||
:
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user