View | Details | Raw Unified | Return to bug 2388
Collapse All | Expand All

(-)Makefile.PL (-205 / +791 lines)
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
}
(-)INSTALL (-7 / +19 lines)
Lines 54-60 http://spamassassin.org/ , and install t Link Here
54
	perl Makefile.PL
54
	perl Makefile.PL
55
	[option: add -DSPAMC_SSL to $CFLAGS to build an SSL-enabled spamc]
55
	[option: add -DSPAMC_SSL to $CFLAGS to build an SSL-enabled spamc]
56
	make
56
	make
57
	make install				[as root]
57
	make install                            [as root]
58
58
59
To install as non-root, do something like this:
59
To install as non-root, do something like this:
60
60
Lines 68-75 To install as non-root, do something lik Link Here
68
If you are running AFS, you may also need to specify INSTALLSITELIB and
68
If you are running AFS, you may also need to specify INSTALLSITELIB and
69
SITELIBEXP.
69
SITELIBEXP.
70
70
71
This will install the SpamAssassin modules and rules into the ~/sausr
71
This will install the SpamAssassin modules and rules below the ~/sausr
72
and ~/saetc directories off your home directory.
72
and ~/saetc directories off your home directory. Please see the file
73
PACKAGING, sections "Changing paths in the Makefile" and "Setting further
74
options on the command line" for more informations on available command
75
line variables.
73
76
74
Note that you can upgrade SpamAssassin using these instructions, as long
77
Note that you can upgrade SpamAssassin using these instructions, as long
75
as you take care to read the caveats at the top of this file.   Upgrading
78
as you take care to read the caveats at the top of this file.   Upgrading
Lines 142-147 target: Link Here
142
	make
145
	make
143
	make install
146
	make install
144
147
148
Please see the file PACKAGING, sections "Changing paths in the Makefile"
149
and "Setting further options on the command line" for more informations
150
on available command line variables.
151
145
4. If you already use procmail, skip to step 6.  If not, ensure procmail
152
4. If you already use procmail, skip to step 6.  If not, ensure procmail
146
is installed using "which procmail" or install it from www.procmail.org.
153
is installed using "which procmail" or install it from www.procmail.org.
147
154
Lines 189-194 These modules are required for spamassas Link Here
189
    Without the proper version the build will fail to create the Makefile.
196
    Without the proper version the build will fail to create the Makefile.
190
    This is included in Perl versions 5.6 and later.
197
    This is included in Perl versions 5.6 and later.
191
198
199
    Version 6.16 or later is recommended.
200
192
201
193
These modules are required for spamassassin to run:
202
These modules are required for spamassassin to run:
194
203
Lines 225-230 These modules are required for spamassas Link Here
225
    If it generates an error, you need to install the module.  If the
234
    If it generates an error, you need to install the module.  If the
226
    command just returns, you should be ok.
235
    command just returns, you should be ok.
227
236
237
228
Optional Additional Modules
238
Optional Additional Modules
229
---------------------------
239
---------------------------
230
240
Lines 273-281 skipped. Link Here
273
    You (and any users who use Razor) will need to register an account
283
    You (and any users who use Razor) will need to register an account
274
    to do so, like this:
284
    to do so, like this:
275
285
276
	# razor-client		[creates symbolic links]
286
	# razor-client          [creates symbolic links]
277
	# razor-admin -create	[creates the razor home]
287
	# razor-admin -create   [creates the razor home]
278
	# razor-admin -register	[registers an account]
288
	# razor-admin -register [registers an account]
279
    
289
    
280
290
281
  - DCC    http://www.rhyolite.com/anti-spam/dcc/
291
  - DCC    http://www.rhyolite.com/anti-spam/dcc/
Lines 296-302 skipped. Link Here
296
    The last command will give some output. One line of it should contain
306
    The last command will give some output. One line of it should contain
297
    something like:
307
    something like:
298
308
299
        dcc.rhyolite.com,-         RTT+0 ms    anon
309
	dcc.rhyolite.com,-         RTT+0 ms    anon
300
310
301
    Note that MIMEDefang users may need to set the 'dcc_path'
311
    Note that MIMEDefang users may need to set the 'dcc_path'
302
    configuration setting, since MIMEDefang does not set a PATH by
312
    configuration setting, since MIMEDefang does not set a PATH by
Lines 357-362 skipped. Link Here
357
	install Mail::Audit
367
	install Mail::Audit
358
	quit
368
	quit
359
369
370
360
  - Digest::SHA1  (from CPAN)
371
  - Digest::SHA1  (from CPAN)
361
372
362
    The Digest::SHA1 module will speed up some cryptographic hash tests,
373
    The Digest::SHA1 module will speed up some cryptographic hash tests,
Lines 364-369 skipped. Link Here
364
375
365
    If you use Debian, you can get Digest::SHA1 from the libdigest-sha1-perl
376
    If you use Debian, you can get Digest::SHA1 from the libdigest-sha1-perl
366
    package.
377
    package.
378
367
379
368
  - Net::Ident   (from CPAN)
380
  - Net::Ident   (from CPAN)
369
381
(-)PACKAGING (+364 lines)
Added Link Here
1
2
Introduction
3
------------
4
5
The Makefile which is used to build SpamAssassin is created by calling
6
	perl Makefile.PL
7
8
This is the standard Perl way of building packages. It involves the
9
Perl module ExtUtils::MakeMaker (which will hopefully be replaced by
10
Module::Build one day) which creates a Makefile.
11
12
ExtUtils::MakeMaker recognizes several variables which can be set at
13
the command line to give the user the possibility to influence the
14
contents of the generated Makefile. All macros written to the Makefile
15
can be changed with a command line like this:
16
	perl Makefile.PL FOO="bar"
17
This would give the (exemplary) macro 'FOO' the value 'bar'.
18
19
Now has the internal structure of ExtUtils::MakeMaker and that of the
20
generated Makefiles changed over the years. For a description of the
21
features your version supports, please read
22
	perldoc ExtUtils::MakeMaker
23
24
One important thing to know when you're building packages is that Perl
25
uses three different "repositories" for installed modules and their
26
corresponding files: 'perl', 'site' and 'vendor' (the latter was
27
introduced with Perl 5.6.0). These have the following meanings:
28
29
  perl:   This should be used only by essential modules shipped with
30
          Perl or modules required by one of these. And maybe for some
31
          other important modules chosen by some obscure selection
32
          process. Only one thing is sure about this set of directories:
33
          SpamAssassin doesn't belong there.
34
35
  site:   This is the default. The libs (.pm files) of the modules are
36
          installed into the site_perl subdir in the Perl lib dir.
37
          Everything installed via the CPAN shell or directly from
38
          sources should go there.
39
40
  vendor: This repository was officially introduced some time after
41
          Perl 5.005_03 (maybe with 5.6.0). It's intended to be the
42
          target for all modules installed from distribution specific
43
          packages; that means RPMs, debs, ebuilds, etc. The rationale
44
          behind this is that this prevents modules installed by the
45
          user from being overwritten by packaged ones.
46
47
The wanted repository can be chosen by setting the variable INSTALLDIRS.
48
So according to the description above should packages probably use
49
	perl Makefile.PL INSTALLDIRS=vendor
50
That's definitely the correct way to go for Debian, according to the
51
Perl Policy [DEBPERL]. But I've heard that the vendor stuff is either
52
broken or not set on many other systems, especially Red Hat ones. Google
53
might help to find more infos on this topic.
54
55
SpamAssassin needs some directories which normally aren't supported by
56
ExtUtils::MakeMaker. So we had to extend its logic quite a bit. And to
57
make it worse did the internal logic change extremely between the 5.x
58
and 6.x series, especially for packaging stuff. We had to "backport"
59
(ie. hack into) some of the functionality ExtUtils::MakeMaker 6.11 and
60
later offers. That this is very error-prone is obvious. So throughout
61
this text you'll find some recommendations for versions you should use.
62
You should definitely use version 5.45 or later, recommended is 6.16
63
and later.
64
65
The following ressources might help understanding this stuff:
66
[MANEUMM616], [MM00779], [P5P94113].
67
68
It's also possible to build SpamAssassin with a current version of
69
ExtUtils::MakeMaker without upgrading the system. See the section
70
"Building with another ExtUtils::MakeMaker" for details.
71
72
73
Changing paths in the Makefile
74
------------------------------
75
76
Internally the Makefile defined quite some paths for the different settings
77
of INSTALLDIRS. One can change them directly but to be independent of the
78
version of ExtUtils::MakeMaker the following variables should be used:
79
80
PREFIX:
81
  Sets the prefix below which SpamAssassin is installed. Please note the
82
  exceptions for SYSCONFDIR.
83
84
  Default is the prefix Perl was built with (call
85
  	perl -V:prefix
86
  to see the value). Normally something like /usr or /usr/local.
87
88
  Samples:
89
    This will install the spamassassin apps in /foo/bin, the libs in
90
    /foo/lib/perl5, the shared stuff in /foo/share/spamassassin and make
91
    SpamAssassin look for config files in /foo/etc/mail/spamassassin:
92
    	perl Makefile.PL PREFIX=/foo
93
94
LIB:
95
  This will change the directory where the SpamAssassin libraries (.pm files
96
  are installed. The module's architecture-independent files will be put into
97
  the given directory, the architecture-dependent files into a subdirectory
98
  with the name of the current architecture.
99
100
  The default is something like PREFIX/lib/perl5/site_perl/PERL_VERSION (for
101
  INSTALLDIRS=site).
102
103
  Samples:
104
    Under i686-Linux, put the architecture-independent files below ~/.libs
105
    and the architecture-dependent ones below ~/.libs/i686-linux:
106
    	perl Makefile.PL LIB=~/.libs
107
108
DATADIR (DEFRULESDIR):
109
  SpamAssassin's real logic lies in its shipped rule definitions and the
110
  corresponding scores. The files with these settings have to be saved
111
  somewhere, normally below PREFIX/share/spamassassin. The full path to
112
  that directory can be changed with this variable (DEFRULESDIR is a
113
  synonyme).
114
115
  ATTENTION: All files within this directory are removed when SpamAssassin
116
  is installed!
117
118
  Samples:
119
    Install everything into the default locations but put the rules in
120
    /tmp/sa-rules (for whatever reason):
121
    	perl Makefile.PL DATADIR=/tmp/sa-rules
122
123
124
SYSCONFDIR:
125
  Sets the base dir for the config files. See also CONFDIR.
126
127
  The default depends on the PREFIX and is compliant to the FHS:
128
    - if PREFIX is either /usr or /usr/local:
129
      /etc
130
    - if PREFIX starts with /opt:
131
      /etc/opt
132
    - else:
133
      PREFIX/etc
134
135
  Samples:
136
    This will (on Windows) install below 'C:\Program Files\SpamAssassin' but
137
    look for the config files in 'C:\Program Files\Shared Files\SpamAssassin':
138
    	perl Makefile.PL PREFIX="C:/Program Files/SpamAssassin"
139
    	  SYSCONFDIR="C:/Program Files/Shared Files/SpamAssassin"
140
141
    To put the apps and libs below ~/.sa-bin but the config below ~/.sa-etc
142
    try the following:
143
    	perl Makefile.PL PREFIX=$HOME/.sa-bin SYSCONFDIR=$HOME/.sa-etc
144
145
    And the following installs SpamAssassin in /usr/local and forces the
146
    config files to be below /usr/local, too:
147
    	perl Makefile.PL PREFIX=/usr/local SYSCONFDIR=/usr/local/etc
148
149
CONFDIR (LOCALRULESDIR):
150
  SpamAssassin looks for its config files in SYSCONFDIR/mail/spamassassin.
151
  (There is also a sample local.cf created if such a file doesn't exist yet.)
152
  Some people didn't like this path for various reasons so the full path to
153
  the config files can be changed here (this more or less makes SYSCONFDIR
154
  obsolete). A synonyme for this variable is LOCALRULESDIR.
155
156
  Samples:
157
    If you'd like to have the config files directly in /etc/spamassassin
158
    try this:
159
    	perl Makefile.PL CONFDIR=/etc/spamassassin
160
161
162
Installing to a directory different from the final destination
163
--------------------------------------------------------------
164
165
When you're building packages, it's often needed to install the stuff to
166
some temporary directory and then build the package from there. The problem
167
with this approach is that the build system of SpamAssassin needs to write
168
some final paths to the libs and the applications.
169
170
Previous versions offered some complicated variables to achieve this. Those
171
hacks weren't compatible to current versions of ExtUtils::MakeMaker. But
172
ExtUtils::MakeMaker 6.06 (which was said to be buggy till 6.11) introduced
173
a feature which is well known from the GNU build tools [GNUMAKECMD]: The
174
variable DESTDIR.
175
176
The value of DESTDIR is simply prepended to all other paths on make install.
177
So if you wanted to create a SpamAssassin package for a system which will
178
have it installed in /usr but you want to create that package from some temp
179
dir, you would do something like this:
180
	perl Makefile.PL Makefile.PL PREFIX=/usr DESTDIR=/tmp/sa-build
181
	make
182
	make disttest
183
	make install
184
	cd /tmp/sa-build
185
	build_some_package
186
187
ATTENTION: This method heavily depends on a feature introduced with a newer
188
version of ExtUtils::MakeMaker. Si it's *strongly* recommended to use
189
	ExtUtils::MakeMaker 6.16 or later
190
when building packages. That module is available here [GETEUMM616]. If any
191
problems occur with previous versions, please report them to [BUGZILLA].
192
See also "Building with another ExtUtils::MakeMaker".
193
194
195
Setting further options on the command line
196
-------------------------------------------
197
198
Besides the directories, the build process of SpamAssassin supports several
199
other settings to set or enable some features. For some of these settings
200
the user is asked before the Makefile is created. To avoid these questions
201
(and accept the defaults, whatever they are) it is possible to redirect
202
STDIN from the null device like this:
203
	perl Makefile.PL < /dev/null
204
Or, under Windows:
205
	perl Makefile.PL < nul
206
207
The following variables are supported:
208
209
ENABLE_SSL:
210
  Can be set to either "yes" or "no" (default). Makes it possible to use SSL
211
  encryption on the (TCP) connection between spamc and spamd.
212
213
  Sample:
214
    Build spamc with SSL, use defaults for all other questions:
215
    	perl Makefile.PL ENABLE_SSL=yes < /dev/null
216
217
CONTACT_ADDRESS:
218
  Each reported spam contains an address under which the confused user/client
219
  can request more information about the tagging of his mail. That address can
220
  be set here. The default is to query the buildung user, falling back to the
221
  string "the administrator of that system".
222
223
  Sample:
224
    The user can find some information on the page http://example.com/tag/:
225
    	perl Makefile.PL CONTACT_ADDRESS="http://example.com/tag/"
226
227
RUN_RAZOR_TESTS:
228
  Vipul's Razor is an optional module. If that module is found to be installed
229
  some special tests can be performed when 'make test' is run. The builder is
230
  asked if he wants to do so. Default is "no" (because those tests can fail if
231
  there are problems with the network connection or the servers).
232
233
  Sample:
234
    Run only the Razor tests:
235
	perl Makefile.PL RUN_RAZOR_TESTS=yes < /dev/null
236
	make test TEST_FILES="t/razor*.t"
237
238
239
Twisting Perl details
240
---------------------
241
242
The build process of SpamAssassin has to know several details of the Perl
243
calling it later. This is used to work around some Perl bugs and make it
244
all actually work :o) The following additional variables are supported to
245
modify these settings:
246
247
PERL_BIN:
248
  The path to the perl application which will be used to call the scripts
249
  (like spamassassin and spamd). It makes sense to set this if you build
250
  SpamAssassin on some weird build host which happen to have Perl in
251
  /some/weird/location which is definitely not the location on the end
252
  user's box. The default is the macro FULLPERL which should be the path
253
  to the perl processing Makefile.PL.
254
255
  Sample:
256
    Building with some weird perl:
257
    	/local/buildsys/perl-5.6.1/bin/perl Makefile.PL PERL_BIN=/usr/bin/perl
258
259
PERL_VERSION:
260
  The build system has to know the version of the Perl which will actually
261
  call SpamAssassin. Normally the app given by PERL_BIN is executed and asked
262
  for its version. If that fails, the version of the perl which called
263
  Makefile.PL is used. Sometimes one might have to correct this.
264
265
  ATTENTION: The version always has o be given in the three-component style.
266
  So the floating-point representation of old Perls has to be "converted".
267
268
  Sample:
269
    Building with Perl 5.8.0 for Perl 5.005_03:
270
    	perl-5.8.0 Makefile.PL PERL_VERSION=5.5.30
271
272
273
Building with another ExtUtils::MakeMaker
274
-----------------------------------------
275
276
It is possible to use a different version than the one which is installed.
277
This is very usefule if one wants to package SpamAssassin but can't or doesn't
278
want to upgrade the module installed on his machine. Follow these steps to
279
success:
280
281
1. Go to CPAN and look for the latest ExtUtils::MakeMaker available.
282
     <http://search.cpan.org/search?query=ExtUtils::MakeMaker>
283
   The standalone package (currently mainatined by Michael G Schwern)
284
   is needed.
285
286
2. Get the tar ball and extract it in some temporary directory. For
287
   version 6.16:
288
   	cd /tmp
289
   	wget http://search.cpan.org/CPAN/authors/id/M/MS/MSCHWERN/ExtUtils-MakeMaker-6.16.tar.gz
290
   	tar xvfz ExtUtils-MakeMaker-6.16.tar.gz
291
292
3. You will now have a directory ExtUtils-MakeMaker-X.YY (where X.YY is the
293
   version). Inside is a subdirectory 'lib'. Add that one to the environment
294
   variable PERL5LIB, like this:
295
   	export PERL5LIB="/tmp/ExtUtils-MakeMaker-6.16/lib:$PERL5LIB"
296
297
4. Now build SpamAssassin. As long as the PERL5LIB variable is set, the
298
   updates ExtUtils::MakeMaker is used.
299
300
301
Obsolete Variables
302
------------------
303
304
The following list shows variables recognized by the old build system and
305
their new counterparts (no, the latter aren't in the wrong order, it actually
306
was that complicated):
307
308
old: PREFIX=/bar/foo INST_PREFIX=/foo
309
new: PREFIX=/foo     DESTDIR=/bar
310
311
old: INST_SITELIB=/foo
312
new: LIB=/foo
313
314
old: SYSCONFDIR=/bar/foo INST_SYSCONFDIR=/foo
315
new: SYSCONFDIR=/foo     DESTDIR=/bar
316
317
old: LOCAL_RULES_DIR=/foo PKG_LOCAL_RULES_DIR=/bar/foo
318
new: LOCALRULESDIR=/foo   DESTDIR=/bar
319
320
old: DEF_RULES_DIR=/foo   PKG_DEF_RULES_DIR=/bar/foo
321
new: DEFRULESDIR=/foo     DESTDIR=/bar
322
323
Unsing one of the following variables will make the Makefile generation
324
process die:
325
  INST_PREFIX
326
  INST_SITELIB
327
  INST_SYSCONFDIR
328
  LOCAL_RULES_DIR
329
  DEF_RULES_DIR
330
331
If you think you need to use one of those nevertheless, you can set the
332
variable IGNORE_CRUFT to "yes".
333
334
335
Ressources
336
----------
337
338
[BUGZILLA] SpamAssassin bug database:
339
  <http://bugzilla.spamassassin.org>
340
341
[DEBPERL] Debian Perl Policy, Chapter 3: Packaged Modules:
342
  <http://www.debian.org/doc/packaging-manuals/perl-policy/ch-module_packages.html>
343
344
[GETEUMM616] Get ExtUtils::MakeMaker 6.16 here:
345
  <http://search.cpan.org/author/MSCHWERN/ExtUtils-MakeMaker-6.16/>
346
347
[GNUMAKECMD] GNU make manual: Make Conventions: Variables for Specifying
348
  Commands
349
  <http://www.gnu.org/manual/make-3.79.1/html_chapter/make_14.html#SEC119>
350
351
[MANEUMM616] The man page for ExtUtils::MakeMaker 6.16:
352
  <http://search.cpan.org/author/MSCHWERN/ExtUtils-MakeMaker-6.16/lib/ExtUtils/MakeMaker.pm#Default_Makefile_Behaviour>
353
354
[MM00779] makemaker-at-perl-dot-org: Michael G Schwern: "Re: MakeMaker
355
  problems with relocation" (PREFIX was broken):
356
  <http://www.mail-archive.com/makemaker@perl.org/msg00779.html>
357
358
[P5P94113] perl5-porters: Michael G Schwern: "Re: OS X's vendorlib default
359
  seems wrong" (description of different repositoreis):
360
  <http://archive.develooper.com/perl5-porters@perl.org/msg94113.html>
361
362
[RHBUG78053] Red Hat bug 78053: "incompatible changes in behavior of
363
  MakeMaker; affects rpm build process" (introduction of DESTDIR):
364
  <https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=78053>
(-)MANIFEST (+2 lines)
Lines 4-9 COPYRIGHT Link Here
4
Changes
4
Changes
5
INSTALL
5
INSTALL
6
INSTALL.VMS
6
INSTALL.VMS
7
PACKAGING
7
License
8
License
8
MANIFEST
9
MANIFEST
9
MANIFEST.SKIP
10
MANIFEST.SKIP
Lines 251-253 t/html_obfu.t Link Here
251
t/spamc_c_stdout_closed.t
252
t/spamc_c_stdout_closed.t
252
t/spamd_allow_user_rules.t
253
t/spamd_allow_user_rules.t
253
t/spamd_hup.t
254
t/spamd_hup.t
255
META.yml                                Module meta-data (added by MakeMaker)
(-)spamassassin.spec (-11 / +6 lines)
Lines 103-123 aplikacji do czytania poczty. Link Here
103
%setup -q -n %{pdir}-%{pnam}-%{real_version}
103
%setup -q -n %{pdir}-%{pnam}-%{real_version}
104
104
105
%build
105
%build
106
%{__perl} Makefile.PL INST_PREFIX=%{_prefix} INST_SYSCONFDIR=%{_sysconfdir} PREFIX=$RPM_BUILD_ROOT/%{_prefix} SYSCONFDIR=$RPM_BUILD_ROOT/%{_sysconfdir} < /dev/null
106
%{__perl} Makefile.PL PREFIX=%{_prefix} SYSCONFDIR=%{_sysconfdir} DESTDIR=$RPM_BUILD_ROOT < /dev/null
107
# now override the PREFIX setting to not use %buildroot%. MakeMaker
107
%{__make}
108
# does not have a better way to do this, it seems...
109
%{__make} PREFIX=%{_prefix}
110
%{__make} spamd/libspamc.so
108
%{__make} spamd/libspamc.so
111
109
112
%install
110
%install
113
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
111
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
114
%makeinstall PREFIX=%buildroot/%{_prefix} \
112
%makeinstall
115
        INSTALLMAN1DIR=%buildroot/%{_mandir}/man1 \
116
	INSTALLMAN3DIR=%buildroot/%{_mandir}/man3 \
117
	INSTALLSITEMAN1DIR=%buildroot/%{_mandir}/man1 \
118
	INSTALLSITEMAN3DIR=%buildroot/%{_mandir}/man3 \
119
	INSTALLVENDORMAN1DIR=%buildroot/%{_mandir}/man1 \
120
	INSTALLVENDORMAN3DIR=%buildroot/%{_mandir}/man3
121
install -d %buildroot/%{initdir}
113
install -d %buildroot/%{initdir}
122
install -d %buildroot/%{_includedir}
114
install -d %buildroot/%{_includedir}
123
install -m 0755 spamd/redhat-rc-script.sh %buildroot/%{initdir}/spamassassin
115
install -m 0755 spamd/redhat-rc-script.sh %buildroot/%{initdir}/spamassassin
Lines 178-183 if [ "$1" -ge "1" ]; then Link Here
178
fi
170
fi
179
171
180
%changelog
172
%changelog
173
* Thu Sep 09 2003 Malte S. Stretz <spamassassin-contrib@msquadrat.de>
174
- take advantage of the new simplified build system
175
181
* Wed May 28 2003 Theo Van Dinter <felicity@kluge.net> 2.60-1
176
* Wed May 28 2003 Theo Van Dinter <felicity@kluge.net> 2.60-1
182
- updated to 2.60
177
- updated to 2.60
183
178
(-)debian/rules (-7 / +6 lines)
Lines 29-34 endif Link Here
29
29
30
PERL = /usr/bin/perl
30
PERL = /usr/bin/perl
31
31
32
PREFIX     = /usr
33
SYSCONFDIR = /etc
34
32
packagea = spamc
35
packagea = spamc
33
packagei = spamassassin
36
packagei = spamassassin
34
37
Lines 40-52 configure-stamp: Link Here
40
	dh_testdir
43
	dh_testdir
41
44
42
	perl Makefile.PL INSTALLDIRS=vendor \
45
	perl Makefile.PL INSTALLDIRS=vendor \
43
	 PREFIX=$(CURDIR)/debian/$(packagei)/usr \
46
	  PREFIX=$(PREFIX) SYSCONFDIR=$(SYSCONFDIR) \
44
	 VENDORPREFIX=$(CURDIR)/debian/$(packagei)/usr \
47
	  CONFDIR=$(SYSCONFDIR)/spamassassin \
45
	 SYSCONFDIR=$(CURDIR)/debian/$(packagei)/etc \
48
	  DESTDIR=$(CURDIR)/debian/$(packagei) < /dev/null
46
	 INST_PREFIX=/usr INST_SYSCONFDIR=/etc \
47
	 PKG_LOCAL_RULES_DIR=$(CURDIR)/debian/$(packagei)/etc/spamassassin \
48
	 LOCAL_RULES_DIR=/etc/spamassassin RUN_RAZOR2_TESTS=n \
49
	 CONTACT_ADDRESS="the administrator of that system"
50
49
51
	touch configure-stamp
50
	touch configure-stamp
52
51

Return to bug 2388