Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/extra/mesa/PKGBUILD
blob: a55eb8f50964a105164608705193e6e0c90f7cdb (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
# 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-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

# libclc needs spirv-llvm-translator which throws heavily errors on 32-bit
#  LLVM_SPIRV :: DebugInfo/X86/dbg-declare-alloca.ll
#  LLVM_SPIRV :: DebugInfo/X86/dbg-declare-arg.ll
#  LLVM_SPIRV :: DebugInfo/X86/dbg-value-const-byref.ll
#  LLVM_SPIRV :: DebugInfo/X86/dw_op_minus_direct.ll
#  LLVM_SPIRV :: DebugInfo/X86/dwarf-aranges-no-dwarf-labels.ll
#  LLVM_SPIRV :: DebugInfo/X86/frame-register.ll
#  LLVM_SPIRV :: DebugInfo/X86/this-stack_value.ll
#  LLVM_SPIRV :: spirv-extensions-control.ll
#  LLVM_SPIRV :: transcoding/SPV_KHR_integer_dot_product-sat.ll
# usually with segfaults in the middle of LLVM itself
# this might be hopeless to get working
makedepends=(${makedepends[@]//libclc/})
eval "$(
  declare -f build | \
    sed '
      s/-D gallium-opencl=icd/-D gallium-opencl=disabled/
    '
  declare -f package_opencl-mesa | \
    sed '
      3 i if false; then
      $ i fi
    '
)"