| 1 | # -*-perl-*- |
| 2 | # |
| 3 | # $Id$ |
| 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 | |
| 28 | use ExtUtils::MakeMaker; |
| 29 | use Config; |
| 30 | |
| 31 | sub 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 | |
| 42 | WriteMakefile(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 |
| 49 | keystuff pgproc utils)]}), |
| 50 | CONFIGURE => \&configure, |
| 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, |
| 56 | PL_FILES => { 'algs.PL' => 'algs.c' }, |
| 57 | depend => { '$(MAKEFILE)' => '$(VERSION_FROM)', |
| 58 | 'catacomb.c' => |
| 59 | join(" ", grep { s/$/.xs/ } |
| 60 | @{[qw(catacomb algorithms mp field ec |
| 61 | gf misc pgen key group pubkey)]}) |
| 62 | }, |
| 63 | VERSION_FROM => "Catacomb.pm"); |
| 64 | |
| 65 | sub 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 | |
| 75 | sub 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 | |
| 85 | sub 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 ---------------------------------------------------- |