You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2014/11/05 18:28:43 UTC
[2/3] git commit: refs/heads/master - Use chaz_CLI for
--clownfish-prefix option
Use chaz_CLI for --clownfish-prefix option
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/8d0b1c5c
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/8d0b1c5c
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/8d0b1c5c
Branch: refs/heads/master
Commit: 8d0b1c5c6f80673405542a81844af3726a718991
Parents: 40ab329
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Wed Nov 5 18:24:59 2014 +0100
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Wed Nov 5 18:24:59 2014 +0100
----------------------------------------------------------------------
common/charmonizer.main | 34 ++++++++++------------------------
1 file changed, 10 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/8d0b1c5c/common/charmonizer.main
----------------------------------------------------------------------
diff --git a/common/charmonizer.main b/common/charmonizer.main
index 25c3fe4..2685189 100644
--- a/common/charmonizer.main
+++ b/common/charmonizer.main
@@ -37,10 +37,6 @@
#include "Charmonizer/Core/ConfWriterPerl.h"
#include "Charmonizer/Core/ConfWriterRuby.h"
-struct lucy_CLIArgs {
- const char *clownfish_prefix;
-};
-
typedef struct SourceFileContext {
chaz_MakeVar *var;
} SourceFileContext;
@@ -136,7 +132,7 @@ S_cfh_file_callback(const char *dir, char *file, void *context) {
}
static void
-S_write_makefile(chaz_CLI *cli, struct lucy_CLIArgs *lucy_args) {
+S_write_makefile(chaz_CLI *cli) {
SourceFileContext sfc;
const char *base_dir = "..";
@@ -144,7 +140,7 @@ S_write_makefile(chaz_CLI *cli, struct lucy_CLIArgs *lucy_args) {
const char *exe_ext = chaz_OS_exe_ext();
const char *obj_ext = chaz_CC_obj_ext();
const char *math_lib = chaz_Floats_math_library();
- const char *cfish_prefix = lucy_args->clownfish_prefix;
+ const char *cfish_prefix = chaz_CLI_strval(cli, "clownfish-prefix");
char *core_dir = chaz_Util_join(dir_sep, base_dir, "core", NULL);
char *lemon_dir = chaz_Util_join(dir_sep, base_dir, "lemon", NULL);
@@ -445,25 +441,15 @@ int main(int argc, const char **argv) {
/* Initialize. */
chaz_CLI *cli
= chaz_CLI_new(argv[0], "charmonizer: Probe C build environment");
+ chaz_CLI_register(cli, "clownfish-prefix",
+ "prefix of Clownfish installation",
+ CHAZ_CLI_ARG_OPTIONAL);
chaz_CLI_set_usage(cli, "Usage: charmonizer [OPTIONS] [-- [CFLAGS]]");
- struct lucy_CLIArgs lucy_args = { NULL };
- {
- int result = chaz_Probe_parse_cli_args(argc, argv, cli);
- if (!result) {
- chaz_Probe_die_usage();
- }
- chaz_Probe_init(cli);
- S_add_compiler_flags(cli);
- }
- {
- int i;
- for (i = 0; i < argc; i++) {
- const char *arg = argv[i];
- if (memcmp(arg, "--clownfish-prefix=", 19) == 0) {
- lucy_args.clownfish_prefix = arg + 19;
- }
- }
+ if (!chaz_Probe_parse_cli_args(argc, argv, cli)) {
+ chaz_Probe_die_usage();
}
+ chaz_Probe_init(cli);
+ S_add_compiler_flags(cli);
/* Employ integer features but don't define stdint types in charmony.h. */
chaz_ConfWriter_append_conf(
@@ -512,7 +498,7 @@ int main(int argc, const char **argv) {
);
if (chaz_CLI_defined(cli, "enable-makefile")) {
- S_write_makefile(cli, &lucy_args);
+ S_write_makefile(cli);
}
/* Clean up. */