Import devel/libmpack. Needed for neovim.

---8<---
libmpack is a small binary serialization/RPC library that implements both the
msgpack and msgpack-rpc specifications.
--->8---

OK jca@ and with input from sthen@. Many thanks.
This commit is contained in:
edd 2017-02-04 12:40:43 +00:00
parent 03ea571fb4
commit c7d8461abe
15 changed files with 176 additions and 0 deletions

12
devel/libmpack/Makefile Normal file
View File

@ -0,0 +1,12 @@
# $OpenBSD: Makefile,v 1.1.1.1 2017/02/04 12:40:43 edd Exp $
#
# The SUBDIRs used here fetch the same distfile. Although we could have used a
# single directory, the mix of SUBPACKAGES and Lua FLAVORS makes the port
# somewhat complicated. We opted to keep it simple and split them out.
SUBDIR = main
SUBDIR += lua
SUBDIR += lua,lua52
SUBDIR += lua,lua53
.include <bsd.port.subdir.mk>

View File

@ -0,0 +1,18 @@
# $OpenBSD: Makefile.inc,v 1.1.1.1 2017/02/04 12:40:43 edd Exp $
V ?= 1.0.3
DISTNAME ?= libmpack-${V}
GH_ACCOUNT ?= tarruda
GH_PROJECT ?= libmpack
GH_TAGNAME ?= ${V}
CATEGORIES ?= devel
HOMEPAGE ?= https://github.com/tarruda/libmpack
# MIT
PERMIT_PACKAGE_CDROM ?= Yes
USE_GMAKE ?= Yes
MAKE_FLAGS ?= config=release

View File

@ -0,0 +1,30 @@
# $OpenBSD: Makefile,v 1.1.1.1 2017/02/04 12:40:43 edd Exp $
COMMENT = Lua bindings to libmsgpack
PKGNAME = lua-libmpack-${V}
FLAVORS = lua52 lua53
FLAVOR ?=
WANTLIB += ${MODLUA_WANTLIB} m
MODULES = lang/lua
RUN_DEPENDS += libmpack->=${V}:devel/libmpack/main
WRKSRC = ${WRKDIST}/binding/lua
MAKE_FLAGS += USE_SYSTEM_LUA=yes \
LUA_VERSION_MAJ_MIN=${MODLUA_VERSION:S/.//}
# The install target installs in the wrong place. Since it is just one file,
# it is easier to use a custom target than to patch and SUBST_CMD.
do-install:
${INSTALL_DATA_DIR} ${MODLUA_LIBDIR}
${INSTALL_DATA} ${WRKSRC}/mpack.so ${MODLUA_LIBDIR}
# There is a Lua binding test suite written in the "busted framework", which we
# don't yet have in-tree. Until it is, we have our own (minimal) test.
TEST_DEPENDS += ${FULLPKGNAME}:${BASE_PKGPATH}
do-test:
${MODLUA_BIN} ${FILESDIR}/test.lua
.include <bsd.port.mk>

View File

@ -0,0 +1,2 @@
SHA256 (libmpack-1.0.3.tar.gz) = Zeshz6kxMgSsUpbjswXXUrhCLHJLY3XK7MY4XwptbiI=
SIZE (libmpack-1.0.3.tar.gz) = 45720

View File

@ -0,0 +1,22 @@
-- Minimal test for lua bindings
local mpack = require('mpack')
local pack = mpack.Packer()
local unpack = mpack.Unpacker()
local input = {one=1, two=2, eleven=11, eighty=80}
local bdata = pack(input)
local output = unpack(bdata)
local n=0
for k,v in pairs(output) do
n=n+1
end
assert(n, 4)
assert(output["one"] == 1)
assert(output["two"] == 2)
assert(output["eleven"] == 11)
assert(output["eighty"] == 80)
print("Lua binding test passed")

View File

@ -0,0 +1,6 @@
$OpenBSD: patch-_config_release_mk,v 1.1.1.1 2017/02/04 12:40:43 edd Exp $
--- .config/release.mk.orig Tue Jan 17 22:17:32 2017
+++ .config/release.mk Tue Jan 17 22:17:38 2017
@@ -1 +1 @@
-XCFLAGS += -O3 -DNDEBUG
+XCFLAGS += -DNDEBUG

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-binding_lua_Makefile,v 1.1.1.1 2017/02/04 12:40:43 edd Exp $
--- binding/lua/Makefile.orig Sun Sep 18 21:09:16 2016
+++ binding/lua/Makefile Thu Dec 29 16:24:17 2016
@@ -33,8 +33,8 @@ CFLAGS ?= -ansi -O0 -g3 -Wall -Wextra -Werror -Wconver
-Wstrict-prototypes -Wno-unused-parameter -pedantic
CFLAGS += -fPIC -DMPACK_DEBUG_REGISTRY_LEAK
-LUA_INCLUDE := $(shell $(PKG_CONFIG) --cflags lua-$(LUA_VERSION_MAJ_MIN) 2>/dev/null || echo "-I/usr/include/lua$(LUA_VERSION_MAJ_MIN)")
-LUA_LIB := $(shell $(PKG_CONFIG) --libs lua-$(LUA_VERSION_MAJ_MIN) 2>/dev/null || echo "-llua$(LUA_VERSION_MAJ_MIN)")
+LUA_INCLUDE := $(shell $(PKG_CONFIG) --cflags lua$(LUA_VERSION_MAJ_MIN) 2>/dev/null || echo "-I/usr/include/lua$(LUA_VERSION_MAJ_MIN)")
+LUA_LIB := $(shell $(PKG_CONFIG) --libs lua$(LUA_VERSION_MAJ_MIN) 2>/dev/null || echo "-llua$(LUA_VERSION_MAJ_MIN)")
INCLUDES = $(LUA_INCLUDE)
LIBS = $(LUA_LIB)

View File

@ -0,0 +1 @@
Lua bindings to libmpack.

View File

@ -0,0 +1,2 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2017/02/04 12:40:43 edd Exp $
lib/lua/${MODLUA_VERSION}/mpack.so

View File

@ -0,0 +1,7 @@
# $OpenBSD: Makefile,v 1.1.1.1 2017/02/04 12:40:43 edd Exp $
COMMENT = simple implementation of msgpack in C
SHARED_LIBS += mpack 0.0
.include <bsd.port.mk>

View File

@ -0,0 +1,2 @@
SHA256 (libmpack-1.0.3.tar.gz) = Zeshz6kxMgSsUpbjswXXUrhCLHJLY3XK7MY4XwptbiI=
SIZE (libmpack-1.0.3.tar.gz) = 45720

View File

@ -0,0 +1,46 @@
$OpenBSD: patch-Makefile,v 1.1.1.1 2017/02/04 12:40:43 edd Exp $
--- Makefile.orig Sun Sep 18 21:09:16 2016
+++ Makefile Thu Dec 29 15:48:41 2016
@@ -68,8 +68,14 @@ PROFOUT := $(OUTDIR)/gprof.txt
TEST_FILTER_OUT := --coverage -ansi -std=c99
.PHONY: all
-all: lib-bin test-bin
+all: dirs lib-bin test-bin
+.PHONY: dirs
+dirs:
+ mkdir -p $(BINDIR)/$(config)/src/.libs
+ mkdir -p $(BINDIR)/$(config)/test/.libs
+ mkdir -p $(BINDIR)/$(config)/test/deps/tap/.libs
+
include .config/$(config).mk
.PHONY: tools
@@ -109,19 +115,19 @@ compile_commands.json:
.PHONY: install
install: install-inc install-lib
- $(LIBTOOL) --mode=finish '$(DESTDIR)$(LIBDIR)'
+ $(LIBTOOL) --mode=finish '$(LIBDIR)'
.PHONY: install-inc
install-inc: $(AMALG_H) mpack.pc.in
- mkdir -p '$(DESTDIR)$(INCDIR)'
- install -m644 $(AMALG_H) '$(DESTDIR)$(INCDIR)'
- mkdir -p '$(DESTDIR)$(LIBDIR)/pkgconfig'
- sed 's,@VERSION@,$(VERSION),;s,@LIBDIR@,$(LIBDIR),;s,@INCDIR@,$(INCDIR),' <mpack.pc.in >'$(DESTDIR)$(LIBDIR)/pkgconfig/mpack.pc'
+ mkdir -p '$(INCDIR)'
+ install -m644 $(AMALG_H) '$(INCDIR)'
+ mkdir -p '$(LIBDIR)/pkgconfig'
+ sed 's,@VERSION@,$(VERSION),;s,@LIBDIR@,$(LIBDIR),;s,@INCDIR@,$(INCDIR),' <mpack.pc.in >'$(LIBDIR)/pkgconfig/mpack.pc'
.PHONY: install-lib
install-lib: $(LIB)
- mkdir -p '$(DESTDIR)$(LIBDIR)'
- $(LIBTOOL) --mode=install cp $(LIB) '$(DESTDIR)$(LIBDIR)/$(LIBRARY)'
+ mkdir -p '$(LIBDIR)'
+ $(LIBTOOL) --mode=install cp $(LIB) '$(LIBDIR)/$(LIBRARY)'
.PHONY: clean
clean:

View File

@ -0,0 +1,6 @@
$OpenBSD: patch-_config_release_mk,v 1.1.1.1 2017/02/04 12:40:43 edd Exp $
--- .config/release.mk.orig Tue Jan 17 22:17:32 2017
+++ .config/release.mk Tue Jan 17 22:17:38 2017
@@ -1 +1 @@
-XCFLAGS += -O3 -DNDEBUG
+XCFLAGS += -DNDEBUG

View File

@ -0,0 +1,2 @@
libmpack is a small binary serialization/RPC library that implements both the
msgpack and msgpack-rpc specifications.

View File

@ -0,0 +1,6 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2017/02/04 12:40:43 edd Exp $
include/mpack.h
lib/libmpack.a
lib/libmpack.la
@lib lib/libmpack.so.${LIBmpack_VERSION}
lib/pkgconfig/mpack.pc