Skip to content

Commit

Permalink
Use PoeBuildInfo.pm rather than hardcode common data in both versions
Browse files Browse the repository at this point in the history
of Makefile.pm.
  • Loading branch information
rcaputo committed Nov 26, 2004
1 parent 3e0ae7c commit 38fdef7
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 75 deletions.
71 changes: 33 additions & 38 deletions mylib/Makefile-5004.pm
@@ -1,9 +1,31 @@
#!/usr/bin/perl
# $Id$

use strict;

use ExtUtils::MakeMaker;

# Add a new target.
use lib qw(./mylib);
use PoeBuildInfo qw(
$clean_files
$dist_abstract
$dist_author
%core_requirements
%recommended_time_hires
);

### Touch files that will be generated at "make dist" time.
### ExtUtils::MakeMaker and Module::Build will complain about them if
### they aren't present now.

open(TOUCH, ">>CHANGES") and close TOUCH;
open(TOUCH, ">>META.yml") and close TOUCH;

### Generate dynamic test files.

system($^X, "mylib/gen-tests.perl") and die "couldn't generate tests: $!";

### Generate Makefile.PL.

sub MY::postamble {
return <<EOF;
Expand All @@ -22,56 +44,29 @@ coverage: Makefile
\cI$^X mylib/coverage.perl
cover: coverage
ppmdist:
\cIecho Use a recent version of Perl to build the PPM distribution.
\cIfalse
EOF
}

# Generate dynamic test files.

system($^X, "mylib/gen-tests.perl") and die "couldn't generate tests: $!";

# Touch generated files so they exist.
open(TOUCH, ">>CHANGES") and close TOUCH;
open(TOUCH, ">>META.yml") and close TOUCH;

WriteMakefile(
NAME => 'POE',
VERSION_FROM => 'lib/POE.pm',

dist => {
COMPRESS => 'gzip -9f',
SUFFIX => 'gz',
PREOP => (
'./mylib/cvs-log.perl | ' .
'tee ./$(DISTNAME)-$(VERSION)/CHANGES > ./CHANGES'
),
PREOP => ( 'false' ),
},
PREREQ_PM => {
"Carp" => 0,
"Exporter" => 0,
"IO" => 1.20,
"POSIX" => 1.02,
"Socket" => 1.7,
"Filter::Util::Call" => 1.06,
"Test::More" => 0.50,
"File::Spec" => 3.01,
"Errno" => 1.09,
},
PL_FILES => { },

clean => {
FILES => (
"coverage.report " .
"poe_report.xml " .
"run_network_tests " .
"tests/20_resources/10_perl/* " .
"tests/20_resources/20_xs/* " .
"tests/30_loops/10_select/* " .
"tests/30_loops/20_poll/* " .
"tests/30_loops/30_event/* " .
"tests/30_loops/40_gtk/* " .
"tests/30_loops/50_tk/* " .
"test-output.err "
),
FILES => $clean_files,
}

PL_FILES => { },
PREREQ_PM => \%core_requirements,
);

1;
66 changes: 29 additions & 37 deletions mylib/Makefile-5005.pm
Expand Up @@ -3,9 +3,25 @@

use strict;

use ExtUtils::MakeMaker;

use lib qw(./mylib);
use PoeBuildInfo qw(
$clean_files
$dist_abstract
$dist_author
%core_requirements
%recommended_time_hires
);

use ExtUtils::MakeMaker;
### Touch files that will be generated at "make dist" time.
### ExtUtils::MakeMaker and Module::Build will complain about them if
### they aren't present now.

open(TOUCH, ">>CHANGES") and close TOUCH;
open(TOUCH, ">>META.yml") and close TOUCH;

### Ensure ExtUtils::AutoInstall is installed.

eval "require ExtUtils::AutoInstall";
if ($@) {
Expand All @@ -14,8 +30,9 @@ if ($@) {
"====================================================================\n",
"\n",
"POE's installer magic requires ExtUtils::AutoInstall. POE comes\n",
"with an older version, but it will not be installed. You should\n",
"install the most recent ExtUtils::AutoInstall at your convenience.\n",
"with its own version, but it is usually out of date and won't be\n",
"installed. You should install the most recent version at your\n",
"earliest convenience.\n",
"\n",
"====================================================================\n",
"\n",
Expand All @@ -24,24 +41,14 @@ if ($@) {
die if $@;
}

my %core_requirements = (
"Carp" => 0,
"Exporter" => 0,
"IO" => 1.20,
"POSIX" => 1.02,
"Socket" => 1.7,
"Filter::Util::Call" => 1.06,
"Test::More" => 0.47,
"File::Spec" => 0.87,
"Errno" => 1.09,
);
### Prompt for additional modules.

ExtUtils::AutoInstall->import(
-version => '0.50',
-core => [ %core_requirements ],
"Recommended modules to increase timer/alarm/delay accuracy." => [
-default => 0,
'Time::HiRes' => '1.59',
%recommended_time_hires,
],
"Optional modules to speed up large-scale clients/servers." => [
-default => 0,
Expand Down Expand Up @@ -88,13 +95,11 @@ ExtUtils::AutoInstall->import(
],
);

# Generate dynamic test files.
### Generate dynamic test files.

system($^X, "mylib/gen-tests.perl") and die "couldn't generate tests: $!";

# Touch generated files so they exist.
open(TOUCH, ">>CHANGES") and close TOUCH;
open(TOUCH, ">>META.yml") and close TOUCH;
### Generate Makefile.PL.

sub MY::postamble {
return ExtUtils::AutoInstall::postamble() .
Expand Down Expand Up @@ -130,8 +135,8 @@ WriteMakefile(
(
($^O eq 'MacOS')
? ()
: ( AUTHOR => 'Rocco Caputo <rcaputo@cpan.org>',
ABSTRACT => 'A highly portable networking and multitasking framework.',
: ( AUTHOR => $dist_author,
ABSTRACT => $dist_abstract,
)
),

Expand All @@ -142,26 +147,13 @@ WriteMakefile(
PREOP => (
'./mylib/cvs-log.perl | ' .
'/usr/bin/tee ./$(DISTNAME)-$(VERSION)/CHANGES > ./CHANGES; ' .
"$^X Build.PL; " .
'./Build distmeta; ' .
"$^X mylib/gen-meta.perl; " .
'/bin/cp -f ./META.yml ./$(DISTNAME)-$(VERSION)/META.yml'
),
},

clean => {
FILES => (
"coverage.report " .
"poe_report.xml " .
"run_network_tests " .
"tests/20_resources/10_perl/* " .
"tests/20_resources/20_xs/* " .
"tests/30_loops/10_select/* " .
"tests/30_loops/20_poll/* " .
"tests/30_loops/30_event/* " .
"tests/30_loops/40_gtk/* " .
"tests/30_loops/50_tk/* " .
"test-output.err "
),
clean => {
FILES => $clean_files,
},

# More for META.yml than anything.
Expand Down

0 comments on commit 38fdef7

Please sign in to comment.