From 5970e0a93f691bdb7134f6cc2598e6d5aca63c1b Mon Sep 17 00:00:00 2001 From: Mark Pulford Date: Tue, 13 Dec 2011 22:29:11 +1030 Subject: Remove external VERSION #define for lua_cjson.c The external #define complicates compilation but is only used in lua_cjson.c and Makefile. --- Makefile | 2 +- lua-cjson-1.0.4-1.rockspec | 6 +++--- lua_cjson.c | 6 +++++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 26f5253..3e179e8 100644 --- a/Makefile +++ b/Makefile @@ -45,7 +45,7 @@ INSTALL_CMD = install ## End platform specific section -BUILD_CFLAGS = -fpic -I$(LUA_INCLUDE_DIR) -DVERSION=\"$(CJSON_VERSION)\" $(CJSON_CFLAGS) +BUILD_CFLAGS = -fpic -I$(LUA_INCLUDE_DIR) $(CJSON_CFLAGS) OBJS := lua_cjson.o strbuf.o .PHONY: all clean install package doc diff --git a/lua-cjson-1.0.4-1.rockspec b/lua-cjson-1.0.4-1.rockspec index 5eac501..ee287b5 100644 --- a/lua-cjson-1.0.4-1.rockspec +++ b/lua-cjson-1.0.4-1.rockspec @@ -31,7 +31,7 @@ build = { -- USE_INTERNAL_ISINF: Provide internal isinf() implementation. Required -- on some Solaris platforms. defines = { - "VERSION=\"1.0.4\"", "USE_POSIX_SETLOCALE", + "USE_POSIX_SETLOCALE", -- LuaRocks does not support platform specific configuration for Solaris. -- Uncomment the line below on Solaris platforms. -- "USE_INTERNAL_ISINF" @@ -41,10 +41,10 @@ build = { -- Override default build options (per platform) platforms = { linux = { modules = { cjson = { defines = { - [2] = "USE_POSIX_USELOCALE" + [1] = "USE_POSIX_USELOCALE" } } } }, macosx = { modules = { cjson = { defines = { - [2] = "USE_POSIX_USELOCALE" + [1] = "USE_POSIX_USELOCALE" } } } } }, copy_directories = { "tests" } diff --git a/lua_cjson.c b/lua_cjson.c index 806a67c..24fb13d 100644 --- a/lua_cjson.c +++ b/lua_cjson.c @@ -44,6 +44,10 @@ #include "strbuf.h" +#ifndef CJSON_VERSION +#define CJSON_VERSION "1.0.4" +#endif + /* Support to reset locale to POSIX for strtod() / sprintf(). * Some locales use comma as a decimal separator. This breaks JSON. */ #ifdef USE_POSIX_USELOCALE @@ -1338,7 +1342,7 @@ int luaopen_cjson(lua_State *l) lua_setfield(l, -2, "null"); /* Set cjson.version */ - lua_pushliteral(l, VERSION); + lua_pushliteral(l, CJSON_VERSION); lua_setfield(l, -2, "version"); /* Return cjson table */ -- cgit v1.2.3-55-g6feb