]> git.openstreetmap.org Git - nominatim.git/commitdiff
configure osm2pgsql and module location via cmake
authorSarah Hoffmann <lonvia@denofr.de>
Mon, 4 Jan 2021 10:37:56 +0000 (11:37 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Mon, 4 Jan 2021 10:37:56 +0000 (11:37 +0100)
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
lib/setup/SetupClass.php
lib/setup_functions.php

index 4d9224b03d2b8b92fdaf349940abfe1ba06e6045..5b7bc6f7decb2c7a8feb6aaa527028088966217e 100755 (executable)
@@ -1,5 +1,7 @@
 #!@PHP_BIN@ -Cq
 <?php
+@define('CONST_Default_ModulePath', '@CMAKE_BINARY_DIR@/module');
+@define('CONST_Default_Osm2pgsql', '@CMAKE_BINARY_DIR@/osm2pgsql/osm2pgsql');
 @define('CONST_BinDir', '@CMAKE_SOURCE_DIR@/utils');
 @define('CONST_LibDir', '@CMAKE_SOURCE_DIR@/lib');
 @define('CONST_DataDir', '@CMAKE_SOURCE_DIR@');
index d3c4c4eb62044903bcc564d48899b853e5334a9f..92c36bf3ab306e680a972dc2a2e934264b968285 100755 (executable)
@@ -42,7 +42,7 @@ class SetupFunctions
             $this->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'));
index a2287d9bf794fc19bfa5a9140324ec581896f24b..dab6a8e73e399f09d8682085f15ea2335f6bb7f6 100755 (executable)
@@ -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()