]> git.donarmstrong.com Git - debhelper.git/blob - dh_installxfonts
r504: * dh_installman: more documentation about the .TH line. Closes: #129205
[debhelper.git] / dh_installxfonts
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
18 dh_installxfonts is a debhelper program that is responsible for
19 registering X fonts, so their corresponding fonts.dir, fonts.alias,
20 and fonts.scale be rebuilt properly at install time.
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
24 directory, and if you have fonts.alias or fonts.scale files, you should
25 install them into the correct location under etc/X11/fonts in your package
26 build directory.
27
28 Your package should should depend on xutils (>= 4.0.3) so that the
29 update-fonts-* commands are available.
30
31 This programt automatically generates the postinst and postrm commands needed
32 to register X fonts.  See L<dh_installdeb(1)> for an explanation of how this
33 works.
34
35 =head1 NOTES
36
37 See L<update-fonts-alias(8)>, L<update-fonts-scale(8)>, and
38 L<update-fonts-dir(8)> for more information about X font installation.
39
40 See Debian policy, section 12.8.5. for details about doing fonts the Debian
41 way.
42
43 =cut
44
45 init();
46
47 foreach my $package (@{$dh{DOPACKAGES}}) {
48         my $tmp=tmpdir($package);
49         my $XFONTDIR="$tmp/usr/X11R6/lib/X11/fonts/";
50
51         # Find all font directories in the package build directory.
52         opendir DIR, $XFONTDIR || next;
53         my @fontdirs = grep { -d "$XFONTDIR/$_" && !/^\./ } (readdir DIR);
54         closedir DIR;
55
56         if (@fontdirs) {
57                 # Figure out what commands the postinst and postrm will need 
58                 # to call.
59                 my @cmds;
60                 foreach my $f (@fontdirs) {
61                         push @cmds, "update-fonts-dir $f";
62                         push @cmds, "update-fonts-alias $f"
63                                 if -f "$tmp/etc/X11/fonts/$f/$package.alias";
64                         # This must come _before_ mkfontdir, thus the unshift.
65                         unshift @cmds, "update-fonts-scale $f"
66                                 if -f "$tmp/etc/X11/fonts/$f/$package.scale";
67                 }
68
69                 autoscript($package, "postinst", "postinst-xfonts",
70                         "s:#CMDS#:".join("\n", @cmds).":;");
71                 autoscript($package, "postrm", "postrm-xfonts",
72                         "s:#CMDS#:".join("\n", @cmds).":;");
73         }
74 }
75
76 =head1 SEE ALSO
77
78 L<debhelper(1)>
79
80 This program is a part of debhelper.
81
82 =head1 AUTHOR
83
84 Joey Hess <joeyh@debian.org>
85
86 =cut