scripts/build/libc/mingw.sh
author Martin Guy <martinwguy@gmail.com>
Sun Mar 31 04:07:38 2013 +0000 (2013-03-31)
changeset 3203 74fd467be5aa
parent 3112 6cb56b3f2d34
permissions -rw-r--r--
arch/avr32: Fix download of header files

This patch fixes the download of the avr32 headers in crosstool-ng by
fetching them directly from Atmel's web site instead of the now-broken URL
given by the original author of the avr32-header-fetching modification,
who fetched them from a copy on his own, now-defunct server.

It also adds the necessary logic to extract from a zip file, as that is
how the headers are packaged.

To configure it for avr32 after launching ct-ng menuconfig in an empty
directory:

Paths and misc options ->
Shell to use as CONFIG_SHELL = sh
Target options ->
Target Architecture = avr32
Toolchain options ->
Tuple's alias = avr32
Binary utilities ->
binutils version = 2.18a
C compiler
gcc version = 4.2.2
C-library
newlib version = 1.17.0
Enable IOs on long long = yes
Enable IOs on floats and doubles = yes
Disable the syscalls supplied with newlib = yes

CONFIG_SHELL is necessary to get round the "fragment: command not
found" bug when binutils-2.18 is configured using bash.

Prepared against crosstool-ng mercurial trunk on 31 March 2012.

Signed-off-by: Martin Guy <martinwguy@gmail.com>
[yann.morin.1998@free.fr: update bundles sample accordingly]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Message-Id: <CAL4-wQrg_NQ7jm-NCADqeyQr9twyhtx42OUGNThP6gWeqZc=kw@mail.gmail.com>
Patchwork-Id: 232612
     1 # Copyright 2012 Yann Diorcet
     2 # Licensed under the GPL v2. See COPYING in the root of this package
     3 
     4 do_libc_get() { 
     5     CT_GetFile "mingw-w64-v${CT_WINAPI_VERSION}" \
     6         http://downloads.sourceforge.net/sourceforge/mingw-w64
     7 }
     8 
     9 do_libc_extract() {
    10     CT_Extract "mingw-w64-v${CT_WINAPI_VERSION}"
    11     CT_Pushd "${CT_SRC_DIR}/mingw-w64-v${CT_WINAPI_VERSION}/"
    12     CT_Patch nochdir mingw-w64 "${CT_WINAPI_VERSION}"
    13     CT_Popd
    14 }
    15 
    16 do_libc_check_config() {
    17     :
    18 }
    19 
    20 do_libc_start_files() {
    21     local -a sdk_opts
    22 
    23     CT_DoStep INFO "Installing C library headers"
    24 
    25     case "${CT_MINGW_DIRECTX}:${CT_MINGW_DDK}" in
    26         y:y)    sdk_opts+=( "--enable-sdk=all"     );;
    27         y:)     sdk_opts+=( "--enable-sdk=directx" );;
    28         :y)     sdk_opts+=( "--enable-sdk=ddk"     );;
    29         :)      ;;
    30     esac
    31 
    32     CT_mkdir_pushd "${CT_BUILD_DIR}/build-mingw-w64-headers"
    33 
    34     CT_DoLog EXTRA "Configuring Headers"
    35 
    36     CT_DoExecLog CFG        \
    37     "${CT_SRC_DIR}/mingw-w64-v${CT_WINAPI_VERSION}/mingw-w64-headers/configure" \
    38         --build=${CT_BUILD} \
    39         --host=${CT_TARGET} \
    40         --prefix=/usr       \
    41         "${sdk_opts[@]}"
    42 
    43     CT_DoLog EXTRA "Compile Headers"
    44     CT_DoExecLog ALL make
    45 
    46     CT_DoLog EXTRA "Installing Headers"
    47     CT_DoExecLog ALL make install DESTDIR=${CT_SYSROOT_DIR}
    48     
    49     CT_Popd
    50 
    51     # It seems mingw is strangely set up to look into /mingw instead of
    52     # /usr (notably when looking for the headers). This symlink is
    53     # here to workaround this, and seems to be here to last... :-/
    54     CT_DoExecLog ALL ln -sv "usr/${CT_TARGET}" "${CT_SYSROOT_DIR}/mingw"
    55 
    56     CT_EndStep
    57 }
    58 
    59 do_libc() {
    60     CT_DoStep INFO "Building mingw-w64 files"
    61 
    62     CT_DoLog EXTRA "Configuring mingw-w64-crt"
    63 
    64     CT_mkdir_pushd "${CT_BUILD_DIR}/build-mingw-w64-crt"
    65 
    66     CT_DoExecLog CFG                                                        \
    67     "${CT_SRC_DIR}/mingw-w64-v${CT_WINAPI_VERSION}/mingw-w64-crt/configure" \
    68         --prefix=/usr                                                       \
    69         --build=${CT_BUILD}                                                 \
    70         --host=${CT_TARGET}                                                 \
    71 
    72     CT_DoLog EXTRA "Building mingw-w64-crt"
    73     CT_DoExecLog ALL make ${JOBSFLAGS}
    74 
    75     CT_DoLog EXTRA "Installing mingw-w64-crt"
    76     CT_DoExecLog ALL make install DESTDIR=${CT_SYSROOT_DIR}
    77 
    78     CT_EndStep
    79 }