You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2007/12/16 22:25:32 UTC

svn commit: r604709 - /spamassassin/branches/3.2/sa-compile.raw

Author: jm
Date: Sun Dec 16 13:25:32 2007
New Revision: 604709

URL: http://svn.apache.org/viewvc?rev=604709&view=rev
Log:
bug 5556: fix a variety of sa-compile portability issues, and support for 5.6.x perls

Modified:
    spamassassin/branches/3.2/sa-compile.raw

Modified: spamassassin/branches/3.2/sa-compile.raw
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.2/sa-compile.raw?rev=604709&r1=604708&r2=604709&view=diff
==============================================================================
--- spamassassin/branches/3.2/sa-compile.raw (original)
+++ spamassassin/branches/3.2/sa-compile.raw Sun Dec 16 13:25:32 2007
@@ -24,6 +24,7 @@
 use lib '@@INSTALLSITELIB@@';                   # substituted at 'make' time
 
 use File::Spec;
+use Config;
 
 BEGIN {                          # see comments in "spamassassin.raw" for doco
   my @bin = File::Spec->splitpath($0);
@@ -404,6 +405,8 @@
     }
   }
 
+  my $ccopt = $Config{optimize};      # typically "-O2"
+
   open(FILE, ">Makefile.PL") || die "write Makefile.PL: $!";
   print FILE <<"EOT";
     use ExtUtils::MakeMaker;
@@ -413,10 +416,11 @@
 	'VERSION_FROM' => '$PMFILE',
 	'ABSTRACT_FROM' => '$PMFILE',
 	'OBJECT' => '\$(O_FILES)',
-	'OPTIMIZE' => '-O2',
+	'OPTIMIZE' => '$ccopt',
 	'AUTHOR' => 'A. U. Tomated <au...@example.com>',
     );
 EOT
+  close FILE or die "write Makefile.PL: $!";
 
   open(FILE, ">MANIFEST.SKIP") || die "write MANIFEST.SKIP: $!";
   print FILE <<'EOT';
@@ -437,6 +441,7 @@
 ^pm_to_blib$
 ~$
 EOT
+  close FILE or die "write MANIFEST.SKIP: $!";
 
   open(my $re, ">$XSFILE") || die "write $XSFILE: $!";
   print $re <<"EOT";
@@ -444,6 +449,16 @@
 #include "perl.h"
 #include "XSUB.h"
 
+  /* bug 5556: newSVpvn_share() is not a defined API in perl 5.6.x.
+   * Thankfully we can use newSVpvn() without much harm, losing only
+   * a tiny bit of performance (I'd reckon ;).
+   */
+#ifdef newSVpvn_share
+#define my_newSVpvn_share(x,y,z)    newSVpvn_share(x,y,z)
+#else
+#define my_newSVpvn_share(x,y,z)    newSVpvn(x,y)
+#endif
+
   /* split single-space-separated result string */
   static void
   split_and_add (AV *results, char *match)
@@ -453,12 +468,12 @@
       for (cp = wordstart = match; *cp != (unsigned char) 0; cp++) {
 	if (*cp == ' ') {
 	  av_push(results,
-	      newSVpvn_share(wordstart, cp-wordstart, (U32)0));
+	      my_newSVpvn_share(wordstart, cp-wordstart, (U32)0));
 	  wordstart = cp + 1;
 	}
       }
       av_push(results,
-	      newSVpvn_share(wordstart, cp-wordstart, (U32)0));
+	      my_newSVpvn_share(wordstart, cp-wordstart, (U32)0));
   }
 
 EOT
@@ -574,7 +589,7 @@
 
   $str =~ s/^fnord//gm;
   print FILE $str;
-
+  close FILE or die "write $PMFILE: $!";
 }
 
 sub fixup_re {