Fix Makefile paths for Perl CPAN build
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/a45abf04 Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/a45abf04 Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/a45abf04 Branch: refs/heads/master Commit: a45abf04a63b7a9d0a2fc40af79216d8778d4d84 Parents: 3764180 Author: Nick Wellnhofer <[email protected]> Authored: Fri Jul 8 13:57:47 2016 +0200 Committer: Nick Wellnhofer <[email protected]> Committed: Fri Jul 8 14:37:20 2016 +0200 ---------------------------------------------------------------------- runtime/common/charmonizer.c | 19 ++++++++++++++----- runtime/common/charmonizer.main | 19 ++++++++++++++----- 2 files changed, 28 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/a45abf04/runtime/common/charmonizer.c ---------------------------------------------------------------------- diff --git a/runtime/common/charmonizer.c b/runtime/common/charmonizer.c index 102970e..27753cc 100644 --- a/runtime/common/charmonizer.c +++ b/runtime/common/charmonizer.c @@ -8801,7 +8801,8 @@ S_link_flags(chaz_CLI *cli) { static cfish_MakeFile* cfish_MakeFile_new(chaz_CLI *cli) { const char *dir_sep = chaz_OS_dir_sep(); - + char *cfcore_filename = chaz_Util_join(dir_sep, "cfcore", "Clownfish.cfp", + NULL); cfish_MakeFile *self = malloc(sizeof(cfish_MakeFile)); self->makefile = chaz_MakeFile_new(); @@ -8810,10 +8811,17 @@ cfish_MakeFile_new(chaz_CLI *cli) { self->cfh_var = NULL; self->cli = cli; - /* TODO: Detect base directory. */ - self->base_dir = ".."; - self->core_dir = chaz_Util_join(dir_sep, self->base_dir, "core", NULL); - self->test_dir = chaz_Util_join(dir_sep, self->base_dir, "test", NULL); + if (chaz_Util_can_open_file(cfcore_filename)) { + self->base_dir = "."; + self->core_dir = chaz_Util_strdup("cfcore"); + self->test_dir = chaz_Util_strdup("cftest"); + } + else { + self->base_dir = ".."; + self->core_dir = chaz_Util_join(dir_sep, "..", "core", NULL); + self->test_dir = chaz_Util_join(dir_sep, "..", "test", NULL); + } + self->autogen_src_dir = chaz_Util_join(dir_sep, "autogen", "source", NULL); self->autogen_inc_dir = chaz_Util_join(dir_sep, "autogen", "include", NULL); @@ -8835,6 +8843,7 @@ cfish_MakeFile_new(chaz_CLI *cli) { self->host_src_dir = NULL; } + free(cfcore_filename); return self; } http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/a45abf04/runtime/common/charmonizer.main ---------------------------------------------------------------------- diff --git a/runtime/common/charmonizer.main b/runtime/common/charmonizer.main index fc68fd4..681d263 100644 --- a/runtime/common/charmonizer.main +++ b/runtime/common/charmonizer.main @@ -253,7 +253,8 @@ S_link_flags(chaz_CLI *cli) { static cfish_MakeFile* cfish_MakeFile_new(chaz_CLI *cli) { const char *dir_sep = chaz_OS_dir_sep(); - + char *cfcore_filename = chaz_Util_join(dir_sep, "cfcore", "Clownfish.cfp", + NULL); cfish_MakeFile *self = malloc(sizeof(cfish_MakeFile)); self->makefile = chaz_MakeFile_new(); @@ -262,10 +263,17 @@ cfish_MakeFile_new(chaz_CLI *cli) { self->cfh_var = NULL; self->cli = cli; - /* TODO: Detect base directory. */ - self->base_dir = ".."; - self->core_dir = chaz_Util_join(dir_sep, self->base_dir, "core", NULL); - self->test_dir = chaz_Util_join(dir_sep, self->base_dir, "test", NULL); + if (chaz_Util_can_open_file(cfcore_filename)) { + self->base_dir = "."; + self->core_dir = chaz_Util_strdup("cfcore"); + self->test_dir = chaz_Util_strdup("cftest"); + } + else { + self->base_dir = ".."; + self->core_dir = chaz_Util_join(dir_sep, "..", "core", NULL); + self->test_dir = chaz_Util_join(dir_sep, "..", "test", NULL); + } + self->autogen_src_dir = chaz_Util_join(dir_sep, "autogen", "source", NULL); self->autogen_inc_dir = chaz_Util_join(dir_sep, "autogen", "include", NULL); @@ -287,6 +295,7 @@ cfish_MakeFile_new(chaz_CLI *cli) { self->host_src_dir = NULL; } + free(cfcore_filename); return self; }
