[109111] trunk/dports/science/gstlal-inspiral/Portfile

Jeremy Huddleston Sequoia jeremyhu at macports.org
Thu Aug 8 09:36:54 PDT 2013


On Aug 8, 2013, at 9:19, Adam Mercer <ram at macports.org> wrote:

> On Thu, Aug 8, 2013 at 10:22 AM, Jeremy Huddleston Sequoia
> <jeremyhu at macports.org> wrote:
> 
>> I added strndup to Libc in Lion, so it's not available in Snow Leopard.
>> 
>> The fix will be to add a static version of strndup when __MAC_OS_X_VERSION_MIN_REQUIRED < 1070:
>> http://opensource.apple.com/source/Libc/Libc-825.26/string/FreeBSD/strndup.c
> 
> So adding something like the following to the file that is failing is
> the appropriate fix?

Yep. Exactly.


> /*
> * Mac OS X 10.6 and lower do not contain strndup, define this
> * statically if needed
> */
> 
> #if __MAC_OS_X_VERSION_MIN_REQUIRED < 1070
> static char *strndup(const char *str, size_t n)
> {
>  size_t len;
>  char *copy;
> 
>  for (len = 0; len < n && str[len]; len++)
>    continue;
> 
>  if ((copy = malloc(len + 1)) == NULL)
>    return (NULL);
>  memcpy(copy, str, len);
>  copy[len] = '\0';
>  return (copy);
> }
> #endif
> 
> Cheers
> 
> Adam

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4145 bytes
Desc: not available
URL: <http://lists.macosforge.org/pipermail/macports-dev/attachments/20130808/2dd99bfb/attachment.p7s>


More information about the macports-dev mailing list