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 <profile.*> 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 <r...@ringlet.net>
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 <vor...@debian.org>
 Uploaders: Anthony Fok <f...@debian.org>, Keith Packard <kei...@keithp.com>
+# 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
 
+ifeq (,$(filter stage1,$(DEB_BUILD_PROFILES)))
+build_demos = 1
+dh_exclude =
+else
+build_demos = 0
+dh_exclude = -Nfreetype2-demos
+endif
+
 %:
-       dh $@
+       dh $@ $(dh_exclude)
+
+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 +85,10 @@ patch-stamp:
        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 +96,10 @@ override_dh_auto_configure: patch
 
 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:
@@ -91,14 +108,16 @@ override_dh_auto_clean:
        rm -rf $(freetype_u) $(ft2demos_u) docs
 
 override_dh_auto_install:
-       dh_auto_install -D $(freetype_u) --destdir=$(CURDIR)/debian/tmp
+       dh_auto_install -D $(freetype_u) --destdir=$(CURDIR)/debian/tmp 
$(dh_exclude)
+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:
-       dh_install --fail-missing
+       dh_install --fail-missing $(dh_exclude)
 
 override_dh_installdocs:
 ifneq (,$(findstring $(libpkg), $(shell dh_listpackages)))
@@ -113,7 +132,7 @@ ifneq (,$(findstring $(devpkg), $(shell dh_listpackages)))
                $(addprefix -X,$(libdoc)) \
                $(ftdocs_d)/docs/*
 endif
-       dh_installdocs -N$(devpkg) -N$(libpkg) --link-doc=$(libpkg)
+       dh_installdocs -N$(devpkg) -N$(libpkg) --link-doc=$(libpkg) 
$(dh_exclude)
 
 override_dh_installchangelogs:
 ifneq (,$(findstring $(libpkg), $(shell dh_listpackages)))
@@ -121,7 +140,7 @@ ifneq (,$(findstring $(libpkg), $(shell dh_listpackages)))
 endif
 
 override_dh_makeshlibs:
-       dh_makeshlibs -V '$(dependency)' --add-udeb '$(udebpkg)'
+       dh_makeshlibs -V '$(dependency)' --add-udeb '$(udebpkg)' $(dh_exclude)
 
 # This variable is used only by get-orig-source, which will normally only
 # be run by maintainers.
-- 
2.0.0

Attachment: signature.asc
Description: Digital signature

Reply via email to