[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#717843: [xfonts-utils] Allow bootstrapping without libfontenc.



Hi,

Thanks a lot for taking care of X in Debian!

As part of this year's "Bootstrappable Debian" Google Summer of Code
project I took a look at xfonts-utils to break a circular build
dependency as noted in the "Type 2 Self-Cycles" and "Feedback Arc Set"
section of http://bootstrap.debian.net/amd64/ and, more specifically, at
http://bootstrap.debian.net/source/xfonts-utils.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.

Thanks for sitting through this somewhat lengthy introduction :)  Now,
the point is, libfontenc needs the pkg-config and aclocal files of
X.org's font-util to build, and xfont-utils's fonttosfnt needs
libfontenc1 and libfontenc-dev to build.  One of the ways to fix this
circular build dependency would be to break font-util into a source and
binary package of its own, let the xfonts-utils binary package depend on
it, and change libfontenc's build dependency to xfonts-utils | font-util
so that it would work both with the old and the new packages.

Another way is what Matthias Klose proposed in this bug report - let
xfonts-utils make sure of the build profiles framework and, in the
stage1 build profile, only build font-util, none of its other tools.
Since we are aiming for binary package level granularity, this means
that in the stage1 profile xfonts-utils would have to build a binary
package with a different name and libfontenc's build dependency would
again have to be adjusted to xfonts-utils | xfonts-utils-stage1.

So what do you think about the attached patch that introduces a new
binary package and teaches the rules file to produce it, only building
font-util, in the stage1 build profile?

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 something should go wrong with the patch, it's also available at
https://gitorious.org/roam-debian-bootstrap/xfonts-utils-debian/commits/roam-stage1-build

Thanks again for your work on X and Debian in general!

G'luck,
Peter

-- 
Peter Pentchev  roam@ringlet.net roam@FreeBSD.org p.penchev@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 6f78405ee9bb62c8ef3285d0dd53f29420537ffa Mon Sep 17 00:00:00 2001
From: Peter Pentchev <roam@ringlet.net>
Date: Sat, 21 Jun 2014 13:36:52 +0300
Subject: [PATCH] In the stage1 build profile, build font-util only.

Break a circular build dependency between libfontenc and xfonts-utils by
building a limited profile in the "stage1" build profile that only
contains font-util and its associated pkg-config and aclocal files.

This will also need font-util's build dependency adjusted to
xfonts-utils | xfonts-utils-stage1.
---
 debian/control | 24 ++++++++++++++++++++++++
 debian/rules   | 22 ++++++++++++++++++++--
 2 files changed, 44 insertions(+), 2 deletions(-)

diff --git a/debian/control b/debian/control
index 50b8d60..09bc6f4 100644
--- a/debian/control
+++ b/debian/control
@@ -2,6 +2,8 @@ Source: xfonts-utils
 Section: x11
 Priority: optional
 Maintainer: Debian X Strike Force <debian-x@lists.debian.org>
+# For stage1 builds, remove the libxfont-dev, libx11-dev, x11proto-core-dev,
+# libfreetype6-dev, and libfontenc-dev dependencies.
 Build-Depends:
  debhelper (>= 7),
  pkg-config,
@@ -25,6 +27,28 @@ Depends:
  ${misc:Depends},
  x11-common,
  xfonts-encodings,
+Conflicts: xfonts-utils-stage1
+Description: X Window System font utility programs
+ xfonts-utils provides a set of utility programs shipped with the X Window
+ System that are needed for font management.
+ .
+ The programs in this package include:
+  - bdftopcf, which converts BDF fonts to PCF fonts;
+  - bdftruncate and ucs2any, tools to generate fonts with various encodings
+    from ISO 10646-encoded fonts
+  - mkfontdir, a program to generate fonts.dir files;
+  - mkfontscale, a program to generate fonts.scale files;
+  - fonttosfnt, a program to wrap bitmap fonts in a sfnt (TrueType) wrapper.
+
+Package: xfonts-utils-stage1
+Architecture: any
+Multi-Arch: foreign
+Depends:
+ ${shlibs:Depends},
+ ${misc:Depends},
+ x11-common,
+ xfonts-encodings,
+Conflicts: xfonts-utils
 Description: X Window System font utility programs
  xfonts-utils provides a set of utility programs shipped with the X Window
  System that are needed for font management.
diff --git a/debian/rules b/debian/rules
index 6640ae7..e0c50aa 100755
--- a/debian/rules
+++ b/debian/rules
@@ -9,10 +9,17 @@
 
 # This package contains multiple modules as shipped by upstream. Each module is # contained in a subdirectory in the root dir of the package. You must list each
 # subdirectory explicitly so that the build system knows what to build
+
+ifeq (,$(filter stage1,$(DEB_BUILD_PROFILES)))
 SUBDIRS = bdftopcf mkfontdir mkfontscale font-util fonttosfnt
+dh_exclude = -Nxfonts-utils-stage1
+else
+SUBDIRS = font-util
+dh_exclude = -Nxfonts-utils
+endif
 
 %:
-	dh $@ --with autotools-dev,quilt
+	dh $@ --with autotools-dev,quilt $(dh_exclude)
 
 STAMP_DIR = stampdir
 
@@ -20,6 +27,13 @@ CONFIG_STAMPS = $(addprefix $(STAMP_DIR)/configure-, $(SUBDIRS))
 BUILD_STAMPS = $(addprefix $(STAMP_DIR)/build-,$(SUBDIRS))
 
 override_dh_auto_configure: $(CONFIG_STAMPS)
+	for i in debian/xfonts-utils.*; do \
+		n=`basename "$$i"`; \
+		if [ "$$n" != "xfonts-utils.debhelper.log" ] && [ "$$n" != "xfonts-utils.install" ]; then \
+			cp -p "$$i" "`echo $$i | sed -e s/xfonts-utils/xfonts-utils-stage1/`"; \
+		fi; \
+	done
+	fgrep -e fontutil -e X11/util/ -e ucs2any -e bdftruncate debian/xfonts-utils.install > debian/xfonts-utils-stage1.install
 
 override_dh_auto_build: $(BUILD_STAMPS)
 
@@ -38,6 +52,10 @@ $(STAMP_DIR)/build-%:
 clean-%:
 	dh_auto_clean -D$* -B$*-build
 
+override_dh_clean:
+	rm -rf debian/xfonts-utils debian/xfonts-utils-stage1 debian/xfonts-utils-stage1.*
+	dh_clean
+
 override_dh_auto_clean: $(addprefix clean-, $(SUBDIRS))
 	rm -rf $(STAMP_DIR)
 
@@ -48,7 +66,7 @@ override_dh_auto_install:
 	done
 
 override_dh_install:
-	dh_install --fail-missing
+	dh_install --fail-missing $(dh_exclude)
 
 override_dh_installxfonts:
 	# we don't actually install any fonts
-- 
2.0.0

Attachment: signature.asc
Description: Digital signature


Reply to: