diff options
-rw-r--r-- | .SRCINFO | 39 | ||||
-rw-r--r-- | PKGBUILD | 129 | ||||
-rw-r--r-- | apache.conf | 7 | ||||
-rw-r--r-- | nominatim.install | 11 | ||||
-rw-r--r-- | nominatim.sysusers | 1 | ||||
-rw-r--r-- | nominatim.tmpfiles | 1 | ||||
-rw-r--r-- | settings-local.php | 3 | ||||
-rw-r--r-- | webapps-paths.patch | 21 |
8 files changed, 212 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..04ace3271f95 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,39 @@ +pkgbase = nominatim + pkgdesc = Geocoding tool using OpenStreetmap data + pkgver = 3.4.1 + pkgrel = 0 + url = https://nominatim.org + arch = x86_64 + license = GPL2 + makedepends = libxml2 + makedepends = cmake + depends = boost + depends = boost-libs + depends = expat + depends = git + depends = php + depends = php-pgsql + depends = postgis + depends = postgresql + depends = proj + depends = pyosmium + optdepends = nominatim-data-wikipedia: optional auxiliary data source to help indicate the importance of OSM features + optdepends = nominatim-data-postcodes-gb: improve searches that involve a UK postcode + optdepends = nominatim-data-postcodes-us: improve searches that involve a US postcode + source = https://nominatim.org/release/Nominatim-3.4.1.tar.bz2 + source = nominatim.install + source = nominatim.sysusers + source = nominatim.tmpfiles + source = apache.conf + source = settings-local.php + source = webapps-paths.patch + sha256sums = eea1e0e4bd0fd5c9408a734e3ad687879fbcdf670edbfa7c678daf7dc1d0fae2 + sha256sums = 79499b5d2a4c364f3e658e837e315644023cf120eca6b7c368aa059ab6b5082d + sha256sums = 7db2c5ff31954c02421fadd06b6758e181a7028f5ac73b16f3abdcb4caef6879 + sha256sums = 1999cb2bb75046a4ea1b326082a4c1cf5de54f12ed36b1d22540c842c7c30b9d + sha256sums = 8dd94ea1a88156bc55dc41e4f4df878df4f28c23c31bfda36c89470e2f5997d0 + sha256sums = df040410ab16df4e45c14b3c3857b58d995e8a4a73dbc111612426617e68f53a + sha256sums = c056160b4d7ec1ed43905a6d13f265f4c726ed660b819091ba17786aca525477 + +pkgname = nominatim + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..0b16fcd84b91 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,129 @@ +# Maintainer: peippo <christoph.fink@gmail.com> + +pkgname="nominatim" +pkgdesc="Geocoding tool using OpenStreetmap data" +url="https://nominatim.org" + +pkgver=3.4.1 +pkgrel=0 + +arch=("x86_64") +license=("GPL2") + +makedepends=( + "libxml2" + "cmake" +) +depends=( + "boost" + "boost-libs" + "expat" + "git" + "php" + "php-pgsql" + "postgis" + "postgresql" + "proj" + "pyosmium" +) +optdepends=( + "nominatim-data-wikipedia: optional auxiliary data source to help indicate the importance of OSM features" + "nominatim-data-postcodes-gb: improve searches that involve a UK postcode" + "nominatim-data-postcodes-us: improve searches that involve a US postcode" +) +# checkdepends=( +# "php-codesniffer" +# "phpunit" +# "python-behave" +# "python-nose" +# "python-pip" +# "python-psycopg2" +# "python-setuptools" +# "python-tidylib" +# ) + +source=( + "https://nominatim.org/release/Nominatim-${pkgver}.tar.bz2" + "${pkgname}.install" + "${pkgname}.sysusers" + "${pkgname}.tmpfiles" + "apache.conf" + "settings-local.php" + "webapps-paths.patch" +) +sha256sums=( + "eea1e0e4bd0fd5c9408a734e3ad687879fbcdf670edbfa7c678daf7dc1d0fae2" + "79499b5d2a4c364f3e658e837e315644023cf120eca6b7c368aa059ab6b5082d" + "7db2c5ff31954c02421fadd06b6758e181a7028f5ac73b16f3abdcb4caef6879" + "1999cb2bb75046a4ea1b326082a4c1cf5de54f12ed36b1d22540c842c7c30b9d" + "8dd94ea1a88156bc55dc41e4f4df878df4f28c23c31bfda36c89470e2f5997d0" + "df040410ab16df4e45c14b3c3857b58d995e8a4a73dbc111612426617e68f53a" + "c056160b4d7ec1ed43905a6d13f265f4c726ed660b819091ba17786aca525477" +) +install="${pkgname}.install" + +prepare() { + mkdir -p "${srcdir}/build" + patch -d "${srcdir}/Nominatim-${pkgver}" -p1 < webapps-paths.patch +} + +build() { + cd "${srcdir}/build" + cmake \ + -DCMAKE_INSTALL_PREFIX="/usr" \ + "../Nominatim-${pkgver}" + make +} + +# check() { +# cd "${srcdir}/Nominatim-${pkgver}/test" +# make +# } + +package() { + cd "${srcdir}/build" + make DESTDIR="${pkgdir}/" install + + # install is a bit confusing (~manual); + # upstream instructs to run from build and src + # directory, which does not sound like the + # thing I’d want to do. + + # directories to copy from source dir + for _dir in \ + "data" \ + "data-sources" \ + "lib" \ + "munin" \ + "sql" \ + "wikidata" + do + install \ + -Ddm755 \ + "${srcdir}/Nominatim-${pkgver}/${_dir}" \ + "${pkgdir}/usr/share/webapps/${pkgname}/${_dir}" + done + + # directories to copy from build dir + for dir in \ + "settings" \ + "utils" \ + "website" + do + install \ + -Ddm755 \ + "${srcdir}/build/${_dir}" \ + "${pkgdir}/usr/share/webapps/${pkgname}/${_dir}" + done + + install -Dm755 "${srcdir}/build/module/nominatim.so" -t "${pkgdir}/usr/share/webapps/${pkgname}/module/" + install -Dm755 "${srcdir}/build/nominatim/nominatim" -t "${pkgdir}/usr/share/webapps/${pkgname}/nominatim/" + + install -Ddm755 "${pkgdir}/etc/webapps/${pkgname}/settings/" + ln -s "/usr/share/webapps/${pkgname}/settings/" "${pkgdir}/etc/webapps/${pkgname}/settings/" + install -Dm644 "${srcdir}/apache.conf" -t "${pkgdir}/etc/webapps/${pkgname}" + install -Dm644 "${srcdir}/settings-local.php" "${pkgdir}/usr/share/webapps/${pkgname}/settings/local.php" + + install -Dm 644 "${srcdir}/${pkgname}.sysusers" "${pkgdir}/usr/lib/sysusers.d/${pkgname}.conf" + install -Dm 644 "${srcdir}/${pkgname}.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/${pkgname}.conf" +} diff --git a/apache.conf b/apache.conf new file mode 100644 index 000000000000..d54b71505f93 --- /dev/null +++ b/apache.conf @@ -0,0 +1,7 @@ +Alias /nominatim "/usr/share/webapps/nominatim/website" +<Directory "/usr/share/webapps/nominatim/website"> + Options FollowSymlinks MultiViews + DirectoryIndex search.php + Require all granted +</Directory> + diff --git a/nominatim.install b/nominatim.install new file mode 100644 index 000000000000..cb3d19a32b0e --- /dev/null +++ b/nominatim.install @@ -0,0 +1,11 @@ +#!/bin/bash + +post_install() { + cat <<- 'EOF' + Create a PostgreSQL database and users for nomination by running + `sudo su - postgres "createuser nominatim; createdb -O nominatim nominatim; createuser http"` + + Then `su` to user `nominatim` and follow the instructions at http://nominatim.org/release-docs/latest/admin/Import-and-Update/#choosing-the-data-to-import to download and import data. + + EOF +} diff --git a/nominatim.sysusers b/nominatim.sysusers new file mode 100644 index 000000000000..3478d9a80f69 --- /dev/null +++ b/nominatim.sysusers @@ -0,0 +1 @@ +u nominatim - "Nominatim geocoder" /usr/share/webapps/nominatim /bin/bash diff --git a/nominatim.tmpfiles b/nominatim.tmpfiles new file mode 100644 index 000000000000..ac5bf7a6cde4 --- /dev/null +++ b/nominatim.tmpfiles @@ -0,0 +1 @@ +d /var/lib/nominatim 755 nominatim nominatim diff --git a/settings-local.php b/settings-local.php new file mode 100644 index 000000000000..a5ff80746897 --- /dev/null +++ b/settings-local.php @@ -0,0 +1,3 @@ +<?php + @define('CONST_Website_BaseURL', '/nominatim/'); + @define('CONST_Osm2pgsql_Flatnode_File', '/var/lib/nominatim/flatnode.file'); diff --git a/webapps-paths.patch b/webapps-paths.patch new file mode 100644 index 000000000000..14ae2c3ca9b7 --- /dev/null +++ b/webapps-paths.patch @@ -0,0 +1,21 @@ +diff -ru a/settings/defaults.php b/settings/defaults.php +--- a/settings/defaults.php 2019-12-28 23:57:37.000000000 +0200 ++++ b/settings/defaults.php 2020-02-06 14:31:22.613567043 +0200 +@@ -1,6 +1,6 @@ + <?php +-@define('CONST_BasePath', '@CMAKE_SOURCE_DIR@'); +-@define('CONST_InstallPath', '@CMAKE_BINARY_DIR@'); ++@define('CONST_BasePath', '/usr/share/webapps/nominatim'); ++@define('CONST_InstallPath', '/usr/share/webapps/nominatim'); + if (file_exists(getenv('NOMINATIM_SETTINGS'))) require_once(getenv('NOMINATIM_SETTINGS')); + if (file_exists(CONST_InstallPath.'/settings/local.php')) require_once(CONST_InstallPath.'/settings/local.php'); + if (isset($_GET['debug']) && $_GET['debug']) @define('CONST_Debug', true); +@@ -8,7 +8,7 @@ + // General settings + @define('CONST_Debug', false); + @define('CONST_Database_DSN', 'pgsql:dbname=nominatim'); // or add ;host=...;port=...;user=...;password=... +-@define('CONST_Database_Web_User', 'www-data'); ++@define('CONST_Database_Web_User', 'http'); + @define('CONST_Database_Module_Path', CONST_InstallPath.'/module'); + @define('CONST_Max_Word_Frequency', '50000'); + @define('CONST_Limit_Reindexing', true); |