3 use ExtUtils::MakeMaker;
8 use vars qw(%Recommends);
9 use ExtUtils::Manifest qw(maniread);
10 use vars qw(%formats $VERBOSE $INCPATH $LIBPATH $NOLOG $DEBUG_MALLOC $MANUAL $CFLAGS $LFLAGS $DFLAGS);
13 # IM_INCPATH colon seperated list of paths to extra include paths
14 # IM_LIBPATH colon seperated list of paths to extra library paths
16 # IM_VERBOSE turns on verbose mode for the library finding and such
17 # IM_MANUAL to manually select which libraries are used and which not
18 # IM_ENABLE to programmatically select which libraries are used
20 # IM_NOLOG if true logging will not be compiled into the module
21 # IM_DEBUG_MALLOC if true malloc debbuging will be compiled into the module
22 # do not use IM_DEBUG_MALLOC in production - this slows
23 # everything down by alot
24 # IM_CFLAGS Extra flags to pass to the compiler
25 # IM_LFLAGS Extra flags to pass to the linker
26 # IM_DFLAGS Extra flags to pass to the preprocessor
27 # IM_SUPPRESS_PROMPT Suppress the prompt asking about gif support
29 getenv(); # get environment variables
31 my $lext=$Config{'so'}; # Get extensions of libraries
32 my $aext=$Config{'_a'};
34 my $help; # display help if set
35 my @enable; # list of drivers to enable
36 my @disable; # or list of drivers to disable
37 my @incpaths; # places to look for headers
38 my @libpaths; # places to look for libraries
39 my $noexif; # non-zero to disable EXIF parsing of JPEGs
40 my $no_gif_set_version; # disable calling EGifSetGifVersion
41 my $coverage; # build for coverage testing
42 GetOptions("help" => \$help,
43 "enable=s" => \@enable,
44 "disable=s" => \@disable,
45 "incpath=s", \@incpaths,
46 "libpath=s" => \@libpaths,
47 "verbose|v" => \$VERBOSE,
50 "nogifsetversion" => \$no_gif_set_version,
51 'coverage' => \$coverage);
54 print "Verbose mode\n";
56 import Data::Dumper qw(Dumper);
65 if ($NOLOG) { print "Logging not compiled into module\n"; }
67 push @defines, [ IMAGER_LOG => 1, "Logging system" ];
71 push @defines, [ IMAGER_DEBUG_MALLOC => 1, "Use Imager's DEBUG malloc()" ];
72 print "Malloc debugging enabled\n";
75 if (@enable && @disable) {
76 print STDERR "Only --enable or --disable can be used, not both, try --help\n";
82 my @incs; # all the places to look for headers
83 my @libs; # all the places to look for libraries
85 init(); # initialize global data
86 pathcheck(); # Check if directories exist
88 if (exists $ENV{IM_ENABLE}) {
89 my %en = map { $_, 1 } split ' ', $ENV{IM_ENABLE};
90 for my $key (keys %formats) {
91 delete $formats{$key} unless $en{$key};
95 my %en = map { $_ => 1 } map { split /,/ } @enable;
96 for my $key (keys %formats) {
97 delete $formats{$key} unless $en{$key};
101 delete @formats{map { split /,/ } @disable};
104 # Pick what libraries are used
111 # Make sure there isn't a clash between the gif libraries.
118 for my $frmkey (sort { $formats{$a}{order} <=> $formats{$b}{order} } keys %formats) {
119 my $frm = $formats{$frmkey};
120 push @defines, [ $frm->{def}, 1, "$frmkey available" ];
121 $F_OBJECT .= ' ' .$frm->{objfiles};
122 if ($frm->{cflags}) {
123 $lib_cflags .= ' ' .$frm->{cflags};
124 ++$definc{$_} for map { /^-I(.*)$/ ? ($1) : () }
125 grep /^-I./, split ' ', $frm->{cflags};
127 if ($frm->{lflags}) {
128 $lib_lflags .= ' ' . $frm->{lflags};
131 $F_LIBS .= ' ' .$frm->{libfiles};
137 print "EXIF support enabled\n";
138 push @defines, [ 'IMEXIF_ENABLE', 1, "Enable experimental EXIF support" ];
139 $F_OBJECT .= ' imexif.o';
142 my $F_INC = join ' ', map "-I$_", map / / ? qq{"$_"} : $_,
143 grep !$definc{$_}, @incs;
144 $F_LIBS = join(' ',map "-L$_", map / / ? qq{"$_"} : $_,
145 grep !$deflib{$_}++, @libs) . $F_LIBS;
148 my $OSDEF = "-DOS_$^O";
150 if ($^O eq 'hpux') { $OSLIBS .= ' -ldld'; }
151 if (defined $Config{'d_dlsymun'}) { $OSDEF .= ' -DDLSYMUN'; }
153 my @objs = qw(Imager.o draw.o polygon.o image.o io.o iolayer.o
154 log.o gaussian.o conv.o pnm.o raw.o feat.o font.o
155 filters.o dynaload.o stackmach.o datatypes.o
156 regmach.o trans2.o quant.o error.o convert.o
157 map.o tags.o palimg.o maskimg.o img16.o rotate.o
158 bmp.o tga.o color.o fills.o imgdouble.o limits.o hlines.o
159 imext.o scale.o rubthru.o render.o);
161 $Recommends{Imager} =
162 { 'Parse::RecDescent' => 0 };
166 'VERSION_FROM' => 'Imager.pm',
167 'LIBS' => "$LFLAGS -lm $lib_lflags $OSLIBS $F_LIBS",
168 'DEFINE' => "$OSDEF $CFLAGS",
169 'INC' => "$lib_cflags $DFLAGS $F_INC",
170 'OBJECT' => join(' ', @objs, $F_OBJECT),
171 clean => { FILES=>'testout meta.tmp rubthru.c scale.c' },
173 PREREQ_PM => { 'Test::More' => 0.47 },
177 if ($Config{gccversion}) {
178 push @ARGV, 'OPTIMIZE=-ftest-coverage -fprofile-arcs';
179 #$opts{dynamic_lib} = { OTHERLDFLAGS => '-ftest-coverage -fprofile-arcs' };
182 die "Don't know the coverage C flags for your compiler\n";
186 # eval to prevent warnings about versions with _ in them
187 my $MM_ver = eval $ExtUtils::MakeMaker::VERSION;
188 if ($MM_ver > 6.06) {
189 $opts{AUTHOR} = 'Tony Cook <tony@imager.perl.org>, Arnar M. Hrafnkelsson';
190 $opts{ABSTRACT} = 'Perl extension for Generating 24 bit Images';
192 if ($MM_ver > 6.10) {
196 make_imconfig(\@defines);
198 if ($VERBOSE) { print Dumper(\%opts); }
199 mkdir('testout',0777); # since we cannot include it in the archive.
201 make_metafile(\%opts);
203 WriteMakefile(%opts);
210 my $perl = $self->{PERLRUN} ? '$(PERLRUN)' : '$(PERL)';
213 my @ims = grep /\.im$/, keys %$mani;
215 dyntest.$(MYEXTLIB) : dynfilt/Makefile
216 cd dynfilt && $(MAKE) $(PASTHRU)
218 lib/Imager/Regops.pm : regmach.h regops.perl
219 $(PERL) regops.perl regmach.h lib/Imager/Regops.pm
221 imconfig.h : Makefile.PL
222 $(ECHO) "imconfig.h out-of-date with respect to $?"
223 $(PERLRUN) Makefile.PL
224 $(ECHO) "==> Your Makefile has been rebuilt - re-run your make command <=="
226 lib/Imager/APIRef.pod : \$(C_FILES) apidocs.perl
227 $perl apidocs.perl lib/Imager/APIRef.pod
229 !.join('', map _im_rule($perl, $_), @ims)
234 my ($perl, $im) = @_;
236 (my $c = $im) =~ s/\.im$/.c/;
240 $perl imtoc.perl $im $c
246 # manual configuration of helper libraries
251 Please answer the following questions about
252 which formats are avaliable on your computer
254 press <return> to continue
257 <STDIN>; # eat one return
259 for my $frm(sort { $formats{$b}{order} <=> $formats{$a}{order} } keys %formats) {
261 if ($formats{$frm}{docs}) { print "\n",$formats{$frm}{docs},"\n\n"; }
262 print "Enable $frm support: ";
265 if ($gz =~ m/^(y|yes|n|no)/i) {
266 $gz=substr(lc($gz),0,1);
268 delete $formats{$frm};
275 # automatic configuration of helper libraries
278 print "Automatic probing:\n" if $VERBOSE;
279 for my $frm (sort { $formats{$a}{order} <=> $formats{$b}{order} } keys %formats) {
280 delete $formats{$frm} if !checkformat($frm);
286 if ($formats{'gif'} and $formats{'ungif'}) {
287 print "ungif and gif can not coexist - removing ungif support\n";
288 delete $formats{'ungif'};
291 for my $frm (qw(gif ungif)) {
292 checkformat($frm) if ($MANUAL and $formats{$frm});
296 for my $frm (grep $formats{$_}, qw(gif ungif)) {
297 push(@dirs, @{$formats{$frm}{incdir}}) if $formats{$frm}{incdir};
301 FILES: for my $dir (@dirs) {
302 my $h = "$dir/gif_lib.h";
303 open H, "< $h" or next;
305 if (/GIF_LIB_VERSION\s+"\s*version\s*(\d+)\.(\d+)/i) {
315 # we need the version in a #ifdefable form
317 push @defines, [ IM_GIFMAJOR => $major, "Parsed giflib version" ];
318 push @defines, [ IM_GIFMINOR => $minor ];
319 push @defines, [ IM_NO_SET_GIF_VERSION => 1, "Disable EGifSetGifVersion" ]
320 if $no_gif_set_version;
327 # print "checking path $path\n";
328 if ( !opendir(DH,$path) ) {
329 warn "Cannot open dir $path: $!\n";
332 my @l=grep { $chk->($_) } readdir(DH);
335 return map $path, @l;
342 print " checkformat($frm)\n" if $VERBOSE;
344 my $probe_array = $formats{$frm}{'code'};
346 print " Calling probe function\n" if $VERBOSE;
347 if (ref $probe_array ne 'ARRAY') {
348 $probe_array = [ $probe_array ];
350 for my $func (@$probe_array) {
351 return 1 if $func->($formats{$frm}, $frm);
355 my $lib_check=$formats{$frm}{'libcheck'};
356 my $inc_check=$formats{$frm}{'inccheck'};
361 push(@l, grep_directory($lp,$lib_check));
366 push(@i, $ip) if $inc_check->($ip,$frm);
369 printf("%10s: includes %s - libraries %s\n",$frm,(@i?'found':'not found'),(@l?'found':'not found'));
370 $formats{$frm}{incdir} = \@i;
371 $formats{$frm}{libdir} = \@l;
372 return 1 if scalar(@i && @l);
375 printf("%10s: not available\n", $frm);
385 print " Include paths:\n";
386 for (@incs) { print $_,"\n"; }
388 @incs=grep { -d $_ && -r _ && -x _ or ( print(" $_ doesnt exist or is unaccessible - removed.\n"),0) } @incs;
391 print "\nLibrary paths:\n";
392 for (@libs) { print $_,"\n"; }
394 @libs=grep { -d $_ && -r _ && -x _ or ( print(" $_ doesnt exist or is unaccessible - removed.\n"),0) } @libs;
399 # Format data initialization
401 # format definition is:
403 # default include path
404 # files needed for include (boolean perl code)
407 # files needed for link (boolean perl code)
408 # object files needed for the format
413 my @definc = qw(/usr/include);
414 @definc{@definc}=(1) x @definc;
415 @incs=(split(/\Q$Config{path_sep}/, $INCPATH),
416 map { split /\Q$Config{path_sep}/} @incpaths );
417 if ($Config{locincpth}) {
418 push @incs, grep -d, split ' ', $Config{locincpth};
420 if ($^O =~ /win32/i && $Config{cc} =~ /\bcl\b/i) {
421 push(@incs, split /;/, $ENV{INCLUDE}) if exists $ENV{INCLUDE};
423 if ($Config{incpath}) {
424 push @incs, grep -d, split /\Q$Config{path_sep}/, $Config{incpath};
428 /usr/include/freetype2
429 /usr/local/include/freetype2
430 /usr/local/include/freetype1/freetype
431 /usr/include /usr/local/include /usr/include/freetype
432 /usr/local/include/freetype);
433 if ($Config{ccflags}) {
434 my @hidden = map { /^-I(.*)$/ ? ($1) : () } split ' ', $Config{ccflags};
436 @definc{@hidden} = (1) x @hidden;
439 @libs= ( split(/\Q$Config{path_sep}/,$LIBPATH),
440 map { split /\Q$Config{path_sep}/} @libpaths );
441 if ($Config{loclibpth}) {
442 push @libs, grep -d, split ' ', $Config{loclibpth};
445 push @libs, grep -d, qw(/sw/lib), split(/ /, $Config{'libpth'});
446 push @libs, grep -d, split / /, $Config{libspath} if $Config{libspath};
447 if ($^O =~ /win32/i && $Config{cc} =~ /\bcl\b/i) {
448 push(@libs, split /;/, $ENV{LIB}) if exists $ENV{LIB};
450 if ($^O eq 'cygwin') {
451 push(@libs, '/usr/lib/w32api') if -d '/usr/lib/w32api';
452 push(@incs, '/usr/include/w32api') if -d '/usr/include/w32api';
454 if ($Config{ldflags}) {
455 # some builds of perl put -Ldir into ldflags without putting it in
456 # loclibpth, let's extract them
457 my @hidden = grep -d, map { /^-L(.*)$/ ? ($1) : () }
458 split ' ', $Config{ldflags};
460 # don't mark them as seen - EU::MM will remove any libraries
461 # it can't find and it doesn't look for -L in ldflags
462 #@deflib{@hidden} = @hidden;
464 push @libs, grep -d, qw(/usr/local/lib);
469 inccheck=>sub { -e catfile($_[0], 'jpeglib.h') },
470 libcheck=>sub { $_[0] eq "libjpeg$aext" or $_ eq "libjpeg.$lext" },
474 In order to use jpeg with this module you need to have libjpeg
475 installed on your computer}
481 inccheck=>sub { -e catfile($_[0], 'tiffio.h') },
482 libcheck=>sub { $_[0] eq "libtiff$aext" or $_ eq "libtiff.$lext" },
486 In order to use tiff with this module you need to have libtiff
487 installed on your computer}
493 inccheck=>sub { -e catfile($_[0], 'png.h') },
494 libcheck=>sub { $_[0] eq "libpng$aext" or $_[0] eq "libpng.$lext" },
495 libfiles=>$^O eq 'MSWin32' ? '-lpng -lzlib' : '-lpng -lz',
498 Png stands for Portable Network Graphics and is intended as
499 a replacement for gif on the web. It is patent free and
500 is recommended by the w3c, you need libpng to use these formats},
507 inccheck=>sub { -e catfile($_[0], 'gif_lib.h') },
508 libcheck=>sub { $_[0] eq "libgif$aext" or $_[0] eq "libgif.$lext" },
512 gif is the de facto standard for webgraphics at the moment,
513 it does have some patent problems. If you have giflib and
514 are not in violation with the unisys patent you should use
515 this instead of the 'ungif' option. Note that they cannot
516 be in use at the same time}
522 inccheck=>sub { -e catfile($_[0], 'gif_lib.h') },
523 libcheck=>sub { $_[0] eq "libungif$aext" or $_[0] eq "libungif.$lext" },
527 gif is the de facto standard for webgraphics at the moment,
528 it does have some patent problems. If you have libungif and
529 want to create images free from LZW patented compression you
530 should use this option instead of the 'gif' option}
533 $formats{'T1-fonts'}={
536 inccheck=>sub { -e catfile($_[0], 't1lib.h') },
537 libcheck=>sub { $_[0] eq "libt1$aext" or $_[0] eq "libt1.$lext" },
541 postscript t1 fonts are scalable fonts. They can include
542 ligatures and kerning information and generally yield good
543 visual quality. We depend on libt1 to rasterize the fonts
547 $formats{'TT-fonts'}=
551 inccheck=>sub { -e catfile($_[0], 'freetype.h')
552 && !-e catfile($_[0], 'fterrors.h') },
553 libcheck=>sub { $_[0] eq "libttf$aext" or $_[0] eq "libttf.$lext" },
556 code => \&freetype1_probe,
558 Truetype fonts are scalable fonts. They can include
559 kerning and hinting information and generally yield good
560 visual quality esp on low resultions. The freetype library is
561 used to rasterize for us. The only drawback is that there
562 are alot of badly designed fonts out there.}
567 inccheck=>sub { -e catfile($_[0], 'windows.h') },
568 libcheck=>sub { lc $_[0] eq 'gdi32.lib'
569 || lc $_[0] eq 'libgdi32.a' },
570 libfiles=>$^O eq 'cygwin' ? '-lgdi32' : '',
573 Uses the Win32 GDI for rendering text.
575 This currently only works on under normal Win32 and cygwin.
578 $formats{'freetype2'} =
582 # we always use a probe function
583 #inccheck=>sub { -e catfile($_[0], 'ft2build.h') },
584 #libcheck=>sub { $_[0] eq "libfreetype$aext" or $_[0] eq "libfreetype.$lext" },
585 libfiles=>'-lfreetype',
586 objfiles=>'freetyp2.o',
588 Freetype 2 supports both Truetype and Type 1 fonts, both of which are
589 scalable. It also supports a variety of other fonts.
593 \&freetype2_probe_ftconfig,
594 \&freetype2_probe_scan
599 for (keys %formats) { $formats{$_}->{docs} =~ s/^\s+/ /mg; }
606 defined($V) ? $V : "";
610 # Get information from environment variables
622 $DFLAGS) = map { gen $_ } qw(IM_VERBOSE
637 open CONFIG, "> imconfig.h"
638 or die "Cannot create imconfig.h: $!\n";
640 /* This file is automatically generated by Makefile.PL.
641 Don't edit this file, since any changes will be lost */
643 #ifndef IMAGER_IMCONFIG_H
644 #define IMAGER_IMCONFIG_H
646 for my $define (@$defines) {
648 print CONFIG "\n/*\n $define->[2]\n*/\n\n";
650 print CONFIG "#define $define->[0] $define->[1]\n";
652 print CONFIG "\n#endif\n";
656 # use pkg-config to probe for libraries
657 # works around the junk that pkg-config dumps on FreeBSD
661 is_exe('pkg-config') or return;
663 my $redir = $^O eq 'MSWin32' ? '' : '2>/dev/null';
665 !system("pkg-config $pkg --exists $redir");
668 # probes for freetype1 by scanning @incs for the includes and
669 # @libs for the libs. This is done separately because freetype's headers
670 # are stored in a freetype or freetype1 directory under PREFIX/include.
672 # we could find the files with the existing mechanism, but it won't set
673 # -I flags correctly.
675 # This could be extended to freetype2 too, but freetype-config catches
677 sub freetype1_probe {
678 my ($frm, $frmkey) = @_;
682 for my $inc (@incs) {
683 for my $subdir (qw/freetype freetype1/) {
684 my $path = File::Spec->catfile($inc, $subdir, 'freetype.h');
686 $path = File::Spec->catfile($inc, $subdir, 'fterrors.h');
689 $found_inc = File::Spec->catdir($inc, $subdir);
696 for my $lib (@libs) {
697 my $a_path = File::Spec->catfile($lib, "libttf$aext");
698 my $l_path = File::Spec->catfile($lib, "libttf.$lext");
699 if (-e $a_path || -e $l_path) {
705 return unless $found_inc && $found_lib;
706 printf("%10s: includes %s - libraries %s\n", $frmkey,
707 ($found_inc ? 'found' : 'not found'),
708 ($found_lib ? 'found' : 'not found'));
710 $frm->{cflags} = "-I$found_inc";
711 $frm->{libfiles} = "-lttf";
716 # probes for freetype2 by trying to run freetype-config
717 sub freetype2_probe_ftconfig {
718 my ($frm, $frmkey) = @_;
720 is_exe('freetype-config') or return;
722 my $cflags = `freetype-config --cflags`
726 my $lflags = `freetype-config --libs`
730 # before 2.1.5 freetype-config --cflags could output
731 # the -I options in the wrong order, causing a conflict with
732 # freetype1.x installed with the same --prefix
735 # - both -Iprefix/include and -Iprefix/include/freetype2 are in cflags
737 # - freetype 1.x headers are in prefix/include/freetype
738 my @incdirs = map substr($_, 2), grep /^-I/, split ' ', $cflags;
740 && $incdirs[1] eq "$incdirs[0]/freetype2"
741 && -e "$incdirs[0]/freetype/freetype.h"
742 && -e "$incdirs[0]/freetype/fterrid.h") {
743 print "** freetype-config provided -I options out of order, correcting\n"
745 $cflags = join(' ', grep(!/-I/, split ' ', $cflags),
746 map "-I$_", reverse @incdirs);
748 $frm->{cflags} = $cflags;
749 $frm->{lflags} = $lflags;
751 printf "%10s: configured via freetype-config\n", $frmkey;
756 # attempt to probe for freetype2 by scanning directories
757 # we can't use the normal scan since we need to find the directory
758 # containing most of the includes
759 sub freetype2_probe_scan {
760 my ($frm, $frmkey) = @_;
765 for my $inc (@incs) {
766 my $path = File::Spec->catfile($inc, 'ft2build.h');
769 # try to find what it's including
771 open FT2BUILD, "< $path"
774 if (m!^\s*\#\s*include\s+<([\w/.]+)>!
775 || m!^\s*\#\s*include\s+"([\w/.]+)"!) {
783 # non-Unix installs put this directly under the same directory in
785 if (-e File::Spec->catfile($inc, $ftheader)) {
789 for my $subdir (qw/freetype2 freetype/) {
790 $path = File::Spec->catfile($inc, $subdir, 'fterrors.h');
794 $found_inc2 = File::Spec->catdir($inc, $subdir);
801 for my $lib (@libs) {
802 my $a_path = File::Spec->catfile($lib, "libfreetype$aext");
803 my $l_path = File::Spec->catfile($lib, "libfreetype.$lext");
804 if (-e $a_path || -e $l_path) {
810 printf("%10s: includes %s - libraries %s\n", $frmkey,
811 ($found_inc ? 'found' : 'not found'),
812 ($found_lib ? 'found' : 'not found'));
814 return unless $found_inc && $found_lib;
816 $frm->{cflags} = _make_I($found_inc);
817 $frm->{cflags} .= " " . _make_I($found_inc2) if $found_inc2;
818 $frm->{libfiles} = "-lfreetype";
829 $inc_dir =~ / / ? qq!-I"$inc_dir"! : "-I$inc_dir";
832 # probes for libpng via pkg-config
834 my ($frm, $frmkey) = @_;
836 is_exe('pkg-config') or return;
839 for my $check_conf (qw(libpng libpng12 libpng10)) {
840 if (_pkg_probe($check_conf)) {
841 $config = $check_conf;
847 my $cflags = `pkg-config $config --cflags`
850 my $lflags = `pkg-config $config --libs`
855 $frm->{cflags} = $cflags;
856 $frm->{lflags} = $lflags;
858 printf "%10s: configured via `pkg-config $config ...`\n", $frmkey;
864 return File::Spec->catfile(@_);
870 for my $dir (File::Spec->path) {
871 -x catfile($dir, "$name$Config{_exe}")
880 Usage: $0 [--enable feature1,feature2,...] [other options]
881 $0 [--disable feature1,feature2,...] [other options]
883 Possible feature names are:
884 png gif ungif jpeg tiff T1-fonts TT-fonts freetype2
887 Verbose library probing (or set IM_VERBOSE in the environment)
889 Disable logging (or set IM_NOLOG in the environment)
891 Add to the include search path
893 Add to the library search path
899 # generate the PM MM argument
900 # I'd prefer to modify the public version, but there doesn't seem to be
901 # a public API to do that
904 my $instbase = '$(INST_LIBDIR)';
906 # first the basics, .pm and .pod files
907 $pm{"Imager.pm"} = "$instbase/Imager.pm";
909 my $mani = maniread();
911 for my $filename (keys %$mani) {
912 if ($filename =~ m!^lib/! && $filename =~ /\.(pm|pod)$/) {
913 (my $work = $filename) =~ s/^lib//;
914 $pm{$filename} = $instbase . $work;
919 $pm{typemap} = $instbase . '/Imager/typemap';
921 # and the core headers
922 for my $filename (keys %$mani) {
923 if ($filename =~ /^\w+\.h$/) {
924 $pm{$filename} = $instbase . '/Imager/include/' . $filename;
928 # and the generated header
929 $pm{"imconfig.h"} = $instbase . '/Imager/include/imconfig.h';
937 # extract the version
938 my $version = MM->parse_version($opts->{VERSION_FROM})
939 or die "Could not extract version number from $opts->{VERSION_FROM}\n";
941 # we don't set this on older EU::MM and it corrupts META.yml
942 # so don't generate it
943 return unless $opts->{AUTHOR};
949 version_from: $opts->{VERSION_FROM}
950 author: $opts->{AUTHOR}
951 abstract: $opts->{ABSTRACT}
954 if (keys %{$Recommends{$opts->{NAME}}}) {
955 $meta .= "recommends:\n";
956 while (my ($module, $version) = each %{$Recommends{$opts->{NAME}}}) {
957 $meta .= " $module: $version\n";
960 if ($opts->{PREREQ_PM}) {
961 $meta .= "requires:\n";
962 while (my ($module, $version) = each %{$opts->{PREREQ_PM}}) {
963 $meta .= " $module: $version\n";
969 distribution_type: module
972 url: http://module-build.sourceforge.net/META-spec-v1.3.html
973 generated_by: $opts->{NAME} version $version
976 if (open META, "< META.yml") {
977 my $old_meta = do { local $/; <META> };
980 $save_meta = $old_meta ne $meta;
986 print "Updating META.yml\n";
987 open META, "> META.yml" or die "Cannot create META.yml: $!";