Much wider support for Catacomb in all its glory.
[catacomb-perl] / Makefile.PL
CommitLineData
660b443c 1# -*-perl-*-
2#
a1a90aaf 3# $Id$
660b443c 4#
5# Makefile for Catacomb/Perl
6#
7# (c) 2000 Straylight/Edgeware
8#
9
10#----- Licensing notice -----------------------------------------------------
11#
12# This file is part of the Perl interface to Catacomb.
13#
14# Catacomb/Perl is free software; you can redistribute it and/or modify
15# it under the terms of the GNU General Public License as published by
16# the Free Software Foundation; either version 2 of the License, or
17# (at your option) any later version.
18#
19# Catacomb/Perl is distributed in the hope that it will be useful,
20# but WITHOUT ANY WARRANTY; without even the implied warranty of
21# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22# GNU General Public License for more details.
23#
24# You should have received a copy of the GNU General Public License
25# along with Catacomb/Perl; if not, write to the Free Software Foundation,
26# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27
660b443c 28use ExtUtils::MakeMaker;
29use Config;
30
fcd15e0b 31sub pmfix {
32 my $h = {};
33 foreach my $i (@_) {
34 my $f = $i;
35 $f =~ s!::!/!;
36 $f .= ".pm";
37 $h->{$f} = "\$(INST_LIBDIR)/$f";
38 }
39 return $h;
40}
41
660b443c 42WriteMakefile(NAME => "Catacomb",
43 DISTNAME => "catacomb-perl",
44 AUTHOR => "Mark Wooding (mdw\@nsict.org)",
45 OPTIMIZE => "-O2 -g",
46 XS => { "catacomb.xs" => "catacomb.c" },
47 OBJECT => join(" ", grep { s/$/$Config{_o}/ }
48 @{[qw(algs mpstuff catacomb algstuff
a1a90aaf 49 keystuff pgproc utils)]}),
660b443c 50 CONFIGURE => \&configure,
fcd15e0b 51 PM => pmfix(Catacomb, Catacomb::Base, Catacomb::Cache,
52 Catacomb::MP, Catacomb::Field, Catacomb::EC,
53 Catacomb::Group, Catacomb::GF, Catacomb::Rand,
54 Catacomb::Crypto, Catacomb::Key),
55 PERL_MALLOC_OK => 1,
660b443c 56 PL_FILES => { 'algs.PL' => 'algs.c' },
57 depend => { '$(MAKEFILE)' => '$(VERSION_FROM)',
58 'catacomb.c' =>
59 join(" ", grep { s/$/.xs/ }
a1a90aaf 60 @{[qw(catacomb algorithms mp field ec
fcd15e0b 61 gf misc pgen key group pubkey)]})
660b443c 62 },
63 VERSION_FROM => "Catacomb.pm");
64
65sub libconfig_item {
66 my $lib = shift;
67 my $what = shift;
68 my $out = `$lib-config --$what`;
69 $? and die("nonzero exit status from $lib-config --$what");
70 chomp $out;
71 $config{$what} .= " " if defined($config{$what});
72 $config{$what} .= $out;
73}
74
75sub libconfig {
76 my $lib = shift;
77 my $version = shift;
78
79 system("$lib-config --check $version")
80 and die("$lib version $version not found");
81 libconfig_item($lib, "cflags");
82 libconfig_item($lib, "libs");
83}
84
85sub configure {
86 local %config;
87 libconfig("mLib", "2.0.0pre4");
88 libconfig("catacomb", "2.0.0pre8");
89 return { CCFLAGS => $config{cflags},
90 LIBS => [ $config{libs} ] };
91}
92
93#----- That's all, folks ----------------------------------------------------