xmlrpc-c is a lightweight RPC library based on XML and HTTP. For quite some time it’s outdated in Fedora (currently we have 1.32.5 which is older than stable/1.43.06 and even older than super-stable/1.39.11) so I started taking a look why.
Enrico Scholz, previous maintainer of xmlrpc in Fedora, did porting to CMake in 2007 and was supporting it until 2013 and even tried to get it in upstream, but upstream developer didn’t even reply (probably there was some communication, but not in public place). So version of xmlrpc-c we have in Fedora uses this patch-set. Because he gave up on maintaining cmake port and was not anymore interested in maintaining this package it’s oudated and not maintained.
Why not just drop this patch and use upstream’s buildsys? “Current buildsystem is broken and nearly unfixable except for the upstream author.” says Enrico and I tend to agree with him. It’s one of worst buildsystems I have ever seen (it’s common among scientists).
I started rebasing cmake port, but after 15 mins I gave up checking what each macro does there. It’s way better that original one, but cmake doesn’t really make your life easier, so I stopped wasting time and started my own meson port. It took me quite a while to make working meson port, most of the time I spent trying to understand how this make-ish thing generates particular library or even which libraries it generates. So, here it is: https://github.com/ignatenkobrain/xmlrpc-c/.
What did I achieve?
- Cross-compilation for free.
- Support for all OS out of the box (this is a bit lie since I tested only on linux, but it’s fairly simple to adapt for others). In original build-sys to build on windows you have to manually change some configs, run some different scripts and etc.
- Maintainable build-sys code (1k of human-readable code vs 5k of function-over-function-with-shell-and-make).
- Faster compiling. I can’t say that original build-sys is slow (actually it’s very fast since it doesn’t use libtool and all other automake stuff), but with meson I got it ~2 times faster.
What I didn’t achieve (yet?)
- Building tests, examples, tools (in my TODO list since it’s required for my update in Fedora).
- Building wininet-client and libwww-client (I’ve never heard about these before and not sure if anyone uses them, so it’s not in my TODO list at this moment).
- Push changes upstream (once I finish complete porting, I will try to get it upstream).
Funny (actually, no) thing I found in
# I can't figure out what XML_BYTE_ORDER is, but it doesn't look like the # code has ever defined it. That means it's treated like 0 in #if. Since # we started using the Gcc -Wundef option, that generates a warning, so # se set it explicitly to 0 here. CFLAGS_LOCAL = -DXML_BYTE_ORDER=0
I hope that upstream developer (Bryan Henderson) can make opposite of title so that not only Meson will ♥ xmlrpc-c, but also in opposite way ;). This will make people (package maintainers in first place) happy.
A bit more technical information…
*FLAGS which I use:
CFLAGS="-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic" CXXFLAGS="-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic" LDFLAGS="-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld"
Lines of Code:
[brain@x1carbon xmlrpc-c]$ find -name '*.mk' -o -name '*.mk.in' -o -name configure.in -o -name Makefile -o -name GNUMakefile | grep -vP "^\./(?:tools|examples|test)" | xargs wc -l ... 4805 total [brain@x1carbon xmlrpc-c]$ find -name meson.build -o -name meson_options.txt | xargs wc -l ... 947 total
[brain@x1carbon xmlrpc-c]$ time ./configure ... real 0m5.838s user 0m1.931s sys 0m3.495s [brain@x1carbon xmlrpc-c]$ meson build --buildtype=plain ... real 0m2.651s user 0m1.246s sys 0m1.935s
[brain@x1carbon xmlrpc-c]$ time make -j4 ... real 0m36.514s user 1m29.565s sys 0m24.865s [brain@x1carbon xmlrpc-c]$ time ninja-build -j4 -C build ... real 0m19.673s user 0m45.926s sys 0m13.389s