clock_gettime definition for macOS <= Sierra. trunk
authoryouri <youri@pkgsrc.org>
Mon, 09 Jul 2018 13:53:34 +0000
branchtrunk
changeset 310273 79873cf03347
parent 310272 6552955cc906
child 310274 d3c3705008ba
clock_gettime definition for macOS <= Sierra.
print/cups-base/distinfo
print/cups-base/patches/patch-cups_ipp.c
print/cups-base/patches/patch-cups_thread.c
--- a/print/cups-base/distinfo	Mon Jul 09 11:58:58 2018 +0000
+++ b/print/cups-base/distinfo	Mon Jul 09 13:53:34 2018 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.7 2018/06/22 14:12:45 bouyer Exp $
+$NetBSD: distinfo,v 1.8 2018/07/09 13:53:34 youri Exp $
 
 SHA1 (cups-2.2.8-source.tar.gz) = f8c572d5b2405091e3be6836523a6abdda645f60
 RMD160 (cups-2.2.8-source.tar.gz) = 79bc052e3f70408a698bfbe2556b53d2f0140b2c
@@ -17,7 +17,8 @@
 SHA1 (patch-config-scripts_cups-manpages.m4) = 5cc943738df29f11fc366557938b82c1e9162344
 SHA1 (patch-config-scripts_cups-opsys.m4) = 2bbacc401d4d8dbc157889b6a6cf66684c52357b
 SHA1 (patch-cups-tls.c) = f89c25f8089d9e11a983a270adbb2cbde3c22511
-SHA1 (patch-cups_ipp.c) = 3528644cf52b716ae2342342949ee94a1c0cf61d
+SHA1 (patch-cups_ipp.c) = 139e6596ba22c62c3d2b16852b2da0d0e677151a
+SHA1 (patch-cups_thread.c) = e625a2b81f3d831d2a0c02bc0fa9a9d31c1097a7
 SHA1 (patch-doc-help-man-cups-files.conf.html) = fcd3d06c00b0a85b6c0790235ccb68685252ea68
 SHA1 (patch-man-cups-files.conf.man.in) = 820da58aa3f854018a48b68256d0cf0dc75b986e
 SHA1 (patch-ppdc_Makefile) = cdeb0ef9a68f9dd85453ef3076a0120ad9983698
--- a/print/cups-base/patches/patch-cups_ipp.c	Mon Jul 09 11:58:58 2018 +0000
+++ b/print/cups-base/patches/patch-cups_ipp.c	Mon Jul 09 13:53:34 2018 +0000
@@ -1,10 +1,10 @@
-$NetBSD: patch-cups_ipp.c,v 1.1 2018/06/22 14:12:45 bouyer Exp $
+$NetBSD: patch-cups_ipp.c,v 1.2 2018/07/09 13:53:34 youri Exp $
 From upstream: https://github.com/apple/cups/commit/18545a5e7ab478b187a0d7136ee19496ae32fc9b
  Fix regressions in ippValidateAttribute (Issue #5322, Issue #5330) 
 
---- cups/ipp.c.orig
+--- cups/ipp.c.orig	2018-06-05 16:06:54.000000000 +0000
 +++ cups/ipp.c
-@@ -5101,16 +5101,19 @@ ippValidateAttribute(
+@@ -5097,16 +5097,19 @@ ippValidateAttribute(
  	      break;
  	  }
  
@@ -34,18 +34,18 @@
  
  	  if ((ptr - attr->values[i].string.text) > (IPP_MAX_TEXT - 1))
  	  {
-@@ -5163,16 +5166,19 @@ ippValidateAttribute(
+@@ -5159,16 +5162,19 @@ ippValidateAttribute(
  	      break;
  	  }
  
 -	  if (*ptr < ' ' || *ptr == 0x7f)
--	  {
++	  if (*ptr)
+ 	  {
 -	    ipp_set_error(IPP_STATUS_ERROR_BAD_REQUEST, _("\"%s\": Bad name value \"%s\" - bad control character (PWG 5100.14 section 8.1)."), attr->name, attr->values[i].string.text);
 -	    return (0);
 -	  }
 -	  else if (*ptr)
-+	  if (*ptr)
- 	  {
+-	  {
 -	    ipp_set_error(IPP_STATUS_ERROR_BAD_REQUEST, _("\"%s\": Bad name value \"%s\" - bad UTF-8 sequence (RFC 8011 section 5.1.3)."), attr->name, attr->values[i].string.text);
 -	    return (0);
 -	  }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/print/cups-base/patches/patch-cups_thread.c	Mon Jul 09 13:53:34 2018 +0000
@@ -0,0 +1,33 @@
+$NetBSD: patch-cups_thread.c,v 1.1 2018/07/09 13:53:34 youri Exp $
+
+Patch for macOS Sierra and before.
+
+--- cups/thread.c.orig	2018-06-05 16:06:54.000000000 +0000
++++ cups/thread.c
+@@ -19,6 +19,26 @@
+ #include "cups-private.h"
+ #include "thread-private.h"
+ 
++#if __APPLE__ && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200
++#include <mach/mach_time.h>
++#ifndef CLOCK_REALTIME
++#define CLOCK_REALTIME 0
++#define CLOCK_MONOTONIC 0
++#endif
++static int
++clock_gettime(int clk_id, struct timespec *t){
++    mach_timebase_info_data_t timebase;
++    mach_timebase_info(&timebase);
++    uint64_t time;
++    time = mach_absolute_time();
++    double nseconds = ((double)time * (double)timebase.numer)/((double)timebase.denom);
++    double seconds = ((double)time * (double)timebase.numer)/((double)timebase.denom * 1e9);
++    t->tv_sec = seconds;
++    t->tv_nsec = nseconds;
++    return 0;
++}
++#endif
++
+ 
+ #if defined(HAVE_PTHREAD_H)
+ /*