1. The native Lua Project

version-badge appveyor-badge travis-badge cirrus-badge azure-badge readthedocs-badge license-badge code-style-black-badge

Lua on the platform you use with the compiler you choose

Lua is multi-paradigm programming language. Lua is cross-platform as it is written in ANSI C. Lua is licensed under MIT license. native Luas goal is to deliver a framework to build Lua on any platform with any compiler.

For information on Lua see Lua.org.

1.1. Overview

As default Lua requires gcc and make to be installed to build the Lua binaries, therefore building for e.g., Linux or other POSIX systems where gcc and make are natively available is easy. Building Lua on Windows with MinGWs’ gcc and some sort of make is also straight forward.

But this does not allow a good platform and compiler independent way of building and testing Lua. Especially testing is not that simple as it should be. Therefore this project tries to implement a platform and compiler independent way of building and testing Lua.

1.2. How-To

Building Lua with the native Lua project requires Python 3.5 or greater and some C compiler.

alternate text

1.3. Supported Platforms And Compilers

The current release supports the following platform/compiler combinations:

Platform

Official Lua Releases

native Lua Releases

aix

gcc

xlc*, gcc*, clang*

bsd

gcc

see OpenBSD and NetBSD

OpenBSD

see bsd

gcc, clang

NetBSD

see bsd

gcc*, clang*

c89

gcc

all compilers*

FreeBSD

gcc

gcc, clang

generic

gcc

gcc (not win32), msvc (win32)

linux

gcc

gcc, clang, icc*

macOS

gcc

gcc, clang

MinGW

gcc

see win32

posix

gcc

TODO

solaris

gcc

gcc*, clang*

win32

see MinGw

msvc, gcc, clang

cygwin

no

gcc, clang

* means not or not fully tested.

1.4. Repository Structure And Code Organization

The repository is structured into the parts described below.

1.4.1. Root Directory

The root directory contains the

  • general project documentation and a changelog (README.rst, index.rst conf.py, doxygen.conf, CHANGELOG.rst)

  • build script and build toolchain (wscript, waf, waf.bat),

  • CI scripts (.appveyor.yml, .cirrus.yml, .travis.yml, azure-pipelines.yml),

  • editor configurations (.vscode, .editorconfig),

  • coding and general guidelines (pyproject.toml, .pylintrc, CONTRIBUTING.rst),

  • licensing information (LICENSE, CONTRIBUTING.rst),

  • and information on the project and the lua version (VERSION).

For details on the build toolchain see waf.io.

1.4.2. demos Directory

Some scripts demonstrating what can be done with Lua. These demos should not use libraries that do not come with the Lua interpreter.

1.4.3. docs Directory

This directory contains the native Lua project documentation as well as the official Lua documentation. The official Lua documentation is found in docs/_static/doc. This documentation is also linked into the project documentation.

native Lua uses the ReadTheDocs Sphinx theme sphinx_rtd_theme as layout theme for the documentation. It is included in docs/_themes/sphinx_rtd_theme.

1.4.4. src Directory

This directory contains the source files as they are downloaded from Lua.org, except that trailing whitespace and additional newlines at the end of the files are removed.

The lua interpreter (lua.c) as well as the lua compiler (luac.c) have been changed, to indicate, that they were build based on the native Lua project:

$ build/gcc/lua -v
Lua 5.3.5  Copyright (C) 1994-2017 Lua.org, PUC-Rio [based on native Lua (0.4.0), https://github.com/swaldhoer/native-lua]

1.4.5. tests Directory

This directory contains the test files as they are downloaded from Lua.org, except that trailing whitespace and additional newlines at the end of the files are removed.

Furthermore for some tests, require changes to the test files in order to work on platforms. The changes made to these files are indicated by the following comment:

-- native Lua

Test files for the build toolchain have been added in tests/build.

1.6. License

native Lua is licensed under the terms of the MIT license.