[Xcb] [PATCH] Move internal/private dependencies to Requires.private

Emil Velikov emil.l.velikov at gmail.com
Sun Sep 7 08:25:24 PDT 2014


On 07/09/14 16:06, Ran Benita wrote:
> On Fri, Sep 05, 2014 at 01:46:40AM +0100, Emil Velikov wrote:
>> Program using the xcb sub-modules has indirect compile and runtime
>> dependency of core xcb. To ensure this out we currently list xcb in
>> the Requires field of the pkg-config files. While this provides all
>> the required dependencies for successful compilation this causes
>> over-linking and hides potential linking miss-use against the xcb modules.
> 
> Can you describe a bit more what sort of linking misuses? (Besides
> overlinking which I don't think applies in this case)
> 
Overlinking applies for all the users of the xcb modules/plugins, as
effectively every user will be linked against core xcb even if it's not needed.

The miss-use (albeit unlikely):
Library A, uses core xcb' function X (v1.2) and xcb-bla. xcb-bla is linked
against core xcb where function X (v1.1) is not compatible with the one used by A.
Currently A will link against X v1.1 and will try to use v1.2. Bad stuff will
happen at the moment it tries to use the function. With this change things
will "explode" upon startup - not perfect solution but a better one imho.

>> By moving to Requires.private we retain the compilation and runtime
>> compatibility and avoids any runtime problems.
> 
> I see the xcb modules as more of "addons" or "plugins" to libxcb than
> just depending on it. And it is quite impossible to use these modules
> without directly using libxcb. So "-lxcb-xkb" would look a bit strange,
> I'd rather always have "-lxcb -lxcb-xkb".
> 
So in that case pick up what you're using rather going for the guesswork that
the right one is picked :)

>>
>> Cc: Keith Packard <keithp at keithp.com>
>> Cc: Alan Coopersmith <alan.coopersmith at oracle.com>
>> References: http://people.freedesktop.org/~dbn/pkg-config-guide.html#faq
>> References: https://wiki.mageia.org/en/Overlinking_issues_in_packaging
>> References: http://err.no/personal/blog/2008/Mar/25
> 
> The referenced pkg-config-guide page says: "[...] it is usually only
> appropriate to add modules from the same package in Requires."
> 
> There's also this page which discusses these directives:
> https://www.flameeyes.eu/autotools-mythbuster/pkgconfig/dependencies.html
> 
Please take a look at [1] and [2]. Also there was a lengthy discussion on
#xorg-devel which you might find interesting.


-Emil

[1] http://lists.freedesktop.org/archives/xcb/2014-August/009617.html
[2] http://lists.freedesktop.org/archives/xcb/2014-August/009654.html


> Ran
> 
>> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
>> ---
>>
>> Hello gents,
>>
>> Please keep me in the CC list as I'm not subscribed to the list
>>
>> -Emil
>>
>>  check-pc-requires     | 4 ++--
>>  xcb-composite.pc.in   | 2 +-
>>  xcb-damage.pc.in      | 2 +-
>>  xcb-dpms.pc.in        | 2 +-
>>  xcb-dri2.pc.in        | 2 +-
>>  xcb-dri3.pc.in        | 2 +-
>>  xcb-glx.pc.in         | 2 +-
>>  xcb-present.pc.in     | 2 +-
>>  xcb-randr.pc.in       | 2 +-
>>  xcb-record.pc.in      | 2 +-
>>  xcb-render.pc.in      | 2 +-
>>  xcb-res.pc.in         | 2 +-
>>  xcb-screensaver.pc.in | 2 +-
>>  xcb-shape.pc.in       | 2 +-
>>  xcb-shm.pc.in         | 2 +-
>>  xcb-sync.pc.in        | 2 +-
>>  xcb-xevie.pc.in       | 2 +-
>>  xcb-xf86dri.pc.in     | 2 +-
>>  xcb-xfixes.pc.in      | 2 +-
>>  xcb-xinerama.pc.in    | 2 +-
>>  xcb-xinput.pc.in      | 2 +-
>>  xcb-xkb.pc.in         | 2 +-
>>  xcb-xprint.pc.in      | 2 +-
>>  xcb-xselinux.pc.in    | 2 +-
>>  xcb-xtest.pc.in       | 2 +-
>>  xcb-xv.pc.in          | 2 +-
>>  xcb-xvmc.pc.in        | 2 +-
>>  27 files changed, 28 insertions(+), 28 deletions(-)
>>
>> diff --git a/check-pc-requires b/check-pc-requires
>> index 0fd9c65..063356f 100755
>> --- a/check-pc-requires
>> +++ b/check-pc-requires
>> @@ -23,7 +23,7 @@ for inc in src/*.h; do
>>  		included=`grep '# *include' $inc |
>>  			sed -e 's/[^<"]*[<"]//' -e 's/[>"]//' |
>>  			grep -v 'xcb.h\|xproto.h'`
>> -		requires=`grep '^Requires:' $pcin`
>> +		requires=`grep '^Requires.private:' $pcin`
>>  		missing=""
>>  		for i in $included; do
>>  			ibase=`basename $i .h`
>> @@ -58,7 +58,7 @@ for inc in src/*.h; do
>>  		*)
>>  			if [ "$fix" = "y" ]; then
>>  			    echo $package adding dependency on $missing
>> -			    sed -i '/^Requires:/s/$/ '"$missing"'/' $pcin
>> +			    sed -i '/^Requires.private:/s/$/ '"$missing"'/' $pcin
>>  			else
>>  			    echo $package missing $missing
>>  			    status=1
>> diff --git a/xcb-composite.pc.in b/xcb-composite.pc.in
>> index 02d49b0..b9b74c2 100644
>> --- a/xcb-composite.pc.in
>> +++ b/xcb-composite.pc.in
>> @@ -6,6 +6,6 @@ includedir=@includedir@
>>  Name: XCB Composite
>>  Description: XCB Composite Extension
>>  Version: @PACKAGE_VERSION@
>> -Requires: xcb xcb-xfixes
>> +Requires.private: xcb xcb-xfixes
>>  Libs: -L${libdir} -lxcb-composite
>>  Cflags: -I${includedir}
>> diff --git a/xcb-damage.pc.in b/xcb-damage.pc.in
>> index c4bc599..3fb46b7 100644
>> --- a/xcb-damage.pc.in
>> +++ b/xcb-damage.pc.in
>> @@ -6,6 +6,6 @@ includedir=@includedir@
>>  Name: XCB Damage
>>  Description: XCB Damage Extension
>>  Version: @PACKAGE_VERSION@
>> -Requires: xcb xcb-xfixes
>> +Requires.private: xcb xcb-xfixes
>>  Libs: -L${libdir} -lxcb-damage
>>  Cflags: -I${includedir}
>> diff --git a/xcb-dpms.pc.in b/xcb-dpms.pc.in
>> index 838a054..281861c 100644
>> --- a/xcb-dpms.pc.in
>> +++ b/xcb-dpms.pc.in
>> @@ -6,6 +6,6 @@ includedir=@includedir@
>>  Name: XCB DPMS
>>  Description: XCB DPMS Extension
>>  Version: @PACKAGE_VERSION@
>> -Requires: xcb
>> +Requires.private: xcb
>>  Libs: -L${libdir} -lxcb-dpms
>>  Cflags: -I${includedir}
>> diff --git a/xcb-dri2.pc.in b/xcb-dri2.pc.in
>> index a9944df..fdb188b 100644
>> --- a/xcb-dri2.pc.in
>> +++ b/xcb-dri2.pc.in
>> @@ -6,6 +6,6 @@ includedir=@includedir@
>>  Name: XCB DRI2
>>  Description: XCB DRI2 Extension
>>  Version: @PACKAGE_VERSION@
>> -Requires: xcb
>> +Requires.private: xcb
>>  Libs: -L${libdir} -lxcb-dri2
>>  Cflags: -I${includedir}
>> diff --git a/xcb-dri3.pc.in b/xcb-dri3.pc.in
>> index 0eb7390..befe11e 100644
>> --- a/xcb-dri3.pc.in
>> +++ b/xcb-dri3.pc.in
>> @@ -6,6 +6,6 @@ includedir=@includedir@
>>  Name: XCB DRI3
>>  Description: XCB DRI3 Extension
>>  Version: @PACKAGE_VERSION@
>> -Requires: xcb
>> +Requires.private: xcb
>>  Libs: -L${libdir} -lxcb-dri3
>>  Cflags: -I${includedir}
>> diff --git a/xcb-glx.pc.in b/xcb-glx.pc.in
>> index bbd4126..79805ef 100644
>> --- a/xcb-glx.pc.in
>> +++ b/xcb-glx.pc.in
>> @@ -6,6 +6,6 @@ includedir=@includedir@
>>  Name: XCB GLX
>>  Description: XCB GLX Extension
>>  Version: @PACKAGE_VERSION@
>> -Requires: xcb
>> +Requires.private: xcb
>>  Libs: -L${libdir} -lxcb-glx
>>  Cflags: -I${includedir}
>> diff --git a/xcb-present.pc.in b/xcb-present.pc.in
>> index e2eccc4..2e0cff8 100644
>> --- a/xcb-present.pc.in
>> +++ b/xcb-present.pc.in
>> @@ -6,6 +6,6 @@ includedir=@includedir@
>>  Name: XCB Present
>>  Description: XCB Present Extension
>>  Version: @PACKAGE_VERSION@
>> -Requires: xcb xcb-randr xcb-xfixes xcb-sync
>> +Requires.private: xcb xcb-randr xcb-xfixes xcb-sync
>>  Libs: -L${libdir} -lxcb-present
>>  Cflags: -I${includedir}
>> diff --git a/xcb-randr.pc.in b/xcb-randr.pc.in
>> index 09c3d12..4c0de13 100644
>> --- a/xcb-randr.pc.in
>> +++ b/xcb-randr.pc.in
>> @@ -6,6 +6,6 @@ includedir=@includedir@
>>  Name: XCB RandR
>>  Description: XCB RandR Extension
>>  Version: @PACKAGE_VERSION@
>> -Requires: xcb xcb-render
>> +Requires.private: xcb xcb-render
>>  Libs: -L${libdir} -lxcb-randr
>>  Cflags: -I${includedir}
>> diff --git a/xcb-record.pc.in b/xcb-record.pc.in
>> index 689f098..b441c9a 100644
>> --- a/xcb-record.pc.in
>> +++ b/xcb-record.pc.in
>> @@ -6,6 +6,6 @@ includedir=@includedir@
>>  Name: XCB Record
>>  Description: XCB Record Extension
>>  Version: @PACKAGE_VERSION@
>> -Requires: xcb
>> +Requires.private: xcb
>>  Libs: -L${libdir} -lxcb-record
>>  Cflags: -I${includedir}
>> diff --git a/xcb-render.pc.in b/xcb-render.pc.in
>> index c3b050a..9ad543e 100644
>> --- a/xcb-render.pc.in
>> +++ b/xcb-render.pc.in
>> @@ -6,6 +6,6 @@ includedir=@includedir@
>>  Name: XCB Render
>>  Description: XCB Render Extension
>>  Version: @PACKAGE_VERSION@
>> -Requires: xcb
>> +Requires.private: xcb
>>  Libs: -L${libdir} -lxcb-render
>>  Cflags: -I${includedir}
>> diff --git a/xcb-res.pc.in b/xcb-res.pc.in
>> index 62dbab6..1f2889d 100644
>> --- a/xcb-res.pc.in
>> +++ b/xcb-res.pc.in
>> @@ -6,6 +6,6 @@ includedir=@includedir@
>>  Name: XCB Res
>>  Description: XCB X-Resource Extension
>>  Version: @PACKAGE_VERSION@
>> -Requires: xcb
>> +Requires.private: xcb
>>  Libs: -L${libdir} -lxcb-res
>>  Cflags: -I${includedir}
>> diff --git a/xcb-screensaver.pc.in b/xcb-screensaver.pc.in
>> index ba3f8ec..1209b20 100644
>> --- a/xcb-screensaver.pc.in
>> +++ b/xcb-screensaver.pc.in
>> @@ -6,6 +6,6 @@ includedir=@includedir@
>>  Name: XCB Screensaver
>>  Description: XCB Screensaver Extension
>>  Version: @PACKAGE_VERSION@
>> -Requires: xcb
>> +Requires.private: xcb
>>  Libs: -L${libdir} -lxcb-screensaver
>>  Cflags: -I${includedir}
>> diff --git a/xcb-shape.pc.in b/xcb-shape.pc.in
>> index 880204d..09637b4 100644
>> --- a/xcb-shape.pc.in
>> +++ b/xcb-shape.pc.in
>> @@ -6,6 +6,6 @@ includedir=@includedir@
>>  Name: XCB Shape
>>  Description: XCB Shape Extension
>>  Version: @PACKAGE_VERSION@
>> -Requires: xcb
>> +Requires.private: xcb
>>  Libs: -L${libdir} -lxcb-shape
>>  Cflags: -I${includedir}
>> diff --git a/xcb-shm.pc.in b/xcb-shm.pc.in
>> index 9256bf0..47c193b 100644
>> --- a/xcb-shm.pc.in
>> +++ b/xcb-shm.pc.in
>> @@ -6,6 +6,6 @@ includedir=@includedir@
>>  Name: XCB Shm
>>  Description: XCB Shm Extension
>>  Version: @PACKAGE_VERSION@
>> -Requires: xcb
>> +Requires.private: xcb
>>  Libs: -L${libdir} -lxcb-shm
>>  Cflags: -I${includedir}
>> diff --git a/xcb-sync.pc.in b/xcb-sync.pc.in
>> index ead76d1..7a4c315 100644
>> --- a/xcb-sync.pc.in
>> +++ b/xcb-sync.pc.in
>> @@ -6,6 +6,6 @@ includedir=@includedir@
>>  Name: XCB Sync
>>  Description: XCB Sync Extension
>>  Version: @PACKAGE_VERSION@
>> -Requires: xcb
>> +Requires.private: xcb
>>  Libs: -L${libdir} -lxcb-sync
>>  Cflags: -I${includedir}
>> diff --git a/xcb-xevie.pc.in b/xcb-xevie.pc.in
>> index 0aa3e02..dc4fee4 100644
>> --- a/xcb-xevie.pc.in
>> +++ b/xcb-xevie.pc.in
>> @@ -6,6 +6,6 @@ includedir=@includedir@
>>  Name: XCB Xevie
>>  Description: XCB Xevie Extension
>>  Version: @PACKAGE_VERSION@
>> -Requires: xcb
>> +Requires.private: xcb
>>  Libs: -L${libdir} -lxcb-xevie
>>  Cflags: -I${includedir}
>> diff --git a/xcb-xf86dri.pc.in b/xcb-xf86dri.pc.in
>> index f3f2980..87c93d5 100644
>> --- a/xcb-xf86dri.pc.in
>> +++ b/xcb-xf86dri.pc.in
>> @@ -6,6 +6,6 @@ includedir=@includedir@
>>  Name: XCB XFree86-DRI
>>  Description: XCB XFree86-DRI Extension
>>  Version: @PACKAGE_VERSION@
>> -Requires: xcb
>> +Requires.private: xcb
>>  Libs: -L${libdir} -lxcb-xf86dri
>>  Cflags: -I${includedir}
>> diff --git a/xcb-xfixes.pc.in b/xcb-xfixes.pc.in
>> index 93eafda..2ebb9cf 100644
>> --- a/xcb-xfixes.pc.in
>> +++ b/xcb-xfixes.pc.in
>> @@ -6,6 +6,6 @@ includedir=@includedir@
>>  Name: XCB XFixes
>>  Description: XCB XFixes Extension
>>  Version: @PACKAGE_VERSION@
>> -Requires: xcb xcb-render xcb-shape
>> +Requires.private: xcb xcb-render xcb-shape
>>  Libs: -L${libdir} -lxcb-xfixes
>>  Cflags: -I${includedir}
>> diff --git a/xcb-xinerama.pc.in b/xcb-xinerama.pc.in
>> index c4775f9..abc3012 100644
>> --- a/xcb-xinerama.pc.in
>> +++ b/xcb-xinerama.pc.in
>> @@ -6,6 +6,6 @@ includedir=@includedir@
>>  Name: XCB Xinerama
>>  Description: XCB Xinerama Extension
>>  Version: @PACKAGE_VERSION@
>> -Requires: xcb
>> +Requires.private: xcb
>>  Libs: -L${libdir} -lxcb-xinerama
>>  Cflags: -I${includedir}
>> diff --git a/xcb-xinput.pc.in b/xcb-xinput.pc.in
>> index ff34ab4..1f1bb27 100644
>> --- a/xcb-xinput.pc.in
>> +++ b/xcb-xinput.pc.in
>> @@ -6,6 +6,6 @@ includedir=@includedir@
>>  Name: XCB XInput
>>  Description: XCB XInput Extension (EXPERIMENTAL)
>>  Version: @PACKAGE_VERSION@
>> -Requires: xcb xcb-xfixes
>> +Requires.private: xcb xcb-xfixes
>>  Libs: -L${libdir} -lxcb-xinput
>>  Cflags: -I${includedir}
>> diff --git a/xcb-xkb.pc.in b/xcb-xkb.pc.in
>> index 6ed0035..d5b1bad 100644
>> --- a/xcb-xkb.pc.in
>> +++ b/xcb-xkb.pc.in
>> @@ -6,6 +6,6 @@ includedir=@includedir@
>>  Name: XCB XKB
>>  Description: XCB Keyboard Extension (EXPERIMENTAL)
>>  Version: @PACKAGE_VERSION@
>> -Requires: xcb
>> +Requires.private: xcb
>>  Libs: -L${libdir} -lxcb-xkb
>>  Cflags: -I${includedir}
>> diff --git a/xcb-xprint.pc.in b/xcb-xprint.pc.in
>> index b5275d5..7ac65f6 100644
>> --- a/xcb-xprint.pc.in
>> +++ b/xcb-xprint.pc.in
>> @@ -6,6 +6,6 @@ includedir=@includedir@
>>  Name: XCB Xprint
>>  Description: XCB Xprint Extension
>>  Version: @PACKAGE_VERSION@
>> -Requires: xcb
>> +Requires.private: xcb
>>  Libs: -L${libdir} -lxcb-xprint
>>  Cflags: -I${includedir}
>> diff --git a/xcb-xselinux.pc.in b/xcb-xselinux.pc.in
>> index 6a71f73..0f86a93 100644
>> --- a/xcb-xselinux.pc.in
>> +++ b/xcb-xselinux.pc.in
>> @@ -6,6 +6,6 @@ includedir=@includedir@
>>  Name: XCB SELinux
>>  Description: XCB SELinux Extension
>>  Version: @PACKAGE_VERSION@
>> -Requires: xcb
>> +Requires.private: xcb
>>  Libs: -L${libdir} -lxcb-xselinux
>>  Cflags: -I${includedir}
>> diff --git a/xcb-xtest.pc.in b/xcb-xtest.pc.in
>> index 886c4dc..9961152 100644
>> --- a/xcb-xtest.pc.in
>> +++ b/xcb-xtest.pc.in
>> @@ -6,6 +6,6 @@ includedir=@includedir@
>>  Name: XCB XTEST
>>  Description: XCB XTEST Extension
>>  Version: @PACKAGE_VERSION@
>> -Requires: xcb
>> +Requires.private: xcb
>>  Libs: -L${libdir} -lxcb-xtest
>>  Cflags: -I${includedir}
>> diff --git a/xcb-xv.pc.in b/xcb-xv.pc.in
>> index f447613..f31de1a 100644
>> --- a/xcb-xv.pc.in
>> +++ b/xcb-xv.pc.in
>> @@ -6,6 +6,6 @@ includedir=@includedir@
>>  Name: XCB Xv
>>  Description: XCB Xv Extension
>>  Version: @PACKAGE_VERSION@
>> -Requires: xcb xcb-shm
>> +Requires.private: xcb xcb-shm
>>  Libs: -L${libdir} -lxcb-xv
>>  Cflags: -I${includedir}
>> diff --git a/xcb-xvmc.pc.in b/xcb-xvmc.pc.in
>> index 95bf4ef..93c51a9 100644
>> --- a/xcb-xvmc.pc.in
>> +++ b/xcb-xvmc.pc.in
>> @@ -6,6 +6,6 @@ includedir=@includedir@
>>  Name: XCB XvMC
>>  Description: XCB XvMC Extension
>>  Version: @PACKAGE_VERSION@
>> -Requires: xcb xcb-xv
>> +Requires.private: xcb xcb-xv
>>  Libs: -L${libdir} -lxcb-xvmc
>>  Cflags: -I${includedir}
>> -- 
>> 2.0.2
>>
>> _______________________________________________
>> Xcb mailing list
>> Xcb at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/xcb



More information about the Xcb mailing list