Name libgl1-mesa-dri
Description free implementation of the OpenGL API -- DRI modules
Version 25.0.7-0ubuntu0.24.04.2
Package Base mesa
Homepage https://mesa3d.org/
Maintainers ['Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>']
Contributors ['Andreas Boll <aboll@debian.org>']
Distro-repo https://git.launchpad.net/ubuntu/+source/mesa/tree/?h=ubuntu/noble
Sources ['https://git.launchpad.net/ubuntu/+source/libgl1-mesa-dri/plain/debian/watch?h=ubuntu/noble', 'https://git.launchpad.net/ubuntu/+source/mesa/plain/debian/patches/../?h=ubuntu/noble', 'https://git.launchpad.net/ubuntu/+source/mesa/plain/debian/patches/path_max.diff?h=ubuntu/noble', 'https://git.launchpad.net/ubuntu/+source/mesa/plain/debian/patches/series?h=ubuntu/noble', 'https://git.launchpad.net/ubuntu/+source/mesa/plain/debian/patches/src_glx_dri_common.h.diff?h=ubuntu/noble']
Dependencies ['libc6', 'libgbm1', 'libvulkan1']
Optional-Dependencies []
Build-Dependencies ['debhelper-compat', 'directx-headers-dev', 'flatbuffers-compiler [linux-arm64]', 'glslang-tools [amd64 arm64 armel armhf i386 loong64 mips64el powerpc ppc64 ppc64el riscv64 s390x sparc64 x32]', 'spirv-tools', 'meson-1.5', 'pkgconf', 'libdrm-dev', 'libx11-dev', 'libxxf86vm-dev', 'libexpat1-dev', 'libflatbuffers-dev [linux-arm64]', 'libsensors-dev [!hurd-any]', 'libxfixes-dev', 'libxext-dev', 'libva-dev', 'libvdpau-dev', 'libvulkan-dev [amd64 arm64 armel armhf i386 loong64 mips64el powerpc ppc64 ppc64el riscv64 s390x sparc64 x32]', 'x11proto-dev', 'linux-libc-dev', 'libx11-xcb-dev', 'libxcb-dri2-0-dev', 'libxcb-glx0-dev', 'libxcb-xfixes0-dev', 'libxcb-dri3-dev', 'libxcb-present-dev', 'libxcb-randr0-dev', 'libxcb-shm0-dev', 'libxcb-sync-dev', 'libxrandr-dev', 'libxshmfence-dev', 'libxtensor-dev [linux-arm64]', 'libzstd-dev', 'python3', 'python3-mako', 'python3-ply', 'python3-yaml', 'python3-pycparser [arm64 armhf]', 'python3-setuptools', 'flex', 'bison', 'libelf-dev [amd64 arm64 armel armhf i386 loong64 mips64el powerpc ppc64 ppc64el riscv64 s390x sparc64 x32]', 'libwayland-dev', 'libwayland-egl-backend-dev', 'llvm-20-dev [amd64 arm64 armel armhf i386 loong64 mips64el powerpc ppc64 ppc64el riscv64 s390x sparc64 x32]', 'libclang-20-dev [amd64 arm64 armel armhf i386 loong64 mips64el powerpc ppc64 ppc64el riscv64 s390x sparc64 x32]', 'libclang-cpp20-dev [amd64 arm64 armel armhf i386 loong64 mips64el powerpc ppc64 ppc64el riscv64 s390x sparc64 x32]', 'libclc-20-dev [amd64 arm64 armel armhf i386 loong64 mips64el powerpc ppc64 ppc64el riscv64 s390x sparc64 x32]', 'libclc-20 [amd64 arm64 armel armhf i386 loong64 mips64el powerpc ppc64 ppc64el riscv64 s390x sparc64 x32]', 'wayland-protocols', 'zlib1g-dev', 'libglvnd-core-dev', 'valgrind [amd64 arm64 armhf i386 mips64el powerpc ppc64 ppc64el s390x]', 'rustc-1.78', 'rustfmt-1.78 [amd64 arm64 armel armhf loong64 mips64el powerpc ppc64 ppc64el riscv64 s390x x32]', 'bindgen', 'cbindgen [amd64 arm64 armel armhf loong64 mips64el powerpc ppc64 ppc64el riscv64 s390x x32]', 'llvm-spirv-20 [amd64 arm64 armel armhf loong64 mips64el powerpc ppc64 ppc64el riscv64 s390x x32]', 'libllvmspirvlib-20-dev [amd64 arm64 armel armhf i386 loong64 mips64el powerpc ppc64 ppc64el riscv64 s390x sparc64 x32]', 'librust-paste-dev [amd64 arm64 armhf ppc64 riscv64 x32]', 'librust-syn-dev']
Provides []
Builddate
Architecture amd64
Distro-Version noble
Licenses []
Hash 5412f0569102bb6f8d4ccac122319abaf534ebcd07dc2935c18fc9611709cd0c
#!/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 = 17
export PATH:=/usr/lib/llvm-$(LLVM_VERSION)/bin/:$(PATH)

export DEB_BUILD_MAINT_OPTIONS=optimize=-lto

ifeq (,$(filter $(DEB_HOST_ARCH), armhf ppc64el sh3 sh4))
buildflags = \
	$(shell DEB_CFLAGS_MAINT_APPEND=-Wall DEB_CXXFLAGS_MAINT_APPEND=-Wall dpkg-buildflags --export=configure)
else
  ifneq (,$(filter $(DEB_HOST_ARCH), armhf))
  # Workaround for a variant of LP: #725126
  buildflags = \
	$(shell DEB_CFLAGS_MAINT_APPEND="-Wall -fno-optimize-sibling-calls" DEB_CXXFLAGS_MAINT_APPEND="-Wall -fno-optimize-sibling-calls" dpkg-buildflags --export=configure)
  else
    # Workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83143
    buildflags = \
	$(shell DEB_CFLAGS_MAINT_APPEND="-Wall -O1" DEB_CXXFLAGS_MAINT_APPEND="-Wall -O1" dpkg-buildflags --export=configure)
  endif
endif

EGL_PLATFORMS = x11
GALLIUM_DRIVERS = swrast
VULKAN_DRIVERS =
VULKAN_LAYERS =

confflags_DRI3 = -Ddri3=disabled
confflags_OSMESA = -Dosmesa=true
confflags_SSE2 = -Dsse2=true

LLVM_ARCHS     = amd64 arm64 armel armhf i386 loong64 powerpc ppc64 ppc64el riscv64 s390x sparc64 x32
RUSTICL_ARCHS  = amd64 arm64 armel armhf loong64 powerpc ppc64 ppc64el riscv64 s390x x32
VALGRIND_ARCHS = amd64 arm64 armhf i386 mips64el powerpc ppc64 ppc64el s390x
WINE_ARCHS     = amd64 arm64 armel armhf i386

# 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_DRI3 = -Ddri3=enabled
  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
  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 iris svga
	VULKAN_DRIVERS += intel intel_hasvk
	# svga needs xa state tracker
	confflags_GALLIUM += -Dgallium-xa=enabled
  endif

  ifneq (,$(filter $(DEB_HOST_ARCH), amd64))
	confflags_GALLIUM += -Dintel-clc=enabled
  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

  # 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

	# Only enable amd on riscv64, swrast needs CPU JIT support which doesn't work properly yet
	ifneq (,$(filter $(DEB_HOST_ARCH), riscv64))
		VULKAN_DRIVERS += amd
		confflags_GALLIUM += -Ddraw-use-llvm=false
	else
	  # 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
	endif

	VULKAN_LAYERS += device-select intel-nullhw overlay
	confflags_GALLIUM += -Dllvm=enabled
	confflags_GALLIUM += -Dgallium-opencl=icd

	# Build rusticl for archs where rustc is available
	ifneq (,$(filter $(DEB_HOST_ARCH), $(RUSTICL_ARCHS)))
		confflags_GALLIUM += -Dgallium-rusticl=true
	endif

	# nine makes sense only on archs that build wine
	ifneq (,$(filter $(DEB_HOST_ARCH), $(WINE_ARCHS)))
		confflags_GALLIUM += -Dgallium-nine=true
	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
endif

ifeq ($(DEB_HOST_ARCH), i386)
	confflags_SSE2 = -Dsse2=false
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 \
	-Ddri-search-path='/usr/lib/$(DEB_HOST_MULTIARCH)/dri:\$$$${ORIGIN}/dri:/usr/lib/dri' \
	-Dplatforms="[$(EGL_PLATFORMS_LIST)]" \
	-Dvulkan-drivers="[$(VULKAN_DRIVERS_LIST)]" \
	-Dvulkan-layers="[$(VULKAN_LAYERS_LIST)]" \
	-Dglvnd=true \
	-Dshared-glapi=enabled \
	-Dgallium-omx=disabled \
	-Db_ndebug=true \
	-Dbuild-tests=true \
	-Dtools=drm-shim \
	$(confflags_DIRECT_RENDERING) \
	$(confflags_GBM) \
	$(confflags_DRI3) \
	$(confflags_GALLIUM) \
	$(confflags_GLES) \
	$(confflags_OSMESA) \
	$(confflags_SSE2) \
	$(confflags_VALGRIND)

override_dh_clean: regen_control
	dpkg-parsechangelog | awk '/^Version:/ {print $$2}' | sed 's/-.*//;s/~/-/' > VERSION
	rm -rf .pc
	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
	for file in debian/*.links.in; do rm -f $${file%%.in}; done
	find -name '*.pyc' -delete
	find -name '__pycache__' -delete
	dh_clean

override_dh_auto_configure:
	dpkg-parsechangelog | awk '/^Version:/ {print $$2}' > VERSION
	$(buildflags) dh_auto_configure -- \
		$(confflags)

override_dh_auto_install:
	dh_auto_install
	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/*/libglapi.so
	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

  ifneq (,$(filter $(DEB_HOST_ARCH), $(RUSTICL_ARCHS)))
	install -m755 -d debian/mesa-opencl-icd/etc/OpenCL/vendors
	mv debian/tmp/etc/OpenCL/vendors/rusticl.icd \
	   debian/mesa-opencl-icd/etc/OpenCL/vendors
	install -m755 -d debian/mesa-opencl-icd/usr/lib/${DEB_HOST_MULTIARCH}/
	mv debian/tmp/usr/lib/${DEB_HOST_MULTIARCH}/libRusticlOpenCL* \
	   debian/mesa-opencl-icd/usr/lib/${DEB_HOST_MULTIARCH}/
  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 $@ --with quilt \
		--builddirectory=build/ \
		--buildsystem=meson

# For maintainer use only, generate a tarball:
gentarball:
	git archive --format=tar upstream-experimental --prefix=$(DEB_SOURCE)-$(DEB_VERSION_UPSTREAM)/ \
		| gzip -9 > ../$(DEB_SOURCE)_$(DEB_VERSION_UPSTREAM).orig.tar.gz

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,@VALGRIND_ARCHS@,$(VALGRIND_ARCHS),g" \
	    -e"s,@WINE_ARCHS@,$(WINE_ARCHS),g" \
	    debian/control.in > debian/control