[Mesa-dev] [PATCH] Add initial Haiku build support
Alexander von Gluck
kallisti5 at unixzen.com
Wed Dec 21 10:16:23 PST 2011
* Doesn't reintroduce legacy drivers
* Adds Haiku mklib code
* Removes some broken PIPE_OS_HAIKU defines
* Removes an NDEBUG ifdef in link_uniforms.cpp,
there is an item that uses the union without
checking NDEBUG below.
* Haiku has a opengl kit that will wrap all of
these build binaries(pretty much an external beos
mesa driver)
---
Makefile | 1 +
acinclude.m4 | 2 +-
bin/mklib | 37 +++++++++++++++++++
configs/haiku | 66
++++++++++++++++++++++++++++++++++
src/gallium/auxiliary/os/os_thread.h | 2 +-
src/gallium/auxiliary/util/u_debug.h | 2 -
src/gallium/drivers/r300/Makefile | 1 +
src/glsl/link_uniforms.cpp | 3 +-
src/glu/sgi/Makefile | 4 +-
src/mesa/main/querymatrix.c | 2 +-
10 files changed, 111 insertions(+), 9 deletions(-)
create mode 100644 configs/haiku
diff --git a/Makefile b/Makefile
index cf6555c..4caa8ce 100644
--- a/Makefile
+++ b/Makefile
@@ -90,6 +90,7 @@ freebsd \
freebsd-dri \
freebsd-dri-amd64 \
freebsd-dri-x86 \
+haiku \
hpux10 \
hpux10-gcc \
hpux10-static \
diff --git a/acinclude.m4 b/acinclude.m4
index a5b389d..33ed8a8 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -34,7 +34,7 @@ if test "$enable_pic" != no; then
# see if we're using GCC
if test "x$GCC" = xyes; then
case "$host_os" in
- aix*|beos*|cygwin*|irix5*|irix6*|osf3*|osf4*|osf5*)
+ aix*|cygwin*|haiku*|irix5*|irix6*|osf3*|osf4*|osf5*)
# PIC is the default for these OSes.
;;
mingw*|os2*|pw32*)
diff --git a/bin/mklib b/bin/mklib
index 70bd1a2..ca4b62c 100755
--- a/bin/mklib
+++ b/bin/mklib
@@ -959,6 +959,43 @@ case $ARCH in
fi
;;
+ 'Haiku')
+ if [ $STATIC = 1 ] ; then
+ LIBNAME="lib${LIBNAME}.a"
+ if [ "x$LINK" = "x" ] ; then
+ # -linker was not specified so set default link
command now
+ if [ $CPLUSPLUS = 1 ] ; then
+ LINK=g++
+ else
+ LINK=gcc
+ fi
+ fi
+
+ OPTS="-ru"
+ if [ "${ALTOPTS}" ] ; then
+ OPTS=${ALTOPTS}
+ fi
+
+ echo "mklib: Making static library for Haiku: " ${LIBNAME}
+
+ # expand .a into .o files
+ NEW_OBJECTS=`expand_archives ${LIBNAME}.obj $OBJECTS`
+
+ # make static lib
+ FINAL_LIBS=`make_ar_static_lib ${OPTS} 1 ${LIBNAME}
${NEW_OBJECTS}`
+
+ # remove temporary extracted .o files
+ rm -rf ${LIBNAME}.obj
+ else
+ LIBNAME="lib${LIBNAME}.so" # prefix with "lib", suffix
with ".so"
+ OPTS="-shared"
+
+ echo "mklib: Making shared library for Haiku: " ${LIBNAME}
+ ${LINK} ${OPTS} ${LDFLAGS} ${OBJECTS} ${DEPS} -o ${LIBNAME}
+ FINAL_LIBS="${LIBNAME}"
+ fi
+ ;;
+
'example')
# If you're adding support for a new architecture, you can
# start with this:
diff --git a/configs/haiku b/configs/haiku
new file mode 100644
index 0000000..12f958e
--- /dev/null
+++ b/configs/haiku
@@ -0,0 +1,66 @@
+# Configuration for Haiku
+# Written by Alexander von Gluck IV
+#
+# Based on the BeOS config
+# written by Philippe Houdoin
+
+include $(TOP)/configs/default
+
+CONFIG_NAME = haiku
+
+# Haiku settings
+
+DEFINES = \
+ -DBEOS_THREADS \
+ -DGNU_ASSEMBLER \
+ -DUSE_X86_ASM \
+ -DUSE_MMX_ASM \
+ -DUSE_3DNOW_ASM \
+ -DUSE_SSE_ASM
+
+MESA_ASM_SOURCES = $(X86_SOURCES)
+GLAPI_ASM_SOURCES = $(X86_API)
+
+CC = gcc
+CXX = g++
+LD = gcc
+
+CFLAGS = -Wall -Wno-multichar $(DEFINES)
+CXXFLAGS = $(CFLAGS)
+LDFLAGS += -Xlinker
+
+# Work around aliasing bugs - developers should comment this out
+CFLAGS += -fno-strict-aliasing -std=c99
+CXXFLAGS += -fno-strict-aliasing
+
+# No makedepend on Haiku, this will solve it
+MKDEP = true
+
+# Debug defines
+ifdef DEBUG
+ CFLAGS += -g -O0
+ LDFLAGS += -g
+ DEFINES += -DDEBUG
+else
+ CFLAGS += -O3
+endif
+
+# Glut setings
+GLUT_CFLAGS = -fexceptions
+
+# Gallium settings
+GALLIUM_DRIVERS_DIRS = trace softpipe i915 r300
+GALLIUM_STATE_TRACKERS_DIRS =
+
+# Directories
+SRC_DIRS = gallium glsl mapi/glapi mesa/x86 mesa glu
+SRC_DIRS += glut/beos
+GLU_DIRS = sgi
+DRIVER_DIRS =
+
+# Library/program dependencies
+GL_LIB_DEPS =
+OSMESA_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB)
+GLU_LIB_DEPS =
+GLUT_LIB_DEPS = -lgame -L$(TOP)/$(LIB_DIR) -l$(GL_LIB)
+APP_LIB_DEPS = -lbe -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -l$(GLUT_LIB)
diff --git a/src/gallium/auxiliary/os/os_thread.h
b/src/gallium/auxiliary/os/os_thread.h
index d830129..3e1c273 100644
--- a/src/gallium/auxiliary/os/os_thread.h
+++ b/src/gallium/auxiliary/os/os_thread.h
@@ -314,7 +314,7 @@ typedef int64_t pipe_condvar;
* pipe_barrier
*/
-#if (defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) ||
defined(PIPE_OS_SOLARIS) || defined(PIPE_OS_HAIKU)) &&
!defined(PIPE_OS_ANDROID)
+#if (defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) ||
defined(PIPE_OS_SOLARIS)) && !defined(PIPE_OS_ANDROID)
typedef pthread_barrier_t pipe_barrier;
diff --git a/src/gallium/auxiliary/util/u_debug.h
b/src/gallium/auxiliary/util/u_debug.h
index b5ea405..677e478 100644
--- a/src/gallium/auxiliary/util/u_debug.h
+++ b/src/gallium/auxiliary/util/u_debug.h
@@ -75,7 +75,6 @@ _debug_printf(const char *format, ...)
* - avoid outputing large strings (512 bytes is the current maximum
length
* that is guaranteed to be printed in all platforms)
*/
-#if !defined(PIPE_OS_HAIKU)
static INLINE void
debug_printf(const char *format, ...) _util_printf_format(1,2);
@@ -92,7 +91,6 @@ debug_printf(const char *format, ...)
#endif
}
-#endif /* !PIPE_OS_HAIKU */
/*
* ... isn't portable so we need to pass arguments in parentheses.
diff --git a/src/gallium/drivers/r300/Makefile
b/src/gallium/drivers/r300/Makefile
index 5f56fc4..3e3a765 100644
--- a/src/gallium/drivers/r300/Makefile
+++ b/src/gallium/drivers/r300/Makefile
@@ -15,6 +15,7 @@ C_SOURCES += \
LIBRARY_INCLUDES = \
-I$(TOP)/include \
-I$(TOP)/src/mesa \
+ -I$(TOP)/src/mapi \
-I$(TOP)/src/glsl
include ../../Makefile.template
diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp
index c7de480..f2e6648 100644
--- a/src/glsl/link_uniforms.cpp
+++ b/src/glsl/link_uniforms.cpp
@@ -336,9 +336,8 @@ link_assign_uniform_locations(struct
gl_shader_program *prog)
rzalloc_array(prog, struct gl_uniform_storage,
num_user_uniforms);
union gl_constant_value *data =
rzalloc_array(uniforms, union gl_constant_value,
num_data_slots);
-#ifndef NDEBUG
+
union gl_constant_value *data_end = &data[num_data_slots];
-#endif
parcel_out_uniform_storage parcel(prog->UniformHash, uniforms,
data);
diff --git a/src/glu/sgi/Makefile b/src/glu/sgi/Makefile
index c8b29ed..b2dc273 100644
--- a/src/glu/sgi/Makefile
+++ b/src/glu/sgi/Makefile
@@ -124,8 +124,8 @@ OBJECTS = $(C_OBJECTS) $(CC_OBJECTS)
##### TARGETS #####
default:
- @if [ "${CONFIG_NAME}" = "beos" ] ; then \
- echo "$(GLU_LIB_NAME) not build under BeOS, but integrated into
${GL_LIB_NAME}." ; \
+ @if [ "${CONFIG_NAME}" = "haiku" ] ; then \
+ echo "$(GLU_LIB_NAME) not built under Haiku, but integrated into
${GL_LIB_NAME} by the opengl kit." ; \
exit 0 ; \
else \
$(MAKE) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) || exit 1 ; \
diff --git a/src/mesa/main/querymatrix.c b/src/mesa/main/querymatrix.c
index eaedf7c..2843d55 100644
--- a/src/mesa/main/querymatrix.c
+++ b/src/mesa/main/querymatrix.c
@@ -73,7 +73,7 @@ fpclassify(double x)
#elif defined(__APPLE__) || defined(__CYGWIN__) ||
defined(__FreeBSD__) || \
defined(__OpenBSD__) || defined(__NetBSD__) ||
defined(__DragonFly__) || \
(defined(__sun) && defined(__C99FEATURES__)) ||
defined(__MINGW32__) || \
- (defined(__sun) && defined(__GNUC__)) || defined(ANDROID)
+ (defined(__sun) && defined(__GNUC__)) || defined(ANDROID) ||
defined(__HAIKU__)
/* fpclassify is available. */
--
1.7.7.2
More information about the mesa-dev
mailing list