From 5e989b9296eca989acde165a4ff4b29e20cf5dfd Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Mon, 4 Jan 2021 11:37:56 +0100 Subject: [PATCH] configure osm2pgsql and module location via cmake The default location of osm2pgsql and the postgresql module is decided at compile/installation time and is not necessarily in the project directory. With this change it is now possible to have a project directory that is completely separate from the build directory. --- cmake/script.tmpl | 2 ++ lib/setup/SetupClass.php | 5 +---- lib/setup_functions.php | 7 +------ 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/cmake/script.tmpl b/cmake/script.tmpl index 4d9224b0..5b7bc6f7 100755 --- a/cmake/script.tmpl +++ b/cmake/script.tmpl @@ -1,5 +1,7 @@ #!@PHP_BIN@ -Cq iCacheMemory = getCacheMemoryMB(); } - $this->sModulePath = getSetting('DATABASE_MODULE_PATH', CONST_InstallDir.'/module'); + $this->sModulePath = getSetting('DATABASE_MODULE_PATH', CONST_Default_ModulePath); info('module path: ' . $this->sModulePath); // parse database string @@ -736,9 +736,6 @@ class SetupFunctions fwriteConstDef($rFile, 'LibDir', CONST_LibDir); fwriteConstDef($rFile, 'DataDir', CONST_DataDir); fwriteConstDef($rFile, 'InstallDir', CONST_InstallDir); - - fwrite($rFile, "if (file_exists(getenv('NOMINATIM_SETTINGS'))) require_once(getenv('NOMINATIM_SETTINGS'));\n\n"); - fwriteConstDef($rFile, 'Database_DSN', getSetting('DATABASE_DSN')); fwriteConstDef($rFile, 'Default_Language', getSetting('DEFAULT_LANGUAGE')); fwriteConstDef($rFile, 'Log_DB', getSettingBool('LOG_DB')); diff --git a/lib/setup_functions.php b/lib/setup_functions.php index a2287d9b..dab6a8e7 100755 --- a/lib/setup_functions.php +++ b/lib/setup_functions.php @@ -17,12 +17,7 @@ function checkInFile($sOSMFile) function getOsm2pgsqlBinary() { - $sBinary = getSetting('OSM2PGSQL_BINARY'); - if (!$sBinary) { - $sBinary = CONST_InstallDir.'/osm2pgsql/osm2pgsql'; - } - - return $sBinary; + return getSetting('OSM2PGSQL_BINARY', CONST_Default_Osm2pgsql); } function getImportStyle() -- 2.45.1