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
|
#!/usr/bin/make -f
EPOCH=6:
DEB_SOURCE := $(shell dpkg-parsechangelog | sed -n 's/^Source: //p')
DEB_VERSION := $(shell dpkg-parsechangelog | sed -n 's/^Version: //p')
UPSTREAM_VERSION := $(shell echo $(DEB_VERSION) | sed -r 's/[^:]+://; s/-[^-]+$$//')
SHLIBS_VERSION := $(EPOCH)11~beta1
# The libavcodec-extra package is necessary because it links against
# libraries that are GPLv3 licensed. Make sure that you do not link
# GPLv2 only applications against the libavcodec-extra flavor!
#
# Because of the lack of archive skew problems, only libavcodec produces
# an -extra variant.
VENDOR := Debian
# these package do not build -extra variants
LIB_PKGS := $(shell sed -nr 's/^Package:[[:space:]]*(lib(avutil|avdevice|avformat|avfilter|avresample|swscale)[0-9]+)[[:space:]]*$$/\1/p' debian/control)
# these packages do build -extra variants
LIB_PKGS2 := $(shell sed -nr 's/^Package:[[:space:]]*(libavcodec[0-9]+)[[:space:]]*$$/\1/p' debian/control)
# these packages are the -extra- variants
LIB_EXTRA_PKGS := $(shell sed -nr 's/^Package:[[:space:]]*(libavcodec-extra-[0-9]+)[[:space:]]*$$/\1/p' debian/control)
# these are the -dev packages
DEV_PKGS := $(shell echo $(LIB_PKGS) $(LIB_PKGS2) | sed 's/[0-9]\+\>/-dev/g')
# Support multiple makes at once
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
NUMJOBS = -j$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
else
# on i386 and amd64, we query the system unless overriden by DEB_BUILD_OPTIONS
ifeq ($(DEB_HOST_ARCH),i386)
NUMJOBS := -j$(shell getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1)
else ifeq ($(DEB_HOST_ARCH),amd64)
NUMJOBS := -j$(shell getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1)
endif
endif
include debian/confflags
OPT_FLAVORS := $(filter-out static shared, $(FLAVORS))
info:
@echo Packages that do not build -extra variants: $(LIB_PKGS)
@echo Packages that do build -extra variatnts: $(LIB_PKGS2)
@echo Packages that are the -extra- variants: $(LIB_EXTRA_PKGS)
$(info FLAVORS = $(FLAVORS))
$(info DEB_BUILD_OPTIONS = $(DEB_BUILD_OPTIONS))
$(info CFLAGS = $(CFLAGS))
$(info CPPFLAGS = $(CPPFLAGS))
$(info LDFLAGS = $(LDFLAGS))
define dh_install_file_opt_flavor
grep @DEB_HOST_MULTIARCH_OPT@ < $(1).in | \
sed 's:@DEB_HOST_MULTIARCH_OPT@:$(DEB_HOST_MULTIARCH)/$($(2)_shlibdir):g' >> $(1)
endef
DH_INSTALL_FILES := $(foreach pkg, $(LIB_PKGS) $(LIB_PKGS2) $(LIB_EXTRA_PKGS) $(DEV_PKGS), debian/$(pkg).install)
$(DH_INSTALL_FILES):
sed 's/@DEB_HOST_MULTIARCH\(_OPT\)\?@/$(DEB_HOST_MULTIARCH)/g' $@.in > $@
$(foreach opt_flavor,$(OPT_FLAVORS),$(call dh_install_file_opt_flavor,$@,$(opt_flavor)))
configure-%: configure-stamp-%
configure-stamp-%: configure
dh_testdir
mkdir -p debian-$*
cd debian-$* && CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" $(CURDIR)/configure \
$($*_build_confflags) $(extra_$*_build_confflags)
touch $@
configure-extra-stamp-%:
dh_testdir
mkdir -p debian-extra-$*
cd debian-extra-$* && CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" $(CURDIR)/configure \
$($*_build_confflags) $(v3_confflags) $(extra_$*_build_confflags)
touch $@
build-%: build-stamp-%
build-stamp-%: configure-stamp-%
dh_testdir
$(MAKE) -C debian-$* $(NUMJOBS) V=1
touch $@
build-extra-stamp-%: configure-extra-stamp-%
dh_testdir
$(MAKE) -C debian-extra-$* $(NUMJOBS) V=1
touch $@
debian-shared/tools/qt-faststart: build-stamp-shared
$(MAKE) -C debian-shared tools/qt-faststart V=1
build: build-stamp build-extra
build-stamp: $(addprefix build-stamp-, $(FLAVORS)) debian-shared/tools/qt-faststart
touch $@
build-extra: $(addprefix build-extra-stamp-, $(filter-out static,$(FLAVORS)))
touch $@
clean:
dh_testdir
rm -f build-stamp build-extra $(addprefix build-stamp-, $(FLAVORS)) \
$(addprefix build-extra-stamp-, $(FLAVORS)) \
$(addprefix configure-stamp-, $(FLAVORS)) \
$(addprefix configure-extra-stamp-, $(FLAVORS)) \
build-doxy-stamp
rm -rf libav/ # created by the libav-extra variant
rm -rf $(addprefix debian-, $(FLAVORS)) \
$(addprefix debian-extra-, $(FLAVORS)) doxy
dh_clean $(DH_INSTALL_FILES) $(wildcard formats*.txt) $(wildcard codecs*.txt)
# The trailing newline is important!
define install_flavor
$(MAKE) -C debian-$(1) install DESTDIR=$(CURDIR)/debian/tmp \
mandir=$(CURDIR)/debian/tmp/usr/share/man
endef
# The trailing newline is important!
define install_flavor_extra
$(MAKE) -C debian-extra-$(1) install DESTDIR=$(CURDIR)/debian/tmp/extra \
mandir=$(CURDIR)/debian/tmp/usr/share/man
endef
# usage $(call call_and_install_avconv_dump,$package,$parameter), paramter like "codecs" or "formats"
define call_and_install_avconv_dump
mkdir -p debian/$(1)/usr/share/doc/$(1)
env LD_LIBRARY_PATH="$(CURDIR)/debian/$(1)/usr/lib/$(DEB_HOST_MULTIARCH):$(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH):$(LD_LIBRARY_PATH)" \
debian/tmp/usr/bin/avconv -$(2) > debian/$(1)/usr/share/doc/$(1)/$(2)-$(DEB_HOST_ARCH).txt
cat debian/$(1)/usr/share/doc/$(1)/$(2)-$(DEB_HOST_ARCH).txt
endef
# installs arch-dependent files only
install: build $(DH_INSTALL_FILES)
dh_testdir
dh_testroot
dh_prep -a
$(foreach flavor,$(FLAVORS),$(call install_flavor,$(flavor)))
mkdir -p debian/tmp/etc
install -m 755 -D debian-shared/tools/qt-faststart debian/tmp/usr/bin/qt-faststart
dh_install $(addprefix -N,$(LIB_EXTRA_PKGS)) \
--fail-missing --sourcedir=debian/tmp
dh_installdocs -a doc/APIchanges
install -m 644 -D debian-shared/doc/*.html doc/t2h.init debian/libav-tools/usr/share/doc/libav-tools
dh_installexamples -a
dh_installchangelogs -a Changelog
$(foreach flavor,$(filter-out static,$(FLAVORS)),$(call install_flavor_extra,$(flavor)))
dh_install $(addprefix -p,$(LIB_EXTRA_PKGS)) --fail-missing \
--sourcedir=debian/tmp/extra
$(call call_and_install_avconv_dump,libavformat56,formats)
$(call call_and_install_avconv_dump,libavcodec56,codecs)
$(call call_and_install_avconv_dump,libavcodec-extra-56,codecs)
binary-indep:
dh_testdir
dh_testroot
dh_prep -i
doxygen doc/Doxyfile
mkdir -p debian/libav-doc/usr/share/doc/libav-doc
mv -v doc/doxy/html debian/libav-doc/usr/share/doc/libav-doc
dh_installdocs -i
dh_installchangelogs -i
dh_compress -i
dh_fixperms -i
dh_installdeb -i
dh_gencontrol -i
dh_md5sums -i
dh_builddeb -i -- -Zxz
binary-arch: build install
dh_testdir
dh_testroot
dh_installman -plibav-tools debian/qt-faststart.1
dh_strip -a --dbg-package=libav-dbg
dh_lintian -a
dh_link -a
dh_compress -a
dh_fixperms -a
# operate on non -extra package producing packages
for pkg in $(LIB_PKGS); do \
dh_makeshlibs -p"$$pkg" -V"$$pkg (>= $(SHLIBS_VERSION))"; \
done
# operate e.g. the -extra- packages, produce shlibs that have alternative dependencies
for pkg in $(LIB_EXTRA_PKGS); do \
npkg=$$(echo "$$pkg" | sed -r 's/-extra-//'); \
dh_makeshlibs -p"$$pkg" -V"$$npkg (>= $(SHLIBS_VERSION)) | $$pkg (>= $(EPOCH)$(UPSTREAM_VERSION))"; \
done
# operate on packages with -extra- variants such as libavcodec54 - produce shlibs that have alternative dependencies
for pkg in $(LIB_PKGS2); do \
upkg=$$(echo "$$pkg" | sed -r 's/([0-9]+)$$/-extra-\1/'); \
dh_makeshlibs -p"$$pkg" -V"$$pkg (>= $(SHLIBS_VERSION)) | $$upkg (>= $(EPOCH)$(UPSTREAM_VERSION))"; \
done
dh_shlibdeps
dh_installdeb -a
dh_gencontrol -a
dh_md5sums -a
dh_builddeb -a -- -Zxz
binary: binary-indep binary-arch
.PHONY: build $(addprefix build-, $(FLAVORS)) \
clean \
$(addprefix configure-, $(FLAVORS)) \
binary binary-indep binary-arch \
install install-common install-extra \
get-orig-source
|