1#!/usr/bin/perl 2 3package main; 4 5use 5.008000; 6use strict; 7use warnings; 8use ExtUtils::MakeMaker; 9use ExtUtils::Liblist; 10use Config; 11 12my $libs = '-ltidyp'; 13my $inc = "-I. -I/usr/include/tidyp -I/usr/local/include/tidyp -I$Config{usrinc}/tidyp"; 14 15eval { require Alien::Tidyp; }; 16 17if ( !$@ ) { 18 print "Using tidyp via Alien::Tidyp\n"; 19 $libs = Alien::Tidyp->config('LIBS'); 20 $inc = Alien::Tidyp->config('INC'); 21} 22else { 23 print "Alien::Tidyp not found. Looking for for tidyp on your system.\n"; 24 my @vars = ExtUtils::Liblist->ext( '-L/usr/lib -L/usr/local/lib -ltidyp', 0, 1 ); 25 $libs = $vars[2]; 26 27 if ( !$libs ) { 28 $libs = '-ltidyp'; 29 print <<'EOF'; 30 31It seems that you don't have tidyp installed. HTML::Tidy does no 32real work on its own. It's just a wrapper around tidyp. 33 34Please read the README.markdown file for details on how to install tidyp. 35 36If you do have tidyp installed, but Makefile.PL can't detect it, 37go ahead and try building. If HTML::Tidy builds and tests correctly, 38please file a ticket at Github at 39http://github.com/petdance/html-tidy/issues, so we can fix the 40library detection code. 41 42EOF 43 } 44} 45 46eval { require LWP::Simple; }; 47 48if ( $@ ) { 49 print <<'EOF'; 50 51NOTE: It seems that you don't have LWP::Simple installed. 52 The webtidy program will not be able to retrieve web pages. 53 54EOF 55} 56 57my $parms = { 58 NAME => 'HTML::Tidy', 59 AUTHOR => 'Andy Lester <andy@petdance.com>', 60 VERSION_FROM => 'lib/HTML/Tidy.pm', 61 ABSTRACT_FROM => 'lib/HTML/Tidy.pm', 62 PREREQ_PM => { 63 'Encode' => 0, # for tests 64 'Exporter' => 0, 65 'Getopt::Long' => 0, # in webtidy 66 'Test::More' => '0.98', # For subtest() 67 'Test::Builder' => 0, 68 'Carp' => 0, 69 'overload' => 0, 70 'constant' => 0, 71 }, 72 73 LIBS => [$libs], 74 NEEDS_LINKING => 1, 75 INC => $inc, 76 77 EXE_FILES => [qw(bin/webtidy)], 78 dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, 79 clean => { FILES => 'HTML-Tidy-*' }, 80}; 81 82if ( $ExtUtils::MakeMaker::VERSION ge '6.45_01' ) { 83 $parms->{META_MERGE} = { 84 resources => { 85 license => 'http://www.opensource.org/licenses/artistic-license-2.0.php', 86 homepage => 'http://github.com/petdance/html-tidy', 87 bugtracker => 'http://github.com/petdance/html-tidy/issues', 88 repository => 'http://github.com/petdance/html-tidy', 89 } 90 }; 91 $parms->{LICENSE} = 'artistic_2'; 92} 93if ( $ExtUtils::MakeMaker::VERSION ge '6.47_02' ) { 94 $parms->{MIN_PERL_VERSION} = 5.008; 95} 96 97WriteMakefile( %{$parms} ); 98 99sub MY::postamble { 100return <<'MAKE_FRAG'; 101.PHONY: tags critic 102 103tags: 104 ctags -f tags --recurse --totals \ 105 --exclude=blib --exclude=t/lib \ 106 --exclude=.svn --exclude='*~' \ 107 --languages=C,Perl --langmap=Perl:+.t \ 108 . 109 110critic: 111 perlcritic -1 \ 112 -profile perlcriticrc \ 113 . 114 115MAKE_FRAG 116} 117