[PATCH] build: always build wayland-scanner

Derek Foreman derekf at osg.samsung.com
Fri Jul 3 07:50:57 PDT 2015


On 01/07/15 04:51 PM, Ross Burton wrote:
> The previous idiom for building a cross-compiled Wayland is to build once for
> the build host (with --enable-scanner --disable-libraries) to get a
> wayland-scanner binary that can then be used in a cross-compile (with
> --disable-scanner).  The problem with this is that the cross wayland is missing
> a wayland-scanner binary, which means you then can't do any Wayland development
> on the target.
> 
> Instead, always build wayland-scanner for the target and change

What if I don't need wayland-scanner (or any of its pre-requisites) for
my target arch?  If I'm building a system image for deployment I won't
have any need for wayland-scanner on it.

> --enable/disable-scanner to --with/without-host-scanner.  Normal builds use the
> default of --without-host-scanner and run the wayland-scanner it just built, and
> cross-compiled builds pass --with-host-scanner to use a previously built host
> scanner but still get a wayland-scanner to install.

I guess I'm not strictly opposed to being able to specify a host scanner
location... I know Tizen builds figure it out from .pc files.  If you
don't have that capability won't you have trouble building pretty much
anything else for your target architecture?

> (a theoretically neater solution would be to build two scanners if required (one
> to run and one to install), but automake makes this overly complicated)

Building host and target architectures out of the same tree?  sounds
quite difficult to get right and probably not worth the effort.

> Signed-off-by: Ross Burton <ross.burton at intel.com>
> ---
>  Makefile.am  |  9 +++++----
>  configure.ac | 34 ++++++++++++++++------------------
>  2 files changed, 21 insertions(+), 22 deletions(-)
> 
> diff --git a/Makefile.am b/Makefile.am
> index 58f5595..151c54b 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -22,16 +22,17 @@ dist_pkgdata_DATA =				\
>  pkgconfigdir = $(libdir)/pkgconfig
>  pkgconfig_DATA =
>  
> -if ENABLE_SCANNER
> -wayland_scanner = $(top_builddir)/wayland-scanner
>  bin_PROGRAMS = wayland-scanner
>  wayland_scanner_SOURCES = src/scanner.c
>  wayland_scanner_CFLAGS = $(EXPAT_CFLAGS) $(AM_CFLAGS)
>  wayland_scanner_LDADD = $(EXPAT_LIBS) libwayland-util.la
> -$(BUILT_SOURCES) : wayland-scanner
>  pkgconfig_DATA += src/wayland-scanner.pc
> -else
> +
> +if HOST_SCANNER
>  wayland_scanner = wayland-scanner
> +else
> +$(BUILT_SOURCES) : wayland-scanner
> +wayland_scanner = $(top_builddir)/wayland-scanner
>  endif
>  
>  libwayland_util_la_CFLAGS = $(AM_CFLAGS)
> diff --git a/configure.ac b/configure.ac
> index 3fa3cf4..61d23bf 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -59,11 +59,11 @@ AC_ARG_ENABLE([libraries],
>  	      [],
>  	      [enable_libraries=yes])
>  
> -AC_ARG_ENABLE([scanner],
> -              [AC_HELP_STRING([--disable-scanner],
> -                              [Disable compilation of wayland-scanner])],
> -              [],
> -              [enable_scanner=yes])
> +AC_ARG_WITH([host-scanner],
> +            [AC_HELP_STRING([--with-host-scanner],
> +                            [Use a host wayland-scanner])],
> +            [],
> +            [with_host_scanner=no])
>  
>  AC_ARG_ENABLE([documentation],
>  	      [AC_HELP_STRING([--disable-documentation],
> @@ -71,7 +71,7 @@ AC_ARG_ENABLE([documentation],
>  	      [],
>  	      [enable_documentation=yes])
>  
> -AM_CONDITIONAL(ENABLE_SCANNER, test "x$enable_scanner" = xyes)
> +AM_CONDITIONAL(HOST_SCANNER, test "x$with_host_scanner" = xyes)
>  
>  AM_CONDITIONAL(ENABLE_LIBRARIES, test "x$enable_libraries" = xyes)
>  
> @@ -94,18 +94,16 @@ if test "x$enable_libraries" = "xyes"; then
>  	AC_CHECK_HEADERS([execinfo.h])
>  fi
>  
> -if test "x$enable_scanner" = "xyes"; then
> -	PKG_CHECK_MODULES(EXPAT, [expat], [],
> -		[AC_CHECK_HEADERS(expat.h, [],
> -			[AC_MSG_ERROR([Can't find expat.h. Please install expat.])])
> -		 SAVE_LIBS="$LIBS"
> -		 AC_SEARCH_LIBS(XML_ParserCreate, expat, [],
> -			[AC_MSG_ERROR([Can't find expat library. Please install expat.])])
> -		 EXPAT_LIBS="$LIBS"
> -		 LIBS="$SAVE_LIBS"
> -		 AC_SUBST(EXPAT_LIBS)
> -		])
> -fi
> +PKG_CHECK_MODULES(EXPAT, [expat], [],
> +	[AC_CHECK_HEADERS(expat.h, [],
> +		[AC_MSG_ERROR([Can't find expat.h. Please install expat.])])
> +	 SAVE_LIBS="$LIBS"
> +	 AC_SEARCH_LIBS(XML_ParserCreate, expat, [],
> +		[AC_MSG_ERROR([Can't find expat library. Please install expat.])])
> +	 EXPAT_LIBS="$LIBS"
> +	 LIBS="$SAVE_LIBS"
> +	 AC_SUBST(EXPAT_LIBS)
> +	])
>  
>  AC_PATH_PROG(XSLTPROC, xsltproc)
>  AM_CONDITIONAL([HAVE_XSLTPROC], [test "x$XSLTPROC" != "x"])
> 



More information about the wayland-devel mailing list