]> cvs.zerfleddert.de Git - m1-debian/blame_incremental - mesa-debian/rules
here we go
[m1-debian] / mesa-debian / rules
... / ...
CommitLineData
1#!/usr/bin/make -f
2# debian/rules for the Debian mesa package
3# Copyright © 2006 Thierry Reding <thierry@gilfi.de>
4
5# Uncomment this to turn on verbose mode.
6#export DH_VERBOSE=1
7
8include /usr/share/dpkg/pkg-info.mk
9
10DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
11DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
12DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
13DEB_HOST_ARCH_CPU ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
14
15# for finding the correct llvm-config when meson doesn't know about it yet
16export PATH:=/usr/lib/llvm-15/bin/:$(PATH)
17
18export DEB_BUILD_MAINT_OPTIONS=optimize=-lto
19
20ifeq (,$(filter $(DEB_HOST_ARCH), armhf ppc64el sh3 sh4))
21buildflags = \
22 $(shell DEB_CFLAGS_MAINT_APPEND=-Wall DEB_CXXFLAGS_MAINT_APPEND=-Wall dpkg-buildflags --export=configure)
23else
24 ifneq (,$(filter $(DEB_HOST_ARCH), armhf))
25 # Workaround for a variant of LP: #725126
26 buildflags = \
27 $(shell DEB_CFLAGS_MAINT_APPEND="-Wall -fno-optimize-sibling-calls" DEB_CXXFLAGS_MAINT_APPEND="-Wall -fno-optimize-sibling-calls" dpkg-buildflags --export=configure)
28 else
29 ifneq (,$(filter $(DEB_HOST_ARCH), ppc64el))
30 # Workaround for https://gitlab.freedesktop.org/mesa/mesa/-/issues/5315
31 buildflags = \
32 $(shell DEB_CFLAGS_MAINT_APPEND="-Wall -O2" DEB_CXXFLAGS_MAINT_APPEND="-Wall -O2" dpkg-buildflags --export=configure)
33 else
34 # Workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83143
35 buildflags = \
36 $(shell DEB_CFLAGS_MAINT_APPEND="-Wall -O1" DEB_CXXFLAGS_MAINT_APPEND="-Wall -O1" dpkg-buildflags --export=configure)
37 endif
38 endif
39endif
40
41EGL_PLATFORMS = x11
42GALLIUM_DRIVERS = swrast
43VULKAN_DRIVERS = swrast
44VULKAN_LAYERS =
45
46confflags_DRI3 = -Ddri3=disabled
47confflags_OSMESA = -Dosmesa=true
48confflags_SSE2 = -Dsse2=true
49
50# hurd doesn't do direct rendering
51ifeq ($(DEB_HOST_ARCH_OS), hurd)
52 confflags_DIRECT_RENDERING = -Dglx-direct=false
53 confflags_GBM = -Dgbm=disabled
54else
55 GALLIUM_DRIVERS += r300 r600 asahi kmsro
56
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
62
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
67 endif
68
69 # Only enable amd on riscv64, swrast needs CPU JIT support which doesn't work properly yet
70 ifneq (,$(filter $(DEB_HOST_ARCH), riscv64))
71 VULKAN_DRIVERS += amd
72 confflags_GALLIUM += -Ddraw-use-llvm=false
73 endif
74
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
79
80 # Freedreno requires arm in addition
81 ifneq (,$(filter arm arm64,$(DEB_HOST_ARCH_CPU)))
82 GALLIUM_DRIVERS += freedreno
83 endif
84
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 freedreno
89 endif
90
91 ifneq (,$(filter $(DEB_HOST_ARCH), armhf arm64 riscv64))
92 GALLIUM_DRIVERS += lima
93 endif
94
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
100 endif
101
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
106
107 ifneq (,$(filter $(DEB_HOST_ARCH), amd64 arm64 armhf i386 mips64el mipsel powerpc ppc64 ppc64el s390x))
108 confflags_VALGRIND += -Dvalgrind=enabled
109 endif
110
111 # WSL supports only amd64 and arm64
112 ifneq (,$(filter amd64 arm64,$(DEB_HOST_ARCH)))
113 GALLIUM_DRIVERS += d3d12
114 endif
115 endif
116
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
120 endif
121
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
129
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
133 endif
134 else
135 confflags_GALLIUM += -Dllvm=disabled
136 endif
137
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
142 endif
143
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"
147 endif
148endif
149
150ifeq ($(DEB_HOST_ARCH), i386)
151 confflags_SSE2 = -Dsse2=false
152endif
153
154empty:=
155space := $(empty) $(empty)
156comma := ,
157GALLIUM_DRIVERS := $(patsubst %,'%',$(GALLIUM_DRIVERS))
158GALLIUM_DRIVERS_LIST := $(subst $(space),$(comma),$(GALLIUM_DRIVERS))
159VULKAN_DRIVERS := $(patsubst %,'%',$(VULKAN_DRIVERS))
160VULKAN_DRIVERS_LIST := $(subst $(space),$(comma),$(VULKAN_DRIVERS))
161VULKAN_LAYERS := $(patsubst %,'%',$(VULKAN_LAYERS))
162VULKAN_LAYERS_LIST := $(subst $(space),$(comma),$(VULKAN_LAYERS))
163
164confflags_EGL = -Dplatforms="$(EGL_PLATFORMS)"
165confflags_GLES = -Dgles1=disabled -Dgles2=enabled
166confflags_GALLIUM += -Dgallium-drivers="[$(GALLIUM_DRIVERS_LIST)]"
167
168confflags += \
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)]" \
173 -Dglvnd=true \
174 -Dshared-glapi=enabled \
175 -Dgallium-omx=disabled \
176 -Db_ndebug=true \
177 -Dbuild-tests=true \
178 -Dlibunwind=disabled \
179 -Degl=enabled \
180 -Dgallium-va=disabled \
181 -Dgallium-vdpau=disabled \
182 -Dgallium-xa=disabled \
183 -Dglx=dri \
184 -Dmicrosoft-clc=disabled \
185 $(confflags_DIRECT_RENDERING) \
186 $(confflags_GBM) \
187 $(confflags_DRI3) \
188 $(confflags_EGL) \
189 $(confflags_GALLIUM) \
190 $(confflags_GLES) \
191 $(confflags_OSMESA) \
192 $(confflags_SSE2) \
193 $(confflags_VALGRIND)
194
195override_dh_clean:
196 rm -rf .pc
197 rm -rf build
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
204 dh_clean
205
206override_dh_auto_configure:
207 $(buildflags) dh_auto_configure -- \
208 $(confflags)
209
210override_dh_auto_install:
211 dh_auto_install
212 for file in debian/*.in; \
213 do \
214 sed -e"s,\$${DEB_HOST_MULTIARCH},$(DEB_HOST_MULTIARCH),g" \
215 $${file} > $${file%%.in}; \
216 done
217
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
220override_dh_auto_test:
221 -dh_auto_test
222
223allpkg = $(shell dh_listpackages -a)
224
225override_dh_installchangelogs:
226 dh_installchangelogs -a
227 dh_installchangelogs -pmesa-common-dev
228
229override_dh_install:
230 # purge .la files
231 find debian/tmp/ -name '*.la' -exec rm '{}' ';'
232
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
238
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/
243
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/
249
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/
255 endif
256 endif
257
258 dh_install -a
259
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; \
265 done
266
267override_dh_missing:
268 dh_missing --fail-missing
269
270override_dh_makeshlibs:
271 dh_makeshlibs -a -- -c4
272
273%:
274 dh $@ --with quilt \
275 --builddirectory=build/ \
276 --buildsystem=meson
277
278# For maintainer use only, generate a tarball:
279gentarball:
280 git archive --format=tar upstream-experimental --prefix=$(DEB_SOURCE)-$(DEB_VERSION_UPSTREAM)/ \
281 | gzip -9 > ../$(DEB_SOURCE)_$(DEB_VERSION_UPSTREAM).orig.tar.gz
Impressum, Datenschutz