[BACK]Return to configure-cygwin CVS log [TXT][DIR] Up to [local] / OpenXM / src / ox_math / mathlink

File: [local] / OpenXM / src / ox_math / mathlink / configure-cygwin (download)

Revision 1.5, Tue Jul 19 10:43:22 2005 UTC (18 years, 10 months ago) by ohara
Branch: MAIN
CVS Tags: R_1_3_1-2, RELEASE_1_3_1_13b, RELEASE_1_2_3_12, KNOPPIX_2006, HEAD, DEB_REL_1_2_3-9
Changes since 1.4: +2 -2 lines

fixed bugs

#!/bin/sh
# $OpenXM: OpenXM/src/ox_math/mathlink/configure-cygwin,v 1.5 2005/07/19 10:43:22 ohara Exp $

BASE="/usr/local/mathematica/AddOns/MathLink/DeveloperKit"
OpenXM_HOME=${OpenXM_HOME:-../../../../OpenXM}
DISTDIR=${OpenXM_HOME}/../OpenXM_dist
DISTFILE=Windows-ml_v3r9.zip
URL=http://support.wolfram.com/mathematica/mathlink/updates/v3r9/"${DISTFILE}"

_fetch () {
    oxfetch.sh "${URL}" ${DISTDIR}
    if [ ! -f "${DISTDIR}/${DISTFILE}" ] ; then
        echo 'MathLink libraries cannot be fetched.'
        exit 1
    fi
    unzip -q "${DISTDIR}/${DISTFILE}"
}

_xcopy () {
    if [ -e ./ml ] ; then 
        rm -rf ./ml
    fi
    mkdir -p ./ml
    cp  "${BASE}"/Windows/CompilerAdditions/mldev32/*/* \
        "${BASE}"/Windows/SystemAdditions/* ./ml/
    chmod +x ./ml/*
    if [ -d ./Windows ]; then
        rm -rf ./Windows
    fi
}

_make () {
    if [ -d ./ml ]; then
        (cd ./ml ; _dlltool; _patch)
    fi
}

_dlltool () {
    for i in ml32i1 ml32i2; do
        (echo EXPORTS ; nm "$i"m.lib | grep 'T _' | sed 's/.* T _//' ) > $i.def
        dlltool --dllname $i.dll --def $i.def --output-lib lib$i.a -k
        rm -f $i.def
    done
}

_patch () {
    nm libml32i1.a | grep 'T _MLGetString@' > .patch
    if [ ! -s .patch ]; then
        mv -f mathlink.h mathlink.h.orig
        sed -e 's/^\(#[ 	]*define[ 	][ 	]*MLAPI\)[ 	][ 	]*APIENTRY[ 	]*/\1/' mathlink.h.orig > mathlink.h
    fi
}

_install () {
    if [ ! -d ${OpenXM_HOME}/bin ]; then 
        mkdir -p ${OpenXM_HOME}/bin
    fi
    install -m 755 ./ml/*.dll ./ml/*.mlp ${OpenXM_HOME}/bin/
}

if [ ! -f ./.configure_done ]; then 
    if [ ! -d "${BASE}" -o -f "${DISTDIR}/${DISTFILE}" ]; then 
        _fetch
        BASE=.
    fi
    _xcopy
    _make
    _install
    touch .configure_done 
fi