Index: Makefile.PL =================================================================== RCS file: /cvsroot/spamassassin/spamassassin/Makefile.PL,v retrieving revision 1.111 diff -u -p -r1.111 Makefile.PL --- Makefile.PL 27 Aug 2003 23:22:06 -0000 1.111 +++ Makefile.PL 29 Aug 2003 21:12:58 -0000 @@ -1,50 +1,200 @@ require 5.005; - -# RPM builders, or people building in their home dirs: -# -# VARIABLE DEFAULT -# ------------- ----------------- -# PREFIX * /usr -# INST_PREFIX + $PREFIX -# SYSCONFDIR * /etc -# or $(PREFIX)/etc if $(INST_PREFIX) is not "/usr" -# INST_SYSCONFDIR + $SYSCONFDIR -# or $(INST_PREFIX)/etc if $(INST_PREFIX) is not "/usr" -# PKG_DEF_RULES_DIR * $DEF_RULES_DIR or $(PREFIX)/share/spamassassin -# DEF_RULES_DIR + $(INST_PREFIX)/share/spamassassin -# PKG_LOCAL_RULES_DIR * $LOCAL_RULES_DIR -# or $(SYSCONFDIR)/mail/spamassassin -# LOCAL_RULES_DIR + $(INST_SYSCONFDIR)/mail/spamassassin -# INST_SITELIB + $(INSTALLSITELIB) -# -# RUN_RAZOR2_TESTS (prompt if Razor 2 found) -# CONTACT_ADDRESS (prompt: default="the administrator of that system") -# ENABLE_SSL * 'no' -# -# PERL_BIN * current path to Perl -# PERL_VERSION * current Perl version -# PERL_WARN * 'yes' for CVS builds; else 'no' -# -# * means the variable is used for build time -# + means the variable is used for run time -# -# For example, to install in your home dir: -# -# perl Makefile.PL PREFIX=/home/jm/sausr SYSCONFDIR=/home/jm/saetc -# -# Or to build a package in /tmp/build, but with its internal paths -# referring to /usr and /etc: -# -# perl Makefile.PL PREFIX=/tmp/build/usr SYSCONFDIR=/tmp/build/etc \ -# INST_PREFIX=/usr INST_SYSCONFDIR=/etc -# -# The Razor prompt ("run Razor 2 tests?") can be overridden by setting -# RUN_RAZOR2_TESTS to "y" or "n". -# -# Set ENABLE_SSL to "yes" if you want the ability to use encrypted -# connections between spamc and spamd. -# -########################################################################### +############################################################################## +# The following variables are recognized on the command line. They are useful +# for building packages (RPM, deb, ...) or installing SpamAssassin in a +# different location than the PREFIX Perl was built with. +# +# --- %YAML:1.0 +# PREFIX: +# description: > +# Sets the prefix below which SpamAssassin is built. Please note the +# exceptions for SYSCONFDIR. +# defaults: +# - The prefix Perl was built with (call 'perl -V:prefix' to see the +# value). Normally something like /usr or /usr/local. +# samples: +# - This will install the spamassassin apps in /foo/bin, the libs in +# /foo/lib/perl5, the shared stuff in /foo/share/spamassassin and make +# SpamAssassin look for config files in /foo/etc/mail/spamassassin: +# +# perl Makefile.PL PREFIX=/foo +# +# scope: build-time +# INST_PREFIX: +# description: > +# Sets the prefix below which SpamAssassin is installed; useful for +# creating packages or building chroot jails. 'make install' will put +# the files below PREFIX but the paths inside the apps will refer to +# INST_PREFIX. Please note the exceptions for INST_SYSCONFDIR. +# defaults: +# - The value of PREFIX. +# samples: +# - The following installs the SpamAssassin stuff below /tmp/build/sa +# but the apps will expect themselves to be in /usr when they're +# used (so the files have to be relocated later): +# +# perl Makefile.PL PREFIX=/tmp/build/sa INST_PREFIX=/usr +# +# scope: run-time +# INST_SITELIB: +# description: > +# Sets the full path to where the SpamAssassin libs are put. +# defaults: +# - Whatever Perl was compiled with. Call 'perl -V:sitelib' to see the +# exact value. Normally something like /usr/lib/perl5/site_perl/5.6.1. +# samples: +# - Install SpamAssassin in /usr/local and force the libs to be put +# there, too, even though Perl is installed in /usr (don't forget +# to set PERL5LIB before you run spamassassin): +# +# perl Makefile.PL INST_PREFIX=/usr/local +# INST_SITELIB=/usr/local/lib/perl5/site_perl/5.6.1 +# +# scope: run-time +# SYSCONFDIR: +# description: > +# Sets the base dir for the config files (and where the sample local.cf +# is created). See also LOCAL_RULES_DIR. +# defaults: +# - /etc if PREFIX is either /usr or /usr/local. +# - /etc/opt if PREFIX starts with /opt +# - PATH/etc if PREFIX is PATH/usr or PATH/usr/local. +# - Else PREFIX/etc. +# samples: +# - This will (on Windows) install below 'C:\Program Files\SA' but look +# for the config files in 'C:\Program Files\Shared Files\SA' +# +# perl Makefile.PL PREFIX="C:/Program Files/SA" +# SYSCONFDIR="C:/Program Files/Shared Files/SA" +# +# - To put the apps and libs below ~/.sa-bin but the config below +# ~/.sa-etc try the following: +# +# perl Makefile.PL PREFIX=$HOME/.sa-bin SYSCONFDIR=$HOME/.sa-etc +# +# - Or you may want to have the stuff in ~/usr and the config in ~/etc: +# +# perl Makefile.PL PREFIX=$HOME/usr +# +# - And the following installs SpamAssassin in /usr/local and forces the +# config files to be below /usr/local, too: +# +# perl Makefile.PL PREFIX=/usr/local SYSCONFDIR=/usr/local/etc +# +# scope: build-time +# INST_SYSCONFDIR: +# description: > +# Sets the base dir below which the config files are sought when any +# SpamAssassin app runs. Cf. INST_PREFIX. +# defaults: +# - The value of SYSCONFDIR if that variable was set. +# - Else /etc if INST_PREFIX is either /usr or /usr/local. +# - Else INST_PREFIX/etc. +# samples: +# - Install SpamAssassin below /usr/lib/mail-root/usr/local and run it +# below the chroot'ed /usr/local later. Make it also look for its +# config in /usr/local/etc: +# +# perl Makefile.PL PREFIX=/usr/lib/mail-root/usr/local +# INST_PREFIX=/usr/local INST_SYSCONFDIR=/usr/local/etc +# +# scope: run-time +# DEF_RULES_DIR: +# description: > +# Changes the full path to where SpamAssassin will later look for its +# rules. Attention: All files in this dir will be purged! +# defaults: +# - INST_PREFIX/share/spamassassin +# samples: +# - Install the rules in /tmp/sa-rules (for whatever reason): +# +# perl Makefile.PL DEF_RULES_DIR=/tmp/sa-rules +# +# scope: run-time +# PKG_DEF_RULES_DIR: +# description: > +# Sets the full path to the dir where the rules are copied to on 'make +# install'. +# defaults: +# - The value of DEF_RULES_DIR if that variable is set. +# - Else PREFIX/share/spamassassin +# samples: +# - I think you got the point with builddir != installdir. +# scope: build-time +# LOCAL_RULES_DIR: +# description: > +# Changes the full path to where SpamAssassin will look for its config +# files later on. Makes (INST_)SYSCONFDIR obsolete. +# defaults: +# - INST_SYSCONFDIR/mail/spamassassin +# samples: +# - If you'd like to have the config files directly in /etc/spamassassin +# try this: +# +# perl Makefile.PL LOCAL_RULES_DIR=/etc/spamassassin +# +# - This does effectively the same but might give some errors: +# +# perl Makefile.PL SYSCONFDIR=/dev/null +# LOCAL_RULES_DIR=/etc/spamassassin +# +# Stupid example, eh? +# scope: run-time +# PKG_LOCAL_RULES_DIR: +# description: > +# This is the same for LOCAL_RULES_DIR what PKG_DEF_RULES_DIR is for +# DEF_RULES_DIR. +# defaults: +# - The value of LOCAL_RULES_DIR if that variable is set. +# - Else SYSCONFDIR/mail/spamassassin +# samples: +# - None. +# scope: build-time +# ENABLE_SSL: +# description: > +# Set to "yes" if you want the ability to use encrypted connections +# between spamc and spamd. +# defaults: +# - "no". +# samples: +# - Obvious: +# +# perl Makefile.PL ENABLE_SSL=yes +# +# scope: build-time +# RUN_RAZOR_TESTS: +# description: > +# Set to 'yes' or 'no' to disable the prompt. +# defaults: +# - Prompt if the Razor2 libs are available and the input isn't coming +# from the null device. +# - Else 'no'. +# samples: +# - Don't run Razor tests on 'make test': +# +# perl Makefile.PL RUN_RAZOR_TESTS=no +# +# - Has the same effects but suppresses all other prompts, too: +# +# perl Makefile.PL < /dev/null +# +# scope: Makefile-creation-time +# CONTACT_ADDRESS: +# description: > +# The contact address which appears in the spam reports; should be set to +# some internal mail address or url the confused user can contact when +# he's got a mail marked as spam. +# defaults: +# - Prompt for an input if the input isn't coming from the null device. +# - The string "the administrator of that system" +# samples: +# - Set the contact address and suppress all other prompts: +# +# perl Makefile.PL CONTACT_ADDRESS="helpdesk@example.com" < /dev/null +# +# scope: Makefile-creation-time +# ... +############################################################################## use strict; use Config; @@ -78,7 +228,7 @@ my $mm_version = $ExtUtils::MakeMaker::V # Gather the rules files in the range 00-69; we do this in perl because it's more portable my @rulesfiles = map { s,^rules/,,; $_ } (); -my $rulesfiles = join(' ', (grep { /^[0-6][0-9]_/ } @rulesfiles), qw(user_prefs.template triplets.txt languages)); +my $rulesfiles = join(' ', (grep { /^[0-6][0-9]_/ } @rulesfiles), qw(user_prefs.template triplets.txt languages)); # Only build spamd and spamc on non-Windows platforms my @SPAMD_EXE_FILES = (); @@ -95,7 +245,7 @@ my %makefile = ( @SPAMD_EXE_FILES ], - 'MAN1PODS' => { + 'MAN1PODS' => { 'spamassassin' => '$(INST_MAN1DIR)/spamassassin.$(MAN1EXT)', 'sa-learn' => '$(INST_MAN1DIR)/sa-learn.$(MAN1EXT)', 'spamd/spamc.pod' => '$(INST_MAN1DIR)/spamc.$(MAN1EXT)', @@ -267,15 +417,24 @@ sub MY::postamble { my $instprefix = $self->{INST_PREFIX} || $prefix; - my $is_sys_build = ($prefix =~ m{^(/usr/?)?$}); - my $is_sys_inst = ($instprefix =~ m{^(/usr/?)?$}); + my $is_sys_build = ($prefix =~ m{^(/usr(/local)?/?)?$}); + my $is_opt_build = ($prefix =~ m{^/opt}); + my $is_sys_inst = ($instprefix =~ m{^(/usr(/local)?/?)?$}); + my $is_opt_inst = ($instprefix =~ m{^/opt}); my $sysconfdir = $self->{SYSCONFDIR} - || ''; + || ( + $is_sys_build ? '/etc' : + $is_opt_build ? '/etc/opt' : + '$(PREFIX)/etc' + ); my $instsysconfdir = $self->{INST_SYSCONFDIR} - || $sysconfdir - || ($is_sys_inst ? '' : '$(INST_PREFIX)') . '/etc'; - $sysconfdir ||= ($is_sys_build ? '' : '$(PREFIX)') . '/etc'; + || $self->{SYSCONFDIR} + || ( + $is_sys_inst ? '/etc' : + $is_opt_inst ? '/etc/opt' : + '$(INST_PREFIX)/etc' + ); my $pkgdefrulesdir = $self->{PKG_DEF_RULES_DIR} || $self->{DEF_RULES_DIR}