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

2014-10-07 Thread Johannes Schauer
Hi,

On Thu, 19 Jun 2014 18:43:08 +0300 Peter Pentchev  wrote:
> 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.

the syntax for the Build-Profiles field was changed during the bootstrap
sprint in paris [1,2]. Attached patch is updated to reflect those changes.
It only changes debian/control.in so please regenerate debian/control.

As the patch requires debhelper to understand the new syntax, this bug is
blocked by that bug in debhelper.

In contrast to the patch for #752103 (which is marked as block by this bug)
this patch does use the new build profile syntax in the Build-Depends field and
thus can be applied before Jessie is released.

cheers, josch

[1] https://wiki.debian.org/Sprints/2014/BootstrapSprint
[2] https://wiki.debian.org/BuildProfileSpec
diff -Nru x264-0.142.2431+gita5831aa/debian/changelog x264-0.142.2431+gita5831aa/debian/changelog
--- x264-0.142.2431+gita5831aa/debian/changelog	2014-07-11 03:21:53.0 +0200
+++ x264-0.142.2431+gita5831aa/debian/changelog	2014-10-07 10:38:08.0 +0200
@@ -1,3 +1,21 @@
+x264 (2:0.142.2431+gita5831aa-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * To avoid a circular build dependencies:
+   - add Build-Profiles field so that only the library is built in the
+ stage1 build profile
+   - add --disable-avs --disable-ffms --disable-gpac to common_confflags
+ when building with stage1
+   - depend on the proper versions of debhelper and dpkg-dev for parsing
+ build profile information in debian/control
+Based on patch by Peter Pentchev
+Closes: #735742
+
+ -- Johannes Schauer   Tue, 07 Oct 2014 10:32:26 +0200
+
 x264 (2:0.142.2431+gita5831aa-1) unstable; urgency=low
 
   * Update to new upstream snapshot
diff -Nru x264-0.142.2431+gita5831aa/debian/confflags x264-0.142.2431+gita5831aa/debian/confflags
--- x264-0.142.2431+gita5831aa/debian/confflags	2014-07-11 03:13:07.0 +0200
+++ x264-0.142.2431+gita5831aa/debian/confflags	2014-10-07 10:27:55.0 +0200
@@ -20,6 +20,10 @@
 
 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 -Nru x264-0.142.2431+gita5831aa/debian/control.in x264-0.142.2431+gita5831aa/debian/control.in
--- x264-0.142.2431+gita5831aa/debian/control.in	2014-07-11 03:13:07.0 +0200
+++ x264-0.142.2431+gita5831aa/debian/control.in	2014-10-07 10:57:02.0 +0200
@@ -6,8 +6,9 @@
  Reinhard Tartler ,
  Fabian Greffrath ,
  Rico Tzschichholz 
+# In the stage1 build profile, drop the libavformat-dev, libffms2-dev and libgpac-dev dependencies.
 Build-Depends:
- debhelper (>= 8.1.3~),
+ debhelper (>= 9.FIXME),
  autotools-dev,
  libavformat-dev (>= 6:9),
  libffms2-dev,
@@ -22,6 +23,7 @@
 Package: x264
 Section: graphics
 Architecture: any
+Build-Profiles: 
 Depends:
  ${misc:Depends},
  ${shlibs:Depends}


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

2014-06-19 Thread Peter Pentchev
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  r...@ringlet.net r...@freebsd.org p.penc...@storpool.com
PGP key:http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint 2EE7 A7A5 17FC 124C F115  C354 651E EFB0 2527 DF13
From f0b2e1f5da32ee903fbea21e96bc24b479a49d94 Mon Sep 17 00:00:00 2001
From: Peter Pentchev 
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 ,
  Fabian Greffrath ,
  Rico Tzschichholz 
+# 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