Source: pkg-config
Version: 0.28-1
Severity: wishlist
Tags: patch

Hi,

Here's the real reason I filed the "drop B-D popt" bug :)

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

So after this somewhat lengthy introduction, pkg-config.  In this case
the first goal is easily satisfied by dropping the libglib2.0-dev
dependency in the "stage1" profile.  However, the result runs contrary
to the second goal - the pkg-config binary package built in this way
would differ, albeit slightly, from the one built in the standard
profile.  So my proposal is to create a second package that is built
with the internal glib implementation, call it, say, pkg-config-stage1,
and determine which of the two binary packages to build according to the
build profile being selected.  In the standard profile, or in any
combination of build profiles that does not include "stage1", the
pkg-config package will be built with the external glib.  In the
"stage1" profile, the internal glib implementation will be used and the
generated package will be called pkg-config-stage1.

Here's the first part of the implementation.  It defines the new package
in the control file, then modifies the rules file to look at the
DEB_BUILD_PROFILES environment variable and choose which package to
build according to that.  This does not make use of the build profile
support in all of the Debian packaging tools (debhelper, dpkg-dev,
sbuild, ...), and the changeset will be much smaller once we can
actually depend on build profile support in the build toolchain, but
this is as far as we can go with the current state of the Debian
archive; I will file a separate bug containing the simplifying patch,
but it will have to wait for #744246, since right now the Debian build
infrastructure does not support build profiles.

If something goes wrong with this e-mail, the patch is also available in
my Gitorious repository at
https://gitorious.org/roam-debian-bootstrap/pkg-config-debian/commits/roam-stage1-build

Thanks a lot for reading this far, and thanks again for your Debian
work!

-- 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

-- no debconf information

-- 
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 fea8bafdc04af4587515d42bb1b7029cb085d56e Mon Sep 17 00:00:00 2001
From: Peter Pentchev <r...@ringlet.net>
Date: Tue, 17 Jun 2014 18:11:22 +0300
Subject: [PATCH] Add an intermediate pkg-config-stage1 w/o B-D glib.

To avoid a circular build dependency (libglib2.0 build-depends on
pkg-config), introduce a new package, pkg-config-stage1, which is only
built if "stage1" is specified in the DEB_BUILD_PROFILES variable.
It is built with pkg-config's internal implementation of glib.

To that end:

- add the new binary package to debian/control

- in the configure target, copy debian/pkg-config.* to
  debian/pkg-config-stage1.* - the packages are essentially the same,
  debhelper needs to be made aware of that
- rename debian/dirs and debian/docs to debian/pkg-config.* so that they
  are also copied
- remove debian/pkg-config-stage1.* in the clean target

- add either -Npkg-config or -Npkg-config-stage1 to the debhelper
  invocation depending on whether "stage1" is in DEB_BUILD_PROFILES
- pass --with-internal-glib to configure in the stage1 profile

- add the full list of files to debian/pkg-config.install and
  debian/pkg-config.manpages, since debhelper sees more than one package
  now and does not automatically include everything found in debian/tmp
---
 debian/control             | 16 ++++++++++++++++
 debian/dirs                |  2 --
 debian/docs                |  3 ---
 debian/pkg-config.dirs     |  2 ++
 debian/pkg-config.docs     |  3 +++
 debian/pkg-config.install  |  4 ++++
 debian/pkg-config.manpages |  1 +
 debian/rules               | 17 +++++++++++++++--
 8 files changed, 41 insertions(+), 7 deletions(-)
 delete mode 100644 debian/dirs
 delete mode 100644 debian/docs
 create mode 100644 debian/pkg-config.dirs
 create mode 100644 debian/pkg-config.docs
 create mode 100644 debian/pkg-config.manpages

diff --git a/debian/control b/debian/control
index 6008483..2c82193 100644
--- a/debian/control
+++ b/debian/control
@@ -2,6 +2,7 @@ Source: pkg-config
 Section: devel
 Priority: optional
 Maintainer: Tollef Fog Heen <tfh...@debian.org>
+# For stage1 builds, remove the libglib2.0-dev dependency.
 Build-Depends: debhelper (>= 7.0.50), dh-autoreconf, libglib2.0-dev
 Homepage: http://pkg-config.freedesktop.org
 Standards-Version: 3.8.4
@@ -17,3 +18,18 @@ Description: manage compile and link flags for libraries
  Increasingly libraries ship with ".pc" files that allow querying of the
  compiler and linker flags needed to use them through the pkg-config(1)
  program.
+
+Package: pkg-config-stage1
+Architecture: any
+Multi-Arch: foreign
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Provides: pkg-config
+Description: manage compile and link flags for libraries (bootstrap)
+ pkg-config is a system for managing library compile and link flags that 
+ works with automake and autoconf.
+ .
+ Increasingly libraries ship with ".pc" files that allow querying of the
+ compiler and linker flags needed to use them through the pkg-config(1)
+ program.
+ .
+ This is an intermediate package to be used for bootstrap builds.
diff --git a/debian/dirs b/debian/dirs
deleted file mode 100644
index 2465ced..0000000
--- a/debian/dirs
+++ /dev/null
@@ -1,2 +0,0 @@
-usr/lib/pkgconfig
-usr/share/pkgconfig
diff --git a/debian/docs b/debian/docs
deleted file mode 100644
index 9a58ad6..0000000
--- a/debian/docs
+++ /dev/null
@@ -1,3 +0,0 @@
-README
-AUTHORS
-NEWS
diff --git a/debian/pkg-config.dirs b/debian/pkg-config.dirs
new file mode 100644
index 0000000..2465ced
--- /dev/null
+++ b/debian/pkg-config.dirs
@@ -0,0 +1,2 @@
+usr/lib/pkgconfig
+usr/share/pkgconfig
diff --git a/debian/pkg-config.docs b/debian/pkg-config.docs
new file mode 100644
index 0000000..9a58ad6
--- /dev/null
+++ b/debian/pkg-config.docs
@@ -0,0 +1,3 @@
+README
+AUTHORS
+NEWS
diff --git a/debian/pkg-config.install b/debian/pkg-config.install
index 89c190e..c1ee38e 100644
--- a/debian/pkg-config.install
+++ b/debian/pkg-config.install
@@ -1 +1,5 @@
+usr/bin/*-pkg-config
+usr/bin/pkg-config
+usr/share/aclocal/pkg.m4
+usr/share/doc/pkg-config/pkg-config-guide.html
 debian/pkg-config-crosswrapper usr/share
diff --git a/debian/pkg-config.manpages b/debian/pkg-config.manpages
new file mode 100644
index 0000000..22492ef
--- /dev/null
+++ b/debian/pkg-config.manpages
@@ -0,0 +1 @@
+debian/tmp/usr/share/man/man1/pkg-config.1
diff --git a/debian/rules b/debian/rules
index af821b6..fd37613 100755
--- a/debian/rules
+++ b/debian/rules
@@ -16,8 +16,16 @@ SYSTEM_LIBDIRS := $(shell for opt in '' $$($${CC-$(GCC)} 
-print-multi-lib | sed
      | sed -e's/:/\n/g' | xargs -n1 readlink -f | grep -v 'gcc\|/[0-9.]\+$$'; \
     done | sort -u | tr '\n' : | sed 's/:$$//')
 
+ifeq (,$(filter stage1,$(DEB_BUILD_PROFILES)))
+dh_exclude=    -Npkg-config-stage1
+conf_glib=     --without-internal-glib
+else
+dh_exclude=    -Npkg-config
+conf_glib=     --with-internal-glib
+endif
+
 %:
-       dh $@ --with autoreconf
+       dh $@ --with autoreconf $(dh_exclude)
 
 override_dh_auto_configure:
        $(SET_PKG_CONFIG) ./configure --prefix=/usr \
@@ -26,11 +34,16 @@ override_dh_auto_configure:
                --mandir=\$${prefix}/share/man \
                --infodir=\$${prefix}/share/info --disable-shared \
                
--with-pc-path=/usr/local/lib/$(DEB_HOST_MULTIARCH)/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig
 \
-               --with-system-library-path=$(SYSTEM_LIBDIRS)
+               --with-system-library-path=$(SYSTEM_LIBDIRS) \
+               $(conf_glib)
+       for i in debian/pkg-config.*; do \
+               cp -pv "$$i" "`echo $$i | sed -e 
s/pkg-config/pkg-config-stage1/`"; \
+       done
 
 override_dh_auto_clean:
        [ ! -f Makefile ] || $(MAKE) distclean DIST_SUBDIRS="check"
        chmod +x debian/pkg-config-crosswrapper
+       rm -f debian/pkg-config-stage1.*
 
 override_dh_auto_test:
        dh_auto_test -- TESTS_ENVIRONMENT=PKG_CONFIG=../pkg-config 
LOG_COMPILER=/bin/bash
-- 
2.0.0

Attachment: signature.asc
Description: Digital signature

Reply via email to