Dogfood v1.0.2 has been released; an alternative for building self contained Lua executables

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Dogfood v1.0.2 has been released; an alternative for building self contained Lua executables

Jasper Klein
Hello,

I would like to announce the v1.0.2 release of my project 'dogfood' [1].

Changes:
- Use lua_pcall when calling the main module and report errors to the user.
- Output all errors to stderr like the PUC Lua interpreter does.
- Output a warning for C modules that are found at one of package.cpath locations.


Dogfood is a srlua alternative for building self contained Lua executables.

The main points where dogfood differs from srlua are:
- One self containing executable.
- Can embed multiple (non-binary) Lua modules in one executable.
- No support for Lua 5.1 and older.

Other features:
- Does not depend on a C compiler to build self contained Lua executables.
- Dogfood self can be build for Unix like operating systems and Windows.


-- Jasper


[1] https://github.com/PG1003/dogfood
Reply | Threaded
Open this post in threaded view
|

Re: Dogfood v1.0.2 has been released; an alternative for building self contained Lua executables

Luiz Henrique de Figueiredo
Here are the changes I made to build dogfood in macOS 10.11.6.
Perhaps use "wc -c < $1" instead of stat?

diff -r ../Downloads/dogfood-master/bootstrap.sh dogfood-master/bootstrap.sh
11c11
< PAYLOAD=$(printf "\r\n-- dogfood %08X\r\n" $(stat -L -c %s $1))
---
> PAYLOAD=$(printf "\r\n-- dogfood %08X\r\n" $(stat -L -f %z $1))
18c18
< printf "\r\n-- food %08X\r\n" $(stat -L -c %s $2) >> $3
---
> printf "\r\n-- food %08X\r\n" $(stat -L -f %z $2) >> $3

diff -r ../Downloads/dogfood-master/makefile dogfood-master/makefile
57c57
< $(CC)  $(CFLAGS) -shared -o $@ -fPIC $+
---
> $(CC) $(CFLAGS) -bundle -undefined dynamic_lookup -o $@ $+
Reply | Threaded
Open this post in threaded view
|

Re: Dogfood v1.0.2 has been released; an alternative for building self contained Lua executables

Jasper Klein
Thank you for trying dogfood on macOS.

> Here are the changes I made to build dogfood in macOS 10.11.6.
> Perhaps use "wc -c < $1" instead of stat?

"wc -c < $1" is indeed better than stat.
I didn't know there was so much difference in usage of stat between BSD and GNU.

>  diff -r ../Downloads/dogfood-master/makefile dogfood-master/makefile
>  57c57
>  < $(CC)  $(CFLAGS) -shared -o $@ -fPIC $+
>  ---
> > $(CC) $(CFLAGS) -bundle -undefined dynamic_lookup -o $@ $+

The flags to build the module on macOS are not accepted by GCC on Linux.
I will try to find a solution for it.

-- Jasper
Reply | Threaded
Open this post in threaded view
|

Re: Dogfood v1.0.2 has been released; an alternative for building self contained Lua executables

Jasper Klein

>>  diff -r ../Downloads/dogfood-master/makefile dogfood-master/makefile
>>  57c57
>>  < $(CC)  $(CFLAGS) -shared -o $@ -fPIC $+
>>  ---
>> > $(CC) $(CFLAGS) -bundle -undefined dynamic_lookup -o $@ $+
>
> The flags to build the module on macOS are not accepted by GCC on Linux.
> I will try to find a solution for it.

With the following diff the makefile should build for Linux and macOS.
I donĀ“t know if there are exceptions for other platforms.
If someone has a suggestion, tell me about it so I can fix the makefile.

-- Jasper


@@ -3,6 +3,13 @@ CFLAGS = -Wall -Wextra -Wpedantic -O3
  INCLUDES = -I "./src"
  LDFLAGS = -llua

+OS = $(shell uname -s)
+ifeq ($(OS),Darwin)
+ LIB_FLAGS = -bundle -undefined dynamic_lookup
+else
+ LIB_FLAGS = -shared -fPIC
+endif
+
  SRCDIR = src/
  OUTDIR = out/
  TSTDIR = test/
@@ -54,7 +61,7 @@ $(OUTDIR)foobar: $(OUTDIR)dogfood $(TSTDIR)foo.lua $(TSTDIR)bar.lua $(TSTDIR)bar
  chmod u+x $@

  $(OUTDIR)pg1003.so: $(TSTDIR)pg1003.c
- $(CC)  $(CFLAGS) -shared -o $@ -fPIC $+
+ $(CC)  $(CFLAGS) $(LIB_FLAGS) -o $@ $+

  # By copying pg1003.so to pg1005.so we have created an invalid lua library (wrong entry point) that is used to test dogfood
  $(OUTDIR)pg1005.so: $(OUTDIR)pg1003.so