Skip to content

swaldhoer/native-lua

Repository files navigation

The native Lua Project

GitHub release (latest SemVer) Build status Build Status Build Status GitHub Code style: black


native Lua - 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. For more information on Lua see lua.org.

native Lua delivers a framework to build and test Lua on any platform with any compiler.

Overview

By default Lua requires gcc and make to be installed to build the Lua binaries, therefore building for e.g., Linux or 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 implements a platform and compiler independent way of building and testing Lua.

How-To

Building Lua with the native Lua project requires Python 3.6 or greater and some C compiler. Exemplary Windows build:

  1. python waf configure
  2. python waf build
  3. python waf install

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.

Repository Structure And Code Organization

The repository is structured into the parts described below.

Root Directory

The root directory contains the

  • general project documentation (README.md, CHANGELOG.md)
  • build script and build toolchain (wscript, waf, waf.bat),
  • required Python packages (requirements.txt, environment.yml),
  • CI scripts (.appveyor.yml, .cirrus.yml, azure-pipelines.yml),
  • editor configurations (.vscode, .editorconfig),
  • coding and general guidelines (pyproject.toml),
  • licensing information (LICENSE),
  • and information on the native Lua project and the lua version (VERSION).

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.

docs Directory

This directory contains the man page files for unix-like systems.

src Directory

This directory contains the source files downloaded from lua.org/ftp. Trailing whitespace and additional newlines at the end of the files are removed. Furthermore the native Lua header is included (see _native_lua_config.h).

Changes to original Lua sources are indicated by the following comment:

/* native Lua */

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.4.0  Copyright (C) 1994-2017 Lua.org, PUC-Rio [based on native Lua (0.6.0-devel), https://github.com/swaldhoer/native-lua]

tests Directory

This directory contains the source files downloaded from lua.org/tests. Trailing whitespace and additional newlines at the end of the files are removed.

Note: The encoding of test files must not be changed.

Some tests require changes to the test files in order to work on platforms.

Changes to original Lua test sources are indicated by the following comment:

-- native Lua

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

Documentation

The native Lua project is document in this README.md and in the build script (wscript).

License

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