lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


It was thus said that the Great Russell Haley once stated:
> Hi,
> 
> TLDR: does anyone have an src Makefile that builds a shared object in
> 5.1.5 that I can use on Ubuntu?
> 
> I have a Ubuntu VM that doesn't have internet but I do have xrdp
> access. The user that set it up manually built wireshark 2.0.2 but
> forgot to build lua. Other similar installations here use lua 5.1.5
> from apt, so I've downloaded 5.1.5 and built it. The configure finds
> my lua installation but didn't find the .so and then I remembered
> there is no liblua53.so in the default Makefile.
> 
> I'm not even going to bother posting my feeble attempts.

  I think the following Makefile will work for Ubuntu.  I created it in the
lua-5.3/src directory and named it "Makefile.ubuntu".  Then run from the
lua-5.3/src directory:

	GenericUnixPrompt% make -f Makefile.ubuntu clean
	GenericUnixPrompt% make -f Makefile.ubuntu

and you should have a liblua53.so in the directory.  You can copy it where
you need, or you could do:

	GenericUnixPrompt% su make -f Makefile.ubuntu install libdir=/path/to/whereever

  -spc (It follows the GNU Makefile convention, as far as I can tell)

INSTALL         = /usr/bin/install
INSTALL_PROGRAM = $(INSTALL)

prefix         = /usr/local
exec_prefix    = $(prefix)
libdir         = $(exec_prefix)/lib

.PHONY: all install uninstall clean

CC = gcc -std=c99 -Wall -Wextra -pedantic
CFLAGS = -fPIC -shared -g -DLUA_USE_LINUX

%.so :
	$(CC) $(CFLAGS) -o $@ $^

liblua53.so : lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \
		lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o \
		ltm.o lundump.o lvm.o lzio.o	\
		lauxlib.o lbaselib.o lbitlib.o lcorolib.o ldblib.o liolib.o \
		lmathlib.o loslib.o lstrlib.o ltablib.o lutf8lib.o loadlib.o linit.o

install: liblua53.so
	$(INSTALL) -d $(DESTDIR)$(libdir)
	$(INSTALL_PROGRAM) liblua53.so $(DESTDIR)$(libdir)

uninstall:
	$(RM) $(DESTDIR)$(libdir)/liblua53.so

clean:
	$(RM) liblua53.so *.o