summaryrefslogtreecommitdiff
path: root/dev-lua/lua-cjson
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2020-12-14 13:26:14 +0000
committerV3n3RiX <venerix@redcorelinux.org>2020-12-14 13:26:14 +0000
commit6abbf81ef2f298e3221ff5e67a1f3c5f23958212 (patch)
tree25413d1cb3a0cbfe36029db32398c0f333609215 /dev-lua/lua-cjson
parent9c417bacd51da6d8b57fa9f37425161d30d4b95b (diff)
gentoo resync : 14.12.2020
Diffstat (limited to 'dev-lua/lua-cjson')
-rw-r--r--dev-lua/lua-cjson/Manifest7
-rw-r--r--dev-lua/lua-cjson/files/lua-cjson-2.1.0.8-lua52.patch143
-rw-r--r--dev-lua/lua-cjson/files/lua-cjson-2.1.0.8-sparse_array_test_fix.patch31
-rw-r--r--dev-lua/lua-cjson/lua-cjson-2.1.0.8-r100.ebuild105
-rw-r--r--dev-lua/lua-cjson/lua-cjson-2.1.0.8.ebuild70
-rw-r--r--dev-lua/lua-cjson/metadata.xml6
6 files changed, 360 insertions, 2 deletions
diff --git a/dev-lua/lua-cjson/Manifest b/dev-lua/lua-cjson/Manifest
index fb73a0212ed6..f07a0d22a892 100644
--- a/dev-lua/lua-cjson/Manifest
+++ b/dev-lua/lua-cjson/Manifest
@@ -1,6 +1,11 @@
+AUX lua-cjson-2.1.0.8-lua52.patch 3588 BLAKE2B 989bd667dd62cf7b39c0188c1fcf94d6890e9839c662e75782bba26faf9fa35c7def97c172c74ec8cb3eb07a0413aa66e7b860d07c2caf459be52ec37450dd1f SHA512 9f16ae9d7885d835252a49208e00199ee8d4bf10790a9b2e696026171831b4a579938ecf7f980631f3fccee55f1d000212dfea80d1ebc22743550847d43f1d26
+AUX lua-cjson-2.1.0.8-sparse_array_test_fix.patch 1084 BLAKE2B 3f6e439b54602a8fb07badb87bd53ce8affbb53f7434a32677b1de0cfc92b6f9f75f21a7c09763649c5cbadf59a8647d704cce1e0e98207e72bb696c9cb8ddbe SHA512 31358192ecff4a06ef045cf8b3d8f717e65674752e1ae70a8e87a487e89a4819448285c537ef5393b05bbb285a0708be37bd7dafa9b8bacbf4bb0e8bdd9fdb67
AUX sparse_array_test_fix.patch 1643 BLAKE2B 6967eefee4a1bf3bdf14f7c2cd56814642adf4321007fc3a9b7f5e4022f468006e8674e6832d3a5fe1ef995b360de6e60bf738a6c3664f78d80d1000380939ae SHA512 597a4eeb180177ccb72f025b9abefe339b845ad188cd6287036905ab613aa36df24f0b51a515bb1718a0286e64b5b12a0cb8864dea2203b69407f9bc665ce393
DIST lua-cjson-2.1.0.6.tar.gz 76820 BLAKE2B 1056fefc8d9c802e068e1e7801cc1eb3a0279371ab72e4e8517e22ad68224dd4892f4e4cbfe0a407af71f1008affded41d7bcc05d89c4ddb0c437d93d67708a7 SHA512 71d25f4ec82641d56e33e13c0ecd8c60186b3c4faf3d30de81706d1305d4e61691a1e84210462942674e50ca2ff19e126cb04025d9645d5d26ef3b3b0e46f64b
DIST lua-cjson-2.1.0.7.tar.gz 76949 BLAKE2B 9189890f24885191001e79cf0f48aaee74026572eda3e767b0e5e63d44634156fd2b972287cb23e243b3fd0f44f8e87a1fcb0c0b8e26197c63e5e0ff30cb3a94 SHA512 c66fbb608dcd1b7daef8c70ad9a60ab442bf8b851b8d8c5e3b11854ab476dff115e2eef31f171a40ce364778682ce351114caf36c995521ec589bd9dd94415c5
+DIST lua-cjson-2.1.0.8.tar.gz 77211 BLAKE2B 227171576318939ab48abe26e87fa905cf9a15e6ff44065c0713b6a6fedac571f1dbbb88526b957836a4368e71c4d19a748b2a3250221572f580f1d32ccf50a0 SHA512 577278ccb58a23ea56ea9ad34c5fb0a07c13c6691a3b666f58fa6427bca269aaec26271d7400dcd253c922d1bb0b3b322915a2ce139880c1ed4c1d2c15437580
EBUILD lua-cjson-2.1.0.6.ebuild 1051 BLAKE2B d9bef905dc69033611379de72f7216e1766c659d4e0c12ad7875857bc8af1991b874880130acb0ef9e150a8f2028e1a94327727cbbe1bde3d9a2f477d37dfbf9 SHA512 e9d21719becf80e547404c1a28f2cc07197fff512df92b8535a91889dc5d57b0b95d7b5c744d2e11c6dae38f34934b0bdaeddeb59ec32fb8e1b49857f05d7771
EBUILD lua-cjson-2.1.0.7.ebuild 1051 BLAKE2B d9bef905dc69033611379de72f7216e1766c659d4e0c12ad7875857bc8af1991b874880130acb0ef9e150a8f2028e1a94327727cbbe1bde3d9a2f477d37dfbf9 SHA512 e9d21719becf80e547404c1a28f2cc07197fff512df92b8535a91889dc5d57b0b95d7b5c744d2e11c6dae38f34934b0bdaeddeb59ec32fb8e1b49857f05d7771
-MISC metadata.xml 678 BLAKE2B fa30839c521f01f875cc3eb8d0a4904975306436464e475acc0aee9acc2f856fc8895444344acda575a69be8d9e35a25f1bd8f4efccb0f174621f54aaa5e1775 SHA512 d4ed2bdea1df6a8ca3a0d4d1405f2e2c1ecd38d0229d6b5a3264c4ffabc4487a52e558fd56cf2903ff7ada9a7cb7204245bf5288a0834ff520a111c814b1e0a2
+EBUILD lua-cjson-2.1.0.8-r100.ebuild 2011 BLAKE2B 5aafff2cd5201a5db81f1ba16f22f2a7e60a8ec94f352231d34fa0ff04b63f0e90b0714f42084ee9bfbdffba27f045eeec21319ac586b95833ebf17b7b9646de SHA512 08abb466a3e4fdf7a07ac8e64d9c86f76a99ccad21b7cacae3c13b1db0c09b832c1017589423dcfa2fc20ad1092982ea9c525d9703cd94a5be793adbb1a68fa2
+EBUILD lua-cjson-2.1.0.8.ebuild 1660 BLAKE2B 601d00a060462cafbc1107947387fd73c9ceefcb1aa8e901e16ee63d526192459ec900bdcea19a8f25aae3c87d53915c6a846bbaf5cc564ae15f14f0a352ca6e SHA512 2cacc3460386d732aa9be52ba12a165166d0634a2c8e74bf26c6dba156eccefe060bbe9648256c2dd7b1c0e664e4ccf5b2d3f1ed979ab9b565a400478c78ec0a
+MISC metadata.xml 779 BLAKE2B 605a71234ea6e3f8eb770b56cdd725cdc244b643c9676afa4552b3f2ef24d6a1c6d96c0468768b16412a8bbaf5ba29b177a57aec6c7a3c006f16da955d952dd7 SHA512 be9492a64cd4be16f395ec49aa031fed8dcddf844df243cd8456452f002098a2cb47ce1e99dffa0843661986ec5352f4feb749578ee5a63a8b47624c3ffae022
diff --git a/dev-lua/lua-cjson/files/lua-cjson-2.1.0.8-lua52.patch b/dev-lua/lua-cjson/files/lua-cjson-2.1.0.8-lua52.patch
new file mode 100644
index 000000000000..8f8c98243f1f
--- /dev/null
+++ b/dev-lua/lua-cjson/files/lua-cjson-2.1.0.8-lua52.patch
@@ -0,0 +1,143 @@
+From e8dddaf2c9c370f3676441304955d81543c5cceb Mon Sep 17 00:00:00 2001
+From: leaf corcoran <leafot@gmail.com>
+Date: Sat, 21 Sep 2019 17:31:38 -0700
+Subject: [PATCH 1/5] support lua 5.2 with LUA_COMPAT_ALL
+
+---
+ lua_cjson.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/lua_cjson.c b/lua_cjson.c
+index 2a69699..83118b1 100644
+--- a/lua_cjson.c
++++ b/lua_cjson.c
+@@ -36,6 +36,9 @@
+ * difficult to know object/array sizes ahead of time.
+ */
+
++
++#define LUA_COMPAT_ALL 1
++
+ #include <assert.h>
+ #include <stdint.h>
+ #include <string.h>
+
+From 2b3c3c866701a0110a6ac50a9bec9f23adc2956e Mon Sep 17 00:00:00 2001
+From: leaf corcoran <leafot@gmail.com>
+Date: Sat, 21 Sep 2019 18:01:05 -0700
+Subject: [PATCH 2/5] support lua 5.3 with LUA_COMPAT_5_1
+
+---
+ lua_cjson.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/lua_cjson.c b/lua_cjson.c
+index 83118b1..9d25f7c 100644
+--- a/lua_cjson.c
++++ b/lua_cjson.c
+@@ -38,6 +38,7 @@
+
+
+ #define LUA_COMPAT_ALL 1
++#define LUA_COMPAT_5_1 1
+
+ #include <assert.h>
+ #include <stdint.h>
+
+From 639c4a38bf0b1bddef4bfdb22bb6a3f8493cc3fe Mon Sep 17 00:00:00 2001
+From: leaf corcoran <leafot@gmail.com>
+Date: Sat, 21 Sep 2019 18:18:27 -0700
+Subject: [PATCH 3/5] Lua 5.2+ unpack support
+
+---
+ lua/cjson/util.lua | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/lua/cjson/util.lua b/lua/cjson/util.lua
+index 5d80106..48fa33c 100644
+--- a/lua/cjson/util.lua
++++ b/lua/cjson/util.lua
+@@ -1,5 +1,7 @@
+ local json = require "cjson"
+
++local unpack = unpack or table.unpack
++
+ -- Various common routines used by the Lua CJSON package
+ --
+ -- Mark Pulford <mark@kyne.com.au>
+
+From 9163dd3c431bd7ab45bdb218c32c8c9633ddf2cc Mon Sep 17 00:00:00 2001
+From: leaf corcoran <leafot@gmail.com>
+Date: Sat, 21 Sep 2019 18:43:47 -0700
+Subject: [PATCH 4/5] Lua 5.2+ maxn support
+
+---
+ lua/cjson/util.lua | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/lua/cjson/util.lua b/lua/cjson/util.lua
+index 48fa33c..2405257 100644
+--- a/lua/cjson/util.lua
++++ b/lua/cjson/util.lua
+@@ -2,6 +2,16 @@ local json = require "cjson"
+
+ local unpack = unpack or table.unpack
+
++local maxn = table.maxn or function(t)
++ local max = 0
++ for k,v in pairs(t) do
++ if type(k) == "number" and k > max then
++ max = k
++ end
++ end
++ return max
++end
++
+ -- Various common routines used by the Lua CJSON package
+ --
+ -- Mark Pulford <mark@kyne.com.au>
+@@ -194,7 +204,7 @@ local function run_test(testname, func, input, should_work, output)
+ local result = {}
+ local tmp = { pcall(func, unpack(input)) }
+ local success = tmp[1]
+- for i = 2, table.maxn(tmp) do
++ for i = 2, maxn(tmp) do
+ result[i - 1] = tmp[i]
+ end
+
+
+From c390998582b959389d0fc039743c96e861902587 Mon Sep 17 00:00:00 2001
+From: leaf corcoran <leafot@gmail.com>
+Date: Sun, 22 Sep 2019 13:43:18 -0700
+Subject: [PATCH 5/5] use macro instead of header defines for Lua 5.2+ support
+
+---
+ lua_cjson.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/lua_cjson.c b/lua_cjson.c
+index 9d25f7c..718a5b9 100644
+--- a/lua_cjson.c
++++ b/lua_cjson.c
+@@ -36,10 +36,6 @@
+ * difficult to know object/array sizes ahead of time.
+ */
+
+-
+-#define LUA_COMPAT_ALL 1
+-#define LUA_COMPAT_5_1 1
+-
+ #include <assert.h>
+ #include <stdint.h>
+ #include <string.h>
+@@ -105,6 +101,10 @@
+ #define json_lightudata_mask(ludata) (ludata)
+ #endif
+
++#if LUA_VERSION_NUM > 501
++#define lua_objlen(L,i) lua_rawlen(L, (i))
++#endif
++
+ static const char * const *json_empty_array;
+ static const char * const *json_array;
+
diff --git a/dev-lua/lua-cjson/files/lua-cjson-2.1.0.8-sparse_array_test_fix.patch b/dev-lua/lua-cjson/files/lua-cjson-2.1.0.8-sparse_array_test_fix.patch
new file mode 100644
index 000000000000..e031672dae33
--- /dev/null
+++ b/dev-lua/lua-cjson/files/lua-cjson-2.1.0.8-sparse_array_test_fix.patch
@@ -0,0 +1,31 @@
+--- a/tests/test.lua
++++ b/tests/test.lua
+@@ -10,6 +10,17 @@
+ local json_safe = require "cjson.safe"
+ local util = require "cjson.util"
+
++local function json_encode_output_type(value)
++ local text = json.encode(value)
++ if string.match(text, "{.*}") then
++ return "object"
++ elseif string.match(text, "%[.*%]") then
++ return "array"
++ else
++ return "scalar"
++ end
++end
++
+ local function gen_raw_octets()
+ local chars = {}
+ for i = 0, 255 do chars[i + 1] = string.char(i) end
+@@ -292,8 +303,8 @@
+ json.encode, { { [1] = "one", [4] = "sparse test" } },
+ true, { '["one",null,null,"sparse test"]' } },
+ { "Encode sparse array as object",
+- json.encode, { { [1] = "one", [5] = "sparse test" } },
+- true, { '{"5":"sparse test","1":"one"}' } },
++ json_encode_output_type, { { [1] = "one", [5] = "sparse test" } },
++ true, { 'object' } },
+ { "Encode table with numeric string key as object",
+ json.encode, { { ["2"] = "numeric string key test" } },
+ true, { '{"2":"numeric string key test"}' } },
diff --git a/dev-lua/lua-cjson/lua-cjson-2.1.0.8-r100.ebuild b/dev-lua/lua-cjson/lua-cjson-2.1.0.8-r100.ebuild
new file mode 100644
index 000000000000..c7ff3172c0be
--- /dev/null
+++ b/dev-lua/lua-cjson/lua-cjson-2.1.0.8-r100.ebuild
@@ -0,0 +1,105 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+LUA_COMPAT=( lua5-{1..3} luajit )
+
+inherit lua toolchain-funcs
+
+DESCRIPTION="A fast JSON encoding/parsing module for Lua"
+HOMEPAGE="https://www.kyne.com.au/~mark/software/lua-cjson.php https://github.com/openresty/lua-cjson"
+SRC_URI="https://github.com/openresty/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~x86"
+IUSE="+internal-fpconv test +threads"
+REQUIRED_USE="
+ threads? ( internal-fpconv )
+ ${LUA_REQUIRED_USE}
+"
+RESTRICT="!test? ( test )"
+
+RDEPEND="${LUA_DEPS}"
+DEPEND="${RDEPEND}"
+BDEPEND="test? ( dev-lang/perl )"
+
+DOCS=( "manual.txt" "NEWS" "performance.txt" "README.md" "THANKS" )
+
+PATCHES=(
+ "${FILESDIR}/${PN}-2.1.0.8-sparse_array_test_fix.patch"
+ "${FILESDIR}/${PN}-2.1.0.8-lua52.patch"
+)
+
+src_prepare() {
+ default
+
+ # Don't install tests
+ sed -e '/cd tests/d' -i Makefile || die
+
+ lua_copy_sources
+}
+
+lua_src_compile() {
+ pushd "${BUILD_DIR}" || die
+
+ local myemakeargs=(
+ "CC=$(tc-getCC)"
+ "CFLAGS=${CFLAGS}"
+ "LDFLAGS=${LDFLAGS}"
+ "LUA_INCLUDE_DIR=$(lua_get_include_dir)"
+ )
+
+ emake "${myemakeargs[@]}"
+
+ popd
+}
+
+src_compile() {
+ lua_foreach_impl lua_src_compile
+}
+
+lua_src_test() {
+ if ! [[ ${ELUA} == "lua5.3" ]]; then
+ pushd "${BUILD_DIR}" || die
+ cd tests || die
+
+ ln -s "${BUILD_DIR}"/cjson.so ./ || die
+ ln -s "${S}"/lua/cjson ./ || die
+
+ ./genutf8.pl || die
+ ./test.lua || die
+
+ popd
+ else
+ ewarn "Not running tests under ${ELUA} because they are known to fail"
+ ewarn "See: https://github.com/openresty/lua-cjson/pull/50"
+ return
+ fi
+}
+
+src_test() {
+ lua_foreach_impl lua_src_test
+}
+
+lua_src_install() {
+ pushd "${BUILD_DIR}" || die
+
+ local myemakeargs=(
+ "DESTDIR=${D}"
+ "LUA_CMODULE_DIR=$(lua_get_lmod_dir)"
+ "LUA_MODULE_DIR=$(lua_get_lmod_dir)"
+ "PREFIX=${EPREFIX}/usr"
+ )
+
+ emake "${myemakeargs[@]}" install install-extra
+
+ popd
+}
+
+src_install() {
+ lua_foreach_impl lua_src_install
+
+ einstalldocs
+}
diff --git a/dev-lua/lua-cjson/lua-cjson-2.1.0.8.ebuild b/dev-lua/lua-cjson/lua-cjson-2.1.0.8.ebuild
new file mode 100644
index 000000000000..2b1199417496
--- /dev/null
+++ b/dev-lua/lua-cjson/lua-cjson-2.1.0.8.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit toolchain-funcs
+
+DESCRIPTION="A fast JSON encoding/parsing module for Lua"
+HOMEPAGE="https://www.kyne.com.au/~mark/software/lua-cjson.php https://github.com/openresty/lua-cjson"
+SRC_URI="https://github.com/openresty/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~x86"
+IUSE="+internal-fpconv luajit test +threads"
+RESTRICT="!test? ( test )"
+REQUIRED_USE="threads? ( internal-fpconv )"
+
+RDEPEND="
+ luajit? ( dev-lang/luajit:2 )
+ !luajit? ( dev-lang/lua:0 )
+"
+
+DEPEND="${RDEPEND}"
+BDEPEND="test? ( dev-lang/perl )"
+
+DOCS=( "manual.txt" "NEWS" "performance.txt" "README.md" "THANKS" )
+
+PATCHES=( "${FILESDIR}/${PN}-2.1.0.8-sparse_array_test_fix.patch" )
+
+src_prepare() {
+ default
+
+ # Don't install tests
+ sed -e '/cd tests/d' -i Makefile || die
+}
+
+src_compile() {
+ local myemakeargs=(
+ "CC=$(tc-getCC)"
+ "CFLAGS=${CFLAGS}"
+ "LDFLAGS=${LDFLAGS}"
+ "LUA_INCLUDE_DIR=$($(tc-getPKG_CONFIG) --variable $(usex luajit 'includedir' 'INSTALL_INC') $(usex luajit 'luajit' 'lua'))"
+ )
+
+ emake "${myemakeargs[@]}"
+}
+
+src_test() {
+ cd tests || die
+
+ ln -s "${S}"/cjson.so ./ || die
+ ln -s "${S}"/lua/cjson ./ || die
+
+ ./genutf8.pl || die
+ ./test.lua || die
+}
+
+src_install() {
+ local myemakeargs=(
+ "DESTDIR=${D}"
+ "LUA_CMODULE_DIR=$($(tc-getPKG_CONFIG) --variable INSTALL_CMOD $(usex luajit 'luajit' 'lua'))"
+ "LUA_MODULE_DIR=$($(tc-getPKG_CONFIG) --variable INSTALL_LMOD $(usex luajit 'luajit' 'lua'))"
+ "PREFIX=${EPREFIX}/usr"
+ )
+
+ emake "${myemakeargs[@]}" install install-extra
+
+ einstalldocs
+}
diff --git a/dev-lua/lua-cjson/metadata.xml b/dev-lua/lua-cjson/metadata.xml
index 5b6408370bec..a4d07bda238c 100644
--- a/dev-lua/lua-cjson/metadata.xml
+++ b/dev-lua/lua-cjson/metadata.xml
@@ -5,7 +5,11 @@
<email>gyakovlev@gentoo.org</email>
<name>Georgy Yakovlev</name>
</maintainer>
- <longdescription lang="en">
+ <maintainer type="person">
+ <email>conikost@gentoo.org</email>
+ <name>Conrad Kostecki</name>
+ </maintainer>
+ <longdescription>
OpenResty fork of mpx/lua-cjson, includes a few bugfixes and improvements,
especially to facilitate the encoding of empty tables as JSON Arrays.
</longdescription>