Giter Club home page Giter Club logo

dogfood's Introduction

A tool for building self contained Lua executables

This tool is an alternative for srlua which can be found here.

The main points where dogfood differs from srlua are:

  • One self contained executable.
  • Can embed multiple 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.

dogfood consists of two parts; a Lua interpreter and a Lua module that creates the self executable Lua programs. The interpreter runs the dogfood's Lua module that is appended at the end of the executable. The module reuses the interpreter when it builds a self contained Lua executable by copying its interpreter and then append the user's Lua modules.

dogfood owes its name to the reuse of its own interpreter. Using your own software products is also knowns as dogfooding.

Requirements

  • Lua version 5.2, 5.3 or 5.4

Usage of dogfood

dogfood [OPTIONS] OUT MODULE...

OUT is the destination of the resulting program
The first MODULE from the list is the entry point of the program while the optional extra modules are accessable by require. The modules are provided without the '.lua' extention.
C modules cannot be embedded in the resulting program but the program can load C modules when they are placed in one of the package.cpath search paths.

The following OPTIONS are available.

Option Description
-c, --compile Compile the modules and embed them as bytecode.
-s, --strip-debug-information Strips the debug information from the bytecode.
-h, --help Shows the help.
-m Adds the given path to package.loaded to search for modules that are provided as parameter.
-v, --lua-version Shows the Lua language version of the interpreter used by the resulting program..

Dogfood binaries for Windows

Building dogfood binaries for Windows requires more effort than for Unix like operating systems.
The following executables are available for download to lower the bar for Windows users that want to try dogfood or don't have the knowledge to build it.

Lua version dogfood v1.1.0 x86-64 dogfood v1.1.0 x86-32
5.2.4 download download
5.3.6 download download
5.4.6 download download

Bootstrapping

Right after compilation, a dogfood binary must be bootstrapped before it is able to build self contained Lua executables. The makefile provided with the sources already takes care of this. In case when you have your own build environment, a bootstrap shell script is provided for Unix like environments and for Windows.

The usage of the bootstrap script is as follows;

bootstrap.sh EXECUTABLE food.lua OUT

For Windows bootstrap.bat instead of bootstrap.sh is used but the commandline prameters are same.

EXECUTABLE is the path to the executable that needs to be bootstrapped.
The file food.lua contains dogfood's logic. You can find this file in the source directory.
OUT is the destination of the resulting executable. EXECUTABLE and OUT can point to the same file.

dogfood's People

Contributors

pg1003 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

anzz1 bddrey

dogfood's Issues

Hi, can't require C module

Hi, this project is so nice.
Lua modules embed or not works fine.
But process is blocked when require C module (.dll).
I test some dynamic libs - 'lfs', 'socket', 'iuplua', 'gbk'.
Demo:

  1. print(pcall(require,'lfs')) in test.lua
    lfs is in the same directory.
  2. 'dogfood.exe test.exe test' in cmd
  3. 'test.exe' under cmd.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.