Porting Unbound to MXE

Hi Wouter / others,

We're trying to include Unbound into MXE, a cross-platform toolkit for
Windows, http://mxe.cc
Just like the KDE folks, we see this as a good way to roll out our
software to that platform.

The documentation online on how to compile Unbound for Windows is
limited, so we're a bit
confused how to do this. Basically, MXE is an environment with a gcc
cross-compiler and
lots of prebuilt crossover libraries. Usually we override variables
like CC, AR, LD to
get things built.

But Unbound is difficult, and appears to have lots of Windows-specifics
built in. Can you
perhaps give some guidance on mapping the software?

(I'm Cc'ing Henri, who is doing this for us.)

Thanks,
-Rick

Hello,

Should this in configure.ac...

# are we on MinGW?
if uname -s 2>&1 | grep MINGW32 >/dev/null; then on_mingw="yes"
else
        if echo $target | grep mingw32 >/dev/null; then on_mingw="yes"
        else on_mingw="no"; fi
fi

...have been...

# are we on MinGW?
if uname -s 2>&1 | grep MINGW32 >/dev/null; then on_mingw="yes"
else
        if echo $host | grep mingw32 >/dev/null; then on_mingw="yes"
        else on_mingw="no"; fi
fi

...since you are not building a cross-compiler?

That's according to

--host: In which system the generated program will run.
--build: In which system the program will be built.
--target: this option is only used to build a cross-compiling toolchain.
When the tool chain generates executable program, in which target system
the program will run.

on
http://jingfenghanmax.blogspot.nl/2010/09/configure-with-host-target-and-build.html

Cheers,
Rick & Henri

Hi Rick,

I think it is correct. That variable is also set when we are cross
compiling. Cross-compile is the usual build method for windows binaries.

Best regards, Wouter

Wouter,

Could you give us the command sequence that you use for cross-compiling
Unbound for Windows?

We're reverse engineering it from autoconfig stuff now, and that's not a
lot of fun.

-Rick

Hi Rick,

Wouter,

Could you give us the command sequence that you use for cross-compiling
Unbound for Windows?

We're reverse engineering it from autoconfig stuff now, and that's not a
lot of fun.

The build code:
$ mingw32-configure --enable-debug --enable-static-exe --disable-flto
... more configure options
$ make
$ zip myunbound.zip unbound.exe unbound-anchor.exe LICENSE ...

You can also compile without the static executables, this is for example
done by the build scripts in dnssec-trigger; (without
--enable-static-exe, but you'll need stuff like openssl.dll).

Best regards, Wouter