[m-rev.] [PATCH 3/4] Support 64-bit Windows target in configure_mingw_cross.
Peter Wang
novalazy at gmail.com
Thu Mar 20 10:47:57 AEDT 2014
Add support for MinGW-w64 cross-compilers targeting 64-bit Windows
in configure_mingw_cross.
tools/configure_mingw_cross:
If the host triplet begins with "x86_64" then assume
configuration values for a 64-bit target.
README.MinGW-cross:
Update documentation.
---
README.MinGW-cross | 40 ++++++++++++++++++----------------------
tools/configure_mingw_cross | 37 +++++++++++++++++++++++++++++++------
2 files changed, 49 insertions(+), 28 deletions(-)
diff --git a/README.MinGW-cross b/README.MinGW-cross
index 3bd4214..010fe3d 100644
--- a/README.MinGW-cross
+++ b/README.MinGW-cross
@@ -1,11 +1,11 @@
-----------------------------------------------------------------------------
-COMPILING MERCURY WITH A MINGW CROSS-COMPILER
+COMPILING MERCURY WITH A MINGW / MINGW-W64 CROSS-COMPILER
-You can cross-compile Mercury on Linux with a MinGW cross-compiler. After
-copying and adjusting some paths, the Mercury installation should be usable
-on Windows. Alternatively, when combined with a native Mercury compiler,
-it could be used to cross-compile Mercury applications for Windows.
+You can compile Mercury on Linux with a MinGW or MinGW-w64 cross-compiler.
+After copying and adjusting some paths, the Mercury installation should be
+usable on Windows. When combined with a native Mercury compiler, it can be
+used to cross-compile Mercury applications for Windows.
-----------------------------------------------------------------------------
@@ -15,34 +15,30 @@ We assume you are on Linux. You will need a native Mercury installation
installed in the normal way. The native Mercury version should match the
version of Mercury you intend to cross-compile.
-Obviously you need a MinGW cross-compiler, as well as a pthreads
-implementation. Many Linux distributions will have packages available,
-e.g. gcc-mingw32 and friends on Debian.
+You need a MinGW or MinGW-w64 cross-compiler, and a pthreads implementation.
+Many Linux distributions will have packages available, e.g. gcc-mingw32 and
+friends on Debian. Otherwise, you may try <http://mxe.cc/>.
-Otherwise, you may try <http://mingw-cross-env.nongnu.org/>.
-If the latest release of that project does not work due to out of date URLs,
-try using the development version.
-
- tar xf mingw-cross-env-2.21.tar.gz
- cd mingw-cross-env-2.21
+ git clone -b stable https://github.com/mxe/mxe.git
+ cd mxe
make gcc pthreads JOBS=6
-----------------------------------------------------------------------------
INSTALLATION
-Ensure that the MinGW cross-compiler i686-pc-mingw-gcc (the name may vary)
-is in your PATH. In a fresh copy of the Mercury source tree, run the following
-in place of the configure script:
+Ensure that the MinGW cross-compiler i686-pc-mingw-gcc or similar is in your
+PATH. In a fresh copy of the Mercury source tree, run the following in place
+of the configure script:
- tools/configure_mingw_cross
+ tools/configure_mingw_cross [--host=HOST] OPTIONS...
-If your MinGW uses a host triplet other than "i686-pc-mingw32" then you must
-pass that using the --host= option. You may pass other options through to
-configure as well, e.g.
+If your installation uses a host triplet other than "i686-pc-mingw32" then
+you must pass that using the --host= option. You may pass other options
+through to configure as well, e.g.
tools/configure_mingw_cross \
- --host=i686-pc-mingw32 \
+ --host=x86_64-w64-mingw32 \
--prefix=/usr/local/mercury-mingw
Then install Mercury as usual:
diff --git a/tools/configure_mingw_cross b/tools/configure_mingw_cross
index 98bc968..5906c04 100755
--- a/tools/configure_mingw_cross
+++ b/tools/configure_mingw_cross
@@ -1,6 +1,7 @@
#!/bin/sh -e
#---------------------------------------------------------------------------#
# Copyright (C) 2012 The University of Melbourne.
+# Copyright (C) 2014 The Mercury team.
# This file may only be copied under the terms of the GNU General
# Public License - see the file COPYING in the Mercury distribution.
#-----------------------------------------------------------------------------#
@@ -23,7 +24,14 @@ done
host=${host:-i686-pc-mingw32}
hostcc=$host-gcc
-echo "Configuring for host $host"
+case $host in
+ x86_64*)
+ bits=64 ;;
+ *)
+ bits=32 ;;
+esac
+
+echo "Configuring for host $host, assuming ${bits}-bit"
if which $hostcc >/dev/null
then
@@ -55,19 +63,36 @@ fi
# Set values which would otherwise be determined with AC_TRY_RUN.
# Taken from the config.cache file after running configure -C in msys.
+case $bits in
+ 32)
+ mercury_cv_word_type=int
+ mercury_cv_low_tag_bits=2
+ mercury_cv_bytes_per_word=4
+ mercury_cv_bits_per_word=32
+ mercury_cv_unboxed_floats=no
+ ;;
+ 64)
+ mercury_cv_word_type='long long'
+ mercury_cv_low_tag_bits=3
+ mercury_cv_bytes_per_word=8
+ mercury_cv_bits_per_word=64
+ mercury_cv_unboxed_floats=yes
+ ;;
+esac
+
mercury_cv_cc_type=gcc \
mercury_cv_sigaction_field=no \
mercury_cv_sigcontext_struct_2arg=no \
mercury_cv_sigcontext_struct_3arg=no \
mercury_cv_siginfo_t=no \
-mercury_cv_word_type=int \
+mercury_cv_word_type=$mercury_cv_word_type \
mercury_cv_int_least64_type='long long' \
mercury_cv_int_least32_type=int \
mercury_cv_int_least16_type=short \
-mercury_cv_low_tag_bits=2 \
-mercury_cv_bytes_per_word=4 \
-mercury_cv_bits_per_word=32 \
-mercury_cv_unboxed_floats=no \
+mercury_cv_low_tag_bits=$mercury_cv_low_tag_bits \
+mercury_cv_bytes_per_word=$mercury_cv_bytes_per_word \
+mercury_cv_bits_per_word=$mercury_cv_bits_per_word \
+mercury_cv_unboxed_floats=$mercury_cv_unboxed_floats \
mercury_cv_float_is_64_bit=no \
mercury_cv_double_is_64_bit=yes \
mercury_cv_long_double_is_64_bit=no \
--
1.8.4
More information about the reviews
mailing list