Alien-Iconv

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

        );
    } else {
        $run_configure = prompt(
            "No config.status found. Run Iconv's configure now?", 'y'
        );
    }

    if( $run_configure =~ /^y/i ) {
        print "\nWe're going to run configure for iconv.\n",
            "First, we'll ask you a few questions about common options\n\n";

        my $prefix = prompt( "Where would you like to install libiconv?", "/usr/local" );
        my $configure_args = '';
        $configure_args .= "--prefix=$prefix " if $prefix;

        $configure_args .= prompt("Are there any other arguments you would like to pass to configure?" );

        print "\nIconv will be configured with the following arguments:\n",
            "  $configure_args\n";

        chdir $ICONV_SOURCE_DIR;

        local $ENV{CFLAGS}  = $CCFLAGS;
        local $ENV{LDFLAGS} = $LDFLAGS;
        my @cmd = (File::Spec->catfile($ICONV_SOURCE_DIR, "configure"),
            split(/\s+/, $configure_args));
        if (system(@cmd) != 0) {
            print <<"END";
configure $configure_args failed: $!
    Something went wrong with the Iconv configuration.
    You should correct it and re-run Makefile.PL.
END
            chdir $CURDIR;
            exit 0;
        }
        chdir $CURDIR;
    }
}


print <<EOM;
Going to use the following information:
    DIST_VERSION: $DIST_VERSION
    ICONV_VERSION: $ICONV_VERSION
    CCFLAGS: $CCFLAGS
    LDFLAGS: $LDFLAGS
EOM

WriteMakefile(
    CCFLAGS => $CCFLAGS,
    LDFLAGS => $LDFLAGS,
    NAME => 'Alien-Iconv',
    VERSION => $DIST_VERSION,
);

print "Now you should type 'make'\n";

package MY;
sub top_targets
{
    my $inherited = shift->SUPER::top_targets(@_);
    $inherited =~ s/^all :: /all :: libiconv /;
    return $inherited;
}

sub constants
{
    my $inherited = shift->SUPER::constants(@_);
    $inherited .= "MEACB_VERSION=$ICONV_VERSION\nICONV_SRC=src/libiconv-$ICONV_VERSION\n";
    return $inherited;
}

sub postamble {
    my $make_str;

	if ($RUNNING_IN_HELL) {
        $make_str = <<MAKE_FRAG;
MAKE_FRAG
    } else {
        $make_str = <<'MAKE_FRAG';
libiconv:
	cd $(ICONV_SRC) && $(MAKE) all

MAKE_FRAG
    }

    $make_str .= <<'MAKE_FRAG';
fetchsrc:
	$(PERL) fetchsrc.pl

MAKE_FRAG

    return $make_str;
}


#sub metafile_target {
#    my $inherited = shift->SUPER::metafile_target(@_);
#    my $build_requires = <<EOM;
#build_requires:
#    Cwd: 0
#    File::Spec: 0
#EOM
#    $inherited =~ s/meta-spec:/${build_requires}meta-spec/;
#    return $inherited;
#}

__END__



( run in 0.823 second using v1.01-cache-2.11-cpan-df04353d9ac )