Re: [Mesa-dev] [PATCH 1/2] build: Don't cross-compile GLSL builtin compiler
On 09/14/2012 12:22 AM, 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. > --- > Makefile.am | 2 + > configure.ac | 12 +- > m4/ax_prog_cc_for_build.m4| 140 > ++ > m4/ax_prog_cxx_for_build.m4 | 123 +++ > src/glsl/.gitignore | 1 - > src/glsl/Makefile.am | 21 ++-- > src/glsl/builtin_compiler/.gitignore | 6 + > src/glsl/builtin_compiler/Makefile.am | 61 ++ > src/glsl/{ => builtin_compiler}/builtin_stubs.cpp | 0 > 9 files changed, 347 insertions(+), 19 deletions(-) > create mode 100644 m4/ax_prog_cc_for_build.m4 > create mode 100644 m4/ax_prog_cxx_for_build.m4 > create mode 100644 src/glsl/builtin_compiler/.gitignore > create mode 100644 src/glsl/builtin_compiler/Makefile.am > rename src/glsl/{ => builtin_compiler}/builtin_stubs.cpp (100%) First off, huge thanks for fixing this! I feel really bad that it's been broken for so long... > diff --git a/Makefile.am b/Makefile.am > index e411218..b72f3cd 100644 > --- a/Makefile.am > +++ b/Makefile.am > @@ -19,6 +19,8 @@ > # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER > DEALINGS > # IN THE SOFTWARE. > > +ACLOCAL_AMFLAGS = -I m4 > + > SUBDIRS = src > > doxygen: > diff --git a/configure.ac b/configure.ac > index 4193496..184d1ed 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -9,7 +9,8 @@ See docs/autoconf.html for more details on the options for > Mesa.]) > AC_INIT([Mesa], [9.1.0], > [https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa]) > AC_CONFIG_AUX_DIR([bin]) > -AC_CANONICAL_HOST > +AC_CONFIG_MACRO_DIR([m4]) > +AC_CANONICAL_SYSTEM > AM_INIT_AUTOMAKE([foreign]) > > dnl http://people.gnome.org/~walters/docs/build-api.txt > @@ -23,9 +24,6 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) > > m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) > > -LT_PREREQ([2.2]) > -LT_INIT([disable-static]) > - > dnl Set internal versions > OSMESA_VERSION=8 > AC_SUBST([OSMESA_VERSION]) > @@ -44,7 +42,9 @@ LIBKMS_XORG_REQUIRED=1.0.0 > dnl Check for progs > AC_PROG_CPP > AC_PROG_CC > +AX_PROG_CC_FOR_BUILD > AC_PROG_CXX > +AX_PROG_CXX_FOR_BUILD > AM_PROG_CC_C_O > AM_PROG_AS > AC_CHECK_PROGS([MAKE], [gmake make]) > @@ -53,6 +53,9 @@ AC_PROG_SED > AC_PROG_MKDIR_P > AC_PATH_PROG([MKDEP], [makedepend]) > > +LT_PREREQ([2.2]) > +LT_INIT([disable-static]) > + > if test "x$MKDEP" = "x"; then > AC_MSG_ERROR([makedepend is required to build Mesa]) > fi > @@ -1958,6 +1961,7 @@ AC_CONFIG_FILES([configs/current > src/gbm/Makefile > src/gbm/main/gbm.pc > src/glsl/Makefile > + src/glsl/builtin_compiler/Makefile > src/glsl/glcpp/Makefile > src/glsl/tests/Makefile > src/glx/Makefile > diff --git a/m4/ax_prog_cc_for_build.m4 b/m4/ax_prog_cc_for_build.m4 > new file mode 100644 > index 000..08095a8 > --- /dev/null > +++ b/m4/ax_prog_cc_for_build.m4 > @@ -0,0 +1,140 @@ > +# === > +# http://www.gnu.org/software/autoconf-archive/ax_prog_cc_for_build.html > +# === > +# > +# SYNOPSIS > +# > +# AX_PROG_CC_FOR_BUILD > +# > +# DESCRIPTION > +# > +# This macro searches for a C compiler that generates native executables, > +# that is a C compiler that surely is not a cross-compiler. This can be > +# useful if you have to generate source code at compile-time like for > +# example GCC does. > +# > +# The macro sets the CC_FOR_BUILD and CPP_FOR_BUILD macros to anything > +# needed to compile or link (CC_FOR_BUILD) and preprocess (CPP_FOR_BUILD). > +# The value of these variables can be overridden by the user by specifying > +# a compiler with an environment variable (like you do for standard CC). > +# > +# It also sets BUILD_EXEEXT and BUILD_OBJEXT to the executable and object > +# file extensions for the build platform, and GCC_FOR_BUILD to `yes' if > +# the compiler we found is GCC. All these variables but GCC_FOR_BUILD are > +# substituted in the Makefile. > +# > +# LICENSE > +# > +# Copyright (c) 2008 Paolo Bonzini > +# > +# Copying and distribution of this file, with or without modification, are > +# p
Re: [Mesa-dev] [PATCH 1/2] build: Don't cross-compile GLSL builtin compiler
On Fri, Sep 14, 2012 at 08:37:43AM -0700, Matt Turner wrote: > On Fri, Sep 14, 2012 at 12:22 AM, 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. > > --- > > I wish you'd sent this to the list a bit more promptly since the last > update to bug 44618 eight months ago. As it is now, I've got a large > (100) patch series in progress that touches these Makefile.am's. I wish the same. At first I was waiting for the automake conversion to progress further and then I got side-tracked with a bunch of other more pressing issues. I guess that's just life... > Overall, it looks pretty good. I'm very glad to learn about the AX_ > macros. I feel much better adding those to Mesa's build system than > macros like we have now (see MESA_PIC_FLAGS). > > I'd like it if this could be made a patch on top of my > automake-gallium series, > http://cgit.freedesktop.org/~mattst88/mesa/log/?h=automake-gallium I'll give it a shot. Let's hope this doesn't take me another eight months. =) Thierry pgpIVOJbwtcTH.pgp Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] build: Don't cross-compile GLSL builtin compiler
On Fri, Sep 14, 2012 at 08:40:48AM -0700, Matt Turner wrote: > On Fri, Sep 14, 2012 at 8:37 AM, Matt Turner wrote: > > On Fri, Sep 14, 2012 at 12:22 AM, 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. > >> --- > > > > I wish you'd sent this to the list a bit more promptly since the last > > update to bug 44618 eight months ago. As it is now, I've got a large > > (100) patch series in progress that touches these Makefile.am's. > > > > Overall, it looks pretty good. I'm very glad to learn about the AX_ > > macros. I feel much better adding those to Mesa's build system than > > macros like we have now (see MESA_PIC_FLAGS). > > > > I'd like it if this could be made a patch on top of my > > automake-gallium series, > > http://cgit.freedesktop.org/~mattst88/mesa/log/?h=automake-gallium > > One other question: do you want to be able to do a cross-compile from > git? If not, we could add builtin_function.cpp to the distribution > list and have it provided in Mesa tarballs. That would remove the need > for this, at the cost of not being able to cross compile sources > checked out of git. I want to be able to do both. Also as far as I remember not having to ship builtin_function.cpp in the tarballs was the reason why builtin_compiler was added in the first place. So I really want this to be fixed properly. Heh, this sounds as if I was the only person around that wants to cross-compile Mesa, but I suspect that's not the case. =) Thierry pgpyOMk9VYx9Q.pgp Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] build: Don't cross-compile GLSL builtin compiler
On Fri, Sep 14, 2012 at 8:37 AM, Matt Turner wrote: > On Fri, Sep 14, 2012 at 12:22 AM, 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. >> --- > > I wish you'd sent this to the list a bit more promptly since the last > update to bug 44618 eight months ago. As it is now, I've got a large > (100) patch series in progress that touches these Makefile.am's. > > Overall, it looks pretty good. I'm very glad to learn about the AX_ > macros. I feel much better adding those to Mesa's build system than > macros like we have now (see MESA_PIC_FLAGS). > > I'd like it if this could be made a patch on top of my > automake-gallium series, > http://cgit.freedesktop.org/~mattst88/mesa/log/?h=automake-gallium One other question: do you want to be able to do a cross-compile from git? If not, we could add builtin_function.cpp to the distribution list and have it provided in Mesa tarballs. That would remove the need for this, at the cost of not being able to cross compile sources checked out of git. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] build: Don't cross-compile GLSL builtin compiler
On Fri, Sep 14, 2012 at 12:22 AM, 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. > --- I wish you'd sent this to the list a bit more promptly since the last update to bug 44618 eight months ago. As it is now, I've got a large (100) patch series in progress that touches these Makefile.am's. Overall, it looks pretty good. I'm very glad to learn about the AX_ macros. I feel much better adding those to Mesa's build system than macros like we have now (see MESA_PIC_FLAGS). I'd like it if this could be made a patch on top of my automake-gallium series, http://cgit.freedesktop.org/~mattst88/mesa/log/?h=automake-gallium ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] build: Don't cross-compile GLSL builtin compiler
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 000..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 pgpTlntT9cnZh.pgp Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] build: Don't cross-compile GLSL builtin compiler
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... > > -SUBDIRS = glcpp > +builtin_compiler/builtin_compiler$(EXEEXT): > + cd builtin_compiler ; $(MAKE) $(AM_MAKEFLAGS) > + EXEEXT is not necessarily the same as BUILD_EXEEXT > diff --git a/src/glsl/builtin_compiler/Makefile.am > b/src/glsl/builtin_compiler/Makefile.am > new file mode 100644 > index 000..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. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev