DEBIAN: Debianization
[glsdk/gstreamer0-10.git] / debian / rules
1 #!/usr/bin/make -f
3 include /usr/share/cdbs/1/rules/debhelper.mk
4 include /usr/share/cdbs/1/class/autotools.mk
5 include /usr/share/cdbs/1/rules/utils.mk
6 -include /usr/share/cdbs/1/rules/autoreconf.mk
7 include /usr/share/gnome-pkg-tools/1/rules/clean-la.mk
9 export HOME=$(CURDIR)/fake-home
11 # make autoreconf not call libtoolize since we ship a patch for ltmain.sh
12 export LIBTOOLIZE=true
13 # make autoreconf not call autopoint since we ship a patch for po/Makefile.in.in
14 export AUTOPOINT=true
16 CFLAGS += -Wno-error
17 CXXFLAGS += -Wno-error
18 LDFLAGS += -Wl,-z,defs -Wl,-O1 -Wl,--as-needed
19 DEB_MAKE_CHECK_TARGET = check || true
21 # debian package version
22 version=$(shell dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2)
23 # upstream version
24 gst_version=$(shell echo $(version) | cut -d '-' -f 1)
25 gst_major=0
26 gst_minor=10
27 gst_abi=$(gst_major).$(gst_minor)
28 gst_pkgname=gstreamer$(gst_abi)
29 gst_lib_prefix=libgstreamer$(gst_abi)
30 # gstreamer library package names
31 gst_lib=$(gst_lib_prefix)-0
32 gst_lib_dev=$(gst_lib_prefix)-dev
33 # gstreamer shlibs
34 gst_shlibs_dep="$(gst_lib) (>= $(gst_version))"
36 # debug package
37 DEB_DH_STRIP_ARGS := --dbg-package=$(gst_lib)-dbg
39 DEB_COMPRESS_EXCLUDE = .sgml .devhelp .ps .pdf
41 DEB_INSTALL_DOCS_$(gst_lib)-dbg += common/gst.supp
43 # disable all CPU specific optimizations in commands launched by this Makefile
44 # using liboil; this is to work around liboil related build failures which
45 # are not specially interesting to catch on buildds as these might run very
46 # specific hardware
47 OIL_CPU_FLAGS=0
48 export OIL_CPU_FLAGS
50 PKGFILES=\
51         debian/$(gst_lib).install \
52         debian/$(gst_lib).symbols \
53         debian/$(gst_lib_dev).install \
54         debian/$(gst_pkgname)-doc.install \
55         debian/$(gst_pkgname)-doc.links \
56         debian/$(gst_pkgname)-doc.lintian \
57         debian/$(gst_pkgname)-tools.install \
58         debian/$(gst_pkgname)-tools.links \
59         debian/$(gst_pkgname)-tools.manpages \
60         debian/gir1.2-gstreamer-$(gst_abi).install
62 # Let's decide the package name and url depending on the distribution
63 DISTRO = "$(shell dpkg-vendor --query vendor)"
65 GST_PACKAGE_NAME := "GStreamer (unknown Debian derivative)"
66 GST_PACKAGE_ORIGIN="http://packages.qa.debian.org/gstreamer$(gst_abi)"
68 ifeq ($(DISTRO),"Debian")
69 GST_PACKAGE_NAME := "GStreamer (Debian)"
70 GST_PACKAGE_ORIGIN="http://packages.qa.debian.org/gstreamer$(gst_abi)"
71 endif
73 ifeq ($(DISTRO),"Ubuntu")
74 GST_PACKAGE_NAME := "GStreamer (Ubuntu)"
75 GST_PACKAGE_ORIGIN="https://launchpad.net/distros/ubuntu/+source/gstreamer$(gst_abi)"
76 endif
78 debian/control:: debian/control.in debian/rules
79         rm -f $@
80         cat $< | \
81                 sed 's/@GST_VERSION@/$(gst_version)/g' | \
82                 sed 's/@GST_PKGNAME@/$(gst_pkgname)/g' | \
83                 sed 's/@GST_ABI@/$(gst_abi)/g' | \
84                 sed 's/@GST_LIB_PREFIX@/$(gst_lib_prefix)/g' | \
85                 sed 's/@GST_LIB@/$(gst_lib)/g' | \
86                 sed 's/@GST_LIB_DEV@/$(gst_lib_dev)/g' \
87                 > $@
89 debian/$(gst_lib).dirs: debian/libgstreamer.dirs debian/rules
90         rm -f $@
91         cat $< | \
92                 sed 's/@GST_ABI@/$(gst_abi)/g' | \
93                 sed 's/@GST_PKGNAME@/$(gst_pkgname)/g' | \
94                 sed 's/@GST_LIB_PREFIX@/$(gst_lib_prefix)/g' \
95                 > $@
97 debian/$(gst_lib).install: debian/libgstreamer.install debian/rules
98         rm -f $@
99         cat $< | \
100                 sed 's/@GST_ABI@/$(gst_abi)/g' | \
101                 sed 's/@GST_PKGNAME@/$(gst_pkgname)/g' | \
102                 sed 's/@GST_LIB_PREFIX@/$(gst_lib_prefix)/g' \
103                 > $@
105 debian/$(gst_lib).symbols: debian/libgstreamer.symbols debian/rules
106         rm -f $@
107         cp -v $< $@
109 debian/gir1.2-gstreamer-$(gst_abi).install: debian/gir1.2-gstreamer.install debian/rules
110         rm -f $@
111         cp -v $< $@
113 debian/$(gst_lib_dev).install: debian/libgstreamer-dev.install debian/rules
114         rm -f $@
115         cat $< | \
116                 sed 's/@GST_ABI@/$(gst_abi)/g' | \
117                 sed 's/@GST_PKGNAME@/$(gst_pkgname)/g' | \
118                 sed 's/@GST_LIB_PREFIX@/$(gst_lib_prefix)/g' \
119                 > $@
121 debian/$(gst_pkgname)-doc.install: debian/gstreamer-doc.install debian/rules
122         rm -f $@
123         cat $< | \
124                 sed 's/@GST_ABI@/$(gst_abi)/g' | \
125                 sed 's/@GST_PKGNAME@/$(gst_pkgname)/g' | \
126                 sed 's/@GST_LIB_PREFIX@/$(gst_lib_prefix)/g' \
127                 > $@
129 debian/$(gst_pkgname)-doc.links: debian/gstreamer-doc.links debian/rules
130         rm -f $@
131         cat $< | \
132                 sed 's/@GST_ABI@/$(gst_abi)/g' | \
133                 sed 's/@GST_PKGNAME@/$(gst_pkgname)/g' | \
134                 sed 's/@GST_LIB_PREFIX@/$(gst_lib_prefix)/g' \
135                 > $@
137 debian/$(gst_pkgname)-doc.lintian: debian/gstreamer-doc.lintian debian/rules
138         rm -f $@
139         cat $< | \
140                 sed 's/@GST_ABI@/$(gst_abi)/g' | \
141                 sed 's/@GST_PKGNAME@/$(gst_pkgname)/g' | \
142                 sed 's/@GST_LIB_PREFIX@/$(gst_lib_prefix)/g' \
143                 > $@
145 debian/$(gst_pkgname)-tools.install: debian/gstreamer-tools-abi.install debian/rules
146         rm -f $@
147         cat $< | \
148                 sed 's/@GST_ABI@/$(gst_abi)/g' | \
149                 sed 's/@GST_PKGNAME@/$(gst_pkgname)/g' | \
150                 sed 's/@GST_LIB_PREFIX@/$(gst_lib_prefix)/g' \
151                 > $@
153 debian/$(gst_pkgname)-tools.links: debian/gstreamer-tools-abi.links debian/rules
154         rm -f $@
155         cat $< | \
156                 sed 's/@GST_ABI@/$(gst_abi)/g' | \
157                 sed 's/@GST_PKGNAME@/$(gst_pkgname)/g' | \
158                 sed 's/@GST_LIB_PREFIX@/$(gst_lib_prefix)/g' \
159                 > $@
161 debian/$(gst_pkgname)-tools.manpages: debian/gstreamer-tools-abi.manpages debian/rules
162         rm -f $@
163         cat $< | \
164                 sed 's/@GST_ABI@/$(gst_abi)/g' | \
165                 sed 's/@GST_PKGNAME@/$(gst_pkgname)/g' | \
166                 sed 's/@GST_LIB_PREFIX@/$(gst_lib_prefix)/g' \
167                 > $@
169 maint: debian/control
171 pre-build:: $(PKGFILES)
173 clean::
174         for f in $(PKGFILES); do \
175                 rm -f $$f; \
176         done
177         -rm -f debian/shlibs.local
178         -rm -rf $(CURDIR)/fake-home
180 common_conf_flags = \
181         --disable-failing-tests \
182         --disable-examples \
183         --enable-DEBUG \
184         --enable-debug \
185         --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \
186         --libexecdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH)/gstreamer0.10 \
187         --with-package-name=$(GST_PACKAGE_NAME) \
188         --with-package-origin=$(GST_PACKAGE_ORIGIN) \
189         --with-buffer-alignment=128 \
190         --disable-examples \
191         --disable-tests \
192         --disable-failing-tests \
193         --disable-valgrind
195 indep_conf_flags = \
196         --with-html-dir=\$${prefix}/share/doc/$(gst_pkgname)-doc
198 # only build the docs if gtk-doc-tools is installed, i.e. binary-indep is
199 # called
200 ifeq ($(shell test "`dpkg -l gtk-doc-tools | grep ^ii`" && echo binary-indep),binary-indep)
201 indep_conf_flags += --enable-gtk-doc --enable-docbook
202 endif
204 DEB_CONFIGURE_EXTRA_FLAGS := $(common_conf_flags) $(indep_conf_flags)
206 common-install-indep::
207         # move around the doc dirs
208         mkdir -p debian/tmp/usr/share/doc/$(gst_pkgname)-doc
209         -cp -r debian/tmp/usr/share/doc/gstreamer-$(gst_abi)/pwg \
210            debian/tmp/usr/share/doc/gstreamer-$(gst_abi)/manual \
211            debian/tmp/usr/share/doc/gstreamer-$(gst_abi)/faq \
212            debian/tmp/usr/share/doc/$(gst_pkgname)-doc
214         # -doc lintian overrides
215         mkdir -p debian/$(gst_pkgname)-doc/usr/share/lintian/overrides/
216         cp -a debian/$(gst_pkgname)-doc.lintian debian/$(gst_pkgname)-doc/usr/share/lintian/overrides/$(gst_pkgname)-doc
218 DEB_DH_MAKESHLIBS_ARGS_$(gst_lib) += -X "/usr/lib/$(DEB_HOST_MULTIARCH)/gstreamer-$(gst_abi)" -V $(gst_shlibs_dep) -- -c4
219 DEB_INSTALL_DOCS_ALL += debian/README.Debian NEWS
220 DEB_SHLIBDEPS_INCLUDE += debian/$(gst_lib)/usr/lib/$(DEB_HOST_MULTIARCH)
222 # override shlibs for libraries from this source before computing dependencies
223 # of packages generated from this source; we already have inter-dependencies
224 # expressed manually in the control file, we do not need the shlibs to add
225 # duplicates
226 # (this rule runs just before the dh_shlibdeps)
227 common-binary-fixup-arch::
228         mkdir -p $(CURDIR)/fake-home
229         HOME=$(CURDIR)/fake-home \
230         dh_girepository -pgir1.2-gstreamer-$(gst_abi)
231         rm -rf $(CURDIR)/fake-home
232         -rm -f debian/shlibs.local
233         cat debian/*/DEBIAN/shlibs | \
234                 sed -n -r -e 's/(([^ ]+: )?([^ ]+) ([^ ]+)) .*/\1/p' \
235                         > debian/shlibs.local
237 # (this rules runs just after the dh_shlibdeps)
238 common-binary-predeb-arch::
239         -rm -f debian/shlibs.local
241 install/$(gst_lib_dev)::
242         gcc -o debian/tmp/usr/bin/gst-codec-info-0.10 debian/gst-codec-info.c $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) `pkg-config --libs --cflags glib-2.0 gthread-2.0 gmodule-no-export-2.0 gobject-2.0 libxml-2.0` debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libgstreamer-0.10.so -Idebian/tmp/usr/include/gstreamer-0.10
243         perldoc -o man debian/dh_gstscancodecs > debian/tmp/usr/share/man/man1/dh_gstscancodecs.1
245 .PHONY: maint