[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT/LIBLUA PATCH] Add optional main and PRECIOUS target



Hi Helipe,

Thanks for the patch!

I tried to compile a simple app with liblua included, and the build systems doesn't do the fetching.

This behaviour doesn't happen with the previous version. I have no clue why, since you did not change the fetch instruction in Makefile.uk.

Also, please see my comments inline.

On 08.10.2019 16:39, Felipe Huici wrote:
We add a menu option to provide a main() function. We also add a
target to Makefile.uk such that make does not delete the library's
public headers after the build.

I think the commit message should also include the fact that `exportsyms.uk` file is deleted.

Or do a separate patch.

Signed-off-by: Felipe Huici <felipe.huici@xxxxxxxxx>
---
  Config.uk     |  12 +-
  Makefile.uk   |  30 +++--
  exportsyms.uk | 338 --------------------------------------------------
  main.c        |  10 ++
  4 files changed, 42 insertions(+), 348 deletions(-)
  delete mode 100644 exportsyms.uk
  create mode 100644 main.c

diff --git a/Config.uk b/Config.uk
index 343a214..541c460 100644
--- a/Config.uk
+++ b/Config.uk
@@ -1,4 +1,12 @@
-config LIBLUA
+menuconfig LIBLUA
        bool "The Lua programming language"
        default n
-       depends on HAVE_LIBC
+       select LIBNEWLIBC
+       select LIBUKTIME
+       select UKUNISTD
+
+if LIBLUA
+config LIBLUA_MAIN_FUNCTION
+       bool "Provide main function"
+       default y

Can you move it to the right since it's under `if LIBLUA` rule?

+endif
diff --git a/Makefile.uk b/Makefile.uk
index 8e62fea..575e287 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -26,17 +26,30 @@ LIBLUA_SRCS_BASE=$(LIBLUA_ORIGIN)/$(LIBLUA_TARBALL)/src
  # The prepare step below takes care of populating the folder.
  $(call mk_sub_build_dir,liblua/include)
  CINCLUDES-$(CONFIG_LIBLUA)   += -I$(LIBLUA_BUILD)/include
-CPPINCLUDES-$(CONFIG_LIBLUA) += -I$(LIBLUA_BUILD)/include
+CXXINCLUDES-$(CONFIG_LIBLUA) += -I$(LIBLUA_BUILD)/include
# Private headers
  LIBLUA_CINCLUDES-y += -I$(LIBLUA_SRCS_BASE)
################################################################################
-# Compilation unit
+# Glue code
  
################################################################################
-LIBLUA_CFLAGS-y += -DLUA_COMPAT_5_2
+LIBLUA_SRCS-$(CONFIG_LIBLUA_MAIN_FUNCTION) += $(LIBLUA_BASE)/main.c
+################################################################################
+# Library flags
+################################################################################
+LIBLUA_SUPPRESS_FLAGS += -Wno-implicit-function-declaration
+LIBLUA_FLAGS += -DLUA_COMPAT_5_2
+
+LIBLUA_CFLAGS-y += $(LIBLUA_FLAGS) $(LIBLUA_SUPPRESS_FLAGS)
+LIBLUA_CXXFLAGS-y += $(LIBLUA_FLAGS) $(LIBLUA_SUPPRESS_FLAGS)
+
+################################################################################
+# Sources
+################################################################################
  # Main loop
+LIBLUA_LUA_FLAGS-y += -Dmain=lua_main
  LIBLUA_SRCS-y += $(LIBLUA_SRCS_BASE)/lua.c
# CORE_O
@@ -76,18 +89,19 @@ LIBLUA_SRCS-y += $(LIBLUA_SRCS_BASE)/lutf8lib.c
  LIBLUA_SRCS-y += $(LIBLUA_SRCS_BASE)/loadlib.c
  LIBLUA_SRCS-y += $(LIBLUA_SRCS_BASE)/linit.c
-
  
################################################################################
-# libray API headers
+# library API headers
  
################################################################################
-$(LIBLUA_SRCS_BASE)/%.h: $(LIBLUA_BUILD)/.origin
-       @# empty recipe to enforce dependency to archive extraction
+.PRECIOUS: $(LIBLUA_EXTRACTED)/%.h
+

Can you give a little bit of context here?

What is the value of `LIBLUA_EXTRACTED` variable more precisely?

+$(LIBLUA_SRCS_BASE)/%.h: $(LIBLUA_EXTRACTED)/%.h
+       @: # empty recipe to enforce dependency to archive extraction
$(LIBLUA_BUILD)/include/%.h: $(LIBLUA_SRCS_BASE)/%.h
        $(call build_cmd,LN,liblua,$@,\
        ln -sf $< $@)
-$(LIBLUA_SRCS_BASE)/%.hpp: $(LIBLUA_BUILD)/.origin
+$(LIBLUA_SRCS_BASE)/%.hpp: $(LIBLUA_EXTRACTED)/%.h
        @# empty recipe to enforce dependency to archive extraction
$(LIBLUA_BUILD)/include/%.hpp: $(LIBLUA_SRCS_BASE)/%.hpp
diff --git a/exportsyms.uk b/exportsyms.uk
deleted file mode 100644
index cbb857e..0000000
--- a/exportsyms.uk
+++ /dev/null
@@ -1,338 +0,0 @@
-luaB_assert
-luaB_auxwrap
-luaB_cocreate
-luaB_collectgarbage
-luaB_coresume
-luaB_corunning
-luaB_costatus
-luaB_cowrap
-luaB_dofile
-luaB_error
-luaB_getmetatable
-luaB_ipairs
-luaB_load
-luaB_loadfile
-luaB_next
-luaB_pairs
-luaB_pcall
-luaB_print
-luaB_rawequal
-luaB_rawget
-luaB_rawlen
-luaB_rawset
-luaB_select
-luaB_setmetatable
-luaB_tonumber
-luaB_tostring
-luaB_type
-luaB_xpcall
-luaB_yield
-luaB_yieldable
-luaC_barrier_
-luaC_barrierback_
-luaC_checkfinalizer
-luaC_fix
-luaC_freeallobjects
-luaC_fullgc
-luaC_newobj
-luaC_runtilstate
-luaC_step
-luaC_upvalbarrier_
-luaC_upvdeccount
-luaD_call
-luaD_callnoyield
-luaD_growstack
-luaD_hook
-luaD_inctop
-luaD_pcall
-luaD_poscall
-luaD_precall
-luaD_protectedparser
-luaD_rawrunprotected
-luaD_reallocstack
-luaD_shrinkstack
-luaD_throw
-luaE_extendCI
-luaE_freeCI
-luaE_freethread
-luaE_setdebt
-luaE_shrinkCI
-luaF_close
-luaF_findupval
-luaF_freeproto
-luaF_getlocalname
-luaF_initupvals
-luaF_newCclosure
-luaF_newLclosure
-luaF_newproto
-luaG_addinfo
-luaG_concaterror
-luaG_errormsg
-luaG_opinterror
-luaG_ordererror
-luaG_runerror
-luaG_tointerror
-luaG_traceexec
-luaG_typeerror
-luaH_free
-luaH_get
-luaH_getint
-luaH_getn
-luaH_getshortstr
-luaH_getstr
-luaH_new
-luaH_newkey
-luaH_next
-luaH_resize
-luaH_resizearray
-luaH_set
-luaH_setint
-luaK_checkstack
-luaK_code
-luaK_codeABC
-luaK_codeABx
-luaK_codek
-luaK_concat
-luaK_dischargevars
-luaK_exp2RK
-luaK_exp2anyreg
-luaK_exp2anyregup
-luaK_exp2nextreg
-luaK_exp2val
-luaK_fixline
-luaK_getlabel
-luaK_goiffalse
-luaK_goiftrue
-luaK_indexed
-luaK_infix
-luaK_intK
-luaK_jump
-luaK_nil
-luaK_patchclose
-luaK_patchlist
-luaK_patchtohere
-luaK_posfix
-luaK_prefix
-luaK_reserveregs
-luaK_ret
-luaK_self
-luaK_setlist
-luaK_setoneret
-luaK_setreturns
-luaK_storevar
-luaK_stringK
-luaL_addlstring
-luaL_addstring
-luaL_addvalue
-luaL_argerror
-luaL_buffinit
-luaL_buffinitsize
-luaL_callmeta
-luaL_checkany
-luaL_checkinteger
-luaL_checklstring
-luaL_checknumber
-luaL_checkoption
-luaL_checkstack
-luaL_checktype
-luaL_checkudata
-luaL_checkversion_
-luaL_error
-luaL_execresult
-luaL_fileresult
-luaL_getmetafield
-luaL_getsubtable
-luaL_gsub
-luaL_len
-luaL_loadbufferx
-luaL_loadfilex
-luaL_loadstring
-luaL_newmetatable
-luaL_newstate
-luaL_openlibs
-luaL_optinteger
-luaL_optlstring
-luaL_optnumber
-luaL_prepbuffsize
-luaL_pushresult
-luaL_pushresultsize
-luaL_ref
-luaL_requiref
-luaL_setfuncs
-luaL_setmetatable
-luaL_testudata
-luaL_tolstring
-luaL_traceback
-luaL_unref
-luaL_where
-luaM_growaux_
-luaM_realloc_
-luaM_toobig
-luaO_arith
-luaO_ceillog2
-luaO_chunkid
-luaO_fb2int
-luaO_hexavalue
-luaO_int2fb
-luaO_nilobject_
-luaO_pushfstring
-luaO_pushvfstring
-luaO_str2num
-luaO_tostring
-luaO_utf8esc
-luaP_opmodes
-luaP_opnames
-luaS_clearcache
-luaS_createlngstrobj
-luaS_eqlngstr
-luaS_hash
-luaS_hashlongstr
-luaS_init
-luaS_new
-luaS_newlstr
-luaS_newudata
-luaS_remove
-luaS_resize
-luaT_callTM
-luaT_callbinTM
-luaT_callorderTM
-luaT_eventname.3270
-luaT_gettm
-luaT_gettmbyobj
-luaT_init
-luaT_objtypename
-luaT_trybinTM
-luaT_typenames_
-luaU_dump
-luaU_undump
-luaV_concat
-luaV_div
-luaV_equalobj
-luaV_execute
-luaV_finishOp
-luaV_finishget
-luaV_finishset
-luaV_lessequal
-luaV_lessthan
-luaV_mod
-luaV_objlen
-luaV_shiftl
-luaV_tointeger
-luaV_tonumber_
-luaX_init
-luaX_lookahead
-luaX_newstring
-luaX_next
-luaX_setinput
-luaX_syntaxerror
-luaX_token2str
-luaX_tokens
-luaY_parser
-luaZ_fill
-luaZ_init
-luaZ_read
-lua_absindex
-lua_arith
-lua_atpanic
-lua_callk
-lua_checkstack
-lua_close
-lua_compare
-lua_concat
-lua_copy
-lua_createtable
-lua_dump
-lua_error
-lua_gc
-lua_getallocf
-lua_getfield
-lua_getglobal
-lua_gethook
-lua_gethookcount
-lua_gethookmask
-lua_geti
-lua_getinfo
-lua_getlocal
-lua_getmetatable
-lua_getstack
-lua_gettable
-lua_gettop
-lua_getupvalue
-lua_getuservalue
-lua_ident
-lua_iscfunction
-lua_isinteger
-lua_isnumber
-lua_isstring
-lua_isuserdata
-lua_isyieldable
-lua_len
-lua_load
-lua_main
-lua_newstate
-lua_newthread
-lua_newuserdata
-lua_next
-lua_pcallk
-lua_pushboolean
-lua_pushcclosure
-lua_pushfstring
-lua_pushinteger
-lua_pushlightuserdata
-lua_pushlstring
-lua_pushnil
-lua_pushnumber
-lua_pushstring
-lua_pushthread
-lua_pushvalue
-lua_pushvfstring
-lua_rawequal
-lua_rawget
-lua_rawgeti
-lua_rawgetp
-lua_rawlen
-lua_rawset
-lua_rawseti
-lua_rawsetp
-lua_resume
-lua_rotate
-lua_setallocf
-lua_setfield
-lua_setglobal
-lua_sethook
-lua_seti
-lua_setlocal
-lua_setmetatable
-lua_settable
-lua_settop
-lua_setupvalue
-lua_setuservalue
-lua_status
-lua_stringtonumber
-lua_toboolean
-lua_tocfunction
-lua_tointegerx
-lua_tolstring
-lua_tonumberx
-lua_topointer
-lua_tothread
-lua_touserdata
-lua_type
-lua_typename
-lua_upvalueid
-lua_upvaluejoin
-lua_version
-lua_xmove
-lua_yieldk
-luai_ctype_
-luaopen_base
-luaopen_bit32
-luaopen_coroutine
-luaopen_debug
-luaopen_io
-luaopen_math
-luaopen_os
-luaopen_package
-luaopen_string
-luaopen_table
-luaopen_utf8
diff --git a/main.c b/main.c
new file mode 100644
index 0000000..4964b69
--- /dev/null
+++ b/main.c
@@ -0,0 +1,10 @@
+#include <stdio.h>
+
+/* Import user configuration: */
+#include <uk/config.h>
+
+int main(int argc, char *argv[])
+{
+  lua_main(argc, argv);
+  return 0;
+}
I think it will improve readability if we split this patch.

One for main function, one for PRECIOUS and one for deletion of exportsyms.uk.


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.