summaryrefslogtreecommitdiff
path: root/perl_dmod/Cstore/Makefile.PL
blob: d3968f723bf85e7a3401ea7681e2d624b622774a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# Copyright (C) 2010 Vyatta, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

package MY;

use 5.010000;
use ExtUtils::MakeMaker;

my $PMOD_DIR = '$(SITEPREFIX)/share/perl5';

sub constants{
  my $self = shift;
  my $orig_txt = $self->SUPER::constants(@_);
  $orig_txt =~ s#= \$\(SITEPREFIX\)/(lib|share)/.*#= $PMOD_DIR#g;
  return $orig_txt;
}

sub c_o {
  my $self = shift;
  my $orig_txt = $self->SUPER::c_o(@_);
  $orig_txt =~ s/\.c(\s)/.cpp$1/g;
  return $orig_txt;
}

sub xs_c {
  my $self = shift;
  my $orig_txt = $self->SUPER::xs_c(@_);
  $orig_txt =~ s/\.c(\s)/.cpp$1/g;
  return $orig_txt;
}

sub xs_o {
  my $self = shift;
  my $orig_txt = $self->SUPER::xs_o(@_);
  $orig_txt =~ s/\.c(\s)/.cpp$1/g;
  return $orig_txt;
}

sub install {
  my $self = shift;
  my $orig_txt = $self->SUPER::install(@_);
  $orig_txt =~ s/pure_install doc_install/pure_install/g;
  $orig_txt =~ s/\$\(INST_MAN3DIR\) .*/undef undef/g;
  return $orig_txt;
}

sub clean {
  my $self = shift;
  my $orig_txt = $self->SUPER::clean(@_);
  $orig_txt =~ s/Cstore\.c\s/Cstore.cpp /g;
  return $orig_txt;
}

sub dynamic_lib {
  my $self = shift;
  my $orig_txt = $self->SUPER::dynamic_lib(@_);
  $orig_txt =~ s/(\s)LD_RUN_PATH=\S+\s+/$1/g;
  return $orig_txt;
}

WriteMakefile(
    NAME              => 'Cstore',
    VERSION_FROM      => 'lib/Cstore.pm',
    PREREQ_PM         => {},
    ($] >= 5.005 ?
      (ABSTRACT_FROM  => 'lib/Cstore.pm',
       AUTHOR         => 'Vyatta <eng@vyatta.com>') : ()),
    # note: MM will convert LIBS to absolute path in Makefile.
    #       => regenerate Makefile every time
    LIBS   => ['-L../../src/.libs -lvyatta-cfg'],
    DEFINE => '',
    INC    => '-I../../src',
    CC => 'g++',
    PREFIX => '/opt/vyatta',
    INSTALLDIRS => 'site',
);