summaryrefslogtreecommitdiff
path: root/scripts/build/libfloat.sh
blob: 147d046115709ae7f4da2d3cc97b4c2ffafee4ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# This file adds functions to build libfloat
# Copyright 2007 Yann E. MORIN
# Licensed under the GPL v2. See COPYING in the root of this package

# Define libfloat functions depending on wether it is selected or not
if [ "${CT_ARCH_FLOAT_SW_LIBFLOAT}" = "y" ]; then

# Download libfloat
do_libfloat_get() {
    # Ah! libfloat separates the version string from the base name with
    # an underscore. We need to workaround this in a sane manner: soft link.
    local libfloat_file=`echo "${CT_LIBFLOAT_FILE}" |sed -r -e 's/^libfloat-/libfloat_/;'`
    CT_GetFile "${libfloat_file}"                                    \
               ftp://ftp.de.debian.org/debian/pool/main/libf/libfloat
    CT_Pushd "${CT_TARBALLS_DIR}"
    ext=`CT_GetFileExtension "${libfloat_file}"`
    ln -svf "${libfloat_file}${ext}" "${CT_LIBFLOAT_FILE}${ext}" |CT_DoLog DEBUG
    CT_Popd
}

# Extract libfloat
do_libfloat_extract() {
    CT_ExtractAndPatch "${CT_LIBFLOAT_FILE}"
}

# Build libfloat
do_libfloat() {
    # Here we build and install libfloat for the target, so that the C library
    # builds OK with those versions of gcc that have severed softfloat support
    # code
    CT_DoStep INFO "Installing software floating point emulation library libfloat"
    mkdir build-libfloat
    cd build-libfloat

    CT_Pushd "${CT_BUILD_DIR}"
    CT_DoLog EXTRA "Copying sources to build dir"
    ( cd "${CT_SRC_DIR}/${CT_LIBFLOAT_FILE}"; tar cf - . ) |tar xvf - |CT_DoLog ALL

    CT_DoLog EXTRA "Cleaning library"
    make clean 2>&1 |CT_DoLog ALL

    CT_DoLog EXTRA "Building library"
    make CROSS_COMPILE="${CT_CC_CORE_SHARED_PREFIX_DIR}/bin/${CT_TARGET}-" 2>&1 |CT_DoLog ALL

    CT_DoLog EXTRA "Installing library"
    make CROSS_COMPILE="${CT_CC_CORE_SHARED_PREFIX_DIR}/bin/${CT_TARGET}-"  \
         DESTDIR="${CT_SYSROOT_DIR}" install                                2>&1 |CT_DoLog ALL

    CT_Popd

    CT_EndStep
}

else # "${CT_ARCH_FLOAT_SW_LIBFLOAT}" != "y"

do_libfloat_get() {
    true
}
do_libfloat_extract() {
    true
}
do_libfloat() {
    true
}

fi