[Mesa-dev] [PATCH 1/2] build: Don't cross-compile GLSL builtin compiler

Thierry Reding thierry.reding at avionic-design.de
Fri Sep 14 06:34:32 PDT 2012


On Fri, Sep 14, 2012 at 02:09:26PM +0100, Jon TURNEY wrote:
> On 14/09/2012 08:22, Thierry Reding wrote:
> > The builtin_compiler binary is used during the build process to generate
> > code for the builtin GLSL functions. Since this binary needs to be run
> > on the build host, it must not be cross-compiled.
> > 
> > This patch fixes the build system to compile a second version of the
> > source files and the builtin_compiler binary itself for the build
> > system. It does so by defining the CC_FOR_BUILD and CXX_FOR_BUILD
> > variables, which are searched for by the configure script and point to
> > the location of native C and C++ compilers.
> 
> > -builtin_function.cpp: $(srcdir)/builtins/profiles/* $(srcdir)/builtins/ir/* $(srcdir)/builtins/glsl/* $(srcdir)/builtins/tools/generate_builtins.py $(srcdir)/builtins/tools/texture_builtins.py builtin_compiler$(EXEEXT)
> > -	$(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/builtins/tools/generate_builtins.py ./builtin_compiler > builtin_function.cpp || rm -f builtin_function.cpp
> > +builtin_function.cpp: $(srcdir)/builtins/profiles/* $(srcdir)/builtins/ir/* $(srcdir)/builtins/glsl/* $(srcdir)/builtins/tools/generate_builtins.py $(srcdir)/builtins/tools/texture_builtins.py builtin_compiler/builtin_compiler$(EXEEXT)
> > +	$(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/builtins/tools/generate_builtins.py builtin_compiler/builtin_compiler > builtin_function.cpp || rm -f builtin_function.cpp
> >  
> >  glcpp/libglcpp.la:
> >  	cd glcpp ; $(MAKE) $(AM_MAKEFLAGS)
> 
> I'm guessing that this is probably no longer needed, as we don't need libglcpp
> to make BUILT_SOURCES anymore...

I think you're right. builtin_compiler builds a separate copy of these.
Also since glcpp is already included in SUBDIRS it should be built
before the contents of the current directory anyway. What was the reason
for this explicit dependency?

> >  
> > -SUBDIRS = glcpp
> > +builtin_compiler/builtin_compiler$(EXEEXT):
> > +	cd builtin_compiler ; $(MAKE) $(AM_MAKEFLAGS)
> > +
> 
> EXEEXT is not necessarily the same as BUILD_EXEEXT

I didn't know that existed. In this case BUILD_EXEEXT is certainly what
we want here. I seem to remember some discussion about the need for the
extension recently. I think the setup was mingw where builtin_compiler
would be run through wine and therefore needed the .exe extension. At
the time, Matt Turner said that this would probably not be needed with
proper cross-compilation support.

But I guess now that we already have the extension anyway I can just
switch it to BUILD_EXEEXT.

> > diff --git a/src/glsl/builtin_compiler/Makefile.am b/src/glsl/builtin_compiler/Makefile.am
> > new file mode 100644
> > index 0000000..b1ff883
> > --- /dev/null
> > +++ b/src/glsl/builtin_compiler/Makefile.am
> > @@ -0,0 +1,61 @@
> > +# Copyright © 2012 Jon TURNEY
> 
> I'm not sure if this is needed, but your name should probably be here.

I did copy this from src/glsl/Makefile.am, so technically parts of it
are covered by the same copyright. I can add myself as well, though.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20120914/9814d58f/attachment-0001.pgp>


More information about the mesa-dev mailing list