Ensure that module version agrees with pspp version
[pspp-builds.git] / perl-module / Makefile.PL
1 use 5.008008;
2 use ExtUtils::MakeMaker;
3 # See lib/ExtUtils/MakeMaker.pm for details of how to influence
4 # the contents of the Makefile that is written.
5
6
7 do 'pspp-module-config' || do {
8     my $src = prompt ("Enter the location of the full pspp source","../pspp");
9     my $build = prompt ("Enter the location of the pspp build directory", "$src" );
10
11     %Locations = (SourceDir => "$src", BuildDir => "$build");
12 };
13
14 WriteMakefile(
15     NAME              => 'PSPP',
16     DISTNAME          => 'PSPP-Perl',
17     VERSION_FROM      => "$Locations{BuildDir}/src/libpspp/version.c", 
18     PREREQ_PM         => {POSIX=>0}, 
19     ($] >= 5.005 ?     ## Add these new keywords supported since 5.005
20       (ABSTRACT_FROM  => 'lib/PSPP.pm', # retrieve abstract from module
21        AUTHOR         => 'John Darrington <john@darrington.wattle.id.au>') : ()),
22     INC       => "-I $Locations{SourceDir}  -I $Locations{SourceDir}/src -I $Locations{SourceDir}/gl -I $Locations{BuildDir}/gl -I $Locations{BuildDir}", 
23
24     MYEXTLIB  => "$Locations{BuildDir}/src/.libs/libpspp-core\$(LIB_EXT)",
25     MAN3PODS  => {"lib/PSPP.pm", "\$(INST_MAN3DIR)/PSPP.3pm",
26             "Examples.pod", "\$(INST_MAN3DIR)/PSPP::Examples.3pm"}
27 );
28
29 if  (eval {require ExtUtils::Constant; 1}) {
30   # If you edit these definitions to change the constants used by this module,
31   # you will need to use the generated const-c.inc and const-xs.inc
32   # files to replace their "fallback" counterparts before distributing your
33   # changes.
34   my @names = (qw());
35   ExtUtils::Constant::WriteConstants(
36                                      NAME         => 'PSPP',
37                                      NAMES        => \@names,
38                                      DEFAULT_TYPE => 'IV',
39                                      C_FILE       => 'const-c.inc',
40                                      XS_FILE      => 'const-xs.inc',
41                                   );
42
43 }
44 else {
45   use File::Copy;
46   use File::Spec;
47   foreach my $file ('const-c.inc', 'const-xs.inc') {
48     my $fallback = File::Spec->catfile('fallback', $file);
49     copy ($fallback, $file) or die "Can't copy $fallback to $file: $!";
50   }
51 }