Bug#752270: [freetype] Allow bootstrapping without the X libraries

2014-10-07 Thread Johannes Schauer
Control: block -1 by 763766

Hi,

On Sun, 22 Jun 2014 02:26:20 +0300 Peter Pentchev  wrote:
> Now, with freetype this is relatively easy - the X libraries are only
> used for building the freetype2-demos package, not for the actual
> freetype libraries.  So what do you think about the attached patch that
> checks for a "stage1" build profile specified in the DEB_BUILD_PROFILES
> variable and, if so, omits the freetype2-demos package from the build
> at all?

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 #752271 (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 -u freetype-2.5.2/debian/changelog freetype-2.5.2/debian/changelog
--- freetype-2.5.2/debian/changelog
+++ freetype-2.5.2/debian/changelog
@@ -1,3 +1,12 @@
+freetype (2.5.2-2.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * If building in the stage1 build profile, do not depend on the X
+libraries and do not build the demo programs.  This breaks a circular
+build dependency of src:freetype with src:libx11 and src:x11proto-core
+
+ -- Johannes Schauer   Tue, 07 Oct 2014 11:06:45 +0200
+
 freetype (2.5.2-2) unstable; urgency=medium
 
   * Acknowledge security NMU; thanks to Michael Gilbert.
diff -u freetype-2.5.2/debian/control freetype-2.5.2/debian/control
--- freetype-2.5.2/debian/control
+++ freetype-2.5.2/debian/control
@@ -3,7 +3,8 @@
 Priority: optional
 Maintainer: Steve Langasek 
 Uploaders: Anthony Fok , Keith Packard 
-Build-Depends: bzip2, debhelper (>= 9), docbook-to-man, gettext (>= 0.10.36-2), libx11-dev, x11proto-core-dev, libz-dev, quilt, libpng-dev, autoconf, automake, libtool
+# For stage1 builds, remove the libx11-dev and x11proto-core-dev dependencies.
+Build-Depends: bzip2, debhelper (>= 9.FIXME), docbook-to-man, gettext (>= 0.10.36-2), libx11-dev, x11proto-core-dev, libz-dev, quilt, libpng-dev, autoconf, automake, libtool
 Standards-Version: 3.9.6
 Homepage: http://www.freetype.org
 
@@ -63,6 +64,7 @@
 Package: freetype2-demos
 Architecture: any
 Section: utils
+Build-Profiles: 
 Depends: ${shlibs:Depends}, ${misc:Depends}
 Replaces: freetype-tools
 Description: FreeType 2 demonstration programs
diff -u freetype-2.5.2/debian/rules freetype-2.5.2/debian/rules
--- freetype-2.5.2/debian/rules
+++ freetype-2.5.2/debian/rules
@@ -46,13 +46,24 @@
 
 libdoc = FTL.TXT CHANGES TODO ft2faq.html
 
+ifeq (,$(filter stage1,$(DEB_BUILD_PROFILES)))
+build_demos = 1
+else
+build_demos = 0
+endif
+
 %:
 	dh $@
 
+tarballs = $(freetype_u) $(ftdocs_u)
+ifeq ($(build_demos),1)
+tarballs += $(ft2demos_u)
+endif
+
 unpack:: unpack-stamp
 unpack-stamp::
 	# Unpack upstream tarballs
-	@for i in $(freetype_u) $(ftdocs_u) $(ft2demos_u); do \
+	@for i in $(tarballs); do \
 	if [ -f $$i.tar.bz2 ]; then \
 		echo "Unpacking $$i.tar.bz2 ..."; \
 		tar -x --bzip2 -f $$i.tar.bz2; \
@@ -72,8 +83,10 @@
 	cd $(freetype_u) \
 	&& QUILT_PATCHES=../debian/patches-freetype quilt --quiltrc /dev/null push -a
 	cd $(freetype_u) && ./autogen.sh
+ifeq ($(build_demos),1)
 	cd $(ft2demos_u) \
 	&& QUILT_PATCHES=../debian/patches-ft2demos quilt --quiltrc /dev/null push -a
+endif
 	touch patch-stamp
 
 override_dh_auto_configure: patch
@@ -81,8 +94,10 @@
 
 override_dh_auto_build:
 	dh_auto_build -D $(freetype_u)
+ifeq ($(build_demos),1)
 	dh_auto_build -D $(ft2demos_u) -- TOP_DIR=../$(freetype_u) \
 		OBJ_DIR=../$(freetype_u)/objs
+endif
 	docbook-to-man $(freetype_config_sgml) > $(freetype_config_man)
 
 override_dh_auto_clean:
@@ -92,9 +107,11 @@
 
 override_dh_auto_install:
 	dh_auto_install -D $(freetype_u) --destdir=$(CURDIR)/debian/tmp
+ifeq ($(build_demos),1)
 	$(freetype_u)/builds/unix/libtool --mode=install \
 	cp -av `find $(ft2demos_u)/bin -type f -perm -u=x -maxdepth 1` \
 		$(CURDIR)/debian/$(demospkg)/usr/bin/
+endif
 	sed -i -e'/dependency_libs/s/'.*'//' debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libfreetype.la
 
 override_dh_install:


Bug#752270: [freetype] Allow bootstrapping without the X libraries

2014-06-21 Thread Peter Pentchev
Source: freetype
Version: 2.5.2-1
Severity: wishlist
Tags: patch

Hi,

Thanks for taking care of freetype2 in Debian!

As part of this year's "Bootstrappable Debian" Google Summer of Code
project I took a look at freetype 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/freetype.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.

Now, with freetype this is relatively easy - the X libraries are only
used for building the freetype2-demos package, not for the actual
freetype libraries.  So what do you think about the attached patch that
checks for a "stage1" build profile specified in the DEB_BUILD_PROFILES
variable and, if so, omits the freetype2-demos package from the build
at all?

In this iteration, one would also have to manually remove the offending
build dependencies from the control file; I will file another bug that
makes use of the new  restriction and the new Build-Profiles
binary stanza header to make this completely automated.  However, that
would have to wait for the actual introduction of build profile-aware
tools in the Debian archive infrastructure.

If anything should go wrong with the patch, it is also available at
https://gitorious.org/roam-debian-bootstrap/freetype-debian/commits/roam-stage1-build

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

G'luck,
Peter

-- System Information:
Debian Release: jessie/sid
  APT prefers testing
  APT policy: (990, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.14-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=bg_BG.UTF-8, LC_CTYPE=bg_BG.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

-- 
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 2346dc86e1e716b6aecca7a2eca1b92f243655df Mon Sep 17 00:00:00 2001
From: Peter Pentchev 
Date: Sat, 21 Jun 2014 16:52:42 +0300
Subject: [PATCH] In the stage1 build profile, do not build demos.

If building in the stage1 build profile, do not depend on the X
libraries and do not build the demo programs.  This breaks a circular
build dependency as outlined in the version-specific pages linked from
http://bootstrap.debian.net/source/freetype.html
---
 debian/control |  1 +
 debian/rules   | 31 +--
 2 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/debian/control b/debian/control
index 141b97a..8ba8005 100644
--- a/debian/control
+++ b/debian/control
@@ -3,6 +3,7 @@ Section: libs
 Priority: optional
 Maintainer: Steve Langasek 
 Uploaders: Anthony Fok , Keith Packard 
+# For stage1 builds, remove the libx11-dev and x11proto-core-dev dependencies.
 Build-Depends: bzip2, debhelper (>= 8.9.4), docbook-to-man, gettext (>= 
0.10.36-2), libx11-dev, x11proto-core-dev, libz-dev, quilt, libpng-dev, 
autoconf, automake, libtool
 Standards-Version: 3.9.2
 Homepage: http://www.freetype.org
diff --git a/debian/rules b/debian/rules
index a4f8782..406a373 100755
--- a/debian/rules
+++ b/debian/rules
@@ -46,13 +46,26 @@ freetype_config_sgml := 
$(CURDIR)/debian/freetype-config.man.sgml
 
 libdoc = FTL.TXT CHANGES TODO ft2faq.html