summaryrefslogtreecommitdiff
path: root/extra/mesa/PKGBUILD
blob: 1a597eca5065e9eaafee887bae090e15bfc8bd4c (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
# disable openswf as it requires AVX, makes no sense with old CPUs
# disable every new software rasterizer and take the old ones
# see also FS32#39
eval "$(
  declare -f build | \
    sed '
      /arch-meson/s/\(gallium-drivers=.*\),swrast,swr/\1,swrast/
      /arch-meson/s/\(-D swr-arches=\)avx,avx2/\1/
    '
  declare -f package_mesa | \
    sed '
      s@_install fakeinstall/usr/lib/libswrAVX.*@#\0@g
    '
)"

# do not build/package vulkan on i486
# do not build i915,i965 on i486
if [ "$CARCH" = 'i486' ]; then
  eval "$(
    declare -f build | \
      sed '
        s/\(-D gallium-drivers=\)\S\+ /\1 /
        s/-D gallium-omx=bellagio //
        s/-D gallium-opencl=\S\+ //
        s/-D osmesa=true /-D osmesa=false /
        s/\(-D gallium-\S\+=\)enabled /\1disabled /g
        s/\(-D gallium-nine=\)true /\1false /g
        s/\(-D vulkan-drivers=\)\S\+ /\1 /
        s/\(-D dri-drivers=\(\S\+,\)\?\)i915,/\1/
        s/\(-D dri-drivers=\(\S\+,\)\?\)i965,/\1/
      '
    declare -f package_mesa | \
      sed '
        \,rm .*/vulkan;,d
        \,bellagio,d
        \,fakeinstall/usr/lib/d3d,d
        \,fakeinstall/usr/lib/libOSMesa\.so\*,d
        \,fakeinstall/usr/lib/libxatracker\.so\*,d
      '
  )"
else
  eval "$(
    declare -f package_vulkan-intel package_vulkan-radeon package_opencl-mesa package_libva-mesa-driver package_mesa-vdpau | \
      sed '
        /^\s*{\s*$/ a arch=('"$(
          printf '%s\n' "${arch[@]}" | \
            grep -vxF 'i486' | \
            tr '\n' ' '
        )"')
      '
  )"
fi

# break cycle with conflicting installation files between mesa and libglvnd
# (indirect dependency via libva)
# i486-specific
if [ "$CARCH" = 'i486' ]; then
  eval "$(
    declare -f package_mesa | \
      sed '
        $ i rm -rf $pkgdir/usr/include/EGL/egl.h \
            rm -rf $pkgdir/usr/include/EGL/eglext.h \
            rm -rf $pkgdir/usr/include/EGL/eglplatform.h \
            rm -rf $pkgdir/usr/include/GL/gl.h \
            rm -rf $pkgdir/usr/include/GL/glcorearb.h \
            rm -rf $pkgdir/usr/include/GL/glext.h  \
            rm -rf $pkgdir/usr/include/GL/glx.h  \
            rm -rf $pkgdir/usr/include/GL/glxext.h  \
            rm -rf $pkgdir/usr/include/GLES2/gl2.h  \
            rm -rf $pkgdir/usr/include/GLES2/gl2ext.h  \
            rm -rf $pkgdir/usr/include/GLES2/gl2platform.h  \
            rm -rf $pkgdir/usr/include/GLES3/gl3.h  \
            rm -rf $pkgdir/usr/include/GLES3/gl31.h  \
            rm -rf $pkgdir/usr/include/GLES3/gl32.h  \
            rm -rf $pkgdir/usr/include/GLES3/gl3ext.h  \
            rm -rf $pkgdir/usr/include/GLES3/gl3platform.h  \
            rm -rf $pkgdir/usr/include/KHR/khrplatform.h  \
            rm -rf $pkgdir/usr/lib/pkgconfig/egl.pc  \
            rm -rf $pkgdir/usr/lib/pkgconfig/gl.pc  \
            rm -rf $pkgdir/usr/lib/pkgconfig/glesv2.pc
      '
    declare -f package_vulkan-mesa-layers | \
      sed '
        3 i if false; then
        $ i fi      
      '
    declare -f package_vulkan-swrast | \
      sed '
        3 i if false; then
        $ i fi      
      '
    declare -f package_vulkan-intel | \
      sed '
        3 i if false; then
        $ i fi      
      '
    declare -f package_vulkan-radeon | \
      sed '
        3 i if false; then
        $ i fi      
      '
    declare -f package_opencl-mesa | \
      sed '
        3 i if false; then
        $ i fi      
      '
    declare -f package_libva-mesa-driver | \
      sed '
        3 i if false; then
        $ i fi      
      '
    declare -f package_libva-mesa-vdpau | \
      sed '
        3 i if false; then
        $ i fi      
      '
    declare -f package_mesa-vdpau | \
      sed '
        3 i if false; then
        $ i fi      
      '
  )
  "
fi

# add libdrm and libxshmfence explocitily for now, as deep down in th
# dependency tree as reasonable instead of patching all packages failing above
if [ "$CARCH" = 'i486' ]; then
  depends+=(libdrm)
  depends+=(libxshmfence)
  depends+=(wayland)
fi

# defaults changed to SSE2 enabled by default, disable it
if [ "$CARCH" = 'i686' -o "$CARCH" = 'i486' ]; then
  eval "$(
  declare -f build | \
  sed '
    s/arch-meson /arch-meson -Dsse2=false /
  '
  )"
fi

# LTO on i486 results in out-of-memory
if [ "$CARCH" == 'i486' ]; then
  eval "$(
    declare -f build | \
      sed '
        s/-D b_lto=true/-D b_lto=false/
      '
  )"
fi