Skip to content

Commit 3eda97c

Browse files
committed
Fix building with luarocks
Building with `luarocks make` was broken in f3c8bf6 since DMPACK_USE_AMALGAMATION is not defined by default. Change defines in lmpack.c to only use system libmpack if DMPACK_USE_SYSTEM is defined.
1 parent ef02522 commit 3eda97c

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,11 @@ INCLUDES = $(LUA_INCLUDE)
5454
LIBS =
5555

5656
ifeq ($(USE_SYSTEM_MPACK),no)
57-
CFLAGS += -DMPACK_USE_AMALGAMATION
5857
MPACK_SRC = mpack-src
5958
else
6059
MPACK_SRC =
6160
LIBS += $(shell $(PKG_CONFIG) --libs mpack 2>/dev/null || echo "-lmpack")
62-
CFLAGS += $(shell $(PKG_CONFIG) --cflags mpack 2> /dev/null)
61+
CFLAGS += -DMPACK_USE_SYSTEM $(shell $(PKG_CONFIG) --cflags mpack 2> /dev/null)
6362
endif
6463

6564
LUA_CMOD_INSTALLDIR ?= $(shell $(PKG_CONFIG) --variable=INSTALL_CMOD $(LUA_IMPL) 2>/dev/null || echo "/usr/lib/lua/$(MPACK_LUA_VERSION_NOPATCH)")

lmpack.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
#include <lua.h>
2424
#include <luaconf.h>
2525

26-
#ifdef MPACK_USE_AMALGAMATION
26+
#ifdef MPACK_USE_SYSTEM
27+
# include <mpack.h>
28+
#else
2729
# define MPACK_API static
2830
# include "mpack-src/src/mpack.c"
29-
#else
30-
# include <mpack.h>
3131
#endif
3232

3333
#define UNPACKER_META_NAME "mpack.Unpacker"

0 commit comments

Comments
 (0)