You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by si...@apache.org on 2004/06/28 04:38:36 UTC

svn commit: rev 22210 - in spamassassin/trunk: . spamc spamc/replace t

Author: sidney
Date: Sun Jun 27 19:38:35 2004
New Revision: 22210

Modified:
   spamassassin/trunk/Makefile.PL
   spamassassin/trunk/spamc/README.win
   spamassassin/trunk/spamc/replace/getopt.c
   spamassassin/trunk/t/SATest.pm
   spamassassin/trunk/t/spamc.t
   spamassassin/trunk/t/spamc_l.t
Log:
bug 3541: add BUILD_SPAMC option in Windows, update readme, fix warning in getopt.c

Modified: spamassassin/trunk/Makefile.PL
==============================================================================
--- spamassassin/trunk/Makefile.PL	(original)
+++ spamassassin/trunk/Makefile.PL	Sun Jun 27 19:38:35 2004
@@ -60,6 +60,7 @@
   'PERL_TAINT',       # "   "  "    "  "    taint mode for the scripts (DON'T)
 
 
+  'BUILD_SPAMC'  ,    # Set to 'no' to skip build of spamc.
   'ENABLE_SSL',       # Set to 'yes' to build spamc with SSL support.
   'CONTACT_ADDRESS',  # To not ask for the contact address, use this.
   'RUN_NET_TESTS',    # To not ask whether net tests should be run, use this.
@@ -95,6 +96,7 @@
 
 
 my %opt = (
+  'build_spamc'        => undef,
   'enable_ssl'      => undef,
   'contact_address' => undef,
   'run_net_tests'   => undef,
@@ -159,7 +161,7 @@
 
     'EXE_FILES'	=> [
         'spamassassin', 'sa-learn',
-        'spamc/spamc$(EXE_EXT)',
+        'spamc/spamc$(EXE_EXT)', # must next to last one
         'spamd/spamd',	# must be the last one
     ],
 
@@ -306,6 +308,18 @@
   # Don't build spamd
   pop    @{$makefile{EXE_FILES}};
   delete $makefile{MAN1PODS}{'spamd/spamd'};
+  # building spamc is optional under Win32 because not everyone has compiler
+  if (!defined $opt{'build_spamc'}) {
+    $opt{'build_spamc'} = bool(prompt(
+      "Build spamc.exe (environment must be set up for C compiler)? (y/n)",
+      'y'));
+  } else {
+    $opt{'build_spamc'} = bool($opt{'build_spamc'});
+  }
+  if (!$opt{'build_spamc'}) {
+    pop    @{$makefile{EXE_FILES}};
+    delete $makefile{MAN1PODS}{'spamc/spamc.pod'};
+  }
   # And require Net::DNS v0.44
   #$makefile{PREREQ_PM}{Net::DNS} = 0.44;
 }

Modified: spamassassin/trunk/spamc/README.win
==============================================================================
--- spamassassin/trunk/spamc/README.win	(original)
+++ spamassassin/trunk/spamc/README.win	Sun Jun 27 19:38:35 2004
@@ -10,24 +10,40 @@
 supported under Windows, so only TCP/IP can be used. As of this
 writing SSL has not been tested with the Windows spamc.
 
-Building spamc for Windows requires a lot more than running it. If all
-you want to do is run spamc without the full SpamAssassin on your
-Windows machine, it is easier if you can get a binary executable from
-someone else who has built it.
+Building spamc for Windows requires a lot more installed on your
+computer than running it does. If all you want to do is run spamc
+without the full SpamAssassin on your Windows machine, it is easier if
+you can get a binary executable from someone else who has built it.
+
+When building SpamAssassin under Windows, building spamc is
+optional. You can specify BUILD_SPAMC=yes or BUILD_SPAMC=no on the
+command line when you run 'perl Makefile.PL'. If you don't, you will
+be asked during the build process if you want to build spamc.
 
 System Requirements
 -------------------
 
-This has only been tested with Microsoft Visual C++ 6.0. There is a
-good chance it will just work with later versions of VC++, but some
-installation files would have to be changed to use with any other
-compiler.
+To build spamc you have to be able to build SpamAssassin and have a
+suitable C compiler.
 
-In addition to VC++ you also have to have installed a Windows version
-of Perl and the modules that are listed as required in the general
+To build SpamAssassin you must have installed a Windows version of
+Perl and the modules that are listed as required in the general
 SpamAssassin documentation. So far the only Windows version of perl
 this has been tested with is ActivePerl.
 
+Building spamc for Windows has been tested with Microsoft Visual C++
+6.0 and with Microsoft Visual C++ Toolkit 2003 with the February 2003
+Platform SDK. It will probably just work with any recent version of
+VC++. Some installation files would have to be changed to use with any
+other C compiler.
+
+Note that Microsoft Visual C++ Toolkit 2003 and the Platform SDK are
+available for download for free from
+http://msdn.microsoft.com/visualc/vctoolkit2003/ and
+http://www.microsoft.com/msdownload/platformsdk/sdkupdate/
+The latter requires Internet Explorer and accepting installation of an
+ActiveX control to access.
+
 To run the spamc executable once it is built you do not need to have
 VC++ or perl installed.
 
@@ -81,13 +97,17 @@
 
 "\Program Files\Microsoft Visual Studio\VC98\Bin\VCVARS32.BAT"
 
+Microsoft Visual C++ Toolkit 2003 has a similar batch file which has
+to be changed to include the appropriate paths for the Platform SDK
+installation.
+
 Also make sure that the SPAMD_SCRIPT environment variable is set in
 your command shell as described above.
 
 Then use the commands
 
  cd \spamasassin
- perl Makefile.PL
+ perl Makefile.PL BUILD_SPAMC=yes
  nmake
  nmake test
  nmake install

Modified: spamassassin/trunk/spamc/replace/getopt.c
==============================================================================
--- spamassassin/trunk/spamc/replace/getopt.c	(original)
+++ spamassassin/trunk/spamc/replace/getopt.c	Sun Jun 27 19:38:35 2004
@@ -22,6 +22,14 @@
 #include <assert.h>
 #include <stdlib.h>
 
+#ifdef _MSC_VER
+/* ignore MSVC++ warnings that are annoying and hard to remove:
+ 4702 unreachable code
+ (there is an unreachable assert(0) in case somehow it is reached)
+ */
+#pragma warning( disable : 4702 )
+#endif
+
 #define OPTERRCOLON (1)
 #define OPTERRNF (2)
 #define OPTERRARG (3)

Modified: spamassassin/trunk/t/SATest.pm
==============================================================================
--- spamassassin/trunk/t/SATest.pm	(original)
+++ spamassassin/trunk/t/SATest.pm	Sun Jun 27 19:38:35 2004
@@ -15,7 +15,11 @@
   #   <http://www.mail-archive.com/dev%40perl.apache.org/msg05466.html>
   #  -- mss, 2004-01-13
   our $RUNNING_ON_WINDOWS = ($^O =~ /^(mswin|dos|os2)/oi);
-  our $SKIP_SPAMC_TESTS   = ($RUNNING_ON_WINDOWS && !$ENV{'SPAMD_HOST'}); 
+  our $NO_SPAMC_EXE = ($RUNNING_ON_WINDOWS &&
+                       !$ENV{'SPAMC_SCRIPT'} &&
+                       !(-e "../spamc/spamc.exe"));
+  our $SKIP_SPAMC_TESTS = ($NO_SPAMC_EXE ||
+                           ($RUNNING_ON_WINDOWS && !$ENV{'SPAMD_HOST'})); 
   our $SKIP_SPAMD_TESTS   = $RUNNING_ON_WINDOWS; 
 }
 

Modified: spamassassin/trunk/t/spamc.t
==============================================================================
--- spamassassin/trunk/t/spamc.t	(original)
+++ spamassassin/trunk/t/spamc.t	Sun Jun 27 19:38:35 2004
@@ -2,8 +2,9 @@
 
 use lib '.'; use lib 't';
 use SATest; sa_t_init("spamc");
-use Test; BEGIN { plan tests => 2 };
+use Test; BEGIN { plan tests => ($NO_SPAMC_EXE ? 0 : 2) };
 
+exit if $NO_SPAMC_EXE;
 # ---------------------------------------------------------------------------
 
 %patterns = (

Modified: spamassassin/trunk/t/spamc_l.t
==============================================================================
--- spamassassin/trunk/t/spamc_l.t	(original)
+++ spamassassin/trunk/t/spamc_l.t	Sun Jun 27 19:38:35 2004
@@ -2,7 +2,9 @@
 
 use lib '.'; use lib 't';
 use SATest; sa_t_init("spamc_l");
-use Test; BEGIN { plan tests => 3 };
+use Test; BEGIN { plan tests => ($NO_SPAMC_EXE ? 0 : 3) };
+
+exit if $NO_SPAMC_EXE;
 
 # ---------------------------------------------------------------------------