=================================================================== RCS file: /home/cvs/OpenXM/src/ox_math/mathlink/configure-cygwin,v retrieving revision 1.2 retrieving revision 1.3 diff -u -p -r1.2 -r1.3 --- OpenXM/src/ox_math/mathlink/configure-cygwin 2002/08/23 07:20:36 1.2 +++ OpenXM/src/ox_math/mathlink/configure-cygwin 2003/01/12 02:35:57 1.3 @@ -1,40 +1,71 @@ #!/bin/sh -# $OpenXM: OpenXM/src/ox_math/mathlink/configure-cygwin,v 1.1 2002/08/15 02:31:53 ohara Exp $ +# $OpenXM: OpenXM/src/ox_math/mathlink/configure-cygwin,v 1.2 2002/08/23 07:20:36 ohara Exp $ -ARCHIVE=Windows-ml_v3r8.zip -URL=http://support.wolfram.com/mathematica/mathlink/updates/v3r8/$ARCHIVE +ARCHIVE=Windows-ml_v3r9.zip +URL=http://support.wolfram.com/mathematica/mathlink/updates/v3r9/"${ARCHIVE}" +BASE="/usr/local/mathematica/AddOns/MathLink/DeveloperKit" +OpenXM_HOME=${OpenXM_HOME:-../../../../OpenXM} _fetch () { - if [ ! -f $ARCHIVE ] ; then - wget -nd $URL + if [ ! -f "${ARCHIVE}" ] ; then + wget --quiet --no-directories --timestamping "${URL}" fi + if [ ! -f "${ARCHIVE}" ] ; then + echo 'MathLink libraries cannot be fetched.' + exit 1 + fi + unzip -q "${ARCHIVE}" } -_unzip () { - if [ -f $ARCHIVE ] ; then - unzip $ARCHIVE - if [ -e mldev32 ] ; then - rm -rf mldev32 - fi - mv Windows/CompilerAdditions/mldev32 . - mv Windows/SystemAdditions/* mldev32/lib/ - chmod +x mldev32/bin/* - rm -rf Windows +_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 + rm -f $i.def done -# rm -rf *.lib } +_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 - _fetch - _unzip - (cd mldev32/lib ; _dlltool) + if [ ! -d "${BASE}" -o -f "${ARCHIVE}" ]; then + _fetch + BASE=. + fi + _xcopy + _make + _install + touch .configure_done fi -touch .configure_done