]> git.donarmstrong.com Git - debhelper.git/blob - dh_installxfonts
r1086: * Several man pae typo fixes by Ruben Porras. Closes: #202819
[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 depend on xutils (>= 4.0.3) so that the
29 update-fonts-* commands are available. (This program adds that dependency to
30 ${misc:Depends}.)
31
32 This program automatically generates the postinst and postrm commands needed
33 to register X fonts.  See L<dh_installdeb(1)> for an explanation of how this
34 works.
35
36 =head1 NOTES
37
38 See L<update-fonts-alias(8)>, L<update-fonts-scale(8)>, and
39 L<update-fonts-dir(8)> for more information about X font installation.
40
41 See Debian policy, section 12.8.5. for details about doing fonts the Debian
42 way.
43
44 =cut
45
46 init();
47
48 foreach my $package (@{$dh{DOPACKAGES}}) {
49         my $tmp=tmpdir($package);
50         my $XFONTDIR="$tmp/usr/X11R6/lib/X11/fonts/";
51
52         # Find all font directories in the package build directory.
53         opendir DIR, $XFONTDIR || next;
54         my @fontdirs = grep { -d "$XFONTDIR/$_" && !/^\./ } (readdir DIR);
55         closedir DIR;
56
57         if (@fontdirs) {
58                 # Figure out what commands the postinst and postrm will need 
59                 # to call.
60                 my @cmds;
61                 foreach my $f (@fontdirs) {
62                         # This must come before update-fonts-dir.
63                         push @cmds, "update-fonts-scale $f"
64                                 if -f "$tmp/etc/X11/fonts/$f/$package.scale";
65                         push @cmds, "update-fonts-dir $f";
66                         push @cmds, "update-fonts-alias $f"
67                                 if -f "$tmp/etc/X11/fonts/$f/$package.alias";
68                 }
69
70                 autoscript($package, "postinst", "postinst-xfonts",
71                         "s:#CMDS#:".join(";", @cmds).":;");
72                 autoscript($package, "postrm", "postrm-xfonts",
73                         "s:#CMDS#:".join(";", @cmds).":;");
74
75                 addsubstvar($package, "misc:Depends", "xutils", ">= 4.0.3");
76         }
77         else {
78                 # remove
79                 addsubstvar($package, "misc:Depends", "xutils", ">= 4.0.3", 1);
80         }
81 }
82
83 =head1 SEE ALSO
84
85 L<debhelper(7)>
86
87 This program is a part of debhelper.
88
89 =head1 AUTHOR
90
91 Joey Hess <joeyh@debian.org>
92
93 =cut