From 179c3e09e2e0418100ee909463f010b81491c139 Mon Sep 17 00:00:00 2001 From: Alexander von Gluck IV Date: Sun, 7 Mar 2021 17:46:49 -0600 Subject: [PATCH] mesa: Add 21.0.0 (based on rc5 for now) * Leaving as untested for now.. there are a few issues... * Some OpenGL windows (GLInfo is a good example) will crash on exit. * Some OpenGL windows (GZDoom, others) won't display until the window is moved. --- sys-libs/mesa/mesa-21.0.0.recipe | 168 +++++++++++++++++++++ sys-libs/mesa/patches/mesa-21.0.0.patchset | 25 +++ 2 files changed, 193 insertions(+) create mode 100644 sys-libs/mesa/mesa-21.0.0.recipe create mode 100644 sys-libs/mesa/patches/mesa-21.0.0.patchset diff --git a/sys-libs/mesa/mesa-21.0.0.recipe b/sys-libs/mesa/mesa-21.0.0.recipe new file mode 100644 index 000000000..79b75347b --- /dev/null +++ b/sys-libs/mesa/mesa-21.0.0.recipe @@ -0,0 +1,168 @@ +SUMMARY="Multi-platform GL implementation" +DESCRIPTION="Mesa is an open-source implementation of the OpenGL \ +specification. The OpenGL specification documents a system for rendering \ +interactive 3D graphics. Mesa fills the role of the Haiku OpenGL kit \ +providing 3D rendering to Haiku applications." +HOMEPAGE="https://www.mesa3d.org/" +COPYRIGHT="1999-2021 Brian Paul" +LICENSE="MIT" +REVISION="1" +#SOURCE_URI="https://mesa.freedesktop.org/archive/mesa-${portVersion}.tar.xz" +SOURCE_URI="https://mesa.freedesktop.org/archive/mesa-21.0.0-rc5.tar.xz" +SOURCE_DIR="mesa-21.0.0-rc5" +CHECKSUM_SHA256="f57d23aa69d5ed7cfde250a7bf8f72285a34692f9e8d541532fa6970f941ce01" +PATCHES="mesa-${portVersion}.patchset" + +ARCHITECTURES="!x86_gcc2 ?x86 ?x86_64 ?arm ?ppc" +SECONDARY_ARCHITECTURES="?x86" + +libVersion=1.0.0 +libOSMesaVersion=8.0.0 +libVersionCompat="$libVersion compat >= ${libVersion%%.*}" +libOSMesaVersionCompat="$libOSMesaVersion compat >= ${libOSMesaVersion%%.*}" + +PROVIDES=" + mesa$secondaryArchSuffix = $portVersion + lib:libEGL$secondaryArchSuffix = $libVersionCompat + lib:libGL$secondaryArchSuffix = $libVersionCompat + lib:libOSMesa$secondaryArchSuffix = $libOSMesaVersionCompat + lib:libglesv1_cm$secondaryArchSuffix = 1.1.0 + lib:libglesv2$secondaryArchSuffix = 2.0.0 + lib:libglapi$secondaryArchSuffix = 0.0.0 + " +REQUIRES=" + haiku$secondaryArchSuffix + lib:libz$secondaryArchSuffix + lib:libLLVM_9$secondaryArchSuffix + lib:libexpat$secondaryArchSuffix + " + +PROVIDES_devel=" + mesa${secondaryArchSuffix}_devel = $portVersion + devel:libEGL$secondaryArchSuffix = $libVersionCompat + devel:libGL$secondaryArchSuffix = $libVersionCompat + devel:libOSMesa$secondaryArchSuffix = $libOSMesaVersionCompat + devel:libglesv1_cm$secondaryArchSuffix = 1.1.0 + devel:libglesv2$secondaryArchSuffix = 2.0.0 + devel:libglapi$secondaryArchSuffix = 0.0.0 + " +REQUIRES_devel=" + mesa$secondaryArchSuffix == $portVersion base + " + +SUMMARY_swpipe="The Mesa LLVM enhanced Gallium software pipe renderer" +DESCRIPTION_swpipe="This 3D BGLRenderer add-on provides Gallium LLVM \ +enhanced software rendering. Software pipe rendering performs all \ +3D rendering on the systems CPU and doesn't require any specialized \ +hardware. The usage of LLVM over traditional rasterization gives this \ +renderer a boost in performance. + +Gallium software pipe rendering is in an extremely early state as of \ +this version of Mesa, and may not function as expected." + +PROVIDES_swpipe=" + mesa${secondaryArchSuffix}_swpipe = $portVersion + " +REQUIRES_swpipe=" + mesa$secondaryArchSuffix == $portVersion base + lib:libLLVM_9$secondaryArchSuffix + " + +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel + devel:libz$secondaryArchSuffix + devel:libLLVM_9$secondaryArchSuffix + devel:libexpat$secondaryArchSuffix + " +BUILD_PREREQUIRES=" + python3$secondaryArchSuffix + mako_python3$secondaryArchSuffix + cmd:ninja + cmd:bison + cmd:find + cmd:flex + cmd:meson + cmd:git + cmd:llvm_config + cmd:egrep + cmd:gcc$secondaryArchSuffix + cmd:ld$secondaryArchSuffix + cmd:pkg_config$secondaryArchSuffix + cmd:which + " + +defineDebugInfoPackage mesa$secondaryArchSuffix \ + "${addOnsDir/mesa$secondaryArchSuffix/mesa${secondaryArchSuffix}_swpipe}/opengl/Software Pipe" \ + "$libDir"/libEGL.so.$libVersion \ + "$libDir"/libGL.so.$libVersion \ + "$libDir"/libOSMesa.so.$libOSMesaVersion \ + +BUILD() +{ + if [ -n "$secondaryArchSuffix" ]; then + export HAIKU_SECONDARY_ARCH="$effectiveTargetArchitecture" + fi + + mkdir -p build + meson build -Dosmesa=true -Degl=true -Dgallium-drivers=swrast \ + --prefix=$prefix \ + --libdir=$libDir \ + --includedir=$includeDir + ninja -C build $jobArgs +} + +INSTALL() +{ + ninja -C build install + + # Do a little cleanup + rm -rf $prefix/share + + # Our rendering add-ons + mkdir -p $addOnsDir/opengl + mv $(find $libDir -name 'libswpipe.so') \ + "$addOnsDir/opengl/Software Pipe" + rm -rf $libDir/haiku + + # Set some nice version info + appVersion=${portVersion//\./ } + setversion "$libDir/libGL.so" -app $appVersion -long "Haiku OpenGL kit" + setversion "$libDir/libEGL.so.1" -app $appVersion -long "Mesa EGL" + setversion "$addOnsDir/opengl/Software Pipe" -app $appVersion -long \ + "Gallium LLVM software pipe renderer" + + prepareInstalledDevelLibs \ + libGL libEGL libOSMesa + fixPkgconfig + + # for compatibility + symlinkRelative -s $libDir/libGL.so.1 $libDir/libGL.so + + # OpenGL Kit + mkdir -p $includeDir/os/opengl + cp ./include/HaikuGL/OpenGLKit.h $includeDir/os/ + cp ./include/HaikuGL/GLView.h $includeDir/os/opengl/ + cp ./include/HaikuGL/GLRenderer.h $includeDir/os/opengl/ + + # Create GL symlink in opengl kit + symlinkRelative -s $includeDir/GL $includeDir/os/opengl/GL + # Create EGL symlink in opengl kit + symlinkRelative -s $includeDir/EGL $includeDir/os/opengl/EGL + # Create KHR symlink in opengl kit + symlinkRelative -s $includeDir/KHR $includeDir/os/opengl/KHR + + # devel package + packageEntries devel \ + $developDir + + # swpipe renderer package + packageEntries swpipe \ + "$addOnsDir/opengl/Software Pipe" + + rmdir "$addOnsDir"/opengl +} + +TEST() +{ + make check +} diff --git a/sys-libs/mesa/patches/mesa-21.0.0.patchset b/sys-libs/mesa/patches/mesa-21.0.0.patchset new file mode 100644 index 000000000..2565b05cf --- /dev/null +++ b/sys-libs/mesa/patches/mesa-21.0.0.patchset @@ -0,0 +1,25 @@ +From 2918d95088bfbcf6af593c1d3a9ebc954eaa76ab Mon Sep 17 00:00:00 2001 +From: Alexander von Gluck IV +Date: Sun, 7 Mar 2021 16:57:17 -0600 +Subject: [PATCH] egl/haiku: Fix ConfigID naming inline with mesa + +--- + src/egl/drivers/haiku/egl_haiku.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/egl/drivers/haiku/egl_haiku.cpp b/src/egl/drivers/haiku/egl_haiku.cpp +index 8eda31c2936..18c73c9cd8b 100644 +--- a/src/egl/drivers/haiku/egl_haiku.cpp ++++ b/src/egl/drivers/haiku/egl_haiku.cpp +@@ -163,7 +163,7 @@ haiku_add_configs_for_visuals(_EGLDisplay *disp) + + conf->base.BlueSize + + conf->base.AlphaSize; + conf->base.ConfigCaveat = EGL_NONE; +- conf->base.ConfigId = 1; ++ conf->base.ConfigID = 1; + conf->base.BindToTextureRGB = EGL_FALSE; + conf->base.BindToTextureRGBA = EGL_FALSE; + conf->base.StencilSize = 0; +-- +2.30.0 +