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 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301
|
#!/usr/bin/make -f
# debian/rules for the Debian mesa package
# Copyright © 2006 Thierry Reding <thierry@gilfi.de>
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
include /usr/share/dpkg/pkg-info.mk
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
DEB_HOST_ARCH_CPU ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
# for finding the correct llvm-config when meson doesn't know about it yet
LLVM_VERSION = 19
export PATH:=/usr/lib/llvm-$(LLVM_VERSION)/bin/:$(PATH)
export DEB_BUILD_MAINT_OPTIONS=optimize=-lto
DEB_CFLAGS_MAINT_APPEND := -Wall
DEB_CXXFLAGS_MAINT_APPEND := -Wall
ifneq (,$(filter $(DEB_HOST_ARCH), armhf))
# Workaround for a variant of LP: #725126
DEB_CFLAGS_MAINT_APPEND += -fno-optimize-sibling-calls
DEB_CXXFLAGS_MAINT_APPEND += -fno-optimize-sibling-calls
else ifneq (,$(filter $(DEB_HOST_ARCH), loong64))
# Workaround loong64 BFD linker crash related to TLSDESC
DEB_CFLAGS_MAINT_APPEND += -mtls-dialect=trad
DEB_CXXFLAGS_MAINT_APPEND += -mtls-dialect=trad
else ifneq (,$(filter $(DEB_HOST_ARCH), m68k))
# This library has huge jump tables: Debian #1067207
DEB_CFLAGS_MAINT_APPEND += -mlong-jump-table-offsets
DEB_CXXFLAGS_MAINT_APPEND += -mlong-jump-table-offsets
else ifneq (,$(filter $(DEB_HOST_ARCH), sh4))
# Workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83143
DEB_CFLAGS_MAINT_APPEND += -freorder-blocks-algorithm=simple
DEB_CXXFLAGS_MAINT_APPEND += -freorder-blocks-algorithm=simple
endif
buildflags = $(shell \
DEB_CFLAGS_MAINT_APPEND='$(DEB_CFLAGS_MAINT_APPEND)' \
DEB_CXXFLAGS_MAINT_APPEND='$(DEB_CXXFLAGS_MAINT_APPEND)' \
dpkg-buildflags --export=configure)
EGL_PLATFORMS = x11
GALLIUM_DRIVERS = softpipe
VULKAN_DRIVERS =
VULKAN_LAYERS =
confflags_TEFLON = -Dteflon=false
LLVM_ARCHS = amd64 arm64 armel armhf i386 loong64 mips64el powerpc ppc64 ppc64el riscv64 s390x sparc64 x32
RUSTICL_ARCHS = amd64 arm64 armel armhf i386 loong64 mips64el powerpc ppc64 ppc64el riscv64 s390x x32
NVK_ARCHS = amd64 arm64 armhf i386 ppc64 riscv64 x32
VALGRIND_ARCHS = amd64 arm64 armhf i386 mips64el powerpc ppc64 ppc64el s390x
# hurd doesn't do direct rendering
ifeq ($(DEB_HOST_ARCH_OS), hurd)
confflags_DIRECT_RENDERING = -Dglx-direct=false
confflags_GBM = -Dgbm=disabled
else
# Non-Linux ports lack epoll, so wayland isn't ready yet:
# https://gitlab.freedesktop.org/wayland/wayland/-/issues/72
# hurd also lacks *_CLOEXEC
EGL_PLATFORMS += wayland
GALLIUM_DRIVERS += nouveau r300 r600 virgl
confflags_DIRECT_RENDERING = -Dglx-direct=true
confflags_GBM = -Dgbm=enabled
confflags_GALLIUM += -Dgallium-extra-hud=true
confflags_GALLIUM += -Dgallium-vdpau=enabled
confflags_GALLIUM += -Dlmsensors=enabled
# Freedreno requires arm in addition
ifneq (,$(filter arm arm64,$(DEB_HOST_ARCH_CPU)))
GALLIUM_DRIVERS += freedreno
endif
# etnaviv, tegra, vc4 and v3d kernel support are only available on armhf and arm64
ifneq (,$(filter $(DEB_HOST_ARCH), armhf arm64))
GALLIUM_DRIVERS += etnaviv panfrost svga tegra vc4 v3d
VULKAN_DRIVERS += broadcom freedreno panfrost
endif
ifneq (,$(filter $(DEB_HOST_ARCH), armhf arm64 loong64 riscv64))
GALLIUM_DRIVERS += lima
endif
# Build intel drivers on archs where libdrm-intel is installed
ifneq (,$(filter $(DEB_HOST_ARCH), amd64 i386 x32))
GALLIUM_DRIVERS += crocus i915 svga
VULKAN_DRIVERS += intel_hasvk
endif
ifneq (,$(filter $(DEB_HOST_ARCH), amd64 arm64 i386 loong64 x32 ppc64el riscv64))
GALLIUM_DRIVERS += iris
VULKAN_DRIVERS += intel
endif
ifneq (,$(filter $(DEB_HOST_ARCH), $(VALGRIND_ARCHS)))
confflags_VALGRIND += -Dvalgrind=enabled
endif
# WSL supports only amd64 and arm64
ifneq (,$(filter $(DEB_HOST_ARCH), amd64 arm64))
GALLIUM_DRIVERS += d3d12
endif
# asahi supports only arm64, amd64 and i386
ifneq (,$(filter $(DEB_HOST_ARCH), arm64 amd64 i386))
GALLIUM_DRIVERS += asahi
VULKAN_DRIVERS += asahi
endif
# LLVM is required for building r300g, radeonsi and llvmpipe drivers.
# It's also required for building OpenCL support.
ifneq (,$(filter $(DEB_HOST_ARCH), $(LLVM_ARCHS)))
GALLIUM_DRIVERS += radeonsi zink llvmpipe
# drop virtio from armel, it doesn't build
ifneq (,$(filter $(DEB_HOST_ARCH), armel))
VULKAN_DRIVERS += amd swrast
else
VULKAN_DRIVERS += amd swrast virtio
endif
VULKAN_LAYERS += device-select intel-nullhw overlay
confflags_GALLIUM += -Dllvm=enabled
# Build rusticl for archs where rustc is available
ifneq (,$(filter $(DEB_HOST_ARCH), $(RUSTICL_ARCHS)))
confflags_GALLIUM += -Dgallium-rusticl=true
endif
ifneq (,$(filter $(DEB_HOST_ARCH), $(NVK_ARCHS)))
export MESON_PACKAGE_CACHE_DIR=/usr/share/cargo/registry/
VULKAN_DRIVERS += nouveau
endif
# gfxstream only builds on 64bit
ifeq ($(DEB_HOST_ARCH_BITS),64)
VULKAN_DRIVERS += gfxstream
endif
else
confflags_GALLIUM += -Dllvm=disabled
endif
ifeq (,$(filter pkg.mesa.nolibva,$(DEB_BUILD_PROFILES)))
confflags_GALLIUM += -Dgallium-va=enabled
confflags_GALLIUM += -Dvideo-codecs="all"
endif
# Teflon only supports arm64
ifneq (,$(filter $(DEB_HOST_ARCH), arm64))
confflags_TEFLON = -Dteflon=true
endif
endif
empty:=
space := $(empty) $(empty)
comma := ,
EGL_PLATFORMS := $(patsubst %,'%',$(EGL_PLATFORMS))
EGL_PLATFORMS_LIST := $(subst $(space),$(comma),$(EGL_PLATFORMS))
GALLIUM_DRIVERS := $(patsubst %,'%',$(GALLIUM_DRIVERS))
GALLIUM_DRIVERS_LIST := $(subst $(space),$(comma),$(GALLIUM_DRIVERS))
VULKAN_DRIVERS := $(patsubst %,'%',$(VULKAN_DRIVERS))
VULKAN_DRIVERS_LIST := $(subst $(space),$(comma),$(VULKAN_DRIVERS))
VULKAN_LAYERS := $(patsubst %,'%',$(VULKAN_LAYERS))
VULKAN_LAYERS_LIST := $(subst $(space),$(comma),$(VULKAN_LAYERS))
confflags_GLES = -Dgles1=disabled -Dgles2=enabled
confflags_GALLIUM += -Dgallium-drivers="[$(GALLIUM_DRIVERS_LIST)]"
confflags += \
-Ddri-drivers-path=/usr/lib/$(DEB_HOST_MULTIARCH)/dri \
-Dplatforms="[$(EGL_PLATFORMS_LIST)]" \
-Dvulkan-drivers="[$(VULKAN_DRIVERS_LIST)]" \
-Dvulkan-layers="[$(VULKAN_LAYERS_LIST)]" \
-Dglvnd=enabled \
-Db_ndebug=true \
-Dbuild-tests=true \
-Dtools=drm-shim \
$(confflags_DIRECT_RENDERING) \
$(confflags_GBM) \
$(confflags_GALLIUM) \
$(confflags_GLES) \
$(confflags_VALGRIND) \
$(confflags_TEFLON)
rewrite_wrap_files:
cp -r subprojects subprojects-save
for crate in paste proc-macro2 quote rustc-hash syn unicode-ident; \
do \
export crate_namever=`basename $$MESON_PACKAGE_CACHE_DIR/$$crate-*`; \
sed -e"/source.*/d" -e"s,$${crate}-.*,$${crate_namever}," -i subprojects/$${crate}.wrap; \
done
touch subprojects/rewrite
override_dh_clean: regen_control
dpkg-parsechangelog | awk '/^Version:/ {print $$2}' | sed 's/-.*//;s/~/-/' > VERSION
rm -rf build
rm -rf configure bin/config.guess bin/config.sub config.h.in
rm -rf $$(find -name Makefile.in)
rm -rf bin/install-sh bin/ltmain.sh
rm -rf src/intel/vulkan/grl/parser.out
rm -rf src/intel/vulkan/grl/parsetab.py
for file in debian/*.links.in; do rm -f $${file%%.in}; done
find -name '*.pyc' -delete
find -name '__pycache__' -delete
if [ -f subprojects/rewrite ]; then \
rm -rf subprojects; \
mv subprojects-save subprojects; \
fi
dh_clean
override_dh_auto_configure: rewrite_wrap_files
dpkg-parsechangelog | awk '/^Version:/ {print $$2}' > VERSION
$(buildflags) dh_auto_configure -- \
$(confflags)
override_dh_auto_install:
dh_auto_install
debian/merge-vulkan-driver-manifests.sh debian/tmp
for file in debian/*.links.in; \
do \
sed -e"s,\$${DEB_HOST_MULTIARCH},$(DEB_HOST_MULTIARCH),g" \
$${file} > $${file%%.in}; \
done
# some tests are expected to fail for now, drop this when upstream has
# better cross-build testing in place and expected failures fixed
override_dh_auto_test:
-dh_auto_test
allpkg = $(shell dh_listpackages -a)
override_dh_installchangelogs:
dh_installchangelogs -a
dh_installchangelogs -pmesa-common-dev
override_dh_install:
# purge .la files
find debian/tmp/ -name '*.la' -exec rm '{}' ';'
# Get rid of some files which aren't installed. Do not
# use -f to ensure we notice disappearing files:
rm debian/tmp/usr/lib/*/libEGL_mesa.so
rm debian/tmp/usr/lib/*/libGLX_mesa.so
# use -f here though
rm -f debian/tmp/usr/lib/*/libgrl.a
# Copy the hardlinked *_dri.so correctly.
install -m755 -d debian/libgl1-mesa-dri/usr/lib/${DEB_HOST_MULTIARCH}/dri/
mv debian/tmp/usr/lib/${DEB_HOST_MULTIARCH}/dri/*_dri.so \
debian/libgl1-mesa-dri/usr/lib/${DEB_HOST_MULTIARCH}/dri/
ifneq ($(DEB_HOST_ARCH_OS), hurd)
# Copy the hardlinked vdpau drivers correctly.
install -m755 -d debian/mesa-vdpau-drivers/usr/lib/${DEB_HOST_MULTIARCH}/vdpau/
mv debian/tmp/usr/lib/${DEB_HOST_MULTIARCH}/vdpau/libvdpau*.so* \
debian/mesa-vdpau-drivers/usr/lib/${DEB_HOST_MULTIARCH}/vdpau/
ifeq (,$(filter pkg.mesa.nolibva,$(DEB_BUILD_PROFILES)))
# Copy the hardlinked va drivers correctly.
install -m755 -d debian/mesa-va-drivers/usr/lib/${DEB_HOST_MULTIARCH}/dri/
mv debian/tmp/usr/lib/${DEB_HOST_MULTIARCH}/dri/*_drv_video.so \
debian/mesa-va-drivers/usr/lib/${DEB_HOST_MULTIARCH}/dri/
endif
endif
dh_install -a
# Install bug control and script:
set -e; for p in $(allpkg); do \
install -d debian/$$p/usr/share/bug/$$p && \
install -m 644 debian/local/control debian/$$p/usr/share/bug/$$p && \
install -m 755 debian/local/script debian/$$p/usr/share/bug/$$p; \
done
override_dh_makeshlibs:
dh_makeshlibs -a -- -c4
%:
dh $@ \
--builddirectory=build/ \
--buildsystem=meson
# For maintainer use only, generate a tarball:
gentarball:
tar --transform 's,^.\/,$(DEB_SOURCE)-$(DEB_VERSION_UPSTREAM)/,' \
--exclude 'debian' --exclude '.git.*' --exclude-vcs \
-cJf ../$(DEB_SOURCE)_$(DEB_VERSION_UPSTREAM).orig.tar.xz .
regen_control:
sed -e"s,@LLVM_VERSION@,$(LLVM_VERSION),g" \
-e"s,@LLVM_ARCHS@,$(LLVM_ARCHS),g" \
-e"s,@RUSTICL_ARCHS@,$(RUSTICL_ARCHS),g" \
-e"s,@NVK_ARCHS@,$(NVK_ARCHS),g" \
-e"s,@VALGRIND_ARCHS@,$(VALGRIND_ARCHS),g" \
debian/control.in > debian/control
|