Lines 1-50
Link Here
|
1 |
require 5.005; |
1 |
require 5.005; |
2 |
|
2 |
############################################################################## |
3 |
# RPM builders, or people building in their home dirs: |
3 |
# The following variables are recognized on the command line. They are useful |
4 |
# |
4 |
# for building packages (RPM, deb, ...) or installing SpamAssassin in a |
5 |
# VARIABLE DEFAULT |
5 |
# different location than the PREFIX Perl was built with. |
6 |
# ------------- ----------------- |
6 |
# |
7 |
# PREFIX * /usr |
7 |
# --- %YAML:1.0 |
8 |
# INST_PREFIX + $PREFIX |
8 |
# PREFIX: |
9 |
# SYSCONFDIR * /etc |
9 |
# description: > |
10 |
# or $(PREFIX)/etc if $(INST_PREFIX) is not "/usr" |
10 |
# Sets the prefix below which SpamAssassin is built. Please note the |
11 |
# INST_SYSCONFDIR + $SYSCONFDIR |
11 |
# exceptions for SYSCONFDIR. |
12 |
# or $(INST_PREFIX)/etc if $(INST_PREFIX) is not "/usr" |
12 |
# defaults: |
13 |
# PKG_DEF_RULES_DIR * $DEF_RULES_DIR or $(PREFIX)/share/spamassassin |
13 |
# - The prefix Perl was built with (call 'perl -V:prefix' to see the |
14 |
# DEF_RULES_DIR + $(INST_PREFIX)/share/spamassassin |
14 |
# value). Normally something like /usr or /usr/local. |
15 |
# PKG_LOCAL_RULES_DIR * $LOCAL_RULES_DIR |
15 |
# samples: |
16 |
# or $(SYSCONFDIR)/mail/spamassassin |
16 |
# - This will install the spamassassin apps in /foo/bin, the libs in |
17 |
# LOCAL_RULES_DIR + $(INST_SYSCONFDIR)/mail/spamassassin |
17 |
# /foo/lib/perl5, the shared stuff in /foo/share/spamassassin and make |
18 |
# INST_SITELIB + $(INSTALLSITELIB) |
18 |
# SpamAssassin look for config files in /foo/etc/mail/spamassassin: |
19 |
# |
19 |
# |
20 |
# RUN_RAZOR2_TESTS (prompt if Razor 2 found) |
20 |
# perl Makefile.PL PREFIX=/foo |
21 |
# CONTACT_ADDRESS (prompt: default="the administrator of that system") |
21 |
# |
22 |
# ENABLE_SSL * 'no' |
22 |
# scope: build-time |
23 |
# |
23 |
# INST_PREFIX: |
24 |
# PERL_BIN * current path to Perl |
24 |
# description: > |
25 |
# PERL_VERSION * current Perl version |
25 |
# Sets the prefix below which SpamAssassin is installed; useful for |
26 |
# PERL_WARN * 'yes' for CVS builds; else 'no' |
26 |
# creating packages or building chroot jails. 'make install' will put |
27 |
# |
27 |
# the files below PREFIX but the paths inside the apps will refer to |
28 |
# * means the variable is used for build time |
28 |
# INST_PREFIX. Please note the exceptions for INST_SYSCONFDIR. |
29 |
# + means the variable is used for run time |
29 |
# defaults: |
30 |
# |
30 |
# - The value of PREFIX. |
31 |
# For example, to install in your home dir: |
31 |
# samples: |
32 |
# |
32 |
# - The following installs the SpamAssassin stuff below /tmp/build/sa |
33 |
# perl Makefile.PL PREFIX=/home/jm/sausr SYSCONFDIR=/home/jm/saetc |
33 |
# but the apps will expect themselves to be in /usr when they're |
34 |
# |
34 |
# used (so the files have to be relocated later): |
35 |
# Or to build a package in /tmp/build, but with its internal paths |
35 |
# |
36 |
# referring to /usr and /etc: |
36 |
# perl Makefile.PL PREFIX=/tmp/build/sa INST_PREFIX=/usr |
37 |
# |
37 |
# |
38 |
# perl Makefile.PL PREFIX=/tmp/build/usr SYSCONFDIR=/tmp/build/etc \ |
38 |
# scope: run-time |
39 |
# INST_PREFIX=/usr INST_SYSCONFDIR=/etc |
39 |
# INST_SITELIB: |
40 |
# |
40 |
# description: > |
41 |
# The Razor prompt ("run Razor 2 tests?") can be overridden by setting |
41 |
# Sets the full path to where the SpamAssassin libs are put. |
42 |
# RUN_RAZOR2_TESTS to "y" or "n". |
42 |
# defaults: |
43 |
# |
43 |
# - Whatever Perl was compiled with. Call 'perl -V:sitelib' to see the |
44 |
# Set ENABLE_SSL to "yes" if you want the ability to use encrypted |
44 |
# exact value. Normally something like /usr/lib/perl5/site_perl/5.6.1. |
45 |
# connections between spamc and spamd. |
45 |
# samples: |
46 |
# |
46 |
# - Install SpamAssassin in /usr/local and force the libs to be put |
47 |
########################################################################### |
47 |
# there, too, even though Perl is installed in /usr (don't forget |
|
|
48 |
# to set PERL5LIB before you run spamassassin): |
49 |
# |
50 |
# perl Makefile.PL INST_PREFIX=/usr/local |
51 |
# INST_SITELIB=/usr/local/lib/perl5/site_perl/5.6.1 |
52 |
# |
53 |
# scope: run-time |
54 |
# SYSCONFDIR: |
55 |
# description: > |
56 |
# Sets the base dir for the config files (and where the sample local.cf |
57 |
# is created). See also LOCAL_RULES_DIR. |
58 |
# defaults: |
59 |
# - /etc if PREFIX is either /usr or /usr/local. |
60 |
# - /etc/opt if PREFIX starts with /opt |
61 |
# - PATH/etc if PREFIX is PATH/usr or PATH/usr/local. |
62 |
# - Else PREFIX/etc. |
63 |
# samples: |
64 |
# - This will (on Windows) install below 'C:\Program Files\SA' but look |
65 |
# for the config files in 'C:\Program Files\Shared Files\SA' |
66 |
# |
67 |
# perl Makefile.PL PREFIX="C:/Program Files/SA" |
68 |
# SYSCONFDIR="C:/Program Files/Shared Files/SA" |
69 |
# |
70 |
# - To put the apps and libs below ~/.sa-bin but the config below |
71 |
# ~/.sa-etc try the following: |
72 |
# |
73 |
# perl Makefile.PL PREFIX=$HOME/.sa-bin SYSCONFDIR=$HOME/.sa-etc |
74 |
# |
75 |
# - Or you may want to have the stuff in ~/usr and the config in ~/etc: |
76 |
# |
77 |
# perl Makefile.PL PREFIX=$HOME/usr |
78 |
# |
79 |
# - And the following installs SpamAssassin in /usr/local and forces the |
80 |
# config files to be below /usr/local, too: |
81 |
# |
82 |
# perl Makefile.PL PREFIX=/usr/local SYSCONFDIR=/usr/local/etc |
83 |
# |
84 |
# scope: build-time |
85 |
# INST_SYSCONFDIR: |
86 |
# description: > |
87 |
# Sets the base dir below which the config files are sought when any |
88 |
# SpamAssassin app runs. Cf. INST_PREFIX. |
89 |
# defaults: |
90 |
# - The value of SYSCONFDIR if that variable was set. |
91 |
# - Else /etc if INST_PREFIX is either /usr or /usr/local. |
92 |
# - Else INST_PREFIX/etc. |
93 |
# samples: |
94 |
# - Install SpamAssassin below /usr/lib/mail-root/usr/local and run it |
95 |
# below the chroot'ed /usr/local later. Make it also look for its |
96 |
# config in /usr/local/etc: |
97 |
# |
98 |
# perl Makefile.PL PREFIX=/usr/lib/mail-root/usr/local |
99 |
# INST_PREFIX=/usr/local INST_SYSCONFDIR=/usr/local/etc |
100 |
# |
101 |
# scope: run-time |
102 |
# DEF_RULES_DIR: |
103 |
# description: > |
104 |
# Changes the full path to where SpamAssassin will later look for its |
105 |
# rules. Attention: All files in this dir will be purged! |
106 |
# defaults: |
107 |
# - INST_PREFIX/share/spamassassin |
108 |
# samples: |
109 |
# - Install the rules in /tmp/sa-rules (for whatever reason): |
110 |
# |
111 |
# perl Makefile.PL DEF_RULES_DIR=/tmp/sa-rules |
112 |
# |
113 |
# scope: run-time |
114 |
# PKG_DEF_RULES_DIR: |
115 |
# description: > |
116 |
# Sets the full path to the dir where the rules are copied to on 'make |
117 |
# install'. |
118 |
# defaults: |
119 |
# - The value of DEF_RULES_DIR if that variable is set. |
120 |
# - Else PREFIX/share/spamassassin |
121 |
# samples: |
122 |
# - I think you got the point with builddir != installdir. |
123 |
# scope: build-time |
124 |
# LOCAL_RULES_DIR: |
125 |
# description: > |
126 |
# Changes the full path to where SpamAssassin will look for its config |
127 |
# files later on. Makes (INST_)SYSCONFDIR obsolete. |
128 |
# defaults: |
129 |
# - INST_SYSCONFDIR/mail/spamassassin |
130 |
# samples: |
131 |
# - If you'd like to have the config files directly in /etc/spamassassin |
132 |
# try this: |
133 |
# |
134 |
# perl Makefile.PL LOCAL_RULES_DIR=/etc/spamassassin |
135 |
# |
136 |
# - This does effectively the same but might give some errors: |
137 |
# |
138 |
# perl Makefile.PL SYSCONFDIR=/dev/null |
139 |
# LOCAL_RULES_DIR=/etc/spamassassin |
140 |
# |
141 |
# Stupid example, eh? |
142 |
# scope: run-time |
143 |
# PKG_LOCAL_RULES_DIR: |
144 |
# description: > |
145 |
# This is the same for LOCAL_RULES_DIR what PKG_DEF_RULES_DIR is for |
146 |
# DEF_RULES_DIR. |
147 |
# defaults: |
148 |
# - The value of LOCAL_RULES_DIR if that variable is set. |
149 |
# - Else SYSCONFDIR/mail/spamassassin |
150 |
# samples: |
151 |
# - None. |
152 |
# scope: build-time |
153 |
# ENABLE_SSL: |
154 |
# description: > |
155 |
# Set to "yes" if you want the ability to use encrypted connections |
156 |
# between spamc and spamd. |
157 |
# defaults: |
158 |
# - "no". |
159 |
# samples: |
160 |
# - Obvious: |
161 |
# |
162 |
# perl Makefile.PL ENABLE_SSL=yes |
163 |
# |
164 |
# scope: build-time |
165 |
# RUN_RAZOR_TESTS: |
166 |
# description: > |
167 |
# Set to 'yes' or 'no' to disable the prompt. |
168 |
# defaults: |
169 |
# - Prompt if the Razor2 libs are available and the input isn't coming |
170 |
# from the null device. |
171 |
# - Else 'no'. |
172 |
# samples: |
173 |
# - Don't run Razor tests on 'make test': |
174 |
# |
175 |
# perl Makefile.PL RUN_RAZOR_TESTS=no |
176 |
# |
177 |
# - Has the same effects but suppresses all other prompts, too: |
178 |
# |
179 |
# perl Makefile.PL < /dev/null |
180 |
# |
181 |
# scope: Makefile-creation-time |
182 |
# CONTACT_ADDRESS: |
183 |
# description: > |
184 |
# The contact address which appears in the spam reports; should be set to |
185 |
# some internal mail address or url the confused user can contact when |
186 |
# he's got a mail marked as spam. |
187 |
# defaults: |
188 |
# - Prompt for an input if the input isn't coming from the null device. |
189 |
# - The string "the administrator of that system" |
190 |
# samples: |
191 |
# - Set the contact address and suppress all other prompts: |
192 |
# |
193 |
# perl Makefile.PL CONTACT_ADDRESS="helpdesk@example.com" < /dev/null |
194 |
# |
195 |
# scope: Makefile-creation-time |
196 |
# ... |
197 |
############################################################################## |
48 |
|
198 |
|
49 |
use strict; |
199 |
use strict; |
50 |
use Config; |
200 |
use Config; |
Lines 78-84
my $mm_version = $ExtUtils::MakeMaker::V
Link Here
|
78 |
|
228 |
|
79 |
# Gather the rules files in the range 00-69; we do this in perl because it's more portable |
229 |
# 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>); |
230 |
my @rulesfiles = map { s,^rules/,,; $_ } (<rules/*.cf>); |
81 |
my $rulesfiles = join(' ', (grep { /^[0-6][0-9]_/ } @rulesfiles), qw(user_prefs.template triplets.txt languages)); |
231 |
my $rulesfiles = join(' ', (grep { /^[0-6][0-9]_/ } @rulesfiles), qw(user_prefs.template triplets.txt languages)); |
82 |
|
232 |
|
83 |
# Only build spamd and spamc on non-Windows platforms |
233 |
# Only build spamd and spamc on non-Windows platforms |
84 |
my @SPAMD_EXE_FILES = (); |
234 |
my @SPAMD_EXE_FILES = (); |
Lines 95-101
my %makefile = (
Link Here
|
95 |
@SPAMD_EXE_FILES |
245 |
@SPAMD_EXE_FILES |
96 |
], |
246 |
], |
97 |
|
247 |
|
98 |
'MAN1PODS' => { |
248 |
'MAN1PODS' => { |
99 |
'spamassassin' => '$(INST_MAN1DIR)/spamassassin.$(MAN1EXT)', |
249 |
'spamassassin' => '$(INST_MAN1DIR)/spamassassin.$(MAN1EXT)', |
100 |
'sa-learn' => '$(INST_MAN1DIR)/sa-learn.$(MAN1EXT)', |
250 |
'sa-learn' => '$(INST_MAN1DIR)/sa-learn.$(MAN1EXT)', |
101 |
'spamd/spamc.pod' => '$(INST_MAN1DIR)/spamc.$(MAN1EXT)', |
251 |
'spamd/spamc.pod' => '$(INST_MAN1DIR)/spamc.$(MAN1EXT)', |
Lines 267-281
sub MY::postamble {
Link Here
|
267 |
my $instprefix = $self->{INST_PREFIX} |
417 |
my $instprefix = $self->{INST_PREFIX} |
268 |
|| $prefix; |
418 |
|| $prefix; |
269 |
|
419 |
|
270 |
my $is_sys_build = ($prefix =~ m{^(/usr/?)?$}); |
420 |
my $is_sys_build = ($prefix =~ m{^(/usr(/local)?/?)?$}); |
271 |
my $is_sys_inst = ($instprefix =~ m{^(/usr/?)?$}); |
421 |
my $is_opt_build = ($prefix =~ m{^/opt}); |
|
|
422 |
my $is_sys_inst = ($instprefix =~ m{^(/usr(/local)?/?)?$}); |
423 |
my $is_opt_inst = ($instprefix =~ m{^/opt}); |
272 |
|
424 |
|
273 |
my $sysconfdir = $self->{SYSCONFDIR} |
425 |
my $sysconfdir = $self->{SYSCONFDIR} |
274 |
|| ''; |
426 |
|| ( |
|
|
427 |
$is_sys_build ? '/etc' : |
428 |
$is_opt_build ? '/etc/opt' : |
429 |
'$(PREFIX)/etc' |
430 |
); |
275 |
my $instsysconfdir = $self->{INST_SYSCONFDIR} |
431 |
my $instsysconfdir = $self->{INST_SYSCONFDIR} |
276 |
|| $sysconfdir |
432 |
|| $self->{SYSCONFDIR} |
277 |
|| ($is_sys_inst ? '' : '$(INST_PREFIX)') . '/etc'; |
433 |
|| ( |
278 |
$sysconfdir ||= ($is_sys_build ? '' : '$(PREFIX)') . '/etc'; |
434 |
$is_sys_inst ? '/etc' : |
|
|
435 |
$is_opt_inst ? '/etc/opt' : |
436 |
'$(INST_PREFIX)/etc' |
437 |
); |
279 |
|
438 |
|
280 |
my $pkgdefrulesdir = $self->{PKG_DEF_RULES_DIR} |
439 |
my $pkgdefrulesdir = $self->{PKG_DEF_RULES_DIR} |
281 |
|| $self->{DEF_RULES_DIR} |
440 |
|| $self->{DEF_RULES_DIR} |