Last active
August 2, 2017 04:38
-
-
Save nonakap/d0a5a2ec756d0e77d42ba0b77803acd0 to your computer and use it in GitHub Desktop.
pkgsrc/devel/jq: fix for https://www.hi-matic.org/diary/index.cgi?20170802#02-2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --exclude=CVS -uNrp jq/Makefile jq.new/Makefile | |
--- jq/Makefile 2017-07-31 07:32:14.000000000 +0900 | |
+++ jq.new/Makefile 2017-08-02 12:49:45.000000000 +0900 | |
@@ -15,9 +15,13 @@ LICENSE= mit | |
USE_LANGUAGES= c99 | |
USE_LIBTOOL= yes | |
USE_TOOLS+= bison flex gmake | |
+USE_TOOLS+= aclocal autoconf automake autoreconf | |
GNU_CONFIGURE= yes | |
CFLAGS.SunOS+= -D_XPG6 -D__EXTENSIONS__ | |
+pre-configure: | |
+ cd ${WRKSRC} && ${TOOLS_CMD.autoreconf} | |
+ | |
.include "../../mk/bsd.pkg.mk" | |
diff --exclude=CVS -uNrp jq/distinfo jq.new/distinfo | |
--- jq/distinfo 2016-05-10 18:20:52.000000000 +0900 | |
+++ jq.new/distinfo 2017-08-02 12:54:05.000000000 +0900 | |
@@ -4,4 +4,7 @@ SHA1 (jq-1.5.tar.gz) = 664638b560d9e7341 | |
RMD160 (jq-1.5.tar.gz) = 33ac77ac93e0539f6d66d29cd717013cdab8cf61 | |
SHA512 (jq-1.5.tar.gz) = 3f9049321e8430b04dbccf81d7f2ab691b89383e91526eaf585bbeeb67698dea73a36b3aa179f6a95ef97cd73a8a9b6dc53cb1a5b0398b6422c11289b705de7b | |
Size (jq-1.5.tar.gz) = 1118086 bytes | |
+SHA1 (patch-builtin.c) = 712c42975c86ec0220ffd933b78336f3d156942b | |
+SHA1 (patch-configure.ac) = 141cf2016d212b10f910923106d3524e466f0eb7 | |
+SHA1 (patch-main.c) = 961059991bd79fcf1d59711c4b37202074c8c02b | |
SHA1 (patch-src_jv__parse.c) = efca86e70daf27291a01bf538487b745b7bd600c | |
diff --exclude=CVS -uNrp jq/patches/patch-builtin.c jq.new/patches/patch-builtin.c | |
--- jq/patches/patch-builtin.c 1970-01-01 09:00:00.000000000 +0900 | |
+++ jq.new/patches/patch-builtin.c 2017-08-02 12:53:57.000000000 +0900 | |
@@ -0,0 +1,50 @@ | |
+$NetBSD$ | |
+ | |
+- gmtime_r() require _XOPEN_SOURCE >= 500. | |
+- We should use mktime() instead of timegm(). | |
+ | |
+--- builtin.c.orig 2015-08-18 04:25:04.000000000 +0000 | |
++++ builtin.c 2017-08-02 03:45:09.000000000 +0000 | |
+@@ -1,6 +1,10 @@ | |
+ #define _BSD_SOURCE | |
+ #define _GNU_SOURCE | |
++#ifdef HAVE_GMTIME_R | |
++#define _XOPEN_SOURCE 500 | |
++#else | |
+ #define _XOPEN_SOURCE | |
++#endif | |
+ #include <sys/time.h> | |
+ #include <stdlib.h> | |
+ #include <stddef.h> | |
+@@ -1037,20 +1041,22 @@ static jv tm2jv(struct tm *tm) { | |
+ * Returns (time_t)-2 if mktime()'s side-effects cannot be corrected. | |
+ */ | |
+ static time_t my_mktime(struct tm *tm) { | |
+-#ifdef HAVE_TIMEGM | |
+- return timegm(tm); | |
+-#else /* HAVE_TIMEGM */ | |
++#ifdef HAVE_MKTIME | |
+ time_t t = mktime(tm); | |
+ if (t == (time_t)-1) | |
+ return t; | |
+ #ifdef HAVE_TM_TM_GMT_OFF | |
+- return t + tm.tm_gmtoff; | |
+-#elif defined(HAVE_TM_TM_GMT_OFF) | |
+- return t + tm.__tm_gmtoff; | |
+-#else | |
++ return t + tm->tm_gmtoff; | |
++#elif defined(HAVE_TM___TM_GMT_OFF) | |
++ return t + tm->__tm_gmtoff; | |
++#else /* !HAVE_TM_TM_GMT_OFF && !HAVE_TM___TM_GMT_OFF */ | |
+ return (time_t)-2; /* Not supported */ | |
+-#endif | |
+-#endif /* !HAVE_TIMEGM */ | |
++#endif /* HAVE_TM_TM_GMT_OFF */ | |
++#elif defined HAVE_TIMEGM | |
++ return timegm(tm); | |
++#else /* !HAVE_TIMEGM */ | |
++ return (time_t)-2; /* Not supported */ | |
++#endif /* HAVE_MKTIME */ | |
+ } | |
+ | |
+ #ifdef HAVE_STRPTIME | |
diff --exclude=CVS -uNrp jq/patches/patch-configure.ac jq.new/patches/patch-configure.ac | |
--- jq/patches/patch-configure.ac 1970-01-01 09:00:00.000000000 +0900 | |
+++ jq.new/patches/patch-configure.ac 2017-08-02 12:53:50.000000000 +0900 | |
@@ -0,0 +1,20 @@ | |
+$NetBSD$ | |
+ | |
+- check mktime(). | |
+- gmtime_r() require _XOPEN_SOURCE >= 500. | |
+ | |
+--- configure.ac.orig 2015-08-18 04:25:04.000000000 +0000 | |
++++ configure.ac 2017-08-02 03:29:24.000000000 +0000 | |
+@@ -141,8 +141,11 @@ AC_FIND_FUNC([isatty], [c], [#include <u | |
+ AC_FIND_FUNC([_isatty], [c], [#include <io.h>], [0]) | |
+ AC_FIND_FUNC([strptime], [c], [#include <time.h>], [0, 0, 0]) | |
+ AC_FIND_FUNC([strftime], [c], [#include <time.h>], [0, 0, 0, 0]) | |
++AC_FIND_FUNC([mktime], [c], [#include <time.h>], [0]) | |
+ AC_FIND_FUNC([timegm], [c], [#include <time.h>], [0]) | |
+-AC_FIND_FUNC([gmtime_r], [c], [#include <time.h>], [0, 0]) | |
++AC_FIND_FUNC([gmtime_r], [c], [ | |
++#define _XOPEN_SOURCE 500 | |
++#include <time.h>], [0, 0]) | |
+ AC_FIND_FUNC([gmtime], [c], [#include <time.h>], [0]) | |
+ AC_FIND_FUNC([gettimeofday], [c], [#include <time.h>], [0, 0]) | |
+ AC_CHECK_MEMBER([struct tm.tm_gmtoff], [AC_DEFINE([HAVE_TM_TM_GMT_OFF],1,[Define to 1 if the system has the tm_gmt_off field in struct tm])], | |
diff --exclude=CVS -uNrp jq/patches/patch-main.c jq.new/patches/patch-main.c | |
--- jq/patches/patch-main.c 1970-01-01 09:00:00.000000000 +0900 | |
+++ jq.new/patches/patch-main.c 2017-08-02 12:19:23.000000000 +0900 | |
@@ -0,0 +1,18 @@ | |
+$NetBSD$ | |
+ | |
+> main.c: In function 'isoptish': | |
+> main.c:80:3: warning: array subscript has type 'char' [-Wchar-subscripts] | |
+> return text[0] == '-' && (text[1] == '-' || isalpha(text[1])); | |
+> ^ | |
+ | |
+--- main.c.orig 2015-08-18 04:25:04.000000000 +0000 | |
++++ main.c 2017-08-02 03:18:29.000000000 +0000 | |
+@@ -77,7 +77,7 @@ static void die() { | |
+ | |
+ | |
+ static int isoptish(const char* text) { | |
+- return text[0] == '-' && (text[1] == '-' || isalpha(text[1])); | |
++ return text[0] == '-' && (text[1] == '-' || isalpha((unsigned char)text[1])); | |
+ } | |
+ | |
+ static int isoption(const char* text, char shortopt, const char* longopt, size_t *short_opts) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment