2 # debian/rules for the Debian mesa package
3 # Copyright © 2006 Thierry Reding <thierry@gilfi.de>
5 # Uncomment this to turn on verbose mode.
8 include /usr
/share
/dpkg
/pkg-info.mk
10 DEB_HOST_MULTIARCH ?
= $(shell dpkg-architecture
-qDEB_HOST_MULTIARCH
)
11 DEB_HOST_ARCH ?
= $(shell dpkg-architecture
-qDEB_HOST_ARCH
)
12 DEB_HOST_ARCH_OS ?
= $(shell dpkg-architecture
-qDEB_HOST_ARCH_OS
)
13 DEB_HOST_ARCH_CPU ?
= $(shell dpkg-architecture
-qDEB_HOST_ARCH_CPU
)
15 # for finding the correct llvm-config when meson doesn't know about it yet
16 export PATH
:=/usr
/lib
/llvm-15
/bin
/:$(PATH
)
18 export DEB_BUILD_MAINT_OPTIONS
=optimize
=-lto
20 ifeq (,$(filter $(DEB_HOST_ARCH
), armhf ppc64el sh3 sh4
))
22 $(shell DEB_CFLAGS_MAINT_APPEND
=-Wall DEB_CXXFLAGS_MAINT_APPEND
=-Wall dpkg-buildflags
--export=configure
)
24 ifneq (,$(filter $(DEB_HOST_ARCH
), armhf
))
25 # Workaround for a variant of LP: #725126
27 $(shell DEB_CFLAGS_MAINT_APPEND
="-Wall -fno-optimize-sibling-calls" DEB_CXXFLAGS_MAINT_APPEND
="-Wall -fno-optimize-sibling-calls" dpkg-buildflags
--export=configure
)
29 ifneq (,$(filter $(DEB_HOST_ARCH
), ppc64el
))
30 # Workaround for https://gitlab.freedesktop.org/mesa/mesa/-/issues/5315
32 $(shell DEB_CFLAGS_MAINT_APPEND
="-Wall -O2" DEB_CXXFLAGS_MAINT_APPEND
="-Wall -O2" dpkg-buildflags
--export=configure
)
34 # Workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83143
36 $(shell DEB_CFLAGS_MAINT_APPEND
="-Wall -O1" DEB_CXXFLAGS_MAINT_APPEND
="-Wall -O1" dpkg-buildflags
--export=configure
)
42 GALLIUM_DRIVERS
= swrast
43 VULKAN_DRIVERS
= swrast
46 confflags_DRI3
= -Ddri3
=disabled
47 confflags_OSMESA
= -Dosmesa
=true
48 confflags_SSE2
= -Dsse2
=true
50 # hurd doesn't do direct rendering
51 ifeq ($(DEB_HOST_ARCH_OS
), hurd
)
52 confflags_DIRECT_RENDERING
= -Dglx-direct
=false
53 confflags_GBM
= -Dgbm
=disabled
55 GALLIUM_DRIVERS
+= r300 r600 asahi kmsro
57 confflags_DIRECT_RENDERING
= -Dglx-direct
=true
58 confflags_GBM
= -Dgbm
=enabled
59 confflags_GALLIUM
+= -Dgallium-extra-hud
=true
60 confflags_GALLIUM
+= -Dgallium-vdpau
=enabled
61 confflags_GALLIUM
+= -Dlmsensors
=enabled
63 # radv/lavapipe needs LLVM and the Vulkan loader, so only build on the subset of
64 # arches where we have LLVM enabled and where the Vulkan loader is built.
65 ifneq (,$(filter $(DEB_HOST_ARCH
), amd64 arm64 armel armhf i386 mips64el mipsel powerpc ppc64 ppc64el s390x sparc64
))
66 VULKAN_DRIVERS
+= amd swrast
69 # Only enable amd on riscv64, swrast needs CPU JIT support which doesn't work properly yet
70 ifneq (,$(filter $(DEB_HOST_ARCH
), riscv64
))
72 confflags_GALLIUM
+= -Ddraw-use-llvm
=false
75 ifeq ($(DEB_HOST_ARCH_OS
), linux
)
76 confflags_DRI3
= -Ddri3
=enabled
77 # Gallium drivers which require kernel support, not yet ported to non-Linux
78 GALLIUM_DRIVERS
+= nouveau virgl
80 # Freedreno requires arm in addition
81 # ifneq (,$(filter arm arm64,$(DEB_HOST_ARCH_CPU)))
82 # GALLIUM_DRIVERS += freedreno
85 # etnaviv, tegra, vc4 and v3d kernel support are only available on armhf and arm64
86 ifneq (,$(filter $(DEB_HOST_ARCH
), armhf arm64
))
87 GALLIUM_DRIVERS
+= etnaviv panfrost svga tegra vc4 v3d
88 VULKAN_DRIVERS
+= broadcom
91 ifneq (,$(filter $(DEB_HOST_ARCH
), armhf arm64 riscv64
))
92 GALLIUM_DRIVERS
+= lima
95 ifneq (,$(filter $(DEB_HOST_ARCH
), amd64 i386 x32
))
96 GALLIUM_DRIVERS
+= svga
97 # svga needs xa state tracker
98 confflags_GALLIUM
+= -Dgallium-xa
=enabled
99 VULKAN_DRIVERS
+= intel
102 # Non-Linux ports lack epoll, so wayland isn't ready yet:
103 # https://gitlab.freedesktop.org/wayland/wayland/-/issues/72
104 # hurd also lacks *_CLOEXEC
105 EGL_PLATFORMS
+= ,wayland
107 ifneq (,$(filter $(DEB_HOST_ARCH
), amd64 arm64 armhf i386 mips64el mipsel powerpc ppc64 ppc64el s390x
))
108 confflags_VALGRIND
+= -Dvalgrind
=enabled
-Dandroid-libbacktrace
=disabled
111 # WSL supports only amd64 and arm64
112 ifneq (,$(filter amd64 arm64
,$(DEB_HOST_ARCH
)))
113 GALLIUM_DRIVERS
+= d3d12
117 # Build intel drivers on archs where libdrm-intel is installed
118 ifneq (,$(filter $(DEB_HOST_ARCH
),amd64 i386 kfreebsd-amd64 kfreebsd-i386 x32
))
119 GALLIUM_DRIVERS
+= iris crocus
122 # LLVM is required for building r300g, radeonsi and llvmpipe drivers.
123 # It's also required for building OpenCL support.
124 ifneq (,$(filter $(DEB_HOST_ARCH
), amd64 arm64 armel armhf i386 mips64el mipsel powerpc ppc64 ppc64el riscv64 s390x sparc64
))
125 GALLIUM_DRIVERS
+= radeonsi
126 confflags_GALLIUM
+= -Dllvm
=enabled
127 confflags_GALLIUM
+= -Dgallium-opencl
=disabled
128 confflags_GALLIUM
+= -Dgallium-rusticl
=false
130 # nine makes sense only on archs that build wine
131 ifneq (,$(filter $(DEB_HOST_ARCH
), amd64 arm64 armel armhf i386 powerpc
))
132 confflags_GALLIUM
+= -Dgallium-nine
=true
135 confflags_GALLIUM
+= -Dllvm
=disabled
138 # build vulkan layers where Vulkan loader is available
139 ifneq (,$(filter $(DEB_HOST_ARCH
), amd64 arm64 armel armhf i386 mips64el mipsel powerpc ppc64 ppc64el riscv64 s390x sparc64 x32
))
140 GALLIUM_DRIVERS
+= zink
141 VULKAN_LAYERS
+= device-select intel-nullhw overlay
144 ifeq (,$(filter pkg.mesa.nolibva
,$(DEB_BUILD_PROFILES
)))
145 confflags_GALLIUM
+= -Dgallium-va
=enabled
146 confflags_GALLIUM
+= -Dvideo-codecs
="vc1dec, h264dec, h264enc, h265dec, h265enc"
150 ifeq ($(DEB_HOST_ARCH
), i386
)
151 confflags_SSE2
= -Dsse2
=false
155 space
:= $(empty
) $(empty
)
157 GALLIUM_DRIVERS
:= $(patsubst %,'%',$(GALLIUM_DRIVERS
))
158 GALLIUM_DRIVERS_LIST
:= $(subst $(space
),$(comma
),$(GALLIUM_DRIVERS
))
159 VULKAN_DRIVERS
:= $(patsubst %,'%',$(VULKAN_DRIVERS
))
160 VULKAN_DRIVERS_LIST
:= $(subst $(space
),$(comma
),$(VULKAN_DRIVERS
))
161 VULKAN_LAYERS
:= $(patsubst %,'%',$(VULKAN_LAYERS
))
162 VULKAN_LAYERS_LIST
:= $(subst $(space
),$(comma
),$(VULKAN_LAYERS
))
164 confflags_EGL
= -Dplatforms
="$(EGL_PLATFORMS)"
165 confflags_GLES
= -Dgles1
=disabled
-Dgles2
=enabled
166 confflags_GALLIUM
+= -Dgallium-drivers
="[$(GALLIUM_DRIVERS_LIST)]"
169 -Ddri-drivers-path
=/usr
/lib
/$(DEB_HOST_MULTIARCH
)/dri \
170 -Ddri-search-path
='/usr/lib/$(DEB_HOST_MULTIARCH)/dri:\$$$${ORIGIN}/dri:/usr/lib/dri' \
171 -Dvulkan-drivers
="[$(VULKAN_DRIVERS_LIST)]" \
172 -Dvulkan-layers
="[$(VULKAN_LAYERS_LIST)]" \
174 -Dshared-glapi
=enabled \
175 -Dgallium-omx
=disabled \
178 -Dlibunwind
=disabled \
180 -Dgallium-va
=disabled \
181 -Dgallium-vdpau
=disabled \
182 -Dgallium-xa
=disabled \
184 -Dmicrosoft-clc
=disabled \
185 $(confflags_DIRECT_RENDERING
) \
189 $(confflags_GALLIUM
) \
191 $(confflags_OSMESA
) \
193 $(confflags_VALGRIND
)
198 rm -rf configure bin
/config.guess bin
/config.sub config.h.in
199 rm -rf
$$(find
-name Makefile.in
)
200 rm -rf bin
/install-sh bin
/ltmain.sh
201 for file in debian
/*.in
; do
rm -f
$${file
%%.in
}; done
202 find
-name
'*.pyc' -delete
203 find
-name
'__pycache__' -delete
206 override_dh_auto_configure
:
207 $(buildflags
) dh_auto_configure
-- \
210 override_dh_auto_install
:
212 for file in debian
/*.in
; \
214 sed
-e
"s,\$${DEB_HOST_MULTIARCH},$(DEB_HOST_MULTIARCH),g" \
215 $${file} > $${file
%%.in
}; \
218 # some tests are expected to fail for now, drop this when upstream has
219 # better cross-build testing in place and expected failures fixed
220 override_dh_auto_test
:
223 allpkg
= $(shell dh_listpackages
-a
)
225 override_dh_installchangelogs
:
226 dh_installchangelogs
-a
227 dh_installchangelogs
-pmesa-common-dev
231 find debian
/tmp
/ -name
'*.la' -exec
rm '{}' ';'
233 # Get rid of some files which aren't installed. Do not
234 # use -f to ensure we notice disappearing files:
235 rm debian
/tmp
/usr
/lib
/*/libglapi.so
236 rm debian
/tmp
/usr
/lib
/*/libEGL_mesa.so
237 rm debian
/tmp
/usr
/lib
/*/libGLX_mesa.so
239 # Copy the hardlinked *_dri.so correctly.
240 install -m755
-d debian
/libgl1-mesa-dri
/usr
/lib
/${DEB_HOST_MULTIARCH}/dri
/
241 mv debian
/tmp
/usr
/lib
/${DEB_HOST_MULTIARCH}/dri
/*_dri.so \
242 debian
/libgl1-mesa-dri
/usr
/lib
/${DEB_HOST_MULTIARCH}/dri
/
244 ifneq ($(DEB_HOST_ARCH_OS
), hurd
)
245 # Copy the hardlinked vdpau drivers correctly.
246 install -m755
-d debian
/mesa-vdpau-drivers
/usr
/lib
/${DEB_HOST_MULTIARCH}/vdpau
/
247 mv debian
/tmp
/usr
/lib
/${DEB_HOST_MULTIARCH}/vdpau
/libvdpau
*.so
* \
248 debian
/mesa-vdpau-drivers
/usr
/lib
/${DEB_HOST_MULTIARCH}/vdpau
/
250 ifeq (,$(filter pkg.mesa.nolibva
,$(DEB_BUILD_PROFILES
)))
251 # Copy the hardlinked va drivers correctly.
252 install -m755
-d debian
/mesa-va-drivers
/usr
/lib
/${DEB_HOST_MULTIARCH}/dri
/
253 mv debian
/tmp
/usr
/lib
/${DEB_HOST_MULTIARCH}/dri
/*_drv_video.so \
254 debian
/mesa-va-drivers
/usr
/lib
/${DEB_HOST_MULTIARCH}/dri
/
260 # Install bug control and script:
261 set
-e
; for p in
$(allpkg
); do \
262 install -d debian
/$$p/usr
/share
/bug
/$$p && \
263 install -m
644 debian
/local
/control debian
/$$p/usr
/share
/bug
/$$p && \
264 install -m
755 debian
/local
/script debian
/$$p/usr
/share
/bug
/$$p; \
268 dh_missing
--fail-missing
270 override_dh_makeshlibs
:
271 dh_makeshlibs
-a
-- -c4
275 --builddirectory
=build
/ \
278 # For maintainer use only, generate a tarball:
280 git archive
--format
=tar upstream-experimental
--prefix=$(DEB_SOURCE
)-$(DEB_VERSION_UPSTREAM
)/ \
281 | gzip
-9 > ..
/$(DEB_SOURCE
)_
$(DEB_VERSION_UPSTREAM
).orig.
tar.gz