Coder Social home page Coder Social logo

luvit / luvi Goto Github PK

View Code? Open in Web Editor NEW
297.0 36.0 63.0 3.52 MB

A project in-between luv and luvit.

License: Apache License 2.0

C 62.71% CMake 11.09% Lua 14.99% Makefile 4.89% Batchfile 5.10% Shell 1.21%
lua luajit libuv luvit hacktoberfest

luvi's Introduction

luvi

Linux Build Status Windows Build status Code Quality: Cpp Total Alerts

A project in-between luv and luvit.

The goal of this is to make building luvit and derivatives much easier.

Workflow

Luvi has a somewhat unique, but very easy workflow for creating self-contained binaries on systems that don't have a compiler.

# Make a folder
git init myapp
# Write the app
vim myapp/main.lua
# Run the app
luvi myapp
# Build the binary when done
luvi myapp -o mybinary
# Build the binary with compiled Lua bytecode
luvi myapp -o mybinary --compile
# Build the binary with compiled and stripped Lua bytecode
luvi myapp -o mybinary --strip
# Run the new self-contained binary
./mybinary
# Deploy / Publish / Profit!

Main API

Your main.lua is run in a mostly stock luajit environment with a few extra things added. This means you can use the luajit extensions including DLUAJIT_ENABLE_LUA52COMPAT features, which we turn on.

Libuv is baked in

The "uv" module contains bindings to libuv as defined in the luv project. Simply require("uv") to access it.

Use this for file I/O, network I/O, timers, or various interfaces with the operating system. This lets you write fast non-blocking network servers or frameworks. The APIs in luv mirror what's in libuv allowing you to add whatever API sugar you want on top be it callbacks, coroutines, or whatever.

Just be sure to call uv.run() and the end of your script to start the event loop if you want to actually wait for any events to happen.

local uv = require('uv')

local function setTimeout(timeout, callback)
    local timer = uv.new_timer()
    local function ontimeout()
        print("ontimeout", self)
        uv.timer_stop(timer)
        uv.close(timer)
        callback(self)
    end
    uv.timer_start(timer, timeout, 0, ontimeout)
    return timer
end

setTimeout(1000, function ()
    print("This happens later")
end)

print("This happens first")

-- This blocks till the timer is done
uv.run()

Integration with C's main function

The raw argc and argv from C side is exposed as a zero indexed lua table of strings at args.

print("Your arguments were", args)

The "env" module provides read/write access to your local environment variables via env.keys, env.get, env.put, env.set, and env.unset.

local env = require('env')

-- Convert the module to a mutable magic table.
local environment = setmetatable({}, {
    __pairs = function (table)
        local keys = env.keys()
        local index = 0
        return function (...)
            index = index + 1
            local name = keys[index]
            if name then
                return name, table[name]
            end
        end
    end,
    __index = function (table, name)
        return env.get(name)
    end,
    __newindex = function (table, name, value)
        if value then
            env.set(name, value, 1)
        else
            env.unset(name)
        end
    end
}))

If you return an integer from main.lua it will be your program's exit code.

Bundle I/O

If you're running from a unzipped folder on disk or a zipped bundle appended to the binary, the I/O to read from this is the same. This is exposed as the bundle property in the "luvi" module.

local bundle = require("luvi").bundle
local files = bundle.readdir("")

bundle.stat(path)

Load metadata about a file in the bundle. This includes type ("file" or "directory"), mtime (in ms since epoch), and size (in bytes).

If the file doesn't exist, it returns nil.

bundle.readdir(path)

Read a directory. Returns a list of filenames in the directory.

If the directory doesn't exist, it return nil.

bundle.readfile(path)

Read the contents of a file. Returns a string if the file exists and nil if it doesn't.

Utils

There is also a "utils" module that has some useful debugging stuff like a colorized pretty printer.

local uv = require('uv')
local dump = require('utils').dump
-- Create a global p() function that pretty prints any values
-- to stdout using libuv's APIs
_G.p = function (...)
    local n = select('#', ...)
    local arguments = { ... }

    for i = 1, n do
        arguments[i] = dump(arguments[i])
    end

    local toWrite = table.concat(arguments, "\t") .. "\n"
    uv.write(stdout, toWrite);
end

Building from Source

We maintain several binary releases of luvi to ease bootstrapping of lit and luvit apps.

The following platforms are supported:

  • Windows (x86_64 / i386)
  • FreeBSD 10.1 (x86_64)
  • Raspberry PI Raspbian (armv6)
  • Raspberry PI 2 Raspbian (armv7)
  • Debian 9 "Stretch" (x86_64)
  • OSX 10.14 "Mojave" (x86_64)

If you want to not wait for pre-built binaries and dive right in, building is based on CMake and is pretty simple.

Build Dependencies

  • Git
  • CMake
  • A C Compiler (visual studio on Windows)
  • Perl (required for OpenSSL)
  • NASM (required for OpenSSL ASM optimizations on Windows)

First clone this repo recursively.

git clone --recursive https://github.com/luvit/luvi.git

Then run the makefile inside it. (Note this assumes you have cmake in your path.) If you're on windows, there is a make.bat file that works mostly like the unix Makefile.

Prior to building the luvi binary you must configure the version of luvi that you want to build. Currently there are three versions:

  • tiny: only the necessities; omits OpenSSL, LPeg, and lrexlib
  • regular: the normal luvit experience; includes OpenSSL, lpeg and lrexlib
  • regular-asm: includes OpenSSL's ASM optimizations
cd luvi
make regular
make
make test

When that's done you should have a shiny little binary in build/luvi.

$ ls -lh build/luvi
-rwxr-xr-x 1 tim tim 948K Nov 20 16:39 build/luvi

Usage

Run it to see usage information:

$ luvi -h

Usage: luvi bundle+ [options] [-- extra args]

  bundle            Path to directory or zip file containing bundle source.
                    `bundle` can be specified multiple times to layer bundles
                    on top of each other.
  --version         Show luvi version and compiled in options.
  --output target   Build a luvi app by zipping the bundle and inserting luvi.
  --main path       Specify a custom main bundle path (normally main.lua)
  --compile         Compile Lua code into bytecode before bundling.
  --strip           Compile Lua code and strip debug info.
  --force           Ignore errors when compiling Lua code.
  --help            Show this help file.
  --                All args after this go to the luvi app itself.

Examples:

  # Run an app from disk, but pass in arguments
  luvi path/to/app -- app args

  # Run from a app zip
  luvi path/to/app.zip

  # Run an app that layers on top of luvit
  luvi path/to/app path/to/luvit

  # Bundle an app with luvi to create standalone
  luvi path/to/app -o target
  ./target some args

  # Run unit tests for a luvi app using custom main
  luvi path/to/app -m tests/run.lua

You can run the sample repl app by doing:

build/luvi samples/repl.app

Ot the test suite with:

build/luvi samples/test.app

CMake Flags

You can use the predefined makefile targets if you want or use cmake directly for more control.

WithOpenSSL (Default: OFF)      - Enable OpenSSL Support
WithOpenSSLASM (Default: OFF)   - Enable OpenSSL Assembly Optimizations
WithSharedOpenSSL (Default: ON) - Use System OpenSSL Library
                                  Otherwise use static library

OPENSSL_ROOT_DIR                - Override the OpenSSL Root Directory
OPENSSL_INCLUDE_DIR             - Override the OpenSSL Include Directory
OPENSSL_LIBRARIES               - Override the OpenSSL Library Path

Example (Static OpenSSL):

cmake \
    -DWithOpenSSL=ON \
    -DWithSharedOpenSSL=OFF \
    ..

Example (Shared OpenSSL):

cmake \
    -DWithSharedOpenSSL=ON \
    -DWithOpenSSL=ON \
    -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl \
    -DOPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include \
    -DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib \
    ..

Holy Build

Executables across Linux distributions are not largely portable for various differences. We can leverage the holy-build-box to create a portable executable for i686 and x86_64 environments.

Note: If you are attempting this on OSX, please install GNU tar from homebrew:

brew install gnu-tar

To get started:

  1. Create a docker machine:

    docker-machine create --driver vmwarefusion --vmwarefusion-cpu-count 3 holy-build-box
    eval $(docker-machine env holy-build-box)
  2. Start the build

    make linux-build
  3. Results should be the current working directory.

luvi's People

Contributors

aiverson avatar bilal2453 avatar carlocab avatar caryhaynie avatar creationix avatar duckwhale avatar evadeflow avatar finitereality avatar james2doyle avatar joerg-krause avatar lduboeuf avatar oz-rw avatar plauche avatar polyswarmer avatar rjemanuele avatar rphillips avatar sinisterrectus avatar squeek502 avatar starwing avatar truemedian avatar xcorail avatar xh4h avatar zhaozg 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  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  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  avatar  avatar  avatar  avatar

Watchers

 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  avatar

luvi's Issues

Build system should change

According to different discussions like #109, I suppose supporting embedded devices is a target for luv and luvi. But the build system does not allow this.

During the build, luajit needs some binaries to be built on the HOST system (buildvm and minilua) and CMAKE does not allow two compilers to run, you should either build for cross-compiling or not.

Another issue is that luvi uses luajit at some stage in the build process to generate byte-codes for some lua scripts, if we cross-compile, luajit won't run on the host machine.

I think moving to another build system like gyp or pure Makefile would solve the first issue. For the second, we can force two builds of luajit, one for host, one for target.

Use package.preload instead of just registering native bindings to _G

Registering many things to _G will cause some problems in some case. We should register them to package.preload and require(them) as local varibles when require.

static luaL_Reg native_bindings[] = {
{"luv", luaopen_luv},
{NULL, NULL}
};

in main:

lua_getglobal(L, "package");
lua_getfield(L, -1, "preload");
luaL_setfuncs(L,  native_bindings, 0);
lua_pop(L, 2);

when we need uv:

local uv = require "luv"

and by the way, this loadstring code is just a mirror of init.lua, so why not directly loadfile("init.lua")? If there will be a rewritten require, that should also be written in Lua.

 // Load the init.lua script
if (luaL_loadstring(L, "return require('init')(...)")) {
fprintf(stderr, "%s\n", lua_tostring(L, -1));
return -1;
}

Windows Event Log

Using the Windows Event Log from Luvi is a tricky proposition without compiling for each change of the logging format. The old use of the Windows Event system is deprecated in favor of the new Windows Event Log.

Writing to the Windows Event Log requires use of the Message Compiler (mc.exe) to compile the desired message format into a binary format linkable to a DLL. https://msdn.microsoft.com/en-us/library/windows/desktop/aa363680(v=vs.85).aspx These tools are freely available as part of the Platform SDK.

A few paths are available to us:

  1. Once shared library support is complete we can provide instructions for accessing the Message Format DLL and the API for writing said messages.
  2. Include a simple static message format
  3. Use the native methods to load the message DLL and use the API for writing said messages.

For the moment, I am leaning toward the last option and providing the API to register a provider message DLL and report events from that DLL.

Enhancement: Embed libtcc

libtcc is the API part of tcc, the Tiny C Compiler. It is a standalone library for compiling, assembling and linking C code. It is small and very fast.

If we embed libtcc into luvi, then luvit, lit, and other downstream users can:-

  • mix C code with lua code in deployed bundles;
  • compile at runtime, not build time for a particular platform
  • speed up development and deployment
  • avoid the need for a cross-compiler tool

For me, this last is the biggest win. Most of the sort of C code needed in luvi applications is of the 'easier to do this bit in C' or 'I need some glue to wrap up this horrible third-party API'; currently, a developer has to run either a set of local cross-compile toolchains (an unmanageable nightmare for most of us) or a build farm (yeah)! Neither are great for rapid prototyping or development where performance isn't the be all and end all.

tcc is not appropriate:-

  • where runtime performance is critical; it's slower than optimized output from gcc and clang
  • where a target system lacks installed system headers

These could be mitigated, in a number of ways:-

  • only allow libtcc when running unbundled applications (aka 'development mode')
  • hard-code typical locations (these are well known for Mac OS X, the BSDs and Linux)
  • embed the system headers as resources into luvi (nearly all are open source, and this isn't linking)
  • allow fallback to looking for .so, etc, as we do now in require.lua; this would also allow those folks that want to use Makefiles or cmake

Support shared luvi

The idea is to enable a shared luvi binary, but still have single-file programs.

echo '#!/usr/local/bin/luvi --' > luvit
curl http://lit.luvit.io/packages/luvit/luvit/v2.1.16.zip >> luvit
chmod +x luvit
./luvit

This works as long as you don't try to pass any arguments to luvit. We need to tweak luvi's CLI handling to allow the luvi app to get it's arguments.

Describe Luvi Windows Service Support

Windows Service support features:

  • Complete Windows services can be written in Luvi, example: https://github.com/luvit/luvi/blob/master/samples/winsvc.app/main.lua
  • The service API closely mimics the Windows API to provide easy understanding of writing a service in Luvi
  • Services can be written in their own process or a shared process
  • Each service runs its own main function
  • Each service has its own callback for handling service control
  • Service control functions are provided for Creating, Deleting, Starting, and other control operations.
  • Extended Service configuration is provided by ChangeServiceConfig2 (service triggers are currently unsupported)

Internally the Windows service threads feed callbacks and control operations to Luv. Each service thread internally calls RegisterServiceCtrlHandlerEx as that much be done within the context of the calling service's thread and the control operations passed to that handler are passed to the user defined Lua handler.

bundle.register

Hi,

I don't see the bundle.register method in the docs. Is that a crucial part? Because it seems that's the only way to 'require' other Lua mods for apps. I found it in the samples.

Great work by the way. Really enjoying Luvi so far.

Cheers.

Libuv doesn't build on Windows 10 with VS 2015

I manually change the MSVC version to 14 from 12 and it configures and almost builds, but at the last step, I get:

"C:\Code\luvi\build\ALL_BUILD.vcxproj" (default target) (1) ->
"C:\Code\luvi\build\deps\luv\luv.vcxproj" (default target) (5) ->
    (ClCompile target) ->
  c:\code\luvi\deps\luv\src\lthreadpool.h(30): error C2632: 'int' followed by 'bool' is illegal [C:\Code\luvi\build\deps\luv\luv.vcxproj]
  c:\code\luvi\deps\luv\src\lthreadpool.h(30): error C2208: 'int': no members defined using this type [C:\Code\luvi\build\deps\luv\luv.vcxproj]
  c:\code\luvi\deps\luv\src\thread.c(68): error C2059: syntax error: 'type' [C:\Code\luvi\build\deps\luv\luv.vcxproj]
  c:\code\luvi\deps\luv\src\thread.c(106): error C2059: syntax error: 'type' [C:\Code\luvi\build\deps\luv\luv.vcxproj]

LPEG's re.lua module not included with luvi?

re.lua is a simple pure-lua module that provides string pattern syntax for lpeg (like regex/lua patterns). Although you can easily inlcude the file in your projects it should be part of the deps as it is part of the standard lpeg distribution.

I notice it's included in the lpeg repo in /deps so perhaps I am missing something but it is definitely not available using require("re") nor is it included in the lpeg module itself.

http://www.inf.puc-rio.br/~roberto/lpeg/re.html

Cleanup luvi interface to not consume command-line arguments.

Since luvi is used to build things like luvit that want full control over args, we can't use args to tell luvi where to find the path.

The proposed resolution is as follows:

  • If LUVI_ZIP environment variable is set, it's the path to an external zip file.
  • If LUVI_DIR environment variable is set, it's the path to the folder containing main.lua.
  • If a zip is appended to the binary itself, use that.
  • Otherwise, search in the cwd for main.lua.
  • Look in parent directories also for main.lua
  • If none are found, throw an error reporting usage.

Document usage of PCRE and LPEG module

Both modules are undocument. I am not quite sure how to use them. Does it mean I can use them in my Lua code, e.g.

local lpeg = require "lpeg"

Thank you!

Outdated usage of luvi

The luvi README and usage help text both say:

  # Run an app that layers on top of luvit
  luvi path/to/app path/to/luvit

This seems to be an outdated usage of luvi: luvit/luvit#948

Why are headers only installed for shared lib build?

CMakeLists is set to only install headers when a shared library version is built but they are needed for building native modules even in a statically linked luvi.

if (BUILD_SHARED_LIBS)
install(
FILES src/luv.h src/util.h src/lhandle.h src/lreq.h
DESTINATION "${INSTALL_INC_DIR}"
)
endif (BUILD_SHARED_LIBS)

Use path relative to my app rather than full path.

When my luvit app crashes, it reports full path of lua files.
When the path is too long to display, it was truncated with ...

This is not friendly for look up errors and not for possible for editors capture errors.
Is it possible to force luvit use path relative to my app root rather than full path.

Unknown CMake command "lua_add_executable"

Building luvi 2.7.0 with WithSharedLibluv=ON fails:

(mkdir -p /home/joerg/Development/git/buildroot/output/build/luvi-v2.7.0/ && cd /home/joerg/Development/git/buildroot/output/build/luvi-v2.7.0/ && rm -f CMakeCache.txt && PATH="/home/joerg/Development/git/buildroot/output/host/bin:/home/joerg/Development/git/buildroot/output/host/sbin:/home/joerg/Development/git/buildroot/output/host/usr/bin:/home/joerg/Development/git/buildroot/output/host/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl"  /home/joerg/Development/git/buildroot/output/host/usr/bin/cmake /home/joerg/Development/git/buildroot/output/build/luvi-v2.7.0/ -DCMAKE_TOOLCHAIN_FILE="/home/joerg/Development/git/buildroot/output/host/usr/share/buildroot/toolchainfile.cmake" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="/usr" -DCMAKE_COLOR_MAKEFILE=OFF -DBUILD_DOC=OFF -DBUILD_DOCS=OFF -DBUILD_EXAMPLE=OFF -DBUILD_EXAMPLES=OFF -DBUILD_TEST=OFF -DBUILD_TESTS=OFF -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=ON  -DBUILD_SHARED_LIBS=OFF -DWithSharedLibluv=ON -DTARGET_ARCH=arm -DLUA_PATH=/home/joerg/Development/git/buildroot/output/host/usr/share/luajit-2.0.4/?.lua -DWithPCRE=OFF -DWithSharedPCRE=OFF -DWithOpenSSL=OFF -DWithOpenSSLASM=OFF -DWithSharedOpenSSL=OFF -DWithZLIB=OFF -DWithSharedZLIB=OFF )
-- The C compiler identification is GNU 5.3.0
-- The ASM compiler identification is GNU
-- Found assembler: /home/joerg/Development/git/buildroot/output/host/usr/bin/arm-linux-musleabi-gcc
-- Check for working C compiler: /home/joerg/Development/git/buildroot/output/host/usr/bin/arm-linux-musleabi-gcc
-- Check for working C compiler: /home/joerg/Development/git/buildroot/output/host/usr/bin/arm-linux-musleabi-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Found luvi version: v2.7.0
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE  
-- Found LIBLUV: /home/joerg/Development/git/buildroot/output/host/usr/arm-buildroot-linux-musleabi/sysroot/usr/lib/libluv.so  
-- Found LUAJIT: /home/joerg/Development/git/buildroot/output/host/usr/arm-buildroot-linux-musleabi/sysroot/usr/lib/libluajit-5.1.so  
-- Found LIBUV: /home/joerg/Development/git/buildroot/output/host/usr/arm-buildroot-linux-musleabi/sysroot/usr/lib/libuv.so  
CMake Error at CMakeLists.txt:140 (lua_add_executable):
  Unknown CMake command "lua_add_executable".


-- Configuring incomplete, errors occurred!

Implement busybox style multi-binary using symlinks

Currently luvi always looks for main.lua in the bundle, but this new feature could make it look in main.foo.lua or main/foo.lua if a symlink point to the binary is named foo.

This way a single luvi based binary can have multiple input ports and be reused as multiple commands with only a single copy on the disk.

Path residue?

Originally reported by @develephant in luvit/lit#63

The debug filename for init.lua is the full system path on the machine where it is built.

Could we change this to something like luvi:init.lua or just init.lua without removing debug symbols alltogether?

[Help] wonder how luv_renamed.c implement

Hi,

luv_renamed.c used to redirect dll's that linked with 'luvi.exe' to load symbols from current process, right?

I just want the same tech to make a standalone lua.exe, to makes dlls that linked against lua53.dll to use symbols exported by lua.exe, so I write a redir_luadll.c, same with luv_renamed.c.

but I have some questions:

  1. is my dll (say, foo.dll) need some specific way to build? If that, means I can't use the right now dlls to support my lua.exe.
  2. I use both MSVC and MinGW, does MinGW support this usage?

Build breaks on Mac OSX 10.11

the commit a3ec57f fail to build, but 2.6.1 build well.

make regular
make test

got:

[ 99%] Linking C executable luvi
Undefined symbols for architecture x86_64:
"_CRYPTO_thread_setup", referenced from:
_luaopen_openssl in liblua_openssl.a(openssl.c.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [luvi] Error 1
make[2]: *** [CMakeFiles/luvi.dir/all] Error 2
make[1]: *** [all] Error 2
make: *** [luvi] Error 2

https://github.com/luvit/luvi/blob/master/cmake/Modules/LuaJITAddExecutable.cmake#L29 cause error on windows.

https://github.com/luvit/luvi/blob/master/cmake/Modules/LuaJITAddExecutable.cmake#L29 cause error on windows, LUA_PATH as command to run but not found, simply can solve with follow change

      if (NOT WIN32)
        add_custom_command(
          OUTPUT ${generated_file}
          MAIN_DEPENDENCY ${source_file}
          COMMAND "LUA_PATH=${LUA_PATH}" luajit
          ARGS -b ${LJ_BYTECODE_OPTS}
            ${source_file}
            ${generated_file}
          COMMENT "Building Luajitted ${source_file}: ${generated_file}"
        )
      else()
        add_custom_command(
          OUTPUT ${generated_file}
          MAIN_DEPENDENCY ${source_file}
          COMMAND luajit
          ARGS -b ${LJ_BYTECODE_OPTS}
            ${source_file}
            ${generated_file}
          COMMENT "Building Luajitted ${source_file}: ${generated_file}"
        )      
      endif()

windows: lowercase drive letters

init.lua getPrefix() for windows matches only uppercase drive letters.
Changing %u in %a solves probably a problem I have with lit run

Bring luvi (and luvit environments) to Lua 5.3

Hi dear @creationix,

I have done to port luvi into Lua 5.3, some modifies to:

  • lrexlib: compatible with Lua 5.3
  • lua_zlib: compatible with Lua 5.3
  • luv:
    • add lua_add_executable() to lua.cmake.
    • remove LUA_USE_DLOPEN when Win32.
  • add env.os and env.arch to lenv.c
  • add global unpack and loadstring to lvuibundle.lua
  • add Lua 5.3 compatible to luvi.h
  • add a compatible bit module to fit lit.

After that, lit now works with Lua 5.3 now. but luvit still doesn't work. I hope lit package manager can add depends like "lua > 5.1" or "luajit > 2.0" to enable modules for luajit or lua. So we can write plain Lua script in lit (but not luvit itself).

as there are many modifies, so I hope a guide how to make a pull request :(

regards,
Xavier Wang.

build error

While building "make" gives error
Machine is with Debian testing 32 bit

trailing line from make console as under

CMakeFiles/luajit.dir/lj_vm.s.o: In function lj_ff_math_pow': buildvm_x86.dasc:(.text+0x28e7): undefined reference tolj_wrap_pow'
CMakeFiles/luajit.dir/lj_vm.s.o: In function lj_ff_math_atan2': buildvm_x86.dasc:(.text+0x292b): undefined reference tolj_wrap_atan2'
CMakeFiles/luajit.dir/lj_vm.s.o: In function lj_ff_math_fmod': buildvm_x86.dasc:(.text+0x296f): undefined reference tolj_wrap_fmod'
collect2: error: ld returned 1 exit status
CMakeFiles/luajit.dir/build.make:219: recipe for target 'luajit' failed
make[3]: *** [luajit] Error 1
make[3]: Leaving directory '/home/dennis/Software/Run/luvi/build'
CMakeFiles/Makefile2:130: recipe for target 'CMakeFiles/luajit.dir/all' failed
make[2]: *** [CMakeFiles/luajit.dir/all] Error 2
make[2]: *** Waiting for unfinished jobs....
[ 65%] Building ASM object CMakeFiles/lua51.dir/lj_vm.s.o
Linking C static library libluajit.a
make[3]: Leaving directory '/ho bitme/dennis/Software/Run/luvi/build'
[ 78%] Built target lua51
make[2]: Leaving directory '/home/dennis/Software/Run/luvi/build'
Makefile:76: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/dennis/Software/Run/luvi/build'
Makefile:21: recipe for target 'luvi' failed
make: *** [luvi] Error 2

tar: Ignoring unknown extended header keyword

Extracting the source file archive luvi-src-v2.7.0.tar.gz throws a lot of annoying warnings:

tar: Ignoring unknown extended header keyword 'LIBARCHIVE.creationtime'
tar: Ignoring unknown extended header keyword 'SCHILY.dev'
tar: Ignoring unknown extended header keyword 'SCHILY.ino'
tar: Ignoring unknown extended header keyword 'SCHILY.nlink'
[..]

Can probably fixed by telling BSD tar on OS X not to insert the extendend headers: http://lee.greens.io/blog/2014/05/06/fix-tar-errors-on-os-x/

Embedd LUVI_MAIN into built applications

As I understand the code currently, the value of LUVI_MAIN is not embedded into built applications. This means that Luvi applications are sensitive to environment variables once deployed to systems outside of the builders control.
It'd be very nice that, if LUVI_MAIN is specified with LUVI_TARGET, then a simple text file containing the LUVI_MAIN value is placed in the concatenated zip. Of course, this code be in the unzipped bundle, too.
Alternatively, I'd be equally happy with disabling LUVI_MAIN for built applications, and simply relying on the symlink (main/x) with main.lua fallback.

I'm worried this could end up like LD_PRELOAD et al... a security hole waiting to be opened.

Expand miniz bindings

Discord has made available a zlib-compressed version of their WebSocket stream. To decode this, one needs to cache and resuse a zlib context. This appears to be impossible using luvi's current miniz bindings, which only expose a high-level version of the zlib api. I may work on this myself as time permits, but I'm documenting the concept as an issue here in case others might be able to handle this more quickly than I can.

Is luvi support hotfix?

I want to use luvit to write a game server framework.So i am more concerned with if luvi support hotfix,especially i buddle the app.

Add full init tests

Flesh out the test.app sample to be comprehensive unit tests that can be run by the CI servers. This only need test the new APIs luvi adds on top of luv. There is no need to duplicate luv's own tests.

Fully-shared build target

Currently the only way to get a fully-shared build is to use cmake directly. I wish there was a make target for it.

Archlinux AUR doesn't really like statically linked stuff...

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.