Index: trunk/dports/devel/valgrind/Portfile
===================================================================
--- trunk/dports/devel/valgrind/Portfile	(revision 117638)
+++ trunk/dports/devel/valgrind/Portfile	(revision 117639)
@@ -35,10 +35,10 @@
 extract.post_args-append --exclude=${distname}/docs/html/FAQ.html
 
-pre-fetch {
-    if {${os.platform} eq "darwin" && (${os.major} < 9 || ${os.major} > 12)} {
-        ui_error "${name} ${version} is only compatible with Mac OS X 10.5, 10.6, 10.7 and 10.8"
-        return -code error "incompatible Mac OS X version"
-    }
-}
+#pre-fetch {
+#    if {${os.platform} eq "darwin" && (${os.major} < 9 || ${os.major} > 12)} {
+#        ui_error "${name} ${version} is only compatible with Mac OS X 10.5, 10.6, 10.7 and 10.8"
+#        return -code error "incompatible Mac OS X version"
+#    }
+#}
 
 depends_build   bin:perl:perl5
@@ -46,5 +46,6 @@
 # as they are only used for tests
 
-patchfiles      link_tool_exe_darwin-ccache.diff
+patchfiles      link_tool_exe_darwin-ccache.diff \
+                patch-compat-snowleo.diff
 
 configure.args  --mandir=${prefix}/share/man \
Index: trunk/dports/devel/valgrind/files/patch-compat-snowleo.diff
===================================================================
--- trunk/dports/devel/valgrind/files/patch-compat-snowleo.diff	(revision 117639)
+++ trunk/dports/devel/valgrind/files/patch-compat-snowleo.diff	(revision 117639)
@@ -0,0 +1,405 @@
+diff -Naur a/coregrind/m_syswrap/priv_syswrap-darwin.h b/coregrind/m_syswrap/priv_syswrap-darwin.h
+--- coregrind/m_syswrap/priv_syswrap-darwin.h	2013-10-23 03:50:12.000000000 -0700
++++ coregrind/m_syswrap/priv_syswrap-darwin.h	2013-11-11 22:28:56.000000000 -0800
+@@ -344,7 +344,7 @@
+ DECL_TEMPLATE(darwin, fchmod_extended);         // 283
+ DECL_TEMPLATE(darwin, access_extended);         // 284
+ DECL_TEMPLATE(darwin, settid);                  // 285
+-// NYI gettid 286
++DECL_TEMPLATE(darwin, gettid);                  // 286
+ // NYI setsgroups 287
+ // NYI getsgroups 288
+ // NYI setwgroups 289
+@@ -354,23 +354,44 @@
+ // NYI identitysvc 293
+ // NYI shared_region_check_np 294
+ // NYI shared_region_map_np 295
++#if DARWIN_VERS >= DARWIN_10_6
++// NYI vm_pressure_monitor 296
++// NYI psynch_rw_longrdlock 297
++// NYI psynch_rw_yieldwrlock 298
++// NYI psynch_rw_downgrade 299
++// NYI psynch_rw_upgrade 300
++DECL_TEMPLATE(darwin, psynch_mutexwait);       // 301
++DECL_TEMPLATE(darwin, psynch_mutexdrop);       // 302
++DECL_TEMPLATE(darwin, psynch_cvbroad);         // 303
++DECL_TEMPLATE(darwin, psynch_cvsignal);        // 304
++DECL_TEMPLATE(darwin, psynch_cvwait);          // 305
++DECL_TEMPLATE(darwin, psynch_rw_rdlock);       // 306
++DECL_TEMPLATE(darwin, psynch_rw_wrlock);       // 307
++DECL_TEMPLATE(darwin, psynch_rw_unlock);       // 308
++// NYI psynch_rw_unlock2 309
++#else
+ // old load_shared_file
+ // old reset_shared_file
+ // old new_system_shared_regions
+ // old shared_region_map_file_np
+ // old shared_region_make_private_np
+-DECL_TEMPLATE(darwin, psynch_mutexwait);       // 301 // new in 10.7 ?
+-DECL_TEMPLATE(darwin, psynch_mutexdrop);       // 302 // new in 10.7 ?
+-DECL_TEMPLATE(darwin, psynch_cvbroad);         // 303 // new in 10.7 ?
+-DECL_TEMPLATE(darwin, psynch_cvsignal);        // 304 // new in 10.7 ?
+-DECL_TEMPLATE(darwin, psynch_cvwait);          // 305 // new in 10.7 ?
+-DECL_TEMPLATE(darwin, psynch_rw_rdlock);       // 306 // new in 10.7 ?
+-DECL_TEMPLATE(darwin, psynch_rw_wrlock);       // 307 // new in 10.7 ?
+-DECL_TEMPLATE(darwin, psynch_rw_unlock);       // 308 // new in 10.7 ?
++// NYI __pthread_mutex_destroy 301
++// NYI __pthread_mutex_init 302
++// NYI __pthread_mutex_lock 303
++// NYI __pthread_mutex_trylock 304
++// NYI __pthread_mutex_unlock 305
++// NYI __pthread_cond_init 306
++// NYI __pthread_cond_destroy 307
++// NYI __pthread_cond_broadcast 308
+ // NYI __pthread_cond_signal 309
++#endif
+ // NYI getsid 310
+ // NYI settid_with_pid 311
+-DECL_TEMPLATE(darwin, psynch_cvclrprepost);    // 312 // new in 10.7 ?
++#if DARWIN_VERS >= DARWIN_10_7
++DECL_TEMPLATE(darwin, psynch_cvclrprepost);    // 312
++#else
++// NYI __pthread_cond_timedwait 312
++#endif
+ // NYI aio_fsync 313
+ DECL_TEMPLATE(darwin, aio_return);             // 314
+ DECL_TEMPLATE(darwin, aio_suspend);            // 315
+@@ -394,9 +415,7 @@
+ DECL_TEMPLATE(darwin, __pthread_canceled);      // 333
+ DECL_TEMPLATE(darwin, __semwait_signal);        // 334
+ // old utrace
+-#if DARWIN_VERS >= DARWIN_10_6
+ DECL_TEMPLATE(darwin, proc_info);               // 336
+-#endif
+ DECL_TEMPLATE(darwin, sendfile);                // 337
+ DECL_TEMPLATE(darwin, stat64);                  // 338
+ DECL_TEMPLATE(darwin, fstat64);                 // 339
+@@ -417,9 +436,7 @@
+ // NYI setauid 354
+ // NYI getaudit 355
+ // NYI setaudit 356
+-#if DARWIN_VERS >= DARWIN_10_7
+ DECL_TEMPLATE(darwin, getaudit_addr)            // 357
+-#endif
+ // NYI setaudit_addr 358
+ // NYI auditctl 359
+ DECL_TEMPLATE(darwin, bsdthread_create);        // 360
+@@ -434,7 +451,9 @@
+ // 369
+ // 370
+ // 371
++#if DARWIN_VERS >= DARWIN_10_6
+ DECL_TEMPLATE(darwin, __thread_selfid);         // 372
++#endif
+ // 373
+ // 374
+ // 375
+diff -Naur a/coregrind/m_syswrap/syswrap-darwin.c b/coregrind/m_syswrap/syswrap-darwin.c
+--- coregrind/m_syswrap/syswrap-darwin.c	2013-10-23 03:50:12.000000000 -0700
++++ coregrind/m_syswrap/syswrap-darwin.c	2013-11-11 21:53:29.000000000 -0800
+@@ -2618,47 +2618,6 @@
+          count, (Addr)p-(Addr)ARG3, ARG4);
+ }
+ 
+-
+-PRE(fsgetpath)
+-{
+-#if VG_WORDSIZE == 4
+-   PRINT("fsgetpath(%#lx, %ld, %#lx {%u,%u}, %llu)", 
+-         ARG1, ARG2, ARG3,
+-         ((unsigned int *)ARG3)[0], ((unsigned int *)ARG3)[1],
+-         LOHI64(ARG4, ARG5));
+-   PRE_REG_READ5(ssize_t, "fsgetpath", 
+-                 void*,"buf", size_t,"bufsize", 
+-                 fsid_t *,"fsid",
+-                 vki_uint32_t, "objid_low32", vki_uint32_t, "objid_high32");
+-#else
+-   PRINT("fsgetpath(%#lx, %ld, %#lx {%u,%u}, %lu)", 
+-         ARG1, ARG2, ARG3,
+-         ((unsigned int *)ARG3)[0],
+-         ((unsigned int *)ARG3)[1], ARG4);
+-   PRE_REG_READ4(ssize_t, "fsgetpath", 
+-                 void*,"buf", size_t,"bufsize", 
+-                 fsid_t *,"fsid", uint64_t,"objid");
+-#endif
+-   PRE_MEM_READ("fsgetpath(fsid)", ARG3, sizeof(fsid_t));
+-   PRE_MEM_WRITE("fsgetpath(buf)", ARG1, ARG2);
+-}
+-
+-POST(fsgetpath)
+-{
+-   POST_MEM_WRITE(ARG1, RES);
+-}
+-
+-PRE(audit_session_self)
+-{
+-  PRINT("audit_session_self()");
+-}
+-
+-POST(audit_session_self)
+-{
+-  record_named_port(tid, RES, MACH_PORT_RIGHT_SEND, "audit-session-%p");
+-  PRINT("audit-session %#lx", RES);
+-}
+-
+ PRE(exchangedata)
+ {
+    PRINT("exchangedata(%#lx(%s), %#lx(%s), %lu)",
+@@ -3561,6 +3520,17 @@
+    }    
+ }
+ 
++PRE(getaudit_addr)
++{
++   PRINT("getaudit_addr(%#lx, %lu)", ARG1, ARG2);
++   PRE_REG_READ1(void*, "auditinfo_addr", int, "length");
++   PRE_MEM_WRITE("getaudit_addr(auditinfo_addr)", ARG1, ARG2);
++}
++POST(getaudit_addr)
++{
++   POST_MEM_WRITE(ARG1, ARG2);
++}
++
+ 
+ PRE(mmap)
+ {
+@@ -3779,7 +3749,6 @@
+                  uint32_t flavor, uint64_t arg,
+                  user_addr_t buffer, int32_t buffersize)
+ */
+-#if DARWIN_VERS >= DARWIN_10_6
+ PRE(proc_info)
+ {
+ #if VG_WORDSIZE == 4
+@@ -3813,7 +3782,6 @@
+ #endif
+ }
+ 
+-#endif /* DARWIN_VERS >= DARWIN_10_6 */
+ 
+ /* ---------------------------------------------------------------------
+    aio_*
+@@ -7428,12 +7396,6 @@
+ //}
+ 
+ 
+-PRE(__thread_selfid)
+-{
+-   PRINT("__thread_selfid ()");
+-   PRE_REG_READ0(vki_uint64_t, "__thread_selfid");
+-}
+-
+ PRE(task_for_pid)
+ {
+    PRINT("task_for_pid(%s, %ld, %#lx)", name_for_port(ARG1), ARG2, ARG3);
+@@ -7782,21 +7744,10 @@
+ 
+ 
+ /* ---------------------------------------------------------------------
+-   Added for OSX 10.7 (Lion)
++   Added for OSX 10.6 (Snow Leopard)
+    ------------------------------------------------------------------ */
+ 
+-#if DARWIN_VERS >= DARWIN_10_7
+-
+-PRE(getaudit_addr)
+-{
+-   PRINT("getaudit_addr(%#lx, %lu)", ARG1, ARG2);
+-   PRE_REG_READ1(void*, "auditinfo_addr", int, "length");
+-   PRE_MEM_WRITE("getaudit_addr(auditinfo_addr)", ARG1, ARG2);
+-}
+-POST(getaudit_addr)
+-{
+-   POST_MEM_WRITE(ARG1, ARG2);
+-}
++#if DARWIN_VERS >= DARWIN_10_6
+ 
+ PRE(psynch_mutexwait)
+ {
+@@ -7867,6 +7818,60 @@
+ {
+ }
+ 
++PRE(__thread_selfid)
++{
++   PRINT("__thread_selfid ()");
++   PRE_REG_READ0(vki_uint64_t, "__thread_selfid");
++}
++
++PRE(fsgetpath)
++{
++#if VG_WORDSIZE == 4
++   PRINT("fsgetpath(%#lx, %ld, %#lx {%u,%u}, %llu)", 
++         ARG1, ARG2, ARG3,
++         ((unsigned int *)ARG3)[0], ((unsigned int *)ARG3)[1],
++         LOHI64(ARG4, ARG5));
++   PRE_REG_READ5(ssize_t, "fsgetpath", 
++                 void*,"buf", size_t,"bufsize", 
++                 fsid_t *,"fsid",
++                 vki_uint32_t, "objid_low32", vki_uint32_t, "objid_high32");
++#else
++   PRINT("fsgetpath(%#lx, %ld, %#lx {%u,%u}, %lu)", 
++         ARG1, ARG2, ARG3,
++         ((unsigned int *)ARG3)[0],
++         ((unsigned int *)ARG3)[1], ARG4);
++   PRE_REG_READ4(ssize_t, "fsgetpath", 
++                 void*,"buf", size_t,"bufsize", 
++                 fsid_t *,"fsid", uint64_t,"objid");
++#endif
++   PRE_MEM_READ("fsgetpath(fsid)", ARG3, sizeof(fsid_t));
++   PRE_MEM_WRITE("fsgetpath(buf)", ARG1, ARG2);
++}
++
++POST(fsgetpath)
++{
++   POST_MEM_WRITE(ARG1, RES);
++}
++
++PRE(audit_session_self)
++{
++  PRINT("audit_session_self()");
++}
++POST(audit_session_self)
++{
++  record_named_port(tid, RES, MACH_PORT_RIGHT_SEND, "audit-session-%p");
++  PRINT("audit-session %#lx", RES);
++}
++
++#endif /* DARWIN_VERS >= DARWIN_10_6 */
++
++
++/* ---------------------------------------------------------------------
++   Added for OSX 10.7 (Lion)
++   ------------------------------------------------------------------ */
++
++#if DARWIN_VERS >= DARWIN_10_7
++
+ PRE(psynch_cvclrprepost)
+ {
+    PRINT("psynch_cvclrprepost(BOGUS)");
+@@ -8297,13 +8302,10 @@
+ // _____(__NR_shared_region_map_np), 
+ #if DARWIN_VERS >= DARWIN_10_6
+ // _____(__NR_vm_pressure_monitor), 
+-#else
+-   _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(296)),   // old load_shared_file 
+-#endif
+-   _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(297)),   // old reset_shared_file 
+-   _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(298)),   // old new_system_shared_regions 
+-   _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(299)),   // old shared_region_map_file_np 
+-   _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(300)),   // old shared_region_make_private_np
++// _____(__NR_psynch_rw_longrdlock), 
++// _____(__NR_psynch_rw_yieldwrlock), 
++// _____(__NR_psynch_rw_downgrade), 
++// _____(__NR_psynch_rw_upgrade), 
+    MACXY(__NR_psynch_mutexwait, psynch_mutexwait), // 301
+    MACXY(__NR_psynch_mutexdrop, psynch_mutexdrop), // 302
+    MACXY(__NR_psynch_cvbroad,   psynch_cvbroad),   // 303
+@@ -8312,10 +8314,30 @@
+    MACXY(__NR_psynch_rw_rdlock, psynch_rw_rdlock), // 306
+    MACXY(__NR_psynch_rw_wrlock, psynch_rw_wrlock), // 307
+    MACXY(__NR_psynch_rw_unlock, psynch_rw_unlock), // 308
+-   _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(309)),   // ???
++// _____(__NR_psynch_rw_unlock2), 
++#else
++   _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(296)),   // old load_shared_file 
++   _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(297)),   // old reset_shared_file 
++   _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(298)),   // old new_system_shared_regions 
++   _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(299)),   // old shared_region_map_file_np 
++   _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(300)),   // old shared_region_make_private_np
++// _____(__NR___pthread_mutex_destroy), 
++// _____(__NR___pthread_mutex_init), 
++// _____(__NR___pthread_mutex_lock), 
++// _____(__NR___pthread_mutex_trylock), 
++// _____(__NR___pthread_mutex_unlock), 
++// _____(__NR___pthread_cond_init), 
++// _____(__NR___pthread_cond_destroy), 
++// _____(__NR___pthread_cond_broadcast), 
++// _____(__NR___pthread_cond_signal), 
++#endif
+ // _____(__NR_getsid), 
+ // _____(__NR_settid_with_pid), 
++#if DARWIN_VERS >= DARWIN_10_7
+    MACXY(__NR_psynch_cvclrprepost, psynch_cvclrprepost), // 312
++#else
++   _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(308)),   // old __pthread_cond_timedwait
++#endif
+ // _____(__NR_aio_fsync), 
+    MACXY(__NR_aio_return,     aio_return), 
+    MACX_(__NR_aio_suspend,    aio_suspend), 
+@@ -8341,9 +8363,7 @@
+    MACX_(__NR___pthread_canceled,      __pthread_canceled),
+    MACX_(__NR___semwait_signal,        __semwait_signal), 
+    _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(335)),   // old utrace
+-#if DARWIN_VERS >= DARWIN_10_6
+    MACXY(__NR_proc_info,               proc_info),  // 336
+-#endif
+    MACXY(__NR_sendfile,    sendfile), 
+    MACXY(__NR_stat64,      stat64), 
+    MACXY(__NR_fstat64,     fstat64), 
+@@ -8364,9 +8384,7 @@
+ // _____(__NR_setauid), 
+ // _____(__NR_getaudit), 
+ // _____(__NR_setaudit), 
+-#if DARWIN_VERS >= DARWIN_10_7
+    MACXY(__NR_getaudit_addr, getaudit_addr),
+-#endif
+ // _____(__NR_setaudit_addr), 
+ // _____(__NR_auditctl), 
+    MACXY(__NR_bsdthread_create,     bsdthread_create),   // 360
+diff -Naur a/include/vki/vki-scnums-darwin.h b/include/vki/vki-scnums-darwin.h
+--- include/vki/vki-scnums-darwin.h	2013-10-23 03:49:54.000000000 -0700
++++ include/vki/vki-scnums-darwin.h	2013-11-11 20:20:08.000000000 -0800
+@@ -508,25 +508,42 @@
+ #define	__NR_shared_region_map_np   VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(295)
+ #if DARWIN_VERS >= DARWIN_10_6
+ #define __NR_vm_pressure_monitor    VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(296)
++#define __NR_psynch_rw_longrdlock   VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(297)
++#define __NR_psynch_rw_yieldwrlock  VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(298)
++#define __NR_psynch_rw_downgrade    VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(299)
++#define __NR_psynch_rw_upgrade      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(300)
++#define __NR_psynch_mutexwait       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(301)
++#define __NR_psynch_mutexdrop       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(302)
++#define __NR_psynch_cvbroad         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(303)
++#define __NR_psynch_cvsignal        VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(304)
++#define __NR_psynch_cvwait          VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(305)
++#define __NR_psynch_rw_rdlock       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(306)
++#define __NR_psynch_rw_wrlock       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(307)
++#define __NR_psynch_rw_unlock       VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(308)
++#define __NR_psynch_rw_unlock2      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(309)
+ #else
+ 			/* 296  old load_shared_file */
+-#endif
+ 			/* 297  old reset_shared_file */
+ 			/* 298  old new_system_shared_regions */
+ 			/* 299  old shared_region_map_file_np */
+ 			/* 300  old shared_region_make_private_np */
+-#define __NR_psynch_mutexwait VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(301)
+-#define __NR_psynch_mutexdrop VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(302)
+-#define __NR_psynch_cvbroad   VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(303)
+-#define __NR_psynch_cvsignal  VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(304)
+-#define __NR_psynch_cvwait    VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(305)
+-#define __NR_psynch_rw_rdlock VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(306)
+-#define __NR_psynch_rw_wrlock VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(307)
+-#define __NR_psynch_rw_unlock VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(308)
+-			/* 309 */
++#define __NR___pthread_mutex_destroy  VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(301)
++#define __NR___pthread_mutex_init     VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(302)
++#define __NR___pthread_mutex_lock     VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(303)
++#define __NR___pthread_mutex_trylock  VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(304)
++#define __NR___pthread_mutex_unlock   VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(305)
++#define __NR___pthread_cond_init      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(306)
++#define __NR___pthread_cond_destroy   VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(307)
++#define __NR___pthread_cond_broadcast VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(308)
++#define __NR___pthread_cond_signal    VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(309)
++#endif
+ #define	__NR_getsid         VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(310)
+ #define	__NR_settid_with_pid VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(311)
++#if DARWIN_VERS >= DARWIN_10_7
+ #define __NR_psynch_cvclrprepost VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(312)
++#else
++#define __NR___pthread_cond_timedwait VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(312)
++#endif
+ #define	__NR_aio_fsync      VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(313)
+ #define	__NR_aio_return     VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(314)
+ #define	__NR_aio_suspend    VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(315)
