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
|
#!/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
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)
ifeq (,$(filter $(DEB_HOST_ARCH), armhf))
buildflags = \
$(shell DEB_CFLAGS_MAINT_APPEND=-Wall DEB_CXXFLAGS_MAINT_APPEND=-Wall dpkg-buildflags --export=configure)
else
# 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)
endif
# keep a list of files we don't install (yet), but since it's a bit
# large, use an external file:
include debian/not-installed
DRI_DRIVERS =
GALLIUM_DRIVERS =
VULKAN_DRIVERS =
EGL_PLATFORMS = x11,surfaceless
confflags_DRI3 = --disable-dri3
# hurd doesn't do direct rendering
ifeq ($(DEB_HOST_ARCH_OS), hurd)
confflags_DIRECT_RENDERING = --disable-driglx-direct
confflags_GBM = --disable-gbm
DRI_DRIVERS = swrast
else
ifeq ($(DEB_HOST_ARCH_OS), linux)
confflags_DRI3 = --enable-dri3
# Gallium drivers which require kernel support, not yet ported to non-Linux
GALLIUM_DRIVERS += nouveau virgl
# Freedreno requires arm in addition
ifneq (,$(filter arm arm64,$(DEB_HOST_ARCH_CPU)))
GALLIUM_DRIVERS += freedreno
endif
# vc4 kernel support is only available on armhf and arm64
ifneq (,$(filter $(DEB_HOST_ARCH), armhf arm64))
GALLIUM_DRIVERS += vc4
endif
# etnaviv kernel support is currently only available on armhf
ifneq (,$(filter $(DEB_HOST_ARCH), armhf))
GALLIUM_DRIVERS += etnaviv imx
endif
ifneq (,$(filter $(DEB_HOST_ARCH), amd64 i386 x32))
GALLIUM_DRIVERS += svga
# svga needs xa state tracker
confflags_GALLIUM += --enable-xa
VULKAN_DRIVERS += intel
endif
# Non-Linux ports also lack *_CLOEXEC and epoll, so wayland isn't ready yet:
EGL_PLATFORMS += wayland
# Likewise, Mir makes no attempt to be portable to random kernels.
EGL_PLATFORMS += mir
EGL_PLATFORMS += rs
ifeq (,$(filter $(DEB_HOST_ARCH), s390 s390x))
DRI_DRIVERS += nouveau
endif
endif
EGL_PLATFORMS += drm
# Build intel drivers on archs where libdrm-intel is installed
ifneq (,$(filter $(DEB_HOST_ARCH),amd64 i386 kfreebsd-amd64 kfreebsd-i386 x32))
DRI_DRIVERS += i915 i965
endif
ifeq (,$(filter $(DEB_HOST_ARCH), s390 s390x))
DRI_DRIVERS += r200 radeon
GALLIUM_DRIVERS += r600 r300
endif
# LLVM is required for building r300g, radeonsi and llvmpipe drivers.
# It's also required for building OpenCL support.
ifneq (,$(filter $(DEB_HOST_ARCH), amd64 arm64 armel armhf i386 kfreebsd-amd64 kfreebsd-i386 mips mips64el mipsel powerpc ppc64 sparc64 ppc64el))
GALLIUM_DRIVERS += radeonsi
confflags_GALLIUM += --enable-gallium-llvm
confflags_GALLIUM += --enable-opencl --enable-opencl-icd
confflags_GALLIUM += ac_cv_path_LLVM_CONFIG=llvm-config-5.0
GALLIUM_DRIVERS += swrast
else
DRI_DRIVERS += swrast
confflags_GALLIUM += --disable-gallium-llvm
endif
# radv needs LLVM and the Vulkan loader, so only build on the subset of
# arches where we have LLVM enabled and where the Vulkan loader is built.
ifneq (,$(filter $(DEB_HOST_ARCH), amd64 arm64 armel armhf i386 mips mips64el mipsel powerpc ppc64 sparc64 ppc64el))
VULKAN_DRIVERS += radeon
endif
confflags_DIRECT_RENDERING = --enable-driglx-direct
confflags_GBM = --enable-gbm
confflags_GALLIUM += --enable-vdpau
confflags_GALLIUM += --enable-va
confflags_GALLIUM += --enable-gallium-extra-hud
confflags_GALLIUM += --enable-lmsensors
endif
# Disable assembly usage on x32 otherwise Mesa defaults to x86_64 assembly
# which doesn't work on x32 (see #758094)
ifneq (,$(filter $(DEB_HOST_ARCH), x32))
confflags += --disable-asm
endif
confflags_EGL = --with-platforms="$(EGL_PLATFORMS)"
confflags_GLES = --disable-gles1 --enable-gles2
confflags_GALLIUM += --with-gallium-drivers="$(GALLIUM_DRIVERS)"
confflags += \
--enable-dri \
--with-dri-drivers="$(DRI_DRIVERS)" \
--with-dri-driverdir=/usr/lib/$(DEB_HOST_MULTIARCH)/dri \
--with-dri-searchpath='/usr/lib/$(DEB_HOST_MULTIARCH)/dri:\$$$${ORIGIN}/dri:/usr/lib/dri' \
--with-vulkan-drivers="$(VULKAN_DRIVERS)" \
--enable-osmesa \
--enable-glx-tls \
--enable-shared-glapi \
--enable-texture-float \
--disable-xvmc \
--disable-omx-bellagio \
$(confflags_DIRECT_RENDERING) \
$(confflags_GBM) \
$(confflags_DRI3) \
$(confflags_EGL) \
$(confflags_GALLIUM) \
$(confflags_GLES) \
$(buildflags)
override_dh_clean:
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/*.in; do rm -f $${file%%.in}; done
rm -f src/compiler/nir/*.pyc
rm -f src/mapi/glapi/gen/*.pyc
rm -f src/mesa/main/*.pyc
rm -f src/gallium/auxiliary/util/*.pyc
dh_clean
override_dh_auto_configure:
dh_auto_configure -- \
$(confflags)
# hack to regenerate anv_entrypoints.{c,h} which are shipped with the tarball
rm -f src/intel/vulkan/anv_entrypoints.c src/intel/vulkan/anv_entrypoints.h
override_dh_auto_install:
dh_auto_install
for file in debian/*.in; \
do \
sed -e"s,\$${DEB_HOST_MULTIARCH},$(DEB_HOST_MULTIARCH),g" \
$${file} > $${file%%.in}; \
done
override_dh_auto_test:
allpkg = $(shell dh_listpackages -a)
override_dh_installchangelogs:
dh_installchangelogs -a
dh_installchangelogs -pmesa-common-dev
override_dh_install:
# Also get rid of other files which aren't installed. Do not
# use -f to ensure we notice disappearing files:
set -e; for file in $(NOT_INSTALLED); do rm debian/tmp/$$file; done
# Files only in git, not in tarballs, OK to use rm -f here:
set -e; for file in $(NOT_INSTALLED_EITHER); do rm -f debian/tmp/$$file; done
# purge .la files
find debian/tmp/ -name '*.la' -exec rm '{}' ';'
# 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/
# Remove vulkan headers only where they get installed in tmp
# We ship those headers via src:vulkan / libvulkan-dev
ifneq (,$(filter $(DEB_HOST_ARCH),amd64 i386 x32))
rm debian/tmp/usr/include/vulkan/vulkan_intel.h
rmdir debian/tmp/usr/include/vulkan
endif
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/
# 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
dh_install -a --fail-missing
# Create an ld.so.conf which says where to find libGL from Mesa
echo "/usr/lib/$(DEB_HOST_MULTIARCH)/mesa" \
> $(CURDIR)/debian/libgl1-mesa-glx/usr/lib/$(DEB_HOST_MULTIARCH)/mesa/ld.so.conf
# Empty directory for the alternative
mkdir -p $(CURDIR)/debian/libgl1-mesa-glx/usr/lib/$(DEB_HOST_MULTIARCH)/xorg/x11-extra-modules
# Create an ld.so.conf which says where to find libEGL, libGLES{1,2}
# from Mesa.
echo "/usr/lib/$(DEB_HOST_MULTIARCH)/mesa-egl" \
> $(CURDIR)/debian/libegl1-mesa/usr/lib/$(DEB_HOST_MULTIARCH)/mesa-egl/ld.so.conf
# 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,autoreconf,libva \
--parallel \
--builddirectory=build/
# For maintainer use only, generate a tarball:
gentarball: SOURCE=mesa
gentarball: UV=$(shell dpkg-parsechangelog|awk '/^Version:/ {print $$2}'|sed 's/-.*$$//')
gentarball:
git archive --format=tar upstream-experimental --prefix=$(SOURCE)-$(UV)/ | gzip -9 > ../$(SOURCE)_$(UV).orig.tar.gz
|