]> git.donarmstrong.com Git - debhelper.git/blob - dh_installxfonts
Typo. Closes: #653339
[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 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.
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 F<fonts.alias> or F<fonts.scale> files, you should
25 install them into the correct location under F<etc/X11/fonts> in your
26 package build directory.
27
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}>.)
31
32 This program automatically generates the F<postinst> and F<postrm> commands needed
33 to register X fonts. These commands are inserted into the maintainer
34 scripts by B<dh_installdeb>. See L<dh_installdeb(1)> for an explanation of how
35 this works.
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
42 See Debian policy, section 11.8.5. for details about doing fonts the Debian
43 way.
44
45 =cut
46
47 init();
48
49 foreach my $package (@{$dh{DOPACKAGES}}) {
50         my $tmp=tmpdir($package);
51
52         # Find all font directories in the package build directory.
53         my @fontdirs;
54         foreach my $parentdir ("$tmp/usr/share/fonts/X11/") {
55                 opendir(DIR, $parentdir) || next;
56                 @fontdirs = grep { -d "$parentdir/$_" && !/^\./ } (readdir DIR);
57                 closedir DIR;
58         }
59
60         if (@fontdirs) {
61                 # Figure out what commands the postinst and postrm will need 
62                 # to call.
63                 my @cmds;
64                 my @cmds_postinst;
65                 my @cmds_postrm;
66                 foreach my $f (@fontdirs) {
67                         # This must come before update-fonts-dir.
68                         push @cmds, "update-fonts-scale $f"
69                                 if -f "$tmp/etc/X11/fonts/$f/$package.scale";
70                         push @cmds, "update-fonts-dir --x11r7-layout $f";
71                         if (-f "$tmp/etc/X11/fonts/$f/$package.alias") {
72                                 push @cmds_postinst, "update-fonts-alias --include /etc/X11/fonts/$f/$package.alias $f";
73                                 push @cmds_postrm, "update-fonts-alias --exclude /etc/X11/fonts/$f/$package.alias $f";
74                                 addsubstvar($package, "misc:Depends", "xfonts-utils (>= 1:7.5+2)");
75                         }
76                 }
77
78                 autoscript($package, "postinst", "postinst-xfonts",
79                         "s:#CMDS#:".join(";", @cmds, @cmds_postinst).":");
80                 autoscript($package, "postrm", "postrm-xfonts",
81                         "s:#CMDS#:".join(";", @cmds, @cmds_postrm).":");
82
83                 addsubstvar($package, "misc:Depends", "xfonts-utils");
84         }
85 }
86
87 =head1 SEE ALSO
88
89 L<debhelper(7)>
90
91 This program is a part of debhelper.
92
93 =head1 AUTHOR
94
95 Joey Hess <joeyh@debian.org>
96
97 =cut