Re: [Mesa-dev] [PATCH] configure.ac: rework wayland-protocols handling

2017-07-23 Thread Andres Gomez
On Mon, 2017-07-24 at 01:27 +0300, Andres Gomez wrote:
> This is:
> 
> Reviewed-by: Andres Gomez 

Mmmm ... I hit the send button too quickly.

Just wanted to mention that I share the same concerns than Daniel.
Would it be up to me, I would not be adding the generated files in the
release but I really don't have hard thoughts about it.

Therefore, if you would rather go with this solution, it is fine by me.


> 
> 
> On Fri, 2017-07-21 at 13:02 +0100, Emil Velikov wrote:
> > From: Emil Velikov 
> > 
> > At dist/distcheck time we need to ensure that all the files and their
> > respective dependencies are handled.
> > 
> > At the moment we'll bail out as the linux-dmabuf rules are guarded in a
> > conditional. Move them outside of it and drop the sources from
> > BUILT_SOURCES.
> > 
> > Thus the files will be generated only as needed, which will happen only
> > after the wayland-protocols dependency is enforced in configure.ac.
> > 
> > v2: add dependency tracking for the header
> > 
> > Cc: Andres Gomez 
> > Signed-off-by: Emil Velikov 
> > ---
> >  configure.ac| 13 ++---
> >  src/egl/Makefile.am | 13 +++--
> >  2 files changed, 17 insertions(+), 9 deletions(-)
> > 
> > diff --git a/configure.ac b/configure.ac
> > index 2689fc55e85..2736fbf201b 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -1681,19 +1681,26 @@ if test "x$WAYLAND_SCANNER" = x; then
> >  AC_PATH_PROG([WAYLAND_SCANNER], [wayland-scanner], [:])
> >  fi
> >  
> > +PKG_CHECK_EXISTS([wayland-protocols >= $WAYLAND_PROTOCOLS_REQUIRED], 
> > [have_wayland_protocols=yes], [have_wayland_protocols=no])
> > +if test "x$have_wayland_protocols" = xyes; then
> > +ac_wayland_protocols_pkgdatadir=`$PKG_CONFIG --variable=pkgdatadir 
> > wayland-protocols`
> > +fi
> > +AC_SUBST(WAYLAND_PROTOCOLS_DATADIR, $ac_wayland_protocols_pkgdatadir)
> > +
> >  # Do per platform setups and checks
> >  platforms=`IFS=', '; echo $with_platforms`
> >  for plat in $platforms; do
> >  case "$plat" in
> >  wayland)
> >  
> > -PKG_CHECK_MODULES([WAYLAND], [wayland-client >= $WAYLAND_REQUIRED 
> > wayland-server >= $WAYLAND_REQUIRED wayland-protocols >= 
> > $WAYLAND_PROTOCOLS_REQUIRED])
> > -ac_wayland_protocols_pkgdatadir=`$PKG_CONFIG --variable=pkgdatadir 
> > wayland-protocols`
> > -AC_SUBST(WAYLAND_PROTOCOLS_DATADIR, 
> > $ac_wayland_protocols_pkgdatadir)
> > +PKG_CHECK_MODULES([WAYLAND], [wayland-client >= $WAYLAND_REQUIRED 
> > wayland-server >= $WAYLAND_REQUIRED])
> >  
> >  if test "x$WAYLAND_SCANNER" = "x:"; then
> >  AC_MSG_ERROR([wayland-scanner is needed to compile the 
> > wayland platform])
> >  fi
> > +if test "x$have_wayland_protocols" = xno; then
> > +AC_MSG_ERROR([wayland-protocols >= 
> > $WAYLAND_PROTOCOLS_REQUIRED is needed to compile the wayland platform])
> > +fi
> >  DEFINES="$DEFINES -DHAVE_WAYLAND_PLATFORM"
> >  ;;
> >  
> > diff --git a/src/egl/Makefile.am b/src/egl/Makefile.am
> > index 7c1a4929b81..f881145c0e3 100644
> > --- a/src/egl/Makefile.am
> > +++ b/src/egl/Makefile.am
> > @@ -64,7 +64,6 @@ libEGL_common_la_LIBADD += 
> > $(top_builddir)/src/loader/libloader_dri3_helper.la
> >  endif
> >  endif
> >  
> > -if HAVE_PLATFORM_WAYLAND
> >  WL_DMABUF_XML = 
> > $(WAYLAND_PROTOCOLS_DATADIR)/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml
> >  
> >  drivers/dri2/linux-dmabuf-unstable-v1-protocol.c: $(WL_DMABUF_XML)
> > @@ -75,17 +74,19 @@ 
> > drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h: $(WL_DMABUF_XML)
> > $(MKDIR_GEN)
> > $(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@
> >  
> > -BUILT_SOURCES += \
> > -   drivers/dri2/linux-dmabuf-unstable-v1-protocol.c \
> > -   drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h
> > +drivers/dri2/linux-dmabuf-unstable-v1-protocol.lo: 
> > drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h
> > +drivers/dri2/egl_dri2.lo: 
> > drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h
> >  
> > +if HAVE_PLATFORM_WAYLAND
> >  AM_CFLAGS += $(WAYLAND_CFLAGS)
> >  libEGL_common_la_LIBADD += $(WAYLAND_LIBS)
> >  libEGL_common_la_LIBADD += $(LIBDRM_LIBS)
> >  libEGL_common_la_LIBADD += 
> > $(top_builddir)/src/egl/wayland/wayland-drm/libwayland-drm.la
> >  libEGL_common_la_LIBADD += $(top_builddir)/src/util/libmesautil.la
> > -dri2_backend_FILES += drivers/dri2/platform_wayland.c  \
> > -   drivers/dri2/linux-dmabuf-unstable-v1-protocol.c
> > +dri2_backend_FILES += \
> > +   drivers/dri2/platform_wayland.c \
> > +   drivers/dri2/linux-dmabuf-unstable-v1-protocol.c \
> > +   drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h
> >  endif
> >  
> >  if HAVE_PLATFORM_DRM
-- 
Br,

Andres
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org

Re: [Mesa-dev] [PATCH] configure.ac: rework wayland-protocols handling

2017-07-23 Thread Andres Gomez
This is:

Reviewed-by: Andres Gomez 


On Fri, 2017-07-21 at 13:02 +0100, Emil Velikov wrote:
> From: Emil Velikov 
> 
> At dist/distcheck time we need to ensure that all the files and their
> respective dependencies are handled.
> 
> At the moment we'll bail out as the linux-dmabuf rules are guarded in a
> conditional. Move them outside of it and drop the sources from
> BUILT_SOURCES.
> 
> Thus the files will be generated only as needed, which will happen only
> after the wayland-protocols dependency is enforced in configure.ac.
> 
> v2: add dependency tracking for the header
> 
> Cc: Andres Gomez 
> Signed-off-by: Emil Velikov 
> ---
>  configure.ac| 13 ++---
>  src/egl/Makefile.am | 13 +++--
>  2 files changed, 17 insertions(+), 9 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 2689fc55e85..2736fbf201b 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1681,19 +1681,26 @@ if test "x$WAYLAND_SCANNER" = x; then
>  AC_PATH_PROG([WAYLAND_SCANNER], [wayland-scanner], [:])
>  fi
>  
> +PKG_CHECK_EXISTS([wayland-protocols >= $WAYLAND_PROTOCOLS_REQUIRED], 
> [have_wayland_protocols=yes], [have_wayland_protocols=no])
> +if test "x$have_wayland_protocols" = xyes; then
> +ac_wayland_protocols_pkgdatadir=`$PKG_CONFIG --variable=pkgdatadir 
> wayland-protocols`
> +fi
> +AC_SUBST(WAYLAND_PROTOCOLS_DATADIR, $ac_wayland_protocols_pkgdatadir)
> +
>  # Do per platform setups and checks
>  platforms=`IFS=', '; echo $with_platforms`
>  for plat in $platforms; do
>  case "$plat" in
>  wayland)
>  
> -PKG_CHECK_MODULES([WAYLAND], [wayland-client >= $WAYLAND_REQUIRED 
> wayland-server >= $WAYLAND_REQUIRED wayland-protocols >= 
> $WAYLAND_PROTOCOLS_REQUIRED])
> -ac_wayland_protocols_pkgdatadir=`$PKG_CONFIG --variable=pkgdatadir 
> wayland-protocols`
> -AC_SUBST(WAYLAND_PROTOCOLS_DATADIR, $ac_wayland_protocols_pkgdatadir)
> +PKG_CHECK_MODULES([WAYLAND], [wayland-client >= $WAYLAND_REQUIRED 
> wayland-server >= $WAYLAND_REQUIRED])
>  
>  if test "x$WAYLAND_SCANNER" = "x:"; then
>  AC_MSG_ERROR([wayland-scanner is needed to compile the 
> wayland platform])
>  fi
> +if test "x$have_wayland_protocols" = xno; then
> +AC_MSG_ERROR([wayland-protocols >= 
> $WAYLAND_PROTOCOLS_REQUIRED is needed to compile the wayland platform])
> +fi
>  DEFINES="$DEFINES -DHAVE_WAYLAND_PLATFORM"
>  ;;
>  
> diff --git a/src/egl/Makefile.am b/src/egl/Makefile.am
> index 7c1a4929b81..f881145c0e3 100644
> --- a/src/egl/Makefile.am
> +++ b/src/egl/Makefile.am
> @@ -64,7 +64,6 @@ libEGL_common_la_LIBADD += 
> $(top_builddir)/src/loader/libloader_dri3_helper.la
>  endif
>  endif
>  
> -if HAVE_PLATFORM_WAYLAND
>  WL_DMABUF_XML = 
> $(WAYLAND_PROTOCOLS_DATADIR)/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml
>  
>  drivers/dri2/linux-dmabuf-unstable-v1-protocol.c: $(WL_DMABUF_XML)
> @@ -75,17 +74,19 @@ drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h: 
> $(WL_DMABUF_XML)
>   $(MKDIR_GEN)
>   $(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@
>  
> -BUILT_SOURCES += \
> - drivers/dri2/linux-dmabuf-unstable-v1-protocol.c \
> - drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h
> +drivers/dri2/linux-dmabuf-unstable-v1-protocol.lo: 
> drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h
> +drivers/dri2/egl_dri2.lo: 
> drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h
>  
> +if HAVE_PLATFORM_WAYLAND
>  AM_CFLAGS += $(WAYLAND_CFLAGS)
>  libEGL_common_la_LIBADD += $(WAYLAND_LIBS)
>  libEGL_common_la_LIBADD += $(LIBDRM_LIBS)
>  libEGL_common_la_LIBADD += 
> $(top_builddir)/src/egl/wayland/wayland-drm/libwayland-drm.la
>  libEGL_common_la_LIBADD += $(top_builddir)/src/util/libmesautil.la
> -dri2_backend_FILES += drivers/dri2/platform_wayland.c\
> - drivers/dri2/linux-dmabuf-unstable-v1-protocol.c
> +dri2_backend_FILES += \
> + drivers/dri2/platform_wayland.c \
> + drivers/dri2/linux-dmabuf-unstable-v1-protocol.c \
> + drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h
>  endif
>  
>  if HAVE_PLATFORM_DRM
-- 
Br,

Andres
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] configure.ac: rework wayland-protocols handling

2017-07-21 Thread Daniel Stone
Hi,

On 21 July 2017 at 15:00, Emil Velikov  wrote:
> On 21 July 2017 at 14:19, Daniel Stone  wrote:
>> I don't mind relaxing it, but OTOH wayland-scanner is already there
>> when you install libwayland, and wayland-protocols is just a pile of
>> XML. So it doesn't really seem like it should cause much pain, and the
>> scanner is also very quick to execute.
>>
> In principle I agree, yet I've seem a handful of questionable
> decisions by builders/package maintainers.

Fair enough, but we're also not bound to their terrible decisions. If
they want to make bad decisions, they can live with the consequences,
surely?

>> Well, I keep being screwed by when I was lazy and had previously done
>> a srcdir==builddir build. spirv_info.lo failed to build, because
>> .deps/spirv_info.Plo was pointing at the srcdir variant, long after it
>> stopped existing; I couldn't find a better way to fix that than just
>> manually hacking the .Plo file to remove the dependency. Similarly,
>> marshal.c was breaking the build for me because it was picking up an
>> outdated version in the srcdir (newer version in the builddir), and so
>> on, and so forth.
> I think you've starter perfectly - "when I was lazy.. $list of problems".
> When I have issues like that I'd just git clean it, go back to the
> important things.

Sure. Where I was getting to with that is, having files be both in
your srcdir, and generated in your builddir, is an excellent way to
uncover a lot of frustrating problems when your build system has no
explicit tracking of which should be used.

>> (Yesterday I got bitten by LLVM LDFLAGS including
>> /usr/lib64 which meant that system libraries were preferred to my
>> local prefix; today I got bitten by libtool relinking on install also
>> refusing to find xcb-dri3 from my local prefix, which I didn't find a
>> better way to fix than just copying my local lib into the system path.
>> It's been a really, really, bad week for me with build systems.)
>>
> FWIW others (cmake, meson) also relink upon install. Back on point -
> set LD_LIBRARY_PATH (see our .travis.yml) and you should be good to
> go.

Meson doesn't relink!

>> Anyway, the reason I say this is because it's not just the
>> -client-protocol.h header but the -protocol.c source file as well.
>> Given I've been bitten by autotools being confused by files being
>> present in both the srcdir and the builddir, I'm reluctant about
>> adding another way this could go wrong.
>>
> Things can [and do] go wrong, regardless. Props to all the people
> using and testing, we can address things promptly.
>
> Tl;Dr; I'd rather stay consistent and follow with any issues when they appear.

OK, in that case wayland-protocols and wayland-scanner should be
optional dependencies when building from a dist tarball. In fact,
given the above, if disting it then we should make it _impossible_ to
ever regenerate those sources when building from a dist tarball,
because autotools continually proves to us that it does not work
reliably when the files are in both srcdir and builddir.

Cheers,
Daniel
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] configure.ac: rework wayland-protocols handling

2017-07-21 Thread Emil Velikov
On 21 July 2017 at 14:19, Daniel Stone  wrote:
> Hi Emil,
>
> On 21 July 2017 at 14:13, Emil Velikov  wrote:
>> On 21 July 2017 at 13:28, Daniel Stone  wrote:
>>> Why do we need to dist these files? We enforce that wayland (providing
>>> wayland-scanner) and wayland-protocols (providing the XML) are present
>>> at configure time,
>> Good point Daniel. AFAICT the general principle in Mesa has been to
>> provide all the required sources so that extra tools are not needed.
>>
>> We could lift the requirement in configure.ac, same way we do for
>> python/flex/bison. If the files are already there (aka we're using
>> release tarball) make the wayland bits a optdepend.
>
> I don't mind relaxing it, but OTOH wayland-scanner is already there
> when you install libwayland, and wayland-protocols is just a pile of
> XML. So it doesn't really seem like it should cause much pain, and the
> scanner is also very quick to execute.
>
In principle I agree, yet I've seem a handful of questionable
decisions by builders/package maintainers.

>>> so disting them doesn't seem to provide any benefit
>>> - they'll just be overwritten with the locally-generated variants. At
>>> that point, we'll also have one copy in the source directory (from
>>> dist), and another in the build directory (from local generation),
>>> which seems like a recipe for disaster.
>>>
>> The recipe for disaster part is a slight exaggeration. Plus we already
>> handle that case because people do in-tree builds :-\
>> It was addressed by my earlier suggestion to list the builddir include
>> before the srcdir one (which is in master).
>
> Well, I keep being screwed by when I was lazy and had previously done
> a srcdir==builddir build. spirv_info.lo failed to build, because
> .deps/spirv_info.Plo was pointing at the srcdir variant, long after it
> stopped existing; I couldn't find a better way to fix that than just
> manually hacking the .Plo file to remove the dependency. Similarly,
> marshal.c was breaking the build for me because it was picking up an
> outdated version in the srcdir (newer version in the builddir), and so
> on, and so forth.
I think you've starter perfectly - "when I was lazy.. $list of problems".
When I have issues like that I'd just git clean it, go back to the
important things.

> (Yesterday I got bitten by LLVM LDFLAGS including
> /usr/lib64 which meant that system libraries were preferred to my
> local prefix; today I got bitten by libtool relinking on install also
> refusing to find xcb-dri3 from my local prefix, which I didn't find a
> better way to fix than just copying my local lib into the system path.
> It's been a really, really, bad week for me with build systems.)
>
FWIW others (cmake, meson) also relink upon install. Back on point -
set LD_LIBRARY_PATH (see our .travis.yml) and you should be good to
go.

> Anyway, the reason I say this is because it's not just the
> -client-protocol.h header but the -protocol.c source file as well.
> Given I've been bitten by autotools being confused by files being
> present in both the srcdir and the builddir, I'm reluctant about
> adding another way this could go wrong.
>
Things can [and do] go wrong, regardless. Props to all the people
using and testing, we can address things promptly.

Tl;Dr; I'd rather stay consistent and follow with any issues when they appear.

Thanks
Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] configure.ac: rework wayland-protocols handling

2017-07-21 Thread Daniel Stone
Hi Emil,

On 21 July 2017 at 14:13, Emil Velikov  wrote:
> On 21 July 2017 at 13:28, Daniel Stone  wrote:
>> Why do we need to dist these files? We enforce that wayland (providing
>> wayland-scanner) and wayland-protocols (providing the XML) are present
>> at configure time,
> Good point Daniel. AFAICT the general principle in Mesa has been to
> provide all the required sources so that extra tools are not needed.
>
> We could lift the requirement in configure.ac, same way we do for
> python/flex/bison. If the files are already there (aka we're using
> release tarball) make the wayland bits a optdepend.

I don't mind relaxing it, but OTOH wayland-scanner is already there
when you install libwayland, and wayland-protocols is just a pile of
XML. So it doesn't really seem like it should cause much pain, and the
scanner is also very quick to execute.

>> so disting them doesn't seem to provide any benefit
>> - they'll just be overwritten with the locally-generated variants. At
>> that point, we'll also have one copy in the source directory (from
>> dist), and another in the build directory (from local generation),
>> which seems like a recipe for disaster.
>>
> The recipe for disaster part is a slight exaggeration. Plus we already
> handle that case because people do in-tree builds :-\
> It was addressed by my earlier suggestion to list the builddir include
> before the srcdir one (which is in master).

Well, I keep being screwed by when I was lazy and had previously done
a srcdir==builddir build. spirv_info.lo failed to build, because
.deps/spirv_info.Plo was pointing at the srcdir variant, long after it
stopped existing; I couldn't find a better way to fix that than just
manually hacking the .Plo file to remove the dependency. Similarly,
marshal.c was breaking the build for me because it was picking up an
outdated version in the srcdir (newer version in the builddir), and so
on, and so forth. (Yesterday I got bitten by LLVM LDFLAGS including
/usr/lib64 which meant that system libraries were preferred to my
local prefix; today I got bitten by libtool relinking on install also
refusing to find xcb-dri3 from my local prefix, which I didn't find a
better way to fix than just copying my local lib into the system path.
It's been a really, really, bad week for me with build systems.)

Anyway, the reason I say this is because it's not just the
-client-protocol.h header but the -protocol.c source file as well.
Given I've been bitten by autotools being confused by files being
present in both the srcdir and the builddir, I'm reluctant about
adding another way this could go wrong.

Cheers,
Daniel
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] configure.ac: rework wayland-protocols handling

2017-07-21 Thread Emil Velikov
On 21 July 2017 at 13:28, Daniel Stone  wrote:
> Hi Emil,
>
> On 21 July 2017 at 13:02, Emil Velikov  wrote:
>> At dist/distcheck time we need to ensure that all the files and their
>> respective dependencies are handled.
>>
>> At the moment we'll bail out as the linux-dmabuf rules are guarded in a
>> conditional. Move them outside of it and drop the sources from
>> BUILT_SOURCES.
>
> Why do we need to dist these files? We enforce that wayland (providing
> wayland-scanner) and wayland-protocols (providing the XML) are present
> at configure time,
Good point Daniel. AFAICT the general principle in Mesa has been to
provide all the required sources so that extra tools are not needed.

We could lift the requirement in configure.ac, same way we do for
python/flex/bison. If the files are already there (aka we're using
release tarball) make the wayland bits a optdepend.

> so disting them doesn't seem to provide any benefit
> - they'll just be overwritten with the locally-generated variants. At
> that point, we'll also have one copy in the source directory (from
> dist), and another in the build directory (from local generation),
> which seems like a recipe for disaster.
>
The recipe for disaster part is a slight exaggeration. Plus we already
handle that case because people do in-tree builds :-\
It was addressed by my earlier suggestion to list the builddir include
before the srcdir one (which is in master).

-Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] configure.ac: rework wayland-protocols handling

2017-07-21 Thread Daniel Stone
Hi Emil,

On 21 July 2017 at 13:02, Emil Velikov  wrote:
> At dist/distcheck time we need to ensure that all the files and their
> respective dependencies are handled.
>
> At the moment we'll bail out as the linux-dmabuf rules are guarded in a
> conditional. Move them outside of it and drop the sources from
> BUILT_SOURCES.

Why do we need to dist these files? We enforce that wayland (providing
wayland-scanner) and wayland-protocols (providing the XML) are present
at configure time, so disting them doesn't seem to provide any benefit
- they'll just be overwritten with the locally-generated variants. At
that point, we'll also have one copy in the source directory (from
dist), and another in the build directory (from local generation),
which seems like a recipe for disaster.

Cheers,
Daniel
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] configure.ac: rework wayland-protocols handling

2017-07-21 Thread Emil Velikov
From: Emil Velikov 

At dist/distcheck time we need to ensure that all the files and their
respective dependencies are handled.

At the moment we'll bail out as the linux-dmabuf rules are guarded in a
conditional. Move them outside of it and drop the sources from
BUILT_SOURCES.

Thus the files will be generated only as needed, which will happen only
after the wayland-protocols dependency is enforced in configure.ac.

v2: add dependency tracking for the header

Cc: Andres Gomez 
Signed-off-by: Emil Velikov 
---
 configure.ac| 13 ++---
 src/egl/Makefile.am | 13 +++--
 2 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/configure.ac b/configure.ac
index 2689fc55e85..2736fbf201b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1681,19 +1681,26 @@ if test "x$WAYLAND_SCANNER" = x; then
 AC_PATH_PROG([WAYLAND_SCANNER], [wayland-scanner], [:])
 fi
 
+PKG_CHECK_EXISTS([wayland-protocols >= $WAYLAND_PROTOCOLS_REQUIRED], 
[have_wayland_protocols=yes], [have_wayland_protocols=no])
+if test "x$have_wayland_protocols" = xyes; then
+ac_wayland_protocols_pkgdatadir=`$PKG_CONFIG --variable=pkgdatadir 
wayland-protocols`
+fi
+AC_SUBST(WAYLAND_PROTOCOLS_DATADIR, $ac_wayland_protocols_pkgdatadir)
+
 # Do per platform setups and checks
 platforms=`IFS=', '; echo $with_platforms`
 for plat in $platforms; do
 case "$plat" in
 wayland)
 
-PKG_CHECK_MODULES([WAYLAND], [wayland-client >= $WAYLAND_REQUIRED 
wayland-server >= $WAYLAND_REQUIRED wayland-protocols >= 
$WAYLAND_PROTOCOLS_REQUIRED])
-ac_wayland_protocols_pkgdatadir=`$PKG_CONFIG --variable=pkgdatadir 
wayland-protocols`
-AC_SUBST(WAYLAND_PROTOCOLS_DATADIR, $ac_wayland_protocols_pkgdatadir)
+PKG_CHECK_MODULES([WAYLAND], [wayland-client >= $WAYLAND_REQUIRED 
wayland-server >= $WAYLAND_REQUIRED])
 
 if test "x$WAYLAND_SCANNER" = "x:"; then
 AC_MSG_ERROR([wayland-scanner is needed to compile the wayland 
platform])
 fi
+if test "x$have_wayland_protocols" = xno; then
+AC_MSG_ERROR([wayland-protocols >= $WAYLAND_PROTOCOLS_REQUIRED 
is needed to compile the wayland platform])
+fi
 DEFINES="$DEFINES -DHAVE_WAYLAND_PLATFORM"
 ;;
 
diff --git a/src/egl/Makefile.am b/src/egl/Makefile.am
index 7c1a4929b81..f881145c0e3 100644
--- a/src/egl/Makefile.am
+++ b/src/egl/Makefile.am
@@ -64,7 +64,6 @@ libEGL_common_la_LIBADD += 
$(top_builddir)/src/loader/libloader_dri3_helper.la
 endif
 endif
 
-if HAVE_PLATFORM_WAYLAND
 WL_DMABUF_XML = 
$(WAYLAND_PROTOCOLS_DATADIR)/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml
 
 drivers/dri2/linux-dmabuf-unstable-v1-protocol.c: $(WL_DMABUF_XML)
@@ -75,17 +74,19 @@ drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h: 
$(WL_DMABUF_XML)
$(MKDIR_GEN)
$(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@
 
-BUILT_SOURCES += \
-   drivers/dri2/linux-dmabuf-unstable-v1-protocol.c \
-   drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h
+drivers/dri2/linux-dmabuf-unstable-v1-protocol.lo: 
drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h
+drivers/dri2/egl_dri2.lo: 
drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h
 
+if HAVE_PLATFORM_WAYLAND
 AM_CFLAGS += $(WAYLAND_CFLAGS)
 libEGL_common_la_LIBADD += $(WAYLAND_LIBS)
 libEGL_common_la_LIBADD += $(LIBDRM_LIBS)
 libEGL_common_la_LIBADD += 
$(top_builddir)/src/egl/wayland/wayland-drm/libwayland-drm.la
 libEGL_common_la_LIBADD += $(top_builddir)/src/util/libmesautil.la
-dri2_backend_FILES += drivers/dri2/platform_wayland.c  \
-   drivers/dri2/linux-dmabuf-unstable-v1-protocol.c
+dri2_backend_FILES += \
+   drivers/dri2/platform_wayland.c \
+   drivers/dri2/linux-dmabuf-unstable-v1-protocol.c \
+   drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h
 endif
 
 if HAVE_PLATFORM_DRM
-- 
2.12.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] configure.ac: rework wayland-protocols handling

2017-07-20 Thread Emil Velikov
On 20 July 2017 at 18:27, Emil Velikov  wrote:
> From: Emil Velikov 
>
> At dist/distcheck time we need to ensure that all the files and their
> respective dependencies are handled.
>
> At the moment we'll bail out as the linux-dmabuf rules are guarded in a
> conditional. Move them outside of it and drop the sources from
> BUILT_SOURCES.
>
> Thus the files will be generated only as needed, which will happen only
> after the wayland-protocols dependency is enforced in configure.ac.
>
Scratch this patch - make distcheck showed green light, it's not complete yet.

-Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] configure.ac: rework wayland-protocols handling

2017-07-20 Thread Emil Velikov
From: Emil Velikov 

At dist/distcheck time we need to ensure that all the files and their
respective dependencies are handled.

At the moment we'll bail out as the linux-dmabuf rules are guarded in a
conditional. Move them outside of it and drop the sources from
BUILT_SOURCES.

Thus the files will be generated only as needed, which will happen only
after the wayland-protocols dependency is enforced in configure.ac.

Cc: Andres Gomez 
Signed-off-by: Emil Velikov 
---
 configure.ac| 13 ++---
 src/egl/Makefile.am | 12 +---
 2 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/configure.ac b/configure.ac
index 2689fc55e85..2736fbf201b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1681,19 +1681,26 @@ if test "x$WAYLAND_SCANNER" = x; then
 AC_PATH_PROG([WAYLAND_SCANNER], [wayland-scanner], [:])
 fi
 
+PKG_CHECK_EXISTS([wayland-protocols >= $WAYLAND_PROTOCOLS_REQUIRED], 
[have_wayland_protocols=yes], [have_wayland_protocols=no])
+if test "x$have_wayland_protocols" = xyes; then
+ac_wayland_protocols_pkgdatadir=`$PKG_CONFIG --variable=pkgdatadir 
wayland-protocols`
+fi
+AC_SUBST(WAYLAND_PROTOCOLS_DATADIR, $ac_wayland_protocols_pkgdatadir)
+
 # Do per platform setups and checks
 platforms=`IFS=', '; echo $with_platforms`
 for plat in $platforms; do
 case "$plat" in
 wayland)
 
-PKG_CHECK_MODULES([WAYLAND], [wayland-client >= $WAYLAND_REQUIRED 
wayland-server >= $WAYLAND_REQUIRED wayland-protocols >= 
$WAYLAND_PROTOCOLS_REQUIRED])
-ac_wayland_protocols_pkgdatadir=`$PKG_CONFIG --variable=pkgdatadir 
wayland-protocols`
-AC_SUBST(WAYLAND_PROTOCOLS_DATADIR, $ac_wayland_protocols_pkgdatadir)
+PKG_CHECK_MODULES([WAYLAND], [wayland-client >= $WAYLAND_REQUIRED 
wayland-server >= $WAYLAND_REQUIRED])
 
 if test "x$WAYLAND_SCANNER" = "x:"; then
 AC_MSG_ERROR([wayland-scanner is needed to compile the wayland 
platform])
 fi
+if test "x$have_wayland_protocols" = xno; then
+AC_MSG_ERROR([wayland-protocols >= $WAYLAND_PROTOCOLS_REQUIRED 
is needed to compile the wayland platform])
+fi
 DEFINES="$DEFINES -DHAVE_WAYLAND_PLATFORM"
 ;;
 
diff --git a/src/egl/Makefile.am b/src/egl/Makefile.am
index 7c1a4929b81..4094639284e 100644
--- a/src/egl/Makefile.am
+++ b/src/egl/Makefile.am
@@ -64,7 +64,6 @@ libEGL_common_la_LIBADD += 
$(top_builddir)/src/loader/libloader_dri3_helper.la
 endif
 endif
 
-if HAVE_PLATFORM_WAYLAND
 WL_DMABUF_XML = 
$(WAYLAND_PROTOCOLS_DATADIR)/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml
 
 drivers/dri2/linux-dmabuf-unstable-v1-protocol.c: $(WL_DMABUF_XML)
@@ -75,17 +74,16 @@ drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h: 
$(WL_DMABUF_XML)
$(MKDIR_GEN)
$(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@
 
-BUILT_SOURCES += \
-   drivers/dri2/linux-dmabuf-unstable-v1-protocol.c \
-   drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h
-
+if HAVE_PLATFORM_WAYLAND
 AM_CFLAGS += $(WAYLAND_CFLAGS)
 libEGL_common_la_LIBADD += $(WAYLAND_LIBS)
 libEGL_common_la_LIBADD += $(LIBDRM_LIBS)
 libEGL_common_la_LIBADD += 
$(top_builddir)/src/egl/wayland/wayland-drm/libwayland-drm.la
 libEGL_common_la_LIBADD += $(top_builddir)/src/util/libmesautil.la
-dri2_backend_FILES += drivers/dri2/platform_wayland.c  \
-   drivers/dri2/linux-dmabuf-unstable-v1-protocol.c
+dri2_backend_FILES += \
+   drivers/dri2/platform_wayland.c \
+   drivers/dri2/linux-dmabuf-unstable-v1-protocol.c \
+   drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h
 endif
 
 if HAVE_PLATFORM_DRM
-- 
2.12.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev