File: rules

package info (click to toggle)
ffmpeg 7%3A8.0.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 111,180 kB
  • sloc: ansic: 1,348,518; asm: 145,582; sh: 9,273; makefile: 5,323; cpp: 3,451; lisp: 1,771; perl: 1,303; objc: 1,058; python: 120; awk: 56; ruby: 51
file content (325 lines) | stat: -rwxr-xr-x 10,057 bytes parent folder | download
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
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
#!/usr/bin/make -f

export V=1

# sets DEBIAN_VERSION variable
include /usr/share/dpkg/pkg-info.mk

# sets DEB_HOST_* variables
include /usr/share/dpkg/architecture.mk

# Ubuntu ld adds -Bsymbolic-functions by default, but that prevents FFmpeg from building.
export DEB_LDFLAGS_MAINT_STRIP=-Wl,-Bsymbolic-functions

# Package name for the extra flavor.
SHLIB_PKGS := $(shell sed -nr '/extra/! s/^Package:[[:space:]]*(lib.*[0-9]+)[[:space:]]*$$/\1/p' debian/control)
EXTRA_PKGS := $(shell sed -nr 's/^Package:[[:space:]]*(.*extra[0-9]+)[[:space:]]*$$/\1/p' debian/control)
FLAVORS = standard
ifeq ($(filter pkg.ffmpeg.noextra,$(DEB_BUILD_PROFILES)),)
FLAVORS += extra
endif

# Most possible features, compatible with effective licensing of GPLv2+
CONFIG := \
	--prefix=/usr \
	--extra-version="$(DEB_VERSION_REVISION)" \
	--toolchain=hardened \
	--libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
	--incdir=/usr/include/$(DEB_HOST_MULTIARCH) \
	--arch=$(DEB_HOST_ARCH_CPU) \
	--enable-gpl \
	--disable-stripping \
	--disable-pocketsphinx \
	--disable-libcaca \
	--disable-libmfx \
	--disable-omx \
	--enable-gnutls \
	--enable-libaom \
	--enable-libass \
	--enable-libbs2b \
	--enable-libcdio \
	--enable-libcodec2 \
	--enable-libdav1d \
	--enable-libflite \
	--enable-libfontconfig \
	--enable-libfreetype \
	--enable-libfribidi \
	--enable-libglslang \
	--enable-libgme \
	--enable-libgsm \
	--enable-libharfbuzz \
	--enable-libmp3lame \
	--enable-libmysofa \
	--enable-libopenjpeg \
	--enable-libopenmpt \
	--enable-libopus \
	--enable-librubberband \
	--enable-libshine \
	--enable-libsnappy \
	--enable-libsoxr \
	--enable-libspeex \
	--enable-libtheora \
	--enable-libtwolame \
	--enable-libvidstab \
	--enable-libvorbis \
	--enable-libvpx \
	--enable-libwebp \
	--enable-libx265 \
	--enable-libxml2 \
	--enable-libxvid \
	--enable-libzimg \
	--enable-openal \
	--enable-opencl \
	--enable-opengl

# disable sndio, it's pulled in via libopenal-dev and autodetected
CONFIG += --disable-sndio

ifeq (amd64,$(DEB_HOST_ARCH))
	CONFIG += --enable-libvpl
else
	CONFIG += --disable-libvpl
endif

# The standard configuration only uses the shared CONFIG.
CONFIG_standard = --enable-shared

# Additional features, compatible with effective licensing of GPLv3+
CONFIG_extra = \
	--enable-shared \
	--enable-version3 \
	--disable-doc \
	--disable-programs \
	--disable-static \
	--enable-libaribb24 \
	--enable-libopencore_amrnb \
	--enable-libopencore_amrwb \
	--enable-libtesseract \
	--enable-libvo_amrwbenc

# Do not enable libsmbclient support on hurd-i386
ifeq (,$(filter hurd-i386,$(DEB_HOST_ARCH)))
	CONFIG_extra += --enable-libsmbclient
endif

# Disable optimizations if requested.
ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
	CONFIG += --disable-optimizations
endif

# Respect CC/CXX from the environment, if they differ from the default.
# Don't set them if they equal the default, because that disables autodetection needed for cross-building.
ifneq (cc,$(CC))
	CONFIG += --cc=$(CC)
endif
ifneq (g++,$(CXX))
	CONFIG += --cxx=$(CXX)
endif

# Some libraries are built only on linux.
ifeq (linux,$(DEB_HOST_ARCH_OS))
	CONFIG += \
		--enable-libdc1394 \
		--enable-libdrm \
		--enable-libiec61883
endif

# ffmpeg is involved in build-dependency cycles with x264 and chromaprint, so disable them in stage one.
# Also disable
# - frei0r, which build-depends on opencv.
# - rav1e and rsvg2 for bootstrap to avoid a complete rust toolchain.
# - network protocols srt, ssh, zmq, rabbitmq, rist, ...
# - device access bluray, jack, dvd, ...
# - optional features pocketsphix, zvbi, ladsap, lv2, sdl2, ...
ifneq (,$(filter pkg.ffmpeg.stage1,$(DEB_BUILD_PROFILES)))
	CONFIG += \
		--disable-chromaprint \
		--disable-frei0r \
		--disable-ladspa \
		--disable-libbluray \
		--disable-libdvdnav \
		--disable-libdvdread \
		--disable-libjack \
		--disable-libxjl \
		--disable-libjxl \
		--disable-libplacebo \
		--disable-libpulse \
		--disable-librabbitmq \
		--disable-librav1e \
		--disable-librist \
		--disable-librsvg \
		--disable-libsrt \
		--disable-libssh \
		--disable-libsvtav1 \
		--disable-libx264 \
		--disable-libzmq \
		--disable-libzvbi \
		--disable-lv2 \
		--disable-sdl2
else
	CONFIG += \
		--enable-chromaprint \
		--enable-frei0r \
		--enable-ladspa \
		--enable-libbluray \
		--enable-libdvdnav \
		--enable-libdvdread \
		--enable-libjack \
		--enable-libjxl \
		--enable-libpulse \
		--enable-librabbitmq \
		--enable-librist \
		--enable-libsrt \
		--enable-libssh \
		--enable-libsvtav1 \
		--enable-libx264 \
		--enable-libzmq \
		--enable-libzvbi \
		--enable-lv2 \
		--enable-sdl2
# Some libraries are built only on linux.
ifeq (linux,$(DEB_HOST_ARCH_OS))
	CONFIG += --enable-libplacebo
else
	CONFIG += --disable-libplacebo
endif
# Rust is not available on most of ports.
ifeq (,$(filter alpha hppa hurd-i386 m68k sh4 sparc64 x32,$(DEB_HOST_ARCH)))
	CONFIG += --enable-librav1e
else
	CONFIG += --disable-librav1e
endif
# avoid librsvg on almost all ports (bug#983344, bug#991556)
ifeq (,$(filter alpha hppa hurd-i386 m68k sh4 x32,$(DEB_HOST_ARCH)))
	CONFIG += --enable-librsvg
else
	CONFIG += --disable-librsvg
endif
endif

# Disable ASM-based optimizations on powerpc and ppc64{,el}.
# They are currently not maintained and broken:
# * https://trac.ffmpeg.org/ticket/9604
# * https://trac.ffmpeg.org/ticket/10955
ifneq (,$(filter powerpc ppc64 ppc64el,$(DEB_HOST_ARCH)))
	CONFIG += --disable-asm
endif

# Disable assembly optimizations on x32, because they don't work (yet).
ifneq (,$(filter x32,$(DEB_HOST_ARCH)))
	CONFIG += --disable-asm
endif

# Disable some tests which fail when FLT_EVAL_METHOD != 0 (found on i386, m68k and s390x)
ifneq (,$(filter i386 m68k s390x,$(DEB_HOST_ARCH_CPU)))
	CONFIG += --ignore-tests=hapenc-hap-none,hapenc-hapa-none,hapenc-hapq-none
endif
# Disable new tests that were never successful on ppc64el
# (introduced in 5fdb5ed6132687219d0ef2127115ebaf95514058)
# https://trac.ffmpeg.org/ticket/9604
ifeq (ppc64el,$(DEB_HOST_ARCH))
	CONFIG += --ignore-tests=checkasm-sw_scale,filter-scale2ref_keep_aspect
endif
# https://trac.ffmpeg.org/ticket/9855
ifneq (,$(filter hppa m68k powerpc sparc64 s390x,$(DEB_HOST_ARCH_CPU)))
	CONFIG += --ignore-tests=filter-overlay_yuv420p10
endif
ifeq (ppc64,$(DEB_HOST_ARCH))
	CONFIG += --ignore-tests=checkasm-sw_scale,filter-overlay_yuv420p10
endif

# Set cross-build prefix for compiler, pkg-config...
ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
	CONFIG += \
		--cross-prefix=$(DEB_HOST_GNU_TYPE)- \
		--target-os=$(DEB_HOST_ARCH_OS)
endif

%:
	dh $@

# Add configuration options:
override_dh_auto_configure: $(patsubst %,configure_%,$(FLAVORS))
configure_%:
	$(info $()   debian/rules $@)
	mkdir -p debian/$*
	cd debian/$* && ../../configure $(strip $(CONFIG) $(CONFIG_$*)) || (cat ffbuild/config.log && exit 1)

# Remove the subdirectories generated for the flavors.
override_dh_auto_clean:
	rm -rf $(patsubst %,debian/%,$(FLAVORS))

# Create doxygen documentation:
override_dh_auto_build-indep:
	dh_auto_build -i --sourcedirectory=debian/standard -- apidoc documentation
	# Create the minified CSS files.
	#  Due to https://github.com/nodejs/node/issues/14752 where nodejs will
	#  leave set O_NONBLOCK on stderr, we pipe stderr through cat which will
	#  create a temporary pipe so this doesn't break the rest of the build.
	#  See: #895154
	(lessc debian/missing-sources/ffmpeg-web/src/less/style.less | cleancss > debian/standard/doc/style.min.css) 2>&1 | cat >&2

override_dh_auto_build-arch: $(patsubst %,build_%,$(FLAVORS))

# noop fallback for below more specific targets
prebuild_%:
	:

# Copy built object files to avoid building them again for the extra flavor.
$(patsubst %,prebuild_%,$(filter %extra,$(FLAVORS))): prebuild_%: build_standard
	$(info $()   debian/rules $@)
	$(eval subdir = debian/$(subst extra,standard,$(subst -extra,,$*)))
	cd $(subdir) && find libavcodec libavdevice libavfilter libavformat libavutil libswscale libswresample \
		-type f -name '*.o' \
		-exec install -m 644 -D -T '{}' '../$*/{}' ';'
	rm debian/$*/libavcodec/allcodecs.o
	rm debian/$*/libavfilter/allfilters.o

# Build qt-faststart here, to make it possible to build with 'nocheck'.
prebuild_standard:
	$(info $()   debian/rules $@)
	$(MAKE) -C debian/standard tools/qt-faststart

build_%: prebuild_%
	$(info $()   debian/rules $@)
	dh_auto_build -a --sourcedirectory=debian/$* || (cat debian/$*/config.log && exit 1)

# Set the library path for the dynamic linker, because the tests otherwise don't find the libraries.
override_dh_auto_test-arch:
	export LD_LIBRARY_PATH="libavcodec:libavdevice:libavfilter:libavformat:libavutil:libswresample:libswscale"; \
		dh_auto_test -a --sourcedirectory=debian/standard -- -k

# No tests for indep build.
override_dh_auto_test-indep:

override_dh_auto_install-arch:
	dh_auto_install -a --sourcedirectory=debian/standard
ifeq ($(filter pkg.ffmpeg.noextra,$(DEB_BUILD_PROFILES)),)
	dh_auto_install -a --sourcedirectory=debian/extra --destdir=debian/tmp/extra
endif

override_dh_auto_install-indep:
	$(MAKE) -C debian/standard DESTDIR=$(CURDIR)/debian/tmp install-doc install-examples
	# Create index.html page for the FFmpeg manual
	cd debian/tmp/usr/share/doc/ffmpeg && tree -H '.' -L 1 -P '*.html' --noreport --charset utf-8 -T 'FFmpeg Manual Index' -o index.html

override_dh_install:
ifeq ($(filter pkg.ffmpeg.noextra,$(DEB_BUILD_PROFILES)),)
	dh_install $(addprefix -p,$(EXTRA_PKGS)) --sourcedir=debian/tmp/extra
endif
	dh_install --remaining-packages

debian/%.symbols: debian/%.symbols.in
	sed 's/@DEB_VERSION@/${DEB_VERSION}/;s/@DEB_VERSION_EPOCH_UPSTREAM@/${DEB_VERSION_EPOCH_UPSTREAM}/' $< > $@

execute_before_dh_makeshlibs: $(patsubst %,debian/%.symbols,$(SHLIB_PKGS))
ifeq ($(filter pkg.ffmpeg.noextra,$(DEB_BUILD_PROFILES)),)
	set -e && for pkg in $(EXTRA_PKGS); do \
		mainpkg=`echo $$pkg | sed 's/-extra//'`; \
		cp -f debian/$$mainpkg.symbols debian/$$pkg.symbols; \
	done
endif

# avoid error: Unknown DWARF DW_OP_0
override_dh_dwz:
	dh_dwz -Xlibavcodec -Xlibavfilter -Xlibavutil -Xlibswresample -Xlibswscale