docs
[pspp] / perl-module / Makefile.PL
1 # PSPP - a program for statistical analysis.
2 # Copyright (C) 2019 Free Software Foundation, Inc.
3 #
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17 use 5.008008;
18 use ExtUtils::MakeMaker;
19 # See lib/ExtUtils/MakeMaker.pm for details of how to influence
20 # the contents of the Makefile that is written.
21
22
23 do './pspp-module-config' || do {
24     my $build = prompt ("Enter the location of the build directory of the configured pspp source:", "" );
25     my $src = $top_srcdir;
26
27     %Locations = (SourceDir => "$src", BuildDir => "$build");
28 };
29
30 WriteMakefile(
31     MAKEFILE          => 'MakefileX',
32     FULLPERL          => "PSPP_TEST_CMD=\"$Locations{BuildDir}/src/ui/terminal/pspp\" \$(PERL)",
33     NAME              => 'PSPP',
34     DISTNAME          => 'PSPP-Perl',
35     VERSION_FROM      => "$Locations{BuildDir}/src/libpspp/version.c",
36     PREREQ_PM         => {POSIX=>0},
37     PM                => {"lib/PSPP.pm", "\$(INST_LIBDIR)/PSPP.pm"},
38     ($] >= 5.005 ?     ## Add these new keywords supported since 5.005
39       (ABSTRACT       => 'Perl extension to PSPP',
40        AUTHOR         => 'John Darrington <john@darrington.wattle.id.au>') : ()),
41     INC       => "-I $Locations{SourceDir}  -I $Locations{SourceDir}/src -I $Locations{SourceDir}/gl -I $Locations{BuildDir}/gl -I $Locations{BuildDir}",
42     MYEXTLIB  => "$Locations{BuildDir}/src/.libs/libpspp-core.\$(SO)",
43     MAN3PODS  => {"lib/PSPP.pm", "\$(INST_MAN3DIR)/PSPP.3pm",
44             "Examples.pod", "\$(INST_MAN3DIR)/PSPP::Examples.3pm"}
45 );
46
47 if  (eval {require ExtUtils::Constant; 1}) {
48   # If you edit these definitions to change the constants used by this module,
49   # you will need to use the generated const-c.inc and const-xs.inc
50   # files to replace their "fallback" counterparts before distributing your
51   # changes.
52   my @names = (qw());
53   ExtUtils::Constant::WriteConstants(
54                                      NAME         => 'PSPP',
55                                      NAMES        => \@names,
56                                      DEFAULT_TYPE => 'IV',
57                                      C_FILE       => 'const-c.inc',
58                                      XS_FILE      => 'const-xs.inc',
59                                   );
60
61 }
62 else {
63   use File::Copy;
64   use File::Spec;
65   foreach my $file ('const-c.inc', 'const-xs.inc') {
66     my $fallback = File::Spec->catfile('fallback', $file);
67     copy ($fallback, $file) or die "Can't copy $fallback to $file: $!";
68   }
69 }