| 1 |
#!/usr/bin/make -f |
| 2 |
# debian/rules for the Debian mesa package |
| 3 |
# Copyright © 2006 Thierry Reding <[email protected]> |
| 4 |
|
| 5 |
# Uncomment this to turn on verbose mode. |
| 6 |
#export DH_VERBOSE=1 |
| 7 |
|
| 8 |
include /usr/share/dpkg/pkg-info.mk |
| 9 |
|
| 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) |
| 14 |
|
| 15 |
# for finding the correct llvm-config when meson doesn't know about it yet |
| 16 |
LLVM_VERSION = 21 |
| 17 |
export PATH:=/usr/lib/llvm-$(LLVM_VERSION)/bin/:$(PATH) |
| 18 |
|
| 19 |
export DEB_BUILD_MAINT_OPTIONS=optimize=-lto |
| 20 |
|
| 21 |
DEB_CFLAGS_MAINT_APPEND := -Wall |
| 22 |
DEB_CXXFLAGS_MAINT_APPEND := -Wall |
| 23 |
ifneq (,$(filter $(DEB_HOST_ARCH), armhf)) |
| 24 |
# Workaround for a variant of LP: #725126 |
| 25 |
DEB_CFLAGS_MAINT_APPEND += -fno-optimize-sibling-calls |
| 26 |
DEB_CXXFLAGS_MAINT_APPEND += -fno-optimize-sibling-calls |
| 27 |
else ifneq (,$(filter $(DEB_HOST_ARCH), loong64)) |
| 28 |
# Workaround loong64 BFD linker crash related to TLSDESC |
| 29 |
DEB_CFLAGS_MAINT_APPEND += -mtls-dialect=trad |
| 30 |
DEB_CXXFLAGS_MAINT_APPEND += -mtls-dialect=trad |
| 31 |
else ifneq (,$(filter $(DEB_HOST_ARCH), m68k)) |
| 32 |
# This library has huge jump tables: Debian #1067207 |
| 33 |
DEB_CFLAGS_MAINT_APPEND += -mlong-jump-table-offsets |
| 34 |
DEB_CXXFLAGS_MAINT_APPEND += -mlong-jump-table-offsets |
| 35 |
else ifneq (,$(filter $(DEB_HOST_ARCH), sh4)) |
| 36 |
# Workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83143 |
| 37 |
DEB_CFLAGS_MAINT_APPEND += -freorder-blocks-algorithm=simple |
| 38 |
DEB_CXXFLAGS_MAINT_APPEND += -freorder-blocks-algorithm=simple |
| 39 |
endif |
| 40 |
buildflags = $(shell \ |
| 41 |
DEB_CFLAGS_MAINT_APPEND='$(DEB_CFLAGS_MAINT_APPEND)' \ |
| 42 |
DEB_CXXFLAGS_MAINT_APPEND='$(DEB_CXXFLAGS_MAINT_APPEND)' \ |
| 43 |
dpkg-buildflags --export=configure) |
| 44 |
|
| 45 |
EGL_PLATFORMS = x11 |
| 46 |
GALLIUM_DRIVERS = softpipe |
| 47 |
VULKAN_DRIVERS = |
| 48 |
VULKAN_LAYERS = |
| 49 |
|
| 50 |
confflags_TEFLON = -Dteflon=false |
| 51 |
|
| 52 |
LLVM_ARCHS = amd64 arm64 armhf i386 loong64 powerpc ppc64 ppc64el riscv64 s390x sparc64 x32 |
| 53 |
RUSTICL_ARCHS = amd64 arm64 armhf i386 loong64 powerpc ppc64 ppc64el riscv64 s390x x32 |
| 54 |
NVK_ARCHS = amd64 arm64 armhf i386 ppc64 riscv64 x32 |
| 55 |
VALGRIND_ARCHS = amd64 arm64 armhf i386 powerpc ppc64 ppc64el riscv64 s390x |
| 56 |
|
| 57 |
# hurd doesn't do direct rendering |
| 58 |
ifeq ($(DEB_HOST_ARCH_OS), hurd) |
| 59 |
confflags_DIRECT_RENDERING = -Dglx-direct=false |
| 60 |
confflags_GBM = -Dgbm=disabled |
| 61 |
else |
| 62 |
# Non-Linux ports lack epoll, so wayland isn't ready yet: |
| 63 |
# https://gitlab.freedesktop.org/wayland/wayland/-/issues/72 |
| 64 |
# hurd also lacks *_CLOEXEC |
| 65 |
EGL_PLATFORMS += wayland |
| 66 |
|
| 67 |
GALLIUM_DRIVERS += nouveau r300 r600 virgl |
| 68 |
confflags_DIRECT_RENDERING = -Dglx-direct=true |
| 69 |
confflags_GBM = -Dgbm=enabled |
| 70 |
confflags_GALLIUM += -Dgallium-extra-hud=true |
| 71 |
confflags_GALLIUM += -Dlmsensors=enabled |
| 72 |
confflags_GALLIUM += -Dgallium-va=enabled |
| 73 |
confflags_GALLIUM += -Dvideo-codecs="all" |
| 74 |
|
| 75 |
|
| 76 |
# Freedreno requires arm in addition |
| 77 |
ifneq (,$(filter arm arm64,$(DEB_HOST_ARCH_CPU))) |
| 78 |
GALLIUM_DRIVERS += freedreno |
| 79 |
endif |
| 80 |
|
| 81 |
# Rocket and Teflon only support arm64 |
| 82 |
ifneq (,$(filter $(DEB_HOST_ARCH), arm64)) |
| 83 |
GALLIUM_DRIVERS += rocket |
| 84 |
confflags_TEFLON = -Dteflon=true |
| 85 |
endif |
| 86 |
|
| 87 |
# etnaviv, tegra, vc4 and v3d kernel support are only available on armhf and arm64 |
| 88 |
ifneq (,$(filter $(DEB_HOST_ARCH), armhf arm64)) |
| 89 |
GALLIUM_DRIVERS += etnaviv panfrost svga tegra vc4 v3d |
| 90 |
VULKAN_DRIVERS += broadcom freedreno panfrost |
| 91 |
endif |
| 92 |
|
| 93 |
ifneq (,$(filter $(DEB_HOST_ARCH), armhf arm64 loong64 riscv64)) |
| 94 |
GALLIUM_DRIVERS += lima |
| 95 |
endif |
| 96 |
|
| 97 |
ifneq (,$(filter $(DEB_HOST_ARCH), armhf arm64 riscv64)) |
| 98 |
VULKAN_DRIVERS += imagination |
| 99 |
endif |
| 100 |
|
| 101 |
# Build intel drivers on archs where libdrm-intel is installed |
| 102 |
ifneq (,$(filter $(DEB_HOST_ARCH), amd64 i386 x32)) |
| 103 |
GALLIUM_DRIVERS += crocus i915 svga |
| 104 |
VULKAN_DRIVERS += intel_hasvk |
| 105 |
endif |
| 106 |
|
| 107 |
ifneq (,$(filter $(DEB_HOST_ARCH), amd64 arm64 i386 loong64 x32 ppc64el riscv64)) |
| 108 |
GALLIUM_DRIVERS += iris |
| 109 |
VULKAN_DRIVERS += intel |
| 110 |
endif |
| 111 |
|
| 112 |
ifneq (,$(filter $(DEB_HOST_ARCH), $(VALGRIND_ARCHS))) |
| 113 |
confflags_VALGRIND += -Dvalgrind=enabled |
| 114 |
endif |
| 115 |
|
| 116 |
# WSL supports only amd64 and arm64 |
| 117 |
ifneq (,$(filter $(DEB_HOST_ARCH), amd64 arm64)) |
| 118 |
GALLIUM_DRIVERS += d3d12 |
| 119 |
endif |
| 120 |
|
| 121 |
# asahi supports only arm64, amd64 and i386 |
| 122 |
ifneq (,$(filter $(DEB_HOST_ARCH), arm64 amd64 i386)) |
| 123 |
GALLIUM_DRIVERS += asahi |
| 124 |
VULKAN_DRIVERS += asahi |
| 125 |
endif |
| 126 |
|
| 127 |
# LLVM is required for building r300g, radeonsi and llvmpipe drivers. |
| 128 |
# It's also required for building OpenCL support. |
| 129 |
ifneq (,$(filter $(DEB_HOST_ARCH), $(LLVM_ARCHS))) |
| 130 |
GALLIUM_DRIVERS += radeonsi zink llvmpipe |
| 131 |
VULKAN_DRIVERS += amd swrast virtio |
| 132 |
|
| 133 |
VULKAN_LAYERS += anti-lag device-select intel-nullhw overlay screenshot |
| 134 |
confflags_GALLIUM += -Dllvm=enabled |
| 135 |
|
| 136 |
# Build rusticl for archs where rustc is available |
| 137 |
ifneq (,$(filter $(DEB_HOST_ARCH), $(RUSTICL_ARCHS))) |
| 138 |
confflags_GALLIUM += -Dgallium-rusticl=true |
| 139 |
endif |
| 140 |
|
| 141 |
ifneq (,$(filter $(DEB_HOST_ARCH), $(NVK_ARCHS))) |
| 142 |
export MESON_PACKAGE_CACHE_DIR=/usr/share/cargo/registry/ |
| 143 |
VULKAN_DRIVERS += nouveau |
| 144 |
endif |
| 145 |
|
| 146 |
# gfxstream only builds on 64bit |
| 147 |
ifeq ($(DEB_HOST_ARCH_BITS),64) |
| 148 |
VULKAN_DRIVERS += gfxstream |
| 149 |
endif |
| 150 |
else |
| 151 |
confflags_GALLIUM += -Dllvm=disabled |
| 152 |
endif |
| 153 |
endif |
| 154 |
|
| 155 |
empty:= |
| 156 |
space := $(empty) $(empty) |
| 157 |
comma := , |
| 158 |
EGL_PLATFORMS := $(patsubst %,'%',$(EGL_PLATFORMS)) |
| 159 |
EGL_PLATFORMS_LIST := $(subst $(space),$(comma),$(EGL_PLATFORMS)) |
| 160 |
GALLIUM_DRIVERS := $(patsubst %,'%',$(GALLIUM_DRIVERS)) |
| 161 |
GALLIUM_DRIVERS_LIST := $(subst $(space),$(comma),$(GALLIUM_DRIVERS)) |
| 162 |
VULKAN_DRIVERS := $(patsubst %,'%',$(VULKAN_DRIVERS)) |
| 163 |
VULKAN_DRIVERS_LIST := $(subst $(space),$(comma),$(VULKAN_DRIVERS)) |
| 164 |
VULKAN_LAYERS := $(patsubst %,'%',$(VULKAN_LAYERS)) |
| 165 |
VULKAN_LAYERS_LIST := $(subst $(space),$(comma),$(VULKAN_LAYERS)) |
| 166 |
|
| 167 |
confflags_GLES = -Dgles1=disabled -Dgles2=enabled |
| 168 |
confflags_GALLIUM += -Dgallium-drivers="[$(GALLIUM_DRIVERS_LIST)]" |
| 169 |
|
| 170 |
confflags += \ |
| 171 |
-Ddri-drivers-path=/usr/lib/$(DEB_HOST_MULTIARCH)/dri \ |
| 172 |
-Dplatforms="[$(EGL_PLATFORMS_LIST)]" \ |
| 173 |
-Dvulkan-drivers="[$(VULKAN_DRIVERS_LIST)]" \ |
| 174 |
-Dvulkan-layers="[$(VULKAN_LAYERS_LIST)]" \ |
| 175 |
-Dvulkan-manifest-per-architecture=false \ |
| 176 |
-Dglvnd=enabled \ |
| 177 |
-Db_ndebug=true \ |
| 178 |
-Dbuild-tests=true \ |
| 179 |
-Dtools=drm-shim \ |
| 180 |
$(confflags_DIRECT_RENDERING) \ |
| 181 |
$(confflags_GBM) \ |
| 182 |
$(confflags_GALLIUM) \ |
| 183 |
$(confflags_GLES) \ |
| 184 |
$(confflags_VALGRIND) \ |
| 185 |
$(confflags_TEFLON) |
| 186 |
|
| 187 |
|
| 188 |
rewrite_wrap_files: |
| 189 |
debian/get-wraps-from-cargo-registry.py --cargo-registry /usr/share/cargo/registry |
| 190 |
|
| 191 |
override_dh_clean: regen_control |
| 192 |
dpkg-parsechangelog | awk '/^Version:/ {print $$2}' | sed 's/-.*//;s/~/-/' > VERSION |
| 193 |
rm -rf build |
| 194 |
rm -rf configure bin/config.guess bin/config.sub config.h.in |
| 195 |
rm -rf $$(find -name Makefile.in) |
| 196 |
rm -rf bin/install-sh bin/ltmain.sh |
| 197 |
rm -rf src/intel/vulkan/grl/parser.out |
| 198 |
rm -rf src/intel/vulkan/grl/parsetab.py |
| 199 |
for file in debian/*.links.in; do rm -f $${file%%.in}; done |
| 200 |
find -name '*.pyc' -delete |
| 201 |
find -name '__pycache__' -delete |
| 202 |
if [ -f subprojects/rewrite ]; then \ |
| 203 |
rm -rf subprojects; \ |
| 204 |
mv subprojects-save subprojects; \ |
| 205 |
fi |
| 206 |
dh_clean |
| 207 |
|
| 208 |
override_dh_auto_configure: rewrite_wrap_files |
| 209 |
dpkg-parsechangelog | awk '/^Version:/ {print $$2}' > VERSION |
| 210 |
$(buildflags) dh_auto_configure -- \ |
| 211 |
$(confflags) |
| 212 |
|
| 213 |
override_dh_auto_install: |
| 214 |
dh_auto_install |
| 215 |
for file in debian/*.links.in; \ |
| 216 |
do \ |
| 217 |
sed -e"s,\$${DEB_HOST_MULTIARCH},$(DEB_HOST_MULTIARCH),g" \ |
| 218 |
$${file} > $${file%%.in}; \ |
| 219 |
done |
| 220 |
|
| 221 |
# some tests are expected to fail for now, drop this when upstream has |
| 222 |
# better cross-build testing in place and expected failures fixed |
| 223 |
override_dh_auto_test: |
| 224 |
-dh_auto_test |
| 225 |
|
| 226 |
allpkg = $(shell dh_listpackages -a) |
| 227 |
|
| 228 |
override_dh_installchangelogs: |
| 229 |
dh_installchangelogs -a |
| 230 |
dh_installchangelogs -pmesa-common-dev |
| 231 |
|
| 232 |
override_dh_install: |
| 233 |
# purge .la files |
| 234 |
find debian/tmp/ -name '*.la' -exec rm '{}' ';' |
| 235 |
|
| 236 |
# Get rid of some files which aren't installed. Do not |
| 237 |
# use -f to ensure we notice disappearing files: |
| 238 |
rm debian/tmp/usr/lib/*/libEGL_mesa.so |
| 239 |
rm debian/tmp/usr/lib/*/libGLX_mesa.so |
| 240 |
# use -f here though |
| 241 |
rm -f debian/tmp/usr/lib/*/libgrl.a |
| 242 |
|
| 243 |
# Copy the hardlinked *_dri.so correctly. |
| 244 |
install -m755 -d debian/libgl1-mesa-dri/usr/lib/${DEB_HOST_MULTIARCH}/dri/ |
| 245 |
mv debian/tmp/usr/lib/${DEB_HOST_MULTIARCH}/dri/*_dri.so \ |
| 246 |
debian/libgl1-mesa-dri/usr/lib/${DEB_HOST_MULTIARCH}/dri/ |
| 247 |
|
| 248 |
ifneq ($(DEB_HOST_ARCH_OS), hurd) |
| 249 |
# Copy the hardlinked va drivers correctly. |
| 250 |
install -m755 -d debian/mesa-libgallium/usr/lib/${DEB_HOST_MULTIARCH}/dri/ |
| 251 |
mv debian/tmp/usr/lib/${DEB_HOST_MULTIARCH}/dri/*_drv_video.so \ |
| 252 |
debian/mesa-libgallium/usr/lib/${DEB_HOST_MULTIARCH}/dri/ |
| 253 |
endif |
| 254 |
|
| 255 |
dh_install -a |
| 256 |
|
| 257 |
# Install bug control and script: |
| 258 |
set -e; for p in $(allpkg); do \ |
| 259 |
install -d debian/$$p/usr/share/bug/$$p && \ |
| 260 |
install -m 644 debian/local/control debian/$$p/usr/share/bug/$$p && \ |
| 261 |
install -m 755 debian/local/script debian/$$p/usr/share/bug/$$p; \ |
| 262 |
done |
| 263 |
|
| 264 |
override_dh_makeshlibs: |
| 265 |
dh_makeshlibs -a -- -c4 |
| 266 |
|
| 267 |
%: |
| 268 |
dh $@ \ |
| 269 |
--builddirectory=build/ \ |
| 270 |
--buildsystem=meson |
| 271 |
|
| 272 |
# For maintainer use only, generate a tarball: |
| 273 |
gentarball: |
| 274 |
tar --transform 's,^.\/,$(DEB_SOURCE)-$(DEB_VERSION_UPSTREAM)/,' \ |
| 275 |
--exclude 'debian' --exclude '.git.*' --exclude-vcs \ |
| 276 |
-cJf ../$(DEB_SOURCE)_$(DEB_VERSION_UPSTREAM).orig.tar.xz . |
| 277 |
|
| 278 |
regen_control: |
| 279 |
sed -e"s,@LLVM_VERSION@,$(LLVM_VERSION),g" \ |
| 280 |
-e"s,@LLVM_ARCHS@,$(LLVM_ARCHS),g" \ |
| 281 |
-e"s,@RUSTICL_ARCHS@,$(RUSTICL_ARCHS),g" \ |
| 282 |
-e"s,@NVK_ARCHS@,$(NVK_ARCHS),g" \ |
| 283 |
-e"s,@VALGRIND_ARCHS@,$(VALGRIND_ARCHS),g" \ |
| 284 |
debian/control.in > debian/control |