summaryrefslogtreecommitdiff
path: root/libre/mesa/PKGBUILD
blob: ead5a47b56953ca87024c36c79e9256831f41148 (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
191
192
# 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.4
pkgrel=1.parabola1
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.pc.patch
        0002-meson-Add-library-versions-to-swr-drivers.patch
        0003-meson-Version-libMesaOpenCL-like-autotools-does.patch
        0004-loader_dri3-Variant-2-Wait-for-pending-swaps-to-comp.patch
        drirc)
source_armv7h=("atomic.patch::https://cgit.freedesktop.org/mesa/mesa/patch/?id=498faea103aa7966b435f21d8ff5e36172389b1e")
sha512sums=('f9a14be46c209661ceb318add1611481445d13b47e95c7a5d2a5e5ecfdd5d2c3fa9c2b16b30035bbb8d61ccc7cb65bfa6698ac8b040273e5ab045a951a67752c'
            'SKIP'
            'f9f0d0ccf166fe6cb684478b6f1e1ab1f2850431c06aa041738563eb1808a004e52cdec823c103c9e180f03ffc083e95974d291353f0220fe52ae6d4897fecc7'
            '2f40198eff47664c831c56e8a63f60a4d1b815cf697e6bdb0be39e6d9c5df043857f6264b7cd2ccf46c07626186c565144e80f4214b5f7936ef7024c47201437'
            'c3f3baf8a5f480ce64b321c031e31c0d5819732ca34647ac545d0fd7fafa40ad4dcf1e1ec8d574754e0a44bf0cdc462ed8709c8d9b58a17e01c6ba5b4c5e91c6'
            'a2062f8a5259aabed1aa20df6a8510f0f3e914cb6bba72751249b3295285596bb7615063a7a7b7870f9f4489d0e6b774f0bced2bdde49a1aa9df6a44976462d1'
            '572901a1e9cacfacfc8c4cc3cd077a626d4aeda8c8a58f6085bae827cba8a2d4d99af1dafbb5a9296b6ebf3120e2b05a084fe1c96093074befe62597319384a1'
            '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>"
              'A5CC9FEC93F2F837CB044912336909B6B25FADFA') # Juan A. Suarez Romero <jasuarez@igalia.com>

prepare() {
  cd mesa-${pkgver}

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

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

  # experimental patch, should fix FS#58549
  # variant 2 patch should fix FS#58605
  # see https://bugs.freedesktop.org/show_bug.cgi?id=106351
  # and https://patchwork.freedesktop.org/series/42687/
  patch -Np1 -i ../0004-loader_dri3-Variant-2-Wait-for-pending-swaps-to-comp.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=disabled
      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
}