# $Id: Makefile.PL,v 1.33 2002/12/15 19:40:19 skimo Exp $
+use 5.006;
use ExtUtils::MakeMaker;
use IO::File;
use Config;
@dist2 = qw(fcgiapp.c os_unix.c os_win32.c);
@dist3 = (@h1, qw(fcgi_config_x86.h));
-GetOptions ("pure-perl!" => \$pure,
- "use-installed:s" => \$useinstalled);
-$pure = "0" unless defined $pure;
-open(CFG,">FCGI.cfg");
-print CFG "\$pure = $pure;1;\n";
-close CFG;
+GetOptions ("use-installed:s" => \$useinstalled);
$libfound = 0;
@libs = ();
-if (! $pure) {
- my $cwd = cwd();
- my $devkit = "$cwd/..";
+my $cwd = cwd();
+my $devkit = "$cwd/..";
- if (defined $useinstalled) {
+if (defined $useinstalled) {
require ExtUtils::Liblist;
my $libspec = $useinstalled ? "-L$useinstalled/lib " : "";
$libspec .= "-lfcgi";
$libfound = 1;
push @libs, $libspec;
}
+}
+if (!$libfound && -d "$devkit/libfcgi" && -d "$devkit/include") {
+ # devkit
+ if (grep { ! -f "$devkit/include/$_" } @dist3
+ or grep { ! -f "$devkit/libfcgi/$_" } @dist2)
+ {
+ warn "This appears to be a FastCGI devkit distribution, " .
+ "but one or more FastCGI library files are missing. \n" .
+ "Please check the integrity of the distribution.\n";
+ exit -1;
}
- if (!$libfound && -d "$devkit/libfcgi" && -d "$devkit/include") {
- # devkit
- if (grep { ! -f "$devkit/include/$_" } @dist3
- or grep { ! -f "$devkit/libfcgi/$_" } @dist2)
- {
- warn "This appears to be a FastCGI devkit distribution, " .
- "but one or more FastCGI library files are missing. \n" .
- "Please check the integrity of the distribution.\n";
- exit -1;
- }
-
- my $extrarules = join "\n",
- map { $b = $_; $b =~ s/\.c$//; my $s="$devkit/libfcgi/$b.c";
- "$b\$(OBJ_EXT): $s\n\t".
- '$(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) '."$s\n"; }
- @dist2;
- eval 'package MY; sub postamble { $extrarules; }';
- $prefix = $devkit;
- }
+
+ my $extrarules = join "\n",
+ map { $b = $_; $b =~ s/\.c$//; my $s="$devkit/libfcgi/$b.c";
+ "$b\$(OBJ_EXT): $s\n\t".
+ '$(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) '."$s\n"; }
+ @dist2;
+ eval 'package MY; sub postamble { $extrarules; }';
+ $prefix = $devkit;
}
+
$sys = $^O eq 'MSWin32' ? 'win32' : 'unix';
push @o, "fcgiapp.o", "os_$sys.o" unless $libfound;
$inc = '-I.' unless $libfound;
push(@extras,
ABSTRACT => 'Fast CGI module',
AUTHOR => 'Sven Verdoolaege (skimo@kotnet.org)'
-)
- if ($ExtUtils::MakeMaker::VERSION >= 5.4301);
-
-$plfiles = {
- 'echo.PL' => 'echo.fpl',
- 'remote.PL' => 'remote.fpl',
- 'threaded.PL' => 'threaded.fpl',
- 'FCGI.PL' => 'FCGI.pm',
-};
-$plfiles->{'FCGI.XL'} = 'FCGI.xs' unless $pure;
-if ($pure) {
- push @extras,
- LINKTYPE => ' ';
-} else {
+) if ($ExtUtils::MakeMaker::VERSION >= 5.4301);
- if ("$sys" eq "win32") {
- push @libs, ":nosearch -lws2_32";
- push @extras, 'DEFINE' => '-DDLLAPI=__declspec(dllexport)';
- }
+push @extras, META_MERGE => {
+ resources => {
+ repository => 'git://git.shadowcat.co.uk/catagits/fcgi2.git',
+ },
+} if $ExtUtils::MakeMaker::VERSION >= 6.46;
- push @extras,
- 'LIBS' => [ "@libs" ],
- 'OBJECT' => "@o",
- 'INC' => $inc;
+push(@extras,
+ MIN_PERL_VERSION => '5.006',
+) if $ExtUtils::MakeMaker::VERSION >= 6.48;
+
+# not strictly necessary as everything is in core...
+#push(@extras,
+# CONFIGURE_REQUIRES => {
+# ...
+# },
+#) if $ExtUtils::MakeMaker::VERSION >= 6.51_03;
+
+if ("$sys" eq "win32") {
+ push @libs, ":nosearch -lws2_32";
+ push @extras, 'DEFINE' => '-DDLLAPI=__declspec(dllexport)';
}
+push @extras,
+ 'LIBS' => [ "@libs" ],
+ 'OBJECT' => "@o",
+ 'INC' => $inc;
+
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
# Work around bug in previous versions of MakeMaker
WriteMakefile(
'NAME' => 'FCGI',
- 'VERSION_FROM' => 'version.pm',
+ 'VERSION_FROM' => 'FCGI.pm',
'dist' => {
'COMPRESS' => 'gzip -9f',
'SUFFIX' => 'gz',
(map {"libfcgi/$_"} @dist2),
map {"include/$_"} @dist3).' $(DISTVNAME);'.
'$(CP) MANIFEST MANIFEST.old;'.
- 'echo -e '. join('\\\n',@dist1,@dist2,@dist3) .
+ '$(ECHO) '. join('\\\n',@dist1,@dist2,@dist3) .
'>> $(DISTVNAME)/MANIFEST',
'POSTOP' =>
'$(MV) MANIFEST.old MANIFEST',
},
'clean' => { FILES => 'config.cache fcgi_config.h' .
- ' FCGI.xs FCGI.c FCGI.cfg ' .
- (join ' ', values %$plfiles)},
- 'PL_FILES' => $plfiles,
+ ' FCGI.c ' },
PM => {'FCGI.pm' => '$(INST_ARCHLIBDIR)/FCGI.pm'},
+ PREREQ_PM => {'XSLoader' => '0'},
@extras,
);
-exit if -f 'fcgi_config.h' or $libfound or $pure;
+exit if -f 'fcgi_config.h' or $libfound;
# CPAN and no installed lib found
if ($sys eq "win32") {
unlink("fcgi_config.h");
my $confdir = $prefix ? "$prefix/include/" : '';
die $! unless copy("${confdir}fcgi_config_x86.h","fcgi_config.h");
-
- # Win can't deal with existence of FCGI.xs or absence of FCGI.c
- unlink("FCGI.xs");
- open(F, ">FCGI.c"); close(F);
- $now = time; $before = $now - 600;
- utime $before, $before, "FCGI.c";
- utime $now, $now, "FCGI.PL";
} else {
print "Running ./configure for you\n";
print "Please read configure.readme for information on how to run it yourself\n";
$ENV{'CC'} = $Config{'cc'};
+ if ( $^O eq 'android' && !$ENV{'TMPDIR'} ) {
+ # See http://stackoverflow.com/a/15417261
+ require File::Spec;
+ $ENV{'TMPDIR'} = File::Spec->tmpdir();
+ }
system("$Config{sh} configure");
}