Add Ubuntu quantal
[ZOOM-Perl-moved-to-github.git] / Makefile.PL
1 # Use: perl Makefile.PL OPTIMIZE="-O0 -g -Wdeclaration-after-statement"
2 #  or: perl Makefile.PL PREFIX=/home/mike/universe
3
4 use 5.008;
5 use ExtUtils::MakeMaker;
6 use strict;
7
8 my $yazver = `yaz-config --version`;
9 my $yazinc = `yaz-config --cflags threads`;
10 my $yazlibs = `yaz-config --libs threads`;
11 if (!$yazver || !$yazinc || !$yazlibs) {
12     die qq[
13 ERROR: Unable to call script: yaz-config
14 If you are using a YAZ installation from the Debian package "yaz", you
15 will also need to install "libyaz-dev" in order to build this module.
16 ];
17 }
18
19 chomp($yazver);
20 check_version($yazver, "2.1.50");
21
22 # For Windows use
23 # $yazinc = '-Ic:\yaz\include';
24 # $yazlibs = 'c:\yaz\lib\yaz.lib';
25
26 # See lib/ExtUtils/MakeMaker.pm for details of how to influence
27 # the contents of the Makefile that is written.
28 WriteMakefile(
29     NAME              => 'Net::Z3950::ZOOM',
30     VERSION_FROM      => 'lib/Net/Z3950/ZOOM.pm', # finds $VERSION
31     PREREQ_PM         => { "MARC::Record" => 1.38 },
32     ($] >= 5.005 ?     ## Add these new keywords supported since 5.005
33       (ABSTRACT_FROM  => 'lib/Net/Z3950/ZOOM.pm', # retrieve abstract from module
34        AUTHOR         => 'Mike Taylor <mike@>') : ()),
35     LIBS              => [ $yazlibs ], # e.g., '-lm'
36     DEFINE            => '', # e.g., '-DHAVE_SOMETHING'
37         # Insert -I. if you add *.h files later:
38     INC               => $yazinc, # e.g., '-I/usr/include/other'
39         # Un-comment this if you add C files to link with later:
40     # OBJECT            => '$(O_FILES)', # link all the C files too
41 # Use this to test for illegal code that GCC stupidly permits by default:
42 #   OPTIMIZE          => "-Wdeclaration-after-statement -g -O0",
43     EXE_FILES    => [ 'samples/zoom/zselect', 'samples/zoom/zoomdump',
44                       'samples/zoom/zoom-delete-records' ],
45 );
46
47
48 sub check_version {
49     my($got, $want) = @_;
50
51     my($gmajor, $gminor, $gtrivial) = ($got =~ /(\d+)\.(\d+)\.(\d+)/);
52     my($wmajor, $wminor, $wtrivial) = ($want =~ /(\d+)\.(\d+)\.(\d+)/);
53     if (($gmajor < $wmajor) ||
54         ($gmajor == $wmajor && $gminor < $wminor) ||
55         ($gmajor == $wmajor && $gminor == $wminor && $gtrivial < $wtrivial)) {
56         print <<__EOT__;
57 *** ERROR!
58 ZOOM-Perl requires at least version $want of YAZ,
59 but you only have version $got.
60 __EOT__
61         exit 1;
62     }
63 }
64
65 sub MY::postamble { "debian: debian/output
66
67 debian/output:
68         dpkg-buildpackage -rfakeroot -d
69         rm -rf debian/output
70         mkdir debian/output
71         mv ../libnet-z3950-zoom-perl* debian/output
72
73 debclean:
74         rm -rf debian/libnet-z3950-zoom-perl debian/output
75 ";
76 }