neon
neon copied to clipboard
Fix mingw cross-builds
While preparing a cross-build procedure (to compile NUT for Windows on a Linux machine with mingw) recently, I've been stuck with inability to build libneon on such platform out of the box. And also not on MSYS2 (a MinGW environment bundle for native Windows).
Looking around, I found a concise set of fixes among OBS recipes at https://build.opensuse.org/package/show/windows:mingw:win32/mingw32-libneon which got me started on this PR (with some creative adaptation).
Now I can configure and build neon on both Windows MSYS2 and Linux mingw environments, and use it as a shared DLL library for NUT. The hack is a bit dirty (setting ne_cv_os_uname
in certain conditions) but making a clean cross-build solution needs larger autoconf script changes toward that goal :)
Example Linux-mingw cross-build looks like this:
./configure --prefix=/usr/i686-w64-mingw32 --host=i686-w64-mingw32 PKG_CONFIG_PATH=/usr/i686-w64-mingw32/lib/pkgconfig
For MSYS2 a plain ./configure
should now suffice for the native target.
Prerequisites like libxml2
should be built and installed first, but were trivial to do so :)
Also note that to sudo make install
from Git sources, I must make all docs
explicitly first (otherwise it fails to install manpages), and that libtool installs "executable" MinGW DLL files like libneon-27.dll
here into "bin", e.g. /usr/i686-w64-mingw32/bin
location. The libneon.dll.a
(hmmm) and neon.pc
are provided to help build against it.
Also note that to
sudo make install
from Git sources, I mustmake all docs
explicitly first (otherwise it fails to install manpages),
https://github.com/notroj/neon/pull/34 https://github.com/notroj/neon/issues/67 https://github.com/notroj/neon/pull/69
That is intentional
Fair enough, comments in Makefile say as much. Although this nukes a common make all && sudo make install
mantra (from git checkout) even where tools are available. I think this should be driven by configure script (NUT does so, and it is rather complicated) but that's up to projects of course.
I locally just apply https://github.com/notroj/neon/pull/69.patch and keep my configure && make install wrappers intact, and it's been fine so far
Thanks for the heads-up :)
As for this PR, its focus was to make libneon cross-buildable (again?) and as I stumbled on installing the result, I posted a note of it. I know first-hand about googling for obscure solutions to non-core issues one gets in daily work - so your further references and context explanations are certainly helpful for such posterity :)
Gentle bump to maintainer :)
@jimklimov I posted a review question above a while ago, can you respond?
@notroj : that's odd - do not see any in github :\ did you submit the review?
Oh, it was visible to me but maybe not submitted, sorry. Is that visible now?
Posted probable fixes, at least it still cross-builds for me from Linux and MSYS2 :)
Now it also defines HAVE_WSPIAPI_H
in generated config.h
(although it seems the builds went fine without it too on both platforms).
Thanks a lot @jimklimov! Sorry for leaving this hanging, I've not used the github review process much before.