/usr/lib/perl5/Alien/wxWidgets.pm is in libalien-wxwidgets-perl 0.64+dfsg-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 | package Alien::wxWidgets;
=head1 NAME
Alien::wxWidgets - building, finding and using wxWidgets binaries
=head1 SYNOPSIS
use Alien::wxWidgets <options>;
my $version = Alien::wxWidgets->version;
my $config = Alien::wxWidgets->config;
my $compiler = Alien::wxWidgets->compiler;
my $linker = Alien::wxWidgets->linker;
my $include_path = Alien::wxWidgets->include_path;
my $defines = Alien::wxWidgets->defines;
my $cflags = Alien::wxWidgets->c_flags;
my $linkflags = Alien::wxWidgets->link_flags;
my $libraries = Alien::wxWidgets->libraries( qw(gl adv core base) );
my @libraries = Alien::wxWidgets->link_libraries( qw(gl adv core base) );
my @implib = Alien::wxWidgets->import_libraries( qw(gl adv core base) );
my @shrlib = Alien::wxWidgets->shared_libraries( qw(gl adv core base) );
my @keys = Alien::wxWidgets->library_keys; # 'gl', 'adv', ...
my $library_path = Alien::wxWidgets->shared_library_path;
my $key = Alien::wxWidgets->key;
my $prefix = Alien::wxWidgets->prefix;
=head1 DESCRIPTION
Please see L<Alien> for the manifesto of the Alien namespace.
In short C<Alien::wxWidgets> can be used to detect and get
configuration settings from an installed wxWidgets.
=cut
use strict;
use Carp;
use Alien::wxWidgets::Utility qw(awx_sort_config awx_grep_config
awx_smart_config);
use Module::Pluggable sub_name => '_list',
search_path => 'Alien::wxWidgets::Config',
instantiate => 'config';
our $AUTOLOAD;
our $VERSION = '0.64';
our %VALUES;
our $dont_remap;
*_remap = \&Alien::wxWidgets::Utility::_awx_remap;
sub AUTOLOAD {
my $name = $AUTOLOAD;
$name =~ s/.*:://;
croak "Can not use '", $name, "'" unless exists $VALUES{$name};
return _remap( $VALUES{$name} );
}
sub import {
my $class = shift;
if( @_ == 1 ) {
$class->dump_configurations if $_[0] eq ':dump';
$class->show_configurations if $_[0] eq ':show';
return;
}
$class->load( @_ );
}
sub load {
my $class = shift;
my %crit = awx_smart_config @_;
my @configs = awx_sort_config awx_grep_config [ $class->_list ], %crit ;
unless( @configs ) {
my @all_configs = $class->get_configurations;
my $message = "Searching configuration for:\n";
$message .= _pretty_print_criteria( \%crit );
$message .= "\nAvailable configurations:\n";
if( @all_configs ) {
$message .= _pretty_print_configuration( $_ ) foreach @all_configs;
} else {
$message .= "No wxWidgets build found\n";
}
die $message;
}
%VALUES = $configs[0]->{package}->values;
}
sub _pretty_print_criteria {
my $criteria = shift;
my %display = %$criteria;
$display{version} = join '-', @{$display{version}} if ref $display{version};
$display{version} = '(any version)' unless $display{version};
$display{toolkit} = '(any toolkit)' unless $display{toolkit};
$display{compiler_kind} = '(any compiler)' unless $display{compiler_kind};
$display{compiler_version} = '(any version)' unless $display{compiler_version};
return _pretty_print_configuration( \%display );
}
sub _pretty_print_configuration {
my $config = shift;
my @options = map { !defined $config->{$_} ? () :
$config->{$_} ? ( $_ ) :
( "no $_" ) }
qw(debug unicode mslu);
return "wxWidgets $config->{version} for $config->{toolkit}; " .
"compiler compatibility: $config->{compiler_kind} " .
$config->{compiler_version} . '; ' .
( @options ? 'options: ' . join( ', ', @options ) : '' ) .
"\n";
}
sub show_configurations {
my $class = shift;
my @configs = $class->get_configurations( @_ );
print _pretty_print_configuration( $_ ) foreach @configs;
}
sub dump_configurations {
my $class = shift;
my @configs = $class->get_configurations( @_ );
require Data::Dumper;
print Data::Dumper->Dump( \@configs );
}
sub get_configurations {
my $class = shift;
return awx_sort_config awx_grep_config [ $class->_list ], @_;
}
my $lib_nok = 'adv|base|html|net|xml|media';
my $lib_mono_28 = 'adv|base|html|net|xml|xrc|media|aui|richtext';
my $lib_mono_29 = 'adv|base|html|net|xml|xrc|media|aui|richtext|stc';
sub _grep_libraries {
my $lib_filter = $VALUES{version} >= 2.005001 ? qr/(?!a)a/ : # no match
$^O =~ /MSWin32/ ? qr/^(?:$lib_nok|gl)$/ :
qr/^(?:$lib_nok)$/;
my( $type, @libs ) = @_;
my $dlls = $VALUES{_libraries};
@libs = keys %$dlls unless @libs;
push @libs, 'core', 'base' unless grep /^core|mono$/, @libs;
my $lib_mono = $VALUES{version} >= 2.009 ? $lib_mono_29 : $lib_mono_28;
if( ( $VALUES{config}{build} || '' ) eq 'mono' ) {
@libs = map { $_ eq 'core' ? ( 'mono' ) :
$_ =~ /^(?:$lib_mono)$/ ? () :
$_ } @libs;
@libs = qw(mono) unless @libs;
}
return map { _remap( $_ ) }
map { defined( $dlls->{$_}{$type} ) ? $dlls->{$_}{$type} :
croak "No such '$type' library: '$_'" }
grep !/$lib_filter/, @libs;
}
sub link_libraries { shift; return _grep_libraries( 'link', @_ ) }
sub shared_libraries { shift; return _grep_libraries( 'dll', @_ ) }
sub import_libraries { shift; return _grep_libraries( 'lib', @_ ) }
sub library_keys { shift; return keys %{$VALUES{_libraries}} }
sub libraries {
my $class = shift;
return ( _remap( $VALUES{link_libraries} ) || '' ) . ' ' .
join ' ', map { _remap( $_ ) }
$class->link_libraries( @_ );
}
1;
__END__
=head1 METHODS
=head2 load/import
use Alien::wxWidgets version => 2.004 | [ 2.004, 2.005 ],
compiler_kind => 'gcc' | 'cl', # Windows only
compiler_version => '3.3', # only GCC for now
toolkit => 'gtk2',
debug => 0 | 1,
unicode => 0 | 1,
mslu => 0 | 1,
key => $key,
;
Alien::wxWidgets->load( <same as the above> );
Using C<Alien::wxWidgets> without parameters will load a default
configuration (for most people this will be the only installed
confiuration). Additional parameters allow to be more selective.
If there is no matching configuration the method will C<die()>.
In case no arguments are passed in the C<use>, C<Alien::wxWidgets>
will try to find a reasonable default configuration.
Please note that when the version is pecified as C<version => 2.004>
it means "any version >= 2.004" while when specified as
C<version => [ 2.004, 2.005 ]> it means "any version => 2.004 and < 2.005".
=head2 key
my $key = Alien::wxWidgets key;
Returns an unique key that can be used to reload the
currently-loaded configuration.
=head2 version
my $version = Alien::wxWidgets->version;
Returns the wxWidgets version for this C<Alien::wxWidgets>
installation in the form MAJOR + MINOR / 1_000 + RELEASE / 1_000_000
e.g. 2.008012 for wxWidgets 2.8.12 and 2.009 for wxWidgets 2.9.0.
=head2 config
my $config = Alien::wxWidgets->config;
Returns some miscellaneous configuration information for wxWidgets
in the form
{ toolkit => 'msw' | 'gtk' | 'motif' | 'x11' | 'cocoa' | 'mac',
debug => 1 | 0,
unicode => 1 | 0,
mslu => 1 | 0,
}
=head2 include_path
my $include_path = Alien::wxWidgets->include_path;
Returns the include paths to be used in a format suitable for the
compiler (usually something like "-I/usr/local/include -I/opt/wx/include").
=head2 defines
my $defines = Alien::wxWidgets->defines;
Returns the compiler defines to be used in a format suitable for the
compiler (usually something like "-D__WXDEBUG__ -DFOO=bar").
=head2 c_flags
my $cflags = Alien::wxWidgets->c_flags;
Returns additional compiler flags to be used.
=head2 compiler
my $compiler = Alien::wxWidgets->compiler;
Returns the (C++) compiler used for compiling wxWidgets.
=head2 linker
my $linker = Alien::wxWidgets->linker;
Returns a linker suitable for linking C++ binaries.
=head2 link_flags
my $linkflags = Alien::wxWidgets->link_flags;
Returns additional link flags.
=head2 libraries
my $libraries = Alien::wxWidgets->libraries( qw(gl adv core base) );
Returns link flags for linking the libraries passed as arguments. This
usually includes some search path specification in addition to the
libraries themselves. The caller is responsible for the correct order
of the libraries.
=head2 link_libraries
my @libraries = Alien::wxWidgets->link_libraries( qw(gl adv core base) );
Returns a list of linker flags that can be used to link the libraries
passed as arguments.
=head2 import_libraries
my @implib = Alien::wxWidgets->import_libraries( qw(gl adv core base) );
Windows specific. Returns a list of import libraries corresponding to
the libraries passed as arguments.
=head2 shared_libraries
my @shrlib = Alien::wxWidgets->shared_libraries( qw(gl adv core base) );
Returns a list of shared libraries corresponding to the libraries
passed as arguments.
=head2 library_keys
my @keys = Alien::wxWidgets->library_keys;
Returns a list of keys that can be passed to C<shared_libraries>,
C<import_libraries> and C<link_libraries>.
=head2 library_path
my $library_path = Alien::wxWidgets->shared_library_path;
Windows specific. Returns the path at which the private copy
of wxWidgets libraries has been installed.
=head2 prefix
my $prefix = Alien::wxWidgets->prefix;
Returns the install prefix for wxWidgets.
=head2 dump_configurations
Alien::wxWidgets->dump_configurations( %filters );
Prints a list of available configurations (mainly useful for
interactive use/debugging).
=head2 show_configurations
Alien::wxWidgets->show_configurations( %filters );
Prints a human-readable list of available configurations (mainly
useful for interactive use/debugging).
=head2 get_configurations
my $configs = Alien::wxWidgets->get_configurations( %filters );
Returns a list of configurations matching the given filters.
=head1 AUTHOR
Mattia Barbon <mbarbon@cpan.org>
=head1 LICENSE
=over 4
=item Alien::wxWidgets
Copyright (c) 2005-2012 Mattia Barbon <mbarbon@cpan.org>
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself
=item inc/bin/patch
was taken from the Perl Power Tools distributions
Copyright (c) 1999 Moogle Stuffy Software <tgy@chocobo.org>
You may play with this software in accordance with the Perl Artistic License.
You may use this documentation under the auspices of the GNU General Public
License.
=item inc/bin/patch.exe
was downloaded from http://gnuwin32.sourceforge.net/packages/patch.htm
ad is copyrighted by its authors, sources are included inside the
inc/src directory.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
=item bundled files from CPAN
inc/File/Fetch/Item.pm
inc/File/Fetch.pm
inc/File/Spec/Unix.pm
inc/IPC/Cmd.pm
inc/Locale/Maketext/Simple.pm
inc/Module/Load/Conditional.pm
inc/Module/Load.pm
inc/Params/Check.pm
inc/Archive/Extract.pm
Are copyright their respective authors an can be used according
to the license specified in their CPAN distributions.
=back
=cut
|