Lines 1-84
Link Here
|
1 |
require 5.005; |
1 |
require 5.005; |
2 |
|
2 |
|
3 |
# RPM builders, or people building in their home dirs: |
|
|
4 |
# |
5 |
# VARIABLE DEFAULT |
6 |
# ------------- ----------------- |
7 |
# PREFIX * /usr |
8 |
# INST_PREFIX + $PREFIX |
9 |
# SYSCONFDIR * /etc |
10 |
# or $(PREFIX)/etc if $(INST_PREFIX) is not "/usr" |
11 |
# INST_SYSCONFDIR + $SYSCONFDIR |
12 |
# or $(INST_PREFIX)/etc if $(INST_PREFIX) is not "/usr" |
13 |
# PKG_DEF_RULES_DIR * $DEF_RULES_DIR or $(PREFIX)/share/spamassassin |
14 |
# DEF_RULES_DIR + $(INST_PREFIX)/share/spamassassin |
15 |
# PKG_LOCAL_RULES_DIR * $LOCAL_RULES_DIR |
16 |
# or $(SYSCONFDIR)/mail/spamassassin |
17 |
# LOCAL_RULES_DIR + $(INST_SYSCONFDIR)/mail/spamassassin |
18 |
# INST_SITELIB + $(INSTALLSITELIB) |
19 |
# |
20 |
# RUN_RAZOR2_TESTS (prompt if Razor 2 found) |
21 |
# CONTACT_ADDRESS (prompt: default="the administrator of that system") |
22 |
# ENABLE_SSL * 'no' |
23 |
# |
24 |
# PERL_BIN * current path to Perl |
25 |
# PERL_VERSION * current Perl version |
26 |
# PERL_WARN * 'yes' for CVS builds; else 'no' |
27 |
# |
28 |
# * means the variable is used for build time |
29 |
# + means the variable is used for run time |
30 |
# |
31 |
# For example, to install in your home dir: |
32 |
# |
33 |
# perl Makefile.PL PREFIX=/home/jm/sausr SYSCONFDIR=/home/jm/saetc |
34 |
# |
35 |
# Or to build a package in /tmp/build, but with its internal paths |
36 |
# referring to /usr and /etc: |
37 |
# |
38 |
# perl Makefile.PL PREFIX=/tmp/build/usr SYSCONFDIR=/tmp/build/etc \ |
39 |
# INST_PREFIX=/usr INST_SYSCONFDIR=/etc |
40 |
# |
41 |
# The Razor prompt ("run Razor 2 tests?") can be overridden by setting |
42 |
# RUN_RAZOR2_TESTS to "y" or "n". |
43 |
# |
44 |
# Set ENABLE_SSL to "yes" if you want the ability to use encrypted |
45 |
# connections between spamc and spamd. |
46 |
# |
47 |
########################################################################### |
48 |
|
49 |
use strict; |
3 |
use strict; |
50 |
use Config; |
4 |
use Config; |
|
|
5 |
|
51 |
use ExtUtils::MakeMaker; |
6 |
use ExtUtils::MakeMaker; |
52 |
|
7 |
|
53 |
$ExtUtils::MakeMaker::Recognized_Att_Keys{'INST_PREFIX'} = 1; |
8 |
use constant RUNNING_ON_WINDOWS => ($^O =~ /^(?:mswin|dos|os2)/oi); |
54 |
$ExtUtils::MakeMaker::Recognized_Att_Keys{'SYSCONFDIR'} = 1; |
|
|
55 |
$ExtUtils::MakeMaker::Recognized_Att_Keys{'INST_SYSCONFDIR'} = 1; |
56 |
$ExtUtils::MakeMaker::Recognized_Att_Keys{'DEF_RULES_DIR'} = 1; |
57 |
$ExtUtils::MakeMaker::Recognized_Att_Keys{'PKG_DEF_RULES_DIR'} = 1; |
58 |
$ExtUtils::MakeMaker::Recognized_Att_Keys{'LOCAL_RULES_DIR'} = 1; |
59 |
$ExtUtils::MakeMaker::Recognized_Att_Keys{'PKG_LOCAL_RULES_DIR'} = 1; |
60 |
$ExtUtils::MakeMaker::Recognized_Att_Keys{'INST_SITELIB'} = 1; |
61 |
|
9 |
|
62 |
$ExtUtils::MakeMaker::Recognized_Att_Keys{'RUN_RAZOR2_TESTS'} = 1; |
|
|
63 |
$ExtUtils::MakeMaker::Recognized_Att_Keys{'ENABLE_SSL'} = 1; |
64 |
$ExtUtils::MakeMaker::Recognized_Att_Keys{'CONTACT_ADDRESS'} = 1; |
65 |
|
10 |
|
66 |
$ExtUtils::MakeMaker::Recognized_Att_Keys{'PERL_BIN'} = 1; |
11 |
my @ATT_KEYS = ( |
67 |
$ExtUtils::MakeMaker::Recognized_Att_Keys{'PERL_WARN'} = 1; |
12 |
# (Current) EU::MMs make a difference between these three possible general |
68 |
$ExtUtils::MakeMaker::Recognized_Att_Keys{'PERL_TAINT'} = 1; |
13 |
# install destinations. One can set INSTALLDIRS to 'perl', 'site' or |
69 |
$ExtUtils::MakeMaker::Recognized_Att_Keys{'PERL_VERSION'} = 1; |
14 |
# 'vendor' to choose one explicitly (the default is 'site'). They have the |
|
|
15 |
# following meaning: |
16 |
# * PERL: Only essential modules shipped with Perl should be installed |
17 |
# there. Don't put SpamAssassin there. |
18 |
# * SITE: The default. Normal installations via CPAN or from the sources |
19 |
# should use these dirs. |
20 |
# * VENDOR: A special set of paths for packaged (RPM, deb, portage, ...) |
21 |
# Perl modules. Not always (correctly) used but the intention |
22 |
# is to keep the system from overwriting the modules installed |
23 |
# by the user. |
24 |
# |
25 |
# See also |
26 |
# <http://search.cpan.org/author/MSCHWERN/ExtUtils-MakeMaker-6.16/lib/ExtUtils/MakeMaker.pm#Default_Makefile_Behaviour> |
27 |
# <http://www.debian.org/doc/packaging-manuals/perl-policy/ch-module_packages.html#s-vendor_dirs> |
28 |
# <http://archive.develooper.com/perl5-porters@perl.org/msg94113.html> |
29 |
# <https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=78053> |
30 |
# <http://www.mail-archive.com/makemaker@perl.org/msg00779.html> |
31 |
# |
32 |
# The options SYSCONFDIR, DATADIR and CONFDIR all support those three |
33 |
# possibilities. The '*' in the following comments refers to those. |
70 |
|
34 |
|
71 |
use constant RUNNING_ON_WINDOWS => ($^O =~ /^(?:mswin|dos|os2)/oi); |
35 |
'SYSCONFIDIR', # Overwrite all $*SYSCONFDIRs; normally determined |
|
|
36 |
'PERLSYSCONFDIR', # based on $*PREFIX. |
37 |
'SITESYSCONFDIR', # |
38 |
'VENDORSYSCONFDIR', # |
39 |
|
40 |
'DATADIR', # Overwrite all INSTALL*DATAs; normally determined |
41 |
'INSTALLDATA', # based on $*PREFIX. |
42 |
'INSTALLSITEDATA', # |
43 |
'INSTALLVENDORDATA',# |
72 |
|
44 |
|
|
|
45 |
'CONFDIR', # Overwrite all INSTALL*CONFs; normally determined |
46 |
'INSTALLCONF', # based on $*SYSCONFDIR. |
47 |
'INSTALLSITECONF', # |
48 |
'INSTALLVENDORCONF',# |
73 |
|
49 |
|
74 |
# See lib/ExtUtils/MakeMaker.pm for details of how to influence |
50 |
'DEFRULESDIR', # A synonyme for 'DATADIR'. |
75 |
# the contents of the Makefile that is written. |
51 |
'LOCALRULESDIR', # " " " 'CONFDIR'. |
|
|
52 |
|
53 |
'PERL_BIN', # Sets the Perl interpreter used by the scripts. |
54 |
'PERL_VERSION', # Some parts in SpamAssassin are dependant on the version |
55 |
'PERL_WARN', # Can be used to disable warnings in the scripts |
56 |
'PERL_TAINT', # " " " " " taint mode for the scripts (DON'T) |
57 |
|
58 |
|
59 |
'ENABLE_SSL', # Set to 'yes' to build spamc with SSL support. |
60 |
'CONTACT_ADDRESS', # Don't ask for the contact address, use this string. |
61 |
'RUN_RAZOR_TESTS', # Don't ask wether the Razor tests should be run, use |
62 |
'RUN_RAZOR2_TESTS'# this setting. |
63 |
); |
64 |
|
65 |
|
66 |
sub parse_arg { |
67 |
my($val, $name) = (@_); |
68 |
|
69 |
if ($val =~ /^($name)=["']?(.*?)["']?$/) { |
70 |
return $2; |
71 |
} else { |
72 |
return undef; |
73 |
} |
74 |
} |
75 |
|
76 |
sub bool { |
77 |
my($val, $def) = (@_, undef, undef); |
78 |
$def = 0 unless defined $def; |
79 |
return bool($def) unless defined $val; |
80 |
|
81 |
$val =~ s/^\s+|\s+$//g; |
82 |
return 0 if $val =~ /^(0|N(o)?|Off)$/i; |
83 |
return 1 if $val =~ /^(1|Y(es)?|On)$/i; |
84 |
return bool($def); |
85 |
} |
86 |
sub yesno { |
87 |
my($val, $def) = (@_, undef, undef); |
88 |
return 'yes' if bool($val, $def); |
89 |
return 'no'; |
90 |
} |
91 |
|
92 |
|
93 |
|
94 |
my %opt = ( |
95 |
'enable_ssl' => undef, |
96 |
'contact_address' => undef, |
97 |
'run_razor_tests' => undef, |
98 |
'destdir' => undef, |
99 |
'__cruft' => undef, |
100 |
'ignore_cruft' => undef, |
101 |
); |
102 |
ARGV: foreach (@ARGV) { |
103 |
foreach my $key (keys %opt) { |
104 |
my $val; |
105 |
|
106 |
$val = parse_arg($_, uc($key)); |
107 |
if (defined $val) { |
108 |
$opt{$key} = $val; |
109 |
next ARGV; |
110 |
} |
111 |
|
112 |
if (defined parse_arg($_, qr/INST_(?:PREFIX|SITELIB|SYSCONFDIR)|[A-Z_]+_RULES_DIR/)) { |
113 |
$opt{'__cruft'} = 1; |
114 |
} |
115 |
} |
116 |
} |
117 |
|
118 |
|
119 |
# Gather some information about what EU::MM offers and/or needs |
120 |
my($mm_version, $mm_has_destdir, $mm_has_good_destdir, $mm_needs_destdir, $mm_has_pm_filter); |
121 |
|
122 |
# Store the version for later use |
123 |
$mm_version = $ExtUtils::MakeMaker::VERSION; |
124 |
|
125 |
# MakeMaker prior to 6.11 doesn't support DESTDIR which is needed for |
126 |
# packaging with builddir!=destdir. See bug 2388. |
127 |
$mm_has_destdir = $ExtUtils::MakeMaker::Recognized_Att_Keys{DESTDIR}; |
128 |
$mm_has_good_destdir = $mm_version >= 6.11; |
129 |
# Add DESTDIR hack only if it's requested (and necessary) |
130 |
$mm_needs_destdir = $opt{'destdir'} && !$mm_has_destdir; |
131 |
$mm_has_destdir ||= $mm_needs_destdir; |
132 |
push(@ATT_KEYS, 'DESTDIR') if $mm_has_destdir; |
133 |
|
134 |
# MakeMaker prior to 5.46 doesn't support PM_FILTER, so we have to |
135 |
# implement it ourselves. Also bear in mind that MakeMaker (5.45) from |
136 |
# Perl 5.6.1 supports that option while the one from 5.6.0 doesn't; they |
137 |
# do have the same version though! See bug 1652. |
138 |
$mm_has_pm_filter = $mm_version > 5.45 || ($mm_version == 5.45 && $] > 5.006); |
139 |
|
140 |
# Now make EU::MM understand our extended vars |
141 |
foreach my $key (@ATT_KEYS) { |
142 |
$ExtUtils::MakeMaker::Recognized_Att_Keys{$key} = 1; |
143 |
} |
76 |
|
144 |
|
77 |
my $mm_version = $ExtUtils::MakeMaker::VERSION; |
|
|
78 |
|
145 |
|
79 |
# Gather the rules files in the range 00-69; we do this in perl because it's more portable |
146 |
# Gather the rules files in the range 00-69; we do this in perl because it's more portable |
80 |
my @rulesfiles = map { s,^rules/,,; $_ } (<rules/*.cf>); |
147 |
my @rulesfiles = map { s,^rules/,,; $_ } (<rules/*.cf>); |
81 |
my $rulesfiles = join(' ', (grep { /^[0-6][0-9]_/ } @rulesfiles), qw(user_prefs.template triplets.txt languages)); |
148 |
my $rulesfiles = join(' ', (grep { /^[0-6][0-9]_/ } @rulesfiles), qw(user_prefs.template triplets.txt languages)); |
82 |
|
149 |
|
83 |
# Only build spamd and spamc on non-Windows platforms |
150 |
# Only build spamd and spamc on non-Windows platforms |
84 |
my @SPAMD_EXE_FILES = (); |
151 |
my @SPAMD_EXE_FILES = (); |
Lines 86-91
if (!RUNNING_ON_WINDOWS) {
Link Here
|
86 |
@SPAMD_EXE_FILES = ('spamd/spamc$(EXE_EXT)', 'spamd/spamd'); |
153 |
@SPAMD_EXE_FILES = ('spamd/spamc$(EXE_EXT)', 'spamd/spamd'); |
87 |
} |
154 |
} |
88 |
|
155 |
|
|
|
156 |
# See lib/ExtUtils/MakeMaker.pm for details of how to influence |
157 |
# the contents of the Makefile that is written. |
89 |
my %makefile = ( |
158 |
my %makefile = ( |
90 |
'NAME' => 'Mail::SpamAssassin', |
159 |
'NAME' => 'Mail::SpamAssassin', |
91 |
'VERSION_FROM' => 'lib/Mail/SpamAssassin.pm', # finds $VERSION |
160 |
'VERSION_FROM' => 'lib/Mail/SpamAssassin.pm', # finds $VERSION |
Lines 95-101
my %makefile = (
Link Here
|
95 |
@SPAMD_EXE_FILES |
164 |
@SPAMD_EXE_FILES |
96 |
], |
165 |
], |
97 |
|
166 |
|
98 |
'MAN1PODS' => { |
167 |
'MAN1PODS' => { |
99 |
'spamassassin' => '$(INST_MAN1DIR)/spamassassin.$(MAN1EXT)', |
168 |
'spamassassin' => '$(INST_MAN1DIR)/spamassassin.$(MAN1EXT)', |
100 |
'sa-learn' => '$(INST_MAN1DIR)/sa-learn.$(MAN1EXT)', |
169 |
'sa-learn' => '$(INST_MAN1DIR)/sa-learn.$(MAN1EXT)', |
101 |
'spamd/spamc.pod' => '$(INST_MAN1DIR)/spamc.$(MAN1EXT)', |
170 |
'spamd/spamc.pod' => '$(INST_MAN1DIR)/spamc.$(MAN1EXT)', |
Lines 106-112
my %makefile = (
Link Here
|
106 |
|
175 |
|
107 |
'PMLIBDIRS' => [ 'lib' ], |
176 |
'PMLIBDIRS' => [ 'lib' ], |
108 |
|
177 |
|
109 |
'PM_FILTER' => '$(PERL) build/preprocessor -Mconditional $(FIXBYTES) -Mvars -DVERSION="$(VERSION)" -DPREFIX="$(INST_PREFIX)"', |
178 |
'PM_FILTER' => '$(PERL) build/preprocessor -Mconditional $(FIXBYTES) -Mvars -DVERSION="$(VERSION)" -DPREFIX="$(I_PREFIX)"', |
110 |
|
179 |
|
111 |
'macro' => { |
180 |
'macro' => { |
112 |
RULES => $rulesfiles, |
181 |
RULES => $rulesfiles, |
Lines 148-209
my %makefile = (
Link Here
|
148 |
'NORECURS' => 1, |
217 |
'NORECURS' => 1, |
149 |
); |
218 |
); |
150 |
|
219 |
|
151 |
# MakeMaker prior to 5.46 doesn't support PM_FILTER, so we have to |
|
|
152 |
# implement it ourselves. Also bear in mind that MakeMaker (5.45) from |
153 |
# Perl 5.6.1 supports that option while the one from 5.6.0 doesn't; they |
154 |
# do have the same version though! See bug 1652. |
155 |
my $pm_filter = $mm_version > 5.45 || ($mm_version == 5.45 && $] > 5.006); |
156 |
|
220 |
|
157 |
if(!$pm_filter) { |
221 |
if (bool($opt{'__cruft'}, 0) and not bool($opt{'ignore_cruft'}, 0)) { |
158 |
warn <<ITSALLSOSTUPID; |
222 |
($_=<<" OLDCRUFT") =~ s/^ {4}//gm; |
159 |
|
223 |
|
160 |
*********************************************************************** |
224 |
*********************************************************************** |
161 |
Your version of ExtUtils::MakeMaker does not support PM_FILTER. |
225 |
You tried to use one of the variables |
162 |
We need to include a nasty workaround to make it work with our make |
226 |
INST_PREFIX |
163 |
routines. You will get loads of warnings and it is very likely to break |
227 |
INST_SITELIB |
164 |
at various places. |
228 |
INST_SYSCONFDIR |
|
|
229 |
DEF_RULES_DIR |
230 |
LOCAL_RULES_DIR |
231 |
Those are not supported anymore. Please read the documents INSTALL and |
232 |
PACKAGING to find out about the new way of changing these values. |
165 |
|
233 |
|
166 |
*Please* consider updating to a version later than 5.45. It's available |
234 |
Thanks and sorry for the inconvenience. |
167 |
on CPAN <http://search.cpan.org/search?module=ExtUtils::MakeMaker>. |
235 |
*********************************************************************** |
168 |
|
236 |
|
169 |
Hint: Perl 5.6.1 and later ship good versions of ExtUtils::MakeMaker |
237 |
OLDCRUFT |
170 |
by default. |
238 |
die $_; |
|
|
239 |
} |
171 |
|
240 |
|
172 |
If anything breaks while building Mail::SpamAssassin, please file a bug |
|
|
173 |
at <http://bugzilla.spamassassin.org>. |
174 |
*********************************************************************** |
175 |
|
241 |
|
176 |
ITSALLSOSTUPID |
242 |
if ($mm_needs_destdir) { |
|
|
243 |
($_=<<" DESTDIRHACK") =~ s/^ {4}//gm; |
244 |
|
245 |
*********************************************************************** |
246 |
You used the variable |
247 |
DESTDIR |
248 |
but your installation of ExtUtils::MakeMaker ${mm_version} doesn't support |
249 |
that directive natively. |
250 |
|
251 |
This script includes a kludge to make it work with older versions, too. |
252 |
If something does not work as expected, please report a bug to |
253 |
<http://bugzilla.spamassassin.org> |
254 |
including your version of ExtUtils::MakeMaker. We might also ask you to |
255 |
attach the generated Makefile to that bug. |
256 |
|
257 |
If you want to be on the safe side, you might want to upgrade your |
258 |
ExtUtils::MakeMaker to at least version 6.11. It is available via CPAN. |
259 |
You can use either the CPAN shell or go to |
260 |
<http://search.cpan.org/search?module=ExtUtils::MakeMaker> |
261 |
to get an up-to-date version. |
262 |
|
263 |
This is needed only for packaging, the end-users will not need to have |
264 |
to upgrade to use SpamAssassin. |
265 |
*********************************************************************** |
266 |
|
267 |
DESTDIRHACK |
268 |
warn $_; |
269 |
} elsif ($opt{'destdir'} and !$mm_has_good_destdir) { |
270 |
($_=<<" DESTDIRBUG") =~ s/^ {4}//gm; |
271 |
|
272 |
*********************************************************************** |
273 |
You used the variable |
274 |
DESTDIR |
275 |
but the implementation in your version of ExtUtils::MakeMaker ${mm_version} |
276 |
is said to be buggy. |
277 |
|
278 |
If you want to be on the safe side, you might want to upgrade your |
279 |
ExtUtils::MakeMaker to at least version 6.11. It is available via CPAN. |
280 |
You can use either the CPAN shell or go to |
281 |
<http://search.cpan.org/search?module=ExtUtils::MakeMaker> |
282 |
to get an up-to-date version. |
283 |
|
284 |
This is needed only for packaging, the end-users will not need to have |
285 |
to upgrade to use SpamAssassin. |
286 |
*********************************************************************** |
287 |
|
288 |
DESTDIRBUG |
289 |
warn $_; |
290 |
} |
291 |
|
292 |
|
293 |
if(!$mm_has_pm_filter) { |
294 |
($_=<<" ITSALLSOSTUPID") =~ s/^ {4}//gm; |
295 |
|
296 |
*********************************************************************** |
297 |
Your version of ExtUtils::MakeMaker does not support PM_FILTER. |
298 |
We need to include a nasty workaround to make it work with our make |
299 |
routines. You will get loads of warnings and it is very likely to break |
300 |
at various places. |
301 |
|
302 |
*Please* consider updating to a version later than 5.45. Its available |
303 |
on CPAN <http://search.cpan.org/search?module=ExtUtils::MakeMaker>. |
304 |
|
305 |
Hint: Perl 5.6.1 and later ship good versions of ExtUtils::MakeMaker |
306 |
by default. |
307 |
|
308 |
If anything breaks while building Mail::SpamAssassin, please file a bug |
309 |
at <http://bugzilla.spamassassin.org>. |
310 |
*********************************************************************** |
311 |
|
312 |
ITSALLSOSTUPID |
313 |
warn $_; |
177 |
|
314 |
|
178 |
$makefile{SKIP} = [ 'pm_to_blib' ]; |
315 |
$makefile{SKIP} = [ 'pm_to_blib' ]; |
179 |
$makefile{macro}{PM_FILTER} = $makefile{PM_FILTER}; |
316 |
$makefile{macro}{PM_FILTER} = $makefile{PM_FILTER}; |
180 |
delete $makefile{PM_FILTER}; |
317 |
delete $makefile{PM_FILTER}; |
181 |
} |
318 |
} |
182 |
|
319 |
|
|
|
320 |
|
183 |
# All the $(*MAN1*) stuff is empty/zero if Perl was Configured with -Dman1dir=none |
321 |
# All the $(*MAN1*) stuff is empty/zero if Perl was Configured with -Dman1dir=none |
184 |
unless($Config{installman1dir}) { |
322 |
unless($Config{installman1dir}) { |
185 |
delete $makefile{MAN1PODS}; |
323 |
delete $makefile{MAN1PODS}; |
186 |
} |
324 |
} |
187 |
|
325 |
|
188 |
####################################################################### |
|
|
189 |
|
190 |
# what a PITA. we can't get at MakeMaker's parsed args. do it ourselves, |
191 |
# again.... |
192 |
|
193 |
my $contactaddr; |
194 |
my $runrazor; |
195 |
|
326 |
|
196 |
for my $arg (@ARGV) { |
327 |
$makefile{'macro'}{'ENABLE_SSL'} = yesno($opt{'enable_ssl'}); |
197 |
if ($arg =~ /^CONTACT_ADDRESS=(.*)/) { |
|
|
198 |
$contactaddr = $1; |
199 |
} |
200 |
elsif ($arg =~ /^RUN_RAZOR2?_TESTS?=(.)/) { |
201 |
$runrazor = $1; |
202 |
} |
203 |
} |
204 |
|
328 |
|
205 |
if (!defined $contactaddr) { |
329 |
if (!defined $opt{'contact_address'}) { |
206 |
$contactaddr = prompt( |
330 |
$opt{'contact_address'} = prompt( |
207 |
"What email address or URL should be used in the suspected-spam report\n". |
331 |
"What email address or URL should be used in the suspected-spam report\n". |
208 |
"text for users who want more information on your filter installation?\n". |
332 |
"text for users who want more information on your filter installation?\n". |
209 |
"(In particular, ISPs should change this to a local Postmaster contact)\n". |
333 |
"(In particular, ISPs should change this to a local Postmaster contact)\n". |
Lines 211-368
if (!defined $contactaddr) {
Link Here
|
211 |
); |
335 |
); |
212 |
print "\n"; |
336 |
print "\n"; |
213 |
} |
337 |
} |
|
|
338 |
$makefile{'macro'}{'CONTACT_ADDRESS'} = $opt{'contact_address'}; |
214 |
|
339 |
|
215 |
if (!defined $runrazor) { |
340 |
if (!defined $opt{'run_razor_tests'}) { |
216 |
$runrazor = eval { require Razor2::Client::Agent }; |
341 |
my $got_razor2 = eval { require Razor2::Client::Agent }; |
217 |
|
342 |
|
218 |
if ($runrazor) { |
343 |
if ($got_razor2) { |
219 |
$runrazor = prompt( |
344 |
$opt{'run_razor_tests'} = prompt( |
220 |
"Run Razor v2 tests (these may fail due to network problems)? (y/n)", |
345 |
"Run Razor v2 tests (these may fail due to network problems)? (y/n)", |
221 |
'n' |
346 |
'n' |
222 |
); |
347 |
); |
223 |
print "\n"; |
348 |
print "\n"; |
224 |
} |
349 |
} |
225 |
} |
350 |
} |
226 |
$runrazor = substr($runrazor, 0, 1); |
351 |
$opt{'run_razor_tests'} = bool($opt{'run_razor_tests'}); |
227 |
$runrazor =~ tr/y1/0/c; |
352 |
if ($opt{'run_razor_tests'}) { |
228 |
if ($runrazor) { |
|
|
229 |
open(FLAG, "> t/do_razor2"); |
353 |
open(FLAG, "> t/do_razor2"); |
230 |
close(FLAG); |
354 |
close(FLAG); |
231 |
} |
355 |
} |
232 |
else { |
356 |
else { |
233 |
unlink("t/do_razor2"); |
357 |
unlink("t/do_razor2"); |
234 |
} |
358 |
} |
|
|
359 |
$makefile{'macro'}{'TEST_RUN_RAZOR'} = yesno($opt{'run_razor_tests'}); |
360 |
|
235 |
|
361 |
|
236 |
# Now dump the Makefile |
362 |
# Now dump the Makefile |
237 |
WriteMakefile(%makefile); |
363 |
WriteMakefile(%makefile); |
|
|
364 |
print "Makefile written by ExtUtils::MakeMaker ${mm_version}\n"; |
238 |
|
365 |
|
239 |
####################################################################### |
366 |
####################################################################### |
240 |
|
367 |
|
241 |
package MY; |
368 |
package MY; |
242 |
|
369 |
|
|
|
370 |
|
371 |
use vars qw( |
372 |
$MY_GLOBALS_ARE_SANE |
373 |
|
374 |
@REPOSITORIES |
375 |
|
376 |
$MACRO_RE |
377 |
$EQ_RE |
378 |
$EQ |
379 |
|
380 |
$SELF |
381 |
); |
382 |
|
383 |
# For some reason initializing the vars on the global scope doesn't work; |
384 |
# guess its some weird Perl behaviour in combination with bless(). |
385 |
sub init_MY_globals { |
386 |
my $self = shift; |
387 |
|
388 |
# Keep a reference to ourselves so we don't have to feed it to the helper |
389 |
# scripts. |
390 |
$SELF = $self; |
391 |
|
392 |
return if $MY_GLOBALS_ARE_SANE; |
393 |
$MY_GLOBALS_ARE_SANE = 1; |
394 |
|
395 |
# (Current) EU::MMs make a difference between these three possible general |
396 |
# install destinations. See also |
397 |
# <http://archive.develooper.com/perl5-porters@perl.org/msg94113.html> |
398 |
# <https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=78053> |
399 |
# <http://www.mail-archive.com/makemaker@perl.org/msg00779.html> |
400 |
# <http://www.debian.org/doc/packaging-manuals/perl-policy/ch-module_packages.html#s-vendor_dirs> |
401 |
@REPOSITORIES = qw( |
402 |
PERL |
403 |
SITE |
404 |
VENDOR |
405 |
); |
406 |
|
407 |
# Macro names follow this RE -- at least stricly enough for our purposes. |
408 |
$MACRO_RE = qr/[A-Z0-9_]+/; |
409 |
# Normally macros are assigned via FOO = bar. But the part with the equal |
410 |
# sign might differ from platform to platform. So we use this RE: |
411 |
$EQ_RE = qr/\s*:?=\s*/; |
412 |
# To assign or own macros we'll follow the first assignment string we find; |
413 |
# normally " = ". |
414 |
$EQ = undef; |
415 |
} |
416 |
|
417 |
# Unset $SELF to avoid any leaking memory. |
418 |
sub clean_MY_globals { |
419 |
my $self = shift; |
420 |
|
421 |
$SELF = undef; |
422 |
} |
423 |
|
424 |
sub set_EQ_from_line { |
425 |
my($line) = (@_); |
426 |
|
427 |
return if defined($EQ); |
428 |
|
429 |
$line =~ /\S(${EQ_RE})/; |
430 |
$EQ = $1; |
431 |
} |
432 |
|
433 |
|
434 |
# Converts a version represented as a float to a real three-part version, |
435 |
# eg.: |
436 |
# 5.006001 -> 5.6.1 |
437 |
# 5.005_03 -> 5.5.30 |
438 |
# |
439 |
# The first parameter should be a version, in what format ever. |
440 |
sub float_to_version { |
441 |
my($ver) = (@_); |
442 |
|
443 |
if ($ver =~ /^\d\.\d+$/) { |
444 |
$ver = sprintf("%1.6f", $ver); |
445 |
$ver =~ s/[.0]+([1-9]+)/.$1/g; |
446 |
} |
447 |
|
448 |
return $ver; |
449 |
} |
450 |
|
451 |
|
452 |
# Generates a Makefile-reference to another macro; something like $(FOO). |
453 |
# |
454 |
# The first and only parameter should be the name of the referred macro, |
455 |
# eg. 'FOO' (will return '$(FOO)'). |
456 |
sub macro_ref { |
457 |
my($name) = (@_); |
458 |
|
459 |
return sprintf('$(%s)', $name); |
460 |
} |
461 |
|
462 |
# Generates a line which defines a Makefile macro. Something like FOO = bar. |
463 |
# The line is *not* followed by a newline! |
464 |
# |
465 |
# The first parameter must be the name of the macro. The second is optional. |
466 |
# If it is omitted, the value set in the current EU::MM instance is used. |
467 |
sub macro_def { |
468 |
my($name, $val) = (@_, undef); |
469 |
$val = $SELF->{$name} unless defined $val; |
470 |
die unless defined $EQ; |
471 |
|
472 |
return $name . $EQ . $val; |
473 |
} |
474 |
|
475 |
# Returns true if the given line defines a macro. |
476 |
# |
477 |
# The first parameter must be the line to inspect. With the second optional |
478 |
# parameter the name of a specific macro might be given. If its omitted, any |
479 |
# macro matching the MACRO_RE pattern will fit. |
480 |
sub line_has_macro_def { |
481 |
my($line, $name) = (@_, undef); |
482 |
$name = $MACRO_RE unless defined $name; |
483 |
|
484 |
return $line =~ /^($name)${EQ_RE}/; |
485 |
} |
486 |
|
487 |
# Reads the name of the macro defined on the given line. |
488 |
# |
489 |
# The first parameter must be the line to be expected. If the line doesn't |
490 |
# contain a macro definition, weird things may happen. So check with |
491 |
# line_has_macro_def() before! |
492 |
sub get_macro_name_from_line { |
493 |
my($line) = (@_); |
494 |
|
495 |
$line =~ /^(${MACRO_RE})${EQ_RE}/; |
496 |
return $1; |
497 |
} |
498 |
|
499 |
# Reads the value of the given macro from the current instance of EU::MM. |
500 |
# |
501 |
# The first parameter must be the name of a macro. |
502 |
sub get_macro { |
503 |
my($name) = (@_); |
504 |
|
505 |
return $SELF->{$name}; |
506 |
} |
507 |
|
508 |
# Reads the value of the given macro from the current instance of EU::MM and |
509 |
# expands all contained macros. So reading BAZ with these declarations |
510 |
# FOO = blah |
511 |
# BAR = $(FOO) |
512 |
# BAZ = $(BAR) |
513 |
# gives 'blah'. |
514 |
# |
515 |
# The first parameter must be the name of a macro. |
516 |
sub get_expanded_macro { |
517 |
my($name) = (@_); |
518 |
|
519 |
my($val); |
520 |
$val = get_macro($name); |
521 |
# Now expand all macros... |
522 |
while ($val =~ s/\Q$(\E(${MACRO_RE})\Q)\E/$SELF->{$1} || ''/ge) {}; |
523 |
|
524 |
return $val; |
525 |
} |
526 |
|
527 |
# Sets the value of the macro with the given name to the given value in the |
528 |
# current instance of EU::MM. Just sets, doesn't write to the Makefile! |
529 |
# |
530 |
# The first parameter must be the macro's name, the second the value. |
531 |
sub set_macro { |
532 |
my($name, $val) = (@_); |
533 |
|
534 |
$SELF->{$name} = $val; |
535 |
} |
536 |
|
537 |
|
538 |
# Returns the actual "repository" name used in macro names; the point is that |
539 |
# EU::MM leaves out the name if the repository is 'PERL'. But only for macros |
540 |
# which don't start with the repository name (like the INSTALL* ones). So the |
541 |
# following mapping should be made: |
542 |
# PERLPREFIX -> PERLPREFIX |
543 |
# PERLSYSCONFDIR -> PERLSYSCONFDIR |
544 |
# INSTALLSITECONF -> INSTALLSITECONF |
545 |
# INSTALLPERLCONF -> INSTALLCONF |
546 |
# Actually, its a bit more complex than that but we follow that simple mapping |
547 |
# for our vars; one also has to know when to call this function and when not. |
548 |
sub repository { |
549 |
my($repository) = (@_); |
550 |
|
551 |
return '' if $repository eq 'PERL'; |
552 |
return $repository; |
553 |
} |
554 |
|
555 |
|
556 |
# This routine determines the correct SYSCONFDIR to use for the given |
557 |
# repository. |
558 |
# |
559 |
# The first parameter must be one value from @REPOSITORIES. |
560 |
# |
561 |
# *SYSCONFDIR can be overwritten with: |
562 |
# *SYSCONFDIR |
563 |
# SYSCONFDIR |
564 |
# If none of those is specified, it will chose an FHS-compliant dir |
565 |
# based on the corresponding *PREFIX: |
566 |
# *PREFIX *SYSCONFDIR |
567 |
# /usr /etc |
568 |
# /usr/local /etc |
569 |
# /opt/* /etc/opt |
570 |
# /foo/* /foo/*/etc |
571 |
sub _set_macro_SYSCONFDIR { |
572 |
my($repository) = (@_); |
573 |
|
574 |
my($macro); |
575 |
$macro = $repository . "SYSCONFDIR"; |
576 |
|
577 |
# Is this macro already set? |
578 |
return if get_macro($macro); |
579 |
|
580 |
# Is this macro supposed to be overwritten? |
581 |
if (get_macro('SYSCONFDIR')) { |
582 |
set_macro($macro, macro_ref('SYSCONFDIR')); |
583 |
return; |
584 |
} |
585 |
|
586 |
my($rprefix); |
587 |
$rprefix = get_expanded_macro("${repository}PREFIX"); |
588 |
|
589 |
# Set the default, depending on the corresponding full PREFIX |
590 |
set_macro($macro, |
591 |
($rprefix =~ m{^$}) ? '' : |
592 |
($rprefix =~ m{^/usr(/local)?/?$}) ? '/etc' : |
593 |
($rprefix =~ m{^/opt(/|$)}) ? '/etc/opt' : |
594 |
macro_ref("${repository}PREFIX") . '/etc' |
595 |
); |
596 |
} |
597 |
|
598 |
# This routine determines the correct INSTALLDATADIR (aka DEFRULESDIR) |
599 |
# to use for the given repository. |
600 |
# |
601 |
# The first parameter must be one value from @REPOSITORIES. |
602 |
# |
603 |
# INSTALL*DATADIR can be overwritten with: |
604 |
# INSTALL*DATADIR |
605 |
# DATADIR |
606 |
# DEFRULESDIR |
607 |
# If none of those is specified, it will chose an FHS-compliant dir, |
608 |
# namely *PREFIX/share/spamassassin. |
609 |
sub _set_macro_DATADIR { |
610 |
my($repository) = (@_); |
611 |
|
612 |
my($macro); |
613 |
$macro = "INSTALL" . repository($repository) . "DATA"; |
614 |
|
615 |
# Is this macro already set? |
616 |
return if get_macro($macro); |
617 |
|
618 |
# Is this macro supposed to be overwritten? |
619 |
foreach my $omacro (qw(DATADIR DEFRULESDIR)) { |
620 |
if (get_macro($omacro)) { |
621 |
set_macro($macro, get_macro($omacro)); |
622 |
return; |
623 |
} |
624 |
} |
625 |
|
626 |
# Set the default value based on the corresponding PREFIX |
627 |
set_macro($macro, |
628 |
macro_ref("${repository}PREFIX") . '/share/spamassassin' |
629 |
); |
630 |
} |
631 |
|
632 |
# This routine determines the correct INSTALLCONFDIR (aka LOCALRULESDIR) |
633 |
# to use for the given repository. |
634 |
# |
635 |
# The first parameter must be one value from @REPOSITORIES. |
636 |
# |
637 |
# INSTALL*CONFDIR can be overwritten with: |
638 |
# INSTALL*CONFDIR |
639 |
# CONFDIR |
640 |
# LOCALRULESDIR |
641 |
# If none of those is specified, it will chose an FHS-compliant dir, |
642 |
# namely *SYSCONFDIR/mail/spamassassin. |
643 |
sub _set_macro_CONFDIR { |
644 |
my($repository) = (@_); |
645 |
|
646 |
my($macro); |
647 |
$macro = "INSTALL" . repository($repository) . "CONF"; |
648 |
|
649 |
# Is this macro already set? |
650 |
return if get_macro($macro); |
651 |
|
652 |
# Is this macro supposed to be overwritten? |
653 |
foreach my $omacro (qw(CONFDIR LOCALRULESDIR)) { |
654 |
if (get_macro($omacro)) { |
655 |
set_macro($macro, get_macro($omacro)); |
656 |
return; |
657 |
} |
658 |
} |
659 |
|
660 |
# Set the default value based on the corresponding SYSCONFDIR |
661 |
set_macro($macro, |
662 |
macro_ref("${repository}SYSCONFDIR") . '/mail/spamassassin' |
663 |
); |
664 |
} |
665 |
|
666 |
# This routine determines the correct value for PERL_BIN. |
667 |
# |
668 |
# There are no parameters. |
669 |
# |
670 |
# If PERL_BIN wasn't set at the command line, it will fall back to |
671 |
# $(FULLPERL) which should refer to the current Perl interpreter. |
672 |
sub _set_macro_PERL_BIN { |
673 |
|
674 |
return if get_macro('PERL_BIN'); |
675 |
set_macro('PERL_BIN', macro_ref('FULLPERL')); |
676 |
} |
677 |
|
678 |
# This routine determines the value of the app given in PERL_BIN. |
679 |
# |
680 |
# There are no parameters. |
681 |
# |
682 |
# If PERL_VERSION wasn't set at the command line, it will try to call |
683 |
# the app given in PERL_BIN and ask it for its version. If that doesn't |
684 |
# work for some reason, it will use the version of the current Perl |
685 |
# interpreter. |
686 |
sub _set_macro_PERL_VERSION { |
687 |
|
688 |
return if get_macro('PERL_VERSION'); |
689 |
|
690 |
my($perl, $ver); |
691 |
|
692 |
# |
693 |
$perl = get_expanded_macro('PERL_BIN'); |
694 |
if (-x $perl) { |
695 |
$ver = qx{$perl -V:version}; |
696 |
$ver =~ s/^version='([0-9.]+).*$/$1/s; |
697 |
} |
698 |
|
699 |
$ver = $] unless $ver; |
700 |
|
701 |
set_macro('PERL_VERSION', float_to_version($ver)); |
702 |
} |
703 |
|
704 |
# This is a helper routine for PERL_WARN and PERL_TAINT. |
705 |
# |
706 |
# The first parameter must be either 'WARN' or 'TAINT'. |
707 |
sub _set_macro_PERL_yesno { |
708 |
my($macro) = (@_); |
709 |
|
710 |
my($val); |
711 |
$macro = 'PERL_' . $macro; |
712 |
$val = ""; |
713 |
if (get_macro($macro)) { |
714 |
$val = yesno(get_macro($macro)); |
715 |
} |
716 |
|
717 |
set_macro($macro, $val); |
718 |
} |
719 |
|
720 |
# This routine sets the value for PERL_WARN. |
721 |
# |
722 |
# There are no parameters. |
723 |
# |
724 |
# If PERL_WARN wasn't set at the command line, PERL_WARN will be left |
725 |
# empty (ie: the default is used). If it was set, the value is fed to |
726 |
# yesno(). |
727 |
sub _set_macro_PERL_WARN { |
728 |
_set_macro_PERL_yesno('WARN'); |
729 |
} |
730 |
|
731 |
# This routine sets the value for PERL_TAINT. |
732 |
# |
733 |
# There are no parameters. |
734 |
# |
735 |
# If PERL_TAINT wasn't set at the command line, PERL_TAINT will be left |
736 |
# empty (ie: the default is used). If it was set, the value is fed to |
737 |
# yesno(). |
738 |
sub _set_macro_PERL_TAINT { |
739 |
_set_macro_PERL_yesno('TAINT'); |
740 |
} |
741 |
|
742 |
|
743 |
# Override the libscan routine so it skips CVS stuff and some common |
744 |
# patch/backup extensions. |
243 |
sub MY::libscan { |
745 |
sub MY::libscan { |
244 |
my($self,$path) = @_; |
746 |
my $self = shift; |
|
|
747 |
my($path) = @_; |
748 |
init_MY_globals($self); |
245 |
|
749 |
|
246 |
return '' if ($path =~ /windows_install/ || $path =~ /\.(orig|diff|patch|bak|backup|my)$/i); |
750 |
return q{} if $path =~ m{ |
247 |
return $path; |
751 |
windows_install| |
|
|
752 |
(^|/)CVS(/|$)| |
753 |
[/.](orig|old|rej|diff|patch|bak|backup|my)$ |
754 |
}ix; |
755 |
|
756 |
clean_MY_globals($self); |
757 |
return $path; #/ |
248 |
} |
758 |
} |
249 |
|
759 |
|
|
|
760 |
# Override the install routine to add our additional install dirs and |
761 |
# hack DESTDIR support into old EU::MMs. |
250 |
sub MY::install { |
762 |
sub MY::install { |
251 |
my $self = shift; |
763 |
my $self = shift; |
252 |
my $inherited = $self->SUPER::install (@_); |
764 |
my @code = split(/\n/, $self->SUPER::install(@_)); |
|
|
765 |
init_MY_globals($self); |
253 |
|
766 |
|
254 |
$inherited =~ s/^(install :: .*)$/$1 inst_cfs/gm; |
767 |
foreach (@code) { |
255 |
$inherited; |
768 |
# Add our install targets as a dependency to all top-level install targets |
|
|
769 |
s/^(install(?:_[a-z]+)?\s*::?\s*.*)$/$1 conf__install data__install/; |
770 |
|
771 |
# Now do the DESTDIR hack, if necessary. |
772 |
next if !$mm_needs_destdir; |
773 |
# Write the correct path to perllocal.pod |
774 |
next if /installed into/; |
775 |
|
776 |
# Replace all other $(INSTALL*) vars (except $(INSTALLDIRS) of course) |
777 |
# with their $(DESTINSTALL*) counterparts |
778 |
s/\Q$(\E(INSTALL[^D][^I][^R][^S][A-Z]+)\Q)\E/\$(DEST$1)/g; |
779 |
} |
780 |
|
781 |
clean_MY_globals($self); |
782 |
return join("\n", @code); |
256 |
} |
783 |
} |
257 |
|
784 |
|
258 |
sub MY::postamble { |
|
|
259 |
# import some C-linkage stuff from %Config. We can't seem to |
260 |
# do this with MakeMaker without it trying to build the perl |
261 |
# modules as .so's :( |
262 |
|
785 |
|
|
|
786 |
|
787 |
|
788 |
# Now override the constants routine to add our own macros. |
789 |
sub MY::constants { |
263 |
my $self = shift; |
790 |
my $self = shift; |
|
|
791 |
my @code = split(/\n/, $self->SUPER::constants(@_)); |
792 |
init_MY_globals($self); |
264 |
|
793 |
|
265 |
my $prefix = $self->{PREFIX} |
794 |
foreach my $line (@code) { |
266 |
|| ''; |
795 |
# Skip comments |
267 |
my $instprefix = $self->{INST_PREFIX} |
796 |
next if $line =~ /^\s*#/; |
268 |
|| $prefix; |
797 |
# Skip everything which isn't a var assignment. |
|
|
798 |
next unless line_has_macro_def($line); |
269 |
|
799 |
|
270 |
my $is_sys_build = ($prefix =~ m{^(/usr/?)?$}); |
800 |
# Store the assignment string if necessary. |
271 |
my $is_sys_inst = ($instprefix =~ m{^(/usr/?)?$}); |
801 |
set_EQ_from_line($line); |
272 |
|
802 |
|
273 |
my $sysconfdir = $self->{SYSCONFDIR} |
803 |
# Add some "dummy" (PERL|SITE|VENDOR)PREFIX macros for later use (only if |
274 |
|| ''; |
804 |
# necessary for old EU::MMs of course) |
275 |
my $instsysconfdir = $self->{INST_SYSCONFDIR} |
805 |
if (line_has_macro_def($line, 'PREFIX')) { |
276 |
|| $sysconfdir |
806 |
foreach my $r (@REPOSITORIES) { |
277 |
|| ($is_sys_inst ? '' : '$(INST_PREFIX)') . '/etc'; |
807 |
my $rprefix = "${r}PREFIX"; |
278 |
$sysconfdir ||= ($is_sys_build ? '' : '$(PREFIX)') . '/etc'; |
|
|
279 |
|
808 |
|
280 |
my $pkgdefrulesdir = $self->{PKG_DEF_RULES_DIR} |
809 |
if (!defined(get_macro($rprefix))) { |
281 |
|| $self->{DEF_RULES_DIR} |
810 |
set_macro($rprefix, macro_ref('PREFIX')); |
282 |
|| '$(PREFIX)/share/spamassassin'; |
811 |
$line .= "\n" . macro_def($rprefix); |
283 |
my $defrulesdir = $self->{DEF_RULES_DIR} |
812 |
} |
284 |
|| '$(INST_PREFIX)/share/spamassassin'; |
813 |
} |
285 |
my $pkglocalrulesdir = $self->{PKG_LOCAL_RULES_DIR} |
814 |
} |
286 |
|| $self->{LOCAL_RULES_DIR} |
|
|
287 |
|| '$(SYSCONFDIR)/mail/spamassassin'; |
288 |
my $localrulesdir = $self->{LOCAL_RULES_DIR} |
289 |
|| '$(INST_SYSCONFDIR)/mail/spamassassin'; |
290 |
my $instsitelib = $self->{INST_SITELIB} |
291 |
|| '$(INSTALLSITELIB)'; |
292 |
|
815 |
|
293 |
my $enablessl = $self->{ENABLE_SSL} |
816 |
# Add DESTDIR support if necessary |
294 |
|| 'no'; |
817 |
if ($mm_needs_destdir) { |
|
|
818 |
if (line_has_macro_def($line, 'INSTALLDIRS')) { |
819 |
$line .= "\n" . macro_def('DESTDIR'); |
820 |
} |
821 |
elsif (line_has_macro_def($_, qr/INSTALL[A-Z]+/)) { |
822 |
my $macro = get_macro_name_from_line($line); |
823 |
$line .= "\n" . macro_def('DEST' . $macro, |
824 |
macro_ref('DESTDIR') . macro_ref($macro)); |
825 |
} |
826 |
} |
827 |
} |
295 |
|
828 |
|
296 |
my $perl_bin = $self->{PERL_BIN} |
829 |
# Add some additional target dirs |
297 |
|| 'this'; |
830 |
{ |
298 |
my $perl_warn = $self->{PERL_WARN} |
831 |
set_macro('SYSCONFDIR', "") unless get_macro('SYSCONFDIR'); |
299 |
|| 'auto'; |
|
|
300 |
my $perl_taint = $self->{PERL_TAINT} |
301 |
|| 'auto'; |
302 |
my $perl_version = $self->{PERL_VERSION} |
303 |
|| 'this'; |
304 |
|
832 |
|
|
|
833 |
# Determine the correct settings for each repository... |
834 |
foreach my $r (@REPOSITORIES) { |
835 |
_set_macro_SYSCONFDIR($r); |
836 |
_set_macro_DATADIR($r); |
837 |
_set_macro_CONFDIR($r); |
838 |
} |
305 |
|
839 |
|
306 |
my $gotpods = keys(%{$self->{MAN1PODS}}) |
840 |
# ... and add it to the Makefile. |
307 |
|| keys(%{$self->{MAN3PODS}}) |
841 |
push(@code, qq{}); |
308 |
|| keys(%{$self->{EXTRAPODS}}) |
842 |
push(@code, macro_def('SYSCONFDIR')); |
309 |
|| 0; |
843 |
foreach my $r (@REPOSITORIES) { |
|
|
844 |
push(@code, macro_def($r . 'SYSCONFDIR')); |
845 |
} |
310 |
|
846 |
|
311 |
qq( |
847 |
foreach my $m (qw(DATA CONF)) { |
312 |
#PREFIX = $prefix # just for reference |
848 |
foreach my $r (@REPOSITORIES) { |
313 |
INST_PREFIX = $instprefix |
849 |
my $macro = 'INSTALL' . repository($r) . $m; |
314 |
SYSCONFDIR = $sysconfdir |
850 |
# The INSTALL* macros. |
315 |
INST_SYSCONFDIR = $instsysconfdir |
851 |
push(@code, macro_def($macro)); |
316 |
PKG_DEF_RULES_DIR = $pkgdefrulesdir |
852 |
# The DESTINSTALL* macros. |
317 |
DEF_RULES_DIR = $defrulesdir |
853 |
push(@code, macro_def('DEST' . $macro, |
318 |
PKG_LOCAL_RULES_DIR = $pkglocalrulesdir |
854 |
macro_ref('DESTDIR') . macro_ref($macro))) |
319 |
LOCAL_RULES_DIR = $localrulesdir |
855 |
if $mm_has_destdir; |
320 |
INST_SITELIB = $instsitelib |
856 |
} |
321 |
ENABLE_SSL = $enablessl |
857 |
} |
322 |
CONTACT_ADDRESS = $contactaddr |
858 |
} |
323 |
|
859 |
|
324 |
PERL_BIN = $perl_bin |
860 |
# Set the PERL_* stuff |
325 |
PERL_WARN = $perl_warn |
861 |
{ |
326 |
PERL_TAINT = $perl_taint |
862 |
_set_macro_PERL_BIN; |
327 |
PERL_VERSION = $perl_version |
863 |
_set_macro_PERL_VERSION; |
|
|
864 |
_set_macro_PERL_WARN; |
865 |
_set_macro_PERL_TAINT; |
328 |
|
866 |
|
329 |
) . q# |
867 |
# Add it to the Makefile. |
|
|
868 |
push(@code, qq{}); |
869 |
foreach my $m (qw(BIN VERSION WARN TAINT)) { |
870 |
push(@code, macro_def('PERL_' . $m)); |
871 |
} |
872 |
} |
873 |
|
874 |
clean_MY_globals($self); |
875 |
return join("\n", @code); |
876 |
} |
877 |
|
878 |
sub MY::postamble { |
879 |
my $self = shift; |
880 |
my @code = (); |
881 |
init_MY_globals($self); |
882 |
|
883 |
my($repository); |
884 |
$repository = uc($SELF->{INSTALLDIRS}) || 'SITE'; |
885 |
|
886 |
foreach my $macro (qw(PREFIX SYSCONFDIR)) { |
887 |
push(@code, macro_def('I_' . $macro, |
888 |
macro_ref($repository . $macro))); |
889 |
} |
890 |
foreach my $macro (qw(DATA CONF LIB)) { |
891 |
push(@code, macro_def('I_' . $macro . 'DIR', |
892 |
macro_ref('INSTALL' . repository($repository) . $macro))); |
893 |
|
894 |
if ($mm_has_destdir) { |
895 |
push(@code, macro_def('B_' . $macro . 'DIR', |
896 |
macro_ref('DESTINSTALL' . repository($repository) . $macro))); |
897 |
} else { |
898 |
push(@code, macro_def('B_' . $macro . 'DIR', |
899 |
macro_ref('I_' . $macro . 'DIR'))); |
900 |
} |
901 |
} |
902 |
|
903 |
my $code = join("\n", @code); |
904 |
@code = (); # free mem |
905 |
|
906 |
$code .= <<' EOD'; |
907 |
|
908 |
PREPROCESS = $(PERL) build/preprocessor |
330 |
|
909 |
|
331 |
FIXVARS = -Mvars \ |
910 |
FIXVARS = -Mvars \ |
332 |
-DVERSION="$(VERSION)" \ |
911 |
-DVERSION="$(VERSION)" \ |
333 |
-DPREFIX="$(INST_PREFIX)" \ |
912 |
-DPREFIX="$(I_PREFIX)" \ |
334 |
-DDEF_RULES_DIR="$(DEF_RULES_DIR)" \ |
913 |
-DDEF_RULES_DIR="$(I_DATADIR)" \ |
335 |
-DLOCAL_RULES_DIR="$(LOCAL_RULES_DIR)" \ |
914 |
-DLOCAL_RULES_DIR="$(I_CONFDIR)" \ |
336 |
-DINSTALLSITELIB="$(INST_SITELIB)" \ |
915 |
-DINSTALLSITELIB="$(I_LIBDIR)" \ |
337 |
-DCONTACT_ADDRESS="$(CONTACT_ADDRESS)" |
916 |
-DCONTACT_ADDRESS="$(CONTACT_ADDRESS)" |
338 |
|
917 |
|
339 |
FIXBYTES = -Mbytes \ |
918 |
FIXBYTES = -Mbytes \ |
340 |
-DPERL_VERSION="$(PERL_VERSION)" |
919 |
-DPERL_VERSION="$(PERL_VERSION)" |
341 |
|
920 |
|
342 |
FIXBANG = -Msharpbang \ |
921 |
FIXBANG = -Msharpbang \ |
343 |
-DPERL_BIN="$(PERL_BIN)" \ |
922 |
-DPERL_BIN="$(PERL_BIN)" \ |
344 |
-DPERL_WARN="$(PERL_WARN)" |
923 |
-DPERL_WARN="$(PERL_WARN)" |
345 |
|
924 |
|
346 |
SPAMC_SOURCES = spamd/spamc.c qmail/qmail-spamc.c spamd/libspamc.c spamd/utils.c |
925 |
SPAMC_SOURCES = spamd/spamc.c spamd/libspamc.c spamd/utils.c qmail/qmail-spamc.c |
347 |
|
926 |
|
348 |
# . (!$pm_filter ? q# |
927 |
EOD |
|
|
928 |
|
929 |
if (!$mm_has_pm_filter) { |
930 |
$code .= <<' EOD'; |
349 |
pm_to_blib: $(TO_INST_PM) |
931 |
pm_to_blib: $(TO_INST_PM) |
350 |
@ $(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" \ |
932 |
@ $(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" \ |
351 |
"-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -Ibuild \ |
933 |
"-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -Ibuild \ |
352 |
-MExtUtils::Install -Mpreprocessor \ |
934 |
-MExtUtils::Install -Mpreprocessor \ |
353 |
-e "ExtUtils::Install::Post545::pm_to_blib({qw{$(PM_TO_BLIB)}}, '$(INST_LIB)/auto', '$(PM_FILTER)')"# : '') . q# |
935 |
-e "ExtUtils::Install::Post545::pm_to_blib({qw{$(PM_TO_BLIB)}}, '$(INST_LIB)/auto', '$(PM_FILTER)')" |
|
|
936 |
EOD |
937 |
} |
938 |
|
939 |
$code .= <<' EOD'; |
354 |
|
940 |
|
355 |
spamassassin: spamassassin.raw |
941 |
spamassassin: spamassassin.raw |
356 |
$(PERL) build/preprocessor $(FIXBYTES) $(FIXVARS) $(FIXBANG) -i$? -o$@ |
942 |
$(PREPROCESS) $(FIXBYTES) $(FIXVARS) $(FIXBANG) -m$(PERM_RWX) -i$? -o$@ |
357 |
$(CHMOD) $(PERM_RWX) $@ |
|
|
358 |
|
943 |
|
359 |
sa-learn: sa-learn.raw |
944 |
sa-learn: sa-learn.raw |
360 |
$(PERL) build/preprocessor $(FIXBYTES) $(FIXVARS) $(FIXBANG) -i$? -o$@ |
945 |
$(PREPROCESS) $(FIXBYTES) $(FIXVARS) $(FIXBANG) -m$(PERM_RWX) -i$? -o$@ |
361 |
$(CHMOD) $(PERM_RWX) $@ |
|
|
362 |
|
946 |
|
363 |
spamd/spamd: spamd/spamd.raw |
947 |
spamd/spamd: spamd/spamd.raw |
364 |
$(PERL) build/preprocessor $(FIXBYTES) $(FIXVARS) $(FIXBANG) -i$? -o$@ |
948 |
$(PREPROCESS) $(FIXBYTES) $(FIXVARS) $(FIXBANG) -m$(PERM_RWX) -i$? -o$@ |
365 |
$(CHMOD) $(PERM_RWX) $@ |
|
|
366 |
|
949 |
|
367 |
spamd/libspamc.so: spamd/binaries.mk $(SPAMC_SOURCES) |
950 |
spamd/libspamc.so: spamd/binaries.mk $(SPAMC_SOURCES) |
368 |
$(MAKE) -f spamd/binaries.mk $@ |
951 |
$(MAKE) -f spamd/binaries.mk $@ |
Lines 383-397
qmail/qmail-spamc: spamd/binaries.mk $(S
Link Here
|
383 |
$(MAKE) -f spamd/binaries.mk $@ |
966 |
$(MAKE) -f spamd/binaries.mk $@ |
384 |
|
967 |
|
385 |
spamd/binaries.mk: spamd/configure |
968 |
spamd/binaries.mk: spamd/configure |
386 |
cd spamd; ./configure --enable-ssl=$(ENABLE_SSL) |
969 |
cd spamd; ./configure --prefix="$(I_PREFIX)" --sysconfdir="$(I_SYSCONFDIR)" --datadir="$(I_DATADIR)" --enable-ssl="$(ENABLE_SSL)" |
387 |
|
970 |
|
388 |
inst_cfs: |
971 |
conf__install: |
389 |
-$(MKPATH) $(PKG_LOCAL_RULES_DIR) |
972 |
-$(MKPATH) $(B_CONFDIR) |
390 |
$(PERL) -e "use File::Copy; (-f '$(PKG_LOCAL_RULES_DIR)/local.cf') or copy ('rules/local.cf', '$(PKG_LOCAL_RULES_DIR)/local.cf');" |
973 |
$(PERL) -MFile::Spec -MFile::Copy \ |
391 |
$(MKPATH) $(PKG_DEF_RULES_DIR) |
974 |
-e "copy(qw{rules/local.cf}, qw{$(B_CONFDIR)/local.cf}) unless -f qw{$(B_CONFDIR)/local.cf};" |
392 |
$(RM_RF) $(PKG_DEF_RULES_DIR)/* |
975 |
|
393 |
$(PERL) build/preprocessor $(FIXVARS) -m$(PERM_RW) -Irules -O$(PKG_DEF_RULES_DIR) $(RULES) |
976 |
data__install: |
394 |
$(CHMOD) $(PERM_RWX) $(PKG_DEF_RULES_DIR) |
977 |
-$(MKPATH) $(B_DATADIR) |
|
|
978 |
$(PERL) -e "map unlink, <$(B_DATADIR)/*>" |
979 |
$(PREPROCESS) $(FIXVARS) -m$(PERM_RW) -Irules -O$(B_DATADIR) $(RULES) |
980 |
$(CHMOD) $(PERM_RWX) $(B_DATADIR) |
395 |
|
981 |
|
396 |
text_html_doc: made-doc-stamp |
982 |
text_html_doc: made-doc-stamp |
397 |
$(NOOP) |
983 |
$(NOOP) |
Lines 399-410
text_html_doc: made-doc-stamp
Link Here
|
399 |
doc: |
985 |
doc: |
400 |
$(MKPATH) $@ |
986 |
$(MKPATH) $@ |
401 |
|
987 |
|
402 |
made-doc-stamp: doc#. ($gotpods ? q# $(MAN1PODS) $(MAN3PODS) $(EXTRAPODS) |
988 |
made-doc-stamp: doc $(MAN1PODS) $(MAN3PODS) $(EXTRAPODS) |
403 |
$(PERL) build/convert_pods_to_doc $(MAN1PODS) $(MAN3PODS) $(EXTRAPODS) |
989 |
$(PERL) build/convert_pods_to_doc $(MAN1PODS) $(MAN3PODS) $(EXTRAPODS) |
404 |
# : '') . q# |
|
|
405 |
$(TOUCH) made-doc-stamp |
990 |
$(TOUCH) made-doc-stamp |
406 |
$(RM_F) pod2htm* |
991 |
$(RM_F) pod2htm* |
|
|
992 |
EOD |
407 |
|
993 |
|
408 |
#; |
994 |
clean_MY_globals($self); |
409 |
|
995 |
return $code; |
410 |
} |
996 |
} |