Revision: 148866 https://trac.macports.org/changeset/148866 Author: mps@macports.org Date: 2016-05-20 11:09:31 -0700 (Fri, 20 May 2016) Log Message: ----------- gnutls: add patch for snow-leopard and older. Modified Paths: -------------- trunk/dports/devel/gnutls/Portfile Added Paths: ----------- trunk/dports/devel/gnutls/files/ trunk/dports/devel/gnutls/files/patch-tests-pkcs11-pkcs11-mock.c.diff Modified: trunk/dports/devel/gnutls/Portfile =================================================================== --- trunk/dports/devel/gnutls/Portfile 2016-05-20 16:11:12 UTC (rev 148865) +++ trunk/dports/devel/gnutls/Portfile 2016-05-20 18:09:31 UTC (rev 148866) @@ -41,6 +41,8 @@ path:share/curl/curl-ca-bundle.crt:curl-ca-bundle \ port:zlib +patchfiles patch-tests-pkcs11-pkcs11-mock.c.diff + post-patch { # Remove comments which confuse at least Leopard's assembler. reinplace {/^#/d} {*}[glob ${worksrcpath}/lib/accelerated/x86/macosx/*.s] Added: trunk/dports/devel/gnutls/files/patch-tests-pkcs11-pkcs11-mock.c.diff =================================================================== --- trunk/dports/devel/gnutls/files/patch-tests-pkcs11-pkcs11-mock.c.diff (rev 0) +++ trunk/dports/devel/gnutls/files/patch-tests-pkcs11-pkcs11-mock.c.diff 2016-05-20 18:09:31 UTC (rev 148866) @@ -0,0 +1,37 @@ +--- tests/pkcs11/pkcs11-mock.c.orig 2016-05-10 15:14:55.000000000 -0500 ++++ tests/pkcs11/pkcs11-mock.c 2016-05-20 13:06:00.000000000 -0500 +@@ -17,6 +17,34 @@ + #include "pkcs11-mock.h" + #include <stdlib.h> + ++#ifdef __APPLE__ ++#include <Availability.h> ++#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1060 ++static char * strndup (char const *s, size_t n); ++static size_t strnlen (const char *string, size_t maxlen); ++ ++static size_t ++strnlen (const char *string, size_t maxlen) ++{ ++ const char *end = memchr (string, '\0', maxlen); ++ return end ? (size_t) (end - string) : maxlen; ++} ++ ++static char * ++strndup (char const *s, size_t n) ++{ ++ size_t len = strnlen (s, n); ++ char *new = malloc (len + 1); ++ ++ if (new == NULL) ++ return NULL; ++ ++ new[len] = '\0'; ++ return memcpy (new, s, len); ++} ++#endif ++#endif ++ + /* This is a very basic mock PKCS #11 module that will return a given fixed + * certificate, and public key for all searches. It will also provide a + * CKO_X_CERTIFICATE_EXTENSION so that it can be used as a p11-kit trust