Line 0
Link Here
|
|
|
1 |
--- Makefile.PL.orig 2013-11-05 19:35:08.000000000 +0600 |
2 |
+++ Makefile.PL 2013-11-05 19:36:19.000000000 +0600 |
3 |
@@ -37,69 +37,3 @@ |
4 |
requires 'Net::SNMP' => undef; |
5 |
|
6 |
WriteAll; |
7 |
- |
8 |
-# substitute prefix everywhere |
9 |
-$MY::variables{DATADIR} =~ s/\$\(PREFIX\)/$MY::variables{PREFIX}/; |
10 |
- |
11 |
-print <<EOF; |
12 |
- |
13 |
-Installation summary |
14 |
--------------------- |
15 |
-prefix: $MY::variables{PREFIX} |
16 |
-constant data installation directory: $MY::variables{DATADIR} |
17 |
- |
18 |
-EOF |
19 |
- |
20 |
-package MY; |
21 |
- |
22 |
-our %setup; |
23 |
-our %variables; |
24 |
- |
25 |
-# force a perl-independant prefix for everything but perl modules |
26 |
-sub constants { |
27 |
- my ($self) = @_; |
28 |
- |
29 |
- # for some reason, initialising variables from the global scope doesn't work |
30 |
- %variables = ( |
31 |
- PREFIX => '/usr/local', |
32 |
- INSTALLLIB => '$(DATADIR)/lib', |
33 |
- INSTALLSITELIB => '$(DATADIR)/lib', |
34 |
- INSTALLVENDORLIB => '$(DATADIR)/lib', |
35 |
- INSTALLMAN3DIR => '$(PREFIX)/share/man/man3', |
36 |
- INSTALLSITEMAN3DIR => '$(PREFIX)/share/man/man3', |
37 |
- INSTALLVENDORMAN3DIR => '$(PREFIX)/share/man/man3', |
38 |
- DATADIR => '$(PREFIX)/share/fusioninventory', |
39 |
- FULLPERLRUN => '$(FULLPERL) -I$(DATADIR)/lib' |
40 |
- ); |
41 |
- |
42 |
- # allow variables detected from agent setup to override defaults |
43 |
- foreach my $name (keys %variables) { |
44 |
- $variables{$name} = $setup{$name} if $setup{$name}; |
45 |
- } |
46 |
- |
47 |
- # allow variables defined on command line to override defaults |
48 |
- foreach my $name (keys %variables) { |
49 |
- $variables{$name} = $self->{ARGS}->{$name} if $self->{ARGS}->{$name}; |
50 |
- } |
51 |
- |
52 |
- # get all standard MM variables definitions, and override them if needed |
53 |
- my @code = split(/\n/, $self->SUPER::constants(@_)); |
54 |
- foreach my $line (@code) { |
55 |
- # Skip comments |
56 |
- next if $line =~ /^\s*#/; |
57 |
- # Skip everything which isn't a var assignment. |
58 |
- next unless $line =~ /^([A-Z0-9_]+) =/; |
59 |
- my $name = $1; |
60 |
- # skip variables we're not interested |
61 |
- next unless $variables{$name}; |
62 |
- |
63 |
- $line = "$name = $variables{$name}"; |
64 |
- } |
65 |
- |
66 |
- # add out own variables |
67 |
- foreach my $name (qw/DATADIR/) { |
68 |
- push @code, "$name = $variables{$name}"; |
69 |
- } |
70 |
- |
71 |
- return join("\n", @code); |
72 |
-} |