Patchwork Replace mingw32 by mingw-w64 for generating 32/64 bits Windows cross compiler

login
register
mail settings
Submitter Yann Diorcet
Date Oct. 25, 2012, 9:49 a.m.
Message ID <0b819b844f8fbf72a2a8.1351158560@blackmint>
Download mbox | patch
Permalink /patch/194092/
State Changes Requested
Headers show

Comments

Yann Diorcet - Oct. 25, 2012, 9:49 a.m.
# HG changeset patch
# User Yann Diorcet <diorcet.yann@gmail.com>
# Date 1351158411 -7200
# Node ID 0b819b844f8fbf72a2a85db438e09d66ab495d3e
# Parent  946d6d133a90935465e3582b54b60c0d7e4e6397
Replace mingw32 by mingw-w64 for generating 32/64 bits Windows cross compiler

kernel/mingw32: Remove this kernel for a generic one
kernel/mingw: New mingw kernel supporting 32 and 64 bit arch
libc/mingw: Remove old options
patches: Remove old mingw libc options' patches
scripts/mingw: Remove old scripts and add new ones

Signed-off-by: "Yann Diorcet" <diorcet.yann@gmail.com>


--
For unsubscribe information see http://sourceware.org/lists.html#faq
Yann E. MORIN - Nov. 13, 2012, 6:57 p.m.
Yann, All,

Sorry to come back late on this, past week has been pretty busy in
Barcelona, during LinuxCon and ELC-E.
Back to a more normal schedule, now.

On Thursday 25 October 2012 Yann Diorcet wrote:
> # HG changeset patch
> # User Yann Diorcet <diorcet.yann@gmail.com>
> # Date 1351158411 -7200
> # Node ID 0b819b844f8fbf72a2a85db438e09d66ab495d3e
> # Parent  946d6d133a90935465e3582b54b60c0d7e4e6397
> Replace mingw32 by mingw-w64 for generating 32/64 bits Windows cross compiler

OK, basically this builds both toolchains OK on my machine. That's a
good start, for sure! ;-)

Here are a few comments, though.

Commit message: what about something like:

    kernel/mingw: replace mingw32 with generic mingw

    Replace the 32-bit-only mingw32 with mingw64 that is capable
    of building toolchains for both 32- and 64-bit mingw.

    kernel/mingw32: Remove this kernel for a generic one
    kernel/mingw: New mingw kernel supporting 32 and 64 bit arch
    libc/mingw: Remove old options
    patches: Remove old mingw libc options' patches

[--SNIP--]
> diff -r 946d6d133a90 -r 0b819b844f8f config/libc/mingw.in
> --- a/config/libc/mingw.in	Mon Oct 22 22:40:01 2012 +0200
> +++ b/config/libc/mingw.in	Thu Oct 25 11:46:51 2012 +0200
> @@ -1,33 +1,7 @@
>  # mingw options
>  
> -## depends on MINGW32
> +## depends on MINGW
>  ##
>  ## 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
> -

Sure there is no option for the C library part of mingw?
At least, add a comment that the version is the same as the one from the
mingw kernel (I mean, a #-comment, not a kconfig comment).

> diff -r 946d6d133a90 -r 0b819b844f8f config/libc/mingw.in.2
> --- a/config/libc/mingw.in.2	Mon Oct 22 22:40:01 2012 +0200
> +++ b/config/libc/mingw.in.2	Thu Oct 25 11:46:51 2012 +0200
> @@ -1,72 +1,1 @@
>  # Part-2 of mingw C library options: development libraries
> -
> -config MINGW_DIRECTX
[--SNIP--]
> -config MINGW_OPENGL
[--SNIP--]
> -config MINGW_PDCURSES
[--SNIP--]
> -choice
[--SNIP--]
> -config MINGW_PDCURSES_V_3_4
[--SNIP--]

In the first place, I was not too happy having those target libraries be
built as part of the toolchain, but people argued they were part of the
expected 'SDK' (or API, call it whatever you want) of mingw / Windows (TM).

So, if those get remove, I'm afraid those same people will come back
whinning, unless you can prove either:
  - it is *not* part of the Windows API/SDK, or
  - the new ming64 build provides a replacement for those libs.

> diff -r 946d6d133a90 -r 0b819b844f8f samples/i686-unknown-mingw32/reported.by
> --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
> +++ b/samples/i686-unknown-mingw32/reported.by	Thu Oct 25 11:46:51 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 as kernel type for 32 bits Windows target"

Nit-picking: please, fold your comments at less than 80-chars.

> diff -r 946d6d133a90 -r 0b819b844f8f samples/x86_64-unknown-mingw32/reported.by
> --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
> +++ b/samples/x86_64-unknown-mingw32/reported.by	Thu Oct 25 11:46:51 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 as kernel type for 64 bits Windows target"

Ditto.

> diff -r 946d6d133a90 -r 0b819b844f8f scripts/build/kernel/mingw.sh
> --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
> +++ b/scripts/build/kernel/mingw.sh	Thu Oct 25 11:46:51 2012 +0200
> @@ -0,0 +1,54 @@
> +# 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" #yes it's correct

I know we discussed this already, and that -mingw32 is indeed the correct
kernel part, but could you add a comment that is a bit more elaborate?

> +    CT_TARGET_SYS=
> +}
> +
> +do_kernel_get() {
> +    CT_GetFile "mingw-w64-v${CT_WINAPI_VERSION}" \
> +        http://downloads.sourceforge.net/sourceforge/mingw-w64
> +}
> +
> +do_kernel_extract() {
> +    CT_Extract "mingw-w64-v${CT_WINAPI_VERSION}"

Even if no patch for now, you have to call CT_Patch anyway (see below, too).

> +}
> +
> +do_kernel_headers() {

sdk_opt is a local variable, you have to declare it. Usually, we use bash
arrays for options. Here, it is not really important, as you only have one
option, but nonetheless, I'd rather have consistent code:
    local -a sdk_opts

and then, to add a configure option:

    sdk_opts+=( "option" )

> +    CT_DoStep INFO "Installing kernel headers"
> +
> +    mkdir -p "${CT_HEADERS_DIR}"
> +
> +    case "${CT_MINGW_DIRECTX}:${CT_MINGW_DDK}" in
> +        y:y)    sdk_opt="--enable-sdk=all";;
> +        y:)     sdk_opt="--enable-sdk=directx";;
> +        :y)     sdk_opt="--enable-sdk=ddk";;
> +        :)      sdk_opt="";;

Empty statement for the ':' case:
        :)  ;;

> +    esac
> +
> +    CT_mkdir_pushd "${CT_BUILD_DIR}/build-header-build-${CT_BUILD}"
> +
> +    CT_DoLog EXTRA "Configuring Headers"
> +
> +    CT_DoExecLog CFG                                \
> +    "${CT_SRC_DIR}/mingw-w64-v${CT_WINAPI_VERSION}/mingw-w64-headers/configure" \
> +	--build=${CT_BUILD}			    \

Space-damage:
  - no leading tabs,
  - trailing '\' are not aligned; it is OK for single-word lines (like
    the ./configure line) to be longer than 80 chars, but other '\'
    should all be aligned together, preferably to the longest line;
    something like:

    CT_DoExecLog CFG              \
        "veeeeeeeeerrrryyyyy-loooooooooooooong-configure-line"  \
            --option1="value1"    \
            --option2="value2"    \
            ${options}

> +        --host=${CT_TARGET}                              \
> +        --prefix="${CT_SYSROOT_DIR}"                        \

Any reason why you do not use --prefix=/usr, and pass DESTDIR=${SYSROOT_DIR}
at install time?

--prefix is for run-time, so the sysroot directory (where target stuff
gets installed) does not exist at runtime, while DESTDIR is for where to
install stuff.

> +        "${sdk_opt}"

> +    CT_DoLog EXTRA "Compile Headers"
> +    CT_DoExecLog ALL make
> +
> +    CT_DoLog EXTRA "Installing Headers"
> +    CT_DoExecLog ALL make install

make DESTDIR="${CT_SYSROOT_DIR}" install

> +    CT_Popd
> +
> +    CT_DoExecLog ALL cp -r "${CT_SYSROOT_DIR}/${CT_TARGET}/include/"*   \
> +                     "${CT_HEADERS_DIR}"

That's what is weird with mingw and the way you install the headers: they
are installed in sysroot/tuple/include, when we want them in
sysroot/usr/include (and by the way, your code only copies them , so they
still are present in the original place. What path will the pre-processor
search for?

I'll do a few tests here to see if --prefix=/usr and DESTDIR=${sysroot_dir}
can make a difference. If you can also look into this, that'd be great, too.

> diff -r 946d6d133a90 -r 0b819b844f8f scripts/build/libc/mingw.sh
> --- a/scripts/build/libc/mingw.sh	Mon Oct 22 22:40:01 2012 +0200
> +++ b/scripts/build/libc/mingw.sh	Thu Oct 25 11:46:51 2012 +0200
[--SNIP--]
>  do_libc_extract() {
> -    CT_Extract "mingwrt-${CT_MINGWRT_VERSION}-mingw32-src"
> -
> -    if [ -n "${CT_MINGW_PDCURSES}" ]; then
> -        CT_Extract "PDCurses-${CT_MINGW_PDCURSES_VERSION}"
> -        CT_Patch "PDCurses" "${CT_MINGW_PDCURSES_VERSION}"
> -    fi
> -    if [ -n "${CT_MINGW_GNURX}" ]; then
> -        CT_Extract "mingw-libgnurx-${CT_MINGW_GNURX_VERSION}-src"
> -        CT_Patch "mingw-libgnurx" "${CT_MINGW_GNURX_VERSION}-src"
> -    fi
> +    CT_Extract "mingw-w64-v${CT_WINAPI_VERSION}"

Even if there are no patches for now, you still have to call CT_Patch,
so it is in-line with the rest of the components.

If there is no patch, CT_Patch will just do nothing.

>  }
>  
>  do_libc_check_config() {
> @@ -40,117 +14,36 @@
>  do_libc_start_files() {
>      CT_DoStep INFO "Installing C library headers"
>  
> -    CT_DoLog EXTRA "Installing MinGW Runtime headers"
> -    mkdir -p "${CT_HEADERS_DIR}"
> -    cp -r ${CT_SRC_DIR}/mingwrt-${CT_MINGWRT_VERSION}-mingw32-src/include/* \
> -          ${CT_HEADERS_DIR}
> -
>      # 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 "usr" "${CT_SYSROOT_DIR}/mingw"
> +    CT_DoExecLog ALL ln -sv "${CT_TARGET}" "${CT_SYSROOT_DIR}/mingw"

And this change should no longer be needed if we use the proper prefix at
configure time. Also, the headers are installed by the 'kernel', so it
should be the 'kernel' script that does the symlink.

Which makes me think... For MingW, do we really have a 'kernel' per-say, or
can't we just build everything in the libc steps? It seems to me that would
be much cleaner.

Note: the do_libc_start_files step is run just after the kernel_headers step.

>      CT_EndStep
>  }
>  
>  do_libc() {
> -    CT_DoStep INFO "Building MinGW files"
> +    CT_DoStep INFO "Building mingw32-w64 files"
>  
> -    CT_DoLog EXTRA "Configuring W32-API"
> +    CT_DoLog EXTRA "Configuring mingw-w64-crt"
>  
> -    mkdir -p "${CT_BUILD_DIR}/build-w32api"
> -    cd "${CT_BUILD_DIR}/build-w32api"
> +    mkdir -p "${CT_BUILD_DIR}/build-w64crt"
> +    cd "${CT_BUILD_DIR}/build-w64crt"
>  
>      CT_DoExecLog CFG                                                  \
> -    CFLAGS="-I${CT_HEADERS_DIR}"                                      \
> -    LDFLAGS="-L${CT_SYSROOT_DIR}/lib"                                 \
> -    "${CT_SRC_DIR}/w32api-${CT_W32API_VERSION}-mingw32-src/configure" \
> +    "${CT_SRC_DIR}/mingw-w64-v${CT_WINAPI_VERSION}/mingw-w64-crt/configure" \
>          --prefix=${CT_SYSROOT_DIR}                                    \

Again, prefix=/usr (yes, that's old code, let use that new stuff to fix it
at the same time) ...

> -        --includedir=${CT_HEADERS_DIR}                                \
>          --host=${CT_TARGET}
>  
> -    CT_DoLog EXTRA "Building W32-API"
> +    CT_DoLog EXTRA "Building mingw-w64-crt"
>      CT_DoExecLog ALL make ${JOBSFLAGS}
>  
> -    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"
> -
> -    CT_DoExecLog CFG                                                    \
> -    CFLAGS="-I${CT_HEADERS_DIR}"                                        \
> -    LDFLAGS="-L${CT_SYSROOT_DIR}/lib"                                   \
> -    "${CT_SRC_DIR}/mingwrt-${CT_MINGWRT_VERSION}-mingw32-src/configure" \
> -        --prefix=${CT_SYSROOT_DIR}/                                     \
> -        --includedir=${CT_HEADERS_DIR}                                  \
> -        --host=${CT_TARGET}
> -
> -    CT_DoLog EXTRA "Building MinGW Runtime"
> -    CT_DoExecLog ALL make ${JOBSFLAGS}
> -
> -    CT_DoLog EXTRA "Installing MinGW Runtime"
> +    CT_DoLog EXTRA "Installing mingw-w64-crt"
>      CT_DoExecLog ALL make install

... and, DESTDIR=${CT_SYSROOT_DIR}

>      CT_EndStep
>  }
>  
>  do_libc_finish() {
> -    CT_DoStep INFO "Installing MinGW Development libraries"
> -
> -    CT_Pushd "${CT_SYSROOT_DIR}"
> -    if [ -n "${CT_MINGW_DIRECTX}" ]; then
> -        CT_DoLog EXTRA "Installing DirectX development package"
> -        CT_Extract nochdir "directx-devel"
> -    fi
> -    if [ -n "${CT_MINGW_OPENGL}" ]; then
> -        CT_DoLog EXTRA "Installing OpenGL development package"
> -        CT_Extract nochdir "opengl-devel"
> -    fi
> -    CT_Popd
> -
> -    if [ -n "${CT_MINGW_PDCURSES}" ]; then
> -        CT_DoLog EXTRA "Building PDCurses development files"
> -        mkdir -p "${CT_BUILD_DIR}/build-pdcurses"
> -        cd "${CT_BUILD_DIR}/build-pdcurses"
> -
> -        make -f ${CT_SRC_DIR}/PDCurses-${CT_MINGW_PDCURSES_VERSION}/win32/mingwin32.mak libs \
> -            PDCURSES_SRCDIR=${CT_SRC_DIR}/PDCurses-${CT_MINGW_PDCURSES_VERSION} \
> -            CROSS_COMPILE=${CT_TARGET}-
> -
> -        CT_DoLog EXTRA "Installing PDCurses development files"
> -        chmod a+r ${CT_SRC_DIR}/PDCurses-${CT_MINGW_PDCURSES_VERSION}/*.h
> -        cp ${CT_SRC_DIR}/PDCurses-${CT_MINGW_PDCURSES_VERSION}/*.h \
> -           ${CT_HEADERS_DIR}/
> -        cp pdcurses.a ${CT_SYSROOT_DIR}/lib/libpdcurses.a
> -        cp pdcurses.a ${CT_SYSROOT_DIR}/lib/libncurses.a
> -    fi
> -
> -    if [ -n "${CT_MINGW_GNURX}" ]; then
> -        CT_DoLog EXTRA "Configuring GnuRX development files"
> -
> -        mkdir -p "${CT_BUILD_DIR}/build-gnurx"
> -        cd "${CT_BUILD_DIR}/build-gnurx"
> -
> -        CT_DoExecLog CFG                                                        \
> -        CFLAGS="${CT_CFLAGS_FOR_TARGET}"                                        \
> -        "${CT_SRC_DIR}/mingw-libgnurx-${CT_MINGW_GNURX_VERSION}-src/configure"  \
> -            --build=${CT_BUILD}                                                 \
> -            --host=${CT_TARGET}                                                 \
> -            --prefix=${CT_SYSROOT_DIR}                                          \
> -            --includedir=${CT_HEADERS_DIR}                                      \
> -            --enable-shared                                                     \
> -            --enable-static
> -
> -        CT_DoLog EXTRA "Building GnuRX development files"
> -        CT_DoExecLog ALL make ${JOBSFLAGS}
> -
> -        CT_DoLog EXTRA "Installing GnuRX development files"
> -        CT_DoExecLog ALL make install-dev
> -    fi
> -
> -    CT_EndStep
> +    :
>  }

Yeah! We get rid of libc_finish for MingW! Hurray! \o/
Let's bash on newlib, the last offender now. ;-)

[--SNIP--]

Now we have a working base that is able to build toolchains, can you look
at the comments above, so we can have a clean implementation?

Thank you for this overall good work so far! :-)

Regards,
Yann E. MORIN.
Yann Diorcet - Nov. 13, 2012, 8:10 p.m.
Le 13/11/2012 19:57, Yann E. MORIN a écrit :
> Yann, All,
>
> Sorry to come back late on this, past week has been pretty busy in
> Barcelona, during LinuxCon and ELC-E.
> Back to a more normal schedule, now.
>
> On Thursday 25 October 2012 Yann Diorcet wrote:
>> # HG changeset patch
>> # User Yann Diorcet <diorcet.yann@gmail.com>
>> # Date 1351158411 -7200
>> # Node ID 0b819b844f8fbf72a2a85db438e09d66ab495d3e
>> # Parent  946d6d133a90935465e3582b54b60c0d7e4e6397
>> Replace mingw32 by mingw-w64 for generating 32/64 bits Windows cross compiler
> OK, basically this builds both toolchains OK on my machine. That's a
> good start, for sure! ;-)
>
> Here are a few comments, though.
>
> Commit message: what about something like:
>
>      kernel/mingw: replace mingw32 with generic mingw
>
>      Replace the 32-bit-only mingw32 with mingw64 that is capable
>      of building toolchains for both 32- and 64-bit mingw.
>
>      kernel/mingw32: Remove this kernel for a generic one
>      kernel/mingw: New mingw kernel supporting 32 and 64 bit arch
>      libc/mingw: Remove old options
>      patches: Remove old mingw libc options' patches
As you want :)
> [--SNIP--]
>> diff -r 946d6d133a90 -r 0b819b844f8f config/libc/mingw.in
>> --- a/config/libc/mingw.in	Mon Oct 22 22:40:01 2012 +0200
>> +++ b/config/libc/mingw.in	Thu Oct 25 11:46:51 2012 +0200
>> @@ -1,33 +1,7 @@
>>   # mingw options
>>   
>> -## depends on MINGW32
>> +## depends on MINGW
>>   ##
>>   ## 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
>> -
> Sure there is no option for the C library part of mingw?
> At least, add a comment that the version is the same as the one from the
> mingw kernel (I mean, a #-comment, not a kconfig comment).
The issue is that in mingw-w64 there is no seperation between 
"kernel"/"libc" they come from same archive. I don't know what i have to do
>
>> diff -r 946d6d133a90 -r 0b819b844f8f config/libc/mingw.in.2
>> --- a/config/libc/mingw.in.2	Mon Oct 22 22:40:01 2012 +0200
>> +++ b/config/libc/mingw.in.2	Thu Oct 25 11:46:51 2012 +0200
>> @@ -1,72 +1,1 @@
>>   # Part-2 of mingw C library options: development libraries
>> -
>> -config MINGW_DIRECTX
> [--SNIP--]
>> -config MINGW_OPENGL
> [--SNIP--]
>> -config MINGW_PDCURSES
> [--SNIP--]
>> -choice
> [--SNIP--]
>> -config MINGW_PDCURSES_V_3_4
> [--SNIP--]
>
> In the first place, I was not too happy having those target libraries be
> built as part of the toolchain, but people argued they were part of the
> expected 'SDK' (or API, call it whatever you want) of mingw / Windows (TM).
>
> So, if those get remove, I'm afraid those same people will come back
> whinning, unless you can prove either:
>    - it is *not* part of the Windows API/SDK, or
>    - the new ming64 build provides a replacement for those libs.
PDCurses is only a wrapper for use curses function with the DOS console. 
Nothing to do with Windows API/SDK.
For opengl
Directx is replaced (btw the old provided includes are incomplete)
There is new important enhancement: DDK
>> diff -r 946d6d133a90 -r 0b819b844f8f samples/i686-unknown-mingw32/reported.by
>> --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
>> +++ b/samples/i686-unknown-mingw32/reported.by	Thu Oct 25 11:46:51 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 as kernel type for 32 bits Windows target"
> Nit-picking: please, fold your comments at less than 80-chars.
ok
>
>> diff -r 946d6d133a90 -r 0b819b844f8f samples/x86_64-unknown-mingw32/reported.by
>> --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
>> +++ b/samples/x86_64-unknown-mingw32/reported.by	Thu Oct 25 11:46:51 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 as kernel type for 64 bits Windows target"
> Ditto.
ok
>
>> diff -r 946d6d133a90 -r 0b819b844f8f scripts/build/kernel/mingw.sh
>> --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
>> +++ b/scripts/build/kernel/mingw.sh	Thu Oct 25 11:46:51 2012 +0200
>> @@ -0,0 +1,54 @@
>> +# 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" #yes it's correct
> I know we discussed this already, and that -mingw32 is indeed the correct
> kernel part, but could you add a comment that is a bit more elaborate?
ok
>
>> +    CT_TARGET_SYS=
>> +}
>> +
>> +do_kernel_get() {
>> +    CT_GetFile "mingw-w64-v${CT_WINAPI_VERSION}" \
>> +        http://downloads.sourceforge.net/sourceforge/mingw-w64
>> +}
>> +
>> +do_kernel_extract() {
>> +    CT_Extract "mingw-w64-v${CT_WINAPI_VERSION}"
> Even if no patch for now, you have to call CT_Patch anyway (see below, too).
i forgot
>
>> +}
>> +
>> +do_kernel_headers() {
> sdk_opt is a local variable, you have to declare it. Usually, we use bash
> arrays for options. Here, it is not really important, as you only have one
> option, but nonetheless, I'd rather have consistent code:
>      local -a sdk_opts
ok
>
> and then, to add a configure option:
>
>      sdk_opts+=( "option" )
>
>> +    CT_DoStep INFO "Installing kernel headers"
>> +
>> +    mkdir -p "${CT_HEADERS_DIR}"
>> +
>> +    case "${CT_MINGW_DIRECTX}:${CT_MINGW_DDK}" in
>> +        y:y)    sdk_opt="--enable-sdk=all";;
>> +        y:)     sdk_opt="--enable-sdk=directx";;
>> +        :y)     sdk_opt="--enable-sdk=ddk";;
>> +        :)      sdk_opt="";;
> Empty statement for the ':' case:
>          :)  ;;
ok
>> +    esac
>> +
>> +    CT_mkdir_pushd "${CT_BUILD_DIR}/build-header-build-${CT_BUILD}"
>> +
>> +    CT_DoLog EXTRA "Configuring Headers"
>> +
>> +    CT_DoExecLog CFG                                \
>> +    "${CT_SRC_DIR}/mingw-w64-v${CT_WINAPI_VERSION}/mingw-w64-headers/configure" \
>> +	--build=${CT_BUILD}			    \
> Space-damage:
>    - no leading tabs,
>    - trailing '\' are not aligned; it is OK for single-word lines (like
>      the ./configure line) to be longer than 80 chars, but other '\'
>      should all be aligned together, preferably to the longest line;
>      something like:
>
>      CT_DoExecLog CFG              \
>          "veeeeeeeeerrrryyyyy-loooooooooooooong-configure-line"  \
>              --option1="value1"    \
>              --option2="value2"    \
>              ${options}
>
>> +        --host=${CT_TARGET}                              \
>> +        --prefix="${CT_SYSROOT_DIR}"                        \
ok
> Any reason why you do not use --prefix=/usr, and pass DESTDIR=${SYSROOT_DIR}
> at install time?
>
> --prefix is for run-time, so the sysroot directory (where target stuff
> gets installed) does not exist at runtime, while DESTDIR is for where to
> install stuff.
No there is no reason. I will try that way
>
>> +        "${sdk_opt}"
>> +    CT_DoLog EXTRA "Compile Headers"
>> +    CT_DoExecLog ALL make
>> +
>> +    CT_DoLog EXTRA "Installing Headers"
>> +    CT_DoExecLog ALL make install
> make DESTDIR="${CT_SYSROOT_DIR}" install
>
>> +    CT_Popd
>> +
>> +    CT_DoExecLog ALL cp -r "${CT_SYSROOT_DIR}/${CT_TARGET}/include/"*   \
>> +                     "${CT_HEADERS_DIR}"
> That's what is weird with mingw and the way you install the headers: they
> are installed in sysroot/tuple/include, when we want them in
> sysroot/usr/include (and by the way, your code only copies them , so they
> still are present in the original place. What path will the pre-processor
> search for?
>
> I'll do a few tests here to see if --prefix=/usr and DESTDIR=${sysroot_dir}
> can make a difference. If you can also look into this, that'd be great, too.
I will try to simplify all this stuff
>> diff -r 946d6d133a90 -r 0b819b844f8f scripts/build/libc/mingw.sh
>> --- a/scripts/build/libc/mingw.sh	Mon Oct 22 22:40:01 2012 +0200
>> +++ b/scripts/build/libc/mingw.sh	Thu Oct 25 11:46:51 2012 +0200
> [--SNIP--]
>>   do_libc_extract() {
>> -    CT_Extract "mingwrt-${CT_MINGWRT_VERSION}-mingw32-src"
>> -
>> -    if [ -n "${CT_MINGW_PDCURSES}" ]; then
>> -        CT_Extract "PDCurses-${CT_MINGW_PDCURSES_VERSION}"
>> -        CT_Patch "PDCurses" "${CT_MINGW_PDCURSES_VERSION}"
>> -    fi
>> -    if [ -n "${CT_MINGW_GNURX}" ]; then
>> -        CT_Extract "mingw-libgnurx-${CT_MINGW_GNURX_VERSION}-src"
>> -        CT_Patch "mingw-libgnurx" "${CT_MINGW_GNURX_VERSION}-src"
>> -    fi
>> +    CT_Extract "mingw-w64-v${CT_WINAPI_VERSION}"
> Even if there are no patches for now, you still have to call CT_Patch,
> so it is in-line with the rest of the components.
ok
> If there is no patch, CT_Patch will just do nothing.
>
>>   }
>>   
>>   do_libc_check_config() {
>> @@ -40,117 +14,36 @@
>>   do_libc_start_files() {
>>       CT_DoStep INFO "Installing C library headers"
>>   
>> -    CT_DoLog EXTRA "Installing MinGW Runtime headers"
>> -    mkdir -p "${CT_HEADERS_DIR}"
>> -    cp -r ${CT_SRC_DIR}/mingwrt-${CT_MINGWRT_VERSION}-mingw32-src/include/* \
>> -          ${CT_HEADERS_DIR}
>> -
>>       # 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 "usr" "${CT_SYSROOT_DIR}/mingw"
>> +    CT_DoExecLog ALL ln -sv "${CT_TARGET}" "${CT_SYSROOT_DIR}/mingw"
> And this change should no longer be needed if we use the proper prefix at
> configure time. Also, the headers are installed by the 'kernel', so it
> should be the 'kernel' script that does the symlink.
>
> Which makes me think... For MingW, do we really have a 'kernel' per-say, or
> can't we just build everything in the libc steps? It seems to me that would
> be much cleaner.
>
> Note: the do_libc_start_files step is run just after the kernel_headers step.
>
>>       CT_EndStep
>>   }
>>   
>>   do_libc() {
>> -    CT_DoStep INFO "Building MinGW files"
>> +    CT_DoStep INFO "Building mingw32-w64 files"
>>   
>> -    CT_DoLog EXTRA "Configuring W32-API"
>> +    CT_DoLog EXTRA "Configuring mingw-w64-crt"
>>   
>> -    mkdir -p "${CT_BUILD_DIR}/build-w32api"
>> -    cd "${CT_BUILD_DIR}/build-w32api"
>> +    mkdir -p "${CT_BUILD_DIR}/build-w64crt"
>> +    cd "${CT_BUILD_DIR}/build-w64crt"
>>   
>>       CT_DoExecLog CFG                                                  \
>> -    CFLAGS="-I${CT_HEADERS_DIR}"                                      \
>> -    LDFLAGS="-L${CT_SYSROOT_DIR}/lib"                                 \
>> -    "${CT_SRC_DIR}/w32api-${CT_W32API_VERSION}-mingw32-src/configure" \
>> +    "${CT_SRC_DIR}/mingw-w64-v${CT_WINAPI_VERSION}/mingw-w64-crt/configure" \
>>           --prefix=${CT_SYSROOT_DIR}                                    \
> Again, prefix=/usr (yes, that's old code, let use that new stuff to fix it
> at the same time) ...
>
>> -        --includedir=${CT_HEADERS_DIR}                                \
>>           --host=${CT_TARGET}
>>   
>> -    CT_DoLog EXTRA "Building W32-API"
>> +    CT_DoLog EXTRA "Building mingw-w64-crt"
>>       CT_DoExecLog ALL make ${JOBSFLAGS}
>>   
>> -    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"
>> -
>> -    CT_DoExecLog CFG                                                    \
>> -    CFLAGS="-I${CT_HEADERS_DIR}"                                        \
>> -    LDFLAGS="-L${CT_SYSROOT_DIR}/lib"                                   \
>> -    "${CT_SRC_DIR}/mingwrt-${CT_MINGWRT_VERSION}-mingw32-src/configure" \
>> -        --prefix=${CT_SYSROOT_DIR}/                                     \
>> -        --includedir=${CT_HEADERS_DIR}                                  \
>> -        --host=${CT_TARGET}
>> -
>> -    CT_DoLog EXTRA "Building MinGW Runtime"
>> -    CT_DoExecLog ALL make ${JOBSFLAGS}
>> -
>> -    CT_DoLog EXTRA "Installing MinGW Runtime"
>> +    CT_DoLog EXTRA "Installing mingw-w64-crt"
>>       CT_DoExecLog ALL make install
> ... and, DESTDIR=${CT_SYSROOT_DIR}
>
>>       CT_EndStep
>>   }
>>   
>>   do_libc_finish() {
>> -    CT_DoStep INFO "Installing MinGW Development libraries"
>> -
>> -    CT_Pushd "${CT_SYSROOT_DIR}"
>> -    if [ -n "${CT_MINGW_DIRECTX}" ]; then
>> -        CT_DoLog EXTRA "Installing DirectX development package"
>> -        CT_Extract nochdir "directx-devel"
>> -    fi
>> -    if [ -n "${CT_MINGW_OPENGL}" ]; then
>> -        CT_DoLog EXTRA "Installing OpenGL development package"
>> -        CT_Extract nochdir "opengl-devel"
>> -    fi
>> -    CT_Popd
>> -
>> -    if [ -n "${CT_MINGW_PDCURSES}" ]; then
>> -        CT_DoLog EXTRA "Building PDCurses development files"
>> -        mkdir -p "${CT_BUILD_DIR}/build-pdcurses"
>> -        cd "${CT_BUILD_DIR}/build-pdcurses"
>> -
>> -        make -f ${CT_SRC_DIR}/PDCurses-${CT_MINGW_PDCURSES_VERSION}/win32/mingwin32.mak libs \
>> -            PDCURSES_SRCDIR=${CT_SRC_DIR}/PDCurses-${CT_MINGW_PDCURSES_VERSION} \
>> -            CROSS_COMPILE=${CT_TARGET}-
>> -
>> -        CT_DoLog EXTRA "Installing PDCurses development files"
>> -        chmod a+r ${CT_SRC_DIR}/PDCurses-${CT_MINGW_PDCURSES_VERSION}/*.h
>> -        cp ${CT_SRC_DIR}/PDCurses-${CT_MINGW_PDCURSES_VERSION}/*.h \
>> -           ${CT_HEADERS_DIR}/
>> -        cp pdcurses.a ${CT_SYSROOT_DIR}/lib/libpdcurses.a
>> -        cp pdcurses.a ${CT_SYSROOT_DIR}/lib/libncurses.a
>> -    fi
>> -
>> -    if [ -n "${CT_MINGW_GNURX}" ]; then
>> -        CT_DoLog EXTRA "Configuring GnuRX development files"
>> -
>> -        mkdir -p "${CT_BUILD_DIR}/build-gnurx"
>> -        cd "${CT_BUILD_DIR}/build-gnurx"
>> -
>> -        CT_DoExecLog CFG                                                        \
>> -        CFLAGS="${CT_CFLAGS_FOR_TARGET}"                                        \
>> -        "${CT_SRC_DIR}/mingw-libgnurx-${CT_MINGW_GNURX_VERSION}-src/configure"  \
>> -            --build=${CT_BUILD}                                                 \
>> -            --host=${CT_TARGET}                                                 \
>> -            --prefix=${CT_SYSROOT_DIR}                                          \
>> -            --includedir=${CT_HEADERS_DIR}                                      \
>> -            --enable-shared                                                     \
>> -            --enable-static
>> -
>> -        CT_DoLog EXTRA "Building GnuRX development files"
>> -        CT_DoExecLog ALL make ${JOBSFLAGS}
>> -
>> -        CT_DoLog EXTRA "Installing GnuRX development files"
>> -        CT_DoExecLog ALL make install-dev
>> -    fi
>> -
>> -    CT_EndStep
>> +    :
>>   }
> Yeah! We get rid of libc_finish for MingW! Hurray! \o/
> Let's bash on newlib, the last offender now. ;-)
>
> [--SNIP--]
>
> Now we have a working base that is able to build toolchains, can you look
> at the comments above, so we can have a clean implementation?
>
> Thank you for this overall good work so far! :-)
>
> Regards,
> Yann E. MORIN.
>


--
For unsubscribe information see http://sourceware.org/lists.html#faq
Yann Diorcet - Nov. 14, 2012, 11:46 a.m.
Le 13/11/12 21:10, Diorcet Yann a écrit :
> Le 13/11/2012 19:57, Yann E. MORIN a écrit :
>> Yann, All,
>>
>> Sorry to come back late on this, past week has been pretty busy in
>> Barcelona, during LinuxCon and ELC-E.
>> Back to a more normal schedule, now.
>>
>> On Thursday 25 October 2012 Yann Diorcet wrote:
>>> # HG changeset patch
>>> # User Yann Diorcet <diorcet.yann@gmail.com>
>>> # Date 1351158411 -7200
>>> # Node ID 0b819b844f8fbf72a2a85db438e09d66ab495d3e
>>> # Parent  946d6d133a90935465e3582b54b60c0d7e4e6397
>>> Replace mingw32 by mingw-w64 for generating 32/64 bits Windows cross 
>>> compiler
>> OK, basically this builds both toolchains OK on my machine. That's a
>> good start, for sure! ;-)
>>
>> Here are a few comments, though.
>>
>> Commit message: what about something like:
>>
>>      kernel/mingw: replace mingw32 with generic mingw
>>
>>      Replace the 32-bit-only mingw32 with mingw64 that is capable
>>      of building toolchains for both 32- and 64-bit mingw.
>>
>>      kernel/mingw32: Remove this kernel for a generic one
>>      kernel/mingw: New mingw kernel supporting 32 and 64 bit arch
>>      libc/mingw: Remove old options
>>      patches: Remove old mingw libc options' patches
> As you want :)
>> [--SNIP--]
>>> diff -r 946d6d133a90 -r 0b819b844f8f config/libc/mingw.in
>>> --- a/config/libc/mingw.in    Mon Oct 22 22:40:01 2012 +0200
>>> +++ b/config/libc/mingw.in    Thu Oct 25 11:46:51 2012 +0200
>>> @@ -1,33 +1,7 @@
>>>   # mingw options
>>>   -## depends on MINGW32
>>> +## depends on MINGW
>>>   ##
>>>   ## 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
>>> -
>> Sure there is no option for the C library part of mingw?
>> At least, add a comment that the version is the same as the one from the
>> mingw kernel (I mean, a #-comment, not a kconfig comment).
> The issue is that in mingw-w64 there is no seperation between 
> "kernel"/"libc" they come from same archive. I don't know what i have 
> to do
>>
>>> diff -r 946d6d133a90 -r 0b819b844f8f config/libc/mingw.in.2
>>> --- a/config/libc/mingw.in.2    Mon Oct 22 22:40:01 2012 +0200
>>> +++ b/config/libc/mingw.in.2    Thu Oct 25 11:46:51 2012 +0200
>>> @@ -1,72 +1,1 @@
>>>   # Part-2 of mingw C library options: development libraries
>>> -
>>> -config MINGW_DIRECTX
>> [--SNIP--]
>>> -config MINGW_OPENGL
>> [--SNIP--]
>>> -config MINGW_PDCURSES
>> [--SNIP--]
>>> -choice
>> [--SNIP--]
>>> -config MINGW_PDCURSES_V_3_4
>> [--SNIP--]
>>
>> In the first place, I was not too happy having those target libraries be
>> built as part of the toolchain, but people argued they were part of the
>> expected 'SDK' (or API, call it whatever you want) of mingw / Windows 
>> (TM).
>>
>> So, if those get remove, I'm afraid those same people will come back
>> whinning, unless you can prove either:
>>    - it is *not* part of the Windows API/SDK, or
>>    - the new ming64 build provides a replacement for those libs.
> PDCurses is only a wrapper for use curses function with the DOS 
> console. Nothing to do with Windows API/SDK.
> For opengl
Correction opengl is included too (but not glut)
> Directx is replaced (btw the old provided includes are incomplete)
> There is new important enhancement: DDK
>>> diff -r 946d6d133a90 -r 0b819b844f8f 
>>> samples/i686-unknown-mingw32/reported.by
>>> --- /dev/null    Thu Jan 01 00:00:00 1970 +0000
>>> +++ b/samples/i686-unknown-mingw32/reported.by    Thu Oct 25 
>>> 11:46:51 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 as 
>>> kernel type for 32 bits Windows target"
>> Nit-picking: please, fold your comments at less than 80-chars.
> ok
>>
>>> diff -r 946d6d133a90 -r 0b819b844f8f 
>>> samples/x86_64-unknown-mingw32/reported.by
>>> --- /dev/null    Thu Jan 01 00:00:00 1970 +0000
>>> +++ b/samples/x86_64-unknown-mingw32/reported.by    Thu Oct 25 
>>> 11:46:51 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 as 
>>> kernel type for 64 bits Windows target"
>> Ditto.
> ok
>>
>>> diff -r 946d6d133a90 -r 0b819b844f8f scripts/build/kernel/mingw.sh
>>> --- /dev/null    Thu Jan 01 00:00:00 1970 +0000
>>> +++ b/scripts/build/kernel/mingw.sh    Thu Oct 25 11:46:51 2012 +0200
>>> @@ -0,0 +1,54 @@
>>> +# 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" #yes it's correct
>> I know we discussed this already, and that -mingw32 is indeed the 
>> correct
>> kernel part, but could you add a comment that is a bit more elaborate?
> ok
>>
>>> +    CT_TARGET_SYS=
>>> +}
>>> +
>>> +do_kernel_get() {
>>> +    CT_GetFile "mingw-w64-v${CT_WINAPI_VERSION}" \
>>> + http://downloads.sourceforge.net/sourceforge/mingw-w64
>>> +}
>>> +
>>> +do_kernel_extract() {
>>> +    CT_Extract "mingw-w64-v${CT_WINAPI_VERSION}"
>> Even if no patch for now, you have to call CT_Patch anyway (see 
>> below, too).
> i forgot
>>
>>> +}
>>> +
>>> +do_kernel_headers() {
>> sdk_opt is a local variable, you have to declare it. Usually, we use 
>> bash
>> arrays for options. Here, it is not really important, as you only 
>> have one
>> option, but nonetheless, I'd rather have consistent code:
>>      local -a sdk_opts
> ok
>>
>> and then, to add a configure option:
>>
>>      sdk_opts+=( "option" )
>>
>>> +    CT_DoStep INFO "Installing kernel headers"
>>> +
>>> +    mkdir -p "${CT_HEADERS_DIR}"
>>> +
>>> +    case "${CT_MINGW_DIRECTX}:${CT_MINGW_DDK}" in
>>> +        y:y)    sdk_opt="--enable-sdk=all";;
>>> +        y:)     sdk_opt="--enable-sdk=directx";;
>>> +        :y)     sdk_opt="--enable-sdk=ddk";;
>>> +        :)      sdk_opt="";;
>> Empty statement for the ':' case:
>>          :)  ;;
> ok
>>> +    esac
>>> +
>>> +    CT_mkdir_pushd "${CT_BUILD_DIR}/build-header-build-${CT_BUILD}"
>>> +
>>> +    CT_DoLog EXTRA "Configuring Headers"
>>> +
>>> +    CT_DoExecLog CFG                                \
>>> + 
>>> "${CT_SRC_DIR}/mingw-w64-v${CT_WINAPI_VERSION}/mingw-w64-headers/configure" 
>>> \
>>> +    --build=${CT_BUILD}                \
>> Space-damage:
>>    - no leading tabs,
>>    - trailing '\' are not aligned; it is OK for single-word lines (like
>>      the ./configure line) to be longer than 80 chars, but other '\'
>>      should all be aligned together, preferably to the longest line;
>>      something like:
>>
>>      CT_DoExecLog CFG              \
>>          "veeeeeeeeerrrryyyyy-loooooooooooooong-configure-line" \
>>              --option1="value1"    \
>>              --option2="value2"    \
>>              ${options}
>>
>>> + --host=${CT_TARGET}                              \
>>> +        --prefix="${CT_SYSROOT_DIR}"                        \
> ok
>> Any reason why you do not use --prefix=/usr, and pass 
>> DESTDIR=${SYSROOT_DIR}
>> at install time?
>>
>> --prefix is for run-time, so the sysroot directory (where target stuff
>> gets installed) does not exist at runtime, while DESTDIR is for where to
>> install stuff.
> No there is no reason. I will try that way
>>
>>> +        "${sdk_opt}"
>>> +    CT_DoLog EXTRA "Compile Headers"
>>> +    CT_DoExecLog ALL make
>>> +
>>> +    CT_DoLog EXTRA "Installing Headers"
>>> +    CT_DoExecLog ALL make install
>> make DESTDIR="${CT_SYSROOT_DIR}" install
>>
>>> +    CT_Popd
>>> +
>>> +    CT_DoExecLog ALL cp -r 
>>> "${CT_SYSROOT_DIR}/${CT_TARGET}/include/"*   \
>>> +                     "${CT_HEADERS_DIR}"
>> That's what is weird with mingw and the way you install the headers: 
>> they
>> are installed in sysroot/tuple/include, when we want them in
>> sysroot/usr/include (and by the way, your code only copies them , so 
>> they
>> still are present in the original place. What path will the 
>> pre-processor
>> search for?
>>
>> I'll do a few tests here to see if --prefix=/usr and 
>> DESTDIR=${sysroot_dir}
>> can make a difference. If you can also look into this, that'd be 
>> great, too.
> I will try to simplify all this stuff
>>> diff -r 946d6d133a90 -r 0b819b844f8f scripts/build/libc/mingw.sh
>>> --- a/scripts/build/libc/mingw.sh    Mon Oct 22 22:40:01 2012 +0200
>>> +++ b/scripts/build/libc/mingw.sh    Thu Oct 25 11:46:51 2012 +0200
>> [--SNIP--]
>>>   do_libc_extract() {
>>> -    CT_Extract "mingwrt-${CT_MINGWRT_VERSION}-mingw32-src"
>>> -
>>> -    if [ -n "${CT_MINGW_PDCURSES}" ]; then
>>> -        CT_Extract "PDCurses-${CT_MINGW_PDCURSES_VERSION}"
>>> -        CT_Patch "PDCurses" "${CT_MINGW_PDCURSES_VERSION}"
>>> -    fi
>>> -    if [ -n "${CT_MINGW_GNURX}" ]; then
>>> -        CT_Extract "mingw-libgnurx-${CT_MINGW_GNURX_VERSION}-src"
>>> -        CT_Patch "mingw-libgnurx" "${CT_MINGW_GNURX_VERSION}-src"
>>> -    fi
>>> +    CT_Extract "mingw-w64-v${CT_WINAPI_VERSION}"
>> Even if there are no patches for now, you still have to call CT_Patch,
>> so it is in-line with the rest of the components.
> ok
>> If there is no patch, CT_Patch will just do nothing.
>>
>>>   }
>>>     do_libc_check_config() {
>>> @@ -40,117 +14,36 @@
>>>   do_libc_start_files() {
>>>       CT_DoStep INFO "Installing C library headers"
>>>   -    CT_DoLog EXTRA "Installing MinGW Runtime headers"
>>> -    mkdir -p "${CT_HEADERS_DIR}"
>>> -    cp -r 
>>> ${CT_SRC_DIR}/mingwrt-${CT_MINGWRT_VERSION}-mingw32-src/include/* \
>>> -          ${CT_HEADERS_DIR}
>>> -
>>>       # 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 "usr" "${CT_SYSROOT_DIR}/mingw"
>>> +    CT_DoExecLog ALL ln -sv "${CT_TARGET}" "${CT_SYSROOT_DIR}/mingw"
>> And this change should no longer be needed if we use the proper 
>> prefix at
>> configure time. Also, the headers are installed by the 'kernel', so it
>> should be the 'kernel' script that does the symlink.
>>
>> Which makes me think... For MingW, do we really have a 'kernel' 
>> per-say, or
>> can't we just build everything in the libc steps? It seems to me that 
>> would
>> be much cleaner.
>>
>> Note: the do_libc_start_files step is run just after the 
>> kernel_headers step.
>>
>>>       CT_EndStep
>>>   }
>>>     do_libc() {
>>> -    CT_DoStep INFO "Building MinGW files"
>>> +    CT_DoStep INFO "Building mingw32-w64 files"
>>>   -    CT_DoLog EXTRA "Configuring W32-API"
>>> +    CT_DoLog EXTRA "Configuring mingw-w64-crt"
>>>   -    mkdir -p "${CT_BUILD_DIR}/build-w32api"
>>> -    cd "${CT_BUILD_DIR}/build-w32api"
>>> +    mkdir -p "${CT_BUILD_DIR}/build-w64crt"
>>> +    cd "${CT_BUILD_DIR}/build-w64crt"
>>>         CT_DoExecLog 
>>> CFG                                                  \
>>> - CFLAGS="-I${CT_HEADERS_DIR}" \
>>> - LDFLAGS="-L${CT_SYSROOT_DIR}/lib" \
>>> - "${CT_SRC_DIR}/w32api-${CT_W32API_VERSION}-mingw32-src/configure" \
>>> + 
>>> "${CT_SRC_DIR}/mingw-w64-v${CT_WINAPI_VERSION}/mingw-w64-crt/configure" 
>>> \
>>> --prefix=${CT_SYSROOT_DIR} \
>> Again, prefix=/usr (yes, that's old code, let use that new stuff to 
>> fix it
>> at the same time) ...
>>
>>> - --includedir=${CT_HEADERS_DIR} \
>>>           --host=${CT_TARGET}
>>>   -    CT_DoLog EXTRA "Building W32-API"
>>> +    CT_DoLog EXTRA "Building mingw-w64-crt"
>>>       CT_DoExecLog ALL make ${JOBSFLAGS}
>>>   -    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"
>>> -
>>> -    CT_DoExecLog 
>>> CFG                                                    \
>>> - CFLAGS="-I${CT_HEADERS_DIR}" \
>>> - LDFLAGS="-L${CT_SYSROOT_DIR}/lib" \
>>> - "${CT_SRC_DIR}/mingwrt-${CT_MINGWRT_VERSION}-mingw32-src/configure" \
>>> - --prefix=${CT_SYSROOT_DIR}/ \
>>> - --includedir=${CT_HEADERS_DIR} \
>>> -        --host=${CT_TARGET}
>>> -
>>> -    CT_DoLog EXTRA "Building MinGW Runtime"
>>> -    CT_DoExecLog ALL make ${JOBSFLAGS}
>>> -
>>> -    CT_DoLog EXTRA "Installing MinGW Runtime"
>>> +    CT_DoLog EXTRA "Installing mingw-w64-crt"
>>>       CT_DoExecLog ALL make install
>> ... and, DESTDIR=${CT_SYSROOT_DIR}
>>
>>>       CT_EndStep
>>>   }
>>>     do_libc_finish() {
>>> -    CT_DoStep INFO "Installing MinGW Development libraries"
>>> -
>>> -    CT_Pushd "${CT_SYSROOT_DIR}"
>>> -    if [ -n "${CT_MINGW_DIRECTX}" ]; then
>>> -        CT_DoLog EXTRA "Installing DirectX development package"
>>> -        CT_Extract nochdir "directx-devel"
>>> -    fi
>>> -    if [ -n "${CT_MINGW_OPENGL}" ]; then
>>> -        CT_DoLog EXTRA "Installing OpenGL development package"
>>> -        CT_Extract nochdir "opengl-devel"
>>> -    fi
>>> -    CT_Popd
>>> -
>>> -    if [ -n "${CT_MINGW_PDCURSES}" ]; then
>>> -        CT_DoLog EXTRA "Building PDCurses development files"
>>> -        mkdir -p "${CT_BUILD_DIR}/build-pdcurses"
>>> -        cd "${CT_BUILD_DIR}/build-pdcurses"
>>> -
>>> -        make -f 
>>> ${CT_SRC_DIR}/PDCurses-${CT_MINGW_PDCURSES_VERSION}/win32/mingwin32.mak 
>>> libs \
>>> - PDCURSES_SRCDIR=${CT_SRC_DIR}/PDCurses-${CT_MINGW_PDCURSES_VERSION} \
>>> -            CROSS_COMPILE=${CT_TARGET}-
>>> -
>>> -        CT_DoLog EXTRA "Installing PDCurses development files"
>>> -        chmod a+r 
>>> ${CT_SRC_DIR}/PDCurses-${CT_MINGW_PDCURSES_VERSION}/*.h
>>> -        cp ${CT_SRC_DIR}/PDCurses-${CT_MINGW_PDCURSES_VERSION}/*.h \
>>> -           ${CT_HEADERS_DIR}/
>>> -        cp pdcurses.a ${CT_SYSROOT_DIR}/lib/libpdcurses.a
>>> -        cp pdcurses.a ${CT_SYSROOT_DIR}/lib/libncurses.a
>>> -    fi
>>> -
>>> -    if [ -n "${CT_MINGW_GNURX}" ]; then
>>> -        CT_DoLog EXTRA "Configuring GnuRX development files"
>>> -
>>> -        mkdir -p "${CT_BUILD_DIR}/build-gnurx"
>>> -        cd "${CT_BUILD_DIR}/build-gnurx"
>>> -
>>> -        CT_DoExecLog 
>>> CFG                                                        \
>>> - CFLAGS="${CT_CFLAGS_FOR_TARGET}" \
>>> - 
>>> "${CT_SRC_DIR}/mingw-libgnurx-${CT_MINGW_GNURX_VERSION}-src/configure" 
>>> \
>>> - --build=${CT_BUILD} \
>>> - --host=${CT_TARGET} \
>>> - --prefix=${CT_SYSROOT_DIR} \
>>> - --includedir=${CT_HEADERS_DIR} \
>>> - --enable-shared \
>>> -            --enable-static
>>> -
>>> -        CT_DoLog EXTRA "Building GnuRX development files"
>>> -        CT_DoExecLog ALL make ${JOBSFLAGS}
>>> -
>>> -        CT_DoLog EXTRA "Installing GnuRX development files"
>>> -        CT_DoExecLog ALL make install-dev
>>> -    fi
>>> -
>>> -    CT_EndStep
>>> +    :
>>>   }
>> Yeah! We get rid of libc_finish for MingW! Hurray! \o/
>> Let's bash on newlib, the last offender now. ;-)
>>
I have remove all code/configuration from kernel stuff. All is in mingw 
libc now. I will send you patch soon.
>> [--SNIP--]
>>
>> Now we have a working base that is able to build toolchains, can you 
>> look
>> at the comments above, so we can have a clean implementation?
>>
>> Thank you for this overall good work so far! :-)
>>
>> Regards,
>> Yann E. MORIN.
>>
>


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

Patch

diff -r 946d6d133a90 -r 0b819b844f8f config/kernel.in
--- a/config/kernel.in	Mon Oct 22 22:40:01 2012 +0200
+++ b/config/kernel.in	Thu Oct 25 11:46:51 2012 +0200
@@ -7,7 +7,7 @@ 
 config BARE_METAL
     bool
 
-config MINGW32
+config MINGW
     bool
 
 # Each target OS (aka kernel) that support shared libraries can select
diff -r 946d6d133a90 -r 0b819b844f8f config/kernel/mingw.in
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/config/kernel/mingw.in	Thu Oct 25 11:46:51 2012 +0200
@@ -0,0 +1,40 @@ 
+# mingw config options
+
+## depends on EXPERIMENTAL && ( ARCH_x86 )
+##
+## select MINGW
+##
+## 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 WINAPI_V_2_0_7
+    bool
+    prompt "2.0.7"
+
+config WINAPI_V_select
+    bool
+    prompt "Other version"
+
+endchoice
+
+config WINAPI_VERSION
+    string
+    prompt "Windoows API version" if WINAPI_V_select
+# Don't remove next line
+# CT_INSERT_VERSION_STRING_BELOW
+    default "2.0.7" if WINAPI_V_2_0_7
+    help
+      Enter the version number of the Windows API files to use
+
+config MINGW_DIRECTX
+    bool
+    prompt "Include DirectX development files"
+
+config MINGW_DDK
+    bool
+    prompt "Include DDK development files"
diff -r 946d6d133a90 -r 0b819b844f8f config/kernel/mingw32.in
--- a/config/kernel/mingw32.in	Mon Oct 22 22:40:01 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@ 
-# mingw32 config options
-
-## depends on EXPERIMENTAL && ( ARCH_x86 && ARCH_32 )
-##
-## 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
-
diff -r 946d6d133a90 -r 0b819b844f8f config/libc/eglibc.in
--- a/config/libc/eglibc.in	Mon Oct 22 22:40:01 2012 +0200
+++ b/config/libc/eglibc.in	Thu Oct 25 11:46:51 2012 +0200
@@ -1,6 +1,6 @@ 
 # eglibc options
 
-## depends on ! MINGW32 && ! BARE_METAL && ARCH_USE_MMU
+## depends on ! MINGW && ! BARE_METAL && ARCH_USE_MMU
 ##
 ## select LIBC_SUPPORT_NPTL
 ## select LIBC_SUPPORT_LINUXTHREADS
diff -r 946d6d133a90 -r 0b819b844f8f config/libc/glibc.in
--- a/config/libc/glibc.in	Mon Oct 22 22:40:01 2012 +0200
+++ b/config/libc/glibc.in	Thu Oct 25 11:46:51 2012 +0200
@@ -1,6 +1,6 @@ 
 # glibc options
 
-## depends on ! MINGW32 && ! BARE_METAL && ARCH_USE_MMU
+## depends on ! MINGW && ! BARE_METAL && ARCH_USE_MMU
 ##
 ## select LIBC_SUPPORT_NPTL
 ##
diff -r 946d6d133a90 -r 0b819b844f8f config/libc/mingw.in
--- a/config/libc/mingw.in	Mon Oct 22 22:40:01 2012 +0200
+++ b/config/libc/mingw.in	Thu Oct 25 11:46:51 2012 +0200
@@ -1,33 +1,7 @@ 
 # mingw options
 
-## depends on MINGW32
+## depends on MINGW
 ##
 ## 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
-
diff -r 946d6d133a90 -r 0b819b844f8f config/libc/mingw.in.2
--- a/config/libc/mingw.in.2	Mon Oct 22 22:40:01 2012 +0200
+++ b/config/libc/mingw.in.2	Thu Oct 25 11:46:51 2012 +0200
@@ -1,72 +1,1 @@ 
 # Part-2 of mingw C library options: development libraries
-
-config MINGW_DIRECTX
-    bool
-    prompt "Include DirectX development files"
-
-config MINGW_OPENGL
-    bool
-    prompt "Include OpenGL development files"
-
-config MINGW_PDCURSES
-    bool
-    prompt "Include PDCurses (NCurses library) development files"
-
-choice
-    bool
-    prompt "PDCurses library version"
-    depends on MINGW_PDCURSES
-
-config MINGW_PDCURSES_V_3_4
-    bool
-    prompt "3.4"
-
-# CT_INSERT_VERSION_ABOVE
-# Don't remove above line!
-
-config MINGW_PDCURSES_V_select
-    bool
-    prompt "Other version"
-
-endchoice
-
-config MINGW_PDCURSES_VERSION
-    string
-    prompt "PDCurses library version" if MINGW_PDCURSES_V_select
-    default "3.4" if MINGW_PDCURSES_V_3_4
-# CT_INSERT_VERSION_STRING_ABOVE
-# Don't remove above line!
-    help
-      Enter the version number of the PDCurses library to use
-
-config MINGW_GNURX
-    bool
-    prompt "Include GnuRX (regex library) development files"
-
-choice
-    bool
-    prompt "GnuRX library version"
-    depends on MINGW_GNURX
-
-config MINGW_GNURX_V_2_5_1
-    bool
-    prompt "2.5.1"
-
-# CT_INSERT_VERSION_ABOVE
-# Don't remove above line!
-
-config MINGW_GNURX_V_select
-    bool
-    prompt "Other version"
-
-endchoice
-
-config MINGW_GNURX_VERSION
-    string
-    prompt "GnuRX library version" if MINGW_GNURX_V_select
-    default "2.5.1" if MINGW_GNURX_V_2_5_1
-# CT_INSERT_VERSION_STRING_ABOVE
-# Don't remove above line!
-    help
-      Enter the version number of the Regex library to use
-
diff -r 946d6d133a90 -r 0b819b844f8f config/libc/uClibc.in
--- a/config/libc/uClibc.in	Mon Oct 22 22:40:01 2012 +0200
+++ b/config/libc/uClibc.in	Thu Oct 25 11:46:51 2012 +0200
@@ -1,6 +1,6 @@ 
 # uClibc options
 
-## depends on ! MINGW32 && ! BARE_METAL
+## depends on ! MINGW && ! BARE_METAL
 ##
 ## select LIBC_SUPPORT_LINUXTHREADS
 ## select LIBC_SUPPORT_THREADS_NONE
diff -r 946d6d133a90 -r 0b819b844f8f patches/PDCurses/3.4/mingw32_cross_compile.patch
--- a/patches/PDCurses/3.4/mingw32_cross_compile.patch	Mon Oct 22 22:40:01 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@ 
---- PDCurses-3.4.orig/win32/mingwin32.mak	2009-11-02 13:50:11.000000000 +0100
-+++ PDCurses-3.4/win32/mingwin32.mak	2009-11-02 13:53:43.000000000 +0100
-@@ -18,7 +18,7 @@
-
- PDCURSES_WIN_H	= $(osdir)/pdcwin.h
-
--CC		= gcc
-+CC		= $(CROSS_COMPILE)gcc
-
- ifeq ($(DEBUG),Y)
- 	CFLAGS  = -g -Wall -DPDCDEBUG
-@@ -30,8 +30,8 @@
-
- CFLAGS += -I$(PDCURSES_SRCDIR)
-
--BASEDEF		= $(PDCURSES_SRCDIR)\exp-base.def
--WIDEDEF		= $(PDCURSES_SRCDIR)\exp-wide.def
-+BASEDEF		= $(PDCURSES_SRCDIR)/exp-base.def
-+WIDEDEF		= $(PDCURSES_SRCDIR)/exp-wide.def
-
- DEFDEPS		= $(BASEDEF)
-
-@@ -46,17 +46,17 @@
-
- DEFFILE		= pdcurses.def
-
--LINK		= gcc
-+LINK		= $(CROSS_COMPILE)gcc
-
- ifeq ($(DLL),Y)
- 	CFLAGS += -DPDC_DLL_BUILD
--	LIBEXE = gcc $(DEFFILE)
-+	LIBEXE = $(CROSS_COMPILE)gcc $(DEFFILE)
- 	LIBFLAGS = -Wl,--out-implib,pdcurses.a -shared -o
- 	LIBCURSES = pdcurses.dll
- 	LIBDEPS = $(LIBOBJS) $(PDCOBJS) $(DEFFILE)
- 	CLEAN = $(LIBCURSES) *.a $(DEFFILE)
- else
--	LIBEXE = ar
-+	LIBEXE = $(CROSS_COMPILE)ar
- 	LIBFLAGS = rcv
- 	LIBCURSES = pdcurses.a
- 	LIBDEPS = $(LIBOBJS) $(PDCOBJS)
-@@ -70,24 +70,24 @@
- libs:	$(LIBCURSES)
-
- clean:
--	-del *.o
--	-del *.exe
--	-del $(CLEAN)
-+	-rm *.o
-+	-rm *.exe
-+	-rm $(CLEAN)
-
- demos:	$(DEMOS)
--	strip *.exe
-+	$(CROSS_COMPILE)strip *.exe
-
- $(DEFFILE): $(DEFDEPS)
- 	echo LIBRARY pdcurses > $@
- 	echo EXPORTS >> $@
--	type $(BASEDEF) >> $@
-+	cat $(BASEDEF) >> $@
- ifeq ($(WIDE),Y)
--	type $(WIDEDEF) >> $@
-+	cat $(WIDEDEF) >> $@
- endif
-
- $(LIBCURSES) : $(LIBDEPS)
- 	$(LIBEXE) $(LIBFLAGS) $@ $?
--	-copy pdcurses.a panel.a
-+	-cp pdcurses.a panel.a
-
- $(LIBOBJS) $(PDCOBJS) : $(PDCURSES_HEADERS)
- $(PDCOBJS) : $(PDCURSES_WIN_H)
---- PDCurses-3.4.orig/curses.h	2009-11-03 14:12:18.000000000 +0100
-+++ PDCurses-3.4./curses.h	2009-11-03 14:14:09.000000000 +0100
-@@ -82,7 +82,9 @@
-  *
-  */
-
-+#ifndef __bool_true_false_are_defined
- typedef unsigned char bool;    /* PDCurses Boolean type */
-+#endif
-
- #ifdef CHTYPE_LONG
- # if _LP64
diff -r 946d6d133a90 -r 0b819b844f8f patches/mingw-libgnurx/2.5.1/build-static-library.patch
--- a/patches/mingw-libgnurx/2.5.1/build-static-library.patch	Mon Oct 22 22:40:01 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@ 
---- mingw-libgnurx-2.5.1.orig/configure	2009-11-03 08:19:15.000000000 +0100
-+++ mingw-libgnurx-2.5.1/configure	2009-11-03 08:31:37.000000000 +0100
-@@ -273,7 +273,7 @@
- PACKAGE_STRING='MinGW libgnurx 2.5.1'
- PACKAGE_BUGREPORT='https://sourceforge.net/tracker/?group_id=2435&atid=102435'
-
--ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CC_QUALIFIED DLLVERSION ZIPCMD ZIPEXT MSVCLIB ac_ct_MSVCLIB GNURX_LIB install_dev LIBOBJS LTLIBOBJS'
-+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CC_QUALIFIED AR DLLVERSION ZIPCMD ZIPEXT MSVCLIB ac_ct_MSVCLIB GNURX_LIB install_dev LIBOBJS LTLIBOBJS'
- ac_subst_files=''
-
- # Initialize some variables set by options.
-@@ -2190,21 +2190,54 @@
-
- fi
- rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
--ac_ext=c
--ac_cpp='$CPP $CPPFLAGS'
--ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
--ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
--ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
--  ac_ext=c
-+
-+for ac_prog in ar; do
-+set dummy ${ac_tool_prefix}$ac_prog; ac_word=$2
-+echo "$as_me:$LINENO: checking for $ac_word" >&5
-+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-+if test "${ac_cv_prog_AR+set}" = set; then
-+  echo $ECHO_N "(cached) $ECHO_C" >&6
-+else
-+  if test -n "$AR"; then
-+  ac_cv_prog_AR="$AR" # Let the user override the test.
-+else
-+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-+for as_dir in $PATH
-+do
-+  IFS=$as_save_IFS
-+  test -z "$as_dir" && as_dir=.
-+  for ac_exec_ext in '' $ac_executable_extensions; do
-+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-+    ac_cv_prog_AR="$ac_tool_prefix$ac_prog"
-+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-+    break 2
-+  fi
-+done
-+done
-+
-+  test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar"
-+fi
-+fi
-+AR=$ac_cv_prog_AR
-+if test -n "$AR"; then
-+  echo "$as_me:$LINENO: result: $AR" >&5
-+echo "${ECHO_T}$AR" >&6
-+else
-+  echo "$as_me:$LINENO: result: no" >&5
-+echo "${ECHO_T}no" >&6
-+fi
-+done
-+
-+ac_ext=c
- ac_cpp='$CPP $CPPFLAGS'
- ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
- ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
- ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-- popCFLAGS=$CFLAGS
-- echo 'int main(void){return 0;}' > conftest.$ac_ext
-- echo "$as_me:$LINENO: checking whether $CC accepts the -mthreads option" >&5
-+popCFLAGS=$CFLAGS
-+echo 'int main(void){return 0;}' > conftest.$ac_ext
-+echo "$as_me:$LINENO: checking whether $CC accepts the -mthreads option" >&5
- echo $ECHO_N "checking whether $CC accepts the -mthreads option... $ECHO_C" >&6
-    CFLAGS="$popCFLAGS $CC_QUALIFIED -mthreads"
-    if (eval $ac_compile) 2>&5; then
-@@ -3038,6 +3069,7 @@
- s,@EXEEXT@,$EXEEXT,;t t
- s,@OBJEXT@,$OBJEXT,;t t
- s,@CC_QUALIFIED@,$CC_QUALIFIED,;t t
-+s,@AR@,$AR,;t t
- s,@DLLVERSION@,$DLLVERSION,;t t
- s,@ZIPCMD@,$ZIPCMD,;t t
- s,@ZIPEXT@,$ZIPEXT,;t t
---- mingw-libgnurx-2.5.1.orig/Makefile.in	2009-11-03 08:17:49.000000000 +0100
-+++ mingw-libgnurx-2.5.1/Makefile.in	2009-11-03 08:57:37.000000000 +0100
-@@ -39,6 +39,7 @@
- mandir = @mandir@
-
- CC = @CC_QUALIFIED@
-+AR = @AR@
- CFLAGS = @CFLAGS@ -I ${srcdir}
- LDFLAGS = @LDFLAGS@
-
-@@ -67,8 +68,8 @@
- libgnurx-$(DLLVERSION).dll libgnurx.dll.a: $(OBJECTS)
- 	$(CC) $(CFLAGS) -shared -o libgnurx-$(DLLVERSION).dll $(LDFLAGS) $(OBJECTS)
-
--libregex.a: libgnurx.dll.a
--	cp -p libgnurx.dll.a $@
-+libregex.a: $(OBJECTS)
-+	$(AR) cru $@ $(OBJECTS)
-
- gnurx.lib: libgnurx-$(DLLVERSION).dll
diff -r 946d6d133a90 -r 0b819b844f8f samples/i686-pc-mingw32/crosstool.config
--- a/samples/i686-pc-mingw32/crosstool.config	Mon Oct 22 22:40:01 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@ 
-CT_EXPERIMENTAL=y
-CT_LOCAL_TARBALLS_DIR="${HOME}/src"
-CT_SAVE_TARBALLS=y
-CT_LOG_EXTRA=y
-CT_ARCH_ARCH="i686"
-CT_ARCH_x86=y
-CT_TARGET_VENDOR="pc"
-CT_KERNEL_mingw32=y
-CT_BINUTILS_V_2_21_1a=y
-CT_BINUTILS_PLUGINS=y
-CT_CC_V_4_4_5=y
-CT_CC_LANG_CXX=y
-CT_MINGW_DIRECTX=y
-CT_MINGW_OPENGL=y
-CT_MINGW_PDCURSES=y
-CT_MINGW_GNURX=y
-CT_GMP_V_4_3_2=y
-CT_MPFR_V_2_4_1=y
-CT_PPL_V_0_10_2=y
-CT_CLOOG_V_0_15_10=y
diff -r 946d6d133a90 -r 0b819b844f8f samples/i686-pc-mingw32/reported.by
--- a/samples/i686-pc-mingw32/reported.by	Mon Oct 22 22:40:01 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@ 
-reporter_name="Bart vdr. Meulen <bartvdrmeulen@gmail.com>"
-reporter_url=""
-reporter_comment="Config to build cross-compiler with mingw as kernel type"
diff -r 946d6d133a90 -r 0b819b844f8f samples/i686-unknown-mingw32/crosstool.config
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/samples/i686-unknown-mingw32/crosstool.config	Thu Oct 25 11:46:51 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_ARCH="i686"
+CT_ARCH_32=y
+CT_ARCH_x86=y
+CT_KERNEL_mingw=y
+CT_BINUTILS_V_2_21_1a=y
+CT_BINUTILS_PLUGINS=y
+CT_CC_V_4_5_2=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 0b819b844f8f samples/i686-unknown-mingw32/reported.by
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/samples/i686-unknown-mingw32/reported.by	Thu Oct 25 11:46:51 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 as kernel type for 32 bits Windows target"
diff -r 946d6d133a90 -r 0b819b844f8f samples/x86_64-unknown-mingw32/crosstool.config
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/samples/x86_64-unknown-mingw32/crosstool.config	Thu Oct 25 11:46:51 2012 +0200
@@ -0,0 +1,17 @@ 
+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_KERNEL_mingw=y
+CT_BINUTILS_V_2_21_1a=y
+CT_BINUTILS_PLUGINS=y
+CT_CC_V_4_5_2=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 0b819b844f8f samples/x86_64-unknown-mingw32/reported.by
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/samples/x86_64-unknown-mingw32/reported.by	Thu Oct 25 11:46:51 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 as kernel type for 64 bits Windows target"
diff -r 946d6d133a90 -r 0b819b844f8f scripts/build/kernel/mingw.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/build/kernel/mingw.sh	Thu Oct 25 11:46:51 2012 +0200
@@ -0,0 +1,54 @@ 
+# 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" #yes it's correct
+    CT_TARGET_SYS=
+}
+
+do_kernel_get() {
+    CT_GetFile "mingw-w64-v${CT_WINAPI_VERSION}" \
+        http://downloads.sourceforge.net/sourceforge/mingw-w64
+}
+
+do_kernel_extract() {
+    CT_Extract "mingw-w64-v${CT_WINAPI_VERSION}"
+}
+
+do_kernel_headers() {
+    CT_DoStep INFO "Installing kernel headers"
+
+    mkdir -p "${CT_HEADERS_DIR}"
+
+    case "${CT_MINGW_DIRECTX}:${CT_MINGW_DDK}" in
+        y:y)    sdk_opt="--enable-sdk=all";;
+        y:)     sdk_opt="--enable-sdk=directx";;
+        :y)     sdk_opt="--enable-sdk=ddk";;
+        :)      sdk_opt="";;
+    esac
+
+    CT_mkdir_pushd "${CT_BUILD_DIR}/build-header-build-${CT_BUILD}"
+
+    CT_DoLog EXTRA "Configuring Headers"
+
+    CT_DoExecLog CFG                                \
+    "${CT_SRC_DIR}/mingw-w64-v${CT_WINAPI_VERSION}/mingw-w64-headers/configure" \
+	--build=${CT_BUILD}			    \
+        --host=${CT_TARGET}                              \
+        --prefix="${CT_SYSROOT_DIR}"                        \
+        "${sdk_opt}"
+
+    CT_DoLog EXTRA "Compile Headers"
+    CT_DoExecLog ALL make
+
+    CT_DoLog EXTRA "Installing Headers"
+    CT_DoExecLog ALL make install
+    
+    CT_Popd
+
+    CT_DoExecLog ALL cp -r "${CT_SYSROOT_DIR}/${CT_TARGET}/include/"*   \
+                     "${CT_HEADERS_DIR}"
+
+    CT_EndStep
+}
diff -r 946d6d133a90 -r 0b819b844f8f scripts/build/kernel/mingw32.sh
--- a/scripts/build/kernel/mingw32.sh	Mon Oct 22 22:40:01 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@ 
-# 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_HEADERS_DIR}"
-    cp -r ${CT_SRC_DIR}/w32api-${CT_W32API_VERSION}-mingw32-src/include/*   \
-          ${CT_HEADERS_DIR}
-
-    CT_EndStep
-}
diff -r 946d6d133a90 -r 0b819b844f8f scripts/build/libc/mingw.sh
--- a/scripts/build/libc/mingw.sh	Mon Oct 22 22:40:01 2012 +0200
+++ b/scripts/build/libc/mingw.sh	Thu Oct 25 11:46:51 2012 +0200
@@ -1,36 +1,10 @@ 
-do_libc_get() {
-    CT_GetFile "mingwrt-${CT_MINGWRT_VERSION}-mingw32-src" \
-        http://downloads.sourceforge.net/sourceforge/mingw
-
-    if [ -n "${CT_MINGW_DIRECTX}" ]; then
-        CT_GetFile "directx-devel" \
-            http://www.libsdl.org/extras/win32/common
-    fi
-    if [ -n "${CT_MINGW_OPENGL}" ]; then
-        CT_GetFile "opengl-devel" \
-            http://www.libsdl.org/extras/win32/common
-    fi
-    if [ -n "${CT_MINGW_PDCURSES}" ]; then
-        CT_GetFile "PDCurses-${CT_MINGW_PDCURSES_VERSION}" \
-            http://downloads.sourceforge.net/sourceforge/pdcurses
-    fi
-    if [ -n "${CT_MINGW_GNURX}" ]; then
-        CT_GetFile "mingw-libgnurx-${CT_MINGW_GNURX_VERSION}-src" \
-            http://downloads.sourceforge.net/sourceforge/mingw
-    fi
+do_libc_get() { 
+    CT_GetFile "mingw-w64-v${CT_WINAPI_VERSION}" \
+        http://downloads.sourceforge.net/sourceforge/mingw-w64
 }
 
 do_libc_extract() {
-    CT_Extract "mingwrt-${CT_MINGWRT_VERSION}-mingw32-src"
-
-    if [ -n "${CT_MINGW_PDCURSES}" ]; then
-        CT_Extract "PDCurses-${CT_MINGW_PDCURSES_VERSION}"
-        CT_Patch "PDCurses" "${CT_MINGW_PDCURSES_VERSION}"
-    fi
-    if [ -n "${CT_MINGW_GNURX}" ]; then
-        CT_Extract "mingw-libgnurx-${CT_MINGW_GNURX_VERSION}-src"
-        CT_Patch "mingw-libgnurx" "${CT_MINGW_GNURX_VERSION}-src"
-    fi
+    CT_Extract "mingw-w64-v${CT_WINAPI_VERSION}"
 }
 
 do_libc_check_config() {
@@ -40,117 +14,36 @@ 
 do_libc_start_files() {
     CT_DoStep INFO "Installing C library headers"
 
-    CT_DoLog EXTRA "Installing MinGW Runtime headers"
-    mkdir -p "${CT_HEADERS_DIR}"
-    cp -r ${CT_SRC_DIR}/mingwrt-${CT_MINGWRT_VERSION}-mingw32-src/include/* \
-          ${CT_HEADERS_DIR}
-
     # 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 "usr" "${CT_SYSROOT_DIR}/mingw"
+    CT_DoExecLog ALL ln -sv "${CT_TARGET}" "${CT_SYSROOT_DIR}/mingw"
 
     CT_EndStep
 }
 
 do_libc() {
-    CT_DoStep INFO "Building MinGW files"
+    CT_DoStep INFO "Building mingw32-w64 files"
 
-    CT_DoLog EXTRA "Configuring W32-API"
+    CT_DoLog EXTRA "Configuring mingw-w64-crt"
 
-    mkdir -p "${CT_BUILD_DIR}/build-w32api"
-    cd "${CT_BUILD_DIR}/build-w32api"
+    mkdir -p "${CT_BUILD_DIR}/build-w64crt"
+    cd "${CT_BUILD_DIR}/build-w64crt"
 
     CT_DoExecLog CFG                                                  \
-    CFLAGS="-I${CT_HEADERS_DIR}"                                      \
-    LDFLAGS="-L${CT_SYSROOT_DIR}/lib"                                 \
-    "${CT_SRC_DIR}/w32api-${CT_W32API_VERSION}-mingw32-src/configure" \
+    "${CT_SRC_DIR}/mingw-w64-v${CT_WINAPI_VERSION}/mingw-w64-crt/configure" \
         --prefix=${CT_SYSROOT_DIR}                                    \
-        --includedir=${CT_HEADERS_DIR}                                \
         --host=${CT_TARGET}
 
-    CT_DoLog EXTRA "Building W32-API"
+    CT_DoLog EXTRA "Building mingw-w64-crt"
     CT_DoExecLog ALL make ${JOBSFLAGS}
 
-    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"
-
-    CT_DoExecLog CFG                                                    \
-    CFLAGS="-I${CT_HEADERS_DIR}"                                        \
-    LDFLAGS="-L${CT_SYSROOT_DIR}/lib"                                   \
-    "${CT_SRC_DIR}/mingwrt-${CT_MINGWRT_VERSION}-mingw32-src/configure" \
-        --prefix=${CT_SYSROOT_DIR}/                                     \
-        --includedir=${CT_HEADERS_DIR}                                  \
-        --host=${CT_TARGET}
-
-    CT_DoLog EXTRA "Building MinGW Runtime"
-    CT_DoExecLog ALL make ${JOBSFLAGS}
-
-    CT_DoLog EXTRA "Installing MinGW Runtime"
+    CT_DoLog EXTRA "Installing mingw-w64-crt"
     CT_DoExecLog ALL make install
 
     CT_EndStep
 }
 
 do_libc_finish() {
-    CT_DoStep INFO "Installing MinGW Development libraries"
-
-    CT_Pushd "${CT_SYSROOT_DIR}"
-    if [ -n "${CT_MINGW_DIRECTX}" ]; then
-        CT_DoLog EXTRA "Installing DirectX development package"
-        CT_Extract nochdir "directx-devel"
-    fi
-    if [ -n "${CT_MINGW_OPENGL}" ]; then
-        CT_DoLog EXTRA "Installing OpenGL development package"
-        CT_Extract nochdir "opengl-devel"
-    fi
-    CT_Popd
-
-    if [ -n "${CT_MINGW_PDCURSES}" ]; then
-        CT_DoLog EXTRA "Building PDCurses development files"
-        mkdir -p "${CT_BUILD_DIR}/build-pdcurses"
-        cd "${CT_BUILD_DIR}/build-pdcurses"
-
-        make -f ${CT_SRC_DIR}/PDCurses-${CT_MINGW_PDCURSES_VERSION}/win32/mingwin32.mak libs \
-            PDCURSES_SRCDIR=${CT_SRC_DIR}/PDCurses-${CT_MINGW_PDCURSES_VERSION} \
-            CROSS_COMPILE=${CT_TARGET}-
-
-        CT_DoLog EXTRA "Installing PDCurses development files"
-        chmod a+r ${CT_SRC_DIR}/PDCurses-${CT_MINGW_PDCURSES_VERSION}/*.h
-        cp ${CT_SRC_DIR}/PDCurses-${CT_MINGW_PDCURSES_VERSION}/*.h \
-           ${CT_HEADERS_DIR}/
-        cp pdcurses.a ${CT_SYSROOT_DIR}/lib/libpdcurses.a
-        cp pdcurses.a ${CT_SYSROOT_DIR}/lib/libncurses.a
-    fi
-
-    if [ -n "${CT_MINGW_GNURX}" ]; then
-        CT_DoLog EXTRA "Configuring GnuRX development files"
-
-        mkdir -p "${CT_BUILD_DIR}/build-gnurx"
-        cd "${CT_BUILD_DIR}/build-gnurx"
-
-        CT_DoExecLog CFG                                                        \
-        CFLAGS="${CT_CFLAGS_FOR_TARGET}"                                        \
-        "${CT_SRC_DIR}/mingw-libgnurx-${CT_MINGW_GNURX_VERSION}-src/configure"  \
-            --build=${CT_BUILD}                                                 \
-            --host=${CT_TARGET}                                                 \
-            --prefix=${CT_SYSROOT_DIR}                                          \
-            --includedir=${CT_HEADERS_DIR}                                      \
-            --enable-shared                                                     \
-            --enable-static
-
-        CT_DoLog EXTRA "Building GnuRX development files"
-        CT_DoExecLog ALL make ${JOBSFLAGS}
-
-        CT_DoLog EXTRA "Installing GnuRX development files"
-        CT_DoExecLog ALL make install-dev
-    fi
-
-    CT_EndStep
+    :
 }
-