Use idle callback to write to the local config directory
[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 $build = prompt ("Enter the location of the build directory of the configured pspp source:", "" );
9     my $src = $top_srcdir;
10
11     %Locations = (SourceDir => "$src", BuildDir => "$build");
12 };
13
14 WriteMakefile(
15     FULLPERL          => "PSPP_TEST_CMD=\"$Locations{BuildDir}/src/ui/terminal/pspp\" \$(PERL)",
16     NAME              => 'PSPP',
17     DISTNAME          => 'PSPP-Perl',
18     VERSION_FROM      => "$Locations{BuildDir}/src/libpspp/version.c", 
19     PREREQ_PM         => {POSIX=>0}, 
20     PM                => {"lib/PSPP.pm", "\$(INST_LIBDIR)/PSPP.pm"},
21     ($] >= 5.005 ?     ## Add these new keywords supported since 5.005
22       (ABSTRACT       => 'Perl extension to PSPP',
23        AUTHOR         => 'John Darrington <john@darrington.wattle.id.au>') : ()),
24     INC       => "-I $Locations{SourceDir}  -I $Locations{SourceDir}/src -I $Locations{SourceDir}/gl -I $Locations{BuildDir}/gl -I $Locations{BuildDir}", 
25     MYEXTLIB  => "$Locations{BuildDir}/src/.libs/libpspp-core.\$(SO)",
26     MAN3PODS  => {"lib/PSPP.pm", "\$(INST_MAN3DIR)/PSPP.3pm",
27             "Examples.pod", "\$(INST_MAN3DIR)/PSPP::Examples.3pm"}
28 );
29
30 if  (eval {require ExtUtils::Constant; 1}) {
31   # If you edit these definitions to change the constants used by this module,
32   # you will need to use the generated const-c.inc and const-xs.inc
33   # files to replace their "fallback" counterparts before distributing your
34   # changes.
35   my @names = (qw());
36   ExtUtils::Constant::WriteConstants(
37                                      NAME         => 'PSPP',
38                                      NAMES        => \@names,
39                                      DEFAULT_TYPE => 'IV',
40                                      C_FILE       => 'const-c.inc',
41                                      XS_FILE      => 'const-xs.inc',
42                                   );
43
44 }
45 else {
46   use File::Copy;
47   use File::Spec;
48   foreach my $file ('const-c.inc', 'const-xs.inc') {
49     my $fallback = File::Spec->catfile('fallback', $file);
50     copy ($fallback, $file) or die "Can't copy $fallback to $file: $!";
51   }
52 }