Source: guile-2.0
Version: 2.0.11+1-1
Severity: wishlist
Tags: patch

Hi,

First of all, thanks a lot for taking care of Guile in Debian!

As part of this year's "Bootstrappable Debian" Google Summer of Code
project Helmut Grohne pointed me at his problems in cross-building
software that uses guile-2.0-libs.  The problem is best illustrated in
the build dependencies of gnutls28: it needs a native version of autogen
(that is, a version that may be executed at build time), which means a
native version of guile-2.0-libs, and it also needs a host version of
guile-2.0-libs through the guile-2.0-dev dependency.  This means that to
cross-build gnutls28, one needs to have both native and host versions of
guile-2.0-libs installed simultaneously; this is only possible through
multiarch.

So what do you think about the attached patches that convert the package
build of Guile 2.0 to listen to debhelper at build time and use the
proper library directory (/usr/lib/<multiarch>/guile/2.0/ instead of
/usr/lib/guile/2.0/), and then marks the library and dev packages as
Multi-Arch: same, so that they may be installed simultaneously for two
architectures?  If you have any questions or concerns about the changes,
please feel free to let me know!

If something should go wrong with attaching the patches, they are also
available in my Gitorious repository:
https://gitorious.org/roam-debian-bootstrap/guile-2_0-debian/commits/roam-multiarch/

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

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-2-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
From f073aa69fa6b94d9e4c917abcd207f88aee84695 Mon Sep 17 00:00:00 2001
From: Peter Pentchev <r...@ringlet.net>
Date: Thu, 31 Jul 2014 03:07:07 +0300
Subject: [PATCH 1/2] Let dh_auto_configure pass the options.

---
 debian/rules | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/debian/rules b/debian/rules
index 98766e8..b726ffe 100755
--- a/debian/rules
+++ b/debian/rules
@@ -74,12 +74,6 @@ ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
        INSTALL_PROGRAM += -s
 endif
 
-configure_args = \
-  --host=$(DEB_HOST_GNU_TYPE) \
-  --build=$(DEB_BUILD_GNU_TYPE) \
-  --disable-error-on-warning \
-  --prefix=/usr
-
 define checkdir
   dh_testdir debian/guile.postinst
 endef
@@ -149,7 +143,7 @@ override_dh_autoreconf:
        dh_autoreconf ./autogen.sh
 
 override_dh_auto_configure:
-       CFLAGS="$(deb_cflags)" ./configure ${configure_args}
+       CFLAGS="$(deb_cflags)" dh_auto_configure -- --disable-error-on-warning
 
 override_dh_auto_clean:
         # If Makefile doesn't exist GNUmakefile will abort on distclean.
-- 
2.0.1

From 5df17f3ee72240a44b1a366faf9611c7cede3473 Mon Sep 17 00:00:00 2001
From: Peter Pentchev <r...@ringlet.net>
Date: Thu, 31 Jul 2014 15:08:17 +0300
Subject: [PATCH 2/2] Convert to multiarch.

Bump the debhelper compatibility level to 9 so that it passes the proper
multiarch libdir to the GNU configure script.

Add Multi-Arch: and Pre-Depends: headers to the binary packages as
appropriate.

Adapt debian/guile-*.install and debian/rules to the multiarch /usr/lib
subdirectories.

Make guile-libs.lintian-overrides a bit less specific, since we cannot
use the full usr/lib/* path any longer; it changes with multiarch, and
the contents of this file needs to be exactly the same on all
architectures so that several guile-2.0-libs:* packages may be installed
simultaneously.

Add a timestamp-fixup blurb at auto-install time with a wordy comment in
the new debian/fix-timestamp.sh script.

Avoid some libtool silliness by not letting it use -rpath at all; it'll
try to because it "realizes" that "/usr/lib/<multiarch>" != "/usr/lib",
so we are attempting to install to a non-standard directory, right?
---
 debian/compat                       |   2 +-
 debian/control                      |   7 +-
 debian/fix-timestamps.sh            | 125 ++++++++++++++++++++++++++++++++++++
 debian/guile-dev.install            |   6 +-
 debian/guile-libs.install           |   8 +--
 debian/guile-libs.lintian-overrides |   4 +-
 debian/rules                        |  23 +++++--
 7 files changed, 160 insertions(+), 15 deletions(-)
 create mode 100644 debian/fix-timestamps.sh

diff --git a/debian/compat b/debian/compat
index 45a4fb7..ec63514 100644
--- a/debian/compat
+++ b/debian/compat
@@ -1 +1 @@
-8
+9
diff --git a/debian/control b/debian/control
index 22cf3ff..66205ce 100644
--- a/debian/control
+++ b/debian/control
@@ -2,7 +2,7 @@ Source: guile-2.0
 Section: interpreters
 Priority: optional
 Maintainer: Rob Browning <r...@defaultvalue.org>
-Build-Depends: libtool, debhelper (>= 8), autoconf, automake, dh-autoreconf,
+Build-Depends: libtool, debhelper (>= 9), autoconf, automake, dh-autoreconf,
  libncurses5-dev, libreadline6-dev, libltdl-dev, libgmp-dev, texinfo, flex, 
libunistring-dev, libgc-dev, libffi-dev, pkg-config
 Standards-Version: 3.7.2
 Homepage: http://www.gnu.org/software/guile/
@@ -10,6 +10,7 @@ Homepage: http://www.gnu.org/software/guile/
 Package: guile-2.0
 Section: lisp
 Architecture: any
+Multi-Arch: allowed
 Provides: guile
 Depends: guile-2.0-libs (= ${binary:Version}), ${shlibs:Depends},
  ${misc:Depends}
@@ -24,6 +25,7 @@ Description: GNU extension language and Scheme interpreter
 Package: guile-2.0-dev
 Section: lisp
 Architecture: any
+Multi-Arch: same
 Provides: libguile-dev
 Conflicts: libguile-dev
 Replaces: guile-2.0-libs (<< 2.0.11)
@@ -42,6 +44,7 @@ Description: Development files for Guile 2.0
 
 Package: guile-2.0-doc
 Architecture: all
+Multi-Arch: foreign
 Section: doc
 Depends: dpkg (>= 1.15.4) | install-info, ${misc:Depends}
 Description: Documentation for Guile 2.0
@@ -57,6 +60,8 @@ Description: Documentation for Guile 2.0
 Package: guile-2.0-libs
 Section: lisp
 Architecture: any
+Multi-Arch: same
+Pre-Depends: ${misc:Pre-Depends}
 Depends: ${shlibs:Depends}, ${misc:Depends}
 Conflicts: guile-2.0-slib
 Provides: guile-2.0-slib
diff --git a/debian/fix-timestamps.sh b/debian/fix-timestamps.sh
new file mode 100644
index 0000000..6a4c58a
--- /dev/null
+++ b/debian/fix-timestamps.sh
@@ -0,0 +1,125 @@
+#!/bin/sh
+#
+# Fix up the timestamps of the compiled /usr/lib/<arch>/**.go files in
+# case more than one (multiarch) version of guile-*-libs is installed on
+# the same host.  If the version that was installed first (and therefore
+# controls the timestamps of /usr/share/guile/**.scm) was actually built
+# later than one of the other versions, then Guile will complain very
+# loudly each time it runs one of the ccache/**.go files and notices that
+# it has an earlier timestamp than the *.scm file it was supposedly
+# built from.  Since this also happens in "guile-config --version",
+# it causes problems for other packages.
+
+set -e
+
+version()
+{
+       echo 'fix-timestamps 0.01'
+}
+
+usage()
+{
+       cat <<EOUSAGE
+Usage: fix-timestamps [-Nv] -e ext -r reffile -s srcdir targetdir...
+       fix-timestamps -V | -h
+
+       -e      the extension of files to look for in the target directories
+       -h      display program usage information and exit
+       -N      no operation mode; display what would have been done
+       -r      the reference file to use for timestamp setting
+       -s      the directory to scan for files to look for
+       -V      display program version information and exit
+       -v      verbose operation; display diagnostic output
+EOUSAGE
+}
+
+unset ext hflag noop reffile srcdir Vflag v
+
+while getopts 'e:hNr:s:Vv' o; do
+       case "$o" in
+               e)
+                       if [ -z "$OPTARG" ]; then
+                               echo "Empty extension specified" 1>&2
+                               exit 1
+                       fi
+                       ext="$OPTARG"
+                       ;;
+
+               h)
+                       hflag=1
+                       ;;
+
+               N)
+                       noop='echo'
+                       ;;
+
+               r)
+                       if [ ! -f "$OPTARG" ]; then
+                               echo "Invalid reference file $OPTARG" 1>&2
+                               exit 1
+                       fi
+                       reffile="$OPTARG"
+                       ;;
+
+               s)
+                       if [ ! -d "$OPTARG" ]; then
+                               echo "Invalid source directory $OPTARG" 1>&2
+                               exit 1
+                       fi
+                       srcdir="$OPTARG"
+                       ;;
+
+               V)
+                       Vflag=1
+                       ;;
+
+               v)
+                       v='-v'
+                       ;;
+
+               *)
+                       usage 1>&2
+                       exit 1
+                       ;;
+       esac
+done
+[ -z "$Vflag" ] || version
+[ -z "$hflag" ] || usage
+[ -z "$Vflag$hflag" ] || exit 0
+
+if [ -z "$ext" ] || [ -z "$srcdir" ] || [ -z "$reffile" ]; then
+       echo "Source directory, reference file or extension not specified" 1>&2
+       exit 1
+fi
+
+shift `expr "$OPTIND" - 1`
+if [ "$#" -lt 1 ]; then
+       echo 'No directory arguments supplied' 1>&2
+       exit 1
+fi
+
+srclist=`mktemp fix-timestamps-filelist.txt.XXXXXX`
+trap "rm -f '$srclist'" EXIT QUIT TERM INT HUP 
+(cd "$srcdir" && find . -type f -name '*.scm' | sed -e 's#^\./##') > 
"$srclist" 
+[ -z "$v" ] || echo "`wc -l < $srclist` Scheme source file(s) found in $srcdir"
+
+while [ "$#" -gt 0 ]; do
+       dir="$1"
+       shift
+       if [ ! -d "$dir" ]; then
+               echo "Invalid target directory $dir" 1>&2
+               exit 1
+       fi
+
+       count=0
+       while read rel; do
+               relb=`echo "$rel" | sed -e 's/\.scm$//'`
+               lgo="$dir/$relb.$ext"
+               if [ -f "$lgo" ]; then
+                       $noop touch -r "$reffile" "$lgo"
+                       [ -z "$v" ] || echo "$lgo"
+                       count=`expr "$count" + 1`
+               fi
+       done < "$srclist"
+       echo "$count file(s) ${noop+would have been }fixed up in $dir"
+done
diff --git a/debian/guile-dev.install b/debian/guile-dev.install
index 37ebb09..d73d116 100644
--- a/debian/guile-dev.install
+++ b/debian/guile-dev.install
@@ -3,9 +3,9 @@ debian/tmp/usr/bin/guile-config
 debian/tmp/usr/bin/guile-snarf
 debian/tmp/usr/bin/guile-tools
 debian/tmp/usr/include/*
-debian/tmp/usr/lib/*.a
-debian/tmp/usr/lib/libguile-@DEB_SRC_EFF_VER@.so
-debian/tmp/usr/lib/pkgconfig/guile-@DEB_SRC_EFF_VER@.pc
+debian/tmp/usr/lib/*/*.a
+debian/tmp/usr/lib/*/libguile-@DEB_SRC_EFF_VER@.so
+debian/tmp/usr/lib/*/pkgconfig/guile-@DEB_SRC_EFF_VER@.pc
 debian/tmp/usr/share/aclocal/guile.m4
 debian/tmp/usr/share/guile/*/scripts/*
 examples usr/share/doc/guile-@DEB_SRC_EFF_VER@-dev
diff --git a/debian/guile-libs.install b/debian/guile-libs.install
index 5406b52..2f55276 100644
--- a/debian/guile-libs.install
+++ b/debian/guile-libs.install
@@ -1,7 +1,7 @@
-debian/tmp/usr/lib/guile/@DEB_SRC_EFF_VER@/ccache/*
-debian/tmp/usr/lib/libguile-@DEB_SRC_EFF_VER@.so.*
-debian/tmp/usr/lib/libguilereadline*.so
-debian/tmp/usr/lib/libguilereadline-*.so.*
+debian/tmp/usr/lib/*/guile/@DEB_SRC_EFF_VER@/ccache/*
+debian/tmp/usr/lib/*/libguile-@DEB_SRC_EFF_VER@.so.*
+debian/tmp/usr/lib/*/libguilereadline*.so
+debian/tmp/usr/lib/*/libguilereadline-*.so.*
 debian/tmp/usr/share/guile/@DEB_SRC_EFF_VER@/guile-procedures.txt
 debian/tmp/usr/share/guile/@DEB_SRC_EFF_VER@/ice-9/*
 debian/tmp/usr/share/guile/@DEB_SRC_EFF_VER@/language/*
diff --git a/debian/guile-libs.lintian-overrides 
b/debian/guile-libs.lintian-overrides
index c7f6809..9d4df60 100644
--- a/debian/guile-libs.lintian-overrides
+++ b/debian/guile-libs.lintian-overrides
@@ -1,4 +1,4 @@
 # This is expected.  Guile puts the version in the name.
-@DEB_PKG_BASENAME@-libs binary: package-name-doesnt-match-sonames 
libguile-@DEB_PKG_BASENAME@-22 libguilereadline-v-18-18
+@DEB_PKG_BASENAME@-libs binary: package-name-doesnt-match-sonames 
*libguilereadline-v-18-18*
 # These are required by dlopen during (use-modules (foo)).
-@DEB_PKG_BASENAME@-libs binary: non-dev-pkg-with-shlib-symlink 
usr/lib/libguilereadline-v-18.so.18.0.0 usr/lib/libguilereadline-v-18.so
+@DEB_PKG_BASENAME@-libs binary: non-dev-pkg-with-shlib-symlink 
*libguilereadline-v-18.so.18.0.0*
diff --git a/debian/rules b/debian/rules
index b726ffe..b955112 100755
--- a/debian/rules
+++ b/debian/rules
@@ -45,6 +45,13 @@ deb_src_eff_ver := $(deb_src_maj_ver).$(deb_src_min_ver)
 deb_pkg_basename := guile-$(deb_src_eff_ver)
 deb_guile_bin_path := /usr/bin/guile-$(deb_src_eff_ver)
 
+multiarch := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
+ifneq ($(multiarch),)
+march = $(multiarch)/
+else
+march =
+endif
+
 define deb_sub
   perl -p \
     -e "s|\@UPSTREAM_VER\@|$(upstream_ver)|go;" \
@@ -54,6 +61,7 @@ define deb_sub
     -e "s|\@DEB_SRC_MIC_VER\@|$(deb_src_mic_ver)|go;" \
     -e "s|\@DEB_SRC_EFF_VER\@|$(deb_src_eff_ver)|go;" \
     -e "s|\@DEB_PKG_BASENAME\@|$(deb_pkg_basename)|go;" \
+    -e "s|\@MARCH\@|$(march)|go;" \
       < $(1) > $(2)
 endef
 
@@ -144,6 +152,8 @@ override_dh_autoreconf:
 
 override_dh_auto_configure:
        CFLAGS="$(deb_cflags)" dh_auto_configure -- --disable-error-on-warning
+       # Let libtool forget about hardcoding -rpath into the libraries
+       sed -i -e "s/^[[:space:]]*hardcode_into_libs=.*/hardcode_into_libs=no/" 
libtool
 
 override_dh_auto_clean:
         # If Makefile doesn't exist GNUmakefile will abort on distclean.
@@ -166,13 +176,18 @@ override_dh_clean:
 override_dh_auto_install: $(autogen_install_files)
        dh_auto_install
 
+       sh debian/fix-timestamps.sh -r NEWS -e scm -s module 
debian/tmp/usr/share/guile/$(deb_src_eff_ver)
+       sh debian/fix-timestamps.sh -r NEWS -e scm -s guile-readline 
debian/tmp/usr/share/guile/$(deb_src_eff_ver)
+       sh debian/fix-timestamps.sh -r NEWS -e go -s module 
debian/tmp/usr/lib/$(march)/guile/$(deb_src_eff_ver)/ccache
+       sh debian/fix-timestamps.sh -r NEWS -e go -s guile-readline 
debian/tmp/usr/lib/$(march)/guile/$(deb_src_eff_ver)/ccache
+
 gdb_ext := \
-  
debian/$(deb_pkg_basename)-libs/usr/lib/libguile-$(deb_src_eff_ver).so*-gdb.scm
+  
debian/$(deb_pkg_basename)-libs/usr/lib/$(march)libguile-$(deb_src_eff_ver).so*-gdb.scm
 gdb_ext_dir := debian/$(deb_pkg_basename)-dev/usr/share/gdb/auto-load
 
 
 override_dh_install: $(autogen_install_files)
-       rm -f debian/tmp/usr/lib/libguile*.la
+       rm -f debian/tmp/usr/lib/$(march)libguile*.la
        if test -e debian/tmp/usr/share/man/man1/guile.1; then \
          mv debian/tmp/usr/share/man/man1/guile.1 \
            debian/tmp/usr/share/man/man1/guile-$(deb_src_eff_ver).1; \
@@ -188,9 +203,9 @@ override_dh_install: $(autogen_install_files)
        sed -i'' '0,\|\$${exec_prefix}/bin/guile|s||$(deb_guile_bin_path)|' \
          debian/$(deb_pkg_basename)-dev/usr/bin/guild
 
-       mkdir -p debian/$(deb_pkg_basename)-libs/usr/lib/$(deb_pkg_basename)/bin
+       mkdir -p 
debian/$(deb_pkg_basename)-libs/usr/lib/$(march)$(deb_pkg_basename)/bin
        cp -a debian/$(deb_pkg_basename)/usr/bin/guile \
-         debian/$(deb_pkg_basename)-libs/usr/lib/$(deb_pkg_basename)/bin
+         
debian/$(deb_pkg_basename)-libs/usr/lib/$(march)$(deb_pkg_basename)/bin
 
        cd debian/$(deb_pkg_basename)/usr/bin/ \
          && mv guile guile-$(deb_src_eff_ver)
-- 
2.0.1

Attachment: signature.asc
Description: Digital signature

Reply via email to