diff options
author | Benjamin Trigona-Harany <slackbuilds@jaxartes.net> | 2013-04-23 12:56:03 -0300 |
---|---|---|
committer | Niels Horn <niels.horn@slackbuilds.org> | 2013-04-23 12:56:03 -0300 |
commit | 459eedd868950ec8d7f4f95ba3038ab1b4abb50f (patch) | |
tree | f8bb5ed4be5d81dcf598ee95190976d128a1af02 | |
parent | 4604cadb54b05b5a817332cf753356ce6c54b5c1 (diff) | |
download | slackbuilds-459eedd868950ec8d7f4f95ba3038ab1b4abb50f.tar.gz |
academic/pgrouting: Added (geospatial routing for PostGIS)
Signed-off-by: Niels Horn <niels.horn@slackbuilds.org>
-rw-r--r-- | academic/pgrouting/README | 11 | ||||
-rw-r--r-- | academic/pgrouting/create_template.sh | 52 | ||||
-rw-r--r-- | academic/pgrouting/pgrouting-1.05-flags.patch | 14 | ||||
-rw-r--r-- | academic/pgrouting/pgrouting-1.05-sql.patch | 39 | ||||
-rw-r--r-- | academic/pgrouting/pgrouting-1.05-weightmap.patch | 38 | ||||
-rw-r--r-- | academic/pgrouting/pgrouting.SlackBuild | 125 | ||||
-rw-r--r-- | academic/pgrouting/pgrouting.info | 10 | ||||
-rw-r--r-- | academic/pgrouting/slack-desc | 19 |
8 files changed, 308 insertions, 0 deletions
diff --git a/academic/pgrouting/README b/academic/pgrouting/README new file mode 100644 index 0000000000..d9e4197d7a --- /dev/null +++ b/academic/pgrouting/README @@ -0,0 +1,11 @@ +pgRouting extends the PostGIS / PostgreSQL geospatial database to provide +geospatial routing functionality. + +The following algorithms are compiled: +* Dijkstra - shortest path algorithm +* A-star (A*) - shortest path algorithm using heuristical function +* Shooting star (Shooting*) - shortest path algorithm for real road + networks with turn restrictions, traffic lights and one way streets + +A script for creating a pgRouting database template on Slackware will be +added to the documentation directory. diff --git a/academic/pgrouting/create_template.sh b/academic/pgrouting/create_template.sh new file mode 100644 index 0000000000..777be827c1 --- /dev/null +++ b/academic/pgrouting/create_template.sh @@ -0,0 +1,52 @@ +# ------------------------------------------------------------------------------ +# Setup template containing PostGIS and/or pgRouting +# ------------------------------------------------------------------------------ +# +# To create a GIS database as non-superuser run: +# +# "createdb -h hostname -W -T template_postgis mydb +# +# Source: http://geospatial.nomad-labs.com/2006/12/24/postgis-template-database/ +# +# Note: requires "libpq-dev" package + +if [ -e `pg_config --sharedir` ] +then + echo "PostGIS installed in" `pg_config --sharedir` + POSTGIS_SQL_PATH=`pg_config --sharedir`/contrib +else + POSTGIS_SQL_PATH=/usr/share/postgresql/contrib +fi +echo "PostGIS path set as $POSTGIS_SQL_PATH" + +ROUTING_SQL_PATH=/usr/share/postlbs + +# Create "template_routing" +# ------------------------- +if sudo -u postgres psql --list | grep -q template_routing ; +then + echo "pgRouting template already exists!" +else + echo "Create pgRouting template ..." + sudo -u postgres createdb -E UTF8 template_routing + + sudo -u postgres psql --quiet -d template_routing -c "create extension postgis;" + sudo -u postgres psql --quiet -d template_routing -c "create extension postgis_topology;" + + sudo -u postgres psql --quiet -d template_routing -f $ROUTING_SQL_PATH/routing_core.sql + sudo -u postgres psql --quiet -d template_routing -f $ROUTING_SQL_PATH/routing_core_wrappers.sql + sudo -u postgres psql --quiet -d template_routing -f $ROUTING_SQL_PATH/routing_topology.sql + sudo -u postgres psql --quiet -d template_routing -f $ROUTING_SQL_PATH/matching.sql + + sudo -u postgres psql --quiet -d template_routing -c "GRANT ALL ON geometry_columns TO PUBLIC;" + sudo -u postgres psql --quiet -d template_routing -c "GRANT ALL ON geography_columns TO PUBLIC;" + sudo -u postgres psql --quiet -d template_routing -c "GRANT ALL ON raster_columns TO PUBLIC;" + sudo -u postgres psql --quiet -d template_routing -c "GRANT ALL ON spatial_ref_sys TO PUBLIC;" + + sudo -u postgres psql --quiet -d template_routing -c "VACUUM FULL;" + sudo -u postgres psql --quiet -d template_routing -c "VACUUM FREEZE;" + + sudo -u postgres psql --quiet -d postgres -c "UPDATE pg_database SET datistemplate='true' WHERE datname='template_routing';" + sudo -u postgres psql --quiet -d postgres -c "UPDATE pg_database SET datallowconn='false' WHERE datname='template_routing';" + echo "... template_routing created." +fi diff --git a/academic/pgrouting/pgrouting-1.05-flags.patch b/academic/pgrouting/pgrouting-1.05-flags.patch new file mode 100644 index 0000000000..a802aab38b --- /dev/null +++ b/academic/pgrouting/pgrouting-1.05-flags.patch @@ -0,0 +1,14 @@ +diff -Nur pgrouting-1.05/CMakeLists.txt pgrouting-1.05-flags/CMakeLists.txt +--- pgrouting-1.05/CMakeLists.txt 2010-11-16 18:42:21.000000000 -0800 ++++ pgrouting-1.05-flags/CMakeLists.txt 2013-03-06 22:05:59.934147381 -0800 +@@ -85,8 +85,8 @@ + LINK_LIBRARIES(postgres) + ENDIF(WIN32) + +-SET(CMAKE_C_FLAGS "-O2 -g -frounding-math") +-SET(CMAKE_CXX_FLAGS "-O2 -g -frounding-math") ++SET(CMAKE_C_FLAGS "${SLKCFLAGS} -frounding-math") ++SET(CMAKE_CXX_FLAGS "${SLKCFLAGS} -frounding-math") + + # Recurse into the subdirectories. This does not actually + # cause another cmake executable to run. The same process will walk through diff --git a/academic/pgrouting/pgrouting-1.05-sql.patch b/academic/pgrouting/pgrouting-1.05-sql.patch new file mode 100644 index 0000000000..43fee1d205 --- /dev/null +++ b/academic/pgrouting/pgrouting-1.05-sql.patch @@ -0,0 +1,39 @@ +diff -Nur pgrouting-1.05/core/sql/routing_core.sql pgrouting-1.05-sql/core/sql/routing_core.sql +--- pgrouting-1.05/core/sql/routing_core.sql 2010-11-16 18:42:21.000000000 -0800 ++++ pgrouting-1.05-sql/core/sql/routing_core.sql 2013-03-06 23:07:39.797615201 -0800 +@@ -14,7 +14,7 @@ + -- + -- You should have received a copy of the GNU General Public License + -- along with this program; if not, write to the Free Software +--- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++-- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + -- + + +@@ -29,7 +29,7 @@ + target_id integer, directed boolean, has_reverse_cost boolean) + RETURNS SETOF path_result + AS '$libdir/librouting' +- LANGUAGE 'C' IMMUTABLE STRICT; ++ LANGUAGE c IMMUTABLE STRICT; + + ----------------------------------------------------------------------- + -- Core function for shortest_path_astar computation +@@ -40,7 +40,7 @@ + target_id integer,directed boolean, has_reverse_cost boolean) + RETURNS SETOF path_result + AS '$libdir/librouting' +- LANGUAGE 'C' IMMUTABLE STRICT; ++ LANGUAGE c IMMUTABLE STRICT; + + ----------------------------------------------------------------------- + -- Core function for shortest_path_astar computation +@@ -50,7 +50,7 @@ + target_id integer,directed boolean, has_reverse_cost boolean) + RETURNS SETOF path_result + AS '$libdir/librouting' +- LANGUAGE 'C' IMMUTABLE STRICT; ++ LANGUAGE c IMMUTABLE STRICT; + + ----------------------------------------------------------------------- + -- This function should not be used directly. Use create_graph_tables instead diff --git a/academic/pgrouting/pgrouting-1.05-weightmap.patch b/academic/pgrouting/pgrouting-1.05-weightmap.patch new file mode 100644 index 0000000000..350938d215 --- /dev/null +++ b/academic/pgrouting/pgrouting-1.05-weightmap.patch @@ -0,0 +1,38 @@ +diff -Nur pgrouting-1.05/core/src/astar_boost_wrapper.cpp pgrouting-1.05-weightmap/core/src/astar_boost_wrapper.cpp +--- pgrouting-1.05/core/src/astar_boost_wrapper.cpp 2010-11-16 18:42:21.000000000 -0800 ++++ pgrouting-1.05-weightmap/core/src/astar_boost_wrapper.cpp 2013-03-06 22:06:43.438193285 -0800 +@@ -139,9 +139,6 @@ + + graph_t graph(num_nodes); + +- property_map<graph_t, edge_weight_t>::type weightmap = get(edge_weight, +- graph); +- + for (std::size_t j = 0; j < count; ++j) + { + +diff -Nur pgrouting-1.05/core/src/boost_wrapper.cpp pgrouting-1.05-weightmap/core/src/boost_wrapper.cpp +--- pgrouting-1.05/core/src/boost_wrapper.cpp 2010-11-16 18:42:21.000000000 -0800 ++++ pgrouting-1.05-weightmap/core/src/boost_wrapper.cpp 2013-03-06 22:06:54.689205167 -0800 +@@ -73,8 +73,6 @@ + + graph_t graph(num_nodes); + +- property_map<graph_t, edge_weight_t>::type weightmap = get(edge_weight, graph); +- + for (std::size_t j = 0; j < count; ++j) + { + edge_descriptor e; bool inserted; +diff -Nur pgrouting-1.05/extra/driving_distance/src/boost_drivedist.cpp pgrouting-1.05-weightmap/extra/driving_distance/src/boost_drivedist.cpp +--- pgrouting-1.05/extra/driving_distance/src/boost_drivedist.cpp 2010-11-16 18:42:21.000000000 -0800 ++++ pgrouting-1.05-weightmap/extra/driving_distance/src/boost_drivedist.cpp 2013-03-06 22:07:23.983236104 -0800 +@@ -84,9 +84,6 @@ + + graph_t graph( num_nodes ); + +- property_map<graph_t, edge_weight_t>::type weightmap = +- get(edge_weight, graph); +- + for (std::size_t j = 0; j < count; ++j) + { + graph_add_edge<graph_t, edge_descriptor> diff --git a/academic/pgrouting/pgrouting.SlackBuild b/academic/pgrouting/pgrouting.SlackBuild new file mode 100644 index 0000000000..ef3557a5b7 --- /dev/null +++ b/academic/pgrouting/pgrouting.SlackBuild @@ -0,0 +1,125 @@ +#!/bin/sh + +# SlackBuild script for pgRouting + +# Copyright 2013 Benjamin Trigona-Harany <slackbuilds@jaxartes.net> +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +PRGNAM=pgrouting +VERSION=${VERSION:-1.05} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i486 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +rm -rf $TMP/$PRGNAM-$VERSION +cd $TMP +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +cd $PRGNAM-$VERSION +chown -R root:root . +find . \ + \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ + -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ + -exec chmod 644 {} \; + +# set build flags +patch -p1 < $CWD/pgrouting-1.05-flags.patch + +# remove broken and unnecessary weightmap declarations +patch -p1 < $CWD/pgrouting-1.05-weightmap.patch + +# fix LANGUAGE 'C' for Postgres 9.2 +patch -p1 < $CWD/pgrouting-1.05-sql.patch + +# Some fixes collected by Fedora packagers +# Correct FSF address +find . \( -name *.cpp -o -name *.c -o -name *.h -o -name *.sql \) -print | xargs -i \ + sed -i 's/59 Temple Place\(, \| - \)Suite 330/51 Franklin Street, Fifth Floor/;s/02111-1307/02110-1301/' {} + +# Fix boost property_map files path +sed -i "s|boost/vector_property_map.hpp|boost/property_map/vector_property_map.hpp|" \ + core/src/shooting_star_boost_wrapper.cpp + +sed -i "s|boost/property_map.hpp|boost/property_map/property_map.hpp|" \ + core/src/shooting_star_relax.hpp \ + core/src/edge_visitors.hpp + +# fix to avoid deprecated "boost/graph/detail/is_same.hpp" file +sed -i "s|boost/graph/detail/is_same.hpp|boost/type_traits/is_same.hpp|" \ + core/src/edge_visitors.hpp + +mkdir -p build +cd build + cmake \ + -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \ + -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_BUILD_TYPE=Release \ + .. + + make VERBOSE=1 + make install VERBOSE=1 DESTDIR=$PKG +cd .. + +find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a authors.txt COPYING README.routing RELEASE_NOTES $PKG/usr/doc/$PRGNAM-$VERSION +cp $CWD/create_template.sh $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/academic/pgrouting/pgrouting.info b/academic/pgrouting/pgrouting.info new file mode 100644 index 0000000000..d5c7c3793b --- /dev/null +++ b/academic/pgrouting/pgrouting.info @@ -0,0 +1,10 @@ +PRGNAM="pgrouting" +VERSION="1.05" +HOMEPAGE="http://pgrouting.org" +DOWNLOAD="http://download.osgeo.org/pgrouting/source/pgrouting-1.05.tar.gz" +MD5SUM="bd7c106e3db3c38f7081f1ee9b0e12ae" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="postgis" +MAINTAINER="Benjamin Trigona-Harany" +EMAIL="slackbuilds@jaxartes.net" diff --git a/academic/pgrouting/slack-desc b/academic/pgrouting/slack-desc new file mode 100644 index 0000000000..3a96ce4c7c --- /dev/null +++ b/academic/pgrouting/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +pgrouting: pgrouting (geospatial routing for PostGIS) +pgrouting: +pgrouting: pgRouting extends the PostGIS / PostgreSQL geospatial database to +pgrouting: provide geospatial routing functionality. +pgrouting: +pgrouting: +pgrouting: +pgrouting: +pgrouting: Homepage: http://pgrouting.org +pgrouting: +pgrouting: |