]> git.donarmstrong.com Git - debhelper.git/blob - dh_icons
cmake: Pass CPPFLAGS in CFLAGS. Closes: #668813 Thanks, Simon Ruderich for the patch...
[debhelper.git] / dh_icons
1 #!/usr/bin/perl -w
2
3 =head1 NAME
4
5 dh_icons - Update Freedesktop icon caches
6
7 =cut
8
9 use strict;
10 use File::Find;
11 use Debian::Debhelper::Dh_Lib;
12
13 =head1 SYNOPSIS
14
15 B<dh_icons> [S<I<debhelper options>>] [B<-n>]
16
17 =head1 DESCRIPTION
18
19 B<dh_icons> is a debhelper program that updates Freedesktop icon caches
20 when needed, using the B<update-icon-caches> program provided by GTK+2.12.
21 Currently this program does not handle installation of the files, though it
22 may do so at a later date. It takes care of adding maintainer script
23 fragments to call B<update-icon-caches>.
24
25 =head1 OPTIONS
26
27 =over 4
28
29 =item B<-n>, B<--noscripts>
30
31 Do not modify maintainer scripts.
32
33 =back
34
35 =cut
36
37 init();
38
39 my $baseicondir="/usr/share/icons";
40
41 foreach my $package (@{$dh{DOPACKAGES}}) {
42         my $tmp=tmpdir($package);
43         my $icondir="$tmp$baseicondir";
44         if (-d $icondir) {
45                 my @dirlist;
46                 opendir(DIRHANDLE, $icondir);
47                 while (my $subdir = readdir(DIRHANDLE)) {
48                         next if $subdir =~ /^\./;
49                         next if $subdir eq "gnome";
50                         next if $subdir eq "hicolor";
51                         my $needs_cache = 0;
52                         find sub {
53                                 $needs_cache = 1 if -f and (/\.png$/ or /\.svg$/ or /\.xpm$/ or /\.icon$/);
54                         }, "$icondir/$subdir" ;
55                         push @dirlist, "$baseicondir/$subdir" if $needs_cache;
56                 }
57                 if (@dirlist and ! $dh{NOSCRIPTS}) {
58                         my $list=join(" ", @dirlist);
59                         autoscript($package,"postinst","postinst-icons","s%#DIRLIST#%$list%");
60                         autoscript($package,"postrm","postrm-icons","s%#DIRLIST#%$list%");
61                 }
62         }
63 }
64
65 =head1 SEE ALSO
66
67 L<debhelper>
68
69 This program is a part of debhelper.
70
71 =head1 AUTHOR
72
73 Ross Burton <ross@burtonini.com>
74 Jordi Mallach <jordi@debian.org>
75 Josselin Mouette <joss@debian.org>
76
77 =cut