summaryrefslogtreecommitdiff
path: root/system/mesa
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2018-02-20 15:52:34 -0600
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2018-02-20 15:52:34 -0600
commit31f3497a1ca9637ff42f3185a5924e0f4e61ab5d (patch)
treef71da288bf3195087ad5ce0d37ba4340b6c8356a /system/mesa
parent643d07e773128ea18a1da44ce69b3e9c5539c68c (diff)
downloadpackages-31f3497a1ca9637ff42f3185a5924e0f4e61ab5d.tar.gz
packages-31f3497a1ca9637ff42f3185a5924e0f4e61ab5d.tar.bz2
packages-31f3497a1ca9637ff42f3185a5924e0f4e61ab5d.tar.xz
packages-31f3497a1ca9637ff42f3185a5924e0f4e61ab5d.zip
system/mesa: take bumped version from forked aports
Diffstat (limited to 'system/mesa')
-rw-r--r--system/mesa/APKBUILD252
-rw-r--r--system/mesa/disk_cache-stack-overflow.patch42
-rw-r--r--system/mesa/drmdeps.patch41
-rw-r--r--system/mesa/glx_ro_text_segm.patch28
-rw-r--r--system/mesa/musl-fix-includes.patch14
-rw-r--r--system/mesa/musl-fixes.patch22
-rw-r--r--system/mesa/python3-compat.patch106
7 files changed, 505 insertions, 0 deletions
diff --git a/system/mesa/APKBUILD b/system/mesa/APKBUILD
new file mode 100644
index 000000000..ed5c69f89
--- /dev/null
+++ b/system/mesa/APKBUILD
@@ -0,0 +1,252 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=mesa
+pkgver=17.3.1
+pkgrel=1
+pkgdesc="Mesa DRI OpenGL library"
+url="http://www.mesa3d.org"
+arch="all"
+license="LGPL"
+depends=
+subpackages="$pkgname-dev
+ $pkgname-dri-ati:_dri
+ $pkgname-dri-nouveau:_dri
+ $pkgname-dri-freedreno:_dri
+ $pkgname-dri-swrast:_dri
+ $pkgname-dri-virtio:_dri
+ $pkgname-glapi $pkgname-egl $pkgname-gl $pkgname-gles
+ $pkgname-xatracker $pkgname-osmesa $pkgname-gbm
+ $pkgname-libwayland-egl:_wayland
+ "
+_llvmver=4
+depends_dev="libdrm-dev dri2proto libxext-dev libxdamage-dev libxcb-dev glproto
+ dri3proto presentproto libxshmfence-dev"
+makedepends="$depends_dev expat-dev xextproto libxt-dev makedepend py3-mako
+ flex bison llvm$_llvmver-dev eudev-dev libvdpau-dev python3 py-libxml2
+ libxvmc-dev gettext zlib-dev wayland-dev libelf-dev wayland-protocols
+ autoconf automake libtool libxxf86vm-dev libx11-dev libxfixes-dev"
+source="https://mesa.freedesktop.org/archive/mesa-$pkgver.tar.xz
+ glx_ro_text_segm.patch
+ musl-fixes.patch
+ musl-fix-includes.patch
+ disk_cache-stack-overflow.patch
+ drmdeps.patch
+ python3-compat.patch
+ "
+replaces="mesa-dricore"
+
+_dri_driverdir=/usr/lib/xorg/modules/dri
+_dri_drivers="r200,radeon,nouveau,swrast"
+_gallium_drivers="r300,r600,radeonsi,nouveau,freedreno,swrast,virgl"
+_vulkan_drivers="radeon"
+
+builddir="$srcdir/mesa-$pkgver"
+
+_arch_opts=
+
+case "$CARCH" in
+x86*)
+ _dri_drivers="${_dri_drivers},i915,i965"
+ _gallium_drivers="${_gallium_drivers},svga"
+ _vulkan_drivers="${_vulkan_drivers},intel"
+ subpackages="$subpackages $pkgname-dri-intel:_dri $pkgname-dri-vmwgfx:_dri"
+ ;;
+arm*)
+ _gallium_drivers="${_gallium_drivers},vc4"
+ case "$CARCH" in
+ armhf) CFLAGS="$CFLAGS -mfpu=neon";;
+ esac
+ ;;
+esac
+
+prepare() {
+ cd "$builddir"
+ default_prepare
+ libtoolize --force \
+ && aclocal \
+ && automake --add-missing \
+ && autoreconf
+}
+
+build() {
+ cd "$builddir"
+
+ export CFLAGS="$CFLAGS -D_XOPEN_SOURCE=700"
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --with-dri-driverdir=$_dri_driverdir \
+ --disable-asm \
+ --disable-xvmc \
+ --enable-glx-rts \
+ --with-gallium-drivers=${_gallium_drivers} \
+ --with-dri-drivers=${_dri_drivers} \
+ --with-vulkan-drivers=${_vulkan_drivers} \
+ --with-llvm-prefix=/usr/lib/llvm$_llvmver \
+ --enable-llvm-shared-libs \
+ --enable-llvm \
+ --with-platforms=x11,drm,wayland \
+ --enable-shared-glapi \
+ --enable-gbm \
+ --disable-glx-tls \
+ --disable-nine \
+ --enable-dri \
+ --enable-dri3 \
+ --enable-glx \
+ --enable-osmesa \
+ --enable-gles1 \
+ --enable-gles2 \
+ --enable-egl \
+ --enable-texture-float \
+ --enable-xa \
+ --enable-vdpau \
+ $_arch_opts
+
+ make
+}
+
+check() {
+ cd "$builddir"
+ # Compiler test requires LLVM 3.8 and Python 2
+ for i in gtest util mapi; do
+ make -C "src/$i" check
+ done
+}
+
+package() {
+ cd "$builddir"
+ make -j1 DESTDIR="$pkgdir" install
+}
+
+egl() {
+ replaces="mesa"
+ pkgdesc="Mesa libEGL runtime libraries"
+ install -d "$subpkgdir"/usr/lib
+ mv "$pkgdir"/usr/lib/libEGL.so* \
+ "$subpkgdir"/usr/lib/
+}
+
+gl() {
+ replaces="mesa"
+ pkgdesc="Mesa libGL runtime libraries"
+ install -d "$subpkgdir"/usr/lib
+ mv "$pkgdir"/usr/lib/libGL.so* \
+ "$subpkgdir"/usr/lib/
+}
+
+glapi() {
+ replaces="$pkgname-gles"
+ pkgdesc="Mesa shared glapi"
+ install -d "$subpkgdir"/usr/lib
+ mv "$pkgdir"/usr/lib/libglapi.so.* \
+ "$subpkgdir"/usr/lib/
+}
+
+gles() {
+ replaces="mesa"
+ pkgdesc="Mesa libGLESv2 runtime libraries"
+ install -d "$subpkgdir"/usr/lib
+ mv "$pkgdir"/usr/lib/libGLES*.so* \
+ "$subpkgdir"/usr/lib/
+}
+
+xatracker() {
+ pkgdesc="Mesa XA state tracker for vmware"
+ install -d "$subpkgdir"/usr/lib
+ mv "$pkgdir"/usr/lib/libxatracker*.so.* \
+ "$subpkgdir"/usr/lib/
+}
+
+osmesa() {
+ pkgdesc="Mesa offscreen rendering libraries"
+ install -d "$subpkgdir"/usr/lib
+ mv "$pkgdir"/usr/lib/libOSMesa.so.* \
+ "$subpkgdir"/usr/lib/
+}
+
+gbm() {
+ pkgdesc="Mesa gbm library"
+ replaces="mesa"
+ install -d "$subpkgdir"/usr/lib
+ mv "$pkgdir"/usr/lib/libgbm.so.* \
+ "$subpkgdir"/usr/lib/
+}
+
+_mv_dri() {
+ install -d "$subpkgdir"/$_dri_driverdir
+
+ while [ $# -gt 0 ]; do
+ mv "$pkgdir"/$_dri_driverdir/${1}.so \
+ "$subpkgdir"/$_dri_driverdir/ || return 1
+ shift
+ done
+}
+
+_mv_vdpau() {
+ local i
+ install -d "$subpkgdir"/usr/lib/vdpau
+ for i in "$@"; do
+ mv "$pkgdir"/usr/lib/vdpau/libvdpau_$i.* \
+ "$subpkgdir"/usr/lib/vdpau/ || return 1
+ done
+}
+
+_mv_gpipe() {
+ return 0
+ # http://cgit.freedesktop.org/mesa/mesa/commit/?id=44ec468e8033553c26a112cebba41c343db00eb1
+ # https://code.google.com/p/chromium/issues/detail?id=412089
+# local i
+# install -d "$subpkgdir"/usr/lib/gallium-pipe
+# for i in "$@"; do
+# mv "$pkgdir"/usr/lib/gallium-pipe/pipe_$i.* \
+# "$subpkgdir"/usr/lib/gallium-pipe/ || return 1
+# done
+}
+
+_dri() {
+ local n=${subpkgname##*-dri-}
+ pkgdesc="Mesa DRI driver for $n"
+ case $n in
+ ati)
+ _mv_dri radeon_dri r200_dri r300_dri r600_dri radeonsi_dri \
+ && _mv_vdpau r300 r600 radeonsi \
+ && _mv_gpipe r300 r600
+ ;;
+ intel)
+ _mv_dri i915_dri i965_dri
+ ;;
+ nouveau)
+ _mv_dri nouveau_dri nouveau_vieux_dri \
+ && _mv_vdpau nouveau \
+ && _mv_gpipe nouveau
+ ;;
+ freedreno)
+ _mv_dri msm_dri kgsl_dri
+ ;;
+ swrast)
+ _mv_dri swrast_dri kms_swrast_dri && _mv_gpipe swrast
+ ;;
+ vmwgfx)
+ _mv_dri vmwgfx_dri && _mv_gpipe vmwgfx
+ ;;
+ virtio)
+ _mv_dri virtio_gpu_dri
+ ;;
+ esac
+}
+
+_wayland() {
+ pkgdesc="Mesa libwayland-egl library"
+ mkdir -p "$subpkgdir"/usr/lib
+ mv "$pkgdir"/usr/lib/libwayland-egl.so.* "$subpkgdir"/usr/lib/ \
+ || return 1
+}
+
+sha512sums="a2bd0123bf2df0db03197001a9e001b25f2609f3c6bf1bae66f3bc50c51d2558b5b77e232e81c1658c3a4dec88eda32a8b5a85c1fedc937a7441476228ef8238 mesa-17.3.1.tar.xz
+c3d4804ebc24c7216e4c9d4995fb92e116be7f478024b44808ee134a4c93bb51d1f66fe5fb6eca254f124c4abf6f81272b027824b3e2650a9607818bf793035a glx_ro_text_segm.patch
+edb9c221b093117f48fa298ae557f1d6ed9bbf32d7d262ad4ddb51d26ece94e3efac17670784606052b2ebe8d3dc2b221164f6b52f5282eb3318e6377932be04 musl-fixes.patch
+c7d91a660a033df91fac9c557039efc8669f0c26b2d35997d50753938b70d1af0bd110dcab3f8236eafab7d4be5dd7cd128a3e057e67e7e6a38a73fd6a7ef62e musl-fix-includes.patch
+f40ff04ac73c090c74d1955de6013c5aa41fb77f28b2b82d89cfc1880306a9ca1dde4581592db19f0a0ec6d85032f1ed5d953103ab0d075f9f0b7e459a028c45 disk_cache-stack-overflow.patch
+6800bc62aebfba22a2562c858c27391b47c5675020bd67f040da93ffe4d5d8ac828907a44c7cee6a4ebe63821b58c2515b4012f1f23473670b1de8670426a430 drmdeps.patch
+be91c579111e4ceadf094fcd55fff46ff12c360e2d89c98fac50fbd3bb2459dbd1209d562d27338b94b20bbeae5fca2dd881694bd0da55fca8cdfe253ae384f1 python3-compat.patch"
diff --git a/system/mesa/disk_cache-stack-overflow.patch b/system/mesa/disk_cache-stack-overflow.patch
new file mode 100644
index 000000000..3fad95259
--- /dev/null
+++ b/system/mesa/disk_cache-stack-overflow.patch
@@ -0,0 +1,42 @@
+The disk cache code tries to allocate a 256 Kbyte buffer on the stack.
+Since musl only gives 80 Kbyte of stack space per thread, this causes a trap.
+
+--- mesa-17.3.1/src/util/disk_cache.c.old 2017-12-21 11:31:22.000000000 -0600
++++ mesa-17.3.1/src/util/disk_cache.c 2017-12-29 01:17:15.625633901 -0600
+@@ -716,7 +716,7 @@
+ deflate_and_write_to_disk(const void *in_data, size_t in_data_size, int dest,
+ const char *filename)
+ {
+- unsigned char out[BUFSIZE];
++ unsigned char *out;
+
+ /* allocate deflate state */
+ z_stream strm;
+@@ -733,6 +733,11 @@
+ /* compress until end of in_data */
+ size_t compressed_size = 0;
+ int flush;
++
++ out = calloc(1, BUFSIZE);
++ if (out == NULL)
++ return 0;
++
+ do {
+ int remaining = in_data_size - BUFSIZE;
+ flush = remaining > 0 ? Z_NO_FLUSH : Z_FINISH;
+@@ -754,6 +759,7 @@
+ ssize_t written = write_all(dest, out, have);
+ if (written == -1) {
+ (void)deflateEnd(&strm);
++ free(out);
+ return 0;
+ }
+ } while (strm.avail_out == 0);
+@@ -768,6 +774,7 @@
+
+ /* clean up and return */
+ (void)deflateEnd(&strm);
++ free(out);
+ return compressed_size;
+ }
+
diff --git a/system/mesa/drmdeps.patch b/system/mesa/drmdeps.patch
new file mode 100644
index 000000000..edcb80643
--- /dev/null
+++ b/system/mesa/drmdeps.patch
@@ -0,0 +1,41 @@
+--- a/src/gallium/winsys/radeon/drm/Makefile.am 2017-08-10 11:45:20.737377457 -0400
++++ b/src/gallium/winsys/radeon/drm/Makefile.am 2017-08-10 11:50:23.414534307 -0400
+@@ -7,4 +7,6 @@
+
+ noinst_LTLIBRARIES = libradeonwinsys.la
+
++libradeonwinsys_la_LIBADD = -ldrm_radeon
++
+ libradeonwinsys_la_SOURCES = $(C_SOURCES)
+--- a/src/gallium/winsys/radeon/drm/Makefile.in 2017-08-10 11:45:25.577298181 -0400
++++ b/src/gallium/winsys/radeon/drm/Makefile.in 2017-08-10 11:57:11.151189074 -0400
+@@ -119,7 +119,7 @@
+ CONFIG_CLEAN_FILES =
+ CONFIG_CLEAN_VPATH_FILES =
+ LTLIBRARIES = $(noinst_LTLIBRARIES)
+-libradeonwinsys_la_LIBADD =
++libradeonwinsys_la_LIBADD = -ldrm_radeon
+ am__objects_1 = radeon_drm_bo.lo radeon_drm_cs.lo \
+ radeon_drm_surface.lo radeon_drm_winsys.lo
+ am_libradeonwinsys_la_OBJECTS = $(am__objects_1)
+--- a/src/gallium/winsys/amdgpu/drm/Makefile.am 2017-12-21 11:31:21.000000000 -0600
++++ b/src/gallium/winsys/amdgpu/drm/Makefile.am 2017-12-28 19:24:48.613693400 -0600
+@@ -11,6 +11,6 @@
+ noinst_LTLIBRARIES = libamdgpuwinsys.la
+
+ libamdgpuwinsys_la_LIBADD = \
+- $(top_builddir)/src/amd/addrlib/libamdgpu_addrlib.la
++ $(top_builddir)/src/amd/addrlib/libamdgpu_addrlib.la -ldrm_amdgpu
+
+ libamdgpuwinsys_la_SOURCES = $(C_SOURCES)
+--- a/src/gallium/winsys/amdgpu/drm/Makefile.in 2017-12-21 11:31:30.000000000 -0600
++++ b/src/gallium/winsys/amdgpu/drm/Makefile.in 2017-12-28 19:25:22.553597353 -0600
+@@ -572,7 +572,7 @@
+ AM_CXXFLAGS = $(AM_CFLAGS)
+ noinst_LTLIBRARIES = libamdgpuwinsys.la
+ libamdgpuwinsys_la_LIBADD = \
+- $(top_builddir)/src/amd/addrlib/libamdgpu_addrlib.la
++ $(top_builddir)/src/amd/addrlib/libamdgpu_addrlib.la -ldrm_amdgpu
+
+ libamdgpuwinsys_la_SOURCES = $(C_SOURCES)
+ all: all-am
diff --git a/system/mesa/glx_ro_text_segm.patch b/system/mesa/glx_ro_text_segm.patch
new file mode 100644
index 000000000..8cad4876b
--- /dev/null
+++ b/system/mesa/glx_ro_text_segm.patch
@@ -0,0 +1,28 @@
+2011-02-09 Jeremy Huddleston <jeremyhu@freedesktop.org
+
+ #240956
+ * configure.ac add support to enable readonly test segment on x86
+
+--- ./configure.ac.orig 2008-11-17 23:19:38.000000000 +0100
++++ ./configure.ac 2008-11-17 23:20:17.000000000 +0100
+@@ -499,6 +499,20 @@
+ enable_xcb=no
+ fi
+
++
++dnl readonly text segment on x86 hardened platforms
++AC_ARG_ENABLE([glx_rts],
++ [AS_HELP_STRING([--enable-glx-rts],
++ [on x86, use a readonly text segment for libGL @<:@default=disabled@:>@])],
++ [enable_glx_rts="$enableval"],
++ [enable_glx_rts=no])
++if test "x$enable_glx_rts" = xyes; then
++ DEFINES="$DEFINES -DGLX_X86_READONLY_TEXT"
++else
++ enable_glx_rts=no
++fi
++
++
+ dnl
+ dnl libGL configuration per driver
+ dnl
diff --git a/system/mesa/musl-fix-includes.patch b/system/mesa/musl-fix-includes.patch
new file mode 100644
index 000000000..2f6cc1d13
--- /dev/null
+++ b/system/mesa/musl-fix-includes.patch
@@ -0,0 +1,14 @@
+diff --git a/src/util/rand_xor.c b/src/util/rand_xor.c
+index de05fa6..016703c 100644
+--- a/src/util/rand_xor.c
++++ b/src/util/rand_xor.c
+@@ -24,6 +24,9 @@
+
+ #if defined(__linux__)
+ #include <sys/file.h>
++#include <sys/types.h>
++#include <sys/stat.h>
++#include <fcntl.h>
+ #include <unistd.h>
+ #else
+ #include <time.h>
diff --git a/system/mesa/musl-fixes.patch b/system/mesa/musl-fixes.patch
new file mode 100644
index 000000000..60140d445
--- /dev/null
+++ b/system/mesa/musl-fixes.patch
@@ -0,0 +1,22 @@
+--- ./src/gallium/winsys/svga/drm/vmw_screen.h.orig
++++ ./src/gallium/winsys/svga/drm/vmw_screen.h
+@@ -34,7 +34,7 @@
+ #ifndef VMW_SCREEN_H_
+ #define VMW_SCREEN_H_
+
+-
++#include <sys/stat.h>
+ #include "pipe/p_compiler.h"
+ #include "pipe/p_state.h"
+
+--- a/src/util/u_endian.h.orig 2016-11-04 12:16:00.480356454 +0100
++++ b/src/util/u_endian.h 2016-11-04 12:16:11.984347944 +0100
+@@ -27,7 +27,7 @@
+ #ifndef U_ENDIAN_H
+ #define U_ENDIAN_H
+
+-#if defined(__GLIBC__) || defined(ANDROID) || defined(__CYGWIN__)
++#if defined(__linux__) || defined(ANDROID) || defined(__CYGWIN__)
+ #include <endian.h>
+
+ #if __BYTE_ORDER == __LITTLE_ENDIAN
diff --git a/system/mesa/python3-compat.patch b/system/mesa/python3-compat.patch
new file mode 100644
index 000000000..8532f8c0c
--- /dev/null
+++ b/system/mesa/python3-compat.patch
@@ -0,0 +1,106 @@
+--- mesa-17.3.1/src/gallium/drivers/r600/egd_tables.py (original)
++++ mesa-17.3.1/src/gallium/drivers/r600/egd_tables.py (refactored)
+@@ -60,7 +60,7 @@
+ """
+ fragments = [
+ '"%s\\0" /* %s */' % (
+- te[0].encode('string_escape'),
++ te[0].encode('unicode-escape'),
+ ', '.join(str(idx) for idx in te[2])
+ )
+ for te in self.table
+@@ -217,10 +217,10 @@
+ strings = StringTable()
+ strings_offsets = IntTable("int")
+
+- print '/* This file is autogenerated by egd_tables.py from evergreend.h. Do not edit directly. */'
+- print
+- print CopyRight.strip()
+- print '''
++ print('/* This file is autogenerated by egd_tables.py from evergreend.h. Do not edit directly. */')
++ print()
++ print(CopyRight.strip())
++ print('''
+ #ifndef EG_TABLES_H
+ #define EG_TABLES_H
+
+@@ -242,20 +242,20 @@
+ unsigned name_offset;
+ unsigned op;
+ };
+-'''
+-
+- print 'static const struct eg_packet3 packet3_table[] = {'
++''')
++
++ print('static const struct eg_packet3 packet3_table[] = {')
+ for pkt in packets:
+- print '\t{%s, %s},' % (strings.add(pkt[5:]), pkt)
+- print '};'
+- print
+-
+- print 'static const struct eg_field egd_fields_table[] = {'
++ print('\t{%s, %s},' % (strings.add(pkt[5:]), pkt))
++ print('};')
++ print()
++
++ print('static const struct eg_field egd_fields_table[] = {')
+
+ fields_idx = 0
+ for reg in regs:
+ if len(reg.fields) and reg.own_fields:
+- print '\t/* %s */' % (fields_idx)
++ print('\t/* %s */' % (fields_idx))
+
+ reg.fields_idx = fields_idx
+
+@@ -266,34 +266,34 @@
+ while value[1] >= len(values_offsets):
+ values_offsets.append(-1)
+ values_offsets[value[1]] = strings.add(strip_prefix(value[0]))
+- print '\t{%s, %s(~0u), %s, %s},' % (
++ print('\t{%s, %s(~0u), %s, %s},' % (
+ strings.add(field.name), field.s_name,
+- len(values_offsets), strings_offsets.add(values_offsets))
++ len(values_offsets), strings_offsets.add(values_offsets)))
+ else:
+- print '\t{%s, %s(~0u)},' % (strings.add(field.name), field.s_name)
++ print('\t{%s, %s(~0u)},' % (strings.add(field.name), field.s_name))
+ fields_idx += 1
+
+- print '};'
+- print
+-
+- print 'static const struct eg_reg egd_reg_table[] = {'
++ print('};')
++ print()
++
++ print('static const struct eg_reg egd_reg_table[] = {')
+ for reg in regs:
+ if len(reg.fields):
+- print '\t{%s, %s, %s, %s},' % (strings.add(reg.name), reg.r_name,
+- len(reg.fields), reg.fields_idx if reg.own_fields else reg.fields_owner.fields_idx)
++ print('\t{%s, %s, %s, %s},' % (strings.add(reg.name), reg.r_name,
++ len(reg.fields), reg.fields_idx if reg.own_fields else reg.fields_owner.fields_idx))
+ else:
+- print '\t{%s, %s},' % (strings.add(reg.name), reg.r_name)
+- print '};'
+- print
++ print('\t{%s, %s},' % (strings.add(reg.name), reg.r_name))
++ print('};')
++ print()
+
+ strings.emit(sys.stdout, "egd_strings")
+
+- print
++ print()
+
+ strings_offsets.emit(sys.stdout, "egd_strings_offsets")
+
+- print
+- print '#endif'
++ print()
++ print('#endif')
+
+
+ def main():