diff options
| -rw-r--r-- | Makefile | 58 | ||||
| -rw-r--r-- | README | 3 | ||||
| -rw-r--r-- | lua-cjson-1.0.4-1.rockspec | 4 |
3 files changed, 40 insertions, 25 deletions
| @@ -4,31 +4,49 @@ LUA_VERSION = 5.1 | |||
| 4 | # See http://lua-users.org/wiki/BuildingModules for platform specific | 4 | # See http://lua-users.org/wiki/BuildingModules for platform specific |
| 5 | # details. | 5 | # details. |
| 6 | 6 | ||
| 7 | ## Linux/BSD | 7 | ## Available Lua CJSON specific workarounds |
| 8 | PREFIX ?= /usr/local | 8 | # |
| 9 | LDFLAGS += -shared | 9 | # To ensure JSON encoding/decoding works correctly for locales using |
| 10 | # comma decimal separators, Lua CJSON must be compiled with one of | ||
| 11 | # these options: | ||
| 12 | # USE_POSIX_USELOCALE: Linux, OSX. Thread safe. Recommended option. | ||
| 13 | # USE_POSIX_SETLOCALE: Works on all ANSI C platforms. May be used when | ||
| 14 | # thread-safety isn't required. | ||
| 15 | # | ||
| 16 | # USE_INTERNAL_ISINF: Handle Solaris platforms that are missing isinf(). | ||
| 17 | |||
| 18 | # Tweak one of these platform sections below to suit your situation. | ||
| 19 | |||
| 20 | ## Linux | ||
| 21 | PREFIX ?= /usr/local | ||
| 22 | CFLAGS_EXTRA ?= -DUSE_POSIX_USELOCALE | ||
| 23 | LDFLAGS_EXTRA ?= -shared | ||
| 24 | |||
| 25 | ## FreeBSD | ||
| 26 | #PREFIX ?= /usr/local | ||
| 27 | #CFLAGS_EXTRA ?= -DUSE_POSIX_SETLOCALE | ||
| 28 | #LUA_INCLUDE_DIR ?= $(PREFIX)/include/lua51 | ||
| 29 | #LDFLAGS_EXTRA ?= -shared | ||
| 10 | 30 | ||
| 11 | ## OSX (Macports) | 31 | ## OSX (Macports) |
| 12 | #PREFIX ?= /opt/local | 32 | #PREFIX ?= /opt/local |
| 13 | #LDFLAGS += -bundle -undefined dynamic_lookup | 33 | #CFLAGS_EXTRA ?= -DUSE_POSIX_USELOCALE |
| 34 | #LDFLAGS_EXTRA ?= -bundle -undefined dynamic_lookup | ||
| 14 | 35 | ||
| 15 | LUA_INCLUDE_DIR ?= $(PREFIX)/include | 36 | ## Solaris |
| 16 | LUA_LIB_DIR ?= $(PREFIX)/lib/lua/$(LUA_VERSION) | 37 | #PREFIX ?= /usr/local |
| 38 | #CFLAGS_EXTRA ?= -DUSE_POSIX_SETLOCALE -DUSE_INTERNAL_ISINF | ||
| 39 | #LDFLAGS_EXTRA ?= -shared | ||
| 17 | 40 | ||
| 18 | #CFLAGS ?= -g -Wall -pedantic -fno-inline | 41 | ## End platform specific section |
| 19 | CFLAGS ?= -g -O3 -Wall -pedantic | ||
| 20 | override CFLAGS += -fpic -I$(LUA_INCLUDE_DIR) -DVERSION=\"$(CJSON_VERSION)\" | ||
| 21 | 42 | ||
| 22 | ## Optional work arounds | 43 | LUA_INCLUDE_DIR ?= $(PREFIX)/include |
| 23 | # Handle Solaris platforms that are missing isinf(). | 44 | LUA_LIB_DIR ?= $(PREFIX)/lib/lua/$(LUA_VERSION) |
| 24 | #override CFLAGS += -DUSE_INTERNAL_ISINF | 45 | |
| 25 | # Handle locales that use comma as a decimal separator on locale aware | 46 | #CFLAGS ?= -g -Wall -pedantic -fno-inline |
| 26 | # platforms (optional, but recommended). | 47 | CFLAGS ?= -O3 -Wall -pedantic |
| 27 | # USE_POSIX_USELOCALE: Linux, OSX. Thread safe. Recommended option. | 48 | override CFLAGS += $(CFLAGS_EXTRA) -fpic -I$(LUA_INCLUDE_DIR) -DVERSION=\"$(CJSON_VERSION)\" |
| 28 | # USE_POSIX_SETLOCALE: Works on all ANSI C platforms. May be used when | 49 | override LDFLAGS += $(LDFLAGS_EXTRA) |
| 29 | # thread-safety isn't required. | ||
| 30 | override CFLAGS += -DUSE_POSIX_USELOCALE | ||
| 31 | #override CFLAGS += -DUSE_POSIX_SETLOCALE | ||
| 32 | 50 | ||
| 33 | INSTALL ?= install | 51 | INSTALL ?= install |
| 34 | 52 | ||
| @@ -54,9 +54,6 @@ build and install the module: | |||
| 54 | OR | 54 | OR |
| 55 | # cp cjson.so [your_module_directory] | 55 | # cp cjson.so [your_module_directory] |
| 56 | 56 | ||
| 57 | Note: Some Solaris platforms are missing isinf(). You can work around | ||
| 58 | this bug by adding -DUSE_INTERNAL_ISINF to CFLAGS in the Makefile. | ||
| 59 | |||
| 60 | 57 | ||
| 61 | RPM | 58 | RPM |
| 62 | --- | 59 | --- |
diff --git a/lua-cjson-1.0.4-1.rockspec b/lua-cjson-1.0.4-1.rockspec index b08032b..da19bd1 100644 --- a/lua-cjson-1.0.4-1.rockspec +++ b/lua-cjson-1.0.4-1.rockspec | |||
| @@ -28,8 +28,8 @@ build = { | |||
| 28 | -- USE_POSIX_USELOCALE: Linux, OSX. Thread safe. Recommended. | 28 | -- USE_POSIX_USELOCALE: Linux, OSX. Thread safe. Recommended. |
| 29 | -- USE_POSIX_SETLOCALE: Works on all ANSI C platforms. May be used when | 29 | -- USE_POSIX_SETLOCALE: Works on all ANSI C platforms. May be used when |
| 30 | -- thread-safety isn't required. | 30 | -- thread-safety isn't required. |
| 31 | -- USE_INTERNAL_ISINF: Provide internal isinf() implementation. Required | 31 | -- USE_INTERNAL_ISINF: Provide internal isinf() implementation. Required |
| 32 | -- on some Solaris platforms. | 32 | -- on some Solaris platforms. |
| 33 | defines = { "VERSION=\"1.0.4\"", "USE_POSIX_SETLOCALE" } | 33 | defines = { "VERSION=\"1.0.4\"", "USE_POSIX_SETLOCALE" } |
| 34 | } | 34 | } |
| 35 | }, | 35 | }, |
