scripts/build/libc/mingw.sh
author Bart vdr Meulen <bartvdrmeulen@gmail.com>
Sun Jul 11 21:36:20 2010 +0200 (2010-07-11)
changeset 2017 f637b6c2162b
child 2018 860de6018501
permissions -rw-r--r--
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>
     1 do_libc_get() {
     2     CT_GetFile "mingwrt-${CT_MINGWRT_VERSION}-mingw32-src" \
     3         http://downloads.sourceforge.net/sourceforge/mingw
     4 }
     5 
     6 do_libc_extract() {
     7     CT_Extract "mingwrt-${CT_MINGWRT_VERSION}-mingw32-src"
     8 }
     9 
    10 do_libc_check_config() {
    11     :
    12 }
    13 
    14 do_libc_headers() {
    15     CT_DoStep INFO "Installing C library headers"
    16 
    17     CT_DoLog EXTRA "Installing MinGW Runtime headers"
    18     mkdir -p "${CT_SYSROOT_DIR}/include"
    19     cp -r ${CT_SRC_DIR}/mingwrt-${CT_MINGWRT_VERSION}-mingw32/include \
    20           ${CT_SYSROOT_DIR}
    21 
    22     CT_EndStep
    23 }
    24 
    25 do_libc_start_files() {
    26     :
    27 }
    28 
    29 do_libc() {
    30     CT_DoStep INFO "Building MinGW files"
    31 
    32     CT_DoLog EXTRA "Configuring W32-API"
    33 
    34     mkdir -p "${CT_BUILD_DIR}/build-w32api"
    35     cd "${CT_BUILD_DIR}/build-w32api"
    36 
    37     CFLAGS="-I${CT_SYSROOT_DIR}/include"                          \
    38     LDFLAGS="-L${CT_SYSROOT_DIR}/lib"                             \
    39     CT_DoExecLog ALL                                              \
    40     "${CT_SRC_DIR}/w32api-${CT_W32API_VERSION}-mingw32/configure" \
    41         --prefix=${CT_SYSROOT_DIR}                                \
    42         --host=${CT_TARGET}
    43 
    44     CT_DoLog EXTRA "Building W32-API"
    45     CT_DoExecLog ALL make ${PARALLELMFLAGS}
    46 
    47     CT_DoLog EXTRA "Installing W32-API"
    48     CT_DoExecLog ALL make install
    49 
    50     CT_DoLog EXTRA "Configuring MinGW Runtime"
    51 
    52     mkdir -p "${CT_BUILD_DIR}/build-mingwrt"
    53     cd "${CT_BUILD_DIR}/build-mingwrt"
    54 
    55     CFLAGS="-I${CT_SYSROOT_DIR}/include"                            \
    56     LDFLAGS="-L${CT_SYSROOT_DIR}/lib"                               \
    57     CT_DoExecLog ALL                                                \
    58     "${CT_SRC_DIR}/mingwrt-${CT_MINGWRT_VERSION}-mingw32/configure" \
    59         --prefix=${CT_SYSROOT_DIR}/                                 \
    60         --host=${CT_TARGET}
    61 
    62     CT_DoLog EXTRA "Building MinGW Runtime"
    63     CT_DoExecLog ALL make ${PARALLELMFLAGS}
    64 
    65     CT_DoLog EXTRA "Installing MinGW Runtime"
    66     CT_DoExecLog ALL make install
    67 
    68     CT_EndStep
    69 }
    70 
    71 do_libc_finish() {
    72  :
    73 }
    74