version 1.1, 2002/08/15 02:31:53 |
version 1.3, 2003/01/12 02:35:57 |
|
|
#!/bin/sh |
#!/bin/sh |
# $OpenXM$ |
# $OpenXM: OpenXM/src/ox_math/mathlink/configure-cygwin,v 1.2 2002/08/23 07:20:36 ohara Exp $ |
|
|
ARCHIVE=Windows-ml_v3r8.zip |
ARCHIVE=Windows-ml_v3r9.zip |
URL=http://support.wolfram.com/mathematica/mathlink/updates/v3r8/$ARCHIVE |
URL=http://support.wolfram.com/mathematica/mathlink/updates/v3r9/"${ARCHIVE}" |
|
BASE="/usr/local/mathematica/AddOns/MathLink/DeveloperKit" |
|
OpenXM_HOME=${OpenXM_HOME:-../../../../OpenXM} |
|
|
_fetch () { |
_fetch () { |
if [ ! -f $ARCHIVE ] ; then |
if [ ! -f "${ARCHIVE}" ] ; then |
wget -nd $URL |
wget --quiet --no-directories --timestamping "${URL}" |
fi |
fi |
|
if [ ! -f "${ARCHIVE}" ] ; then |
|
echo 'MathLink libraries cannot be fetched.' |
|
exit 1 |
|
fi |
|
unzip -q "${ARCHIVE}" |
} |
} |
|
|
_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/ |
|
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 "${ARCHIVE}" ]; then |
_unzip |
_fetch |
(cd mldev32/lib ; _dlltool) |
BASE=. |
|
fi |
|
_xcopy |
|
_make |
|
_install |
|
touch .configure_done |
fi |
fi |
touch .configure_done |
|