Rename core directory to "cfcore" for CPAN tarball
diff --git a/common/charmonizer.c b/common/charmonizer.c
index 3950751..3bcf930 100644
--- a/common/charmonizer.c
+++ b/common/charmonizer.c
@@ -8772,7 +8772,8 @@
lucy_MakeFile_new(chaz_CLI *cli) {
const char *dir_sep = chaz_OS_dir_sep();
const char *cfish_prefix = chaz_CLI_strval(cli, "clownfish-prefix");
-
+ char *cfcore_filename = chaz_Util_join(dir_sep, "cfcore", "Lucy.cfp",
+ NULL);
lucy_MakeFile *self = malloc(sizeof(lucy_MakeFile));
self->cli = cli;
@@ -8781,9 +8782,16 @@
self->test_lib = NULL;
/* Initialize directories. */
- 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, self->base_dir, "core", NULL);
+ self->test_dir = chaz_Util_join(dir_sep, self->base_dir, "test", NULL);
+ }
if (chaz_CLI_defined(cli, "enable-perl")) {
self->host_src_dir = "xs";
}
diff --git a/common/charmonizer.main b/common/charmonizer.main
index 591511e..f6bab2f 100644
--- a/common/charmonizer.main
+++ b/common/charmonizer.main
@@ -224,7 +224,8 @@
lucy_MakeFile_new(chaz_CLI *cli) {
const char *dir_sep = chaz_OS_dir_sep();
const char *cfish_prefix = chaz_CLI_strval(cli, "clownfish-prefix");
-
+ char *cfcore_filename = chaz_Util_join(dir_sep, "cfcore", "Lucy.cfp",
+ NULL);
lucy_MakeFile *self = malloc(sizeof(lucy_MakeFile));
self->cli = cli;
@@ -233,9 +234,16 @@
self->test_lib = NULL;
/* Initialize directories. */
- 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, self->base_dir, "core", NULL);
+ self->test_dir = chaz_Util_join(dir_sep, self->base_dir, "test", NULL);
+ }
if (chaz_CLI_defined(cli, "enable-perl")) {
self->host_src_dir = "xs";
}
diff --git a/perl/Build.PL b/perl/Build.PL
index 3f4ff07..a057f9b 100644
--- a/perl/Build.PL
+++ b/perl/Build.PL
@@ -20,15 +20,26 @@
use File::Spec::Functions qw( catdir );
use Lucy::Build;
-my @BASE_PATH = Lucy::Build->cf_base_path;
-my $MODULES_DIR = catdir( @BASE_PATH, 'modules' );
+my $IS_CPAN_DIST = -e 'cfcore';
+my @BASE_PATH = Lucy::Build->cf_base_path;
+my $CORE_SOURCE_DIR;
+my $TEST_SOURCE_DIR;
+my $MODULES_DIR;
+if ($IS_CPAN_DIST) {
+ $CORE_SOURCE_DIR = 'cfcore';
+ $TEST_SOURCE_DIR = 'cftest';
+ $MODULES_DIR = 'modules';
+}
+else {
+ $CORE_SOURCE_DIR = catdir( @BASE_PATH, 'core' );
+ $TEST_SOURCE_DIR = catdir( @BASE_PATH, 'test' );
+ $MODULES_DIR = catdir( @BASE_PATH, 'modules' );
+}
my $SNOWSTEM_SRC_DIR = catdir( $MODULES_DIR, qw( analysis snowstem source ) );
my $SNOWSTEM_INC_DIR = catdir( $SNOWSTEM_SRC_DIR, 'include' );
my $SNOWSTOP_SRC_DIR = catdir( $MODULES_DIR, qw( analysis snowstop source ) );
my $UCD_INC_DIR = catdir( $MODULES_DIR, qw( unicode ucd ) );
my $UTF8PROC_SRC_DIR = catdir( $MODULES_DIR, qw( unicode utf8proc ) );
-my $CORE_SOURCE_DIR = catdir( @BASE_PATH, 'core' );
-my $TEST_SOURCE_DIR = catdir( @BASE_PATH, 'test' );
my $XS_SOURCE_DIR = 'xs';
my @cf_linker_flags = Clownfish::CFC::Perl::Build->cf_linker_flags(
diff --git a/perl/buildlib/Lucy/Build.pm b/perl/buildlib/Lucy/Build.pm
index 7cb2392..f128145 100644
--- a/perl/buildlib/Lucy/Build.pm
+++ b/perl/buildlib/Lucy/Build.pm
@@ -291,7 +291,8 @@
# bunch of stuff. After the tarball is packaged up, we delete the copied
# directories.
my %to_copy = (
- '../core' => 'core',
+ '../core' => 'cfcore',
+ '../test' => 'cftest',
'../modules' => 'modules',
'../devel' => 'devel',
'../lemon' => 'lemon',