Annotation of OpenXM/src/ox_math/mathlink/configure-cygwin, Revision 1.3
1.1 ohara 1: #!/bin/sh
1.3 ! ohara 2: # $OpenXM: OpenXM/src/ox_math/mathlink/configure-cygwin,v 1.2 2002/08/23 07:20:36 ohara Exp $
1.1 ohara 3:
1.3 ! ohara 4: ARCHIVE=Windows-ml_v3r9.zip
! 5: URL=http://support.wolfram.com/mathematica/mathlink/updates/v3r9/"${ARCHIVE}"
! 6: BASE="/usr/local/mathematica/AddOns/MathLink/DeveloperKit"
! 7: OpenXM_HOME=${OpenXM_HOME:-../../../../OpenXM}
1.1 ohara 8:
9: _fetch () {
1.3 ! ohara 10: if [ ! -f "${ARCHIVE}" ] ; then
! 11: wget --quiet --no-directories --timestamping "${URL}"
! 12: fi
! 13: if [ ! -f "${ARCHIVE}" ] ; then
! 14: echo 'MathLink libraries cannot be fetched.'
! 15: exit 1
! 16: fi
! 17: unzip -q "${ARCHIVE}"
! 18: }
! 19:
! 20: _xcopy () {
! 21: if [ -e ./ml ] ; then
! 22: rm -rf ./ml
! 23: fi
! 24: mkdir -p ./ml
! 25: cp "${BASE}"/Windows/CompilerAdditions/mldev32/*/* \
! 26: "${BASE}"/Windows/SystemAdditions/* ./ml/
! 27: chmod +x ./ml/*
! 28: if [ -d ./Windows ]; then
! 29: rm -rf ./Windows
1.1 ohara 30: fi
31: }
32:
1.3 ! ohara 33: _make () {
! 34: if [ -d ./ml ]; then
! 35: (cd ./ml ; _dlltool; _patch)
1.1 ohara 36: fi
37: }
38:
39: _dlltool () {
40: for i in ml32i1 ml32i2; do
41: (echo EXPORTS ; nm "$i"m.lib | grep 'T _' | sed 's/.* T _//' ) > $i.def
42: dlltool --dllname $i.dll --def $i.def --output-lib lib$i.a -k
1.3 ! ohara 43: rm -f $i.def
1.1 ohara 44: done
1.3 ! ohara 45: }
! 46:
! 47: _patch () {
! 48: nm libml32i1.a | grep 'T _MLGetString@' > .patch
! 49: if [ ! -s .patch ]; then
! 50: mv -f mathlink.h mathlink.h.orig
! 51: sed -e 's/^\(#[ ]*define[ ][ ]*MLAPI\)[ ][ ]*APIENTRY[ ]*/\1/' mathlink.h.orig > mathlink.h
! 52: fi
! 53: }
! 54:
! 55: _install () {
! 56: if [ ! -d ${OpenXM_HOME}/bin ]; then
! 57: mkdir -p ${OpenXM_HOME}/bin
! 58: fi
! 59: install -m 755 ./ml/*.dll ./ml/*.mlp ${OpenXM_HOME}/bin/
1.1 ohara 60: }
61:
62: if [ ! -f ./.configure_done ]; then
1.3 ! ohara 63: if [ ! -d "${BASE}" -o -f "${ARCHIVE}" ]; then
! 64: _fetch
! 65: BASE=.
! 66: fi
! 67: _xcopy
! 68: _make
! 69: _install
! 70: touch .configure_done
1.1 ohara 71: fi
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>