[PATCH 9/9] Fix and improve debian/rules.
Jon Severinsson
jon at severinsson.net
Fri Sep 6 14:41:05 UTC 2013
Propperly enables paralell make, enforces a clear separation between build/install/binay and indep/arch steps, minor cleanups, etc.
Also fixes a bug causing the extra version of libavcodec.so.54.35.0 gets installed in both libavcodec54 and libavcodec-extra-54.
---
debian/rules | 134 +++++++++++++++++++++++++++++-----------------------------
1 fil ändrad, 68 tillägg(+), 66 borttagningar(-)
diff --git a/debian/rules b/debian/rules
index 6b554bae..b6c4c328 100755
--- a/debian/rules
+++ b/debian/rules
@@ -52,14 +52,12 @@ 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
+ NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+ MAKEFLAGS += -j$(NUMJOBS)
+else ifneq (,$(filter $(DEB_HOST_ARCH_CPU), amd64 i386))
+ # on i386 and amd64, we query the system unless overriden by DEB_BUILD_OPTIONS
+ NUMJOBS := $(shell getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1)
+ MAKEFLAGS += -j$(NUMJOBS)
endif
include debian/confflags
@@ -90,50 +88,53 @@ else
CONFIGURE := configure
endif
-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-%:
+configure-extra-stamp-%: $(CONFIGURE)
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
+ $(MAKE) -C debian-$* V=1
touch $@
build-extra-stamp-%: configure-extra-stamp-%
dh_testdir
- $(MAKE) -C debian-extra-$* $(NUMJOBS) V=1
+ $(MAKE) -C debian-extra-$* 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
+build-doxy-stamp:
+ dh_testdir
+ doxygen doc/Doxyfile
touch $@
+
+build: build-common build-extra build-doxy
+build-common: $(addprefix build-stamp-, $(FLAVORS)) debian-shared/tools/qt-faststart
build-extra: $(addprefix build-extra-stamp-, $(filter-out static,$(FLAVORS)))
- touch $@
+build-doxy: build-doxy-stamp
clean:
dh_testdir
- rm -f build-stamp build-extra $(addprefix build-stamp-, $(FLAVORS)) \
+ rm -f $(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)
+ $(addprefix debian-extra-, $(FLAVORS)) \
+ doc/doxy/html
+ dh_clean $(DH_INSTALL_FILES)
# The trailing newline is important!
define install_flavor
@@ -144,65 +145,54 @@ 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
+ $(MAKE) -C debian-extra-$(1) install DESTDIR=$(CURDIR)/debian/tmp-extra \
+ mandir=$(CURDIR)/debian/tmp-extra/usr/share/man
endef
-# installs arch-dependent files only
install: install-common install-extra
-install-common: build $(DH_INSTALL_FILES)
+install-common: build-common
+ # Installs stuff to debian/tmp
dh_testdir
dh_testroot
- dh_prep -a
$(foreach flavor,$(FLAVORS),$(call install_flavor,$(flavor)))
mkdir -p debian/tmp/etc
install -m 644 -D doc/avserver.conf debian/tmp/etc/
install -m 644 -D debian-shared/tools/qt-faststart debian/tmp/usr/bin/qt-faststart
- dh_install -a $(addprefix -N,$(LIB_EXTRA_PKGS)) \
- --fail-missing --sourcedir=debian/tmp
env LD_LIBRARY_PATH="$(LD_LIBRARY_PATH):$(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)" \
- debian/tmp/usr/bin/avconv -formats | tee formats-$(DEB_HOST_ARCH).txt
+ debian/tmp/usr/bin/avconv -formats | tee debian-shared/formats-$(DEB_HOST_ARCH).txt
env LD_LIBRARY_PATH="$(LD_LIBRARY_PATH):$(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)" \
- debian/tmp/usr/bin/avconv -codecs | tee codecs.txt
- dh_installdocs -plibavformat54 formats-$(DEB_HOST_ARCH).txt
- dh_installdocs -plibavcodec54 codecs.txt
-install-extra: build $(DH_INSTALL_FILES)
+ debian/tmp/usr/bin/avconv -codecs | tee debian-shared/codecs-$(DEB_HOST_ARCH).txt
+ifeq ($(DEB_SOURCE), libav)
+ # the libav-source package does exist in some derivatives such as ubuntu, etc.
+ if grep -q 'Package: libav-source' debian/control; then \
+ mkdir -p debian/tmp/usr/src; \
+ tar czvf debian/tmp/usr/src/libav-source.tar.gz . \
+ --exclude 'debian*' --exclude 'doc/doxy/html' --exclude .git --exclude .pc --exclude '*-stamp-*' \
+ --transform 's,^./,libav/,' ; \
+ fi
+endif
+install-extra: build-extra
+ # Installs stuff to debian/tmp-extra
dh_testdir
dh_testroot
$(foreach flavor,$(filter-out static,$(FLAVORS)),$(call install_flavor_extra,$(flavor)))
- dh_install -a $(addprefix -p,$(LIB_EXTRA_PKGS)) --fail-missing \
- --sourcedir=debian/tmp/extra
- env LD_LIBRARY_PATH="$(LD_LIBRARY_PATH):$(CURDIR)/debian/tmp/extra/usr/lib/$(DEB_HOST_MULTIARCH)" \
- debian/tmp/usr/bin/avconv -codecs | tee codecs.txt
- dh_installdocs -plibavcodec-extra-54 codecs.txt
-ifeq ($(DEB_SOURCE), libav)
- dh_installdocs -a doc/APIchanges
- install -m 644 -D debian-shared/doc/*.html debian/libav-tools/usr/share/doc/libav-tools
- dh_installexamples -p libavcodec-dev libavcodec/api-example.c
- dh_installchangelogs -a Changelog
-else
- dh_installchangelogs -a libav/Changelog
-endif
+ env LD_LIBRARY_PATH="$(LD_LIBRARY_PATH):$(CURDIR)/debian/tmp-extra/usr/lib/$(DEB_HOST_MULTIARCH)" \
+ debian/tmp-extra/usr/bin/avconv -codecs | tee debian-extra-shared/codecs-$(DEB_HOST_ARCH).txt
-binary-indep:
-ifeq ($(DEB_SOURCE), libav)
+binary-indep: install-common build-doxy $(DH_INSTALL_FILES)
dh_testdir
dh_testroot
- dh_prep -i
- # the libav-source package does exist in some derivatives such as ubuntu, etc.
- if grep -q 'Package: libav-source' debian/control; then \
- dh_installdirs -ptmp usr/src; \
- tar czvf debian/tmp/usr/src/libav-source.tar.gz . \
- --exclude 'debian*' --exclude .git --exclude .pc --exclude '*-stamp' \
- --transform 's,^./,libav/,' ; \
- fi
+ dh_install -i --fail-missing --sourcedir=debian/tmp
+ dh_installdocs -i -A debian/README.Debian
+ dh_installdocs -plibav-doc doc/APIchanges doc/doxy/html
+ifeq ($(DEB_SOURCE), libav)
+ dh_installchangelogs -i Changelog
+else
+ dh_installchangelogs -i libav/Changelog
endif
- 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_link -i
+ dh_lintian -i
dh_compress -i
dh_fixperms -i
dh_installdeb -i
@@ -210,17 +200,30 @@ endif
dh_md5sums -i
dh_builddeb -i -- -Zxz
-binary-arch: build install
+binary-arch: install-common install-extra $(DH_INSTALL_FILES)
dh_testdir
dh_testroot
+ dh_install -a $(addprefix -N,$(LIB_EXTRA_PKGS)) \
+ --fail-missing --sourcedir=debian/tmp
+ dh_install $(addprefix -p,$(LIB_EXTRA_PKGS)) \
+ --fail-missing --sourcedir=debian/tmp-extra
+ dh_installdocs -a -A debian/README.Debian
+ dh_installdocs -plibav-tools debian-shared/doc/*.html
+ dh_installdocs -plibavformat54 debian-shared/formats-$(DEB_HOST_ARCH).txt
+ dh_installdocs -plibavcodec54 debian-shared/codecs-$(DEB_HOST_ARCH).txt
+ dh_installdocs -plibavcodec-extra-54 debian-extra-shared/codecs-$(DEB_HOST_ARCH).txt
+ dh_installdocs $(addprefix -p,$(DEV_PKGS)) -A doc/APIchanges
+ dh_installexamples -plibavcodec-dev libavcodec/api-example.c
dh_installman -plibav-tools debian/qt-faststart.1
ifeq ($(DEB_SOURCE), libav)
+ dh_installchangelogs Changelog
dh_strip -a --dbg-package=libav-dbg
else
+ dh_installchangelogs libav/Changelog
dh_strip -a --dbg-package=libav-extra-dbg
endif
- dh_lintian -a
dh_link -a
+ dh_lintian -a
dh_compress -a
dh_fixperms -a
@@ -239,6 +242,7 @@ endif
dh_makeshlibs -p"$$pkg" -V"$$pkg (>= $(SHLIBS_VERSION)) | $$upkg (>= $(EPOCH)$(UPSTREAM_VERSION))"; \
done
dh_shlibdeps
+
dh_installdeb -a
dh_gencontrol -a
dh_md5sums -a
@@ -246,9 +250,7 @@ endif
binary: binary-indep binary-arch
-.PHONY: build $(addprefix build-, $(FLAVORS)) \
- clean \
- configure $(addprefix configure-, $(FLAVORS)) \
- binary binary-indep binary-arch \
+.PHONY: build build-common build-extra build-doxy \
install install-common install-extra \
- get-orig-source
+ binary binary-common binary-indep binary-arch \
+ clean
--
1.7.10.4
More information about the pkg-multimedia-maintainers
mailing list