Skip to content

Commit

Permalink
- fix/simplify META.yml generation - we now generate META.yml at
Browse files Browse the repository at this point in the history
  Makefile.PL time, since trying to work with EU::MM to generate a 
  custom META.yml was a waste.
  • Loading branch information
Tony Cook committed Feb 21, 2006
1 parent d1f5892 commit 135d30e
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 45 deletions.
3 changes: 3 additions & 0 deletions Changes
Expand Up @@ -1361,6 +1361,9 @@ Revision history for Perl extension Imager.
- make win32.c const happy
- make raw.c C89 compliant
- added version/level to the API function table structure
- fix/simplify META.yml generation - we now generate META.yml at
Makefile.PL time, since trying to work with EU::MM to generate a
custom META.yml was a waste.

=================================================================

Expand Down
1 change: 0 additions & 1 deletion CountColor/Makefile.PL
@@ -1,5 +1,4 @@
use ExtUtils::MakeMaker;
require "../metafile.pl";

my %opts =
(
Expand Down
1 change: 0 additions & 1 deletion DynTest/Makefile.PL
@@ -1,5 +1,4 @@
use ExtUtils::MakeMaker;
require "../metafile.pl";

my %opts =
(
Expand Down
1 change: 0 additions & 1 deletion Flines/Makefile.PL
@@ -1,5 +1,4 @@
use ExtUtils::MakeMaker;
require "../metafile.pl";

my %opts =
(
Expand Down
1 change: 0 additions & 1 deletion MANIFEST
Expand Up @@ -125,7 +125,6 @@ log.c
log.h
map.c
maskimg.c
metafile.pl Common META.yml generation
palimg.c
plug.h
png.c
Expand Down
53 changes: 52 additions & 1 deletion Makefile.PL
Expand Up @@ -6,7 +6,6 @@ use Config;
use File::Spec;
use Getopt::Long;
use vars qw(%Recommends);
require "metafile.pl";
use ExtUtils::Manifest qw(maniread);
use vars qw(%formats $VERBOSE $INCPATH $LIBPATH $NOLOG $DEBUG_MALLOC $MANUAL $CFLAGS $LFLAGS $DFLAGS);

Expand Down Expand Up @@ -168,11 +167,17 @@ if ($ExtUtils::MakeMaker::VERSION > 6.06) {
$opts{AUTHOR} = 'Tony Cook <tony@imager.perl.org>, Arnar M. Hrafnkelsson';
$opts{ABSTRACT} = 'Perl extension for Generating 24 bit Images';
}
if ($ExtUtils::MakeMaker::VERSION > 6.10) {
$opts{NO_META} = 1;
}

make_imconfig(\@defines);

if ($VERBOSE) { print Dumper(\%opts); }
mkdir('testout',0777); # since we cannot include it in the archive.

make_metafile(\%opts);

WriteMakefile(%opts);

exit;
Expand Down Expand Up @@ -815,3 +820,49 @@ sub gen_PM {

\%pm;
}

sub make_metafile {
my ($opts) = @_;

# extract the version
my $version = MM->parse_version($opts->{VERSION_FROM})
or die "Could not extract version number from $opts->{VERSION_FROM}\n";

my $meta = <<YAML;
--- #YAML:1.0
name: $opts->{NAME}
version: $version
version_from: $opts->{VERSION_FROM}
author: $opts->{AUTHOR}
abstract: $opts->{ABSTRACT}
installdirs: site
YAML
if (keys %{$Recommends{$opts->{NAME}}}) {
$meta .= "recommends:\n";
while (my ($module, $version) = each %{$Recommends{$opts->{NAME}}}) {
$meta .= " $module: $version\n";
}
}
$meta .= <<YAML;
license: perl
dynamic_config: 1
distribution_type: module
generated_by: $opts->{NAME} version $version
YAML
my $save_meta;
if (open META, "< META.yml") {
my $old_meta = do { local $/; <META> };
close META;

$save_meta = $old_meta ne $meta;
}
else {
++$save_meta;
}
if ($save_meta) {
print "Updating META.yml\n";
open META, "> META.yml" or die "Cannot create META.yml: $!";
print META $meta;
close META;
}
}
1 change: 0 additions & 1 deletion Mandelbrot/Makefile.PL
@@ -1,5 +1,4 @@
use ExtUtils::MakeMaker;
require "../metafile.pl";

my %opts =
(
Expand Down
6 changes: 3 additions & 3 deletions TODO
Expand Up @@ -8,11 +8,11 @@ not commitments.

BEFORE 0.48:

scale() fixes/docs, Imager::Transformations going over.
scale() fixes/docs, Imager::Transformations going over. (done)

do some more malloc checks
do some more malloc checks (done)

scan $Config{libspath} for directories if we can.
scan $Config{libspath} for directories if we can. (done)

0.47:

Expand Down
36 changes: 0 additions & 36 deletions metafile.pl

This file was deleted.

0 comments on commit 135d30e

Please sign in to comment.