Adapt charmonizer for Go bindings. * Add "host" CLI arg. * Only build static lib when "static" Makefile target is run. * Select correct dir for host-specific C files.
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/b5bd3522 Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/b5bd3522 Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/b5bd3522 Branch: refs/heads/go_bindings_2 Commit: b5bd3522ae33c5398cbd734b96b1ff8064b24634 Parents: 8e24d26 Author: Marvin Humphrey <[email protected]> Authored: Sat Nov 29 20:53:43 2014 -0800 Committer: Marvin Humphrey <[email protected]> Committed: Sat Nov 29 21:07:53 2014 -0800 ---------------------------------------------------------------------- runtime/common/charmonizer.main | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/b5bd3522/runtime/common/charmonizer.main ---------------------------------------------------------------------- diff --git a/runtime/common/charmonizer.main b/runtime/common/charmonizer.main index 4c2bcd5..8d9b9d1 100644 --- a/runtime/common/charmonizer.main +++ b/runtime/common/charmonizer.main @@ -97,12 +97,17 @@ 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, "host", "specify host binding language", + CHAZ_CLI_ARG_REQUIRED); chaz_CLI_register(cli, "disable-threads", "whether to disable threads", CHAZ_CLI_NO_ARG); chaz_CLI_set_usage(cli, "Usage: charmonizer [OPTIONS] [-- [CFLAGS]]"); if (!chaz_Probe_parse_cli_args(argc, argv, cli)) { chaz_Probe_die_usage(); } + if (!chaz_CLI_defined(cli, "host")) { + chaz_CLI_set(cli, "host", "c"); + } chaz_Probe_init(cli); S_add_compiler_flags(cli); @@ -235,7 +240,16 @@ cfish_MakeFile_new(chaz_CLI *cli) { self->autogen_target = chaz_Util_join(dir_sep, "autogen", "hierarchy.json", NULL); - if (chaz_CLI_defined(cli, "enable-perl")) { + if (strcmp(chaz_CLI_strval(cli, "host"), "go") == 0) { + static const char *go_autogen_src_files[] = { + "cfish_parcel", + "testcfish_parcel", + NULL + }; + self->host_src_dir = "ext"; + self->autogen_src_files = go_autogen_src_files; + } + else if (chaz_CLI_defined(cli, "enable-perl")) { static const char *perl_autogen_src_files[] = { "boot", "callbacks", @@ -258,7 +272,7 @@ cfish_MakeFile_new(chaz_CLI *cli) { self->shared_lib = chaz_Lib_new("cfish", chaz_Lib_SHARED, cfish_version, cfish_major_version); - self->static_lib = chaz_Lib_new("cfish", chaz_Lib_STATIC, cfish_version, + self->static_lib = chaz_Lib_new("clownfish", chaz_Lib_STATIC, cfish_version, cfish_major_version); self->shared_lib_filename = chaz_Lib_filename(self->shared_lib); self->static_lib_filename = chaz_Lib_filename(self->static_lib); @@ -350,12 +364,10 @@ cfish_MakeFile_write(cfish_MakeFile *self) { /* Rules */ - scratch = chaz_Util_join(" ", self->shared_lib_filename, - self->static_lib_filename, NULL); - chaz_MakeFile_add_rule(self->makefile, "all", scratch); - free(scratch); + chaz_MakeFile_add_rule(self->makefile, "all", self->shared_lib_filename); + chaz_MakeFile_add_rule(self->makefile, "static", self->static_lib_filename); - if (!chaz_CLI_defined(self->cli, "enable-perl")) { + if (strcmp(chaz_CLI_strval(self->cli, "host"), "c") == 0) { cfish_MakeFile_write_c_cfc_rules(self); }
