~bratsche/ubuntu/maverick/gtk+2.0/menu-activation-fix

« back to all changes in this revision

Viewing changes to debian/dh_gtkmodules.in

  • Committer: Bazaar Package Importer
  • Author(s): Robert Ancell
  • Date: 2010-07-22 21:41:30 UTC
  • mfrom: (1.11.7 upstream) (72.1.16 experimental)
  • Revision ID: james.westby@ubuntu.com-20100722214130-5uzyvpb9g4m0ts2c
Tags: 2.21.5-1ubuntu1
* Merge with Debian experimental, Ubuntu changes:
* debian/control.in:
  - Add introspection build-depends
  - Add Vcs-Bzr link
  - Add gir1.0-gtk-2.0 package
  - libgtk2.0-dev replaces gir-repository-dev
  - Conflict with appmenu-gtk (<< 0.1.3) to prevent menu proxy breakage
* debian/rules:
  - Build with --enable-introspection
  - Add gir1.0-gtk-2.0 package to BINARY_ARCH_PKGS
  - Add dh_girepository call
  - Disable devhelp files
* debian/dh_gtkmodules.in:
  - Remove obsolete script content
* debian/libgtk2.0-0.symbols:
  - Add Ubuntu specific symbols
* debian/libgtk2.0-dev.install.in:
  - Add gir files
* debian/libgtk2.0-doc.install.in
  - Disable devhelp files
* debian/gir1.0-gtk-2.0.install.in
  - Introspection package
* debian/patches/043_menu_proxy.patch
  - Add GtkMenuProxy support for remoting menus.
* debian/patches/062_dnd_menubar.patch:
  - Allow click on menubars for dnd
* debian/patches/063_treeview_almost_fixed.patch:
  - Add an ubuntu-almost-fixed-height-mode property, (required for
    software-center)
* debian/patches/071_no_offscreen_widgets_grabbing.patch:
  - Don't let offscreen widgets do grabbing
* debian/patches/072_indicator_menu_update.patch:
  - change by Cody Russell to send an update event on menu changes,
    should make the bluetooth indicator refresh correctly
* debian/patches/091_bugzilla_tooltip_refresh.patch:
  - Upstream bugzilla change to have better looking tooltips the gtk theme
    need to set "new-tooltip-style" to use those
* debian/watch:
  - Watch for unstable versions

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
 
43
43
init();
44
44
 
45
 
# 'abs_path' from Cwd resolves symlinks, and we don't want that to happen
46
 
# (otherwise it's harder to remove the prefix of the generated output)
47
 
sub make_absolute_path {
48
 
    my $path = shift;
49
 
    if ($path =~ m#^/#) {
50
 
        return $path;
51
 
    }
52
 
    my $cwd = getcwd;
53
 
    return "$cwd/$path";
54
 
}
55
 
 
56
 
# gdk-pixbuf-query-loaders helper (generates a GdkPixbuf loaders module
57
 
# file on its stdout with *.so passed on its command-line)
58
 
my $queryloaders;
59
 
if ($ENV{GTK_QUERYLOADERS}) {
60
 
    $queryloaders = $ENV{GTK_QUERYLOADERS};
61
 
} else {
62
 
    $queryloaders = '/@LIBDIR@/libgtk2.0-0/gdk-pixbuf-query-loaders';
63
 
}
64
 
 
65
 
# gtk-query-immodules-2.0 helper (generates an IM module file on its
66
 
# stdout with *.so passed on its command-line)
67
 
my $queryimmodules;
68
 
if ($ENV{GTK_QUERYIMMODULES}) {
69
 
    $queryimmodules = $ENV{GTK_QUERYIMMODULES};
70
 
} else {
71
 
    $queryimmodules = '/@LIBDIR@/libgtk2.0-0/gtk-query-immodules-2.0';
72
 
}
73
 
 
74
 
# relative Gtk base module path
75
 
my $modules_base_path = '@MODULES_BASE_PATH@';
76
 
 
77
 
# relative path to GdkPixbuf loaders modules (separated by ":")
78
 
my $loaders_modules_path = "$modules_base_path/loaders";
79
 
# relative directory to store the generated loader module file
80
 
my $loader_module_files_d = "$modules_base_path/loader-files.d";
81
 
 
82
 
# relative path to IM modules (separated by ":")
83
 
my $im_modules_path = "$modules_base_path/immodules";
84
 
# relative directory to store the generated IM module file
85
 
my $im_module_files_d = "$modules_base_path/immodule-files.d";
86
 
 
87
 
# Gtk binary version virtual Provide
88
 
my $gtk_binver_dep = '@GTK_BINVER_DEP@';
89
 
 
90
 
sub find_modules {
91
 
    # where to store the modules we find
92
 
    my $modules_ref = shift;
93
 
    # base directory to prepend to the list of locations
94
 
    my $basedir = shift;
95
 
    # list of locations to search relative to $basedir separated with ":"
96
 
    my $path = shift;
97
 
 
98
 
    foreach (map("$basedir/$_", split(/:/, $path))) {
99
 
        # it's necessary to make the path absolute to strip the build-time
100
 
        # prefix later on
101
 
        my $path = make_absolute_path($_);
102
 
        if (! -e $path) {
103
 
            verbose_print("skipping $path.");
104
 
            next;
105
 
        }
106
 
        if (-d $path) {
107
 
            # if path is a directory (or symlink to a directory), search for
108
 
            # *.so files or symlinks
109
 
            open(FIND,
110
 
              "find '$path' -name '*.so' \\( -type f -or -type l \\) |")
111
 
              or die "Can't run find: $!";
112
 
            while (<FIND>) {
113
 
                chomp;
114
 
                push @$modules_ref, $_;
115
 
            }
116
 
            close FIND or die "Error while running find: $!";
117
 
        } elsif (-f $path or -l $path) {
118
 
            # if path is a file or symlink, simply add it to the list
119
 
            push @$modules_ref, $path;
120
 
        } else {
121
 
            error("$path has unknown file type.");
122
 
        }
123
 
    }
124
 
}
125
 
 
126
 
sub query_modules {
127
 
    # absolute pathname to query helper
128
 
    my $querymodules = shift;
129
 
    # base directory to prepend to the output module file and to strip
130
 
    # of the output
131
 
    my $basedir = shift;
132
 
    # relative directory where to write the module file
133
 
    my $module_files_d = shift;
134
 
    # relative path of the module file
135
 
    my $module_file = shift;
136
 
    # modules to query
137
 
    my @modules = @_;
138
 
 
139
 
    my $do_query = join ' ', $querymodules, @modules;
140
 
    open(QUERY, "$do_query 2>&1 |")
141
 
        or die "Can't query modules with $querymodules: $!";
142
 
 
143
 
    doit("rm", "-f", "$module_file");
144
 
    if (! -d "$basedir/$module_files_d") {
145
 
        doit("install", "-d", "$basedir/$module_files_d");
146
 
    }
147
 
    complex_doit("printf '%s\\n' '# automatically generated by dh_gtkmodules, do not edit' >>$module_file");
148
 
 
149
 
    my $absolute_basedir = make_absolute_path($basedir);
150
 
    my $n_lines = 0;
151
 
    while (<QUERY>) {
152
 
        next if m/^#/;
153
 
        chomp;
154
 
        # if some module couldn't be loaded by the query helper, bail out
155
 
        if (m#^g_module_open\(\) failed for #) {
156
 
            error("$querymodules could not load a module:\n$_\nYou should probably make the libraries built by your package available via LD_LIBRARY_PATH.");
157
 
        }
158
 
        # strip build-time prefix from output
159
 
        if (m#^\Q"$absolute_basedir/\E#) {
160
 
            s#^\Q"$absolute_basedir/\E#"/#;
161
 
        }
162
 
        complex_doit("printf '%s\\n' '$_' >>$module_file");
163
 
        $n_lines++;
164
 
    }
165
 
    # nothing written to the module file, fail miserably
166
 
    if (0 == $n_lines) {
167
 
        doit("rm", "-f", "$module_file");
168
 
        error("Internal error: could not find any module in the output of $querymodules.");
169
 
    }
170
 
 
171
 
    doit("chmod", 644, "$module_file");
172
 
    doit("chown", "0:0", "$module_file");
173
 
 
174
 
    close QUERY or die "Error while querying modules with $querymodules: $!";
175
 
}
176
 
 
177
 
foreach my $package (@{$dh{DOPACKAGES}}) {
178
 
    my $tmp = tmpdir($package);
179
 
    my @loaders_modules = ();
180
 
    my @im_modules = ();
181
 
 
182
 
    # if the versionned directory isn't present, give up on package
183
 
    if (! -d "$tmp/$modules_base_path") {
184
 
        next;
185
 
    }
186
 
 
187
 
    # since the versionned module directory exists, generate a dependency
188
 
    # on the Gtk binary version
189
 
    if (! $dh{K_FLAG}) {
190
 
        addsubstvar($package, "misc:Depends", $gtk_binver_dep);
191
 
    }
192
 
 
193
 
    # search for specific module types
194
 
    find_modules(\@loaders_modules, $tmp, $loaders_modules_path);
195
 
    find_modules(\@im_modules, $tmp, $im_modules_path);
196
 
 
197
 
    warning("Package $package has " . @loaders_modules . " GdkPixbuf loaders and " . @im_modules . " Gtk IM modules.");
198
 
 
199
 
    # if no modules of these types were found, we're done
200
 
    if (0 == @loaders_modules + @im_modules) {
201
 
        next;
202
 
    }
203
 
 
204
 
    if (@loaders_modules) {
205
 
        query_modules($queryloaders,
206
 
                      $tmp,
207
 
                      $loader_module_files_d,
208
 
                      "$tmp/$loader_module_files_d/$package.loaders",
209
 
                      @loaders_modules);
210
 
    }
211
 
    if (@im_modules) {
212
 
        query_modules($queryimmodules,
213
 
                      $tmp,
214
 
                      $im_module_files_d,
215
 
                      "$tmp/$im_module_files_d/$package.immodules",
216
 
                      @im_modules);
217
 
    }
218
 
}
 
45
warning("This program is deprecated, everything is handled by triggers now.");
 
46
exit 0;
219
47
 
220
48
=back
221
49