[Debian GNUstep maintainers] Re: progress on GNUstep packages

Hubert Chan hubert at uhoreg.ca
Sat Oct 15 02:53:02 UTC 2005


Attached is the debhelper script that I have written to move the GNUstep
files around.  Apparently, I have not yet fully written the last part
(for relocating framework stuff) -- it's just a stub right now.  But
this should be enough to give you an idea of what's going on.  If you
want, you can also try it out and check to see if it does the right
thing on your packages.  Just add dh_gnustep somewhere in your
debian/rules file, in an appropriate place in the binary-* rules.

-------------- next part --------------
#!/usr/bin/perl -w

=head1 NAME

dh_gnustep - moves files in the GNUstep hierarchy to FHS-compliant locations

=cut

use strict;
use File::Path;
use Debian::Debhelper::Dh_Lib;

=head1 SYNOPSIS

B<dh_gnustep> [S<I<debhelper options>>] ...options?

=head1 DESCRIPTION

dh_gnustep is a program based on debhelper that is responsible for moving files
in the GNUstop hierarchy within the System domain, rooted at
/usr/lib/GNUstep/System, to Filesystem Hierarchy Standard (FHS)-compliant
locations.

dh_gnustep makes the following changes:

=over 4

=item man and info documentation:

Moves man and info documentation to /usr/share/man and /usr/share/info,
respectively.

=item arch-indep directories:

Moves architecture-independent directories to /usr/share/GNUstep.

=item header files:

Moves header files to /usr/include/GNUstep/Headers.

=item library resources:

Moves library resources to /usr/share/GNUstep/Libraries.

=item shared library objects:

Moves .so files to /usr/lib.

=item frameworks:

Moves framework headers to /usr/include/GNUstep/Frameworks, and framework
resources to /usr/share/GNUstep/Frameworks.

=back

=head1 OPTIONS

...?

=head1 BUGS

Should implement B<-X> option.

Should do something with resources in .app bundles

=head1 CONFORMS TO

Debian policy, version 3.6.2

FHS, version 2.3

=cut

init();

my $SYS_ROOT = 'usr/lib/GNUstep/System';
my $LIB_ROOT = $SYS_ROOT . '/Library';
my $SHARE_ROOT = 'usr/share/GNUstep';
my $INCLUDE_ROOT = 'usr/include/GNUstep';

my @ARCH_INDEP_DIRS = qw(Colors DTDs DocTemplates Documentation Fonts Images KeyBindings PostScript Sounds);

foreach my $package (@{$dh{DOPACKAGES}}) {
	my $tmp=tmpdir($package);

	# move man and info pages to usr/share/man and usr/share/info
	if (-d "$tmp/$LIB_ROOT/Documentation/man") {
		mkpath "$tmp/usr/share/man";
		rename "$tmp/$LIB_ROOT/Documentation/man", "$tmp/usr/share/man";
	}
	if (-d "$tmp/$LIB_ROOT/Documentation/info") {
		mkpath "$tmp/usr/share/info";
		rename "$tmp/$LIB_ROOT/Documentation/info", "$tmp/usr/share/info";
	}

	# move arch-indep directories to usr/share/GNUstep
	foreach my $directory (@ARCH_INDEP_DIRS) {
		if (-d "$tmp/$LIB_ROOT/$directory") {
			mkpath "$tmp/$SHARE_ROOT/$directory";
			rename "$tmp/$LIB_ROOT/$directory", "$tmp/$SHARE_ROOT/$directory";
		}
	}

	# move headers to usr/include/GNUstep
	if (-d "$tmp/$LIB_ROOT/Headers") {
		mkpath "$tmp/$INCLUDE_ROOT/Headers";
		rename "$tmp/$LIB_ROOT/Headers", "$tmp/$INCLUDE_ROOT/Headers";
	}

	# move library resources to usr/share/GNUstep/Libraries
	if (-d "$tmp/$LIB_ROOT/Libraries/Resources") {
		mkpath "$tmp/$SHARE_ROOT/Libraries";
	        rename "$tmp/$LIB_ROOT/Libraries/Resources", "$tmp/$SHARE_ROOT/Libraries";
	}

	# move shared library objects to usr/lib
	if (-d "$tmp/$LIB_ROOT/Libraries") {
		opendir LIBDIR, "$tmp/$LIB_ROOT/Libraries";
		my @libraries = grep -f "$tmp/$LIB_ROOT/Libraries/$_", readdir LIBDIR;
		close LIBDIR;
		foreach my $library (@libraries) {
			if (-l "$tmp/$LIB_ROOT/Libraries/$library") {
				my $linkend = readlink "$tmp/$LIB_ROOT/Libraries/$library";
				if ($linkend =~ m|^../Frameworks|) {
					# Framework library -- create new link with right target; leave original in place
					$linkend =~ s|^..|GNUstep/System/Library|;
					symlink $linkend, "$tmp/usr/lib/$library";
				} else {
					# regular library -- move to usr/lib and create compatibility symlink
					rename "$tmp/$LIB_ROOT/Libraries/$library", "$tmp/usr/lib";
					symlink "../../../../$library", "GNUstep/System/Library/Libraries/$library";
				}
			}
		}
	}

	# find frameworks and move resources and headers
	# FIXME
	if (-d "$tmp/$LIB_ROOT/Frameworks") {
		opendir FRAMEWORKDIR, "$tmp/$LIB_ROOT/Frameworks";
		my @frameworks = grep !/^./, readdir FRAMEWORKDIR;
		close FRAMEWORKDIR;
		foreach my $framework (@frameworks) {
			print "  move framework $framework\n";
			my $fwdir = "$tmp/$LIB_ROOT/Frameworks/$framework";
			opendir CURFWDIR, "$fwdir/Versions";
			my @versions = grep !/^Current$/, readdir CURFWDIR;
			foreach my $version (@versions) {
				print "    version: $version\n";
				if (-d "$fwdir/Versions/$version/Headers") {
					print "      move headers\n";
				}
				if (-d "$fwdir/Versions/$version/Resources") {
					print "      move resources\n";
				}
			}
		}
	}
}

=head1 SEE ALSO

L<debhelper(7)>

This program is not yet part of debhelper.

=head1 AUTHOR

Hubert Chan <hubert at uhoreg.ca>

=cut
-------------- next part --------------

I just emailed Joey Hess (debhelper maintainer) to ask him about
whether/how this script should be included in debhelper.

I've put up file listings for gnustep-make and gnustep-make-doc with the
relocated files, so that you can get a little taste of what things will
look like.  (Unfortunately, gnustep-make and gnustep-make-doc aren't
exactly the most exciting packages to see what's going on.)
http://www.uhoreg.ca/programming/debian/gnustep/gnustep-make-list.text
http://www.uhoreg.ca/programming/debian/gnustep/gnustep-make-doc-list.text

A couple of changes to my proposed file relocation scheme:

- I'm not moving System/Library/Makefiles into
  /usr/share/GNUstep/Makefiles, like I had planned to.  It contains the
  architecture-dependent binaries user_home and which_lib, as well as a
  directory named "ix86".  user_home and which_lib, being
  arch-dependent, can't go under /usr/share.  However, everything else
  in System/Library/Makefiles is arch-indep, and probably should go in
  /usr/share.  I'm not sure what the best way to do this is.  The only
  thing I could think of is to move user_home and which_lib to
  System/Tools, and replace them with a symlink on
  System/Library/Makefiles, and then move System/Library/Makefiles to
  /usr/share/GNUstep/Makefiles.  Does anyone see any problems with that?
  There's also the question of what to do with the "ix86" directory,
  which seems to be meant for arch-dependent stuff.  Does anyone else
  have any ideas?

- I'm leaving documentation in /usr/share/GNUstep/Documentation, instead
  of suggesting that it's put it /usr/share/doc/<package>.  Policy only
  says that text documentation "should" go in there, and trying to move
  everything, and manage symlinks, is going to be a big pain.  You can
  make the move in your own packages, but I'm not going to recommend
  that it be done for everyone.

I should be able to put up new gnustep-make packages soon, and I think
that the rest of the base packages shouldn't be too hard to adapt.

-- 
Hubert Chan <hubert at uhoreg.ca> - http://www.uhoreg.ca/
PGP/GnuPG key: 1024D/124B61FA
Fingerprint: 96C5 012F 5F74 A5F7 1FF7  5291 AF29 C719 124B 61FA
Key available at wwwkeys.pgp.net.   Encrypted e-mail preferred.


More information about the pkg-GNUstep-maintainers mailing list