Re: [meta-ti][master/wrynose][PATCH] libsdl2: Set runtime dependency for SDL2 tests

Antonios Christidis <[email protected]> Mon, 29 Jun 2026 11:34:02 -0500
Newsgroups org.yoctoproject.lists.meta-ti
Message-ID <[email protected]>
On 6/29/26 9:58 AM, Andrew Davis wrote:
> On 6/29/26 9:50 AM, Antonios Christidis wrote:
>>
>> On 6/25/26 5:38 PM, Andrew Davis wrote:
>>> On 6/25/26 3:09 PM, Antonios Christidis via lists.yoctoproject.org=20
>>> wrote:
>>>> From: Antonios Christidis <[email protected]>
>>>>
>>>> Set a runtime dependency on libsdl2 for the libsdl2-tests package.
>>>>
>>>
>>> Any clue on why this isn't automatic? Do the application in the test
>>> package not link to libsdl2?
>>>
>> This isn't automatic because a custom package is created using the=20
>> PACKAGE_BEFORE_PN
>> variable, so I need to explicitly set its dependencies.
>>
>
> Odd, wasn't aware that would mess up the automatic dependency=20
> tracking. So side
> question then, why use `PACKAGE_BEFORE_PN`? What is special about this=20
> recipe
> that the test package can't be a normally added sub-package?
>
Normally the packaging rules for ${PN} are evaluated first in the=20
do_package_split task. I use PACKAGE_BEFORE_PN for two reasons: it=20
automatically creates the package, and it evaluates FILES:${PN}-tests=20
before FILES:${PN}. Without this, test binaries would end up in the main=20
package since both packages claim ${libexecdir}.

>> Currently, when SDL_TESTS is enabled, the test binaries have SDL2=20
>> libs statically
>> compiled in. However, I'm sending a revision to add support for=20
>> dynamic linking instead.
>> This is needed because customers using the sysroots to cross-compile=20
>> their applications
>> have the SDL2 libraries available in their build environment, but the=20
>> binaries can't run
>> since those libraries don't exist in the target filesystem.
>
> Sounds good. BTW, any idea why the tests statically linked with the=20
> library before?
> Even if the library includes both dynamic and static libs, I would=20
> expect the default
> to always be dynamic linking (saves space, upgradable, etc..)
>
The default build type for tests back in 2018 was expecting the test=20
executables to dynamically link with libsdl2 until=20
6cf4d0e43bf12de05374e07eb076a0c73b6f95b1 commit. The reasoning behind=20
the switch is not documented within the commit unfortunately. I will ask=20
the SDL community if they have any further info.

> Andrew
>
>>
>> |
>>
>> |
>>
>>> Andrew
>>>
>>>> Signed-off-by: Antonios Christidis <[email protected]>
>>>> ---
>>>> =C2=A0 meta-ti-test/recipes-graphics/libsdl2/libsdl2-ti.inc | 1 +
>>>> =C2=A0 1 file changed, 1 insertion(+)
>>>>
>>>> diff --git a/meta-ti-test/recipes-graphics/libsdl2/libsdl2-ti.inc=20
>>>> b/meta-ti-test/recipes-graphics/libsdl2/libsdl2-ti.inc
>>>> index 33ff0632..750a5603 100644
>>>> --- a/meta-ti-test/recipes-graphics/libsdl2/libsdl2-ti.inc
>>>> +++ b/meta-ti-test/recipes-graphics/libsdl2/libsdl2-ti.inc
>>>> @@ -3,3 +3,4 @@ EXTRA_OECMAKE +=3D "-DSDL_TESTS=3DON \
>>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "
>>>> =C2=A0 PACKAGE_BEFORE_PN =3D "${PN}-tests"
>>>> =C2=A0 FILES:${PN}-tests +=3D "${libexecdir} ${datadir}/installed-te=
sts/SDL2"
>>>> +RDEPENDS:${PN}-tests +=3D "${PN}"
>>>>
>>>>
>>>>
>>>> -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-
>>>> Links: You receive all messages sent to this group.
>>>> View/Reply Online (#20098):=20
>>>> https://lists.yoctoproject.org/g/meta-ti/message/20098
>>>> Mute This Topic: https://lists.yoctoproject.org/mt/119980196/3619733
>>>> Group Owner: [email protected]
>>>> Unsubscribe: https://lists.yoctoproject.org/g/meta-ti/unsub=20
>>>> [[email protected]]
>>>> -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-
>>>>
>>>
>