summaryrefslogtreecommitdiff
path: root/libre/mesa/PKGBUILD
blob: bb3c55c98735c8052a0890ed1dce24ce8e8799c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# Maintainer (Arch): Jan de Groot <jgc@archlinux.org>
# Maintainer (Arch): Andreas Radke <andyrtr@archlinux.org>
# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>

pkgbase=mesa
pkgname=("${pkgbase}")
pkgdesc="A free implementation of the OpenGL specification, without nonfree software recommendations in drirc"
pkgver=18.0.3
pkgrel=3.parabola2
arch=('i686' 'x86_64' 'armv7h')
makedepends=('python2-mako' 'libxml2' 'libx11' 'glproto' 'libdrm' 'dri2proto' 'dri3proto' 'presentproto'
             'libxshmfence' 'libxxf86vm' 'libxdamage' 'libvdpau' 'libva' 'wayland' 'wayland-protocols'
             'elfutils' 'llvm' 'libomxil-bellagio' 'clang' 'libglvnd' 'lm_sensors'
             'meson')
makedepends_x86_64=('libclc' 'libunwind')
makedepends_i686=("${makedepends_x86_64[@]}")
url="https://www.mesa3d.org/"
license=('custom')
source=(https://mesa.freedesktop.org/archive/mesa-${pkgver}.tar.xz{,.sig}
        LICENSE
        0001-glvnd-fix-gl-dot-pc.patch
        0002-loader_dri3-Wait-for-pending-swaps-to-complete-before-drawable_fini.patch
        0004-meson-Add-library-versions-to-swr-drivers.patch
        0005-meson-Version-libMesaOpenCL-like-autotools-does.patch
        drirc)
source_armv7h=("atomic.patch::https://cgit.freedesktop.org/mesa/mesa/patch/?id=498faea103aa7966b435f21d8ff5e36172389b1e")
sha512sums=('decd050bab049d17bcde3f832d4da0ffdb80f147c99377a162739bbe72fd6fd32b51e56e6fc66895b8c30fc19a1815bae164b21aa557816c3998ad18c1ffca2d'
            'SKIP'
            'f9f0d0ccf166fe6cb684478b6f1e1ab1f2850431c06aa041738563eb1808a004e52cdec823c103c9e180f03ffc083e95974d291353f0220fe52ae6d4897fecc7'
            '75849eca72ca9d01c648d5ea4f6371f1b8737ca35b14be179e14c73cc51dca0739c333343cdc228a6d464135f4791bcdc21734e2debecd29d57023c8c088b028'
            '19b980db37675732d28978318074ca172ef862de7fdcae2c82ef16dc411c709c8598b044a828e7e260d86d23f644485abcc6a0aaf5e04b9c05dce22d0c7e3716'
            '0f5da6e48885713c7ddef9e5715e178e0a499bcb622d7f19e15b9e4b4647331d7bf14829218b6ab80f17bae90fd95b8df6a0a81203d8081686805ca5329531ff'
            'd3c01f61a0a0cc2f01e66e0126ad8b6386d4a53c1dc1b3b134800e4cd25507e458bac860cbed10cf4b46b04e8d50aba233870587b89c058fffd57436b48289bf'
            '7d949d1f45e68b8ec71ca0192569eeb6fc98b540e9696fea437894db02d98a78724ae4021f244137dd2ed2c8c167e96016f20306b4cf83c2defc8acd10170a1e')
sha512sums_armv7h=('75cd21bccc84a6b6b0de39c6d209c8bee0e5143b486433184ca078e8bc6797d30746be3ce5f7a89eea9bc3c7e2d68880412511fd6b9946252c7c7638523c6caa')
validpgpkeys=('8703B6700E7EE06D7A39B8D6EDAE37B02CEB490D'  # Emil Velikov <emil.l.velikov@gmail.com>
              '946D09B5E4C9845E63075FF1D961C596A7203456'  # Andres Gomez <tanty@igalia.com>
              'E3E8F480C52ADD73B278EE78E1ECBE07D7D70895') # Juan Antonio Suárez Romero (Igalia, S.L.) <jasuarez@igalia.com>"

prepare() {
  cd mesa-${pkgver}

  # glvnd support patches - from Fedora
  # non-upstreamed ones
  patch -Np1 -i ../0001-glvnd-fix-gl-dot-pc.patch

  # experimental patch, should fix FS#58549
  # see https://bugs.freedesktop.org/show_bug.cgi?id=106351
  # and https://patchwork.freedesktop.org/series/42687/
  patch -Np1 -i ../0002-loader_dri3-Wait-for-pending-swaps-to-complete-before-drawable_fini.patch

  # Upstreamed meson fixes
  patch -Np1 -i ../0004-meson-Add-library-versions-to-swr-drivers.patch
  patch -Np1 -i ../0005-meson-Version-libMesaOpenCL-like-autotools-does.patch
}

build() {
  case "$CARCH" in
    x86_64|i686)
      DRI=i915,i965,r100,r200,nouveau
      GALLIUM=r300,r600,radeonsi,nouveau,virgl,svga,swrast,swr
      VULKAN=amd,intel
      SWR_ARCHES=avx,avx2
      OPENCL=icd
      GALLIUM_XA=true
      LIBUNWIND=true
      ;;
    armv7h)
      DRI=nouveau
      GALLIUM=freedreno,nouveau,swrast,virgl,etnaviv,imx,vc4
      VULKAN=
      SWR_ARCHES=
      OPENCL=
      GALLIUM_XA=false
      LIBUNWIND=false
      ;;
  esac

  arch-meson mesa-$pkgver build \
    -D b_lto=false \
    -D b_ndebug=true \
    -D platforms=x11,wayland,drm,surfaceless \
    -D dri-drivers=${DRI} \
    -D gallium-drivers=${GALLIUM} \
    -D vulkan-drivers=${VULKAN} \
    -D swr-arches=${SWR_ARCHES} \
    -D dri3=true \
    -D egl=true \
    -D gallium-extra-hud=true \
    -D gallium-nine=true \
    -D gallium-omx=true \
    -D gallium-opencl=${OPENCL} \
    -D gallium-va=true \
    -D gallium-vdpau=true \
    -D gallium-xa=${GALLIUM_XA} \
    -D gallium-xvmc=false \
    -D gbm=true \
    -D gles1=true \
    -D gles2=true \
    -D glvnd=true \
    -D glx=dri \
    -D libunwind=${LIBUNWIND} \
    -D llvm=true \
    -D lmsensors=true \
    -D osmesa=gallium \
    -D shared-glapi=true \
    -D texture-float=true \
    -D valgrind=false

  # Print config
  meson configure build

  ninja -C build

  # fake installation to be seperated into packages
  # outside of fakeroot but mesa doesn't need to chown/mod
  DESTDIR=${srcdir}/fakeinstall ninja -C build install
}

_install() {
  local src f dir
  for src; do
    f="${src#fakeinstall/}"
    dir="${pkgdir}/${f%/*}"
    install -m755 -d "${dir}"
    mv -v "${src}" "${dir}/"
  done
}

package_mesa() {
  depends=('libdrm' 'wayland' 'libxxf86vm' 'libxdamage' 'libxshmfence' 'libelf'
           'libomxil-bellagio' 'llvm-libs' 'lm_sensors' 'libglvnd')
  depends_x86_64=('libunwind')
  depends_i686=("${depends_x86_64[@]}")
  optdepends=('opengl-man-pages: for the OpenGL API man pages'
              'mesa-vdpau: for accelerated video playback'
              'libva-mesa-driver: for accelerated video playback')
  provides=('ati-dri' 'intel-dri' 'nouveau-dri' 'svga-dri' 'mesa-dri' 'mesa-libgl' 'opengl-driver')
  conflicts=('ati-dri' 'intel-dri' 'nouveau-dri' 'svga-dri' 'mesa-dri' 'mesa-libgl')
  replaces=('ati-dri' 'intel-dri' 'nouveau-dri' 'svga-dri' 'mesa-dri' 'mesa-libgl')
  backup=('etc/drirc')

  install -m755 -d ${pkgdir}/etc
  cp -v ${srcdir}/drirc ${pkgdir}/etc

  _install fakeinstall/usr/share/glvnd/egl_vendor.d/50_mesa.json

  # ati-dri, nouveau-dri, intel-dri, svga-dri, swrast
  _install fakeinstall/usr/lib/dri/*_dri.so

  _install fakeinstall/usr/lib/bellagio
  _install fakeinstall/usr/lib/d3d
  _install fakeinstall/usr/lib/lib{gbm,glapi}.so*
  _install fakeinstall/usr/lib/libOSMesa.so*
  if [ "$CARCH" = "i686" ]; then
    _install fakeinstall/usr/lib/libwayland*.so*
  fi

  if [ "$CARCH" != "armv7h" ]; then
    _install fakeinstall/usr/lib/libxatracker.so*
    _install fakeinstall/usr/lib/libswrAVX*.so*
  fi

  # in libglvnd
  rm -v fakeinstall/usr/lib/libGLESv{1_CM,2}.so*

  # in vulkan-headers
  rm -rv fakeinstall/usr/include/vulkan

  if [ "$CARCH" != "i686" ]; then
    # in wayland
    rm -v fakeinstall/usr/lib/libwayland-egl.so*
    rm -v fakeinstall/usr/lib/pkgconfig/wayland-egl.pc
  fi

  _install fakeinstall/usr/include
  _install fakeinstall/usr/lib/pkgconfig

  # libglvnd support
  _install fakeinstall/usr/lib/libGLX_mesa.so*
  _install fakeinstall/usr/lib/libEGL_mesa.so*

  # indirect rendering
  ln -s /usr/lib/libGLX_mesa.so.0 "${pkgdir}/usr/lib/libGLX_indirect.so.0"

  # make sure there are no files left to install
  #find fakeinstall -depth -print0 | xargs -0 rmdir

  install -m644 -Dt "${pkgdir}/usr/share/licenses/${pkgname}" LICENSE
}