Alien-MeCab
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
if ($@) {
print <<EOM;
*** Whoa! libiconv was not detected! ***
MeCab requires libiconv to work properly. You can either
(1) install it yourself by hand, or
(2) install it via Alien::Iconv
EOM
my $yn = prompt("Would you like to add Alien::Iconv to prerequisite modules?", "y");
if ($yn !~ /^y(?:es)?$/) {
print <<EOM;
You chose not to install libiconv. Please install it manually and
re-run perl Makefile.PL for Alien::MeCab.
EOM
exit 0;
}
Makefile.PL view on Meta::CPAN
Because Alien::MeCab may have been called to be installed from a dependency
of another module, we want to make sure that you *really* want to install
this version of Alien::MeCab (and therefore libmecab).
If you answer "y", then We're going to install
libmecab: $MECAB_VERSION
This operation may OVERWRITE your previous installation
EOM
my $yn = prompt("Really install?", "n");
if ($yn !~ /^y(?:es)?$/) {
exit 0;
}
}
# Ask if we want to download the source.
my $sourcefile = $RUNNING_IN_HELL ? $MECAB_EXE : $MECAB_SOURCE;
if (! -f $sourcefile) {
my $yn = prompt("mecab source file $sourcefile does not exist. Download it now?", "y");
if ($yn =~ /^y(?:es)?$/i) {
my @cmd = ($^X, File::Spec->catfile("src", "fetchsrc.pl"), "--version", $MECAB_VERSION);
system(@cmd);
}
}
# If the source hasn't been expanded, then unpack it
if ($^O ne 'MSWin32') {
if (! -d $MECAB_SOURCE_DIR) {
my $yn = prompt("Mecab source directory has not been unpacked yet. Unpack it now?", "y");
if ($yn =~ /^y(?:es)?$/i) {
eval {
require Archive::Tar;
Archive::Tar->can_handle_compressed_files or die "No compression support :(";
};
if ($@) {
print STDERR "Archive extraction requires Archive::Tar (with IO::Zlib)\n";
exit 0;
}
Makefile.PL view on Meta::CPAN
exit 0;
}
chdir $CURDIR;
}
}
{
print "\n";
my $run_configure;
if( -e File::Spec->catfile($MECAB_SOURCE_DIR, 'config.status')) {
$run_configure = prompt(
"Looks like MeCab has already been configured.\n".
"Do you want to re-run configure?",
"n"
);
} else {
$run_configure = prompt(
"No config.status found. Run MeCab's configure now?", 'y'
);
}
if( $run_configure =~ /^y/i ) {
print "\nWe're going to run configure for mecab.\n",
"First, we'll ask you a few questions about common options\n\n";
my $prefix = prompt( "Where would you like to install libmecab?", "/usr/local" );
my $charset = prompt( "What charset would you like to use?", "utf8" );
my $configure_args = '';
$configure_args .= "--prefix=$prefix " if $prefix;
$configure_args .= "--with-charset=$charset " if $charset;
$configure_args .= prompt("Are there any other arguments you would like to pass to configure?" );
print "\nMeCab will be configured with the following arguments:\n",
" $configure_args\n";
chdir $MECAB_SOURCE_DIR;
local $ENV{CFLAGS} = $CCFLAGS;
local $ENV{LDFLAGS} = $LDFLAGS;
my @cmd = (File::Spec->catfile($MECAB_SOURCE_DIR, "configure"),
split(/\s+/, $configure_args));
inc/Devel/CheckLib.pm view on Meta::CPAN
=head1 SYNOPSIS
# in a Makefile.PL or Build.PL
use lib qw(inc);
use Devel::CheckLib;
check_lib_or_exit( lib => 'jpeg', header => 'jpeglib.h' );
check_lib_or_exit( lib => [ 'iconv', 'jpeg' ] );
# or prompt for path to library and then do this:
check_lib_or_exit( lib => 'jpeg', libpath => $additional_path );
=head1 HOW IT WORKS
You pass named parameters to a function, describing to it how to build
and link to the libraries.
It works by trying to compile this:
int main(void) { return 0; }
inc/Devel/CheckLib.pm view on Meta::CPAN
a C<ExtUtils::MakeMaker>-style space-seperated list of
incpaths, each preceded by '-I'.
=back
=head2 check_lib_or_exit
This behaves exactly the same as C<assert_lib()> except that instead of
dieing, it warns (with exactly the same error message) and exits.
This is intended for use in Makefile.PL / Build.PL
when you might want to prompt the user for various paths and
things before checking that what they've told you is sane.
If any library or header is missing, it exits with an exit value of 0 to avoid
causing a CPAN Testers 'FAIL' report. CPAN Testers should ignore this
result -- which is what you want if an external library dependency is not
available.
=cut
sub check_lib_or_exit {
inc/Devel/CheckLib.pm view on Meta::CPAN
L<Devel::CheckOS>
L<Probe::Perl>
=head1 AUTHORS
David Cantrell E<lt>david@cantrell.org.ukE<gt>
David Golden E<lt>dagolden@cpan.orgE<gt>
Thanks to the cpan-testers-discuss mailing list for prompting us to write it
in the first place;
to Chris Williams for help with Borland support.
=head1 COPYRIGHT and LICENCE
Copyright 2007 David Cantrell. Portions copyright 2007 David Golden.
This module is free-as-in-speech software, and may be used, distributed,
and modified under the same conditions as perl itself.
( run in 0.546 second using v1.01-cache-2.11-cpan-0b5f733616e )