mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-03-26 11:46:34 +01:00
made Makefile.PL XS/PP configurable
This commit is contained in:
parent
8fc86ce7fa
commit
918dbd1926
@ -5,15 +5,29 @@ name 'Data-MessagePack';
|
|||||||
all_from 'lib/Data/MessagePack.pm';
|
all_from 'lib/Data/MessagePack.pm';
|
||||||
readme_from('lib/Data/MessagePack.pm');
|
readme_from('lib/Data/MessagePack.pm');
|
||||||
|
|
||||||
perl_version '5.008005';
|
perl_version '5.008000';
|
||||||
license 'perl';
|
license 'perl';
|
||||||
can_cc or die "This module requires a C compiler";
|
|
||||||
|
|
||||||
tests 't/*.t';
|
tests 't/*.t';
|
||||||
recursive_author_tests('xt');
|
recursive_author_tests('xt');
|
||||||
use_ppport 3.19;
|
|
||||||
|
|
||||||
requires_c99(); # msgpack C library requires C99.
|
my $use_xs = want_xs();
|
||||||
|
|
||||||
|
if ( $] >= 5.008005 and $use_xs ) {
|
||||||
|
can_cc or die "This module requires a C compiler";
|
||||||
|
use_ppport 3.19;
|
||||||
|
requires_c99(); # msgpack C library requires C99.
|
||||||
|
cc_src_paths('xs-src');
|
||||||
|
if ($ENV{DEBUG}) {
|
||||||
|
cc_append_to_ccflags '-g';
|
||||||
|
}
|
||||||
|
# for author's test_pp
|
||||||
|
requires 'Data::Float' => 0 if ( $Module::Install::AUTHOR and $] < 5.010 );
|
||||||
|
}
|
||||||
|
else { # for Data::MessagePack::PP
|
||||||
|
print "configure PP version\n";
|
||||||
|
requires 'Data::Float' => 0 if ( $] < 5.010 );
|
||||||
|
}
|
||||||
|
|
||||||
clean_files qw{
|
clean_files qw{
|
||||||
*.stackdump
|
*.stackdump
|
||||||
@ -23,10 +37,6 @@ clean_files qw{
|
|||||||
cover_db
|
cover_db
|
||||||
};
|
};
|
||||||
|
|
||||||
if ($ENV{DEBUG}) {
|
|
||||||
cc_append_to_ccflags '-g';
|
|
||||||
}
|
|
||||||
|
|
||||||
# copy modules
|
# copy modules
|
||||||
if ($Module::Install::AUTHOR && -d File::Spec->catfile('..', 'msgpack')) {
|
if ($Module::Install::AUTHOR && -d File::Spec->catfile('..', 'msgpack')) {
|
||||||
mkdir 'msgpack' unless -d 'msgpack';
|
mkdir 'msgpack' unless -d 'msgpack';
|
||||||
@ -39,7 +49,50 @@ if ($Module::Install::AUTHOR && -d File::Spec->catfile('..', 'msgpack')) {
|
|||||||
requires 'Test::More' => 0.94; # done_testing
|
requires 'Test::More' => 0.94; # done_testing
|
||||||
test_requires('Test::Requires');
|
test_requires('Test::Requires');
|
||||||
|
|
||||||
|
test_with_env( test_pp => PERL_DATA_MESSAGEPACK => 'pp' );
|
||||||
|
|
||||||
|
if($Module::Install::AUTHOR) {
|
||||||
|
postamble qq{test :: test_pp\n\n};
|
||||||
|
}
|
||||||
|
|
||||||
auto_set_repository();
|
auto_set_repository();
|
||||||
auto_include;
|
auto_include;
|
||||||
WriteAll;
|
WriteAll;
|
||||||
|
|
||||||
|
# copied from Makefile.PL in Text::Xslate.
|
||||||
|
sub test_with_env {
|
||||||
|
my($name, %env) = @_;
|
||||||
|
|
||||||
|
my $dir = '.testenv';
|
||||||
|
if(not -e $dir) {
|
||||||
|
mkdir $dir or die "Cannot mkdir '.testenv': $!";
|
||||||
|
}
|
||||||
|
clean_files($dir);
|
||||||
|
|
||||||
|
{
|
||||||
|
open my $out, '>', "$dir/$name.pl"
|
||||||
|
or die "Cannot open '$dir/$name.pl' for writing: $!";
|
||||||
|
print $out "# This file sets the env for 'make $name', \n";
|
||||||
|
print $out "# generated by $0 at ", scalar(localtime), ".\n";
|
||||||
|
print $out "# DO NOT EDIT THIS FILE DIRECTLY.\n";
|
||||||
|
print $out "\n";
|
||||||
|
|
||||||
|
while(my($name, $value) = each %env) {
|
||||||
|
printf $out '$ENV{q{%s}} = q{%s};'."\n", $name, $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# repeat testing for pure Perl mode
|
||||||
|
# see also ExtUtils::MM_Any::test_via_harness()
|
||||||
|
|
||||||
|
my $t = q{$(FULLPERLRUN) -MExtUtils::Command::MM -e}
|
||||||
|
.q{ "do q[%s]; test_harness($(TEST_VERBOSE), '$(INST_LIB)', '$(INST_ARCHLIB)')"}
|
||||||
|
.q{ $(TEST_FILES)};
|
||||||
|
|
||||||
|
postamble qq{$name :: pure_all\n}
|
||||||
|
. qq{\t} . q{$(NOECHO) $(ECHO) TESTING: } . $name . qq{\n}
|
||||||
|
. qq{\t} . sprintf($t, "$dir/$name.pl") . qq{\n\n}
|
||||||
|
|
||||||
|
. qq{testall :: $name\n\n};
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
@ -3,4 +3,4 @@ use warnings;
|
|||||||
use Test::More tests => 1;
|
use Test::More tests => 1;
|
||||||
|
|
||||||
use_ok 'Data::MessagePack';
|
use_ok 'Data::MessagePack';
|
||||||
|
diag ( $INC{'Data/MessagePack/PP.pm'} ? 'PP' : 'XS' );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user