Skip to content
This repository has been archived by the owner on Oct 5, 2024. It is now read-only.

Commit

Permalink
fix: Make the etc directory configurable so it installs without being…
Browse files Browse the repository at this point in the history
… root
  • Loading branch information
robsavoye committed Mar 29, 2024
1 parent 8dbdde5 commit 751b237
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ AM_CXXFLAGS = \
-fno-builtin-malloc \
-fno-builtin-calloc \
-fno-builtin-realloc \
-fno-builtin-free \
-DETCDIR=$(ETCDIR)
-fno-builtin-free
else
AM_CXXFLAGS = \
-rdynamic \
Expand All @@ -104,6 +103,7 @@ endif
AM_CPPFLAGS = \
-DPKGLIBDIR=\"$(pkglibdir)\" \
-DSRCDIR=\"$(srcdir)\" \
-DETCDIR=\"$(ETCDIR)\" \
-DBOOST_LOCALE_HIDE_AUTO_PTR
# Optionally timing can be turned on, which produces volumes of output which adds too much
# clutter to the output. This should only be enabled when doing performance tuning.
Expand Down
3 changes: 2 additions & 1 deletion src/replicator/planetreplicator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ PlanetReplicator::PlanetReplicator(void) {};
std::shared_ptr<RemoteURL> PlanetReplicator::findRemotePath(const underpassconfig::UnderpassConfig &config, ptime time) {
yaml::Yaml yaml;

std::string rep_file = "ETCDIR/replicator/planetreplicator.yaml";
std::string rep_file = ETCDIR;
rep_file += "replicator/planetreplicator.yaml";
yaml.read(rep_file);
std::map<int, ptime> hashes;

Expand Down
3 changes: 2 additions & 1 deletion src/stats/statsconfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ namespace statsconfig {

StatsConfig::StatsConfig() {
if (path.empty()) {
path = "ETCDIR/stats/statistics.yaml";
path = ETCDIR;
path += "/stats/statistics.yaml";
if (!boost::filesystem::exists(path)) {
throw std::runtime_error("Statistics file not found: " + path);
}
Expand Down
3 changes: 3 additions & 0 deletions src/testsuite/libunderpass.all/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

AUTOMAKE_OPTIONS = dejagnu

ETCDIR = $(subst lib,etc,$(pkglibdir))

check_PROGRAMS = \
pq-test \
change-test \
Expand Down Expand Up @@ -55,6 +57,7 @@ AM_CXXFLAGS = \
-DPKGLIBDIR=\"$(pkglibdir)\" \
-DTOPSRCDIR=\"$(TOPSRC)\" \
-DSRCDIR=\"$(srcdir)\" \
-DETCDIR=\"$(ETCDIR)\" \
-DBOOST_LOCALE_HIDE_AUTO_PTR \
-Wno-deprecated-declarations

Expand Down
4 changes: 3 additions & 1 deletion src/testsuite/libunderpass.all/geo-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ main(int argc, char* argv[])
return 1;
}

if (tgu.readFile("ETCDIR/priority.geojson")) {
std::string filespec = ETCDIR;
filespec += "/priority.geojson";
if (tgu.readFile(filespec)) {
runtest.pass("Read file with absolute path");
} else {
runtest.fail("Read file with absolute path");
Expand Down
3 changes: 2 additions & 1 deletion src/underpass.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ main(int argc, char *argv[])
{

std::string datadir = "replication/";
std::string boundary = "ETCDIR/priority.geojson";
std::string boundary = ETCDIR;
boundary += "/priority.geojson";

UnderpassConfig config;

Expand Down

0 comments on commit 751b237

Please sign in to comment.