aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Pulford <mark@kyne.com.au>2011-11-29 00:10:42 +1030
committerMark Pulford <mark@kyne.com.au>2011-11-29 00:10:42 +1030
commit11b35407875cc363f7897ff1c7c34828b4efe3ce (patch)
tree8a05f9b73130e5c62ffdc5f4a4628255dcea5582
parentd6b3f9ceb6c73121d9fa52bf66b7cfa59b611680 (diff)
downloadlua-cjson-11b35407875cc363f7897ff1c7c34828b4efe3ce.tar.gz
lua-cjson-11b35407875cc363f7897ff1c7c34828b4efe3ce.tar.bz2
lua-cjson-11b35407875cc363f7897ff1c7c34828b4efe3ce.zip
Improve build documentation and layout
-rw-r--r--Makefile58
-rw-r--r--README3
-rw-r--r--lua-cjson-1.0.4-1.rockspec4
3 files changed, 40 insertions, 25 deletions
diff --git a/Makefile b/Makefile
index 10e0ba1..1cf5d53 100644
--- a/Makefile
+++ b/Makefile
@@ -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
8PREFIX ?= /usr/local 8#
9LDFLAGS += -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
21PREFIX ?= /usr/local
22CFLAGS_EXTRA ?= -DUSE_POSIX_USELOCALE
23LDFLAGS_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
15LUA_INCLUDE_DIR ?= $(PREFIX)/include 36## Solaris
16LUA_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
19CFLAGS ?= -g -O3 -Wall -pedantic
20override CFLAGS += -fpic -I$(LUA_INCLUDE_DIR) -DVERSION=\"$(CJSON_VERSION)\"
21 42
22## Optional work arounds 43LUA_INCLUDE_DIR ?= $(PREFIX)/include
23# Handle Solaris platforms that are missing isinf(). 44LUA_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). 47CFLAGS ?= -O3 -Wall -pedantic
27# USE_POSIX_USELOCALE: Linux, OSX. Thread safe. Recommended option. 48override 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 49override LDFLAGS += $(LDFLAGS_EXTRA)
29# thread-safety isn't required.
30override CFLAGS += -DUSE_POSIX_USELOCALE
31#override CFLAGS += -DUSE_POSIX_SETLOCALE
32 50
33INSTALL ?= install 51INSTALL ?= install
34 52
diff --git a/README b/README
index e2e8dbc..09caab5 100644
--- a/README
+++ b/README
@@ -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
57Note: 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
61RPM 58RPM
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 },