version 1.2, 2002/08/23 07:20:36 |
version 1.5, 2005/07/19 10:43:22 |
|
|
#!/bin/sh |
#!/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.4 2003/11/16 17:25:20 ohara Exp $ |
|
|
ARCHIVE=Windows-ml_v3r8.zip |
BASE="/usr/local/mathematica/AddOns/MathLink/DeveloperKit" |
URL=http://support.wolfram.com/mathematica/mathlink/updates/v3r8/$ARCHIVE |
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 () { |
_fetch () { |
if [ ! -f $ARCHIVE ] ; then |
oxfetch.sh "${URL}" ${DISTDIR} |
wget -nd $URL |
if [ ! -f "${DISTDIR}/${DISTFILE}" ] ; then |
|
echo 'MathLink libraries cannot be fetched.' |
|
exit 1 |
fi |
fi |
|
unzip -q "${DISTDIR}/${DISTFILE}" |
} |
} |
|
|
_unzip () { |
_xcopy () { |
if [ -f $ARCHIVE ] ; then |
if [ -e ./ml ] ; then |
unzip $ARCHIVE |
rm -rf ./ml |
if [ -e mldev32 ] ; then |
|
rm -rf mldev32 |
|
fi |
|
mv Windows/CompilerAdditions/mldev32 . |
|
mv Windows/SystemAdditions/* mldev32/lib/ |
|
chmod +x mldev32/bin/* |
|
rm -rf Windows |
|
fi |
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 () { |
_dlltool () { |
for i in ml32i1 ml32i2; do |
for i in ml32i1 ml32i2; do |
(echo EXPORTS ; nm "$i"m.lib | grep 'T _' | sed 's/.* T _//' ) > $i.def |
(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 |
dlltool --dllname $i.dll --def $i.def --output-lib lib$i.a -k |
rm -f $i.def |
rm -f $i.def |
done |
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 |
if [ ! -f ./.configure_done ]; then |
_fetch |
if [ ! -d "${BASE}" -o -f "${DISTDIR}/${DISTFILE}" ]; then |
_unzip |
_fetch |
(cd mldev32/lib ; _dlltool) |
BASE=. |
|
fi |
|
_xcopy |
|
_make |
|
_install |
|
touch .configure_done |
fi |
fi |
touch .configure_done |
|