Bug#994752: Bug#994751: pango1.0: the development package does not include static libraries

2021-09-22 Thread Alfonso Sanchez-Beato
On Mon, Sep 20, 2021 at 6:05 PM Simon McVittie  wrote:
>
> Control: tags -1 = moreinfo
>
> On Mon, 20 Sep 2021 at 17:29:34 +0200, Alfonso Sanchez-Beato wrote:
> > On Mon, Sep 20, 2021 at 5:05 PM Simon McVittie  wrote:
> > > libpango-1.0.so.0 depends on libgio-2.0.so.0, which depends on
> > > libmount.so.1, which is only available as a shared library
> >
> > I do not see a dependency on libgio when I run ldd on
> > libpango-1.0.so.0, although it does depend on libglib-2.0.so.0 and
> > libgobject-2.0.so.0.
>
> Maybe the dependency was only introduced in a recent version? It's
> certainly there in Debian unstable, which is the only suite where adding
> static libraries would be in-scope for Debian (other than experimental,
> but there's currently no version of pango1.0 in experimental), for at
> least amd64 and i386.

Right, I double checked and indeed the latest in unstable has that dependency.

>
> > Besides, it is possible to compile statically against libpango and
> > still compile dynamically against some of its dependencies.
> ...
> > > More generally, configurations that aren't actively tested typically
> > > don't work, so if I enable static linking in a particular package,
> > > I would want to have at least superficial autopkgtest coverage for it
> > > (see debian/tests/build-static and debian/tests/build in src:glib2.0 for
> > > an example)
> >
> > I will be happy to provide such a test if that is the blocker for landing 
> > this.
>
> If this is something that works in unstable, then please do.

Please see the new attached patch.

>
> smcv

Thanks,
Alfonso
diff -Nru pango1.0-1.48.10+ds1/debian/changelog pango1.0-1.48.10+ds1/debian/changelog
--- pango1.0-1.48.10+ds1/debian/changelog	2021-09-17 09:54:40.0 +
+++ pango1.0-1.48.10+ds1/debian/changelog	2021-09-22 14:10:13.0 +
@@ -1,3 +1,15 @@
+pango1.0 (1.48.10+ds1-2) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Include archive files to allow static compilation of the libraries
+- d/rules: Build also archive files for static compilation
+- d/libpango1.0-dev.install: Include archive files
+- d/tests/build: Add --static option
+- d/tests/build-static: Exercise static linking
+- d/tests/control: Add build-static test
+
+ -- Alfonso Sanchez-Beato (email Canonical)   Wed, 22 Sep 2021 14:10:13 +
+
 pango1.0 (1.48.10+ds1-1) unstable; urgency=medium
 
   * Team upload
diff -Nru pango1.0-1.48.10+ds1/debian/libpango1.0-dev.install pango1.0-1.48.10+ds1/debian/libpango1.0-dev.install
--- pango1.0-1.48.10+ds1/debian/libpango1.0-dev.install	2021-09-17 09:54:40.0 +
+++ pango1.0-1.48.10+ds1/debian/libpango1.0-dev.install	2021-09-22 14:06:45.0 +
@@ -1,4 +1,5 @@
 usr/include
+usr/lib/*/*.a
 usr/lib/*/*.so
 usr/lib/*/pkgconfig/*.pc
 usr/share/gir-1.0
diff -Nru pango1.0-1.48.10+ds1/debian/rules pango1.0-1.48.10+ds1/debian/rules
--- pango1.0-1.48.10+ds1/debian/rules	2021-09-17 09:54:40.0 +
+++ pango1.0-1.48.10+ds1/debian/rules	2021-09-22 14:06:45.0 +
@@ -21,6 +21,7 @@
 		-Dauto_features=enabled \
 		-Dgtk_doc=$(with_docs) \
 		-Dinstall-tests=true \
+		-Ddefault_library=both \
 		$(NULL)
 
 override_dh_auto_test-arch:
diff -Nru pango1.0-1.48.10+ds1/debian/tests/build pango1.0-1.48.10+ds1/debian/tests/build
--- pango1.0-1.48.10+ds1/debian/tests/build	2021-09-17 09:54:40.0 +
+++ pango1.0-1.48.10+ds1/debian/tests/build	2021-09-22 14:10:13.0 +
@@ -1,11 +1,36 @@
 #!/bin/sh
 # autopkgtest check: Builds a small application against libcairo2-dev, checking
 # if it compiles, links and runs successfully.
-# Author: Rafał Cieślak  
+# Authors: Rafał Cieślak ,
+#  Alfonso Sánchez-Beato 
 
 set -e
 set -u
 
+mode=dynamic
+
+getopt_temp="$(getopt -o '' --long 'static' -n debian/tests/build -- "$@")"
+eval set -- "$getopt_temp"
+
+while true; do
+case "$1" in
+(--static)
+mode=static
+shift
+continue
+;;
+
+(--)
+shift
+break
+;;
+
+(*)
+echo "getopt: Internal error" >&2
+exit 2
+esac
+done
+
 WORKDIR=$(mktemp -d)
 cleanup () {
 rm -fr "$WORKDIR"
@@ -31,9 +56,26 @@
 }
 EOF
 
-# Deliberately word-splitting, that's how pkg-config works:
-# shellcheck disable=SC2046
-"${CROSS_COMPILE}gcc" -o build_test build_test.c $("${CROSS_COMPILE}pkg-config" --cflags --libs pango)
+
+case "$mode" in
+(static)
+# Compile all statically but libgraphite and libmount, that do not have
+# static version yet.
+flags=$("${CROSS_COMPILE}pkg-config" --cflags --static --libs pango)
+flags=$(echo "$flags" | sed 's/-lgraphite2//')
+flags=$(echo "$flags" | sed 's/-lmount//')
+# Deliberately word-splitting, that's how pkg-config works:
+# shellcheck disable=SC2086
+"${CROSS_COMPILE}gcc" -o build_test build_test.c -Wl,-Bstatic $flags -Wl,-Bdynamic -lgcc_s 

Bug#994752: Bug#994751: pango1.0: the development package does not include static libraries

2021-09-20 Thread Simon McVittie
Control: tags -1 = moreinfo

On Mon, 20 Sep 2021 at 17:29:34 +0200, Alfonso Sanchez-Beato wrote:
> On Mon, Sep 20, 2021 at 5:05 PM Simon McVittie  wrote:
> > libpango-1.0.so.0 depends on libgio-2.0.so.0, which depends on
> > libmount.so.1, which is only available as a shared library
> 
> I do not see a dependency on libgio when I run ldd on
> libpango-1.0.so.0, although it does depend on libglib-2.0.so.0 and
> libgobject-2.0.so.0.

Maybe the dependency was only introduced in a recent version? It's
certainly there in Debian unstable, which is the only suite where adding
static libraries would be in-scope for Debian (other than experimental,
but there's currently no version of pango1.0 in experimental), for at
least amd64 and i386.

> Besides, it is possible to compile statically against libpango and
> still compile dynamically against some of its dependencies.
...
> > More generally, configurations that aren't actively tested typically
> > don't work, so if I enable static linking in a particular package,
> > I would want to have at least superficial autopkgtest coverage for it
> > (see debian/tests/build-static and debian/tests/build in src:glib2.0 for
> > an example)
> 
> I will be happy to provide such a test if that is the blocker for landing 
> this.

If this is something that works in unstable, then please do.

smcv