As the issue #1022 explains, building the default OSv image that
implicitly adds cli module that in turn implicitly pulls httpserver-api
and cli modules, requires some bizarre workarounds on modern Linux distribution.
This is caused by the fact that the lua module is based on Lua 5.2 and older 
version
of LuaSec (OpenSSL library for Lua) which requires old version of OpenSSL 1.0.

This patch updates following modules:
1) cli:
- makes necessary changes to work with Lua 5.3
- drops explicit dependency on the modules ncurses and libedit in lieu of
  new terminfo and the script manifest_from_host.sh that pulls all necessary
  dependencies from host
- creates common cli executable that can be used on both host and OSv side

2) httpserver-api
- drops explicit dependency on the module libyaml in lieu of using
  manifest_from_host.sh that pulls all necessary dependencies from host

3) lua
- revamps this module completely by upgrading to Lua 5.3
- extensively employs manifest_from_host.sh to pull Lua libraries
  from host (see changes to setup.py) and minimize building from source
- updates Lua modules (like LuaSec) to the newest versions

4) openssl
- instead of using hardcoded usr.manifest, new Makefile employs 
manifest_from_host.sh
  to find relevant main OpenSSL 1.1 library and its required dependencies from 
host

The patch also deletes the obsolete module libedit in lieu of using relevant 
files from host.

Finally it adds new terminfo module.

This patch has been tested with following Linux distribution using Docker:
- Ubuntu 18.10 (OpenSSL 1.0 -> OpenSSL 1.1 upgrade)
- Ubuntu 19.04
- Fedora 27 (OpenSSL 1.0 -> OpenSSL 1.1 upgrade)
- Ubuntu 29

Fixes #1022

Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com>
---
 modules/cli/.gitignore                     |   2 +-
 modules/cli/Makefile                       |  35 +++---
 modules/cli/cli.c                          |  63 ++++++----
 modules/cli/lib/osv_api.lua                |   4 +-
 modules/cli/module.py                      |   8 +-
 modules/cli/rpmbuild/Makefile              |   8 +-
 modules/httpserver-api/Makefile            |   1 +
 modules/httpserver-api/module.py           |   1 -
 modules/libedit/.gitignore                 |   2 -
 modules/libedit/Makefile                   |  41 -------
 modules/libedit/module.py                  |   7 --
 modules/lua/.gitignore                     |   8 +-
 modules/lua/Makefile                       | 133 +++++----------------
 modules/lua/check-openssl-version          |  16 ---
 modules/lua/module.py                      |   6 +-
 modules/lua/src/Makefile                   | 119 ------------------
 modules/openssl/.gitignore                 |   1 +
 modules/openssl/Makefile                   |  23 ++++
 modules/openssl/usr.manifest               |  37 ------
 modules/terminfo/Makefile                  |  16 +++
 modules/terminfo/module.py                 |   4 +
 modules/terminfo/out/terminfo/v/vt100-am   |   1 +
 modules/terminfo/out/terminfo/v/vt100-qemu | Bin 0 -> 1184 bytes
 scripts/setup.py                           |  16 ++-
 24 files changed, 151 insertions(+), 401 deletions(-)
 delete mode 100644 modules/libedit/.gitignore
 delete mode 100644 modules/libedit/Makefile
 delete mode 100644 modules/libedit/module.py
 delete mode 100755 modules/lua/check-openssl-version
 delete mode 100644 modules/lua/src/Makefile
 create mode 100644 modules/openssl/.gitignore
 create mode 100644 modules/openssl/Makefile
 delete mode 100644 modules/openssl/usr.manifest
 create mode 100644 modules/terminfo/Makefile
 create mode 100644 modules/terminfo/module.py
 create mode 120000 modules/terminfo/out/terminfo/v/vt100-am
 create mode 100644 modules/terminfo/out/terminfo/v/vt100-qemu

diff --git a/modules/cli/.gitignore b/modules/cli/.gitignore
index 773de15c..64545030 100644
--- a/modules/cli/.gitignore
+++ b/modules/cli/.gitignore
@@ -1,2 +1,2 @@
 cli
-cli.so
+usr.manifest
diff --git a/modules/cli/Makefile b/modules/cli/Makefile
index e2abe632..857aae93 100644
--- a/modules/cli/Makefile
+++ b/modules/cli/Makefile
@@ -1,34 +1,27 @@
+LUA_LIB_NAME = $(shell ldconfig -p | grep -Po "liblua*.5\.3.so" | grep -o 
"lua.*5.3" | head -1)
+LUA_INCLUDES = $(shell $(CXX) -E -xc++ - -v </dev/null 2>&1 | awk '/^End/ 
{exit} /^ \/.*include/ {print $$0}' | grep -vP 'c\+\+|gnu' | xargs -I '{}' find 
{} -name lualib.h | xargs dirname | awk '// { printf("-I%s\n", $$0)}')
+
 CC=gcc
 CFLAGS=-O2 -g -Wall -std=gnu99
-INCLUDES=-I../lua/src \
-       -I$(lastword $(wildcard ../ncurses/build/*/include)) \
-       -I$(lastword $(wildcard ../libedit/build/*/src))
-LFLAGS=-L../lua/src \
-       -L$(lastword $(wildcard ../ncurses/build/*/lib)) \
-       -L$(lastword $(wildcard ../libedit/build/*/src/.libs))
-LIBS=-ledit -ltinfo -llua
+LIBS=-ledit -ltinfo -l$(LUA_LIB_NAME)
 SRCS=cli.c
-MAIN=cli.so
+MAIN=cli
+
+INCLUDES = $(LUA_INCLUDES)
 
-# For compiling executable running locally
-LOC_INCLUDES=-I../lua/src
-LOC_LFLAGS=-L../lua/src
-LOC_LDFLAGS=-Wl,-rpath,$(abspath ../lua/src)
-LOC_MAIN=cli
+SRC = $(shell readlink -f ../..)
 
 module: $(MAIN)
+       $(SRC)/scripts/manifest_from_host.sh cli > usr.manifest
 
 $(MAIN): $(SRCS)
-       $(CC) -DOSV_CLI $(CFLAGS) $(INCLUDES) -fPIC -shared -o $@ $(SRCS) 
$(LFLAGS) $(LIBS)
+       $(CC) $(CFLAGS) $(INCLUDES) $^ -fPIC -pie -o $@ $(LIBS)
 
-$(LOC_MAIN): $(SRCS)
-       $(CC) $(CFLAGS) $(LOC_INCLUDES) $^ -o $@ $(LOC_LDFLAGS) $(LOC_LFLAGS) 
$(LIBS)
+rpm: $(MAIN)
+       make -C rpmbuild
 
 clean:
-       rm -f $(MAIN) $(LOC_MAIN)
+       rm -f $(MAIN)
        make -f rpmbuild/Makefile clean
 
-rpm: $(LOC_MAIN)
-       make -C rpmbuild
-
-.PHONY: module clean rpm
+.PHONY: module clean
diff --git a/modules/cli/cli.c b/modules/cli/cli.c
index 01c6a1e8..68dfbba0 100644
--- a/modules/cli/cli.c
+++ b/modules/cli/cli.c
@@ -5,6 +5,7 @@
 #include <signal.h>
 #include <getopt.h>
 #include <signal.h>
+#include <gnu/libc-version.h>
 
 #include <lua.h>
 #include <lauxlib.h>
@@ -16,17 +17,15 @@
 #include <sys/poll.h>
 #include <termios.h>
 
-#ifdef OSV_CLI
-#define CLI_LUA "/cli/cli.lua"
-#define CLI_LUA_PATH 
"/usr/share/lua/5.2/?.lua;/cli/lib/?.lua;/cli/lua/share/?.lua"
-#define CLI_LUA_CPATH "/usr/lib/lua/5.2/?.so;/cli/lua/lib/?.so"
-#define CLI_COMMANDS_PATH "/cli/commands"
-#else
-#define CLI_LUA "cli.lua"
-#define CLI_LUA_PATH 
"lib/?.lua;../lua/out/share/lua/5.2/?.lua;./lib/share/lua/5.2/?.lua"
-#define CLI_LUA_CPATH "../lua/out/lib/lua/5.2/?.so;./lib/lib/lua/5.2/?.so"
-#define CLI_COMMANDS_PATH "./commands"
-#endif
+#define OSV_CLI_LUA "/cli-app/cli.lua"
+#define OSV_CLI_LUA_PATH 
"/usr/share/lua/5.3/?.lua;/usr/share/lua/5.3/?/init.lua;/cli-app/lib/?.lua;/cli-app/lua/share/?.lua"
+#define OSV_CLI_LUA_CPATH "/usr/lib/lua/5.3/?.so;/cli-app/lua/lib/?.so"
+#define OSV_CLI_COMMANDS_PATH "/cli-app/commands"
+
+#define HOST_CLI_LUA "cli.lua"
+#define HOST_CLI_LUA_PATH 
"lib/?.lua;./lib/share/lua/5.3/?.lua;../lua/install/lua_modules/share/lua/5.3/?.lua;../lua/install/lua_modules/share/lua/5.3/?/init.lua"
+#define HOST_CLI_LUA_CPATH 
"./lib/lib/lua/5.3/?.so;../lua/install/lua_modules/lib/lua/5.3/?.so"
+#define HOST_CLI_COMMANDS_PATH "./commands"
 
 #define PROMPT_MAXLEN 128
 static char sprompt[PROMPT_MAXLEN];
@@ -66,22 +65,26 @@ static struct {
 /* Misc */
 void print_usage();
 
+static int is_osv() {
+  return strcmp("OSv", gnu_get_libc_release()) == 0;
+}
+
 int main (int argc, char* argv[]) {
-#ifdef OSV_CLI
-  putenv("TERM=vt100-qemu");
+  if (is_osv()) {
+    putenv("TERM=vt100-qemu");
 
-  cli_console_size_dirty();
-#else
-  struct winsize sz;
-  ioctl(0, TIOCGWINSZ, &sz);
+    cli_console_size_dirty();
+  } else {
+    struct winsize sz;
+    ioctl(0, TIOCGWINSZ, &sz);
 
-  if (sz.ws_col > 0 && sz.ws_row > 0) {
-    con_width = sz.ws_col;
-    con_height = sz.ws_row;
+    if (sz.ws_col > 0 && sz.ws_row > 0) {
+      con_width = sz.ws_col;
+      con_height = sz.ws_row;
 
-    signal(SIGWINCH, cli_sigwinch_handler);
+      signal(SIGWINCH, cli_sigwinch_handler);
+    }
   }
-#endif
 
   int i;
 
@@ -137,6 +140,9 @@ int main (int argc, char* argv[]) {
 
   /* Lua state */
   L = cli_luaL_newstate();
+  if (L == NULL) {
+    exit(2);
+  }
 
   if (test_command != NULL) {
     if (L == NULL) {
@@ -292,10 +298,15 @@ lua_State *cli_luaL_newstate() {
   lua_State *L = luaL_newstate();
   luaL_openlibs(L);
 
-  cli_lua_settable(L, "package", "path", CLI_LUA_PATH);
-  cli_lua_settable(L, "package", "cpath", CLI_LUA_CPATH);
+  if (is_osv()) {
+    cli_lua_settable(L, "package", "path", OSV_CLI_LUA_PATH);
+    cli_lua_settable(L, "package", "cpath", OSV_CLI_LUA_CPATH);
+  } else {
+    cli_lua_settable(L, "package", "path", HOST_CLI_LUA_PATH);
+    cli_lua_settable(L, "package", "cpath", HOST_CLI_LUA_CPATH);
+  }
 
-  int error = luaL_loadfile(L, CLI_LUA) || lua_pcall(L, 0, 0, 0);
+  int error = luaL_loadfile(L, is_osv() ? OSV_CLI_LUA : HOST_CLI_LUA) || 
lua_pcall(L, 0, 0, 0);
   if (error) {
     fprintf(stderr, "Failed to load shell: %s\n", lua_tostring(L, -1));
     lua_pop(L, 1);
@@ -304,7 +315,7 @@ lua_State *cli_luaL_newstate() {
     return NULL;
   }
 
-  cli_lua_settable(L, "context", "commands_path", CLI_COMMANDS_PATH);
+  cli_lua_settable(L, "context", "commands_path", is_osv() ? 
OSV_CLI_COMMANDS_PATH : HOST_CLI_COMMANDS_PATH);
   for (int i=0; i<CTXC; i++) {
     if (ctxv[i]) {
       cli_lua_settable(L, "context", ctx[i].name, ctxv[i]);
diff --git a/modules/cli/lib/osv_api.lua b/modules/cli/lib/osv_api.lua
index 7155298d..affc3056 100644
--- a/modules/cli/lib/osv_api.lua
+++ b/modules/cli/lib/osv_api.lua
@@ -91,12 +91,12 @@ local function create_ssl_socket()
 
   local params = {
     mode = "client",
-    protocol = "tlsv1",
+    protocol = "any",
     key = context.ssl_key,
     certificate = context.ssl_cert,
     cafile = context.ssl_cacert,
     verify = context.ssl_verify,
-    options = "all"
+    options = {"all", "no_sslv3"}
   }
 
   local st = getmetatable(conn.sock).__index.settimeout
diff --git a/modules/cli/module.py b/modules/cli/module.py
index e38aa2db..aec10615 100644
--- a/modules/cli/module.py
+++ b/modules/cli/module.py
@@ -3,16 +3,14 @@ from osv.modules.filemap import FileMap
 from osv.modules import api
 
 require('lua')
-require('ncurses')
-require('libedit')
+require('terminfo')
 require_running('httpserver')
 
 usr_files = FileMap()
-usr_files.add('${OSV_BASE}/modules/cli').to('/cli') \
-       .include('cli.so') \
+usr_files.add('${OSV_BASE}/modules/cli').to('/cli-app') \
        .include('cli.lua') \
        .include('lib/**') \
        .include('commands/**')
 
-full = api.run('/cli/cli.so')
+full = api.run('/cli')
 default = full
diff --git a/modules/cli/rpmbuild/Makefile b/modules/cli/rpmbuild/Makefile
index be9915d6..c91d30f6 100644
--- a/modules/cli/rpmbuild/Makefile
+++ b/modules/cli/rpmbuild/Makefile
@@ -5,7 +5,7 @@ VERSION=1.0
 
 MAIN=rpm
 CLI_DIR=osv-cli-$(VERSION)/usr/lib64/osv-cli
-LOC_MAIN=cli
+LUA_LIB_PATH = $(shell ldconfig -p | grep -Po "/.*liblua*.5\.3.so" | head -1)
 
 module: clean all
 
@@ -30,9 +30,9 @@ copy-files:
        cp $(CLI_ROOT)/cli.lua $(CLI_DIR)
        cp $(CLI_ROOT)/lib/*.lua $(CLI_DIR)/lib
        cp -r $(CLI_ROOT)/commands $(CLI_DIR)
-       cp -r $(LUA_DIR)/out/share $(CLI_DIR)/lib
-       cp -r $(LUA_DIR)/out/lib $(CLI_DIR)/lib
-       cp $(LUA_DIR)/src/liblua.so $(CLI_DIR)/lib
+       cp -r $(LUA_DIR)/install/lua_modules/share $(CLI_DIR)/lib
+       cp -r $(LUA_DIR)/install/lua_modules/lib $(CLI_DIR)/lib
+       cp $(LUA_LIB_PATH) $(CLI_DIR)/lib
 
 clean:
        rm -rf BUILD
diff --git a/modules/httpserver-api/Makefile b/modules/httpserver-api/Makefile
index 0f581e6e..30fdc1a1 100644
--- a/modules/httpserver-api/Makefile
+++ b/modules/httpserver-api/Makefile
@@ -46,6 +46,7 @@ module: all
 
 all: lib$(TARGET).so api_api api_app api_env api_file api_fs api_hardware 
api_network api_os api_trace
        $(call quiet, cat _usr_*.manifest | sort | uniq > usr.manifest, 
CREATE_MANIFEST)
+       $(call very-quiet, $(SRC)/scripts/manifest_from_host.sh lib$(TARGET).so 
>> usr.manifest)
 
 add_api_to_manifest = \
        echo "/usr/mgmt/plugins/libhttpserver-$(1).so: 
`pwd`/libhttpserver-$(1).so" > _usr_$(1).manifest
diff --git a/modules/httpserver-api/module.py b/modules/httpserver-api/module.py
index 25bc4948..e1da7447 100644
--- a/modules/httpserver-api/module.py
+++ b/modules/httpserver-api/module.py
@@ -13,7 +13,6 @@ usr_files.add(os.path.join(_module, 
'api-doc')).to('/usr/mgmt/api')
 
 api.require('openssl')
 api.require('libtools')
-api.require('libyaml')
 
 # only require next 3 modules if java (jre) is included in the list of modules
 api.require_if_other_module_present('josvsym','java')
diff --git a/modules/libedit/.gitignore b/modules/libedit/.gitignore
deleted file mode 100644
index 5fc3ba00..00000000
--- a/modules/libedit/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-build
-download
diff --git a/modules/libedit/Makefile b/modules/libedit/Makefile
deleted file mode 100644
index 04979144..00000000
--- a/modules/libedit/Makefile
+++ /dev/null
@@ -1,41 +0,0 @@
-# A small Makefile "download and build" for libedit
-
-# Directories for downloading and building
-DOWNLOAD=download
-BUILD=build
-
-# libedit
-LE_VERSION=20140620-3.1
-LE_FOLDER=libedit-$(LE_VERSION)
-LE_DOWNLOAD=http://thrysoee.dk/editline/libedit-$(LE_VERSION).tar.gz
-LE_ARCHIVE=download/$(LE_FOLDER).tar.gz
-LE_BUILD=$(BUILD)/$(LE_FOLDER)
-
-CFLAGS:=-fPIC
-LDFLAGS:=-L$(abspath $(lastword $(wildcard ../ncurses/build/*/lib)))
-
-MAIN=$(LE_BUILD)/src/.libs/libedit.so.0
-
-module: $(MAIN)
-
-$(MAIN): $(LE_BUILD)/Makefile
-       cd $(LE_BUILD) && make
-
-$(LE_BUILD)/Makefile: $(LE_BUILD)/configure
-       cd $(LE_BUILD) && CFLAGS=$(CFLAGS) LDFLAGS=$(LDFLAGS) ./configure
-
-$(LE_BUILD)/configure: $(LE_ARCHIVE) | $(BUILD)
-       cd $(BUILD) && tar xzf ../$(LE_ARCHIVE)
-       touch $(LE_BUILD)/configure
-
-$(LE_ARCHIVE): | $(DOWNLOAD)
-       cd $(DOWNLOAD) && \
-               curl --remote-name --remote-time $(LE_DOWNLOAD)
-
-$(DOWNLOAD) $(BUILD):
-       @mkdir -p $@
-
-clean:
-       rm -rf $(BUILD) $(DOWNLOAD)
-
-.PHONY: module clean
diff --git a/modules/libedit/module.py b/modules/libedit/module.py
deleted file mode 100644
index 53582563..00000000
--- a/modules/libedit/module.py
+++ /dev/null
@@ -1,7 +0,0 @@
-from osv.modules.filemap import FileMap
-
-VERSION = '20140620-3.1'
-
-usr_files = FileMap()
-usr_files.add('${OSV_BASE}/modules/libedit/build/libedit-%s/src/.libs' % 
VERSION).to('/usr/lib') \
-       .include('lib*.so.?')
diff --git a/modules/lua/.gitignore b/modules/lua/.gitignore
index 0e3f9ff5..0089f1a3 100644
--- a/modules/lua/.gitignore
+++ b/modules/lua/.gitignore
@@ -1,5 +1,3 @@
-build
-download
-out
-src/*
-!src/Makefile
+install
+upstream
+usr.manifest
diff --git a/modules/lua/Makefile b/modules/lua/Makefile
index 620a78f8..91325455 100644
--- a/modules/lua/Makefile
+++ b/modules/lua/Makefile
@@ -1,138 +1,65 @@
-# Some directories
-OUT=out
-BUILD=build
-DOWNLOAD=download
-
-# Official version
-LUA_V=5.2
-
-# Archive details
-LUA_VERSION=5.2.3
-LUA_FOLDER=lua-$(LUA_VERSION)
-LUA_DOWNLOAD=http://www.lua.org/ftp/$(LUA_FOLDER).tar.gz
-LUA_ARCHIVE=download/$(LUA_FOLDER).tar.gz
-
-# Lua sources for dependencies
-LUA_SRCS=lapi.c lapi.h lauxlib.c lauxlib.h lbaselib.c lbitlib.c lcode.c \
-  lcode.h lcorolib.c lctype.c lctype.h ldblib.c ldebug.c ldebug.h ldo.c ldo.h \
-  ldump.c lfunc.c lfunc.h lgc.c lgc.h linit.c liolib.c llex.c llex.h \
-  llimits.h lmathlib.c lmem.c lmem.h loadlib.c lobject.c lobject.h lopcodes.c \
-  lopcodes.h loslib.c lparser.c lparser.h lstate.c lstate.h lstring.c \
-  lstring.h lstrlib.c ltable.c ltable.h ltablib.c ltm.c ltm.h lua.c luac.c \
-  luaconf.h lua.h lualib.h lundump.c lundump.h lvm.c lvm.h lzio.c lzio.h
-
-SRCS=$(addprefix src/, $(LUA_SRCS))
-
-# Out sub-directories
-BDIR=$(OUT)/bin
-LDIR=$(OUT)/lib/lua/$(LUA_V)
-CDIR=$(OUT)/share/lua/$(LUA_V)
-
-# Lua itself
-MAIN=src/liblua.so
-
-# Local executable used for LuaRocks
-LUA_BIN=$(BDIR)/lua
-LUA_ROCKS_BIN=$(BDIR)/luarocks
+SRC = $(shell readlink -f ../..)
+LUA_ROCKS=upstream/luarocks-3.1.1-linux-x86_64/luarocks
+MODULES_DIR=install/lua_modules
+LDIR=install/lua_modules/lib/lua/5.3
+CDIR=install/lua_modules/share/lua/5.3
 
 # List of Lua modules, each module has its own target
 LUA_MODULES=LuaSocket LuaJSON Lua_stdlib LuaFileSystem LuaPath LuaSec
 
-module: $(MAIN) $(LUA_MODULES)
-
-$(MAIN): $(SRCS)
-       cd src && $(MAKE)
-
-$(LUA_BIN): $(MAIN) | $(BDIR)
-       cp src/lua $(LUA_BIN)
-
-$(LUA_ARCHIVE): | $(DOWNLOAD)
-       cd $(DOWNLOAD) && \
-        curl --remote-name --remote-time $(LUA_DOWNLOAD)
-
-$(SRCS): $(LUA_ARCHIVE)
-       tar -Oxzf $< $(LUA_FOLDER)/$@ > $@
-
-$(DOWNLOAD) $(BUILD) $(LDIR) $(CDIR) $(BDIR):
-       @mkdir -p $@
-
-# == LuaRocks ==
-LuaRocks_V=2.1.2
-LuaRocks_F=luarocks-$(LuaRocks_V)
-LuaRocks_A=$(LuaRocks_F).tar.gz
-LuaRocks_D=http://luarocks.org/releases/$(LuaRocks_A)
-
-$(LUA_ROCKS_BIN): $(LUA_BIN) $(BUILD)/$(LuaRocks_F)/src/luarocks
-       cd $(BUILD)/$(LuaRocks_F) && \
-               make install
-
-$(BUILD)/$(LuaRocks_F)/src/luarocks: $(BUILD)/$(LuaRocks_F)/Makefile
-       cd $(BUILD)/$(LuaRocks_F) && \
-               make build
-
-$(BUILD)/$(LuaRocks_F)/Makefile: $(BUILD)/$(LuaRocks_F)/configure
-       $(eval PREFIX=$(shell pwd))
-       cd $(BUILD)/$(LuaRocks_F) && \
-               ./configure --prefix=$(PREFIX)/$(OUT) --force-config \
-               --with-lua-include=$(PREFIX)/src --lua-version=$(LUA_V) \
-               --with-lua=$(PREFIX)/$(OUT)
-       touch $@
+LUA_LIBRARY := $(shell ldconfig -p | grep -Po "liblua*.5\.3.so.0" | head -1)
+ifndef LUA_LIBRARY
+       LUA_LIBRARY := $(shell ldconfig -p | grep -Po "liblua*.5\.3.so" | head 
-1)
+endif
 
-$(BUILD)/$(LuaRocks_F)/configure: $(DOWNLOAD)/$(LuaRocks_A) | $(BUILD)
-       tar --directory $(BUILD) -xzf $<
-       touch $@
+module: $(LUA_MODULES)
+       mkdir -p $(MODULES_DIR)
+       $(SRC)/scripts/manifest_from_host.sh -l $(LUA_LIBRARY) > usr.manifest
 
-$(DOWNLOAD)/$(LuaRocks_A): | $(DOWNLOAD)
-       curl --remote-time --location $(LuaRocks_D) > $@
+$(LUA_ROCKS):
+       mkdir -p upstream
+       cd upstream && wget -c 
https://luarocks.github.io/luarocks/releases/luarocks-3.1.1-linux-x86_64.zip
+       cd upstream && unzip luarocks-3.1.1-linux-x86_64.zip
 
 # == LuaSocket ==
 LuaSocket: $(LDIR)/socket/core.so
 
-$(LDIR)/socket/core.so: $(LUA_ROCKS_BIN)
-       out/bin/luarocks install luasocket 3.0-rc1
+$(LDIR)/socket/core.so: $(LUA_ROCKS)
+       $(LUA_ROCKS) install --no-doc --tree $(MODULES_DIR) luasocket 3.0rc1-2
 
 # == LuaJSON ==
 LuaJSON: $(CDIR)/json.lua
 
-$(CDIR)/json.lua: $(LUA_ROCKS_BIN)
-       out/bin/luarocks install luajson 1.3.3
+$(CDIR)/json.lua: $(LUA_ROCKS)
+       $(LUA_ROCKS) install --no-doc --tree $(MODULES_DIR) luajson 1.3.4-1
 
 # == Lua_stdlib ==
 Lua_stdlib: $(CDIR)/std.lua
 
-$(CDIR)/std.lua: $(LUA_ROCKS_BIN)
-       out/bin/luarocks install stdlib 40
+$(CDIR)/std.lua: $(LUA_ROCKS)
+       $(LUA_ROCKS) install --no-doc --tree $(MODULES_DIR) stdlib 41.2.2-1
 
 # == LuaFileSystem ==
 LuaFileSystem: $(LDIR)/lfs.so
 
-$(LDIR)/lfs.so: $(LUA_ROCKS_BIN)
-       out/bin/luarocks install LuaFileSystem 1.6.2
+$(LDIR)/lfs.so: $(LUA_ROCKS)
+       $(LUA_ROCKS) install --no-doc --tree $(MODULES_DIR) LuaFileSystem 
1.7.0-2
 
 # == LuaPath ==
 LuaPath: $(CDIR)/path.lua
 
-$(CDIR)/path.lua: $(LUA_ROCKS_BIN)
-       out/bin/luarocks install lua-path 0.2.1
+$(CDIR)/path.lua: $(LUA_ROCKS)
+       $(LUA_ROCKS) install --no-doc --tree $(MODULES_DIR) lua-path 0.3.1-1
 
 # == LuaSec ==
 LuaSec: $(CDIR)/ssl.lua
 
-$(CDIR)/ssl.lua: $(LUA_ROCKS_BIN)
-       ./check-openssl-version
-
-# Workaround because LuaRocks ignores /lib64
-ifneq ("$(wildcard /usr/lib64/libssl.so*)", "")
-       out/bin/luarocks install LuaSec 0.5 OPENSSL_LIBDIR=/usr/lib64
-else
-       out/bin/luarocks install LuaSec 0.5
-endif
+$(CDIR)/ssl.lua: $(LUA_ROCKS)
+       $(LUA_ROCKS) install --no-doc --tree $(MODULES_DIR) LuaSec 0.8-1
 
-##
 clean:
-       rm -f $(SRCS)
-       rm -rf $(DOWNLOAD) $(BUILD) $(OUT)
-       cd src && $(MAKE) clean
+       rm -rf install
+       rm -rf upstream
 
 .PHONY: module clean $(LUA_MODULES)
 .NOTPARALLEL: $(LUA_MODULES)
diff --git a/modules/lua/check-openssl-version 
b/modules/lua/check-openssl-version
deleted file mode 100755
index 90ae479a..00000000
--- a/modules/lua/check-openssl-version
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-
-# This is here to help cope with the transition period that the distro
-# use for openssl-1.0 to openssl-1.1
-if [ -f /usr/include/openssl/opensslv.h ]; then
-    has_new_openssl=$(grep "OpenSSL 1.1" /usr/include/openssl/opensslv.h)
-fi
-if [ "$has_new_openssl"x != "x" ]; then
-    echo "OpenSSL 1.1 header detected."
-    echo "On Fedora >= 26 please use the compat headers by doing:"
-    echo ""
-    echo "    dnf install --allowerasing compat-openssl10-devel -y"
-    echo ""
-    exit 1
-fi
-exit 0
diff --git a/modules/lua/module.py b/modules/lua/module.py
index b15ebbc2..721454a6 100644
--- a/modules/lua/module.py
+++ b/modules/lua/module.py
@@ -1,10 +1,6 @@
 from osv.modules.filemap import FileMap
 
 usr_files = FileMap()
-usr_files.add('${OSV_BASE}/modules/lua/src/liblua.so').to('/usr/lib/liblua.so')
-
-usr_files.add('${OSV_BASE}/modules/lua/out').to('/usr') \
-       .exclude('bin/*') \
-       .exclude('etc/*') \
+usr_files.add('${OSV_BASE}/modules/lua/install/lua_modules/').to('/usr') \
        .exclude('lib/luarocks/**') \
        .exclude('share/lua/*/luarocks/**')
diff --git a/modules/lua/src/Makefile b/modules/lua/src/Makefile
deleted file mode 100644
index c6ed82bb..00000000
--- a/modules/lua/src/Makefile
+++ /dev/null
@@ -1,119 +0,0 @@
-# == MODIFIED VERSION OF ORIGINAL LUA MAKEFILE ==
-
-CC= gcc
-CFLAGS=-O2 -Wall -fPIC -DLUA_COMPAT_ALL -DLUA_USE_DLOPEN -DLUA_USE_STRTODHEX \
- -DLUA_USE_AFORMAT -DLUA_USE_LONGLONG -DLUA_USE_POSIX
-LDFLAGS=
-LIBS= -lm -ldl
-
-AR= ar rcu
-RANLIB= ranlib
-RM= rm -f
-
-LUA_A= liblua.a
-CORE_O=        lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o 
llex.o \
-       lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o \
-       ltm.o lundump.o lvm.o lzio.o
-LIB_O= lauxlib.o lbaselib.o lbitlib.o lcorolib.o ldblib.o liolib.o \
-       lmathlib.o loslib.o lstrlib.o ltablib.o loadlib.o linit.o
-BASE_O= $(CORE_O) $(LIB_O)
-
-LUA_T= lua
-LUA_O= lua.o
-
-LUA_SO= liblua.so
-
-ALL_O= $(BASE_O) $(LUA_O)
-ALL_T= $(LUA_SO) $(LUA_A) $(LUA_T)
-
-all:   $(ALL_T)
-
-o:     $(ALL_O)
-
-$(LUA_A): $(BASE_O)
-       $(AR) $@ $(BASE_O)
-       $(RANLIB) $@
-
-$(LUA_T): $(LUA_O) $(LUA_A)
-       $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
-
-$(LUA_SO): $(ALL_O)
-       $(CC) $(CFLAGS) -shared -o $@ $(LDFLAGS) $? $(LIBS)
-
-clean:
-       $(RM) $(ALL_T) $(ALL_O)
-
-depend:
-       @$(CC) $(CFLAGS) -MM l*.c
-
-echo:
-       @echo "CC= $(CC)"
-       @echo "CFLAGS= $(CFLAGS)"
-       @echo "LDFLAGS= $(SYSLDFLAGS)"
-       @echo "LIBS= $(LIBS)"
-       @echo "RM= $(RM)"
-
-# list targets that do not create files (but not all makes understand .PHONY)
-.PHONY: all o clean depend echo
-
-# DO NOT DELETE
-
-lapi.o: lapi.c lua.h luaconf.h lapi.h llimits.h lstate.h lobject.h ltm.h \
- lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h lstring.h ltable.h lundump.h \
- lvm.h
-lauxlib.o: lauxlib.c lua.h luaconf.h lauxlib.h
-lbaselib.o: lbaselib.c lua.h luaconf.h lauxlib.h lualib.h
-lbitlib.o: lbitlib.c lua.h luaconf.h lauxlib.h lualib.h
-lcode.o: lcode.c lua.h luaconf.h lcode.h llex.h lobject.h llimits.h \
- lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h ldo.h lgc.h \
- lstring.h ltable.h lvm.h
-lcorolib.o: lcorolib.c lua.h luaconf.h lauxlib.h lualib.h
-lctype.o: lctype.c lctype.h lua.h luaconf.h llimits.h
-ldblib.o: ldblib.c lua.h luaconf.h lauxlib.h lualib.h
-ldebug.o: ldebug.c lua.h luaconf.h lapi.h llimits.h lstate.h lobject.h \
- ltm.h lzio.h lmem.h lcode.h llex.h lopcodes.h lparser.h ldebug.h ldo.h \
- lfunc.h lstring.h lgc.h ltable.h lvm.h
-ldo.o: ldo.c lua.h luaconf.h lapi.h llimits.h lstate.h lobject.h ltm.h \
- lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h lopcodes.h lparser.h \
- lstring.h ltable.h lundump.h lvm.h
-ldump.o: ldump.c lua.h luaconf.h lobject.h llimits.h lstate.h ltm.h \
- lzio.h lmem.h lundump.h
-lfunc.o: lfunc.c lua.h luaconf.h lfunc.h lobject.h llimits.h lgc.h \
- lstate.h ltm.h lzio.h lmem.h
-lgc.o: lgc.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h ltm.h \
- lzio.h lmem.h ldo.h lfunc.h lgc.h lstring.h ltable.h
-linit.o: linit.c lua.h luaconf.h lualib.h lauxlib.h
-liolib.o: liolib.c lua.h luaconf.h lauxlib.h lualib.h
-llex.o: llex.c lua.h luaconf.h lctype.h llimits.h ldo.h lobject.h \
- lstate.h ltm.h lzio.h lmem.h llex.h lparser.h lstring.h lgc.h ltable.h
-lmathlib.o: lmathlib.c lua.h luaconf.h lauxlib.h lualib.h
-lmem.o: lmem.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h \
- ltm.h lzio.h lmem.h ldo.h lgc.h
-loadlib.o: loadlib.c lua.h luaconf.h lauxlib.h lualib.h
-lobject.o: lobject.c lua.h luaconf.h lctype.h llimits.h ldebug.h lstate.h \
- lobject.h ltm.h lzio.h lmem.h ldo.h lstring.h lgc.h lvm.h
-lopcodes.o: lopcodes.c lopcodes.h llimits.h lua.h luaconf.h
-loslib.o: loslib.c lua.h luaconf.h lauxlib.h lualib.h
-lparser.o: lparser.c lua.h luaconf.h lcode.h llex.h lobject.h llimits.h \
- lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h ldo.h lfunc.h \
- lstring.h lgc.h ltable.h
-lstate.o: lstate.c lua.h luaconf.h lapi.h llimits.h lstate.h lobject.h \
- ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h llex.h lstring.h \
- ltable.h
-lstring.o: lstring.c lua.h luaconf.h lmem.h llimits.h lobject.h lstate.h \
- ltm.h lzio.h lstring.h lgc.h
-lstrlib.o: lstrlib.c lua.h luaconf.h lauxlib.h lualib.h
-ltable.o: ltable.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h \
- ltm.h lzio.h lmem.h ldo.h lgc.h lstring.h ltable.h lvm.h
-ltablib.o: ltablib.c lua.h luaconf.h lauxlib.h lualib.h
-ltm.o: ltm.c lua.h luaconf.h lobject.h llimits.h lstate.h ltm.h lzio.h \
- lmem.h lstring.h lgc.h ltable.h
-lua.o: lua.c lua.h luaconf.h lauxlib.h lualib.h
-luac.o: luac.c lua.h luaconf.h lauxlib.h lobject.h llimits.h lstate.h \
- ltm.h lzio.h lmem.h lundump.h ldebug.h lopcodes.h
-lundump.o: lundump.c lua.h luaconf.h ldebug.h lstate.h lobject.h \
- llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lstring.h lgc.h lundump.h
-lvm.o: lvm.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h ltm.h \
- lzio.h lmem.h ldo.h lfunc.h lgc.h lopcodes.h lstring.h ltable.h lvm.h
-lzio.o: lzio.c lua.h luaconf.h llimits.h lmem.h lstate.h lobject.h ltm.h \
- lzio.h
diff --git a/modules/openssl/.gitignore b/modules/openssl/.gitignore
new file mode 100644
index 00000000..f9235a6b
--- /dev/null
+++ b/modules/openssl/.gitignore
@@ -0,0 +1 @@
+usr.manifest
diff --git a/modules/openssl/Makefile b/modules/openssl/Makefile
new file mode 100644
index 00000000..fd1617bb
--- /dev/null
+++ b/modules/openssl/Makefile
@@ -0,0 +1,23 @@
+#
+# Copyright (C) 2019 Waldemar Kozaczuk, Ltd.
+#
+# This work is open source software, licensed under the terms of the
+# BSD license as described in the LICENSE file in the top-level directory.
+#
+SRC = $(shell readlink -f ../..)
+
+module:
+       $(SRC)/scripts/manifest_from_host.sh -l libssl.so.1.1 > usr.manifest
+       # From krb5-libs
+       #/&/etc/krb5.conf: %(miscbase)s/&
+       $(SRC)/scripts/manifest_from_host.sh -l libgssapi_krb5.so.2 >> 
usr.manifest
+       # From libselinux
+       $(SRC)/scripts/manifest_from_host.sh -l libselinux.so.1 >> usr.manifest
+       # From xz-libs
+       $(SRC)/scripts/manifest_from_host.sh -l liblzma.so.5 >> usr.manifest
+
+.PHONY: module
+
+clean:
+       rm -rf usr.manifest
+.PHONY: clean
diff --git a/modules/openssl/usr.manifest b/modules/openssl/usr.manifest
deleted file mode 100644
index e9d13ad3..00000000
--- a/modules/openssl/usr.manifest
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# Copyright (C) 2014 Cloudius Systems, Ltd.
-#
-# This work is open source software, licensed under the terms of the
-# BSD license as described in the LICENSE file in the top-level directory.
-#
-
-# From openssl-libs
-/usr/lib/openssl/**: %(miscbase)s/usr/lib64/openssl/**
-#/usr/lib/&/libssl.so.1.0.1k: %(miscbase)s/usr/lib64/&
-/usr/lib/&/libssl.so.10: %(miscbase)s/usr/lib64/&
-#/usr/lib/&/libcrypto.so.1.0.1k: %(miscbase)s/usr/lib64/&
-/usr/lib/&/libcrypto.so.10: %(miscbase)s/usr/lib64/&
-
-# From libcom_err
-/usr/lib/&/libcom_err.so.2: %(miscbase)s/usr/lib64/&
-#/usr/lib/&/libcom_err.so.2.1: %(miscbase)s/usr/lib64/&
-
-# From krb5-libs
-/&/etc/krb5.conf: %(miscbase)s/&
-/usr/lib/&/libgssapi_krb5.so.2: %(miscbase)s/usr/lib64/&
-/usr/lib/&/libk5crypto.so.3: %(miscbase)s/usr/lib64/&
-/usr/lib/&/libkrb5.so.3: %(miscbase)s/usr/lib64/&
-#/usr/lib/&/libkrb5.so.3.3: %(miscbase)s/usr/lib64/&
-/usr/lib/&/libkrb5support.so.0: %(miscbase)s/usr/lib64/&
-
-# From libselinux
-/usr/lib/&/libselinux.so.1: %(miscbase)s/usr/lib64/&
-
-# From keyutils-libs
-/usr/lib/&/libkeyutils.so.1: %(miscbase)s/usr/lib64/&
-
-# From pcre
-/usr/lib/&/libpcre.so.1: %(miscbase)s/usr/lib64/&
-
-# From xz-libs
-/usr/lib/&/liblzma.so.5: %(miscbase)s/usr/lib64/&
diff --git a/modules/terminfo/Makefile b/modules/terminfo/Makefile
new file mode 100644
index 00000000..ad4fbb81
--- /dev/null
+++ b/modules/terminfo/Makefile
@@ -0,0 +1,16 @@
+OUT=out
+TI_VT100=$(OUT)/terminfo/v/vt100-qemu
+
+module: $(TI_VT100)
+
+$(TI_VT100): $(MAIN)
+       @mkdir -p $(OUT)/terminfo
+       infocmp vt100 | sed 's/cud1=\(^J\|\\n\),/cud1=\\E[B,/; 
s/ind=\(^J\|\\n\),/ind=\\E[S,/; s/vt100/vt100-qemu/' \
+               > $(OUT)/terminfo.tmp
+       tic -o $(OUT)/terminfo $(OUT)/terminfo.tmp
+       rm -f $(OUT)/terminfo.tmp
+
+clean:
+       rm -rf $(OUT)
+
+.PHONY: module clean
diff --git a/modules/terminfo/module.py b/modules/terminfo/module.py
new file mode 100644
index 00000000..a422d75c
--- /dev/null
+++ b/modules/terminfo/module.py
@@ -0,0 +1,4 @@
+from osv.modules.filemap import FileMap
+
+usr_files = FileMap()
+usr_files.add('${OSV_BASE}/modules/terminfo/out/terminfo').to('/usr/share/terminfo')
diff --git a/modules/terminfo/out/terminfo/v/vt100-am 
b/modules/terminfo/out/terminfo/v/vt100-am
new file mode 120000
index 00000000..7de1ca04
--- /dev/null
+++ b/modules/terminfo/out/terminfo/v/vt100-am
@@ -0,0 +1 @@
+vt100-qemu
\ No newline at end of file
diff --git a/modules/terminfo/out/terminfo/v/vt100-qemu 
b/modules/terminfo/out/terminfo/v/vt100-qemu
new file mode 100644
index 
0000000000000000000000000000000000000000..d228a60e1d29ebd2bee4c3263d27c32c2bb7427b
GIT binary patch
literal 1184
zcmdT?JBt%h6h3zpcNI*kWp$?sk}I1+&E(;%Ox%!Ni=Zxv4+M$mhD@HDNha^dX1B4m
z6<bS7u~<++K|w)5!NS7A!otGB($e_dJCofF`Ukw^JLfy!dCZ+NSzsE?(+qjo38mZC
zg27Xbyww>wG;58_e9k8W-(v4f*6e0$xxDG?md$)UK*Z#aoPz*|5lho79iy>42jGbm
zI!JT0Kqu+6)OET{X|U@ux&eDzGN-3NC2H)8$KxU0rF&5B(*sw3NROr}oX+w1@jms5
z%XjD*y`We0hThQ!`b3}U3w?ES-(3IQ^*`t*{R00DDC`hB!X}fay~ow(nGY=BMj@uN
znB)m*Z^GVUcUX>9*bewpsftO@*-Q4Cy=CvE@^M#JlvzdOJ<<xccjo?~?PdQzc3hdE
zqoihdncEsS4Q_|H*@O@-!X(wqMSm<BTn4}7kA;Qb6{cE}C==Ng(S`q>npyS7LPAMM
z?*WTiuB1(f{uhZjiWlXU*DaqEIUci9cuHyjq=7zg1-J@a1KL0b=mJ%s2V4MFfdt0J
zwW=!a71v7Yd9n){5CXzL1iIXVcnwL==@7I#M9c`5VIsmrVPfhs#)XZD5v_vg#!^Ym
zV24Yj>L|gb*4*s`d0b4j&+-v(8yYu690H9v6sfRG=}sI$D#{H@l%3;k56^qK;cO*I
zhw(xUpatM*DI2KK`g%57C=`p8%Em^uYFV{fy>8o$Mzh&!wcDLex7+LW`-8!7xVbqR
bZEbCD<BD;;BrW!}xS|Gvn6w5#bH4c>xsE~Q

literal 0
HcmV?d00001

diff --git a/scripts/setup.py b/scripts/setup.py
index de76800c..211b40de 100755
--- a/scripts/setup.py
+++ b/scripts/setup.py
@@ -46,7 +46,7 @@ class Fedora(object):
                 'ncurses',
                 'ncurses-devel',
                 'openssl',
-                'openssl-libs',
+                'openssl-libs.x86_64',
                 'p11-kit',
                 'patch',
                 'python-dpkt',
@@ -56,41 +56,42 @@ class Fedora(object):
                 'unzip',
                 'wget',
                 'yaml-cpp-devel',
+                'pax-utils',
                  ]
     ec2_packages = standard_ec2_packages
     test_packages = ['openssl-devel']
     ec2_post_install = standard_ec2_post_install
 
     class Fedora_25(object):
-        packages = ['java-1.8.0-openjdk', 'python2-requests', 'openssl-devel']
+        packages = ['java-1.8.0-openjdk', 'python2-requests', 
'openssl-devel.x86_64', 'lua-5.3.4', 'lua-devel-5.3.4']
         ec2_packages = []
         test_packages = []
         ec2_post_install = None
         version = '25'
 
     class Fedora_26(object):
-        packages = ['java-1.8.0-openjdk', 'python2-requests', 
'compat-openssl10-devel']
+        packages = ['java-1.8.0-openjdk', 'python2-requests', 
'openssl-devel.x86_64', 'lua-5.3.4', 'lua-devel-5.3.4']
         ec2_packages = []
         test_packages = []
         ec2_post_install = None
         version = '26'
 
     class Fedora_27(object):
-        packages = ['java-1.8.0-openjdk', 'python2-requests', 
'compat-openssl10-devel']
+        packages = ['java-1.8.0-openjdk', 'python2-requests', 
'openssl-devel.x86_64', 'lua-5.3.4', 'lua-devel-5.3.4']
         ec2_packages = []
         test_packages = []
         ec2_post_install = None
         version = '27'
 
     class Fedora_28(object):
-        packages = ['java-1.8.0-openjdk', 'python2-requests', 
'compat-openssl10-devel']
+        packages = ['java-1.8.0-openjdk', 'python2-requests', 
'openssl-devel.x86_64', 'lua-5.3.4', 'lua-devel-5.3.4']
         ec2_packages = []
         test_packages = []
         ec2_post_install = None
         version = '28'
 
     class Fedora_29(object):
-        packages = ['java-1.8.0-openjdk', 'python2-requests', 
'compat-openssl10-devel']
+        packages = ['java-1.8.0-openjdk', 'python2-requests', 
'openssl-devel.x86_64', 'lua-5.3.5', 'lua-devel-5.3.5']
         ec2_packages = []
         test_packages = []
         ec2_post_install = None
@@ -220,6 +221,9 @@ class Ubuntu(object):
                 'tcpdump',
                 'unzip',
                 'wget',
+                'pax-utils',
+                'lua5.3',
+                'liblua5.3',
                 ]
 
     ec2_packages = standard_ec2_packages
-- 
2.20.1

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/20190804153324.14890-1-jwkozaczuk%40gmail.com.

Reply via email to