Obsoleted by new material in IDSoftwareRelease2010
[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 );
45
46
47 sub check_version {
48     my($got, $want) = @_;
49
50     my($gmajor, $gminor, $gtrivial) = ($got =~ /(\d+)\.(\d+)\.(\d+)/);
51     my($wmajor, $wminor, $wtrivial) = ($want =~ /(\d+)\.(\d+)\.(\d+)/);
52     if (($gmajor < $wmajor) ||
53         ($gmajor == $wmajor && $gminor < $wminor) ||
54         ($gmajor == $wmajor && $gminor == $wminor && $gtrivial < $wtrivial)) {
55         print <<__EOT__;
56 *** ERROR!
57 ZOOM-Perl requires at least version $want of YAZ,
58 but you only have version $got.
59 __EOT__
60         exit 1;
61     }
62 }
63
64 sub MY::postamble { "debian: debian/output
65
66 debian/output:
67         dpkg-buildpackage -rfakeroot -d
68         rm -rf debian/output
69         mkdir debian/output
70         mv ../libnet-z3950-zoom-perl* debian/output
71
72 debclean:
73         rm -rf debian/libnet-z3950-zoom-perl debian/output
74 ";
75 }