[MLton-user] Script for cross-compiling gmp :)
Anoq of the Sun
anoq@HardcoreProcessing.com
Mon, 24 Nov 2003 21:04:06 +0200
This is a multi-part message in MIME format.
--------------0D01EA39E8E806823A78FE19
Content-Type: text/plain; charset=iso-8859-7
Content-Transfer-Encoding: 7bit
Hello!
I managed to get gmp to cross-compile (it seems - don't know if it really
works with MLton yet).
The older versions of gmp (2.0.2) which was used in MLton in the old days
used the configure arguments --host and --target.
Now it uses --build and --host instead -
and it is claimed in the gmp docs that the old way was "incorrect".
Anyway - this script should work with gmp 4.1.2 - which is
the latest I was able to find and which seems old enough that
it is plausible that it is stable :)
./build-cross-gmp-4.1.2 mingw
Cheers
--
http://www.HardcoreProcessing.com
--------------0D01EA39E8E806823A78FE19
Content-Type: text/plain; charset=iso-8859-7;
name="build-cross-gmp-4.1.2"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="build-cross-gmp-4.1.2"
#!/usr/bin/env bash
# This script builds and installs gmp for cross compilation from
# Linux to Windows.
set -e
die () {
echo >&2 "$1"
exit 1
}
root=`pwd`
name=`basename $0`
usage () {
die "usage: $name {mingw}"
}
case "$#" in
1)
case "$1" in
mingw)
targetType="$1"
;;
*)
usage
;;
esac
;;
*)
usage
esac
# You may want to change the installation prefix, which is where the
# script will install gmp. When cross compiling the script will add $target
# to this prefix.
prefix='/usr'
# You must have have the sources to gmp, and place the
# tarfile in the current directory.
gmpVers='4.1.2'
gmpDir="gmp-$gmpVers"
gmpTar="gmp-$gmpVers.tar"
# You may want to set the target.
case "$targetType" in
mingw)
target='i386-pc-mingw32'
platformFlags='--build=i586-pc-linux --host=i386-pc-mingw32'
# Reset prefix to point to target directory
prefix=$prefix/$target
;;
esac
exists () {
if [ ! -r "$1" ]; then
die "$1 does not exist"
fi
}
echo 'Checking that needed files exist.'
exists $gmpTar
echo 'Building gmp.'
cd $root
if [ ! -d $gmpDir ]; then
tar x <$gmpTar
fi
mkdir -p build-gmp
cd build-gmp
../$gmpDir/configure --prefix=$prefix $platformFlags \
>$root/configure-gmp-log 2>&1 ||
die "Configure of gmp failed."
eval make CFLAGS=-O install distclean >$root/build-gmp-log 2>&1 ||
die "Build of gmp failed."
echo 'Success.'
--------------0D01EA39E8E806823A78FE19--