summaryrefslogtreecommitdiffstats
path: root/meta/recipes-graphics
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-graphics')
-rw-r--r--meta/recipes-graphics/mesa/mesa-8.0.5.inc18
-rw-r--r--meta/recipes-graphics/mesa/mesa-9.0.1.inc11
-rw-r--r--meta/recipes-graphics/mesa/mesa-common.inc3
-rw-r--r--meta/recipes-graphics/mesa/mesa-dri-glsl-native.inc7
-rw-r--r--meta/recipes-graphics/mesa/mesa-dri-glsl-native_8.0.5.bb22
-rw-r--r--meta/recipes-graphics/mesa/mesa-dri_9.0.1.bb (renamed from meta/recipes-graphics/mesa/mesa-dri_8.0.5.bb)0
-rw-r--r--meta/recipes-graphics/mesa/mesa/0001-Compile-with-uclibc.patch52
-rw-r--r--meta/recipes-graphics/mesa/mesa/0003-fix-for-x32.patch50
-rw-r--r--meta/recipes-graphics/mesa/mesa/0004-gross-hack-to-prevent-from-install-libgl.patch29
-rw-r--r--meta/recipes-graphics/mesa/mesa/cross-glsl.patch632
10 files changed, 644 insertions, 180 deletions
diff --git a/meta/recipes-graphics/mesa/mesa-8.0.5.inc b/meta/recipes-graphics/mesa/mesa-8.0.5.inc
deleted file mode 100644
index b39b011f1e..0000000000
--- a/meta/recipes-graphics/mesa/mesa-8.0.5.inc
+++ /dev/null
@@ -1,18 +0,0 @@
1DEPENDS += "mesa-dri-glsl-native"
2
3SRC_URI = "ftp://ftp.freedesktop.org/pub/mesa/${PV}/MesaLib-${PV}.tar.bz2 \
4 file://0001-Compile-with-uclibc.patch \
5 file://0002-cross-compile.patch \
6 file://0003-fix-for-x32.patch \
7 "
8SRC_URI += "${@base_contains('DISTRO_FEATURES', 'x11', '', 'file://0004-gross-hack-to-prevent-from-install-libgl.patch', d)}"
9
10S = "${WORKDIR}/Mesa-${PV}"
11
12SRC_URI[md5sum] = "01305591073a76b65267f69f27d635a3"
13SRC_URI[sha256sum] = "511b8da34f8e69ed24caf422964fb7ae747f3b1d8093f6b8aa2602164a475a5e"
14
15do_configure_prepend() {
16 # We need builtin_compiler built for buildhost arch instead of target (is provided by mesa-dri-glsl-native)"
17 sed -i "s#\./builtin_compiler#${STAGING_BINDIR_NATIVE}/glsl/builtin_compiler#g" ${S}/src/glsl/Makefile
18}
diff --git a/meta/recipes-graphics/mesa/mesa-9.0.1.inc b/meta/recipes-graphics/mesa/mesa-9.0.1.inc
new file mode 100644
index 0000000000..9b639da72f
--- /dev/null
+++ b/meta/recipes-graphics/mesa/mesa-9.0.1.inc
@@ -0,0 +1,11 @@
1SRC_URI = "ftp://ftp.freedesktop.org/pub/mesa/${PV}/MesaLib-${PV}.tar.bz2 \
2 file://0002-cross-compile.patch \
3 file://cross-glsl.patch \
4 "
5
6SRC_URI[md5sum] = "97d6554c05ea7449398afe3a0ede7018"
7SRC_URI[sha256sum] = "57a7ba83bace3f3a7dc0929fe026ef5f0ad454234ec4ad8a3e0d31650a75db6f"
8
9LIC_FILES_CHKSUM = "file://docs/license.html;md5=012f69938d81b766472fd0d240df38a4"
10
11S = "${WORKDIR}/Mesa-${PV}"
diff --git a/meta/recipes-graphics/mesa/mesa-common.inc b/meta/recipes-graphics/mesa/mesa-common.inc
index 70957eb9b3..838ce11c78 100644
--- a/meta/recipes-graphics/mesa/mesa-common.inc
+++ b/meta/recipes-graphics/mesa/mesa-common.inc
@@ -10,12 +10,11 @@ HOMEPAGE = "http://mesa3d.org"
10BUGTRACKER = "https://bugs.freedesktop.org" 10BUGTRACKER = "https://bugs.freedesktop.org"
11SECTION = "x11" 11SECTION = "x11"
12LICENSE = "MIT" 12LICENSE = "MIT"
13LIC_FILES_CHKSUM = "file://docs/license.html;md5=03ccdc4c379c4289aecfb8892c546f67"
14 13
15INC_PR = "r9" 14INC_PR = "r9"
16PE = "2" 15PE = "2"
17 16
18DEPENDS = "libxml2-native makedepend-native flex-native bison-native" 17DEPENDS = "expat makedepend-native flex-native bison-native"
19 18
20PROVIDES = "virtual/libgl virtual/libgles1 virtual/libgles2 virtual/egl" 19PROVIDES = "virtual/libgl virtual/libgles1 virtual/libgles2 virtual/egl"
21 20
diff --git a/meta/recipes-graphics/mesa/mesa-dri-glsl-native.inc b/meta/recipes-graphics/mesa/mesa-dri-glsl-native.inc
deleted file mode 100644
index c8b80e88fd..0000000000
--- a/meta/recipes-graphics/mesa/mesa-dri-glsl-native.inc
+++ /dev/null
@@ -1,7 +0,0 @@
1DESCRIPTION = "gl shader language specific build from mesa-dri"
2HOMEPAGE = "http://mesa3d.org"
3BUGTRACKER = "https://bugs.freedesktop.org"
4SECTION = "x11"
5LICENSE = "GPLv3+"
6
7DEPENDS = "makedepend-native"
diff --git a/meta/recipes-graphics/mesa/mesa-dri-glsl-native_8.0.5.bb b/meta/recipes-graphics/mesa/mesa-dri-glsl-native_8.0.5.bb
deleted file mode 100644
index 842d492843..0000000000
--- a/meta/recipes-graphics/mesa/mesa-dri-glsl-native_8.0.5.bb
+++ /dev/null
@@ -1,22 +0,0 @@
1require mesa-dri-glsl-native.inc
2
3LIC_FILES_CHKSUM = "file://glsl_parser.yy;beginline=2;endline=23;md5=a12a9c0208ee64a07ce314dfed4c81eb"
4
5SRC_URI = "ftp://ftp.freedesktop.org/pub/mesa/${PV}/MesaLib-${PV}.tar.bz2"
6SRC_URI[md5sum] = "01305591073a76b65267f69f27d635a3"
7SRC_URI[sha256sum] = "511b8da34f8e69ed24caf422964fb7ae747f3b1d8093f6b8aa2602164a475a5e"
8
9S = "${WORKDIR}/Mesa-${PV}/src/glsl/"
10
11inherit native
12
13# use default config for native build
14do_configure_prepend() {
15 ln -sf ${S}/../../configs/default ${S}/../../configs/current
16}
17
18do_install() {
19 install -d ${D}/${bindir}/glsl
20 install -m 755 ${S}/builtin_compiler ${D}/${bindir}/glsl/builtin_compiler
21 install -m 755 ${S}/glsl_compiler ${D}/${bindir}/glsl/glsl_compiler
22}
diff --git a/meta/recipes-graphics/mesa/mesa-dri_8.0.5.bb b/meta/recipes-graphics/mesa/mesa-dri_9.0.1.bb
index 26b56e426c..26b56e426c 100644
--- a/meta/recipes-graphics/mesa/mesa-dri_8.0.5.bb
+++ b/meta/recipes-graphics/mesa/mesa-dri_9.0.1.bb
diff --git a/meta/recipes-graphics/mesa/mesa/0001-Compile-with-uclibc.patch b/meta/recipes-graphics/mesa/mesa/0001-Compile-with-uclibc.patch
deleted file mode 100644
index d39270a48b..0000000000
--- a/meta/recipes-graphics/mesa/mesa/0001-Compile-with-uclibc.patch
+++ /dev/null
@@ -1,52 +0,0 @@
1Compile with uclibc
2
3Upstream-Status: Pending
4---
5 configure.ac | 3 +++
6 src/glsl/strtod.c | 2 +-
7 src/mesa/main/imports.c | 2 +-
8 3 files changed, 5 insertions(+), 2 deletions(-)
9
10diff --git a/configure.ac b/configure.ac
11index fbaa376..454dad2 100644
12--- a/configure.ac
13+++ b/configure.ac
14@@ -543,6 +543,9 @@ AC_SUBST([DLOPEN_LIBS])
15 dnl See if posix_memalign is available
16 AC_CHECK_FUNC([posix_memalign], [DEFINES="$DEFINES -DHAVE_POSIX_MEMALIGN"])
17
18+dnl See if newlocale is available
19+AC_CHECK_FUNCS_ONCE(newlocale)
20+
21 dnl SELinux awareness.
22 AC_ARG_ENABLE([selinux],
23 [AS_HELP_STRING([--enable-selinux],
24diff --git a/src/glsl/strtod.c b/src/glsl/strtod.c
25index a876e13..9fce7e9 100644
26--- a/src/glsl/strtod.c
27+++ b/src/glsl/strtod.c
28@@ -45,7 +45,7 @@ double
29 glsl_strtod(const char *s, char **end)
30 {
31 #if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__) && \
32- !defined(__HAIKU__)
33+ !defined(__HAIKU__) && defined (HAVE_NEWLOCALE)
34 static locale_t loc = NULL;
35 if (!loc) {
36 loc = newlocale(LC_CTYPE_MASK, "C", NULL);
37diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c
38index d3727ef..363bf32 100644
39--- a/src/mesa/main/imports.c
40+++ b/src/mesa/main/imports.c
41@@ -767,7 +767,7 @@ float
42 _mesa_strtof( const char *s, char **end )
43 {
44 #if defined(_GNU_SOURCE) && !defined(__CYGWIN__) && !defined(__FreeBSD__) && \
45- !defined(ANDROID) && !defined(__HAIKU__)
46+ !defined(ANDROID) && !defined(__HAIKU__) && defined (HAVE_NEWLOCALE)
47 static locale_t loc = NULL;
48 if (!loc) {
49 loc = newlocale(LC_CTYPE_MASK, "C", NULL);
50--
511.7.10.4
52
diff --git a/meta/recipes-graphics/mesa/mesa/0003-fix-for-x32.patch b/meta/recipes-graphics/mesa/mesa/0003-fix-for-x32.patch
deleted file mode 100644
index 2d6a150e42..0000000000
--- a/meta/recipes-graphics/mesa/mesa/0003-fix-for-x32.patch
+++ /dev/null
@@ -1,50 +0,0 @@
1Upstream-Status: Pending
2
3Using uname like this when cross compiling is a really bad idea. We
4provide the correct linker flags, lets just assume we can get this
5right ourselves.
6
7RP 2012/04/26
8---
9 bin/mklib | 16 ----------------
10 1 file changed, 16 deletions(-)
11
12diff --git a/bin/mklib b/bin/mklib
13index b33aa90..16cb017 100755
14--- a/bin/mklib
15+++ b/bin/mklib
16@@ -330,15 +330,7 @@ case $ARCH in
17 ;;
18 esac
19
20- # Check if objects are 32-bit and we're running in 64-bit
21- # environment. If so, pass -m32 flag to linker.
22 set ${OBJECTS}
23- ABI32=`file $1 | grep 32-bit`
24- ARM=`file $1 | grep ARM`
25- # Do not add "-m32" option for arm.
26- if [ -z "$ARM" -a "${ABI32}" -a `uname -m` = "x86_64" ] ; then
27- OPTS="-m32 ${OPTS}"
28- fi
29
30 if [ "${ALTOPTS}" ] ; then
31 OPTS=${ALTOPTS}
32@@ -389,15 +381,7 @@ case $ARCH in
33 # exptmp is removed below
34 fi
35
36- # Check if objects are 32-bit and we're running in 64-bit
37- # environment. If so, pass -m32 flag to linker.
38 set ${OBJECTS}
39- ABI32=`file $1 | grep 32-bit`
40- ARM=`file $1 | grep ARM`
41- # Do not add "-m32" option for arm.
42- if [ -z "$ARM" -a "${ABI32}" -a `uname -m` = "x86_64" ] ; then
43- OPTS="-m32 ${OPTS}"
44- fi
45 if [ "${ALTOPTS}" ] ; then
46 OPTS=${ALTOPTS}
47 fi
48--
491.7.10.4
50
diff --git a/meta/recipes-graphics/mesa/mesa/0004-gross-hack-to-prevent-from-install-libgl.patch b/meta/recipes-graphics/mesa/mesa/0004-gross-hack-to-prevent-from-install-libgl.patch
deleted file mode 100644
index cf9dee25ee..0000000000
--- a/meta/recipes-graphics/mesa/mesa/0004-gross-hack-to-prevent-from-install-libgl.patch
+++ /dev/null
@@ -1,29 +0,0 @@
1gross hack to prevent from install libgl
2
3This patch is not suitable for upstream. This is only needed for the 8.0.x
4branch, master (8.1.x) has a largely different build system (using automake)
5and does not need it. It is fully expected to drop the patch with the next bump
6to a stable version based on 8.1.x.
7
8Upstream-Status: Inappropriate
9
10---
11 src/mesa/Makefile | 2 +-
12 1 file changed, 1 insertion(+), 1 deletion(-)
13
14diff --git a/src/mesa/Makefile b/src/mesa/Makefile
15index 0e15d61..a0a2cb5 100644
16--- a/src/mesa/Makefile
17+++ b/src/mesa/Makefile
18@@ -166,7 +166,7 @@ install: default $(DRICORE_INSTALL_TARGET)
19 else \
20 $(MAKE) install-osmesa || exit 1 ; \
21 fi ;; \
22- dri) $(MAKE) install-libgl install-dri || exit 1 ;; \
23+ dri) $(MAKE) install-dri || exit 1 ;; \
24 *) $(MAKE) install-libgl || exit 1 ;; \
25 esac ; \
26 done
27--
281.7.10.4
29
diff --git a/meta/recipes-graphics/mesa/mesa/cross-glsl.patch b/meta/recipes-graphics/mesa/mesa/cross-glsl.patch
new file mode 100644
index 0000000000..2e7929738d
--- /dev/null
+++ b/meta/recipes-graphics/mesa/mesa/cross-glsl.patch
@@ -0,0 +1,632 @@
1Respect CC_FOR_BUILD when building glsl_compiler, so we don't need a
2mesa-dri-glsl-native anymore.
3
4Upstream-Status: Backport (from master)
5Signed-off-by: Ross Burton <ross.burton@intel.com>
6
7diff --git a/configure.ac b/configure.ac
8index b46f897..3765cd3 100644
9--- a/configure.ac
10+++ b/configure.ac
11@@ -10,7 +10,7 @@ AC_INIT([Mesa], [9.0.1],
12 [https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa])
13 AC_CONFIG_AUX_DIR([bin])
14 AC_CONFIG_MACRO_DIR([m4])
15-AC_CANONICAL_HOST
16+AC_CANONICAL_SYSTEM
17 AM_INIT_AUTOMAKE([foreign])
18
19 dnl http://people.gnome.org/~walters/docs/build-api.txt
20@@ -24,9 +24,6 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
21
22 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
23
24-LT_PREREQ([2.2])
25-LT_INIT([disable-static])
26-
27 dnl Set internal versions
28 OSMESA_VERSION=8
29 AC_SUBST([OSMESA_VERSION])
30@@ -45,7 +42,9 @@ LIBKMS_XORG_REQUIRED=1.0.0
31 dnl Check for progs
32 AC_PROG_CPP
33 AC_PROG_CC
34+AX_PROG_CC_FOR_BUILD
35 AC_PROG_CXX
36+AX_PROG_CXX_FOR_BUILD
37 AM_PROG_CC_C_O
38 AM_PROG_AS
39 AC_CHECK_PROGS([MAKE], [gmake make])
40@@ -54,6 +53,9 @@ AC_PROG_SED
41 AC_PROG_MKDIR_P
42 AC_PATH_PROG([MKDEP], [makedepend])
43
44+LT_PREREQ([2.2])
45+LT_INIT([disable-static])
46+
47 if test "x$MKDEP" = "x"; then
48 AC_MSG_ERROR([makedepend is required to build Mesa])
49 fi
50@@ -155,6 +157,21 @@ dnl Cache LDFLAGS and CPPFLAGS so we can add to them and restore later
51 _SAVE_LDFLAGS="$LDFLAGS"
52 _SAVE_CPPFLAGS="$CPPFLAGS"
53
54+dnl build host compiler macros
55+DEFINES_FOR_BUILD=""
56+AC_SUBST([DEFINES_FOR_BUILD])
57+case "$build_os" in
58+linux*|*-gnu*|gnu*)
59+ DEFINES_FOR_BUILD="$DEFINES_FOR_BUILD -D_GNU_SOURCE"
60+ ;;
61+solaris*)
62+ DEFINES_FOR_BUILD="$DEFINES_FOR_BUILD -DSVR4"
63+ ;;
64+cygwin*)
65+ DEFINES_FOR_BUILD="$DEFINES_FOR_BUILD"
66+ ;;
67+esac
68+
69 dnl Compiler macros
70 DEFINES=""
71 AC_SUBST([DEFINES])
72@@ -172,6 +189,7 @@ esac
73
74 dnl Add flags for gcc and g++
75 if test "x$GCC" = xyes; then
76+ CFLAGS_FOR_BUILD="$CFLAGS_FOR_BUILD -Wall -std=c99"
77 CFLAGS="$CFLAGS -Wall -std=c99"
78
79 # Enable -Werror=implicit-function-declaration and
80@@ -199,13 +217,16 @@ if test "x$GCC" = xyes; then
81 CFLAGS=$save_CFLAGS
82
83 # Work around aliasing bugs - developers should comment this out
84+ CFLAGS_FOR_BUILD="$CFLAGS_FOR_BUILD -fno-strict-aliasing"
85 CFLAGS="$CFLAGS -fno-strict-aliasing"
86
87 # gcc's builtin memcmp is slower than glibc's
88 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43052
89+ CFLAGS_FOR_BUILD="$CFLAGS_FOR_BUILD -fno-builtin-memcmp"
90 CFLAGS="$CFLAGS -fno-builtin-memcmp"
91 fi
92 if test "x$GXX" = xyes; then
93+ CXXFLAGS_FOR_BUILD="$CXXFLAGS_FOR_BUILD -Wall"
94 CXXFLAGS="$CXXFLAGS -Wall"
95
96 # Enable -fvisibility=hidden if using a gcc that supports it
97@@ -222,10 +243,12 @@ if test "x$GXX" = xyes; then
98 CXXFLAGS=$save_CXXFLAGS
99
100 # Work around aliasing bugs - developers should comment this out
101+ CXXFLAGS_FOR_BUILD="$CXXFLAGS_FOR_BUILD -fno-strict-aliasing"
102 CXXFLAGS="$CXXFLAGS -fno-strict-aliasing"
103
104 # gcc's builtin memcmp is slower than glibc's
105 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43052
106+ CXXFLAGS_FOR_BUILD="$CXXFLAGS_FOR_BUILD -fno-builtin-memcmp"
107 CXXFLAGS="$CXXFLAGS -fno-builtin-memcmp"
108 fi
109
110@@ -309,6 +332,14 @@ AC_ARG_ENABLE([debug],
111 [enable_debug=no]
112 )
113 if test "x$enable_debug" = xyes; then
114+ DEFINES_FOR_BUILD="$DEFINES_FOR_BUILD -DDEBUG"
115+ if test "x$GCC_FOR_BUILD" = xyes; then
116+ CFLAGS_FOR_BUILD="$CFLAGS_FOR_BUILD -g"
117+ fi
118+ if test "x$GXX_FOR_BUILD" = xyes; then
119+ CXXFLAGS_FOR_BUILD="$CXXFLAGS_FOR_BUILD -g"
120+ fi
121+
122 DEFINES="$DEFINES -DDEBUG"
123 if test "x$GCC" = xyes; then
124 CFLAGS="$CFLAGS -g"
125@@ -1960,6 +1991,7 @@ AC_CONFIG_FILES([configs/current
126 src/gbm/Makefile
127 src/gbm/main/gbm.pc
128 src/glsl/Makefile
129+ src/glsl/builtin_compiler/Makefile
130 src/glsl/glcpp/Makefile
131 src/glsl/tests/Makefile
132 src/glx/Makefile
133diff --git a/m4/ax_prog_cc_for_build.m4 b/m4/ax_prog_cc_for_build.m4
134new file mode 100644
135index 0000000..6369809
136--- /dev/null
137+++ b/m4/ax_prog_cc_for_build.m4
138@@ -0,0 +1,125 @@
139+# ===========================================================================
140+# http://www.gnu.org/software/autoconf-archive/ax_prog_cc_for_build.html
141+# ===========================================================================
142+#
143+# SYNOPSIS
144+#
145+# AX_PROG_CC_FOR_BUILD
146+#
147+# DESCRIPTION
148+#
149+# This macro searches for a C compiler that generates native executables,
150+# that is a C compiler that surely is not a cross-compiler. This can be
151+# useful if you have to generate source code at compile-time like for
152+# example GCC does.
153+#
154+# The macro sets the CC_FOR_BUILD and CPP_FOR_BUILD macros to anything
155+# needed to compile or link (CC_FOR_BUILD) and preprocess (CPP_FOR_BUILD).
156+# The value of these variables can be overridden by the user by specifying
157+# a compiler with an environment variable (like you do for standard CC).
158+#
159+# It also sets BUILD_EXEEXT and BUILD_OBJEXT to the executable and object
160+# file extensions for the build platform, and GCC_FOR_BUILD to `yes' if
161+# the compiler we found is GCC. All these variables but GCC_FOR_BUILD are
162+# substituted in the Makefile.
163+#
164+# LICENSE
165+#
166+# Copyright (c) 2008 Paolo Bonzini <bonzini@gnu.org>
167+#
168+# Copying and distribution of this file, with or without modification, are
169+# permitted in any medium without royalty provided the copyright notice
170+# and this notice are preserved. This file is offered as-is, without any
171+# warranty.
172+
173+#serial 5
174+
175+AU_ALIAS([AC_PROG_CC_FOR_BUILD], [AX_PROG_CC_FOR_BUILD])
176+AC_DEFUN([AX_PROG_CC_FOR_BUILD], [dnl
177+AC_REQUIRE([AC_PROG_CC])dnl
178+AC_REQUIRE([AC_PROG_CPP])dnl
179+AC_REQUIRE([AC_EXEEXT])dnl
180+AC_REQUIRE([AC_CANONICAL_SYSTEM])dnl
181+
182+dnl Use the standard macros, but make them use other variable names
183+dnl
184+pushdef([ac_cv_prog_CPP], ac_cv_build_prog_CPP)dnl
185+pushdef([ac_cv_prog_gcc], ac_cv_build_prog_gcc)dnl
186+pushdef([ac_cv_prog_cc_works], ac_cv_build_prog_cc_works)dnl
187+pushdef([ac_cv_prog_cc_cross], ac_cv_build_prog_cc_cross)dnl
188+pushdef([ac_cv_prog_cc_g], ac_cv_build_prog_cc_g)dnl
189+pushdef([ac_cv_exeext], ac_cv_build_exeext)dnl
190+pushdef([ac_cv_objext], ac_cv_build_objext)dnl
191+pushdef([ac_exeext], ac_build_exeext)dnl
192+pushdef([ac_objext], ac_build_objext)dnl
193+pushdef([CC], CC_FOR_BUILD)dnl
194+pushdef([CPP], CPP_FOR_BUILD)dnl
195+pushdef([CFLAGS], CFLAGS_FOR_BUILD)dnl
196+pushdef([CPPFLAGS], CPPFLAGS_FOR_BUILD)dnl
197+pushdef([LDFLAGS], LDFLAGS_FOR_BUILD)dnl
198+pushdef([host], build)dnl
199+pushdef([host_alias], build_alias)dnl
200+pushdef([host_cpu], build_cpu)dnl
201+pushdef([host_vendor], build_vendor)dnl
202+pushdef([host_os], build_os)dnl
203+pushdef([ac_cv_host], ac_cv_build)dnl
204+pushdef([ac_cv_host_alias], ac_cv_build_alias)dnl
205+pushdef([ac_cv_host_cpu], ac_cv_build_cpu)dnl
206+pushdef([ac_cv_host_vendor], ac_cv_build_vendor)dnl
207+pushdef([ac_cv_host_os], ac_cv_build_os)dnl
208+pushdef([ac_cpp], ac_build_cpp)dnl
209+pushdef([ac_compile], ac_build_compile)dnl
210+pushdef([ac_link], ac_build_link)dnl
211+
212+save_cross_compiling=$cross_compiling
213+save_ac_tool_prefix=$ac_tool_prefix
214+cross_compiling=no
215+ac_tool_prefix=
216+
217+AC_PROG_CC
218+AC_PROG_CPP
219+AC_EXEEXT
220+
221+ac_tool_prefix=$save_ac_tool_prefix
222+cross_compiling=$save_cross_compiling
223+
224+dnl Restore the old definitions
225+dnl
226+popdef([ac_link])dnl
227+popdef([ac_compile])dnl
228+popdef([ac_cpp])dnl
229+popdef([ac_cv_host_os])dnl
230+popdef([ac_cv_host_vendor])dnl
231+popdef([ac_cv_host_cpu])dnl
232+popdef([ac_cv_host_alias])dnl
233+popdef([ac_cv_host])dnl
234+popdef([host_os])dnl
235+popdef([host_vendor])dnl
236+popdef([host_cpu])dnl
237+popdef([host_alias])dnl
238+popdef([host])dnl
239+popdef([LDFLAGS])dnl
240+popdef([CPPFLAGS])dnl
241+popdef([CFLAGS])dnl
242+popdef([CPP])dnl
243+popdef([CC])dnl
244+popdef([ac_objext])dnl
245+popdef([ac_exeext])dnl
246+popdef([ac_cv_objext])dnl
247+popdef([ac_cv_exeext])dnl
248+popdef([ac_cv_prog_cc_g])dnl
249+popdef([ac_cv_prog_cc_cross])dnl
250+popdef([ac_cv_prog_cc_works])dnl
251+popdef([ac_cv_prog_gcc])dnl
252+popdef([ac_cv_prog_CPP])dnl
253+
254+dnl Finally, set Makefile variables
255+dnl
256+BUILD_EXEEXT=$ac_build_exeext
257+BUILD_OBJEXT=$ac_build_objext
258+AC_SUBST(BUILD_EXEEXT)dnl
259+AC_SUBST(BUILD_OBJEXT)dnl
260+AC_SUBST([CFLAGS_FOR_BUILD])dnl
261+AC_SUBST([CPPFLAGS_FOR_BUILD])dnl
262+AC_SUBST([LDFLAGS_FOR_BUILD])dnl
263+])
264diff --git a/m4/ax_prog_cxx_for_build.m4 b/m4/ax_prog_cxx_for_build.m4
265new file mode 100644
266index 0000000..ecf8db9
267--- /dev/null
268+++ b/m4/ax_prog_cxx_for_build.m4
269@@ -0,0 +1,109 @@
270+# ===========================================================================
271+# http://www.gnu.org/software/autoconf-archive/ax_prog_cxx_for_build.html
272+# ===========================================================================
273+#
274+# SYNOPSIS
275+#
276+# AX_PROG_CXX_FOR_BUILD
277+#
278+# DESCRIPTION
279+#
280+# This macro searches for a C++ compiler that generates native executables,
281+# that is a C++ compiler that surely is not a cross-compiler. This can be
282+# useful if you have to generate source code at compile-time like for
283+# example GCC does.
284+#
285+# The macro sets the CXX_FOR_BUILD and CXXCPP_FOR_BUILD macros to anything
286+# needed to compile or link (CXX_FOR_BUILD) and preprocess (CXXCPP_FOR_BUILD).
287+# The value of these variables can be overridden by the user by specifying
288+# a compiler with an environment variable (like you do for standard CXX).
289+#
290+# LICENSE
291+#
292+# Copyright (c) 2008 Paolo Bonzini <bonzini@gnu.org>
293+# Copyright (c) 2012 Avionic Design GmbH
294+#
295+# Based on the AX_PROG_CC_FOR_BUILD macro by Paolo Bonzini.
296+#
297+# Copying and distribution of this file, with or without modification, are
298+# permitted in any medium without royalty provided the copyright notice
299+# and this notice are preserved. This file is offered as-is, without any
300+# warranty.
301+
302+#serial 5
303+
304+AU_ALIAS([AC_PROG_CXX_FOR_BUILD], [AX_PROG_CXX_FOR_BUILD])
305+AC_DEFUN([AX_PROG_CXX_FOR_BUILD], [dnl
306+AC_REQUIRE([AX_PROG_CC_FOR_BUILD])dnl
307+AC_REQUIRE([AC_PROG_CXX])dnl
308+AC_REQUIRE([AC_PROG_CXXCPP])dnl
309+AC_REQUIRE([AC_CANONICAL_SYSTEM])dnl
310+
311+dnl Use the standard macros, but make them use other variable names
312+dnl
313+pushdef([ac_cv_prog_CXXCPP], ac_cv_build_prog_CXXCPP)dnl
314+pushdef([ac_cv_prog_gxx], ac_cv_build_prog_gxx)dnl
315+pushdef([ac_cv_prog_cxx_works], ac_cv_build_prog_cxx_works)dnl
316+pushdef([ac_cv_prog_cxx_cross], ac_cv_build_prog_cxx_cross)dnl
317+pushdef([ac_cv_prog_cxx_g], ac_cv_build_prog_cxx_g)dnl
318+pushdef([CXX], CXX_FOR_BUILD)dnl
319+pushdef([CXXCPP], CXXCPP_FOR_BUILD)dnl
320+pushdef([CXXFLAGS], CXXFLAGS_FOR_BUILD)dnl
321+pushdef([CPPFLAGS], CPPFLAGS_FOR_BUILD)dnl
322+pushdef([CXXCPPFLAGS], CXXCPPFLAGS_FOR_BUILD)dnl
323+pushdef([host], build)dnl
324+pushdef([host_alias], build_alias)dnl
325+pushdef([host_cpu], build_cpu)dnl
326+pushdef([host_vendor], build_vendor)dnl
327+pushdef([host_os], build_os)dnl
328+pushdef([ac_cv_host], ac_cv_build)dnl
329+pushdef([ac_cv_host_alias], ac_cv_build_alias)dnl
330+pushdef([ac_cv_host_cpu], ac_cv_build_cpu)dnl
331+pushdef([ac_cv_host_vendor], ac_cv_build_vendor)dnl
332+pushdef([ac_cv_host_os], ac_cv_build_os)dnl
333+pushdef([ac_cxxcpp], ac_build_cxxcpp)dnl
334+pushdef([ac_compile], ac_build_compile)dnl
335+pushdef([ac_link], ac_build_link)dnl
336+
337+save_cross_compiling=$cross_compiling
338+save_ac_tool_prefix=$ac_tool_prefix
339+cross_compiling=no
340+ac_tool_prefix=
341+
342+AC_PROG_CXX
343+AC_PROG_CXXCPP
344+
345+ac_tool_prefix=$save_ac_tool_prefix
346+cross_compiling=$save_cross_compiling
347+
348+dnl Restore the old definitions
349+dnl
350+popdef([ac_link])dnl
351+popdef([ac_compile])dnl
352+popdef([ac_cxxcpp])dnl
353+popdef([ac_cv_host_os])dnl
354+popdef([ac_cv_host_vendor])dnl
355+popdef([ac_cv_host_cpu])dnl
356+popdef([ac_cv_host_alias])dnl
357+popdef([ac_cv_host])dnl
358+popdef([host_os])dnl
359+popdef([host_vendor])dnl
360+popdef([host_cpu])dnl
361+popdef([host_alias])dnl
362+popdef([host])dnl
363+popdef([CXXCPPFLAGS])dnl
364+popdef([CPPFLAGS])dnl
365+popdef([CXXFLAGS])dnl
366+popdef([CXXCPP])dnl
367+popdef([CXX])dnl
368+popdef([ac_cv_prog_cxx_g])dnl
369+popdef([ac_cv_prog_cxx_cross])dnl
370+popdef([ac_cv_prog_cxx_works])dnl
371+popdef([ac_cv_prog_gxx])dnl
372+popdef([ac_cv_prog_CXXCPP])dnl
373+
374+dnl Finally, set Makefile variables
375+dnl
376+AC_SUBST([CXXFLAGS_FOR_BUILD])dnl
377+AC_SUBST([CXXCPPFLAGS_FOR_BUILD])dnl
378+])
379diff --git a/src/glsl/Makefile.am b/src/glsl/Makefile.am
380index 1ecc003..6fb3d2d 100644
381--- a/src/glsl/Makefile.am
382+++ b/src/glsl/Makefile.am
383@@ -19,9 +19,7 @@
384 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
385 # IN THE SOFTWARE.
386
387-
388-# builtin_compiler is built before libglsl to generate builtin_function.cpp for libglsl.
389-# For this to work, a dummy version of builtin_function.cpp, builtin_stubs.cpp, is used.
390+SUBDIRS = builtin_compiler glcpp
391
392 AM_CPPFLAGS = \
393 -I$(top_srcdir)/include \
394@@ -38,32 +36,23 @@ AM_LFLAGS = --nounistd -o$(LEX_OUTPUT_ROOT).c
395
396 include Makefile.sources
397
398-noinst_LTLIBRARIES = libglslcommon.la libglsl.la
399-noinst_PROGRAMS = glsl_compiler glsl_test builtin_compiler
400+noinst_LTLIBRARIES = libglsl.la
401+noinst_PROGRAMS = glsl_compiler glsl_test
402
403-# common sources for builtin_compiler and libglsl
404-libglslcommon_la_SOURCES = \
405+libglsl_la_SOURCES = \
406 glsl_lexer.ll \
407 glsl_parser.cc \
408 $(LIBGLSL_FILES) \
409- $(LIBGLSL_CXX_FILES)
410-
411-libglslcommon_la_LIBADD = glcpp/libglcpp.la
412-
413-# common sources for builtin_compiler and glsl_compiler
414-GLSL2_SOURCES = \
415- $(top_srcdir)/src/mesa/program/hash_table.c \
416- $(top_srcdir)/src/mesa/program/symbol_table.c \
417- $(GLSL_COMPILER_CXX_FILES)
418-
419-libglsl_la_SOURCES = \
420+ $(LIBGLSL_CXX_FILES) \
421 builtin_function.cpp
422
423-libglsl_la_LIBADD = libglslcommon.la
424+libglsl_la_LIBADD = glcpp/libglcpp.la
425 libglsl_la_LDFLAGS =
426
427 glsl_compiler_SOURCES = \
428- $(GLSL2_SOURCES)
429+ $(top_srcdir)/src/mesa/program/hash_table.c \
430+ $(top_srcdir)/src/mesa/program/symbol_table.c \
431+ $(GLSL_COMPILER_CXX_FILES)
432
433 glsl_compiler_LDADD = libglsl.la
434
435@@ -76,12 +65,6 @@ glsl_test_SOURCES = \
436
437 glsl_test_LDADD = libglsl.la
438
439-builtin_compiler_SOURCES = \
440- $(GLSL2_SOURCES) \
441- builtin_stubs.cpp
442-
443-builtin_compiler_LDADD = libglslcommon.la
444-
445 # automake <=1.11 and automake >=1.12 have different conventions for naming C++ header files
446 # made by yacc. To work with both, we write our own rule rather than using automake's.
447 # When (if) we require automake >=1.12 in configure.ac, this can be removed, and we can use
448@@ -89,16 +72,11 @@ builtin_compiler_LDADD = libglslcommon.la
449 glsl_parser.cc glsl_parser.h: glsl_parser.yy
450 $(AM_V_GEN) $(YACC) -v -o glsl_parser.cc -p "_mesa_glsl_" --defines=glsl_parser.h $<
451
452-BUILT_SOURCES = glsl_parser.h builtin_function.cpp
453-CLEANFILES = glsl_lexer.cc glsl_parser.cc $(BUILT_SOURCES)
454-
455-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)
456- $(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/builtins/tools/generate_builtins.py ./builtin_compiler > builtin_function.cpp || rm -f builtin_function.cpp
457-
458-glcpp/libglcpp.la:
459- cd glcpp ; $(MAKE) $(AM_MAKEFLAGS)
460+BUILT_SOURCES = glsl_parser.h
461+CLEANFILES = glsl_lexer.cc glsl_parser.cc $(BUILT_SOURCES) builtin_function.cpp
462
463-SUBDIRS = glcpp
464+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$(BUILD_EXEEXT)
465+ $(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/builtins/tools/generate_builtins.py builtin_compiler/builtin_compiler$(BUILD_EXEEXT) > builtin_function.cpp || rm -f builtin_function.cpp
466
467 # Provide compatibility with scripts for the old Mesa build system for
468 # a while by putting a link to the library in the current directory.
469diff --git a/src/glsl/builtin_compiler/Makefile.am b/src/glsl/builtin_compiler/Makefile.am
470new file mode 100644
471index 0000000..72032b5
472--- /dev/null
473+++ b/src/glsl/builtin_compiler/Makefile.am
474@@ -0,0 +1,68 @@
475+# Copyright © 2012 Jon TURNEY
476+# Copyright © 2012 Thierry Reding
477+#
478+# Permission is hereby granted, free of charge, to any person obtaining a
479+# copy of this software and associated documentation files (the "Software"),
480+# to deal in the Software without restriction, including without limitation
481+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
482+# and/or sell copies of the Software, and to permit persons to whom the
483+# Software is furnished to do so, subject to the following conditions:
484+#
485+# The above copyright notice and this permission notice (including the next
486+# paragraph) shall be included in all copies or substantial portions of the
487+# Software.
488+#
489+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
490+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
491+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
492+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
493+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
494+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
495+# IN THE SOFTWARE.
496+
497+CC = @CC_FOR_BUILD@
498+CFLAGS = @CFLAGS_FOR_BUILD@
499+CPP = @CPP_FOR_BUILD@
500+CPPFLAGS = @CPPFLAGS_FOR_BUILD@
501+CXX = @CXX_FOR_BUILD@
502+CXXFLAGS = @CXXFLAGS_FOR_BUILD@
503+LD = @LD_FOR_BUILD@
504+LDFLAGS = @LDFLAGS_FOR_BUILD@
505+
506+AM_CFLAGS = \
507+ -I $(top_srcdir)/include \
508+ -I $(top_srcdir)/src/mapi \
509+ -I $(top_srcdir)/src/mesa \
510+ -I $(GLSL_SRCDIR) \
511+ -I $(GLSL_SRCDIR)/glcpp \
512+ $(DEFINES_FOR_BUILD)
513+
514+AM_CXXFLAGS = $(AM_CFLAGS)
515+
516+AM_YFLAGS = -v -d -p "glcpp_parser_"
517+AM_LFLAGS = --nounistd -o$(LEX_OUTPUT_ROOT).c
518+
519+include ../Makefile.sources
520+
521+noinst_PROGRAMS = builtin_compiler
522+
523+builtin_compiler_SOURCES = \
524+ $(GLSL_SRCDIR)/glcpp/glcpp-lex.l \
525+ $(GLSL_SRCDIR)/glcpp/glcpp-parse.y \
526+ $(LIBGLCPP_FILES) \
527+ $(GLSL_SRCDIR)/glsl_lexer.ll \
528+ $(GLSL_SRCDIR)/glsl_parser.cc \
529+ $(LIBGLSL_FILES) \
530+ $(LIBGLSL_CXX_FILES) \
531+ $(top_srcdir)/src/mesa/program/hash_table.c \
532+ $(top_srcdir)/src/mesa/program/symbol_table.c \
533+ $(GLSL_COMPILER_CXX_FILES) \
534+ builtin_stubs.cpp
535+
536+BUILT_SOURCES = \
537+ glcpp-lex.c \
538+ glcpp-parse.c \
539+ glcpp-parse.h \
540+ glsl_lexer.cc
541+
542+CLEANFILES = $(BUILT_SOURCES)
543diff --git a/src/glsl/builtin_compiler/builtin_stubs.cpp b/src/glsl/builtin_compiler/builtin_stubs.cpp
544new file mode 100644
545index 0000000..dfa5d32
546--- /dev/null
547+++ b/src/glsl/builtin_compiler/builtin_stubs.cpp
548@@ -0,0 +1,39 @@
549+/*
550+ * Copyright © 2010 Intel Corporation
551+ *
552+ * Permission is hereby granted, free of charge, to any person obtaining a
553+ * copy of this software and associated documentation files (the "Software"),
554+ * to deal in the Software without restriction, including without limitation
555+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
556+ * and/or sell copies of the Software, and to permit persons to whom the
557+ * Software is furnished to do so, subject to the following conditions:
558+ *
559+ * The above copyright notice and this permission notice (including the next
560+ * paragraph) shall be included in all copies or substantial portions of the
561+ * Software.
562+ *
563+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
564+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
565+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
566+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
567+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
568+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
569+ * DEALINGS IN THE SOFTWARE.
570+ */
571+
572+#include <stdio.h>
573+#include "glsl_parser_extras.h"
574+
575+/* A dummy file. When compiling prototypes, we don't care about builtins.
576+ * We really don't want to half-compile builtin_functions.cpp and fail, though.
577+ */
578+void
579+_mesa_glsl_release_functions(void)
580+{
581+}
582+
583+void
584+_mesa_glsl_initialize_functions(_mesa_glsl_parse_state *state)
585+{
586+ (void) state;
587+}
588diff --git a/src/glsl/builtin_stubs.cpp b/src/glsl/builtin_stubs.cpp
589deleted file mode 100644
590index dfa5d32..0000000
591--- a/src/glsl/builtin_stubs.cpp
592+++ /dev/null
593@@ -1,39 +0,0 @@
594-/*
595- * Copyright © 2010 Intel Corporation
596- *
597- * Permission is hereby granted, free of charge, to any person obtaining a
598- * copy of this software and associated documentation files (the "Software"),
599- * to deal in the Software without restriction, including without limitation
600- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
601- * and/or sell copies of the Software, and to permit persons to whom the
602- * Software is furnished to do so, subject to the following conditions:
603- *
604- * The above copyright notice and this permission notice (including the next
605- * paragraph) shall be included in all copies or substantial portions of the
606- * Software.
607- *
608- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
609- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
610- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
611- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
612- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
613- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
614- * DEALINGS IN THE SOFTWARE.
615- */
616-
617-#include <stdio.h>
618-#include "glsl_parser_extras.h"
619-
620-/* A dummy file. When compiling prototypes, we don't care about builtins.
621- * We really don't want to half-compile builtin_functions.cpp and fail, though.
622- */
623-void
624-_mesa_glsl_release_functions(void)
625-{
626-}
627-
628-void
629-_mesa_glsl_initialize_functions(_mesa_glsl_parse_state *state)
630-{
631- (void) state;
632-}