This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch efl
in repository laugh.

View the commit online.

commit e9564ca646a8d48c8fa0cd8c03e5f3a2d680dd18
Author: melerva <[email protected]>
AuthorDate: Wed Sep 17 21:00:44 2025 -0400

    Started adding EFL Core
    
    Also silenced meson warning by renaming meson.options
---
 meson.build                        | 11 ++++++++++
 meson.options => meson_options.txt |  0
 src/main.c                         | 45 ++++++++++++++++++++++++++------------
 3 files changed, 42 insertions(+), 14 deletions(-)

diff --git a/meson.build b/meson.build
index 58aa9e3..d92448b 100644
--- a/meson.build
+++ b/meson.build
@@ -2,11 +2,17 @@ project('laugh', 'c')
 
 lua_dep = dependency('lua-5.4', required: true)
 physfs_dep = dependency('physfs', required: true)
+efl_core_dep = dependency('efl-core', required: get_option('use_efl'))
+efl_net_dep = dependency('efl-net', required: get_option('use_efl'))
+efl_ui_dep = dependency('efl-ui', required: get_option('use_efl'))
 
 add_project_dependencies(
   [
     lua_dep,
     physfs_dep,
+    efl_core_dep,
+    efl_net_dep,
+    efl_ui_dep,
   ],
   language: 'c',
 )
@@ -16,6 +22,11 @@ conf.set('LAUGH_VERSION_MAJOR', 0)
 conf.set('LAUGH_VERSION_MINOR', 0)
 conf.set('LAUGH_VERSION_PATCH', 0)
 
+conf.set('EFL_BETA_API_SUPPORT', 1)
+conf.set('LAUGH_USE_EFL_CORE', efl_core_dep.found())
+conf.set('LAUGH_USE_EFL_NET', efl_net_dep.found())
+conf.set('LAUGH_USE_EFL_UI', efl_ui_dep.found())
+
 laugh_sources = [
   'src/main.c',
   'src/modules/laugh.c',
diff --git a/meson.options b/meson_options.txt
similarity index 100%
rename from meson.options
rename to meson_options.txt
diff --git a/src/main.c b/src/main.c
index 60822ab..946825c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -11,6 +11,10 @@
 #include <stdlib.h>
 #include <string.h>
 
+#ifdef LAUGH_USE_EFL_CORE
+#  include <Efl_Core.h>
+#endif // LAUGH_USE_EFL_CORE
+
 extern int laugh_loadfile(lua_State *const L);
 extern void init_preloaders(lua_State *const L);
 extern void init_physfs_loader(lua_State *const L);
@@ -71,18 +75,27 @@ static bool check_bundled(
   return bundled;
 }
 
+#ifdef LAUGH_USE_EFL_CORE
+EAPI_MAIN void efl_main(void *data EINA_UNUSED, const Efl_Event *const ev) {
+#  define getargv(n) (char*)eina_array_data_get(((Efl_Loop_Arguments*)ev->info)->argv, n)
+#  define mainret(status) efl_exit(status)
+  const int argc = eina_array_count(((Efl_Loop_Arguments*)ev->info)->argv);
+#else // LAUGH_USE_EFL_CORE
+#  define getargv(n) argv[n]
+#  define mainret(status) return status
 int main(const int argc, char *const argv[]) {
-  if (!PHYSFS_init(argv[0])) {
+#endif // LAUGH_USE_EFL_CORE
+  if (!PHYSFS_init(getargv(0))) {
     fprintf(stderr, "physfs init failed: %s",
         PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
-    return EXIT_FAILURE;
+    mainret(EXIT_FAILURE);
   }
   atexit(deinit_physfs);
   PHYSFS_permitSymbolicLinks(true);
 
   unsigned int app_args_start = 0;
 
-  if (!check_bundled(PHYSFS_getBaseDir(), basename(argv[0]))) {
+  if (!check_bundled(PHYSFS_getBaseDir(), basename(getargv(0)))) {
     char *app_name = NULL;
 
     if (argc > 1) {
@@ -90,33 +103,33 @@ int main(const int argc, char *const argv[]) {
 
       for (unsigned int i = 1; i < argc; i++) {
         if (!skip_opts) {
-          if (!strcmp(argv[i], "--help")) {
-            display_help(stdout, argv[0]);
-            return EXIT_SUCCESS;
+          if (!strcmp(getargv(i), "--help")) {
+            display_help(stdout, getargv(0));
+            mainret(EXIT_SUCCESS);
           }
 
-          if (!strcmp(argv[i], "--")) {
+          if (!strcmp(getargv(i), "--")) {
             skip_opts = true;
             continue;
           }
         }
 
-        app_name = argv[i];
+        app_name = getargv(i);
         app_args_start = i;
         break;
       }
     }
 
     if (app_name == NULL) {
-      display_help(stderr, argv[0]);
-      return EXIT_FAILURE;
+      display_help(stderr, getargv(0));
+      mainret(EXIT_FAILURE);
     }
 
     if (!PHYSFS_mount(app_name, "/", 0)) {
       fprintf(stderr, "%s: error running \"%s\": %s\n",
-          argv[0], app_name,
+          getargv(0), app_name,
           PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()));
-      return EXIT_FAILURE;
+      mainret(EXIT_FAILURE);
     }
   }
 
@@ -137,7 +150,7 @@ int main(const int argc, char *const argv[]) {
   /* load arguments into a global 'arg' table */
   lua_newtable(L);
   for (int i = app_args_start; i < argc; i++) {
-    lua_pushstring(L, argv[i]);
+    lua_pushstring(L, getargv(i));
     lua_rawseti(L, -2, i - app_args_start);
   }
   lua_setglobal(L, "arg");
@@ -183,7 +196,11 @@ int main(const int argc, char *const argv[]) {
       }
 
       lua_close(L);
-      return ret;
+      mainret(ret);
     }
   }
 }
+
+#ifdef LAUGH_USE_EFL_CORE
+EFL_MAIN() // the real main function
+#endif // LAUGH_USE_EFL_CORE

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to