You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by gb...@apache.org on 2023/11/06 08:23:53 UTC

svn commit: r1913610 - in /spamassassin/trunk/spamc: README.win configure.pl

Author: gbechis
Date: Mon Nov  6 08:23:53 2023
New Revision: 1913610

URL: http://svn.apache.org/viewvc?rev=1913610&view=rev
Log:
make spamc(1) build on Windows only with Strawberry Perl tools.
If Microsoft Windows Toolkit is installed, spamc.exe will be built
with Microsoft toolchain.
bz #8053

Modified:
    spamassassin/trunk/spamc/README.win
    spamassassin/trunk/spamc/configure.pl

Modified: spamassassin/trunk/spamc/README.win
URL: http://svn.apache.org/viewvc/spamassassin/trunk/spamc/README.win?rev=1913610&r1=1913609&r2=1913610&view=diff
==============================================================================
--- spamassassin/trunk/spamc/README.win (original)
+++ spamassassin/trunk/spamc/README.win Mon Nov  6 08:23:53 2023
@@ -33,6 +33,10 @@ To build SpamAssassin you must have inst
 and the modules that are listed as required in the general SpamAssassin
 documentation.
 
+Strawberry Perl provides a C compiler that is enough to build spamc.exe.
+If you want to use Microsoft Visual C++ instead, you should download
+Microsoft Visual C++ Toolkit from Microsoft website.
+
 Building spamc for Windows has been tested with Microsoft Visual C++ 6.0
 and with Microsoft Visual C++ Toolkit 2003. It will probably just work
 with any recent version of VC++. Some installation files would have to
@@ -73,7 +77,7 @@ by unpacking the source files into some
 /usr/local/src/spamassassin, then in a Cygwin bash shell
 
  cd /usr/local/src/spamassassin
- perl Makefile.PL
+ perl Makefile.PL BUILD_SPAMC=yes
  make
  make test
  make install

Modified: spamassassin/trunk/spamc/configure.pl
URL: http://svn.apache.org/viewvc/spamassassin/trunk/spamc/configure.pl?rev=1913610&r1=1913609&r2=1913610&view=diff
==============================================================================
--- spamassassin/trunk/spamc/configure.pl (original)
+++ spamassassin/trunk/spamc/configure.pl Mon Nov  6 08:23:53 2023
@@ -88,20 +88,34 @@ else
 {
   # These are the defaults for the Makefile.
   my %env = (
-    CC             => 'cl',
+    CC             => 'gcc',
 
-    WINCFLAGS      => '/DWIN32 /W4',
-    SSLCFLAGS      => '/DSPAMC_SSL',
+    WINCFLAGS      => '',
+    SSLCFLAGS      => '-DSPAMC_SSL',
 
     SRCDIR         =>  $srcdir,
 
-    WINLIBS        => 'ws2_32.lib',
-    SSLLIBS        => 'ssleay32.lib libeay32.lib',
+    WINLIBS        => '-lws2_32 -o spamc.exe',
+    SSLLIBS        => '-lcrypto -lssl',
 
     SPAMC_FILES    => 'spamc.c getopt.c',
     LIBSPAMC_FILES => 'libspamc.c utils.c',
   );
 
+  my $cl_found = 0;
+  foreach my $path (File::Spec->path()) {
+    if( -x $path . '\cl.exe' ) {
+      $cl_found = 1;
+    }
+  }
+  if($cl_found) {
+    $env{'CC'}        = 'cl';
+    $env{'WINCFLAGS'} = '/DWIN32 /W4';
+    $env{'SSLCFLAGS'} = '/DSPAMC_SSL';
+    $env{'WINLIBS'}   = 'ws2_32.lib';
+    $env{'SSLLIBS'}   = 'ssleay32.lib libeay32.lib';
+  }
+
   # Enable SSL only if requested.
   if ($args{'enable-ssl'} and $args{'enable-ssl'} ne 'yes') {
     delete $env{SSLCFLAGS};