From e12976a0bccc9641def213fedd5992bb9c9020e0 Mon Sep 17 00:00:00 2001 From: augiedoggie Date: Mon, 7 Feb 2022 14:34:06 -0700 Subject: [PATCH] jo: add recipe for 1.6 (#6595) * jo: add recipe for 1.6 * jo: remove autoheader prerequire --- app-text/jo/jo-1.6.recipe | 61 ++++++++++++++++++++ app-text/jo/patches/jo-1.6.patchset | 89 +++++++++++++++++++++++++++++ 2 files changed, 150 insertions(+) create mode 100644 app-text/jo/jo-1.6.recipe create mode 100644 app-text/jo/patches/jo-1.6.patchset diff --git a/app-text/jo/jo-1.6.recipe b/app-text/jo/jo-1.6.recipe new file mode 100644 index 000000000..61b656e99 --- /dev/null +++ b/app-text/jo/jo-1.6.recipe @@ -0,0 +1,61 @@ +SUMMARY="JSON output from a shell" +DESCRIPTION="jo is a small utility to create JSON objects on the command line. It creates a JSON \ +string on stdout from words given it as arguments or read from stdin." +HOMEPAGE="https://github.com/jpmens/jo" +COPYRIGHT="2016-2022 Jan-Piet Mens" +LICENSE="GNU GPL v2" +REVISION="1" +SOURCE_URI="https://github.com/jpmens/jo/archive/refs/tags/$portVersion.tar.gz" +CHECKSUM_SHA256="ae2837ddad9993d5e28fe8db00efec6b2378d68b7366021353a1e297b5fa2025" +PATCHES="$portName-$portVersion.patchset" + +ARCHITECTURES="all" + +PROVIDES=" + jo = $portVersion + cmd:jo + " +REQUIRES=" + haiku + " + +BUILD_REQUIRES=" + haiku_devel + " +BUILD_PREREQUIRES=" + cmd:aclocal + cmd:autoconf + cmd:automake + cmd:autoreconf + cmd:awk + cmd:find + cmd:gcc + cmd:grep + cmd:install + cmd:make + cmd:pkg_config + cmd:sed + " + +BUILD() +{ + autoreconf -vfi + + LDFLAGS="-lbsd" runConfigure ./configure \ + --sysconfdir=$dataDir + + make $jobArgs +} + +INSTALL() +{ + make install + + mkdir -p $docDir + cp -a jo.md $docDir +} + +TEST() +{ + make check +} diff --git a/app-text/jo/patches/jo-1.6.patchset b/app-text/jo/patches/jo-1.6.patchset new file mode 100644 index 000000000..8c1894f42 --- /dev/null +++ b/app-text/jo/patches/jo-1.6.patchset @@ -0,0 +1,89 @@ +From 6e04754d66421d0eece695ddf01da1a4c6fd29e9 Mon Sep 17 00:00:00 2001 +From: Chris Roberts +Date: Fri, 4 Feb 2022 20:45:13 +0000 +Subject: gcc2 variable declaration fixes + + +diff --git a/jo.c b/jo.c +index f7c2cd9..2a98392 100644 +--- a/jo.c ++++ b/jo.c +@@ -219,6 +219,8 @@ JsonNode *jo_mknumber(char *str, JsonTag type) { + JsonNode *vnode(char *str, int flags) + { + JsonTag type = flags_to_tag(flags); ++ char *endptr; ++ double num; + + if (strlen(str) == 0) { + return (flags & FLAG_SKIPNULLS) ? (JsonNode *)NULL : jo_mknull(type); +@@ -237,8 +239,7 @@ JsonNode *vnode(char *str, int flags) + return jo_mkstring(str, type); + } + +- char *endptr; +- double num = strtod(str, &endptr); ++ num = strtod(str, &endptr); + + if (!*endptr && isfinite(num)) { + return jo_mknumber(str, type); +@@ -298,10 +299,11 @@ JsonNode *vnode(char *str, int flags) + } + + if (*str == '{' || *str == '[') { ++ JsonNode *obj; + if (type == JSON_STRING) { + return json_mkstring(str); + } +- JsonNode *obj = json_decode(str); ++ obj = json_decode(str); + + if (obj == NULL) { + /* JSON cannot be decoded; return the string */ +@@ -432,17 +434,19 @@ int member_to_object(JsonNode *object, int flags, char key_delim, char *kv) + char *p = strchr(kv, '='); + char *q = strchr(kv, '@'); + char *r = strchr(kv, ':'); ++ JsonNode *val; + + if ((r && *(r+1) == '=') && !q) { + char *filename = p + 1; + char *content; + size_t len; ++ JsonNode *o; + + if ((content = slurp_file(filename, &len, false)) == NULL) { + errx(1, "Error reading file %s", filename); + } + +- JsonNode *o = json_decode(content); ++ o = json_decode(content); + free(content); + + if (o == NULL) { +@@ -459,7 +463,6 @@ int member_to_object(JsonNode *object, int flags, char key_delim, char *kv) + return (-1); + } + +- JsonNode *val; + if (p) { + *p = 0; + val = vnode(p+1, flags); +diff --git a/json.c b/json.c +index ba46d18..333c108 100644 +--- a/json.c ++++ b/json.c +@@ -593,8 +593,9 @@ static void prepend_node(JsonNode *parent, JsonNode *child) + + static void insert_node(JsonNode *parent, JsonNode *child) + { ++ JsonNode *this; + if (!child) return; +- JsonNode *this = parent->children.head; ++ this = parent->children.head; + + while (this != NULL && strcmp(this->key, child->key)) + this = this->next; +-- +2.30.2 +