[PATCH] kernel/mingw64: add mingw64 kernel type

Yann Diorcet diorcet.yann@gmail.com
Tue Oct 23 18:33:00 GMT 2012


# HG changeset patch
# User Yann Diorcet <diorcet.yann@gmail.com>
# Date 1351016048 -7200
# Node ID a34dced6ae17acc54d132e91805208971e6ac7f4
# Parent  946d6d133a90935465e3582b54b60c0d7e4e6397
kernel/mingw64: add mingw64 kernel type
script: add script for kernel and libc for mingw64
samples: add 64 bits Windows target sample
Signed-off-by: Yann Diorcet <diorcet.yann@gmail.com>

diff -r 946d6d133a90 -r a34dced6ae17 config/kernel.in
--- a/config/kernel.in	Mon Oct 22 22:40:01 2012 +0200
+++ b/config/kernel.in	Tue Oct 23 20:14:08 2012 +0200
@@ -10,6 +10,9 @@
 config MINGW32
     bool
 
+config MINGW64
+    bool
+
 # 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
diff -r 946d6d133a90 -r a34dced6ae17 config/kernel/mingw64.in
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/config/kernel/mingw64.in	Tue Oct 23 20:14:08 2012 +0200
@@ -0,0 +1,33 @@
+# mingw64 config options
+
+## depends on EXPERIMENTAL && ( ARCH_x86 && ARCH_64 )
+##
+## select MINGW64
+##
+## 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 W64API_V_2_0_7
+    bool
+    prompt "2.0.7"
+
+config W64API_V_select
+    bool
+    prompt "Other version"
+
+endchoice
+
+config W64API_VERSION
+    string
+    prompt "W64 api version" if W64API_V_select
+# Don't remove next line
+# CT_INSERT_VERSION_STRING_BELOW
+    default "2.0.7" if W64API_V_2_0_7
+    help
+      Enter the version number of the windows api files to use
+
diff -r 946d6d133a90 -r a34dced6ae17 config/libc/eglibc.in
--- a/config/libc/eglibc.in	Mon Oct 22 22:40:01 2012 +0200
+++ b/config/libc/eglibc.in	Tue Oct 23 20:14:08 2012 +0200
@@ -1,6 +1,6 @@
 # eglibc options
 
-## depends on ! MINGW32 && ! BARE_METAL && ARCH_USE_MMU
+## depends on ! MINGW32 && ! MINGW64 && ! BARE_METAL && ARCH_USE_MMU
 ##
 ## select LIBC_SUPPORT_NPTL
 ## select LIBC_SUPPORT_LINUXTHREADS
diff -r 946d6d133a90 -r a34dced6ae17 config/libc/glibc.in
--- a/config/libc/glibc.in	Mon Oct 22 22:40:01 2012 +0200
+++ b/config/libc/glibc.in	Tue Oct 23 20:14:08 2012 +0200
@@ -1,6 +1,6 @@
 # glibc options
 
-## depends on ! MINGW32 && ! BARE_METAL && ARCH_USE_MMU
+## depends on ! MINGW32 && ! MINGW64 && ! BARE_METAL && ARCH_USE_MMU
 ##
 ## select LIBC_SUPPORT_NPTL
 ##
diff -r 946d6d133a90 -r a34dced6ae17 config/libc/mingw64.in
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/config/libc/mingw64.in	Tue Oct 23 20:14:08 2012 +0200
@@ -0,0 +1,33 @@
+# mingw64 options
+
+## depends on MINGW64
+##
+## select LIBC_SUPPORT_WIN32THREADS
+##
+## help The de-facto standard for Mingw distributions.
+
+choice
+    bool
+    prompt "Mingw64 runtime version"
+
+# Don't remove next line
+# CT_INSERT_VERSION_BELOW
+config MINGW64RT_V_3_18
+    bool
+    prompt "3.18"
+
+config MINGW64RT_V_select
+    bool
+    prompt "Other version"
+
+endchoice
+
+config MINGW64RT_VERSION
+    string
+    prompt "Mingw64 runtime version" if MINGW64RT_V_select
+# Don't remove next line
+# CT_INSERT_VERSION_STRING_BELOW
+    default "3.18" if MINGW64RT_V_3_18
+    help
+      Enter the version number of the mingw64 runtime files to use
+
diff -r 946d6d133a90 -r a34dced6ae17 config/libc/mingw64.in.2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/config/libc/mingw64.in.2	Tue Oct 23 20:14:08 2012 +0200
@@ -0,0 +1,10 @@
+# Part-2 of mingw C library options: development libraries
+
+config MINGW_DIRECTX
+    bool
+    prompt "Include DirectX development files"
+
+config MINGW_DDK
+    bool
+    prompt "Include DDK development files"
+
diff -r 946d6d133a90 -r a34dced6ae17 config/libc/uClibc.in
--- a/config/libc/uClibc.in	Mon Oct 22 22:40:01 2012 +0200
+++ b/config/libc/uClibc.in	Tue Oct 23 20:14:08 2012 +0200
@@ -1,6 +1,6 @@
 # uClibc options
 
-## depends on ! MINGW32 && ! BARE_METAL
+## depends on ! MINGW32 && ! MINGW64 && ! BARE_METAL
 ##
 ## select LIBC_SUPPORT_LINUXTHREADS
 ## select LIBC_SUPPORT_THREADS_NONE
diff -r 946d6d133a90 -r a34dced6ae17 samples/x86_64-w64-mingw32/crosstool.config
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/samples/x86_64-w64-mingw32/crosstool.config	Tue Oct 23 20:14:08 2012 +0200
@@ -0,0 +1,18 @@
+CT_EXPERIMENTAL=y
+CT_LOCAL_TARBALLS_DIR="${HOME}/src"
+CT_SAVE_TARBALLS=y
+CT_LOG_EXTRA=y
+CT_ARCH_64=y
+CT_ARCH_x86=y
+CT_TARGET_VENDOR="w64"
+CT_KERNEL_mingw64=y
+CT_BINUTILS_V_2_21_1a=y
+CT_BINUTILS_PLUGINS=y
+CT_CC_V_4_5_1=y
+CT_CC_LANG_CXX=y
+CT_MINGW_DIRECTX=y
+CT_MINGW_DDK=y
+CT_GMP_V_4_3_2=y
+CT_MPFR_V_2_4_2=y
+CT_PPL_V_0_10_2=y
+CT_CLOOG_V_0_15_10=y
diff -r 946d6d133a90 -r a34dced6ae17 samples/x86_64-w64-mingw32/reported.by
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/samples/x86_64-w64-mingw32/reported.by	Tue Oct 23 20:14:08 2012 +0200
@@ -0,0 +1,3 @@
+reporter_name="Yann Diorcet <diorcet.yann@gmail.com>"
+reporter_url=""
+reporter_comment="Config to build cross-compiler with mingw-w64 as kernel type"
diff -r 946d6d133a90 -r a34dced6ae17 scripts/build/kernel/mingw64.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/build/kernel/mingw64.sh	Tue Oct 23 20:14:08 2012 +0200
@@ -0,0 +1,83 @@
+# This file declares functions to install the kernel headers for mingw64
+# Copyright 2012 Yann Diorcet
+# 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 "mingw-w64-v${CT_W64API_VERSION}" \
+        http://downloads.sourceforge.net/sourceforge/mingw-w64
+}
+
+do_kernel_extract() {
+    CT_Extract "mingw-w64-v${CT_W64API_VERSION}"
+}
+
+do_kernel_headers() {
+    CT_DoStep INFO "Installing kernel headers"
+
+    mkdir -p "${CT_HEADERS_DIR}"
+#    cp -r ${CT_SRC_DIR}/mingw-w64-v${CT_W64API_VERSION}/include/*   \
+#          ${CT_HEADERS_DIR}
+
+    if [ -n "${CT_MINGW_DIRECTX}" ]; then
+        sdk_opt="directx"
+        if [ -n "${CT_MINGW_DDK}" ]; then
+            sdk_opt="all"
+        fi
+    else
+        if [ -n "${CT_MINGW_DDK}" ]; then
+            sdk_opt="ddk"
+        else
+            sdk_opt="none"
+        fi
+    fi
+
+    CT_mkdir_pushd "${CT_BUILD_DIR}/build-header-build-${CT_BUILD}"
+    gmp_opts+=( "host=${CT_TARGET}" )
+    gmp_opts+=( "prefix=${CT_SYSROOT_DIR}" )
+    gmp_opts+=( "sdk=${sdk_opt}" )
+    do_mingw64_headers_backend "${gmp_opts[@]}"
+
+    CT_Popd
+
+    CT_DoExecLog ALL cp -r ${CT_SYSROOT_DIR}/${CT_TARGET}/include/*   \
+                     ${CT_HEADERS_DIR}
+
+    CT_EndStep
+}
+
+# Build MINGW64 headers
+#     Parameter     : description               : type      : default
+#     host          : machine to run on         : tuple     : (none)
+#     prefix        : prefix to install into    : dir       : (none)
+#     cflags        : host cflags to use        : string    : (empty)
+do_mingw64_headers_backend() {
+    local host
+    local prefix
+    local cflags
+    local arg
+    local sdk
+
+    for arg in "$@"; do
+        eval "${arg// /\\ }"
+    done
+
+    CT_DoLog EXTRA "Configuring Headers"
+
+    CT_DoExecLog CFG                                \
+    "${CT_SRC_DIR}/mingw-w64-v${CT_W64API_VERSION}/mingw-w64-headers/configure" \
+	--build=${CT_BUILD}			    \
+        --host=${host}                              \
+        --prefix="${prefix}"                        \
+        --enable-sdk="${sdk}"
+
+    CT_DoLog EXTRA "Compile Headers"
+    CT_DoExecLog ALL make
+
+    CT_DoLog EXTRA "Installing Headers"
+    CT_DoExecLog ALL make install
+}
diff -r 946d6d133a90 -r a34dced6ae17 scripts/build/libc/mingw64.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/build/libc/mingw64.sh	Tue Oct 23 20:14:08 2012 +0200
@@ -0,0 +1,52 @@
+do_libc_get() { 
+    CT_GetFile "mingw-w64-v${CT_W64API_VERSION}" \
+        http://downloads.sourceforge.net/sourceforge/mingw-w64
+}
+
+do_libc_extract() {
+	CT_Extract "mingw-w64-v${CT_W64API_VERSION}"
+}
+
+do_libc_check_config() {
+    :
+}
+
+do_libc_start_files() {
+    CT_DoStep INFO "Installing C library headers"
+
+    # It seems mingw is strangely set up to look into /mingw instead of
+    # /usr (notably when looking for the headers). This symlink is
+    # here to workaround this, and seems to be here to last... :-/
+    CT_DoExecLog ALL ln -sv "${CT_TARGET}" "${CT_SYSROOT_DIR}/mingw"
+
+    CT_EndStep
+}
+
+do_libc() {
+    CT_DoStep INFO "Building MinGW64 files"
+
+    CT_DoLog EXTRA "Configuring W64-CRT"
+
+    mkdir -p "${CT_BUILD_DIR}/build-w64crt"
+    cd "${CT_BUILD_DIR}/build-w64crt"
+
+    CT_DoExecLog CFG                                                  \
+    "${CT_SRC_DIR}/mingw-w64-v${CT_W64API_VERSION}/mingw-w64-crt/configure" \
+        --prefix=${CT_SYSROOT_DIR}                                    \
+        --host=${CT_TARGET}
+
+    CT_DoLog EXTRA "Building W64-CRT"
+    CT_DoExecLog ALL make ${JOBSFLAGS}
+
+    CT_DoLog EXTRA "Installing W64-CRT"
+    CT_DoExecLog ALL make install
+
+    CT_EndStep
+}
+
+do_libc_finish() {
+    CT_DoStep INFO "Installing MinGW64 Development libraries"
+
+    CT_EndStep
+}
+

--
For unsubscribe information see http://sourceware.org/lists.html#faq



More information about the crossgcc mailing list