lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject [1/2] git commit: refs/heads/chaz_generic_cli - Adapt for Charmonizer CLI changes.
Date Wed, 15 Oct 2014 02:28:55 GMT
Repository: lucy
Updated Branches:
  refs/heads/chaz_generic_cli [created] 40b170679


Adapt for Charmonizer CLI changes.


Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/19522ad9
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/19522ad9
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/19522ad9

Branch: refs/heads/chaz_generic_cli
Commit: 19522ad9d11669361a635a6b097b46a752c3a378
Parents: 6e1fe3a
Author: Marvin Humphrey <marvin@rectangular.com>
Authored: Thu Oct 9 18:19:15 2014 -0700
Committer: Marvin Humphrey <marvin@rectangular.com>
Committed: Tue Oct 14 19:24:08 2014 -0700

----------------------------------------------------------------------
 common/charmonizer.main | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/19522ad9/common/charmonizer.main
----------------------------------------------------------------------
diff --git a/common/charmonizer.main b/common/charmonizer.main
index c12b3c4..78da384 100644
--- a/common/charmonizer.main
+++ b/common/charmonizer.main
@@ -49,7 +49,7 @@ static const char lucy_version[]        = "0.4.0";
 static const char lucy_major_version[]  = "0.4";
 
 static void
-S_add_compiler_flags(struct chaz_CLIArgs *args) {
+S_add_compiler_flags(struct chaz_CLI *cli) {
     chaz_CFlags *extra_cflags = chaz_CC_get_extra_cflags();
 
     if (chaz_Probe_gcc_version_num()) {
@@ -60,7 +60,7 @@ S_add_compiler_flags(struct chaz_CLIArgs *args) {
         else if (getenv("LUCY_DEBUG")) {
             chaz_CFlags_append(extra_cflags,
                 "-DLUCY_DEBUG -pedantic -Wall -Wextra -Wno-variadic-macros");
-            if (args->charmony_pm) {
+            if (chaz_CLI_defined(cli, "enable-perl")) {
                 chaz_CFlags_append(extra_cflags, "-DPERL_GCC_PEDANTIC");
             }
         }
@@ -136,8 +136,7 @@ S_cfh_file_callback(const char *dir, char *file, void *context) {
 }
 
 static void
-S_write_makefile(struct chaz_CLIArgs *chaz_args,
-                 struct lucy_CLIArgs *lucy_args) {
+S_write_makefile(chaz_CLI *cli, struct lucy_CLIArgs *lucy_args) {
     SourceFileContext sfc;
 
     const char *base_dir     = "..";
@@ -208,7 +207,7 @@ S_write_makefile(struct chaz_CLIArgs *chaz_args,
     chaz_CFlags_enable_debugging(makefile_cflags);
     chaz_CFlags_disable_strict_aliasing(makefile_cflags);
     chaz_CFlags_compile_shared_library(makefile_cflags);
-    if (chaz_args->code_coverage) {
+    if (chaz_CLI_defined(cli, "enable-coverage")) {
         chaz_CFlags_enable_code_coverage(makefile_cflags);
     }
 
@@ -331,7 +330,7 @@ S_write_makefile(struct chaz_CLIArgs *chaz_args,
     if (chaz_HeadCheck_check_header("pcre.h")) {
         chaz_CFlags_add_external_library(link_flags, "pcre");
     }
-    if (chaz_args->code_coverage) {
+    if (chaz_CLI_defined(cli, "enable-coverage")) {
         chaz_CFlags_enable_code_coverage(link_flags);
     }
     rule = chaz_MakeFile_add_shared_lib(makefile, shared_lib, "$(LUCY_OBJS)",
@@ -372,7 +371,7 @@ S_write_makefile(struct chaz_CLIArgs *chaz_args,
     }
     chaz_MakeRule_add_command(rule, test_command);
 
-    if (chaz_args->code_coverage) {
+    if (chaz_CLI_defined(cli, "enable-coverage")) {
         rule = chaz_MakeFile_add_rule(makefile, "coverage", test_lucy_exe);
         chaz_MakeRule_add_command(rule,
                                   "lcov"
@@ -412,7 +411,7 @@ S_write_makefile(struct chaz_CLIArgs *chaz_args,
 
     chaz_MakeRule_add_recursive_rm_command(clean_rule, "autogen");
 
-    if (chaz_args->code_coverage) {
+    if (chaz_CLI_defined(cli, "enable-coverage")) {
         chaz_MakeRule_add_rm_command(clean_rule, "lucy.info");
         chaz_MakeRule_add_recursive_rm_command(clean_rule, "coverage");
     }
@@ -444,15 +443,17 @@ S_write_makefile(struct chaz_CLIArgs *chaz_args,
 
 int main(int argc, const char **argv) {
     /* Initialize. */
-    struct chaz_CLIArgs chaz_args;
+    chaz_CLI *cli
+        = chaz_CLI_new(argv[0], "charmonizer: Probe C build environment");
+    chaz_CLI_set_usage(cli, "Usage: charmonizer [OPTIONS] [-- [CFLAGS]]");
     struct lucy_CLIArgs lucy_args = { NULL };
     {
-        int result = chaz_Probe_parse_cli_args(argc, argv, &chaz_args);
+        int result = chaz_Probe_parse_cli_args(argc, argv, cli);
         if (!result) {
             chaz_Probe_die_usage();
         }
-        chaz_Probe_init(&chaz_args);
-        S_add_compiler_flags(&chaz_args);
+        chaz_Probe_init(cli);
+        S_add_compiler_flags(cli);
     }
     {
         int i;
@@ -515,11 +516,12 @@ int main(int argc, const char **argv) {
         "#endif\n\n"
     );
 
-    if (chaz_args.write_makefile) {
-        S_write_makefile(&chaz_args, &lucy_args);
+    if (chaz_CLI_defined(cli, "enable-makefile")) {
+        S_write_makefile(cli, &lucy_args);
     }
 
     /* Clean up. */
+    chaz_CLI_destroy(cli);
     chaz_Probe_clean_up();
 
     return 0;


Mime
View raw message