scripts/build/debug/duma.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sat Apr 26 21:31:05 2008 +0000 (2008-04-26)
changeset 454 372b2f397baa
parent 237 131ee309e740
permissions -rw-r--r--
Configure tsocks with a simple heuristic.

Consider the proxy has to be in a 'local' network. It means it is directly
reachable by the local machine, even if the local machine has to hop through
one or more gates to reach the proxy (often the case in enterprise networks
where class A 10.0.0.0/8 is in fact sub-divided into smaller networks, each
one of them in a different location, eg. 10.1.0.0/16 in a place, while
10.2.0.0/16 would be on the other side of the world). Not being in the same
subnet does not mean the proxy is not available.

So we will build a mask with at most high bits set, which defines a network
that has both the local machine and the proxy. Because a machine may have
more than one interface, build a mask for each of them, removing 127.0.0.1
which is added automagically by tsocks, and removing duplicate masks.

If all of this does not work, then it means the local machine can NOT in fact
reach the proxy, which in turn means the user mis-configured something (most
probably a typo...).

/trunk/scripts/crosstool.sh | 61 52 9 0 +++++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 52 insertions(+), 9 deletions(-)
yann@236
     1
# Biuld script for D.U.M.A.
yann@236
     2
yann@236
     3
is_enabled="${CT_DUMA}"
yann@236
     4
yann@236
     5
do_print_filename() {
yann@236
     6
    [ "${CT_DUMA}" = "y" ] || return 0
yann@236
     7
    echo "duma_${CT_DUMA_VERSION}"
yann@236
     8
}
yann@236
     9
yann@236
    10
do_debug_duma_get() {
yann@236
    11
    CT_GetFile "duma_${CT_DUMA_VERSION}" http://mesh.dl.sourceforge.net/sourceforge/duma/
yann@236
    12
    # D.U.M.A. doesn't separate its name from its version with a dash,
yann@236
    13
    # but with an underscore. Create a link so that crosstool-NG can
yann@236
    14
    # work correctly:
yann@236
    15
    cd "${CT_TARBALLS_DIR}"
yann@236
    16
    duma_ext=`CT_GetFileExtension "duma_${CT_DUMA_VERSION}"`
yann@236
    17
    rm -f "duma-${CT_DUMA_VERSION}${duma_ext}"
yann@236
    18
    ln -sf "duma_${CT_DUMA_VERSION}${duma_ext}" "duma-${CT_DUMA_VERSION}${duma_ext}"
yann@236
    19
}
yann@236
    20
yann@236
    21
do_debug_duma_extract() {
yann@236
    22
    CT_ExtractAndPatch "duma-${CT_DUMA_VERSION}"
yann@236
    23
    cd "${CT_SRC_DIR}"
yann@236
    24
    rm -f "duma-${CT_DUMA_VERSION}"
yann@236
    25
    ln -sf "duma_${CT_DUMA_VERSION}" "duma-${CT_DUMA_VERSION}"
yann@236
    26
}
yann@236
    27
yann@236
    28
do_debug_duma_build() {
yann@236
    29
    CT_DoStep INFO "Installing D.U.M.A."
yann@236
    30
    CT_DoLog EXTRA "Copying sources"
yann@236
    31
    cp -a "${CT_SRC_DIR}/duma_${CT_DUMA_VERSION}" "${CT_BUILD_DIR}/build-duma"
yann@236
    32
    CT_Pushd "${CT_BUILD_DIR}/build-duma"
yann@236
    33
yann@236
    34
    DUMA_CPP=
yann@236
    35
    [ "${CT_CC_LANG_CXX}" = "y" ] && DUMA_CPP=1
yann@236
    36
yann@236
    37
    libs=
yann@236
    38
    [ "${CT_DUMA_A}" = "y" ] && libs="${libs} libduma.a"
yann@236
    39
    [ "${CT_DUMA_SO}" = "y" ] && libs="${libs} libduma.so.0.0"
yann@236
    40
    for lib in ${libs}; do
yann@236
    41
        CT_DoLog EXTRA "Building library \"${lib}\""
yann@236
    42
        make HOSTCC="${CT_CC_NATIVE}"       \
yann@236
    43
             HOSTCXX="${CT_CC_NATIVE}"      \
yann@237
    44
             CC="${CT_TARGET}-${CT_CC}"     \
yann@237
    45
             CXX="${CT_TARGET}-${CT_CC}"    \
yann@236
    46
             DUMA_CPP="${DUMA_CPP}"         \
yann@369
    47
             ${libs}                        2>&1 |CT_DoLog ALL
yann@236
    48
        CT_DoLog EXTRA "Installing library \"${lib}\""
yann@236
    49
        install -m 644 "${lib}" "${CT_SYSROOT_DIR}/usr/lib" 2>&1 |CT_DoLog ALL
yann@236
    50
    done
yann@236
    51
    if [ "${CT_DUMA_SO}" = "y" ]; then
yann@236
    52
        CT_DoLog EXTRA "Installing shared library links"
yann@236
    53
        ln -vsf libduma.so.0.0 "${CT_SYSROOT_DIR}/usr/lib/libduma.so.0" 2>&1 |CT_DoLog ALL
yann@236
    54
        ln -vsf libduma.so.0.0 "${CT_SYSROOT_DIR}/usr/lib/libduma.so"   2>&1 |CT_DoLog ALL
yann@236
    55
    fi
yann@236
    56
    CT_DoLog EXTRA "Installing LD_PRELOAD wrapper script"
yann@236
    57
    mkdir -p "${CT_DEBUG_INSTALL_DIR}/usr/bin"
yann@236
    58
    cp -v duma.sh                               \
yann@236
    59
       "${CT_DEBUG_INSTALL_DIR}/usr/bin/duma"   2>&1 |CT_DoLog ALL
yann@236
    60
yann@236
    61
    CT_EndStep
yann@236
    62
    CT_Popd
yann@236
    63
}
yann@236
    64