aboutsummaryrefslogtreecommitdiff
path: root/Makefile.PL
blob: 86b969fc757c55ce5ff0d05a6e728bcd77be560f (plain)
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
use 5.016001;
use strict;
use warnings;
use ExtUtils::MakeMaker;
use Module::Metadata;

WriteMakefile(
    NAME              => 'POSIX::Run::Capture',
    VERSION_FROM      => 'lib/POSIX/Run/Capture.pm',
    LICENSE           =>  'gpl_3',
    PREREQ_PM         => {}, # e.g., Module::Name => 1.1
    MIN_PERL_VERSION  => 5.006,
    ABSTRACT_FROM     => 'lib/POSIX/Run/Capture.pm',
    AUTHOR            => 'Sergey Poznyakoff <gray@gnu.org>',
    LIBS              => [''], # e.g., '-lm'
    DEFINE            => '',
    INC               => '-I.', # e.g., '-I. -I/usr/include/other'
    OBJECT            => '$(O_FILES) runcap/libruncap.a',
    DIR               => [ 'runcap' ],
    META_MERGE        => {
	'meta-spec' => { version => 2 },
        resources => {
	    repository => {
		type => 'git',
                url => 'git://git.gnu.org.ua/posixruncapture.git',
		web => 'http://git.gnu.org.ua/cgit/posixruncapture.git/',
	    },
	},
	provides => Module::Metadata->provides(version => '1.4',
					       dir => 'lib')
    }
);

package MY;

sub pasthru {
    my $val = shift->SUPER::pasthru(@_);
    chomp($val);
    return $val . "\\\n        O='\$(CCFLAGS)'";
}

sub test {
    my $val = shift->SUPER::test(@_);
    open(my $fd, '<', \$val);
    my @ret;
    my $ignore;
    while (<$fd>) {
	chomp;
	if (/^(subdirs-test_.+?)\s*:.*$/) {
	    push @ret, "$1:: subdirs-test-prepare", '';
	    $ignore = 1;
	} elsif ($ignore) {
	    if (/^$/) {
		$ignore = 0;
	    } elsif (/^\S/) {
		$ignore = 0;
		push @ret, $_;
	    }
	} else {
	    push @ret, $_;
	}
    }
    close $fd;

    push @ret, '',
         "subdirs-test-prepare::",
         "\t\@\$(MAKE) -C runcap/t genout O='\$(CCFLAGS)'",
         '';
    
    return join("\n", @ret);
}

Return to:

Send suggestions and report system problems to the System administrator.