[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Writing scripts that are compatible with Lua 5.1, 5.2, and 5.3?
- From: François Perrad <francois.perrad@...>
- Date: Wed, 15 Mar 2017 11:36:35 +0100
2017-03-14 5:57 GMT+01:00 Paul Merrell <marbux@gmail.com>:
> On Mon, Mar 13, 2017 at 4:37 AM, tomas <tomas@tecgraf.puc-rio.br> wrote:
>
>> I wrote that page as the result of my effort in adapting some libraries to
>> work in all those Lua versions. Recently I only worked in LuaSQL drivers
>> (for Lua 5.3) and there were no adaptations needed, so I had nothing to add
>> to the page...
>
> Thanks, Tomas. I'll link the page.
>
> Best regards,
>
> Paul
>
The next step is to test this compatibility.
The current best tool/helper is `hererocks`
(https://github.com/mpeterv/hererocks)
which allows to build several variants of Lua (with its own luarocks)
Here, few examples:
$ hererocks Lua-5.1 --lua 5.1 --compat default
--luarocks latest
$ hererocks Lua-5.2 --lua 5.2 --compat default
--luarocks latest
$ hererocks Lua-5.2-strict --lua 5.2 --compat none
--luarocks latest
$ hererocks Lua-5.3 --lua 5.3 --compat default
--luarocks latest
$ hererocks Lua-5.3-strict --lua 5.3 --compat none
--luarocks latest
$ hererocks Lua-5.3-noconv --lua 5.3 --compat default
--cflags="-DLUA_NOCVTN2S -DLUA_NOCVTS2N" --luarocks latest
$ hererocks Lua-5.3-32bits --lua 5.3 --compat default
--cflags="-DLUA_32BITS" --luarocks latest
$ hererocks Lua-5.3-longdouble --lua 5.3 --compat default
--cflags="-DLUA_FLOAT_TYPE=3" --luarocks latest
$ hererocks LuaJIT-2.0 --luajit 2.0 --compat default
--luarocks latest
$ hererocks LuaJIT-2.0-compat52 --luajit 2.0 --compat all
--luarocks latest
$ hererocks LuaJIT-2.1 --luajit 2.1 --compat default
--luarocks latest
$ hererocks LuaJIT-2.1-compat52 --luajit 2.1 --compat all
--luarocks latest
Variants without compat allows to detect issue with the next version.
Sadly, the current release (2.4.2) of luarocks doesn't support the
Lua-5.3-noconv
(see https://github.com/luarocks/luarocks/issues/682).
Variants with alternate number are not always relevant.
`hererocks` plays with continous integration, like CI Travis.
See my template of .travis.yml, for each line of `env`, a build is done.
François
----8<---------- .travis.yml ----------------------------------------------
language: python
sudo: false
env:
- LUA="lua 5.1" COMPAT=default CFLAGS=""
- LUA="lua 5.2" COMPAT=default CFLAGS=""
- LUA="lua 5.2" COMPAT=none CFLAGS=""
- LUA="lua 5.3" COMPAT=default CFLAGS=""
- LUA="lua 5.3" COMPAT=none CFLAGS=""
- LUA="lua 5.3" COMPAT=default CFLAGS="-DLUA_NOCVTN2S -DLUA_NOCVTS2N"
- LUA="lua 5.3" COMPAT=default CFLAGS="-DLUA_32BITS"
- LUA="lua 5.3" COMPAT=default CFLAGS="-DLUA_FLOAT_TYPE=3"
- LUA="luajit 2.0" COMPAT=none CFLAGS=""
- LUA="luajit 2.0" COMPAT=all CFLAGS=""
- LUA="luajit 2.1" COMPAT=none CFLAGS=""
- LUA="luajit 2.1" COMPAT=all CFLAGS=""
before_install:
- pip install hererocks
- hererocks HERE --$LUA --compat $COMPAT --cflags="$CFLAGS"
--no-readline --luarocks latest --verbose
- hererocks HERE --show
- source HERE/bin/activate
install:
- luarocks install luacheck
- luarocks install other_dependency
script:
- luacheck on_your_code
- run your_test_suite
----8<---------------------------------------------------------------------
> --
> [Notice not included in the above original message: The U.S. National
> Security Agency neither confirms nor denies that it intercepted this
> message.]
>