Bug#735742: [x264] fix the circular build dependency with libav and others

Peter Pentchev roam at ringlet.net
Thu Jun 19 15:43:08 UTC 2014


Hi,

As part of this year's "Bootstrappable Debian" Google Summer of Code
project I took a look at x264 to break a circular build dependency as
noted in the "Feedback Arc Set" section of
http://bootstrap.debian.net/amd64/ and, more specifically, at
http://bootstrap.debian.net/source/x264.html and the version-specific
pages linked from it.  There are two primary goals to my work on this
GSoC project:
- The first goal is to modify some packages so that they may be built in
  some limited way ("nocheck", binary-only, or build profiles like
  "stage1") without some of their usual build dependencies.  In most
  cases this is caused by one or more dependency loops between binary
  and source packages, so that a source package requires for its
  building, directly or indirectly, one of its own binary packages to be
  already built.  The modifications make the source build in a limited
  fashion (not generating documentation, not running tests, not building
  some of the binary packages) so that this may happen with only the
  rest of the build dependencies, so Debian may be bootstrapped on a new
  architecture starting from a very few cross-built toolchain packages
  and then moving along, source package by source package.
- The second goal, which is actually closely related to the first, is
  that in the process of modifications, any changes (some files not
  regenerated, others not built at all) can be made with binary package
  level granularity.  This means that if a binary package is built at
  all during a limited build, then it must have the same contents as the
  same binary package resulting from a full build.  The point here is to
  avoid breakage if other packages in the archive depend on some
  functionality provided by the omitted files; if so, it should be
  obvious that the functionality is missing, and the clearest way to do
  that is by omitting a full binary package or, rather, delaying its
  build until the rest of the build dependencies are present.

With x264, both goals may be achieved by not building the x264 binary
package itself in the special "stage1" build profile.  Thus, if just the
library packages are built in the "stage1" profile (with the offending
build dependencies removed), then they may be used for the build of
libavformat, libffms2 and libgpac, and then the bootstrapping process
may return to the build of the x264 binary package.

Here's a patch that does this: if we are building in the "stage1"
profile, the configure script is invoked with --disable-* and the rules
file does not build the x264 binary package at all.  This still leaves
the build dependencies in the control file; a separate bug will be filed
for that, modifying the control file to add instructions to drop these
dependencies in the stage1 profile.  Unfortunately, the Debian archive
infrastructure cannot yet deal with these annotations, so that bug will
most probably have to wait until Jessie is released.

If something goes wrong with the patch, it is also available at
https://gitorious.org/roam-debian-bootstrap/x264-debian/commits/roam-stage1-build

Thanks in advance for your time, and thanks for your work on Debian!

G'luck,
Peter

-- 
Peter Pentchev  roam at ringlet.net roam at FreeBSD.org p.penchev at storpool.com
PGP key:        http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint 2EE7 A7A5 17FC 124C F115  C354 651E EFB0 2527 DF13
-------------- next part --------------
From f0b2e1f5da32ee903fbea21e96bc24b479a49d94 Mon Sep 17 00:00:00 2001
From: Peter Pentchev <roam at ringlet.net>
Date: Thu, 19 Jun 2014 16:42:17 +0300
Subject: [PATCH 1/2] Build only the library in the stage1 build profile.

If DEB_BUILD_PROFILES contains "stage1", do not build the x264 utility
and thus do not look for the video libraries in the configure stage.
---
 debian/confflags  |  4 ++++
 debian/control.in |  1 +
 debian/rules      | 12 +++++++++---
 3 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/debian/confflags b/debian/confflags
index 95abb94..88e1cf7 100644
--- a/debian/confflags
+++ b/debian/confflags
@@ -20,6 +20,10 @@ endif
 
 common_confflags += --prefix=/usr --libdir=/usr/lib/$(DEB_HOST_MULTIARCH)
 
+ifneq (,$(filter stage1,$(DEB_BUILD_PROFILES)))
+common_confflags += --disable-avs --disable-ffms --disable-gpac
+endif
+
 # XXX why isn't --enable-visualize used in the static build?
 # TODO --disable-asm when we build an opt flavor?
 static_confflags += \
diff --git a/debian/control.in b/debian/control.in
index 4e8fb42..770a83f 100644
--- a/debian/control.in
+++ b/debian/control.in
@@ -6,6 +6,7 @@ Uploaders:
  Reinhard Tartler <siretart at tauware.de>,
  Fabian Greffrath <fabian+debian at greffrath.com>,
  Rico Tzschichholz <ricotz at ubuntu.com>
+# In the stage1 build profile, drop the libavformat-dev, libffms2-dev and libgpac-dev dependencies.
 Build-Depends:
  debhelper (>= 8.1.3~),
  autotools-dev,
diff --git a/debian/rules b/debian/rules
index ad922e5..f991ef3 100755
--- a/debian/rules
+++ b/debian/rules
@@ -7,13 +7,19 @@ DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 DEB_HOST_GNU_CPU    ?= $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)
 
+ifeq (,$(filter stage1,$(DEB_BUILD_PROFILES)))
+dh_exclude=
+else
+dh_exclude=	-Nx264
+endif
+
 include debian/confflags
 
 DH_INSTALL_FILES = debian/$(libx264N).install \
                    debian/libx264-dev.install
 
 %:
-	dh $@ --parallel --with autotools_dev
+	dh $@ --parallel --with autotools_dev $(dh_exclude)
 
 .PHONY: debian/control
 debian/control:
@@ -68,10 +74,10 @@ override_dh_auto_install:
 override_dh_auto_clean: debian/control
 	rm -rf debian/install
 	$(MAKE) -o config.mak distclean
-	dh_clean config.mak2 $(DH_INSTALL_FILES)
+	dh_clean config.mak2 $(DH_INSTALL_FILES) $(dh_exclude)
 
 override_dh_install: $(DH_INSTALL_FILES)
-	dh_install --list-missing --sourcedir=debian/install
+	dh_install --list-missing --sourcedir=debian/install $(dh_exclude)
 ifeq ($(do_opt),yes)
 	mkdir -p debian/$(libx264N)$(opt_libdir)
 	cp -a debian/install/opt$(opt_libdir)/*.so.* debian/$(libx264N)$(opt_libdir)
-- 
2.0.0

-------------- next part --------------
From 30035fe730d0fd8f5af284c3382257fb5f8d6979 Mon Sep 17 00:00:00 2001
From: Peter Pentchev <roam at ringlet.net>
Date: Thu, 19 Jun 2014 16:44:18 +0300
Subject: [PATCH 2/2] Regenerate the control file.

---
 debian/control | 1 +
 1 file changed, 1 insertion(+)

diff --git a/debian/control b/debian/control
index 66ac8c9..10790da 100644
--- a/debian/control
+++ b/debian/control
@@ -6,6 +6,7 @@ Uploaders:
  Reinhard Tartler <siretart at tauware.de>,
  Fabian Greffrath <fabian+debian at greffrath.com>,
  Rico Tzschichholz <ricotz at ubuntu.com>
+# In the stage1 build profile, drop the libavformat-dev, libffms2-dev and libgpac-dev dependencies.
 Build-Depends:
  debhelper (>= 8.1.3~),
  autotools-dev,
-- 
2.0.0

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-multimedia-maintainers/attachments/20140619/529280ed/attachment.sig>


More information about the pkg-multimedia-maintainers mailing list