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 thesources from www.lua.org. On most Unixes, you can also use the nativepackage management system to easily install lua.
Stone Soup 0.3 includes Lua 5.1.2 in its source tree. Crawl uses Luafor dungeon generation. In addition, Crawl has a (rudimentary) Luainterface for users to run scripts which can do things such asconditionalise parts of the .crawlrc/init.txt. Such user Lua scriptsare enabled by default on DOS and Windows, but can be turned off byediting your makefile and removing -DCLUA_BINDINGS from the compilerflags.User scripts are not enabled by default on Unix since the stockmakefile installs Crawl setgid, and the Lua scripting interface hasnot been audited for setgid security. See the full section on Lua formore details. For non-privileged installs, you can enable Lua userscripts as described in the build instructions.
then add -llua to your LIB = line in makefile.unix, and rebuild tocompile with Lua support. See the section on Lua (below) for moreinformation.
clean, and rebuild to compile with user Lua support. See the sectionon Lua (below) for more information.
* If you have Lua installed, you can add your lua headers and liblualibrary to the 'Crawl' target in the Xcode project, uncomment the'#define CLUA_BINDINGS' line in AppHdr.h, and rebuild to compilewith Lua support.
* If you'd like users to be able to script Crawl with Lua, you canedit AppHdr.h, uncomment// #define CLUA_BINDINGSand rebuild to compile with Lua support. See the section on Luafor more information.
MinGW makefile supplied. If you're on 9x/ME, you can choose to use theCygwin build instructions, or build a binary on a Windows NT/2k/XPsystem (the binary will run on 9x), or build a DOS binary.
MinGW makefile supplied (which needs the cmd.exe shell of the WindowsNT family). If you're on 9x/ME, you can use the Cygwin buildinstructions, or build a binary on a Windows NT/2k/XP system (thebinary 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 -lpcreand 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. Ifyou'd like to build from svn, install the svn client. You may alsowant to install diff and patch if you'd like to apply third partypatches, 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 svnclient. You may also want to install diff and patch if you'd like toapply third party patches, or create your own.
CFLAGS = -D$(OS_TYPE) $(EXTRA_FLAGS) -DCLUA_BINDINGS -DREGEX_PCREAdd -llua and -lpcre to the LIB line in makefile.dos, like so:LIB = -llua -lpcre
CFLAGS := $(INCLUDES) $(CFWARN) $(CFOTHERS) -DREGEX_PCREAnd 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 likethis:LIB = -lluaIf you're using Lua older than 5.1, though, the Lua library comprisesof *two* libraries: liblua and liblualib (yes, confusing), so you needLIB = -llua -llualibThis also depends on how you install Lua - some package managementsystems build just the plain old liblua.so even for pre 5.1 Lua. If indoubt, try both "-llua -llualib" and "-llua".On many Linuxes (Debian, for instance), the package management systeminstalls Lua libraries including the version number, so the linkeroption becomes something like:LIB = -llua50Lua include path:On Unix, Lua headers may be installed in /usr/include (unlikely), orin a subdirectory of /usr/include (such as /usr/include/lua50/). Ifthe headers are in a subdirectory, you need to add this directory tothe include path in your makefile.unix:INCLUDES = -I/usr/include/ncurses -I/usr/include/lua50On other platforms, the Lua headers should usually be installed inyour compiler's include directory, or a subdirectory. If it's in asubdirectory, you'll need to add the full directory path to yourincludes line.Getting Lua:
On Windows, Lua binaries are available on luaforge.net. You shouldfind links to get binaries from www.lua.org.
Enabling Lua user scripts is unsuitable for Crawl installed setuid orsetgid - we have not audited the user scripting interface forsecurity. If you're not planning to install Crawl setuid/setgid (notrunning set[ug]id is a good idea in general), you can enable the Luauser-script bindings safely.
On DOS, you get the joy of compiling Lua yourself. It's not hard, andyou can use the existing Windows support in the Lua makefiles withsome minor modifications, but you may be better served using theofficial Crawl Stone Soup binaries if you want Lua with your Crawl anddon't want to compile Lua.
As of 0.3, the Lua source is included with Crawl. The only step neededto enable user-scripts is to uncomment CLUA_BINDINGS in AppHdr.h.