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