q66 pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=2f81b2636775ce5fdd0cf9d76595e751da3930d9

commit 2f81b2636775ce5fdd0cf9d76595e751da3930d9
Author: Daniel Kolesa <[email protected]>
Date:   Tue Nov 14 13:42:38 2017 +0100

    eolian: scan system dir by default
    
    The '-S' option lets you reverse that. But by default, most
    people will want the prefix to be scanned for eo files.
---
 pc/eo.pc.in                          |  2 +-
 src/Makefile.am                      |  1 +
 src/Makefile_Eolian_Files_Helper.am  |  8 +++----
 src/bin/eolian/main.c                | 46 ++++++++++++++++++++++++++++--------
 src/examples/eolian_cxx/Makefile.am  |  4 ++--
 src/tests/eolian/eolian_generation.c |  2 +-
 6 files changed, 45 insertions(+), 18 deletions(-)

diff --git a/pc/eo.pc.in b/pc/eo.pc.in
index 998bf2347a..2547193fc5 100644
--- a/pc/eo.pc.in
+++ b/pc/eo.pc.in
@@ -5,7 +5,7 @@ includedir=@includedir@
 datarootdir=@datarootdir@
 datadir=@datadir@
 eoincludedir=@datadir@/eolian/include
-eolian_flags=-I${pc_sysrootdir}${eoincludedir}/eo-@VMAJ@
+eolian_flags=-S -I${pc_sysrootdir}${eoincludedir}/eo-@VMAJ@
 
 Name: Eo
 Description: EFL's generic object system library.
diff --git a/src/Makefile.am b/src/Makefile.am
index c6969786bb..2651fd89ab 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -4,6 +4,7 @@ CLEANFILES =
 BUILT_SOURCES =
 
 EOLIAN_FLAGS = -I$(srcdir)
+EOLIAN_GEN_FLAGS = -S
 
 DIST_SUBDIRS =
 SUBDIRS =
diff --git a/src/Makefile_Eolian_Files_Helper.am 
b/src/Makefile_Eolian_Files_Helper.am
index bf14567554..463433c6ff 100644
--- a/src/Makefile_Eolian_Files_Helper.am
+++ b/src/Makefile_Eolian_Files_Helper.am
@@ -8,19 +8,19 @@ SUFFIXES = .eo .eo.c .eo.h .eo.legacy.h .eot .eot.h
 %.eo.c: %.eo ${_EOLIAN_GEN_DEP}
        $(AM_V_EOL) \
        $(MKDIR_P) $(dir $@); \
-       $(EOLIAN_GEN) $(EOLIAN_FLAGS) -gc -o c:$@ $<
+       $(EOLIAN_GEN) $(EOLIAN_FLAGS) $(EOLIAN_GEN_FLAGS) -gc -o c:$@ $<
 
 %.eo.h: %.eo ${_EOLIAN_GEN_DEP}
        $(AM_V_EOL) \
        $(MKDIR_P) $(dir $@); \
-       $(EOLIAN_GEN) $(EOLIAN_FLAGS) -gh -o h:$@ $<
+       $(EOLIAN_GEN) $(EOLIAN_FLAGS) $(EOLIAN_GEN_FLAGS) -gh -o h:$@ $<
 
 %.eot.h: %.eot ${_EOLIAN_GEN_DEP}
        $(AM_V_EOL) \
        $(MKDIR_P) $(dir $@); \
-       $(EOLIAN_GEN) $(EOLIAN_FLAGS) -gh -o h:$@ $<
+       $(EOLIAN_GEN) $(EOLIAN_FLAGS) $(EOLIAN_GEN_FLAGS) -gh -o h:$@ $<
 
 %.eo.legacy.h: %.eo ${_EOLIAN_GEN_DEP}
        $(AM_V_EOL) \
        $(MKDIR_P) $(dir $@); \
-       $(EOLIAN_GEN) $(EOLIAN_FLAGS) -gl -o l:$@ $<
+       $(EOLIAN_GEN) $(EOLIAN_FLAGS) $(EOLIAN_GEN_FLAGS) -gl -o l:$@ $<
diff --git a/src/bin/eolian/main.c b/src/bin/eolian/main.c
index 65ee41c5ba..fdb5ca2568 100644
--- a/src/bin/eolian/main.c
+++ b/src/bin/eolian/main.c
@@ -37,6 +37,7 @@ _print_usage(const char *progn, FILE *outf)
    fprintf(outf, "Usage: %s [options] [input]\n", progn);
    fprintf(outf, "Options:\n"
                  "  -I inc        include path \"inc\"\n"
+                 "  -S            do not scan system dir for eo files\n"
                  "  -g type       generate file of type \"type\"\n"
                  "  -o name       specify the base name for output\n"
                  "  -o type:name  specify a particular output filename\n"
@@ -50,7 +51,9 @@ _print_usage(const char *progn, FILE *outf)
                  "  c: C source file (.eo.c)\n"
                  "  i: Implementation file (.c, merged with existing)\n"
                  "\n"
-                 "By default, the 'hc' set is used ('h' for .eot files).\n"
+                 "By default, the 'hc' set is used ('h' for .eot files).\n\n"
+                 "The system-wide Eolian directory is scanned for eo files\n"
+                 "by default, together with all specified '-I' flags.\n\n"
                  "Output filenames are determined from input .eo filename.\n"
                  "Default output path is where the input file is.\n\n"
                  "Also, specifying a type-dependent input file automatically\n"
@@ -420,6 +423,10 @@ main(int argc, char **argv)
 {
    int pret = 1;
 
+   char *outs[5] = { NULL, NULL, NULL, NULL, NULL };
+   char *basen = NULL;
+   Eina_List *includes = NULL;
+
    eina_init();
    eolian_init();
 
@@ -433,21 +440,20 @@ main(int argc, char **argv)
 
    eina_log_timing(_eolian_gen_log_dom, EINA_LOG_STATE_STOP, 
EINA_LOG_STATE_INIT);
 
-   char *outs[5] = { NULL, NULL, NULL, NULL, NULL };
-   char *basen = NULL;
-
    int gen_what = 0;
-   for (int opt; (opt = getopt(argc, argv, "I:g:o:hv")) != -1;)
+   Eina_Bool scan_system = EINA_TRUE;
+
+   for (int opt; (opt = getopt(argc, argv, "SI:g:o:hv")) != -1;)
      switch (opt)
        {
         case 0:
           break;
+        case 'S':
+          scan_system = EINA_FALSE;
+          break;
         case 'I':
-          if (!eolian_directory_scan(optarg))
-            {
-               fprintf(stderr, "eolian: could not scan '%s'\n", optarg);
-               goto end;
-            }
+          /* just a pointer to argv contents, so it persists */
+          includes = eina_list_append(includes, optarg);
           break;
         case 'g':
           for (const char *wstr = optarg; *wstr; ++wstr)
@@ -522,6 +528,25 @@ main(int argc, char **argv)
         goto end;
      }
 
+   if (scan_system)
+     {
+        if (!eolian_system_directory_scan())
+          {
+             fprintf(stderr, "eolian: could not scan system directory\n");
+             goto end;
+          }
+     }
+
+   const char *inc;
+   EINA_LIST_FREE(includes, inc)
+     {
+        if (!eolian_directory_scan(inc))
+          {
+             fprintf(stderr, "eolian: could not scan '%s'\n", inc);
+             goto end;
+          }
+     }
+
    const Eolian_Unit *src = eolian_file_parse(input);
    if (!src)
      {
@@ -559,6 +584,7 @@ end:
         eina_log_domain_unregister(_eolian_gen_log_dom);
      }
 
+   eina_list_free(includes);
    for (size_t i = 0; i < (sizeof(_dexts) / sizeof(char *)); ++i)
      free(outs[i]);
    free(basen);
diff --git a/src/examples/eolian_cxx/Makefile.am 
b/src/examples/eolian_cxx/Makefile.am
index ece53188d0..df5a370b19 100644
--- a/src/examples/eolian_cxx/Makefile.am
+++ b/src/examples/eolian_cxx/Makefile.am
@@ -138,10 +138,10 @@ eolian_cxx_callbacks_01_SOURCES = 
eolian_cxx_callbacks_01.cc
        true $<
 
 %.eo.c: %.eo
-       $(AM_V_EOL)$(EOLIAN_GEN) $(EOLIAN_FLAGS) -gc -o c:$@ $<
+       $(AM_V_EOL)$(EOLIAN_GEN) $(EOLIAN_FLAGS) $(EOLIAN_GEN_FLAGS) -gc -o 
c:$@ $<
 
 %.eo.h: %.eo
-       $(AM_V_EOL)$(EOLIAN_GEN) $(EOLIAN_FLAGS) -gh -o h:$@ $<
+       $(AM_V_EOL)$(EOLIAN_GEN) $(EOLIAN_FLAGS) $(EOLIAN_GEN_FLAGS) -gh -o 
h:$@ $<
 
 examples: $(ECXX_EXAMPLE_EOS) $(GENERATED) $(EXTRA_PROGRAMS)
 
diff --git a/src/tests/eolian/eolian_generation.c 
b/src/tests/eolian/eolian_generation.c
index c339b2911f..eb9f7d3973 100644
--- a/src/tests/eolian/eolian_generation.c
+++ b/src/tests/eolian/eolian_generation.c
@@ -85,7 +85,7 @@ _eolian_gen_execute(const char *eo_filename, const char 
*options, const char *ou
 {
    char command[PATH_MAX];
    snprintf(command, PATH_MAX,
-         EOLIAN_GEN" %s -I \""PACKAGE_DATA_DIR"/data\" -o %s %s",
+         EOLIAN_GEN" %s -S -I \""PACKAGE_DATA_DIR"/data\" -o %s %s",
          options, output_filename, eo_filename);
    return system(command);
 }

-- 


Reply via email to