~ubuntu-branches/ubuntu/utopic/debhelper/utopic-proposed

1 by Joey Hess
dh_install: delay globbing until after destintations have been found.
1
#!/usr/bin/perl -w
2
3
=head1 NAME
4
5
dh_installxfonts - register X fonts
6
7
=cut
8
9
use strict;
10
use Debian::Debhelper::Dh_Lib;
11
12
=head1 SYNOPSIS
13
14
B<dh_installxfonts> [S<I<debhelper options>>]
15
16
=head1 DESCRIPTION
17
1.4.21 by Joey Hess, Joey Hess, Valery Perrin
[ Joey Hess ]
18
B<dh_installxfonts> is a debhelper program that is responsible for
19
registering X fonts, so their corresponding F<fonts.dir>, F<fonts.alias>,
20
and F<fonts.scale> be rebuilt properly at install time.
1 by Joey Hess
dh_install: delay globbing until after destintations have been found.
21
22
Before calling this program, you should have installed any X fonts provided
23
by your package into the appropriate location in the package build
1.4.21 by Joey Hess, Joey Hess, Valery Perrin
[ Joey Hess ]
24
directory, and if you have F<fonts.alias> or F<fonts.scale> files, you should
25
install them into the correct location under F<etc/X11/fonts> in your
17 by Colin Watson, Colin Watson, Scott James Remnant
[ Colin Watson ]
26
package build directory.
1 by Joey Hess
dh_install: delay globbing until after destintations have been found.
27
1.4.21 by Joey Hess, Joey Hess, Valery Perrin
[ Joey Hess ]
28
Your package should depend on B<xfonts-utils> so that the
29
B<update-fonts->I<*> commands are available. (This program adds that dependency to
30
B<${misc:Depends}>.)
1 by Joey Hess
dh_install: delay globbing until after destintations have been found.
31
1.4.21 by Joey Hess, Joey Hess, Valery Perrin
[ Joey Hess ]
32
This program automatically generates the F<postinst> and F<postrm> commands needed
26 by Colin Watson
* Resynchronise with Debian. Remaining changes:
33
to register X fonts. These commands are inserted into the maintainer
1.4.21 by Joey Hess, Joey Hess, Valery Perrin
[ Joey Hess ]
34
scripts by B<dh_installdeb>. See L<dh_installdeb(1)> for an explanation of how
26 by Colin Watson
* Resynchronise with Debian. Remaining changes:
35
this works.
1 by Joey Hess
dh_install: delay globbing until after destintations have been found.
36
37
=head1 NOTES
38
39
See L<update-fonts-alias(8)>, L<update-fonts-scale(8)>, and
40
L<update-fonts-dir(8)> for more information about X font installation.
41
2 by Sebastien Bacher
dh_scrollkeeper: don't display the output (Warty #336).
42
See Debian policy, section 11.8.5. for details about doing fonts the Debian
1 by Joey Hess
dh_install: delay globbing until after destintations have been found.
43
way.
44
45
=cut
46
47
init();
48
1.4.58 by Joey Hess
* dh: Skips running commands that it can tell will do nothing.
49
# PROMISE: DH NOOP WITHOUT tmp(usr/share/fonts/X11)
50
1 by Joey Hess
dh_install: delay globbing until after destintations have been found.
51
foreach my $package (@{$dh{DOPACKAGES}}) {
52
	my $tmp=tmpdir($package);
53
54
	# Find all font directories in the package build directory.
17 by Colin Watson, Colin Watson, Scott James Remnant
[ Colin Watson ]
55
	my @fontdirs;
1.4.5 by Joey Hess
make: Avoid infinite make recursion that occurrs when testing existence
56
	foreach my $parentdir ("$tmp/usr/share/fonts/X11/") {
37 by Martin Pitt
* Merge with Debian unstable. Remaining Ubuntu changes:
57
		opendir(DIR, $parentdir) || next;
17 by Colin Watson, Colin Watson, Scott James Remnant
[ Colin Watson ]
58
		@fontdirs = grep { -d "$parentdir/$_" && !/^\./ } (readdir DIR);
59
		closedir DIR;
60
	}
1 by Joey Hess
dh_install: delay globbing until after destintations have been found.
61
62
	if (@fontdirs) {
63
		# Figure out what commands the postinst and postrm will need 
64
		# to call.
65
		my @cmds;
1.4.9 by Joey Hess
* dh(1): Minor rewording of documentation of override commands.
66
		my @cmds_postinst;
67
		my @cmds_postrm;
1 by Joey Hess
dh_install: delay globbing until after destintations have been found.
68
		foreach my $f (@fontdirs) {
69
			# This must come before update-fonts-dir.
70
			push @cmds, "update-fonts-scale $f"
71
				if -f "$tmp/etc/X11/fonts/$f/$package.scale";
17 by Colin Watson, Colin Watson, Scott James Remnant
[ Colin Watson ]
72
			push @cmds, "update-fonts-dir --x11r7-layout $f";
1.4.9 by Joey Hess
* dh(1): Minor rewording of documentation of override commands.
73
			if (-f "$tmp/etc/X11/fonts/$f/$package.alias") {
74
				push @cmds_postinst, "update-fonts-alias --include /etc/X11/fonts/$f/$package.alias $f";
75
				push @cmds_postrm, "update-fonts-alias --exclude /etc/X11/fonts/$f/$package.alias $f";
76
				addsubstvar($package, "misc:Depends", "xfonts-utils (>= 1:7.5+2)");
77
			}
1 by Joey Hess
dh_install: delay globbing until after destintations have been found.
78
		}
79
80
		autoscript($package, "postinst", "postinst-xfonts",
1.4.9 by Joey Hess
* dh(1): Minor rewording of documentation of override commands.
81
			"s:#CMDS#:".join(";", @cmds, @cmds_postinst).":");
1 by Joey Hess
dh_install: delay globbing until after destintations have been found.
82
		autoscript($package, "postrm", "postrm-xfonts",
1.4.9 by Joey Hess
* dh(1): Minor rewording of documentation of override commands.
83
			"s:#CMDS#:".join(";", @cmds, @cmds_postrm).":");
1 by Joey Hess
dh_install: delay globbing until after destintations have been found.
84
44 by Martin Pitt
* Merge with Debian unstable. Remaining Ubuntu changes:
85
		addsubstvar($package, "misc:Depends", "xfonts-utils");
1 by Joey Hess
dh_install: delay globbing until after destintations have been found.
86
	}
87
}
88
89
=head1 SEE ALSO
90
2 by Sebastien Bacher
dh_scrollkeeper: don't display the output (Warty #336).
91
L<debhelper(7)>
1 by Joey Hess
dh_install: delay globbing until after destintations have been found.
92
93
This program is a part of debhelper.
94
95
=head1 AUTHOR
96
97
Joey Hess <joeyh@debian.org>
98
99
=cut