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

Solving recursive dependency disease in KDE-based packages

Most KDE and KDE-dependent packages have an 'admin' directory with various
evil and unnecessary files in it.  I think I've found a recipe for
removing the recursive dependencies from such KDE packages.

(1) Relibtoolizing.  This is much trickier than normal.  First install
Debian's libtool and autotools-dev.  Run all these commands from the top level

  libtoolize --copy --force

Make sure that ltmain.sh, config.guess, and config.sub have been replaced
in admin.

KDE likes to use its own copy of libtool.m4, so appease it by copying your
version into place.

  cp /usr/share/aclocal/libtool.m4 admin/libtool.m4.in

Regenerating acinclude.m4, aclocal.m4, configure.in, and finally configure,
can be a pain in the neck.  In some packages, it's done by


But if that fails you have to work out the individual steps involved.
Sometimes the code is in admin/Makefile.common, so you can run

  make -f admin/Makefile.common configure.in

Check that the right version of libtool.m4 got copied into acinclude.m4
and aclocal.m4.  You may have to do stuff like

  make -f admin/Makefile.common acinclude.m4

(2) Possibly fixing acinclude.m4.in

In my experience the redefinition of AC_FOREACH sometimes fights with the
new libtool.  It's just an optimization, so if autoconf crashes building
configure, delete that section from admin/acinclude.m4.in and rebuild
everything up to and including configure, as noted under (1).

(3) Fixing *_LDADD, *_LIBADD, *_LDFLAGS in the Makefile.am files.

  Replace stuff like $(LIBFOO) with -lfoo, and get rid of stuff like
  $(all_libraries).  $(LIBPTHREAD) is never needed on Linux and should
  be removed; there will be other libraries like that, where you should
  just remove the $(LIBFOO) entry entirely.  This takes some trial and error.
  The configure script may dump stuff into LDFLAGS, in which case your best
  bet is to delete that and replace it with an explicit list of libraries.
  It's OK to do these changes unconditionally because KDE never builds
  static libraries.

  To work out which libraries you're linked to which you don't actually need,
  ldd -u <executable or library> is invaluable.

  Rebuild your Makefile.in by running the correct version of automake,
  and then -- this is very important -- running


  All the KDE packages edit the Makefile.in generated by automake with
  this script before actually using them.  If you've managed to get
  a working Makefile, you may be able do this rebuild with
  'make (subdir)/Makefile.in'

  The configure script will be figuring out a lot of useless stuff, but it's
  easiest to let it waste its time.  admin/acinclude.m4.in has a lot of
  'foo-config' type code for working out recursive dependencies, and we
  want to ignore most of it, but it's rather hard to delete it without
  deleting code we actually want.  In the long run, it might be advisable
  to make a Debian-specific version of it with all the hideous cruft
  removed, and then all KDE-based packages could be fixed just by updating it;
  but that's a lot of work.

(4) Remove any cruft generated during the rebuild.
  Sometimes this process leaves extra files hanging around which weren't
  there before.  :-P

I license this message as if it were public domain; please copy it anywhere
it might help and edit it as needed.

Nathanael Nerode  <neroden@twcny.rr.com>

A thousand reasons. http://www.thousandreasons.org/
Lies, theft, war, kidnapping, torture, rape, murder...
Get me out of this fascist nightmare!

Reply to: