Disable the static library

The static library is not useful in practice, because its dependencies
atk, gdk-pixbuf and pangocairo are only available as shared libraries.
This commit is contained in:
Simon McVittie 2019-02-07 10:18:49 +00:00
parent d51736aa03
commit 4a1942996e
8 changed files with 4 additions and 178 deletions

21
debian/README.Debian vendored
View File

@ -1,25 +1,10 @@
GTK+2.0 for Debian
-------------------
Static libraries issue
======================
If you wish to link the GTK+ 2.0 libraries statically into your program,
please note that you *can not* use the '-static' flag to gcc.
Instead, you have to link your program *dynamically* and link *only*
the GTK+ 2.0 libraries statically, like this:
Static libraries
================
$ gcc -export-dynamic -o foo foo.c \
-Wl,-Bstatic `pkg-config --cflags --libs gtk+-2.0` -Wl,-Bdynamic \
[other dynamically linked libraries]
The reason for this is that GTK+ 2.0 uses dlopen(3) in order to load
some modules. Undefined symbols in these modules are resolved by the
dynamic linker. If the program is linked statically, the linker has
no way of finding out which symbols are already present in the program
and might causes strange problem so that proper symbols isn't used --
Initialize function in statically linked libraries is called, and some
global variable is initialized, dynamically loaded modules might also
expects those initialized global variable.
Statically linking GTK into a program is no longer supported.
Key binding

View File

@ -1,4 +1,3 @@
debian/install/shared/usr/include/gail* /usr/include
debian/install/shared/@LIBDIR@/libgail*.so @LIBDIR@
debian/install/static/@LIBDIR@/libgail*.a @LIBDIR@
debian/install/shared/@LIBDIR@/pkgconfig/gail*.pc @LIBDIR@/pkgconfig

View File

@ -7,5 +7,3 @@ debian/install/shared/@LIBDIR@/gtk-@APIVER@/include @LIBDIR@/gtk-@APIVER@
debian/install/shared/usr/share/aclocal usr/share
debian/install/shared/usr/share/gir-1.0 usr/share
debian/install/shared/usr/share/man/man1/gtk-builder-convert.1 usr/share/man/man1
# from the static flavor
debian/install/static/@LIBDIR@/libg?k*.a @LIBDIR@

View File

@ -1,62 +0,0 @@
From: =?utf-8?q?Lo=C3=AFc_Minier?= <lool@dooz.org>
Date: Sat, 21 Sep 2013 23:37:03 +0200
Subject: Don't query immodules for the local tree under --disable-shared
[mbiebl: follow upstream and use immodules.cache instead of gtk.immodules]
Bug: http://bugzilla.gnome.org/show_bug.cgi?id=346531
Forwarded: yes
Applied-upstream: no, bug was closed due to lack of feedback
---
configure.ac | 1 +
modules/input/Makefile.am | 17 ++++++++++++++++-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 44d3056..0294160 100644
--- a/configure.ac
+++ b/configure.ac
@@ -182,6 +182,7 @@ fi
AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL
+AM_CONDITIONAL([ENABLE_SHARED], [test "$enable_shared" = yes])
dnl when using libtool 2.x create libtool early, because it's used in configure
m4_ifdef([LT_OUTPUT], [LT_OUTPUT])
diff --git a/modules/input/Makefile.am b/modules/input/Makefile.am
index c8610fa..bfe5085 100644
--- a/modules/input/Makefile.am
+++ b/modules/input/Makefile.am
@@ -189,7 +189,11 @@ dist_imconffile_DATA = im-multipress.conf
if CROSS_COMPILING
RUN_QUERY_IMMODULES_TEST=false
else
+if ENABLE_SHARED
RUN_QUERY_IMMODULES_TEST=test -z "$(DESTDIR)"
+else
+RUN_QUERY_IMMODULES_TEST=false
+endif
endif
# Running this if cross compiling or if DESTDIR is set is going to
@@ -253,7 +257,18 @@ noinst_LTLIBRARIES = \
included-modules: $(noinst_LTLIBRARIES)
immodules.cache: Makefile.am $(module_LTLIBRARIES)
- $(top_builddir)/gtk/gtk-query-immodules-2.0 $(module_LTLIBRARIES) > immodules.cache
+ @if $(RUN_QUERY_IMMODULES_TEST) ; then \
+ echo "$(top_builddir)/gtk/gtk-query-immodules-2.0 > immodules.cache" ; \
+ $(top_builddir)/gtk/gtk-query-immodules-2.0 $(module_LTLIBRARIES) > immodules.cache; \
+ else \
+ echo "***" ; \
+ echo "*** Warning: immodules.cache not built" ; \
+ echo "***" ; \
+ echo "*** Generate this file manually on host" ; \
+ echo "*** system using gtk-query-immodules-2.0" ; \
+ echo "***" ; \
+ touch immodules.cache; \
+ fi
CLEANFILES = immodules.cache

View File

@ -1,27 +0,0 @@
From: =?utf-8?q?Lo=C3=AFc_Minier?= <lool@dooz.org>
Date: Tue, 15 Aug 2006 09:54:12 +0000
Subject: Don't build perf measurement tools in static builds
Bug: http://bugzilla.gnome.org/show_bug.cgi?id=346559
---
Makefile.am | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am
index 8e3a2f1..1fdcbc4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,12 @@
## Makefile.am for GTK+
include $(top_srcdir)/Makefile.decl
-SRC_SUBDIRS = gdk gtk modules demos tests perf
+# don't build perf measurement tools in static builds
+if ENABLE_SHARED
+MAYBE_PERF = perf
+endif
+
+SRC_SUBDIRS = gdk gtk modules demos tests $(MAYBE_PERF)
SUBDIRS = po po-properties $(SRC_SUBDIRS) docs m4macros build
# require automake 1.4

View File

@ -1,64 +0,0 @@
From: Josselin Mouette <joss@debian.org>
Date: Sun, 18 Nov 2007 01:30:52 +0100
Subject: Generate correct Requires.private for gdk-2.0.pc
This contains all necessary dependencies for static linking, moving them
out of Requires.
Based on a GTK+ 3 commit by Matthias Clasen.
Origin: upstream, 3.3.6, commit:b558885221afa5cce0abbd42410877d58d8d2d9a
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=665326
---
configure.ac | 14 +++++++++-----
gdk-2.0.pc.in | 1 +
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/configure.ac b/configure.ac
index 0294160..3eaa305 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1325,23 +1325,27 @@ LDFLAGS="$saved_ldflags"
# Pull in gio-unix for GDesktopAppInfo usage, see at least gdkapplaunchcontext-x11.c
if test "x$gdktarget" = "xx11"; then
- GDK_PACKAGES="$PANGO_PACKAGES gio-unix-2.0 $X_PACKAGES gdk-pixbuf-2.0 cairo-$cairo_backend"
+ GDK_PACKAGES="$PANGO_PACKAGES gdk-pixbuf-2.0"
+ GDK_PRIVATE_PACKAGES="gio-unix-2.0 $X_PACKAGES cairo-$cairo_backend"
else
- GDK_PACKAGES="$PANGO_PACKAGES gio-2.0 gdk-pixbuf-2.0 cairo-$cairo_backend"
+ GDK_PACKAGES="$PANGO_PACKAGES gdk-pixbuf-2.0"
+ GDK_PRIVATE_PACKAGES="gio-2.0 cairo-$cairo_backend"
fi
-GDK_DEP_LIBS="$GDK_EXTRA_LIBS `$PKG_CONFIG --libs $GDK_PACKAGES` $MATH_LIB"
-GDK_DEP_CFLAGS="`$PKG_CONFIG --cflags gthread-2.0 $GDK_PACKAGES` $GDK_EXTRA_CFLAGS"
+GDK_DEP_LIBS="$GDK_EXTRA_LIBS `$PKG_CONFIG --libs $GDK_PACKAGES $GDK_PRIVATE_PACKAGES` $MATH_LIB"
+GDK_DEP_CFLAGS="`$PKG_CONFIG --cflags gthread-2.0 $GDK_PACKAGES $GDK_PRIVATE_PACKAGES` $GDK_EXTRA_CFLAGS"
#
# If we aren't writing explicit dependencies, then don't put the extra libraries we need
# into the pkg-config files
#
if test $enable_explicit_deps != yes ; then
- GDK_PACKAGES="$PANGO_PACKAGES gdk-pixbuf-2.0"
GDK_EXTRA_LIBS=
+else
+ GDK_PACKAGES="$GDK_PACKAGES $GDK_PRIVATE_PACKAGES"
fi
AC_SUBST(GDK_PACKAGES)
+AC_SUBST(GDK_PRIVATE_PACKAGES)
AC_SUBST(GDK_EXTRA_LIBS)
AC_SUBST(GDK_EXTRA_CFLAGS)
AC_SUBST(GDK_DEP_LIBS)
diff --git a/gdk-2.0.pc.in b/gdk-2.0.pc.in
index 5b2a5d8..9acba30 100644
--- a/gdk-2.0.pc.in
+++ b/gdk-2.0.pc.in
@@ -8,5 +8,6 @@ Name: GDK
Description: GTK+ Drawing Kit (${target} target)
Version: @VERSION@
Requires: @GDK_PACKAGES@
+Requires.private: @GDK_PRIVATE_PACKAGES@
Libs: -L${libdir} -lgdk-${target}-@GTK_API_VERSION@ @GDK_EXTRA_LIBS@
Cflags: -I${includedir}/gtk-2.0 -I${libdir}/gtk-2.0/include @GDK_EXTRA_CFLAGS@

View File

@ -16,9 +16,6 @@ modules-other-gail-gailtreeview.c-Fix-Waddress-warning.patch
modules-other-gail-gailtreeview.c-Fix-Wunused-but-set-var.patch
modules-other-gail-gailtreeview.c-Incorporate-review-sugg.patch
Consistently-use-g_stat-and-GStatBuf.patch
001_static-linking-dont-query-immodules.patch
002_static-linking-dont-build-perf.patch
003_gdk.pc_privates.patch
004_gtk+-ximian-gtk2-filesel-navbutton-5.patch
005_support_disabling_x11_extensions.patch
015_default-fallback-icon-theme.patch

2
debian/rules vendored
View File

@ -71,7 +71,7 @@ ALL_PKGS := $(BINARY_INDEP_PKGS) $(BINARY_ARCH_PKGS)
# list of flavors we build; each gets a builddir, a configure pass (configure
# args are defined below), a build pass, and an install pass (in two steps)
# Note: the shared flavor is required
FLAVORS := shared static
FLAVORS := shared
ifneq ($(filter %-udeb,$(built_binaries)),)
FLAVORS += shared_udeb