mplayer: fix detection of X.org
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Wed, 31 Aug 2016 21:17:26 +0000 (23:17 +0200)
committerPeter Korsgaard <peter@korsgaard.com>
Wed, 31 Aug 2016 21:28:52 +0000 (23:28 +0200)
commit6ae3ce9585dcbdfd381111aa9d885bc5b46020d4
treebff59d60c1e75d40f13eca21090f9c19afba92e9
parente227e6bf504ce91849744c155164e5bec26594a7
mplayer: fix detection of X.org

As reported in bug #8206, the mplayer configure script fails to detect
the availability of X11 header/library if the X.org development packages
are not installed on the build machine.

This is due to the logic used by the mplayer configure script, which
looks like this:

  for I in $(echo $extra_cflags | sed s/-I//g) /usr/include ; do
    if test -f "$I/X11/Xlib.h" ; then
      _x11_headers="yes"

So, in other words, it:

 1/ Parses the --extra-cflags option, and finds the -I options in there.

 2/ Looks in /usr/include

Since $(STAGING_DIR)/usr/include is in the compiler built-in search path
for headers, we currently don't explicitly pass it in --extra-cflags, so
mplayer only looks in /usr/include. If you have X11 headers there thanks
to being installed on your build machine, everything works fine (the
rest of the build logic really uses the headers and libraries of the
cross-compiler). But if you don't have X11 headers in /usr/include, the
configure scripts assumes X11 is not available.

Since fixing the hand-written configure script of mplayer, hosted in a
Subversion repository, is beyond sanity, we simply work around this
problem by passing the appropriate -I$(STAGING_DIR)/usr/include option
in --extra-cflags.

Before this patch, during the configure script:

Checking for X11 headers presence ... no (check if the dev(el) packages are installed)
Checking for X11 ... no (check if the dev(el) packages are installed)

And then, the mplayer binary:

 0x00000001 (NEEDED)                     Shared library: [librt.so.0]
 0x00000001 (NEEDED)                     Shared library: [libz.so.1]
 0x00000001 (NEEDED)                     Shared library: [libpthread.so.0]
 0x00000001 (NEEDED)                     Shared library: [libdl.so.0]
 0x00000001 (NEEDED)                     Shared library: [libm.so.0]
 0x00000001 (NEEDED)                     Shared library: [libc.so.0]

With this patch, during the configure script:

Checking for X11 headers presence ... yes
Checking for X11 ... yes

And then, the mplayer binary:

 0x00000001 (NEEDED)                     Shared library: [librt.so.0]
 0x00000001 (NEEDED)                     Shared library: [libz.so.1]
 0x00000001 (NEEDED)                     Shared library: [libpthread.so.0]
 0x00000001 (NEEDED)                     Shared library: [libdl.so.0]
 0x00000001 (NEEDED)                     Shared library: [libm.so.0]
 0x00000001 (NEEDED)                     Shared library: [libXext.so.6]
 0x00000001 (NEEDED)                     Shared library: [libX11.so.6]
 0x00000001 (NEEDED)                     Shared library: [libXinerama.so.1]
 0x00000001 (NEEDED)                     Shared library: [libXxf86vm.so.1]
 0x00000001 (NEEDED)                     Shared library: [libc.so.0]

Fixes bug #8206

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
package/mplayer/mplayer.mk