[Mesa-dev] [PATCH] Haiku: convert to autotools

Jerome Duval jerome.duval at gmail.com
Mon Oct 23 15:58:46 UTC 2017


* configure.ac:
  -pthread is not available on Haiku.
  Haiku doesn't require --enable-dri
  build hgl on Haiku
* egl/Makefile.am: define backendfiles for Haiku
* src/gallium/Makefile.am: build winsys/sw/hgl, state_trackers/hgl and
targets/haiku-softpipe on Haiku.
* src/gallium/targets/haiku-softpipe: add Makefile.am
* src/gallium/state_trackers/hgl: add Makefile.am
* winsys/sw/hgl: add Makefile.am
* src/hgl/Makefile.am: add Makefile.am
---
 configure.ac                                       | 30 +++++++++-
 src/Makefile.am                                    |  4 ++
 src/egl/Makefile.am                                | 20 ++++++-
 src/gallium/Makefile.am                            |  9 ++-
 src/gallium/state_trackers/hgl/Makefile.am         | 39 ++++++++++++
 src/gallium/state_trackers/hgl/Makefile.sources    |  3 +
 src/gallium/targets/haiku-softpipe/Makefile.am     | 69 ++++++++++++++++++++++
 .../targets/haiku-softpipe/SoftwareRenderer.cpp    |  2 +
 src/gallium/winsys/sw/hgl/Makefile.am              | 34 +++++++++++
 src/gallium/winsys/sw/hgl/Makefile.sources         |  3 +
 src/hgl/Makefile.am                                | 50 ++++++++++++++++
 src/hgl/Makefile.sources                           |  8 +++
 src/hgl/gl.pc.in                                   | 11 ++++
 13 files changed, 277 insertions(+), 5 deletions(-)
 create mode 100644 src/gallium/state_trackers/hgl/Makefile.am
 create mode 100644 src/gallium/state_trackers/hgl/Makefile.sources
 create mode 100644 src/gallium/targets/haiku-softpipe/Makefile.am
 create mode 100644 src/gallium/winsys/sw/hgl/Makefile.am
 create mode 100644 src/gallium/winsys/sw/hgl/Makefile.sources
 create mode 100644 src/hgl/Makefile.am
 create mode 100644 src/hgl/Makefile.sources
 create mode 100644 src/hgl/gl.pc.in

diff --git a/configure.ac b/configure.ac
index add3830..1d8efc5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -272,6 +272,9 @@ case "$host_os" in
 *-android*)
     android=yes
     ;;
+*haiku)
+    haiku=yes
+    ;;
 linux*|*-gnu*|gnu*|cygwin*)
     DEFINES="$DEFINES -D_GNU_SOURCE"
     ;;
@@ -281,6 +284,7 @@ solaris*)
 esac
 
 AM_CONDITIONAL(HAVE_ANDROID, test "x$android" = xyes)
+AM_CONDITIONAL(HAVE_HAIKU, test "x$haiku" = xyes)
 
 dnl
 dnl Check compiler flags
@@ -863,12 +867,18 @@ dnl According to the manual when using pthreads, one should add -pthread to
 dnl both compile and link-time arguments.
 dnl In practise that should be sufficient for all platforms, since any
 dnl platforms build with GCC and Clang support the flag.
-PTHREAD_LIBS="$PTHREAD_LIBS -pthread"
+case "$host_os" in
+haiku*)
+    ;;
+* )
+    PTHREAD_LIBS="$PTHREAD_LIBS -pthread"
+    ;;
+esac
 
 dnl pthread-stubs is mandatory on BSD platforms, due to the nature of the
 dnl project. Even then there's a notable issue as described in the project README
 case "$host_os" in
-linux* | cygwin* | darwin* | solaris* | *-gnu* | gnu*)
+linux* | cygwin* | darwin* | solaris* | *-gnu* | gnu* | haiku*)
     pthread_stubs_possible="no"
     ;;
 * )
@@ -1518,7 +1528,12 @@ require_dri_shared_libs_and_glapi() {
     if test "x$enable_dri" != xyes; then
         # There is only a single backend which won't be build/used otherwise.
         # XXX: Revisit this as the egl/haiku is a thing.
-        AC_MSG_ERROR([$1 requires --enable-dri])
+        case "$host_os" in
+        haiku*)
+                ;;
+        *)
+                AC_MSG_ERROR([$1 requires --enable-dri]) ;;
+		esac
     fi
 
     if test "x$enable_shared_glapi" != xyes; then
@@ -1748,6 +1763,10 @@ for plat in $platforms; do
         DEFINES="$DEFINES -DHAVE_ANDROID_PLATFORM"
         ;;
 
+    haiku)
+        DEFINES="$DEFINES -DHAVE_HAIKU_PLATFORM"
+        ;;
+
     *)
         AC_MSG_ERROR([platform '$plat' does not exist])
         ;;
@@ -2891,6 +2910,7 @@ AC_CONFIG_FILES([Makefile
                  src/gallium/state_trackers/clover/Makefile
                  src/gallium/state_trackers/dri/Makefile
                  src/gallium/state_trackers/glx/xlib/Makefile
+                 src/gallium/state_trackers/hgl/Makefile
                  src/gallium/state_trackers/nine/Makefile
                  src/gallium/state_trackers/omx_bellagio/Makefile
                  src/gallium/state_trackers/osmesa/Makefile
@@ -2901,6 +2921,7 @@ AC_CONFIG_FILES([Makefile
                  src/gallium/targets/d3dadapter9/Makefile
                  src/gallium/targets/d3dadapter9/d3d.pc
                  src/gallium/targets/dri/Makefile
+                 src/gallium/targets/haiku-softpipe/Makefile
                  src/gallium/targets/libgl-xlib/Makefile
                  src/gallium/targets/omx-bellagio/Makefile
                  src/gallium/targets/opencl/Makefile
@@ -2925,6 +2946,7 @@ AC_CONFIG_FILES([Makefile
                  src/gallium/winsys/amdgpu/drm/Makefile
                  src/gallium/winsys/svga/drm/Makefile
                  src/gallium/winsys/sw/dri/Makefile
+                 src/gallium/winsys/sw/hgl/Makefile
                  src/gallium/winsys/sw/kms-dri/Makefile
                  src/gallium/winsys/sw/null/Makefile
                  src/gallium/winsys/sw/wrapper/Makefile
@@ -2941,6 +2963,8 @@ AC_CONFIG_FILES([Makefile
                  src/glx/windows/Makefile
                  src/glx/windows/windowsdriproto.pc
                  src/gtest/Makefile
+                 src/hgl/Makefile
+                 src/hgl/gl.pc
                  src/intel/Makefile
                  src/loader/Makefile
                  src/mapi/Makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index 5ef2d4f..7ef63f7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -108,6 +108,10 @@ if HAVE_PLATFORM_WAYLAND
 SUBDIRS += egl/wayland/wayland-egl
 endif
 
+if HAVE_HAIKU
+SUBDIRS += hgl
+endif
+
 if HAVE_EGL
 SUBDIRS += egl
 endif
diff --git a/src/egl/Makefile.am b/src/egl/Makefile.am
index eeb745f..9b8528645 100644
--- a/src/egl/Makefile.am
+++ b/src/egl/Makefile.am
@@ -52,6 +52,7 @@ libEGL_common_la_LIBADD = \
 
 dri2_backend_FILES =
 dri3_backend_FILES =
+haiku_backend_FILES =
 
 if HAVE_PLATFORM_X11
 AM_CFLAGS += $(XCB_DRI2_CFLAGS)
@@ -108,6 +109,22 @@ libEGL_common_la_LIBADD += $(ANDROID_LIBS)
 dri2_backend_FILES += drivers/dri2/platform_android.c
 endif
 
+if HAVE_HAIKU
+AM_CPPFLAGS = \
+	-I$(top_srcdir)/include \
+	-I$(top_srcdir)/include/HaikuGL \
+	-I$(top_srcdir)/src/egl/main \
+	-I$(top_srcdir)/src/ \
+	-D_EGL_BUILT_IN_DRIVER_HAIKU \
+	-D_EGL_NATIVE_PLATFORM=$(EGL_NATIVE_PLATFORM)
+haiku_backend_FILES += drivers/haiku/egl_haiku.cpp
+libEGL_common_la_LIBADD += $(top_builddir)/src/hgl/libGL.la
+libEGL_common_la_SOURCES += \
+	$(haiku_backend_FILES)
+
+endif
+
+if !HAVE_HAIKU
 AM_CFLAGS += \
 	-I$(top_srcdir)/src/loader \
 	-I$(top_builddir)/src/egl/drivers/dri2 \
@@ -151,6 +168,8 @@ g_egldispatchstubs.h: $(GLVND_GEN_DEPS)
 BUILT_SOURCES += g_egldispatchstubs.c g_egldispatchstubs.h
 CLEANFILES = $(BUILT_SOURCES)
 
+endif
+
 if USE_LIBGLVND
 AM_CFLAGS += \
 	$(GLVND_CFLAGS)
@@ -207,7 +226,6 @@ TESTS = egl-symbols-check \
 EXTRA_DIST = \
 	$(TESTS) \
 	SConscript \
-	drivers/haiku \
 	main/egl.def \
 	main/README.txt \
 	$(GLVND_GEN_DEPS) \
diff --git a/src/gallium/Makefile.am b/src/gallium/Makefile.am
index ea20799..37800b9 100644
--- a/src/gallium/Makefile.am
+++ b/src/gallium/Makefile.am
@@ -119,6 +119,10 @@ if HAVE_DRISW_KMS
 SUBDIRS += winsys/sw/kms-dri
 endif
 
+if HAVE_HAIKU
+SUBDIRS += winsys/sw/hgl
+endif
+
 SUBDIRS += winsys/sw/wrapper
 
 ##
@@ -182,6 +186,10 @@ if HAVE_ST_NINE
 SUBDIRS += state_trackers/nine targets/d3dadapter9
 endif
 
+if HAVE_HAIKU
+SUBDIRS += state_trackers/hgl targets/haiku-softpipe
+endif
+
 ##
 ## Don't forget to bundle the remaining (non autotools) state-trackers/targets
 ##
@@ -191,7 +199,6 @@ EXTRA_DIST += \
 	state_trackers/README \
 	state_trackers/wgl targets/libgl-gdi \
 	targets/graw-gdi targets/graw-null  targets/graw-xlib \
-	state_trackers/hgl targets/haiku-softpipe \
 	tools
 
 
diff --git a/src/gallium/state_trackers/hgl/Makefile.am b/src/gallium/state_trackers/hgl/Makefile.am
new file mode 100644
index 0000000..5b55be8
--- /dev/null
+++ b/src/gallium/state_trackers/hgl/Makefile.am
@@ -0,0 +1,39 @@
+# Copyright © 2017 Haiku, Inc. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+include Makefile.sources
+include $(top_srcdir)/src/gallium/Automake.inc
+
+
+AM_CPPFLAGS = \
+	-I$(top_srcdir)/src \
+	-I$(top_srcdir)/src/mapi \
+	-I$(top_srcdir)/src/mesa \
+	-I$(top_srcdir)/include/HaikuGL \
+	$(GALLIUM_CFLAGS)
+
+noinst_LTLIBRARIES = libhgl.la
+libhgl_la_LIBADD = -ltranslation
+libhgl_la_SOURCES = $(common_SOURCES)
+
+
+EXTRA_DIST = SConscript
diff --git a/src/gallium/state_trackers/hgl/Makefile.sources b/src/gallium/state_trackers/hgl/Makefile.sources
new file mode 100644
index 0000000..3076ba3
--- /dev/null
+++ b/src/gallium/state_trackers/hgl/Makefile.sources
@@ -0,0 +1,3 @@
+common_SOURCES := \
+	hgl.c \
+	bitmap_wrapper.cpp
diff --git a/src/gallium/targets/haiku-softpipe/Makefile.am b/src/gallium/targets/haiku-softpipe/Makefile.am
new file mode 100644
index 0000000..94599a3
--- /dev/null
+++ b/src/gallium/targets/haiku-softpipe/Makefile.am
@@ -0,0 +1,69 @@
+include $(top_srcdir)/src/gallium/Automake.inc
+
+AM_CPPFLAGS = \
+		-I$(top_srcdir)/src/mapi \
+		-I$(top_srcdir)/src/mesa \
+		-I$(top_srcdir)/src/mesa/main \
+		-I$(top_srcdir)/include/HaikuGL \
+		-I$(top_srcdir)/src/gallium/include \
+		-I$(top_srcdir)/src/gallium/winsys \
+		-I$(top_srcdir)/src/gallium/state_trackers/hgl \
+		-I/boot/system/develop/headers/private \
+		$(GALLIUM_TARGET_CFLAGS) \
+		$(DEFINES) \
+		-DGALLIUM_SOFTPIPE \
+		-DGALLIUM_RBUG \
+		-DGALLIUM_TRACE
+
+hswpipedir = ${libdir}/haiku
+hswpipe_LTLIBRARIES = libswpipe.la
+
+libswpipe_la_SOURCES = \
+		GalliumContext.cpp \
+		SoftwareRenderer.cpp
+
+libswpipe_la_LDFLAGS = \
+		-shared \
+		-shrext .so \
+		-module \
+		-avoid-version \
+		$(GC_SECTIONS)
+
+libswpipe_la_LIBADD = \
+		$(top_builddir)/src/hgl/libGL.la \
+		$(top_builddir)/src/gallium/winsys/sw/hgl/libswhgl.la \
+		$(top_builddir)/src/gallium/state_trackers/hgl/libhgl.la \
+		$(top_builddir)/src/gallium/drivers/rbug/librbug.la \
+		$(top_builddir)/src/gallium/drivers/trace/libtrace.la \
+		$(top_builddir)/src/gallium/auxiliary/libgallium.la \
+		$(top_builddir)/src/mesa/libmesagallium.la \
+		$(top_builddir)/src/gallium/drivers/softpipe/libsoftpipe.la \
+		$(GALLIUM_COMMON_LIB_DEPS) \
+		-lnetwork
+
+EXTRA_DIST = \
+		SConscript
+
+TARGET_DRIVERS =
+TARGET_CPPFLAGS =
+TARGET_LIB_DEPS =
+
+include $(top_srcdir)/src/gallium/drivers/softpipe/Automake.inc
+include $(top_srcdir)/src/gallium/drivers/llvmpipe/Automake.inc
+include $(top_srcdir)/src/gallium/drivers/swr/Automake.inc
+
+
+if HAVE_GALLIUM_LLVM
+AM_CPPFLAGS += -DGALLIUM_LLVMPIPE
+
+libswpipe_la_LIBADD += $(LLVM_LIBS) \
+	$(top_builddir)/src/gallium/drivers/llvmpipe/libllvmpipe.la
+libswpipe_la_LDFLAGS += $(LLVM_LDFLAGS)
+endif
+
+if HAVE_GALLIUM_SWR
+AM_CPPFLAGS += -DGALLIUM_SWR
+
+libswpipe_la_LIBADD += \
+        $(top_builddir)/src/gallium/drivers/swr/libmesaswr.la
+endif
diff --git a/src/gallium/targets/haiku-softpipe/SoftwareRenderer.cpp b/src/gallium/targets/haiku-softpipe/SoftwareRenderer.cpp
index 18cb1ac..4e4888a 100644
--- a/src/gallium/targets/haiku-softpipe/SoftwareRenderer.cpp
+++ b/src/gallium/targets/haiku-softpipe/SoftwareRenderer.cpp
@@ -33,6 +33,8 @@
 
 extern const char* color_space_name(color_space space);
 
+#undef _EXPORT
+#define _EXPORT __attribute__((__visibility__("default")))
 
 extern "C" _EXPORT BGLRenderer*
 instantiate_gl_renderer(BGLView *view, ulong opts, BGLDispatcher *dispatcher)
diff --git a/src/gallium/winsys/sw/hgl/Makefile.am b/src/gallium/winsys/sw/hgl/Makefile.am
new file mode 100644
index 0000000..8e5d403
--- /dev/null
+++ b/src/gallium/winsys/sw/hgl/Makefile.am
@@ -0,0 +1,34 @@
+# Copyright © 2017 Haiku, Inc. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+# DEALINGS IN THE SOFTWARE.
+
+include Makefile.sources
+include $(top_srcdir)/src/gallium/Automake.inc
+
+AM_CFLAGS = \
+	-I$(top_srcdir)/src/gallium/state_trackers/hgl \
+	$(GALLIUM_WINSYS_CFLAGS)
+
+noinst_LTLIBRARIES = libswhgl.la
+
+libswhgl_la_SOURCES = $(C_SOURCES)
+
+EXTRA_DIST = SConscript
diff --git a/src/gallium/winsys/sw/hgl/Makefile.sources b/src/gallium/winsys/sw/hgl/Makefile.sources
new file mode 100644
index 0000000..52bfc88
--- /dev/null
+++ b/src/gallium/winsys/sw/hgl/Makefile.sources
@@ -0,0 +1,3 @@
+C_SOURCES := \
+	hgl_sw_winsys.c \
+	hgl_sw_winsys.h
diff --git a/src/hgl/Makefile.am b/src/hgl/Makefile.am
new file mode 100644
index 0000000..f82602a
--- /dev/null
+++ b/src/hgl/Makefile.am
@@ -0,0 +1,50 @@
+# Copyright © 2017 Haiku, Inc. All rights reserved.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice (including the next
+# paragraph) shall be included in all copies or substantial portions of the
+# Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+include Makefile.sources
+
+AM_CPPFLAGS = \
+	-I$(top_srcdir)/src \
+	-I$(top_srcdir)/src/mapi \
+	-I$(top_srcdir)/src/mesa \
+	-I$(top_srcdir)/src/mesa/main \
+	-I$(top_srcdir)/include/ \
+	-I$(top_srcdir)/include/HaikuGL \
+	-I/system/develop/headers/private \
+	-I$(top_builddir)/src/mapi \
+	$(DEFINES)
+
+
+lib_LTLIBRARIES = libGL.la
+
+libGL_la_LIBADD = $(top_builddir)/src/mapi/glapi/libglapi.la -lbe
+libGL_la_SOURCES = $(COMMON_SOURCES)
+libGL_la_LDFLAGS = \
+	-no-undefined \
+	-version-number 1:0 \
+	$(BSYMBOLIC) \
+	$(GC_SECTIONS) \
+	$(LD_NO_UNDEFINED)
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = gl.pc
+
+EXTRA_DIST =
diff --git a/src/hgl/Makefile.sources b/src/hgl/Makefile.sources
new file mode 100644
index 0000000..5df230b
--- /dev/null
+++ b/src/hgl/Makefile.sources
@@ -0,0 +1,8 @@
+COMMON_SOURCES := \
+    GLView.cpp \
+    GLRenderer.cpp \
+    GLRendererRoster.cpp \
+    GLRendererRoster.h \
+    GLDispatcher.cpp \
+    GLDispatcher.h
+
diff --git a/src/hgl/gl.pc.in b/src/hgl/gl.pc.in
new file mode 100644
index 0000000..7577bae
--- /dev/null
+++ b/src/hgl/gl.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=${prefix}
+libdir=@libdir@
+includedir=@includedir@
+
+Name: gl
+Description: Mesa OpenGL library
+Version: @PACKAGE_VERSION@
+Libs: -L${libdir} -lGL
+Libs.private: @GL_PC_LIB_PRIV@
+Cflags: -I${includedir} @GL_PC_CFLAGS@
-- 
2.7.4



More information about the mesa-dev mailing list