1 --- lua-5.0.2.orig/doc/lua.1
2 +++ lua-5.0.2/doc/lua.1
6 show version information.
9 +load the compatibility library into the interpreter. If you specify
10 +this, then you will also need to specify the
12 +option in order to enter an interactive interpreter.
15 +suppress the creation of a standard LUA_PATH variable. Use this if
16 +you need to run scripts which conflict with system-installed libraries.
24 -(lua@tecgraf.puc-rio.br)
26 +.BI <lua@tecgraf.puc-rio.br>
28 +Debian modifications to the manpage by
31 +.BI <dsilvers@debian.org>
33 --- lua-5.0.2.orig/src/luac/Makefile
34 +++ lua-5.0.2/src/luac/Makefile
39 -$T: $(OBJS) $(LIB)/liblua.a $(LIB)/liblualib.a
40 - $(CC) -o $@ $(MYLDFLAGS) $(OBJS) -L$(LIB) -llua -llualib $(EXTRA_LIBS) $(DLLIB)
41 +$T: $(OBJS) $(LIB)/liblua.a $(LIB)/liblualib.a
42 + $(CC) -o $@ $(MYLDFLAGS) $(OBJS) -L$(LIB) -llua -llualib $(EXTRA_LIBS)
44 # print.c needs opcode names from lopcodes.c
45 lopcodes.o: ../lopcodes.c ../lopcodes.h
46 --- lua-5.0.2.orig/src/lib/Makefile
47 +++ lua-5.0.2/src/lib/Makefile
49 OBJS= lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o ltablib.o lstrlib.o loadlib.o
50 SRCS= lauxlib.c lbaselib.c ldblib.c liolib.c lmathlib.c ltablib.c lstrlib.c loadlib.c
52 -T= $(LIB)/liblualib.a
53 +SOBJS := $(patsubst %.o,%.os,$(OBJS))
55 +T= $(LIB)/liblualib.a
66 + rm -f $(OBJS) $(SOBJS) $T
70 --- lua-5.0.2.orig/src/lib/liolib.c
71 +++ lua-5.0.2/src/lib/liolib.c
73 if (f == stdin || f == stdout || f == stderr)
74 return 0; /* file cannot be closed */
76 - int ok = (pclose(f) != -1) || (fclose(f) == 0);
79 + ok = (pclose(f) != -1);
81 + if (errno == ECHILD) ok = 1; /* pclose worked, but could reap child */
82 + else ok = (fclose(f) == 0);
86 *(FILE **)lua_touserdata(L, 1) = NULL; /* mark file as closed */
88 --- lua-5.0.2.orig/src/lua/Makefile
89 +++ lua-5.0.2/src/lua/Makefile
94 -$T: $(OBJS) $(LIB)/liblua.a $(LIB)/liblualib.a
95 - $(CC) -o $@ $(MYLDFLAGS) $(OBJS) -L$(LIB) -llua -llualib $(EXTRA_LIBS) $(DLLIB)
96 +$T: $(OBJS) $(LIB)/liblua.a $(LIB)/liblualib.a
97 + $(CC) -o $@ $(MYLDFLAGS) $(OBJS) -L$(LIB) -llua -llualib $(EXTRA_LIBS) $(DLLIB)
101 --- lua-5.0.2.orig/src/lua/lua.c
102 +++ lua-5.0.2/src/lua/lua.c
105 static const char *progname = PROGNAME;
107 +/* These bits are added for Debian's -P functionality */
109 +static int done_path = 0;
110 +static int suppress_path = 0;
112 +static const char* paths[] = {
116 + "/usr/local/share/lua",
120 +static void do_path()
122 + const char** p = paths;
124 + if( done_path || suppress_path ) return;
127 + lua_pushliteral(L,"LUA_PATH");
128 + lua_pushliteral(L,"");
132 + const char* home = getenv("HOME");
134 + lua_pushstring(L,home);
135 + lua_pushstring(L,*p+1);
136 + lua_pushliteral(L,"/?.lua;");
137 + lua_pushstring(L,home);
138 + lua_pushstring(L,*p+1);
139 + lua_pushliteral(L,"/?;");
143 + lua_pushstring(L,*p);
144 + lua_pushliteral(L,"/?.lua;");
145 + lua_pushstring(L,*p);
146 + lua_pushliteral(L,"/?;");
150 + lua_concat(L,any+1);
154 + lua_pushliteral(L, "?.lua;?");
156 + lua_settable(L, LUA_GLOBALSINDEX);
159 static const luaL_reg lualibs[] = {
160 {"base", luaopen_base},
162 static void lstop (lua_State *l, lua_Debug *ar) {
163 (void)ar; /* unused arg. */
164 lua_sethook(l, NULL, 0, 0);
165 - luaL_error(l, "interrupted!");
171 static void laction (int i) {
172 - signal(i, SIG_DFL); /* if another SIGINT happens before lstop,
173 - terminate process (default action) */
174 lua_sethook(L, lstop, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1);
178 " -i enter interactive mode after executing `script'\n"
179 " -l name load and run library `name'\n"
180 " -v show version information\n"
181 + " -C load the compatibility library before startup\n"
182 + " -P suppress the setting of LUA_PATH. If not specified\n"
183 + " very early, this setting may not take effect.\n"
184 " -- stop handling options\n" ,
187 @@ -120,23 +172,42 @@
190 msg = lua_tostring(L, -1);
191 - if (msg == NULL) msg = "(error with no message)";
192 - l_message(progname, msg);
195 + lua_getglobal(L, "LUA_DEFAULT_ERROR"); /* try global variable */
196 + str = lua_tostring(L, -1);
199 + if (*str != '\0') msg = str;
200 + } else msg = "(error with no message)";
202 + if (msg) l_message(progname, msg);
208 +static void sig_catch(int sig, void (*handler)(int))
210 + struct sigaction sa;
211 + sa.sa_handler = handler;
213 + sigemptyset(&sa.sa_mask);
214 + sigaction(sig, &sa, 0); /* XXX ignores errors */
218 static int lcall (int narg, int clear) {
220 int base = lua_gettop(L) - narg; /* function index */
222 + lua_settop(L,base);
223 lua_pushliteral(L, "_TRACEBACK");
224 lua_rawget(L, LUA_GLOBALSINDEX); /* get traceback function */
225 lua_insert(L, base); /* put it under chunk and args */
226 - signal(SIGINT, laction);
227 + sig_catch(SIGINT, laction);
228 status = lua_pcall(L, narg, (clear ? 0 : LUA_MULTRET), base);
229 - signal(SIGINT, SIG_DFL);
230 + sig_catch(SIGINT, SIG_DFL);
231 lua_remove(L, base); /* remove traceback function */
237 static int load_file (const char *name) {
239 lua_pushliteral(L, "require");
240 lua_rawget(L, LUA_GLOBALSINDEX);
241 if (!lua_isfunction(L, -1)) { /* no `require' defined? */
244 const char *oldprogname = progname;
247 while ((status = load_string()) != -1) {
248 if (status == 0) status = lcall(0, 0);
251 return 1; /* stop if file fails */
255 + const char *filename = "compat.lua";
256 + if (load_file(filename))
257 + return 1; /* stop if file fails */
262 + l_message(progname, "option `-P' is too late, ignored");
267 l_message(progname, "option `-c' is deprecated");
270 status = handle_luainit();
272 status = handle_argv(s->argv, &interactive);
274 if (status == 0 && interactive) manual_input();
277 --- lua-5.0.2.orig/src/Makefile
278 +++ lua-5.0.2/src/Makefile
286 +SOBJS := $(patsubst %.o,%.os,$(OBJS))
291 +$T: $(OBJS) $(SOBJS)
298 + rm -f $(OBJS) $(SOBJS) $T
302 --- lua-5.0.2.orig/lua-config
303 +++ lua-5.0.2/lua-config
308 +-- This file is under the terms of the MIT licence. Do as you will.
310 +-- Process the arg table
313 + io.stderr:write([[Usage: lua-config <options>
317 + --include Outputs the -I switches needed to find <lua.h> etc.
319 + --static Outputs the full path to the static libraries
321 + --libs Outputs the -L and -l switches needed to find the library
322 + --libs-only-L Outputs only the -L switches
323 + --libs-only-l Outputs only the -l switches
325 + --extralibs Outputs the -l switches appropriate to the extra libs needed by lua
327 + Note that --static is mututally exclusive with the --libs* options
329 + Also, you can specify the following
331 + --vmonly Outputs only the switches for finding the VM libraries
332 + --libonly Outputs only the switches for finding the standard libraries
333 + --both Outputs the switches for both [The default]
337 + gcc `lua-config --include` my_prog.c -o my_prog `lua-config --libs`
344 + io.stdout:write( [[5.0.0
350 + io.stdout:write( [[lua-config version 1.10 (c) Daniel Silverstone 2002
352 +lua-config was written for the Debian GNU/Linux project. This version
353 +of lua-config will provide switches appropriate to Lua 5.0
358 +if( table.getn(arg) == 0 ) then
371 +table.foreachi( arg,
373 + if( param == '--version' ) then
376 + if( param == '--help' ) then
379 + if( param == '--include' ) then
380 + output_include = 1;
383 + if( param == '--libs' ) then
388 + if( param == '--libs-only-L' ) then
392 + if( param == '--libs-only-l' ) then
396 + if( param == '--extralibs' ) then
400 + if( param == '--static' ) then
404 + if( param == '--vmonly' ) then
409 + if( param == '--libonly' ) then
414 + if( param == '--both' ) then
419 + io.stderr:write( "Unknown argument ", param );
423 +if( (output_extras + output_libs_l + output_libs_L + output_include + output_static) == 0 ) then
427 +if( (output_static + (output_libs_l or output_libs_L)) > 1 ) then
433 +if( output_include == 1 ) then
434 + table.insert( outargs, "-I/usr/include/lua" );
437 +if( output_libs_L == 1 ) then
438 + table.insert( outargs, "-L/usr/include" );
441 +if( output_libs_l == 1 ) then
442 + if( output_lib == 1 ) then
443 + table.insert( outargs, "-llualib" );
445 + if( output_vm == 1 ) then
446 + table.insert( outargs, "-llua" );
450 +if( output_static == 1 ) then
451 + if( output_lib == 1 ) then
452 + table.insert( outargs, "/usr/lib/liblualib.a" );
454 + if( output_vm == 1 ) then
455 + table.insert( outargs, "/usr/lib/liblua.a" );
459 +if( output_extras == 1 ) then
460 + table.insert( outargs, "-lm" );
463 +io.stdout:write( outargs[1] );
465 +for i=2,table.getn(outargs) do
466 + io.stdout:write( " ", outargs[i] );
469 +io.stdout:write( "\n" );
470 --- lua-5.0.2.orig/config
473 # interface (e.g., Linux, Solaris, IRIX, BSD, AIX, HPUX, and probably others),
474 # uncomment the next two lines.
476 -#LOADLIB= -DUSE_DLOPEN=1
478 +LOADLIB= -DUSE_DLOPEN=1
481 # In Linux with gcc, you should also uncomment the next definition for
482 # MYLDFLAGS, which passes -E (= -export-dynamic) to the linker. This option
483 # allows dynamic libraries to link back to the `lua' program, so that they do
484 # not need the Lua libraries. (Other systems may have an equivalent facility.)
489 # On Windows systems. support for dynamic loading is enabled by default.
490 # To disable this support, uncomment the next line.
492 # or if you are using a modified interpreter that does not need them,
493 # then comment the following line or add the appropriates libraries.
498 # If you want to customize the stand-alone Lua interpreter, uncomment and
499 # edit the following two lines; also edit etc/saconfig.c to suit your needs.
501 # to add -lreadline (and perhaps also -lhistory and -lcurses or -lncurses)
504 -#USERCONF=-DLUA_USERCONFIG='"$(LUA)/etc/saconfig.c"' -DUSE_READLINE
505 -#EXTRA_LIBS= -lm -ldl -lreadline # -lhistory -lcurses -lncurses
506 +USERCONF=-DLUA_USERCONFIG='"$(LUA)/etc/saconfig.c"' -DUSE_READLINE
507 +EXTRA_LIBS= -lreadline -lm -ldl # -lhistory -lcurses -lncurses
509 # ------------------------------------------------------------------ C compiler
512 # debug information. If you only want the shared libraries, you may want to
513 # add -fPIC to MYCFLAGS.
517 #MYCFLAGS= -O3 -fomit-frame-pointer # -fPIC
519 # Write here any options you may need for your C linker.
520 @@ -148,19 +148,20 @@
522 # Locations for "make install". You may need to be root do "make install".
524 -INSTALL_ROOT= /usr/local
525 +INSTALL_ROOT= $(PREFIX)/usr/
526 INSTALL_BIN= $(INSTALL_ROOT)/bin
527 -INSTALL_INC= $(INSTALL_ROOT)/include
528 +INSTALL_INC= $(INSTALL_ROOT)/include/lua
529 INSTALL_LIB= $(INSTALL_ROOT)/lib
530 -INSTALL_MAN= $(INSTALL_ROOT)/man/man1
531 +INSTALL_MAN= $(INSTALL_ROOT)/share/man/man1
532 +INSTALL_SHARE= $(INSTALL_ROOT)/share/lua
534 # You may prefer to use "install" instead of "cp" if you have it.
535 # If you use "install", you may also want to change the permissions after -m.
539 -#INSTALL_EXEC= install -m 0755
540 -#INSTALL_DATA= install -m 0644
543 +INSTALL_EXEC= install -m 0755
544 +INSTALL_DATA= install -m 0644
546 # == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE =========
549 INCS= -I$(INC) $(EXTRA_INCS)
550 DEFS= $(NUMBER) $(EXTRA_DEFS)
552 -CFLAGS= $(MYCFLAGS) $(WARN) $(INCS) $(DEFS)
553 +CFLAGS= $(MYCFLAGS) $(WARN) $(INCS) $(DEFS) -DINSTALL_SHARE=\"$(INSTALL_SHARE)\"
555 +# Extra rule for .os files
557 + $(CC) $(CFLAGS) -fPIC -DPIC -o $@ -c $<
560 --- lua-5.0.2.orig/Makefile
561 +++ lua-5.0.2/Makefile
564 # shared libraries (for Linux)
566 - ld -o lib/liblua.so.$V -shared src/*.o
567 - ld -o lib/liblualib.so.$V -shared src/lib/*.o
568 - cd lib; ln -fs liblua.so.$V liblua.so; ln -fs liblualib.so.$V liblualib.so
569 + gcc -o lib/liblua.so.$V -shared -Wl,-soname,liblua.so.$V \
571 + ln -fs liblua.so.$V lib/liblua-build.so
572 + gcc -o lib/liblualib.so.$V -shared -Wl,-soname,liblualib.so.$V \
573 + src/lib/*.os -Llib -llua-build -lm -ldl -lc
574 + cd lib; ln -fs liblua.so.$V liblua.so; \
575 + ln -fs liblualib.so.$V liblualib.so
577 # binaries using shared libraries
579 --- lua-5.0.2.orig/lua.pc
585 +includedir=/usr/include/
588 +Description: The Lua 5.0 programming language
590 +Libs: -L${libdir} -llua
591 +Cflags: -I${includedir}/lua
593 --- lua-5.0.2.orig/lualib.pc
594 +++ lua-5.0.2/lualib.pc
599 +includedir=/usr/include/
602 +Description: The Lua 5.0 programming language addon libraries
605 +Libs: -L${libdir} -llualib
606 +Cflags: -I${includedir}/lua
608 --- lua-5.0.2.orig/lua-config.1
609 +++ lua-5.0.2/lua-config.1
611 +.\" Manual page for lua-config
612 +.\" Written by Daniel Silverstone <dsilvers@debian.org>
613 +.\" For the Debian GNU/Linux system
617 +lua-config \- Lua configuration information
635 +The lua-config script allows you to determine useful information
636 +about the chosen version of lua running on the Debian GNU/Linux
638 +More information can be found by running
640 +without any arguments.
642 +This script is unique to Debian and as such you shouldn't rely
643 +on its presence on every system. Lua is an embedded language
644 +by default and different Linux distributions each take a different
645 +approach to making it possible to compile with Lua. The
647 +system also provides a way to look for libraries and is more likely
648 +to be supported across different Linux distributions. Debian's
652 +and the libraries are in
656 +files can be found in the
662 +lua-config was written by
663 +.B Daniel Silverstone
664 +.BI <dsilvers@debian.org>.
666 +This manual page was written by
667 +.B Daniel Silverstone
668 +.BI <dsilvers@debian.org>.
669 +For the Debian project. It may be used without restriction in any