[PATCH weston 5/6] libweston: do not add libweston-$version to the Cflags

Emil Velikov emil.l.velikov at gmail.com
Mon Jul 4 15:02:23 UTC 2016


On 4 July 2016 at 15:32, Quentin Glidic <sardemff7+wayland at sardemff7.net> wrote:
> On 04/07/2016 16:23, Emil Velikov wrote:
>>
>> From: Emil Velikov <emil.velikov at collabora.com>
>>
>> When managing headers there's normally two ways to handle them
>> - with or without the subfolder.
>>
>> Opting for the latter case here, since it will provide direct feedback,
>> whether one is using libweston-0 or any other version.
>>
>> Which in turn should deter (help prevent) issues like building/linking
>> against multiple versions of libweston.
>>
>> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
>
>
> I really prefer not to do that. It means supporting multiple versions of
> libweston will lead to a really big #ifdef dance at the top of the file to
> include every single version you might support, instead of a just a few
> #ifdef around specific new/old functions you use.
>
Yes, I agree with you - adding ifdef spaghetti is ugly. Then again, if
one wants to support multiple versions they will need a bunch of them
either way.

Keeping things explicit will give (and/or save) you and others a fair
bit of time when it goes wrong/nasty. Here is an (somewhat silly, or
you might say sad) example I've seen in the open-source Tizen world...
or was it Android:

Dev. lacks exact knowledge when function A (libfoo1) and B (libfoo2)
are introduced. Thus he/she adds both versions of libfoo in the
configure pkg-config checks. At which point, you will have symbol
collisions, seemingly random corruption and/or crashes.

Cheers,
Emil


More information about the wayland-devel mailing list