Index: packaging/Win32/build/win32-packager.pl
===================================================================
--- packaging/Win32/build/win32-packager.pl	(revision 26227)
+++ packaging/Win32/build/win32-packager.pl	(working copy)
@@ -825,6 +824,69 @@
              "make install"],
   comment => 'building and installing: msys fftw' ],
 
+[ always => [], 
+  write => [$sources.'flac-SIZE_T_MAX.patch', 
+'--- include/share/alloc.h	2008-06-29 21:43:05.000000000 +1000
++++ include/share/alloc.h	2008-08-13 14:38:33.000000000 +1000
+@@ -28,7 +28,7 @@
+  */
+ 
+ #include <limits.h> /* for SIZE_MAX */
+-#if !defined _MSC_VER && !defined __MINGW32__ && !defined __EMX__
++#if HAVE_STDINT_H
+ #include <stdint.h> /* for SIZE_MAX in case limits.h didn\'t get it */
+ #endif
+ #include <stdlib.h> /* for size_t, malloc(), etc */'],
+ comment => 'Write a patch to fix SIZE_T_MAX errors' ],
+
+[ always => [], 
+  write => [$sources.'flac-memcmp.patch',
+'--- examples/cpp/encode/file/main.cpp.orig	2007-09-13 09:58:03.000000000 -0600
++++ examples/cpp/encode/file/main.cpp	2007-11-18 12:59:45.000000000 -0600
+@@ -30,6 +30,7 @@
+ 
+ #include <stdio.h>
+ #include <stdlib.h>
++#include <cstring>
+ #include "FLAC++/metadata.h"
+ #include "FLAC++/encoder.h"
+ 
+--- examples/cpp/decode/file/main.cpp.orig	2008-09-14 20:37:05.000000000 +0200
++++ examples/cpp/decode/file/main.cpp	2008-09-14 20:37:19.000000000 +0200
+@@ -31,6 +31,7 @@
+ 
+ #include <stdio.h>
+ #include <stdlib.h>
++#include <cstring>
+ #include "FLAC++/decoder.h"
+ 
+ static FLAC__uint64 total_samples = 0;'],
+ comment => 'Write a patch to fix memcmp related errors' ],
+
+[ archive => $sources.'flac-1.2.1.tar.gz',  
+  fetch   => 'http://downloads.sourceforge.net/project/flac/flac-src/flac-1.2.1-src/flac-1.2.1.tar.gz'],
+[ dir     => $sources.'flac-1.2.1', 
+  extract => $sources.'flac-1.2.1.tar' ],
+
+[ grep  => ['#if HAVE_STDINT_H',
+            "$sources/flac-1.2.1/include/share/alloc.h"], 
+  shell => ["cd $sources/flac-1.2.1/",
+            'patch -p0 < '.$sources.'/flac-SIZE_T_MAX.patch'], 
+ comment => 'Apply SIZE_T_MAX patch to flac source' ],
+
+[ grep  => ['#include <cstring>',
+            "$sources/flac-1.2.1/examples/cpp/decode/file/main.cpp"], 
+  shell => ["cd $unixsources/flac-1.2.1/",
+            'patch -p0 < '.$sources.'/flac-memcmp.patch'], 
+ comment => 'Apply memcmp patch to flac source' ],
+
+[ file    => '/lib/libFLAC++.a', 
+  shell  => ["cd $unixsources/flac-1.2.1",
+             "./configure --prefix=/usr",
+             "make",
+             "make install"],
+  comment => 'building and installing: msys flac' ],
+
 # typical template:
 #[ archive => $sources.'xxx.tar.gz',  fetch => ''],
 #[ dir => $sources.'xxx', extract => $sources.'xxx.tar' ],
