git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1833 c06c8d41-db1a-0410-9941-cceddc491573
W2D7G5ARFVO2HKUPFITKCGFC6UKB6ZCZFIT6223QLQ7PU7UO7L5AC
Q2FZIIGQECGP2FKKWLGDBBQVGCFZ4JTY53PFPJP6X7YKC23AQGFQC
RPOZZWKG5GLPHVZZ7ZKMKS64ZMV2LDCQSARBJFJ6FZOTOKCQO7FAC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
JQCVEFFILBCGLBRRKJ3EVVDDZFHZ4GCBSXKN3D5ZSQZ4HGDHMCHQC
SDLKLUNFGVKDS55DDJZCBAVIB7NL3RRYPTACAY65SCUQKV6APFSAC
PL6I2CMSTHY5ZHWVMIQE5YTM5S5VPKBNZM6QJVHZSSKOJGIJ5W4AC
RVST2QHYJ757ZHK4AUJ5NGPDZ44AD6RVFVXYPKQIBJXZBDNUCHXQC
HXOYKQF6JLOELDE27O66U3Q7J6CP2YPRF42VSJD4LPTV7PZNT6PQC
VGTQD4PW3FSNBHTUBBRRI24WNIZU6VPDYUQGO2SO53P6J5WJO5XQC
LS3DAZVRDCXVN2BKBC6RGCKO3R43Z7HKG4GXJWLBK4AKBL2G6QDQC
YRTMOMVMYSROOIO4YKAJLDW4AIO7KWYZ6RNLMY3M4VULN2NGYCCQC
// Uncomment to enable the Crawl Lua bindings. You can also set this
// in your makefile by adding -DCLUA_BINDINGS to the CFLAGS line (this
// is preferred to editing AppHdr.h directly).
//
// #define CLUA_BINDINGS
// =========================================================================
// Lua user scripts (NOTE: this may also be enabled in your makefile!)
// =========================================================================
//
// Enables Crawl's Lua bindings for user scripts. See the section on
// Lua in INSTALL for more information. NOTE: CLUA_BINDINGS is enabled
// by default in all standard makefiles. Commenting it out here may
// not be sufficient to disable user-Lua - you must also check your
// makefile and remove -DCLUA_BINDINGS. You can use V in-game to check
// whether user-scripts are enabled.
//
// #define CLUA_BINDINGS
Lua support requires liblua, which you can build by downloading the
sources from www.lua.org. On most Unixes, you can also use the native
package management system to easily install lua.
Stone Soup 0.3 includes Lua 5.1.2 in its source tree. Crawl uses Lua
for dungeon generation. In addition, Crawl has a (rudimentary) Lua
interface for users to run scripts which can do things such as
conditionalise parts of the .crawlrc/init.txt. Such user Lua scripts
are enabled by default on DOS and Windows, but can be turned off by
editing your makefile and removing -DCLUA_BINDINGS from the compiler
flags.
User scripts are not enabled by default on Unix since the stock
makefile installs Crawl setgid, and the Lua scripting interface has
not been audited for setgid security. See the full section on Lua for
more details. For non-privileged installs, you can enable Lua user
scripts as described in the build instructions.
then add -llua to your LIB = line in makefile.unix, and rebuild to
compile with Lua support. See the section on Lua (below) for more
information.
clean, and rebuild to compile with user Lua support. See the section
on Lua (below) for more information.
* If you have Lua installed, you can add your lua headers and liblua
library to the 'Crawl' target in the Xcode project, uncomment the
'#define CLUA_BINDINGS' line in AppHdr.h, and rebuild to compile
with Lua support.
* If you'd like users to be able to script Crawl with Lua, you can
edit AppHdr.h, uncomment
// #define CLUA_BINDINGS
and rebuild to compile with Lua support. See the section on Lua
for more information.
MinGW makefile supplied. If you're on 9x/ME, you can choose to use the
Cygwin build instructions, or build a binary on a Windows NT/2k/XP
system (the binary will run on 9x), or build a DOS binary.
MinGW makefile supplied (which needs the cmd.exe shell of the Windows
NT family). If you're on 9x/ME, you can use the Cygwin build
instructions, or build a binary on a Windows NT/2k/XP system (the
binary will run on 9x), or build a DOS binary.
* Add -llua and -lpcre to the LIB line in makefile.mgw as:
LIB = -lwinmm -static -llua -lpcre
and build Crawl to include Lua and regex support.
* If you enabled REGEX_PCRE, add -lpcre to the LIB line in makefile.mgw as:
LIB = -lpcre -static -lwinmm -L$(LUASRC) -l$(LUALIB) -L$(SQLSRC) -l$(SQLLIB)
and build Crawl to include regex support.
the following packages are selected: gcc, g++, make, flex, bison. If
you'd like to build from svn, install the svn client. You may also
want to install diff and patch if you'd like to apply third party
patches, or create your own.
the following packages are selected: gcc, g++, make, flex, bison,
libncurses-devel. If you'd like to build from svn, install the svn
client. You may also want to install diff and patch if you'd like to
apply third party patches, or create your own.
CFLAGS = -D$(OS_TYPE) $(EXTRA_FLAGS) -DCLUA_BINDINGS -DREGEX_PCRE
Add -llua and -lpcre to the LIB line in makefile.dos, like so:
LIB = -llua -lpcre
CFLAGS := $(INCLUDES) $(CFWARN) $(CFOTHERS) -DREGEX_PCRE
And add -lpcre to the LIB line in makefile.dos, like so:
LIB = -L$(LUASRC) -l$(LUALIB) -L$(SQLSRC) -l$(SQLLIB) -lpcre
NOTE: When linking in Lua, the makefile LIB line usually looks like
this:
LIB = -llua
If you're using Lua older than 5.1, though, the Lua library comprises
of *two* libraries: liblua and liblualib (yes, confusing), so you need
LIB = -llua -llualib
This also depends on how you install Lua - some package management
systems build just the plain old liblua.so even for pre 5.1 Lua. If in
doubt, try both "-llua -llualib" and "-llua".
On many Linuxes (Debian, for instance), the package management system
installs Lua libraries including the version number, so the linker
option becomes something like:
LIB = -llua50
Lua include path:
On Unix, Lua headers may be installed in /usr/include (unlikely), or
in a subdirectory of /usr/include (such as /usr/include/lua50/). If
the headers are in a subdirectory, you need to add this directory to
the include path in your makefile.unix:
INCLUDES = -I/usr/include/ncurses -I/usr/include/lua50
On other platforms, the Lua headers should usually be installed in
your compiler's include directory, or a subdirectory. If it's in a
subdirectory, you'll need to add the full directory path to your
includes line.
Getting Lua:
On Windows, Lua binaries are available on luaforge.net. You should
find links to get binaries from www.lua.org.
Enabling Lua user scripts is unsuitable for Crawl installed setuid or
setgid - we have not audited the user scripting interface for
security. If you're not planning to install Crawl setuid/setgid (not
running set[ug]id is a good idea in general), you can enable the Lua
user-script bindings safely.
On DOS, you get the joy of compiling Lua yourself. It's not hard, and
you can use the existing Windows support in the Lua makefiles with
some minor modifications, but you may be better served using the
official Crawl Stone Soup binaries if you want Lua with your Crawl and
don't want to compile Lua.
As of 0.3, the Lua source is included with Crawl. The only step needed
to enable user-scripts is to uncomment CLUA_BINDINGS in AppHdr.h.