forked from pool/lua-cjson
Accepting request 874720 from home:mcepl:work
Another Lua JSON package, this one with C module, and much faster. OBS-URL: https://build.opensuse.org/request/show/874720 OBS-URL: https://build.opensuse.org/package/show/devel:languages:lua/lua-cjson?expand=0&rev=1
This commit is contained in:
commit
a586ab7fd4
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
## Default LFS
|
||||||
|
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zst filter=lfs diff=lfs merge=lfs -text
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
.osc
|
5
_multibuild
Normal file
5
_multibuild
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<multibuild>
|
||||||
|
<package>lua51</package>
|
||||||
|
<package>lua53</package>
|
||||||
|
<package>lua54</package>
|
||||||
|
</multibuild>
|
3
lua-cjson-2.1.0.tar.gz
Normal file
3
lua-cjson-2.1.0.tar.gz
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:51bc69cd55931e0cba2ceae39e9efa2483f4292da3a88a1ed470eda829f6c778
|
||||||
|
size 86024
|
10
lua-cjson.changes
Normal file
10
lua-cjson.changes
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Sat Feb 13 11:27:22 UTC 2021 - Matej Cepl <mcepl@suse.com>
|
||||||
|
|
||||||
|
- Make tests work (a little bit, gh#mpx/lua-cjson#75) by adding
|
||||||
|
test_environment.patch.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Jan 29 12:55:13 UTC 2021 - Matej Cepl <mcepl@suse.com>
|
||||||
|
|
||||||
|
- Initial packaging of cjson 2.1.0.
|
85
lua-cjson.spec
Normal file
85
lua-cjson.spec
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
#
|
||||||
|
# spec file for package lua-cjson
|
||||||
|
#
|
||||||
|
# Copyright (c) 2021 SUSE LLC
|
||||||
|
#
|
||||||
|
# All modifications and additions to the file contributed by third parties
|
||||||
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
|
# upon. The license for this file, and modifications and additions to the
|
||||||
|
# file, is the same license as for the pristine package itself (unless the
|
||||||
|
# license for the pristine package is not an Open Source License, in which
|
||||||
|
# case the license is the MIT License). An "Open Source License" is a
|
||||||
|
# license that conforms to the Open Source Definition (Version 1.9)
|
||||||
|
# published by the Open Source Initiative.
|
||||||
|
|
||||||
|
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
%define flavor @BUILD_FLAVOR@
|
||||||
|
%define mod_name cjson
|
||||||
|
Version: 2.1.0
|
||||||
|
Release: 0
|
||||||
|
Summary: Lua JSON Encoding/Decoding
|
||||||
|
License: MIT
|
||||||
|
URL: https://www.kyne.com.au/~mark/software/lua-cjson.php
|
||||||
|
Source0: http://www.kyne.com.au/~mark/software/download/lua-cjson-%{version}.tar.gz
|
||||||
|
# PATCH-FIX-UPSTREAM test_environment.patch gh#mpx/lua-cjson#75 mcepl@suse.com
|
||||||
|
# Make it possible for tests to be influenced by the variables
|
||||||
|
Patch0: test_environment.patch
|
||||||
|
BuildRequires: lua-macros
|
||||||
|
BuildRequires: %{flavor}-devel
|
||||||
|
Requires: %{flavor}
|
||||||
|
BuildRequires: %{flavor}-luarocks
|
||||||
|
BuildRequires: cmake
|
||||||
|
BuildRequires: gcc-c++
|
||||||
|
BuildRequires: pkgconfig
|
||||||
|
%lua_provides
|
||||||
|
%if "%{flavor}" == ""
|
||||||
|
Name: lua-%{mod_name}
|
||||||
|
ExclusiveArch: do_not_build
|
||||||
|
%else
|
||||||
|
Name: %{flavor}-%{mod_name}
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%description
|
||||||
|
This is the Lua extension package for JSON encoding/decoding.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%autosetup -p1 -n lua-%{mod_name}-%{version}
|
||||||
|
|
||||||
|
%build
|
||||||
|
export CFLAGS="%{optflags}"
|
||||||
|
%cmake \
|
||||||
|
-H.. -DCMAKE_C_FLAGS="%{optflags}" \
|
||||||
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||||
|
-DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_COLOR_MAKEFILE=OFF \
|
||||||
|
-DBUILD_STATIC_LIBS=OFF -DCMAKE_INSTALL_DO_STRIP=OFF \
|
||||||
|
-DBUILD_SHARED_LIBS=ON \
|
||||||
|
-DLUA_INCLUDE_DIR:PATH="%{lua_incdir}"
|
||||||
|
find ..
|
||||||
|
|
||||||
|
%make_build \
|
||||||
|
CC="gcc" \
|
||||||
|
PREFIX="%{_prefix}" \
|
||||||
|
LUA_INCLUDE_DIR=%{lua_incdir}
|
||||||
|
|
||||||
|
%install
|
||||||
|
mkdir -p -m 755 \
|
||||||
|
%{buildroot}%{lua_archdir} \
|
||||||
|
%{buildroot}%{lua_noarchdir}/cjson
|
||||||
|
install -m755 build/cjson.so %{buildroot}%{lua_archdir}/
|
||||||
|
install -m644 lua/cjson/util.lua %{buildroot}%{lua_noarchdir}/cjson/
|
||||||
|
|
||||||
|
%check
|
||||||
|
rm -rf build
|
||||||
|
export CFLAGS="%{optflags}" PREFIX="%{_prefix}" \
|
||||||
|
LUA_INCLUDE_DIR="%{lua_incdir}" LUA_CMODULE_DIR="%{lua_archdir}" LUA_MODULE_DIR="%{lua_noarchdir}"
|
||||||
|
./runtests.sh
|
||||||
|
|
||||||
|
%files
|
||||||
|
%{lua_archdir}/cjson.so
|
||||||
|
%dir %{lua_noarchdir}/cjson
|
||||||
|
%{lua_noarchdir}/cjson/util.lua
|
||||||
|
|
||||||
|
%changelog
|
60
test_environment.patch
Normal file
60
test_environment.patch
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
---
|
||||||
|
Makefile | 4 ++--
|
||||||
|
runtests.sh | 2 +-
|
||||||
|
2 files changed, 3 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
--- a/runtests.sh
|
||||||
|
+++ b/runtests.sh
|
||||||
|
@@ -1,4 +1,5 @@
|
||||||
|
#!/bin/sh
|
||||||
|
+set -x
|
||||||
|
|
||||||
|
PLATFORM="`uname -s`"
|
||||||
|
[ "$1" ] && VERSION="$1" || VERSION="2.1.0"
|
||||||
|
@@ -56,15 +57,15 @@ do_tests
|
||||||
|
make clean
|
||||||
|
rm -rf tests/cjson{,.so}
|
||||||
|
|
||||||
|
-echo "===== Testing Cmake build ====="
|
||||||
|
-mkdir build
|
||||||
|
-cd build
|
||||||
|
-cmake ..
|
||||||
|
-make
|
||||||
|
-cd ..
|
||||||
|
-cp -r lua/cjson build/cjson.so tests
|
||||||
|
-do_tests
|
||||||
|
-rm -rf build tests/cjson{,.so}
|
||||||
|
+# echo "===== Testing Cmake build ====="
|
||||||
|
+# mkdir build
|
||||||
|
+# cd build
|
||||||
|
+# cmake "$CMAKE_FLAGS" ..
|
||||||
|
+# make
|
||||||
|
+# cd ..
|
||||||
|
+# cp -r lua/cjson build/cjson.so tests
|
||||||
|
+# do_tests
|
||||||
|
+# rm -rf build tests/cjson{,.so}
|
||||||
|
|
||||||
|
if [ "$PLATFORM" = "Linux" ]
|
||||||
|
then
|
||||||
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -13,14 +13,14 @@
|
||||||
|
##### Build defaults #####
|
||||||
|
LUA_VERSION = 5.1
|
||||||
|
TARGET = cjson.so
|
||||||
|
-PREFIX = /usr/local
|
||||||
|
+PREFIX ?= /usr/local
|
||||||
|
#CFLAGS = -g -Wall -pedantic -fno-inline
|
||||||
|
-CFLAGS = -O3 -Wall -pedantic -DNDEBUG
|
||||||
|
+CFLAGS ?= -O3 -Wall -pedantic -DNDEBUG
|
||||||
|
CJSON_CFLAGS = -fpic
|
||||||
|
CJSON_LDFLAGS = -shared
|
||||||
|
-LUA_INCLUDE_DIR = $(PREFIX)/include
|
||||||
|
-LUA_CMODULE_DIR = $(PREFIX)/lib/lua/$(LUA_VERSION)
|
||||||
|
-LUA_MODULE_DIR = $(PREFIX)/share/lua/$(LUA_VERSION)
|
||||||
|
+LUA_INCLUDE_DIR ?= $(PREFIX)/include
|
||||||
|
+LUA_CMODULE_DIR ?= $(PREFIX)/lib/lua/$(LUA_VERSION)
|
||||||
|
+LUA_MODULE_DIR ?= $(PREFIX)/share/lua/$(LUA_VERSION)
|
||||||
|
LUA_BIN_DIR = $(PREFIX)/bin
|
||||||
|
|
||||||
|
##### Platform overrides #####
|
Loading…
x
Reference in New Issue
Block a user