diff -u -r -N ThirdParty.orig/Perl/Makefile ThirdParty/Perl/Makefile
--- ThirdParty.orig/Perl/Makefile	2007-09-04 15:17:57.000000000 -0700
+++ ThirdParty/Perl/Makefile	2007-10-01 17:25:10.393972000 -0700
@@ -115,7 +115,7 @@
 PERL_MM_USE_DEFAULT	:= 1
 export PERL_MM_USE_DEFAULT
 
-JAVA_HOME		:= /usr/local/java
+JAVA_HOME		?= /usr/local/java
 export JAVA_HOME
 
 TMPDIR	:= tmp
@@ -176,7 +176,7 @@
 	done
 
 	@echo -n "Compiling perl lib DBD::mysql ..."; \
-	$(PERL) -I$(DEST_LIB_DIR) -MCPAN -e 'get DBI; $$CPAN::Config->{makepl_arg}.=" --nocatchstderr --mysql_config=\"/opt/zimbra/mysql/bin/mysql_config\" --libs=\"-L/opt/zimbra/mysql/lib -lmysqlclient -lz -lm\" --cflags=\" -I$(MYSQL_INCLUDE) -Os -fno-common\" "; $$CPAN::Config->{make_arg} .=" LD_RUN_PATH=/opt/zimbra/mysql/lib"; force ("install", "DBD::mysql")' >> $(LOGFILE) 2>&1; \
+	$(PERL) -I$(DEST_LIB_DIR) -MCPAN -e 'get DBI; $$CPAN::Config->{makepl_arg}.=" --nocatchstderr --mysql_config=\"/opt/zimbra/mysql/bin/mysql_config\" --libs=\"-L/opt/zimbra/mysql/lib -R/opt/zimbra/mysql/lib -lmysqlclient -lz -lm\" --cflags=\" -I$(MYSQL_INCLUDE) -Os -fno-common\" "; $$CPAN::Config->{make_arg} .=" LD_RUN_PATH=/opt/zimbra/mysql/lib"; force ("install", "DBD::mysql")' >> $(LOGFILE) 2>&1; \
 	if [ $$? -ne 0 ]; then  echo "FAILED.";  else  echo "done.";  fi \
 
 	@for lib in $(SA_PERL_LIBS); do \
@@ -243,7 +243,7 @@
 
 DBD:
 	echo "Compiling perl lib DBD::mysql"; \
-	$(PERL) -I$(DEST_LIB_DIR) -MCPAN -e 'get DBI; $$CPAN::Config->{makepl_arg}.=" --nocatchstderr --mysql_config=\"/opt/zimbra/mysql/bin/mysql_config\" --libs=\"-L/opt/zimbra/mysql/lib -lmysqlclient -lz -lm\" --cflags=\" -I$(MYSQL_INCLUDE) -Os -fno-common\" "; $$CPAN::Config->{make_arg} .=" LD_RUN_PATH=/opt/zimbra/mysql/lib"; force ("install", "DBD::mysql")' ; \
+	$(PERL) -I$(DEST_LIB_DIR) -MCPAN -e 'get DBI; $$CPAN::Config->{makepl_arg}.=" --nocatchstderr --mysql_config=\"/opt/zimbra/mysql/bin/mysql_config\" --libs=\"-L/opt/zimbra/mysql/lib -R/opt/zimbra/mysql/lib -lmysqlclient -lz -lm\" --cflags=\" -I$(MYSQL_INCLUDE) -Os -fno-common\" "; $$CPAN::Config->{make_arg} .=" LD_RUN_PATH=/opt/zimbra/mysql/lib"; force ("install", "DBD::mysql")' ; \
 
 
 setup:
diff -u -r -N ThirdParty.orig/Perl/MyConfig.pm.template ThirdParty/Perl/MyConfig.pm.template
--- ThirdParty.orig/Perl/MyConfig.pm.template	2007-09-04 15:17:57.000000000 -0700
+++ ThirdParty/Perl/MyConfig.pm.template	2007-09-13 15:27:02.662956000 -0700
@@ -42,7 +42,7 @@
   'tar' => q[@@TAR@@],
   'term_is_latin' => q[1],
   'unzip' => q[@@UNZIP@@],
-  'urllist' => [q[http://inside.zimbra.com/public/software/shared/CPAN/],],
+  'urllist' => [q[ftp://ftp.perl.org/pub/CPAN/],],
   'wget' => q[@@WGET@@],
 };
 1;
diff -u -r -N ThirdParty.orig/PostFix/Makefile ThirdParty/PostFix/Makefile
--- ThirdParty.orig/PostFix/Makefile	2007-09-04 15:17:25.000000000 -0700
+++ ThirdParty/PostFix/Makefile	2007-09-13 13:38:47.225539000 -0700
@@ -67,6 +67,22 @@
 	PCRE_LIB := -L/opt/zimbra/lib -lpcre
 endif
 
+MYSQLDIR := /opt/zimbra/mysql-$(MYSQL_VERSION)/lib
+ifeq ($(BUILD_PLATFORM), SOLARIS10)
+	PCRE_DEF := -DHAS_PCRE
+	PCRE_INCLUDE := -I/opt/csw/include
+	PCRE_LIB := -L/opt/csw/lib -R/opt/csw/lib -lpcre
+	PATCH := gpatch
+	DBLIB := -L/opt/zimbra/sleepycat-4.2.52.6/lib -R/opt/zimbra/sleepycat-4.2.52.6/lib
+	SASLLIB := -L/opt/zimbra/cyrus-sasl-$(SASL_VERSION)/lib -R/opt/zimbra/cyrus-sasl-$(SASL_VERSION)/lib
+	LDAPLIB := -L/opt/zimbra/openldap-$(LDAP_VERSION)/lib -R/opt/zimbra/openldap-$(LDAP_VERSION)/lib
+	MYSQLLIB := -L$(MYSQLDIR) -R$(MYSQLDIR) -L$(MYSQLDIR)/mysql -R$(MYSQLDIR)/mysql
+endif
+PATCH ?= patch
+SASLLIB ?= -L/opt/zimbra/cyrus-sasl-$(SASL_VERSION)/lib
+LDAPLIB ?= -L/opt/zimbra/openldap-$(LDAP_VERSION)/lib
+MYSQLLIB ?= -L$(MYSQLDIR)
+
 all: prep build install tar
 
 prep:
@@ -78,9 +94,9 @@
 	(tar xzf postfix-$(POSTFIX_RELEASE).tar.gz; \
 	mv postfix-$(POSTFIX_RELEASE) postfix-$(POSTFIX_VERSION); \
 	cd postfix-$(POSTFIX_VERSION); \
-	patch -g0 -p1 < ../postfix-ldap-sasl.patch; \
-	patch -g0 -p1 < ../postfix-zimbra-bdb.patch; \
-	patch -g0 -p1 < ../postfix-main-cf-zimbra.patch; \
+	$(PATCH) -g0 -p1 < ../postfix-ldap-sasl.patch; \
+	$(PATCH) -g0 -p1 < ../postfix-zimbra-bdb.patch; \
+	$(PATCH) -g0 -p1 < ../postfix-main-cf-zimbra.patch; \
 	make makefiles \
 	OPT="-O2" \
 	DEBUG="-g" \
@@ -103,10 +119,7 @@
 	-I/opt/zimbra/mysql-$(MYSQL_VERSION)/include \
 	-I/opt/zimbra/mysql-$(MYSQL_VERSION)/include/mysql \
 	-I/opt/zimbra/cyrus-sasl-$(SASL_VERSION)/include/sasl -I/usr/include -I/usr/kerberos/include' \
-	AUXLIBS='-L/opt/zimbra/cyrus-sasl-$(SASL_VERSION)/lib \
-	$(DBLIB) -ldb -L/opt/zimbra/openldap-$(LDAP_VERSION)/lib $(PCRE_LIB) \
-	-lldap -llber -L/opt/zimbra/mysql-$(MYSQL_VERSION)/lib \
-	-L/opt/zimbra/mysql-$(MYSQL_VERSION)/lib/mysql \
+	AUXLIBS='$(SASLLIB) $(DBLIB) -ldb $(LDAPLIB) $(PCRE_LIB) -lldap -llber $(MYSQLLIB) \
 	-lmysqlclient -lz -lm -L$(SYSTEM_LIB) -lsasl2 -lpthread -lssl -lcrypto'; \
 	env LD_RUN_PATH=$(LD_RUN_PATH) make;)
 
diff -u -r -N ThirdParty.orig/aspell/Makefile ThirdParty/aspell/Makefile
--- ThirdParty.orig/aspell/Makefile	2007-09-04 15:12:16.000000000 -0700
+++ ThirdParty/aspell/Makefile	2007-09-13 11:29:47.257529000 -0700
@@ -7,6 +7,12 @@
         BUILD_PLATFORM := "UNKNOWN"
 endif
 
+ifeq ($(BUILD_PLATFORM),SOLARIS10)
+	CC=/opt/csw/gcc3/bin/gcc
+	CXX=/opt/csw/gcc3/bin/g++
+	export CC CXX
+endif
+
 ZIMBRA_HOME ?= /opt/zimbra
 
 ASPELL_VERSION := 0.60.5
@@ -29,7 +35,7 @@
 	(cd $(ZIMBRA_HOME); ln -s aspell-$(ASPELL_VERSION) aspell)
 
 dict-install:
-	export PATH=$(ZIMBRA_HOME)/aspell-$(ASPELL_VERSION)/bin:$$PATH
+	PATH=$(ZIMBRA_HOME)/aspell-$(ASPELL_VERSION)/bin:$$PATH; export PATH
 	for dict in $(ASPELL_DICTS); do \
 		tar xjf $$dict.tar.bz2; \
 		(cd $$dict; PATH=$(ZIMBRA_HOME)/aspell-$(ASPELL_VERSION)/bin:$$PATH ./configure; \
diff -u -r -N ThirdParty.orig/clamav/Makefile ThirdParty/clamav/Makefile
--- ThirdParty.orig/clamav/Makefile	2007-09-04 15:12:27.000000000 -0700
+++ ThirdParty/clamav/Makefile	2007-09-13 11:42:43.231998000 -0700
@@ -27,7 +27,7 @@
 tar:
 	mkdir -p $(P4_ROOT)/ThirdPartyBuilds/$(BUILD_PLATFORM)/clamav
 	(cd $(ZIMBRA_HOME); tar czf $(CLAMAV_TGZ_TARGET) clamav-$(CLAMAV_VERSION))
-	chmod -R a+w $(CLAMAV_ROOT)/builds/$(BUILD_PLATFORM)
+	chmod -R a+w $(P4_ROOT)/ThirdPartyBuilds/$(BUILD_PLATFORM)/clamav
 
 p4edit: $(CLAMAV_TGZ_TARGET)
 	p4 add $(CLAMAV_TGZ_TARGET)
diff -u -r -N ThirdParty.orig/cyrus-sasl/zimbra-cyrus-sasl-build.sh ThirdParty/cyrus-sasl/zimbra-cyrus-sasl-build.sh
--- ThirdParty.orig/cyrus-sasl/zimbra-cyrus-sasl-build.sh	2007-09-04 15:09:55.000000000 -0700
+++ ThirdParty/cyrus-sasl/zimbra-cyrus-sasl-build.sh	2007-09-13 10:23:41.180825000 -0700
@@ -33,9 +33,18 @@
 mv ${release} ${src}
 
 cd ${src}
-patch -g0 -p1 < ../../sasl-link-order.patch
-patch -g0 -p1 < ../../sasl-darwin.patch
-patch -g0 -p1 < ../../sasl-auth-zimbra.patch
+
+if [ -x /usr/bin/gpatch ]; then
+	# Solaris
+	gpatch -g0 -p1 < ../../sasl-link-order.patch
+	gpatch -g0 -p1 < ../../sasl-darwin.patch
+	gpatch -g0 -p1 < ../../sasl-auth-zimbra.patch
+else
+	patch -g0 -p1 < ../../sasl-link-order.patch
+	patch -g0 -p1 < ../../sasl-darwin.patch
+	patch -g0 -p1 < ../../sasl-auth-zimbra.patch
+fi
+
 rm config/ltconfig config/libtool.m4
 if [ -x /usr/bin/libtoolize ]; then
 	LIBTOOLIZE=/usr/bin/libtoolize
@@ -44,8 +53,12 @@
 		export CPPFLAGS=-DDARWIN
 		LIBTOOLIZE=/opt/local/bin/glibtoolize
 	else
-		echo "Where is libtoolize?"
-		exit 1
+		if [ -x /opt/csw/bin/libtoolize ]; then
+			LIBTOOLIZE=/opt/csw/bin/libtoolize
+		else
+			echo "Where is libtoolize?"
+			exit 1
+		fi
 	fi
 fi
 $LIBTOOLIZE -f -c
@@ -62,6 +75,17 @@
 autoheader
 autoconf -f
 
+# Check for Solaris
+grep "Solaris 10" /etc/release >/dev/null 2>&1
+if [ $? -eq 0 ]; then
+    PRESOLOPTS="-I/opt/csw/include/libxml2"
+    POSTSOLOPTS="--with-openssl=/opt/csw"
+else
+    PRESOLOPTS=""
+    POSTSOLOPTS=""
+fi
+
+
 cd ..
 sed -i.bak 's/-lRSAglue //' configure
 if [ $platform = "Darwin" ]; then
@@ -76,11 +100,11 @@
             --with-dblib=no \
             --enable-login
 else 
-LIBS="/opt/zimbra/libxml2/lib/libxml2.a" CFLAGS="-D_REENTRANT -g -O2" ./configure --enable-zimbra --prefix=/opt/zimbra/${src} \
+LIBS="/opt/zimbra/libxml2/lib/libxml2.a" CFLAGS="-D_REENTRANT -g -O2" CPPFLAGS="${PRESOLOPTS}" ./configure --enable-zimbra --prefix=/opt/zimbra/${src} \
             --with-saslauthd=/opt/zimbra/${src}/state \
             --with-plugindir=/opt/zimbra/${src}/lib/sasl2 \
             --with-dblib=no \
-            --enable-login
+            --enable-login ${POSTSOLOPTS}
 fi
 if [ $platform = "Darwin" ]; then
      sed -i .bak -e 's/\_la_LDFLAGS)/_la_LDFLAGS) $(AM_LDFLAGS)/' plugins/Makefile
diff -u -r -N ThirdParty.orig/libxml2/Makefile ThirdParty/libxml2/Makefile
--- ThirdParty.orig/libxml2/Makefile	2007-09-04 15:09:40.000000000 -0700
+++ ThirdParty/libxml2/Makefile	2007-09-13 12:15:26.230552000 -0700
@@ -20,6 +20,10 @@
 	#ENVMOD := env LIBS="-lresolv" 
 #endif
 
+ifeq ($(BUILD_PLATFORM), SOLARIS10)
+	APP_CONFIGURE := $(APP_CONFIGURE) --with-iconv=/opt/csw
+endif
+
 all: build tar
 
 build: $(APP_NAME)-$(APP_VERSION)
diff -u -r -N ThirdParty.orig/memcached/Makefile ThirdParty/memcached/Makefile
--- ThirdParty.orig/memcached/Makefile	2007-09-04 15:27:01.000000000 -0700
+++ ThirdParty/memcached/Makefile	2007-09-15 00:00:26.279764000 -0700
@@ -7,6 +7,11 @@
 	BUILD_PLATFORM := "UNKNOWN"
 endif
 
+SOLPATCH := 
+ifeq ($(BUILD_PLATFORM), SOLARIS10)
+	SOLPATCH := gpatch -p0 < ../solaris.libevent.patch
+endif
+
 ZIMBRA_HOME ?= /opt/zimbra
 
 LIBEVENT_VERSION ?=1.3b
@@ -21,6 +26,7 @@
 build:
 	(tar xfz libevent-$(LIBEVENT_VERSION).tar.gz; \
 	cd libevent-$(LIBEVENT_VERSION); \
+	$(SOLPATCH); \
 	CFLAGS="-g -O2" ./configure --prefix=$(ZIMBRA_HOME)/memcached-$(MEMCACHED_VERSION); \
 	make; make install; \
 	cd $(MEMCACHED_ROOT); \
diff -u -r -N ThirdParty.orig/memcached/solaris.libevent.patch ThirdParty/memcached/solaris.libevent.patch
--- ThirdParty.orig/memcached/solaris.libevent.patch	1969-12-31 16:00:00.000000000 -0800
+++ ThirdParty/memcached/solaris.libevent.patch	2007-09-15 00:33:08.117527000 -0700
@@ -0,0 +1,266 @@
+--- configure.orig      Sat Sep 15 00:32:30 2007
++++ configure   Sat Sep 15 00:31:47 2007
+@@ -19927,7 +19927,7 @@
+ #define HAVE_LIBSOCKET 1
+ _ACEOF
+ 
+-  LIBS="-lsocket $LIBS"
++  LIBS="-lsocket -lnsl -lresolv $LIBS"
+ 
+ fi
+ 
+
+--- configure.in.bak	2007-05-04 13:46:45.000000000 -0700
++++ configure.in	2007-05-04 14:06:13.000000000 -0700
+@@ -35,6 +35,8 @@
+ 
+ dnl Checks for libraries.
+ AC_CHECK_LIB(socket, socket)
++AC_CHECK_LIB(resolv, inet_aton)
++AC_CHECK_LIB(nsl, inet_ntoa)
+ 
+ dnl Checks for header files.
+ AC_HEADER_STDC
+--- event.h.bak	2007-05-04 13:46:45.000000000 -0700
++++ event.h	2007-05-04 13:46:45.000000000 -0700
+@@ -299,39 +299,39 @@
+ 
+ void evtag_init(void);
+ 
+-void evtag_marshal(struct evbuffer *evbuf, u_int8_t tag, const void *data,
+-    u_int32_t len);
++void evtag_marshal(struct evbuffer *evbuf, unsigned char tag, const void *data,
++    unsigned int len);
+ 
+-void encode_int(struct evbuffer *evbuf, u_int32_t number);
++void encode_int(struct evbuffer *evbuf, unsigned int number);
+ 
+-void evtag_marshal_int(struct evbuffer *evbuf, u_int8_t tag,
+-    u_int32_t integer);
++void evtag_marshal_int(struct evbuffer *evbuf, unsigned char tag,
++    unsigned int integer);
+ 
+-void evtag_marshal_string(struct evbuffer *buf, u_int8_t tag,
++void evtag_marshal_string(struct evbuffer *buf, unsigned char tag,
+     const char *string);
+ 
+-void evtag_marshal_timeval(struct evbuffer *evbuf, u_int8_t tag,
++void evtag_marshal_timeval(struct evbuffer *evbuf, unsigned char tag,
+     struct timeval *tv);
+ 
+ void evtag_test(void);
+ 
+-int evtag_unmarshal(struct evbuffer *src, u_int8_t *ptag,
++int evtag_unmarshal(struct evbuffer *src, unsigned char *ptag,
+     struct evbuffer *dst);
+-int evtag_peek(struct evbuffer *evbuf, u_int8_t *ptag);
+-int evtag_peek_length(struct evbuffer *evbuf, u_int32_t *plength);
+-int evtag_payload_length(struct evbuffer *evbuf, u_int32_t *plength);
++int evtag_peek(struct evbuffer *evbuf, unsigned char *ptag);
++int evtag_peek_length(struct evbuffer *evbuf, unsigned int *plength);
++int evtag_payload_length(struct evbuffer *evbuf, unsigned int *plength);
+ int evtag_consume(struct evbuffer *evbuf);
+ 
+-int evtag_unmarshal_int(struct evbuffer *evbuf, u_int8_t need_tag,
+-    u_int32_t *pinteger);
++int evtag_unmarshal_int(struct evbuffer *evbuf, unsigned char need_tag,
++    unsigned int *pinteger);
+ 
+-int evtag_unmarshal_fixed(struct evbuffer *src, u_int8_t need_tag, void *data,
++int evtag_unmarshal_fixed(struct evbuffer *src, unsigned char need_tag, void *data,
+     size_t len);
+ 
+-int evtag_unmarshal_string(struct evbuffer *evbuf, u_int8_t need_tag,
++int evtag_unmarshal_string(struct evbuffer *evbuf, unsigned char need_tag,
+     char **pstring);
+ 
+-int evtag_unmarshal_timeval(struct evbuffer *evbuf, u_int8_t need_tag,
++int evtag_unmarshal_timeval(struct evbuffer *evbuf, unsigned char need_tag,
+     struct timeval *ptv);
+ 
+ #ifdef __cplusplus
+--- test/regress.c.bak	2007-05-04 13:46:45.000000000 -0700
++++ test/regress.c	2007-05-04 13:46:45.000000000 -0700
+@@ -673,7 +673,7 @@
+    cleanup_test();
+ }
+ 
+-int decode_int(u_int32_t *pnumber, struct evbuffer *evbuf);
++int decode_int(unsigned int *pnumber, struct evbuffer *evbuf);
+ 
+ void
+ read_once_cb(int fd, short event, void *arg)
+@@ -724,10 +724,10 @@
+ evtag_int_test(void)
+ {
+ 	struct evbuffer *tmp = evbuffer_new();
+-	u_int32_t integers[TEST_MAX_INT] = {
++	unsigned int integers[TEST_MAX_INT] = {
+ 		0xaf0, 0x1000, 0x1, 0xdeadbeef, 0x00, 0xbef000
+ 	};
+-	u_int32_t integer;
++	unsigned int integer;
+ 	int i;
+ 
+ 	for (i = 0; i < TEST_MAX_INT; i++) {
+--- test/regress.gen.c.bak	2007-05-04 13:46:45.000000000 -0700
++++ test/regress.gen.c	2007-05-04 13:46:45.000000000 -0700
+@@ -273,7 +273,7 @@
+ int
+ msg_unmarshal(struct msg *tmp,  struct evbuffer *evbuf)
+ {
+-  u_int8_t tag;
++  unsigned char tag;
+   while (EVBUFFER_LENGTH(evbuf) > 0) {
+     if (evtag_peek(evbuf, &tag) == -1)
+       return (-1);
+@@ -357,9 +357,9 @@
+ }
+ 
+ int
+-evtag_unmarshal_msg(struct evbuffer *evbuf, u_int8_t need_tag,  struct msg *msg)
++evtag_unmarshal_msg(struct evbuffer *evbuf, unsigned char need_tag,  struct msg *msg)
+ {
+-  u_int8_t tag;
++  unsigned char tag;
+   int res = -1;
+ 
+   struct evbuffer *tmp = evbuffer_new();
+@@ -378,7 +378,7 @@
+ }
+ 
+ void
+-evtag_marshal_msg(struct evbuffer *evbuf, u_int8_t tag, const struct msg *msg)
++evtag_marshal_msg(struct evbuffer *evbuf, unsigned char tag, const struct msg *msg)
+ {
+   struct evbuffer *_buf = evbuffer_new();
+   assert(_buf != NULL);
+@@ -489,7 +489,7 @@
+ int
+ kill_unmarshal(struct kill *tmp,  struct evbuffer *evbuf)
+ {
+-  u_int8_t tag;
++  unsigned char tag;
+   while (EVBUFFER_LENGTH(evbuf) > 0) {
+     if (evtag_peek(evbuf, &tag) == -1)
+       return (-1);
+@@ -538,9 +538,9 @@
+ }
+ 
+ int
+-evtag_unmarshal_kill(struct evbuffer *evbuf, u_int8_t need_tag,  struct kill *msg)
++evtag_unmarshal_kill(struct evbuffer *evbuf, unsigned char need_tag,  struct kill *msg)
+ {
+-  u_int8_t tag;
++  unsigned char tag;
+   int res = -1;
+ 
+   struct evbuffer *tmp = evbuffer_new();
+@@ -559,7 +559,7 @@
+ }
+ 
+ void
+-evtag_marshal_kill(struct evbuffer *evbuf, u_int8_t tag, const struct kill *msg)
++evtag_marshal_kill(struct evbuffer *evbuf, unsigned char tag, const struct kill *msg)
+ {
+   struct evbuffer *_buf = evbuffer_new();
+   assert(_buf != NULL);
+@@ -636,7 +636,7 @@
+ int
+ run_unmarshal(struct run *tmp,  struct evbuffer *evbuf)
+ {
+-  u_int8_t tag;
++  unsigned char tag;
+   while (EVBUFFER_LENGTH(evbuf) > 0) {
+     if (evtag_peek(evbuf, &tag) == -1)
+       return (-1);
+@@ -672,9 +672,9 @@
+ }
+ 
+ int
+-evtag_unmarshal_run(struct evbuffer *evbuf, u_int8_t need_tag,  struct run *msg)
++evtag_unmarshal_run(struct evbuffer *evbuf, unsigned char need_tag,  struct run *msg)
+ {
+-  u_int8_t tag;
++  unsigned char tag;
+   int res = -1;
+ 
+   struct evbuffer *tmp = evbuffer_new();
+@@ -693,7 +693,7 @@
+ }
+ 
+ void
+-evtag_marshal_run(struct evbuffer *evbuf, u_int8_t tag, const struct run *msg)
++evtag_marshal_run(struct evbuffer *evbuf, unsigned char tag, const struct run *msg)
+ {
+   struct evbuffer *_buf = evbuffer_new();
+   assert(_buf != NULL);
+--- test/regress.gen.h.bak	2007-05-04 13:46:45.000000000 -0700
++++ test/regress.gen.h	2007-05-04 13:46:45.000000000 -0700
+@@ -41,10 +41,10 @@
+   int (*run_get)(struct msg *, int, struct run **);
+   struct run *(*run_add)(struct msg *);
+ 
+-  u_int8_t from_name_set;
+-  u_int8_t to_name_set;
+-  u_int8_t kill_set;
+-  u_int8_t run_set;
++  unsigned char from_name_set;
++  unsigned char to_name_set;
++  unsigned char kill_set;
++  unsigned char run_set;
+ };
+ 
+ struct msg *msg_new();
+@@ -53,8 +53,8 @@
+ void msg_marshal(struct evbuffer *, const struct msg *);
+ int msg_unmarshal(struct msg *, struct evbuffer *);
+ int msg_complete(struct msg *);
+-void evtag_marshal_msg(struct evbuffer *, u_int8_t, const struct msg *);
+-int evtag_unmarshal_msg(struct evbuffer *, u_int8_t, struct msg *);
++void evtag_marshal_msg(struct evbuffer *, unsigned char, const struct msg *);
++int evtag_unmarshal_msg(struct evbuffer *, unsigned char, struct msg *);
+ int msg_from_name_assign(struct msg *, const char *);
+ int msg_from_name_get(struct msg *, char * *);
+ int msg_to_name_assign(struct msg *, const char *);
+@@ -82,8 +82,8 @@
+   int (*action_assign)(struct kill *, const char *);
+   int (*action_get)(struct kill *, char * *);
+ 
+-  u_int8_t weapon_set;
+-  u_int8_t action_set;
++  unsigned char weapon_set;
++  unsigned char action_set;
+ };
+ 
+ struct kill *kill_new();
+@@ -92,8 +92,8 @@
+ void kill_marshal(struct evbuffer *, const struct kill *);
+ int kill_unmarshal(struct kill *, struct evbuffer *);
+ int kill_complete(struct kill *);
+-void evtag_marshal_kill(struct evbuffer *, u_int8_t, const struct kill *);
+-int evtag_unmarshal_kill(struct evbuffer *, u_int8_t, struct kill *);
++void evtag_marshal_kill(struct evbuffer *, unsigned char, const struct kill *);
++int evtag_unmarshal_kill(struct evbuffer *, unsigned char, struct kill *);
+ int kill_weapon_assign(struct kill *, const char *);
+ int kill_weapon_get(struct kill *, char * *);
+ int kill_action_assign(struct kill *, const char *);
+@@ -112,7 +112,7 @@
+   int (*how_assign)(struct run *, const char *);
+   int (*how_get)(struct run *, char * *);
+ 
+-  u_int8_t how_set;
++  unsigned char how_set;
+ };
+ 
+ struct run *run_new();
+@@ -121,8 +121,8 @@
+ void run_marshal(struct evbuffer *, const struct run *);
+ int run_unmarshal(struct run *, struct evbuffer *);
+ int run_complete(struct run *);
+-void evtag_marshal_run(struct evbuffer *, u_int8_t, const struct run *);
+-int evtag_unmarshal_run(struct evbuffer *, u_int8_t, struct run *);
++void evtag_marshal_run(struct evbuffer *, unsigned char, const struct run *);
++int evtag_unmarshal_run(struct evbuffer *, unsigned char, struct run *);
+ int run_how_assign(struct run *, const char *);
+ int run_how_get(struct run *, char * *);
diff -u -r -N ThirdParty.orig/mysql/Makefile ThirdParty/mysql/Makefile
--- ThirdParty.orig/mysql/Makefile	2007-09-04 15:08:55.000000000 -0700
+++ ThirdParty/mysql/Makefile	2007-09-12 23:21:45.631201000 -0700
@@ -35,7 +35,7 @@
 	mkdir -p $(ZIMBRA_HOME)
 	(cd $(ZIMBRA_HOME); tar xzf $(MYSQL_TGZ_TARGET))
 	-(cd $(ZIMBRA_HOME)/mysql-$(MYSQL_VERSION)/lib; \
-	tar xzf $(MYSQL_CLIENT_TGZ_TARGET)
+	tar xzf $(MYSQL_CLIENT_TGZ_TARGET))
 	cp -f $(ZIMBRA_HOME)/mysql-$(MYSQL_VERSION)/include/mysql/* $(ZIMBRA_HOME)/mysql-$(MYSQL_VERSION)/include
 
 symlink:
@@ -46,7 +46,8 @@
 clean: ;
 
 clientlibs: builddynamic
-	-(cd $(ZIMBRA_HOME)/mysql-$(MYSQL_VERSION)/lib/mysql ; tar czvf $(MYSQL_CLIENT_TGZ_TARGET) libmysqlclient.*{so,dylib}*)
+	mkdir $(MYSQL_ROOT)/$(BUILD_PLATFORM)
+	-(cd $(ZIMBRA_HOME)/mysql-$(MYSQL_VERSION)/lib/mysql ; tar czvf $(MYSQL_CLIENT_TGZ_TARGET) libmysqlclient.*so* libmysqlclient.*dylib*)
 
 buildstatic:
 	rm -rf mysql-$(MYSQL_VERSION_STRING)
diff -u -r -N ThirdParty.orig/nginx/Makefile ThirdParty/nginx/Makefile
--- ThirdParty.orig/nginx/Makefile	2007-09-04 15:27:08.000000000 -0700
+++ ThirdParty/nginx/Makefile	2007-09-15 02:40:06.943382000 -0700
@@ -8,6 +8,13 @@
 endif
 
 CFLAGS := "-g -O2"
+LD_OPT := 
+
+ifeq ($(BUILD_PLATFORM), SOLARIS10)
+        CFLAGS := "-g -O2 -I/opt/csw/include -L/opt/csw/lib"
+	LD_OPT := "-L/opt/csw/lib -R/opt/csw/lib"
+endif
+
 
 ifeq ($(BUILD_PLATFORM), RPL1)
 	CFLAGS := "-g -O2 -DOPENSSL_NO_KRB5"
@@ -23,17 +30,18 @@
 
 build:
 	(cd nginx-$(NGINX_VERSION)-zimbra; \
-	CFLAGS=$(CFLAGS) ./configure \
+	CFLAGS=$(CFLAGS) LINK=$(LINK) ./configure \
              --prefix=$(ZIMBRA_HOME)/nginx-$(NGINX_VERSION)-zimbra \
              --with-debug \
              --without-http  \
              --with-mail \
+	     --with-ld-opt=$(LD_OPT) \
              --with-mail_ssl_module; \
 	make; make install)
 	ln -s $(NGINX_INSTALL) $(ZIMBRA_HOME)/nginx
 
 tar:
-	mkdir -p $(P4_ROOT)/ThirdPartyBuilds/$(BUILD_PLATFORM)
+	mkdir -p $(P4_ROOT)/ThirdPartyBuilds/$(BUILD_PLATFORM)/nginx
 	(cd $(ZIMBRA_HOME); tar czf $(NGINX_TGZ_TARGET) nginx-$(NGINX_VERSION)-zimbra)
 
 p4edit: $(NGINX_TGZ_TARGET)
diff -u -r -N ThirdParty.orig/openldap/Makefile ThirdParty/openldap/Makefile
--- ThirdParty.orig/openldap/Makefile	2007-09-04 15:10:47.000000000 -0700
+++ ThirdParty/openldap/Makefile	2007-09-13 10:45:05.413213000 -0700
@@ -18,6 +18,12 @@
 	ENVMOD := env LIBS="-lresolv" 
 endif
 
+ifeq ($(BUILD_PLATFORM), SOLARIS10)
+	PATCH := gpatch
+endif
+PATCH ?= patch
+
+
 ZIMBRA_HOME ?= /opt/zimbra
 LDAP_RELEASE ?= 2.3.37
 LDAP_PATCH_LEVEL ?= 7
@@ -31,9 +37,9 @@
 	(tar xzf openldap-$(LDAP_RELEASE).tgz; \
 	mv openldap-$(LDAP_RELEASE) openldap-$(LDAP_VERSION); \
 	cd openldap-$(LDAP_VERSION); \
-	patch -p1 < ../ITS5037.patch; \
-	patch -p1 < ../ITS5052.patch; \
-	patch -p1 < ../init-null.patch; \
+	$(PATCH) -p1 < ../ITS5037.patch; \
+	$(PATCH) -p1 < ../ITS5052.patch; \
+	$(PATCH) -p1 < ../init-null.patch; \
 	LD_LIBRARY_PATH=/opt/zimbra/sleepycat-$(BDB_VERSION)/lib \
 	CPPFLAGS="-I/opt/zimbra/sleepycat-$(BDB_VERSION)/include -I/usr/kerberos/include -I/opt/zimbra/cyrus-sasl-$(SASL_VERSION)/include" \
 	LDFLAGS="-L/opt/zimbra/sleepycat-$(BDB_VERSION)/lib -L/opt/zimbra/cyrus-sasl-$(SASL_VERSION)/lib" \
diff -u -r -N ThirdParty.orig/php/Makefile ThirdParty/php/Makefile
--- ThirdParty.orig/php/Makefile	2007-09-04 15:16:51.000000000 -0700
+++ ThirdParty/php/Makefile	2007-09-15 02:38:46.475978000 -0700
@@ -15,11 +15,14 @@
 ifeq ($(BUILD_PLATFORM), SuSEES9)
 	LIBXML2 := --with-libxml-dir=/opt/zimbra/libxml2-$(LIBXML2_VERSION)
 endif
+ifeq ($(BUILD_PLATFORM), SOLARIS10)
+	LIBXML2 := --with-libxml-dir=/opt/csw
+endif
 
 ZIMBRA_HOME ?= /opt/zimbra
 
 PHP_TGZ_TARGET := \
-	$(P4_ROOT)/ThirdPartyBuilds/$(BUILD_PLATFORM)/php-$(PHP_VERSION).tgz
+	$(P4_ROOT)/ThirdPartyBuilds/$(BUILD_PLATFORM)/php/php-$(PHP_VERSION).tgz
 
 all: build tar
 
@@ -37,7 +40,7 @@
 	(cd $(ZIMBRA_HOME); tar czf \
 	$(PHP_TGZ_TARGET) \
 	php-$(PHP_VERSION))
-	chmod -R a+w $(PHP_ROOT)/builds/$(BUILD_PLATFORM)
+	chmod -R a+w $(P4_ROOT)/ThirdPartyBuilds/$(BUILD_PLATFORM)/php
 
 $(P4_ROOT)/ThirdPartyBuilds/$(BUILD_PLATFORM)/php:
 	mkdir -p $@
diff -u -r -N ThirdParty.orig/snmp/Makefile ThirdParty/snmp/Makefile
--- ThirdParty.orig/snmp/Makefile	2007-09-04 15:17:37.000000000 -0700
+++ ThirdParty/snmp/Makefile	2007-09-13 14:30:37.154716000 -0700
@@ -32,6 +32,7 @@
 	$(ENVMOD) CFLAGS="-g -O2" ./configure --prefix=$(INSTALL_PREFIX) \
 	--with-default-snmp-version=3 --with-sys-contact="admin" \
 	--with-sys-location="unknown" --with-logfile="$(ZIMBRA_HOME)/log/snmpd.log" \
+	--with-perl-modules="LIB=/opt/zimbra/zimbramon/lib" \
 	--with-persistent-directory="$(INSTALL_PREFIX)/var"; \
 	make; make install)
 	(cp -f $(APP_NAME)-$(APP_VERSION)/COPYING $(INSTALL_PREFIX)/LICENSE)
