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

Re: [Minios-devel] [UNIKRAFT/LIBLUA PATCH 4/5] Add optional main()



Reviewed-by: Roxana Nicolescu <nicolescu.roxana1996@xxxxxxxxx>

On 15.10.2019 17:37, Roxana Nicolescu wrote:
Hi Felipe,

I run checkpatch.pl on your patch and it has some warnings. Can you fix them on upstream?

Roxana

On 15.10.2019 16:26, Felipe Huici wrote:
We add a menu option to provide a main() function, and set it to on by
default so that in the standard case a user can choose a platform,
compile and run.

Signed-off-by: Felipe Huici <felipe.huici@xxxxxxxxx>
---
  Config.uk   |  6 ++++++
  Makefile.uk | 19 ++++++++++++++++---
  main.c      | 10 ++++++++++
  3 files changed, 32 insertions(+), 3 deletions(-)
  create mode 100644 main.c

diff --git a/Config.uk b/Config.uk
index f489c0d..891b437 100644
--- a/Config.uk
+++ b/Config.uk
@@ -4,3 +4,9 @@ config LIBLUA
          select LIBNEWLIBC
          select LIBUKTIME
          select UKUNISTD
+
+if LIBLUA
+   config LIBLUA_MAIN_FUNCTION
+       bool "Provide main function"
+       default y
+endif
diff --git a/Makefile.uk b/Makefile.uk
index 6768de3..9251ff2 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -32,11 +32,24 @@ CXXINCLUDES-$(CONFIG_LIBLUA) += -I$(LIBLUA_BUILD)/include
  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
@@ -78,7 +91,7 @@ LIBLUA_SRCS-y += $(LIBLUA_SRCS_BASE)/linit.c
################################################################################
-# libray API headers
+# Libray API headers
################################################################################
  $(LIBLUA_SRCS_BASE)/%.h: $(LIBLUA_BUILD)/.origin
      @# empty recipe to enforce dependency to archive extraction
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;
+}

_______________________________________________
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®.