Support for w*ndows
Niels Möller
nisse at lysator.liu.se
Fri Nov 25 16:29:11 CET 2011
I've got some help from a contributor (Martin Storsjö) to improve
building of nettle for wind*ws, and I'd like to share some informaton on
how it's set up.
First, there are mingw-based cross compilers. I've used the debian
packages. Then nettle can be configured for cross-compilation using
./configure --host=i586-mingw32msvc
or
./configure --host=amd64-mingw32msvc
depending on the desired abi (W32 or W64). This is old news, it least
W32 has worked for quite a while, with just some recent fixes related to
shared libraries.
Next, if cross compiling for windows, configure sets an EMULATOR
variable to wine or wine64 (haven''t yet tried wine64, I think it's not
yet in debian so I'd have to build it from source). make check passes
this on in the environment of the run-tests script, which then starts
the test programs (except scripts) via wine.
So if the build machine is supported by wine (as far as I'm aware, that
means x86, or maybe you can hook in some cpu emulator to wine?), plain
make && make check will build the cross build library and run the
testsuite. In my experience, it has never been so little pain involved
in testing the w*ndows build...
For x86_64, M$ uses different calling conventions than everybody else.
This is detected by configure. To deal with this in the assembly files,
there are macros W64_ENTRY and W64_EXIT which are used at the entry and
exit of assembly routines. When building for W64, they expand to some
extra instructions to move arguments around between registers and save
extra callee-save registers. The extra overhead is paid only for W64.
Then there have been some minor porting issues, like line end
conventions, and different size of long (for w64) and different
alignment for uint64_t (on w32). But I think it's going to be fairly
easy to test and maintain portability to w*ndows.
I haven't tried doing the same for gmp, but if anybody is interested in
doing work to get windows builds of gmp more well tested, I'd recommend
that something similar is setup.
Regards,
/Niels
--
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.
More information about the gmp-devel
mailing list