On 25.07.21 15:23, Alessio Vanni wrote: > Hello, > > Christian Grothoff <[email protected]> writes: > >> GNU Taler has taler-config, which recycles gnunet-config in a funky way >> using LD_PRELOAD: >> >> https://git.taler.net/exchange.git/tree/src/util/taler-config.in >> >> This works, because there is: >> https://git.taler.net/exchange.git/tree/src/util/os_installation.c >> >> which overrides gnunet-config settings to turn it into taler-config! >> >> So _ideally_, we would use the GNUNET_OS_ProjectData instead of directly >> using hard-coded values for the output of the new flags. That way, we >> could modify GNU Taler so that taler-config will not return the GNUnet >> flags, but the Taler flags (again using preload, without copying the >> source!) > > I don't follow Taler's development, so I didn't know about this "trick". > Thanks for reporting.
Sure, it is very non-obvious ;-). > I'm going to push a patch to change the hardcoded values to something > based on the values returned by `GNUNET_OS_installation_get_path'. > Hopefully that's going to work for Taler, as I can't think of any other > way to have it print the includedir and the libdir otherwise :) I suggest youy pass all of the information (also possibly via #define's) into the GNUNET_OS_ProjectData and grab it from there! That way, Taler can override it without having to change gnunet-config itself. > As a side note, to keep gnunet-config coherent with the pkg-config > definition, I also had it print `-lgnunetutil' when using the `--libs' > flag. > > I don't know how Taler handles its public APIs, if it has any, so if an > application wants to compile against Taler it would be useful to have > taler-config also print e.g. `-ltalerutil'. Yes, it is similar. So you should get the "-gnunetutil" also from some new field you add to the GNUNET_OS_ProjectData. Ideally, you could even put an array of command-line options into GNUNET_OS_ProjectData, so that all of the new functions you add becomes fully customizable via LD_PRELOADs. > I doubt this is something that gnunet-config can handle internally, so > if Taler (or any application using the LD_PRELOAD + gnunet-config combo) > has special needs for the `--libs' (or even the `--cflags') flag, the > execution with that flag should be intercepted somehow and the > appropriate values appended to the default output of gnunet-config. My point was the "intercepted somehow" we should use is the customization via the GNUNET_OS_ProjectData! Happy hacking! Christian
