mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-25 04:12:44 +03:00
postgis_2_3: remove
2.4 supports all packaged postgresql versions
This commit is contained in:
parent
3bbe3ca902
commit
9f1ccebf51
@ -1,102 +0,0 @@
|
||||
{ fetchurl
|
||||
, stdenv
|
||||
, perl
|
||||
, libxml2
|
||||
, postgresql
|
||||
, geos
|
||||
, proj
|
||||
, flex
|
||||
, gdal
|
||||
, json_c
|
||||
, pkgconfig
|
||||
, file
|
||||
}:
|
||||
|
||||
/*
|
||||
|
||||
### NixOS - usage:
|
||||
==================
|
||||
|
||||
services.postgresql.extraPlugins = [ (pkgs.postgis.override { postgresql = pkgs.postgresql95; }) ];
|
||||
|
||||
|
||||
### important Postgis implementation details:
|
||||
=============================================
|
||||
|
||||
Postgis provides a shared library implementing many operations. They are
|
||||
exposed to the Postgres SQL interpreter by special SQL queries eg:
|
||||
|
||||
CREATE FUNCTION [...]
|
||||
AS '[..]liblwgeom', 'lwhistogram2d_in' LANGUAGE 'C' IMMUTABLE STRICT; -- WITH (isstrict);
|
||||
|
||||
where liblwgeom is the shared library.
|
||||
Postgis < 1.5 used absolute paths, in NixOS $libdir is always used.
|
||||
|
||||
Thus if you want to use postgresql dumps which were created by non NixOS
|
||||
systems you have to adopt the library path.
|
||||
|
||||
|
||||
### TODO:
|
||||
=========
|
||||
the bin commands to have gtk gui:
|
||||
*/
|
||||
|
||||
|
||||
let
|
||||
version = "2.3.1";
|
||||
sha256 = "0xd21h2k6x3i1b3z6pgm3pmkfpxm6irxd5wbx68acjndjgd6p3ac";
|
||||
in stdenv.mkDerivation rec {
|
||||
name = "postgis-${version}";
|
||||
|
||||
src = fetchurl {
|
||||
url = "http://download.osgeo.org/postgis/source/postgis-${builtins.toString version}.tar.gz";
|
||||
inherit sha256;
|
||||
};
|
||||
|
||||
# don't pass these vars to the builder
|
||||
removeAttrs = ["sql_comments" "sql_srcs"];
|
||||
|
||||
# create aliases for all commands adding version information
|
||||
postInstall = ''
|
||||
sql_srcs=$(for sql in ${builtins.toString sql_srcs}; do echo -n "$(find $out -iname "$sql") "; done )
|
||||
|
||||
for prog in $out/bin/*; do # */
|
||||
ln -s $prog $prog-${version}
|
||||
done
|
||||
|
||||
cp -r doc $out
|
||||
'';
|
||||
|
||||
buildInputs = [ libxml2 postgresql geos proj perl gdal json_c pkgconfig ];
|
||||
|
||||
sql_comments = "postgis_comments.sql";
|
||||
|
||||
sql_srcs = ["postgis.sql" "spatial_ref_sys.sql"];
|
||||
|
||||
# postgis config directory assumes /include /lib from the same root for json-c library
|
||||
NIX_LDFLAGS = "-L${stdenv.lib.getLib json_c}/lib";
|
||||
|
||||
dontDisableStatic = true;
|
||||
preConfigure = ''
|
||||
sed -i 's@/usr/bin/file@${file}/bin/file@' configure
|
||||
configureFlags="--datadir=$out/share --datarootdir=$out/share --bindir=$out/bin --with-gdalconfig=${gdal}/bin/gdal-config --with-jsondir=${json_c.dev}"
|
||||
makeFlags="PERL=${perl}/bin/perl datadir=$out/share pkglibdir=$out/lib bindir=$out/bin"
|
||||
'';
|
||||
postConfigure = ''
|
||||
sed -i "s|@mkdir -p \$(DESTDIR)\$(PGSQL_BINDIR)||g ;
|
||||
s|\$(DESTDIR)\$(PGSQL_BINDIR)|$prefix/bin|g
|
||||
" \
|
||||
"raster/loader/Makefile";
|
||||
sed -i "s|\$(DESTDIR)\$(PGSQL_BINDIR)|$prefix/bin|g
|
||||
" \
|
||||
"raster/scripts/python/Makefile";
|
||||
'';
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "Geographic Objects for PostgreSQL";
|
||||
homepage = http://postgis.refractions.net;
|
||||
license = licenses.gpl2;
|
||||
maintainers = [ maintainers.marcweber ];
|
||||
platforms = platforms.linux;
|
||||
};
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
#!/bin/sh
|
||||
sql_files=(@sql_srcs@)
|
||||
sql_comments=@sql_comments@
|
||||
|
||||
do_help(){ echo "$0 [--comments] db_name1 [db_name2 ..]"; }
|
||||
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
-h|--help)
|
||||
do_help; exit 0
|
||||
;;
|
||||
--comments)
|
||||
LOAD_COMMENTS=1
|
||||
;;
|
||||
*)
|
||||
dbs=(${dbs[@]} "$arg")
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
PSQL(){
|
||||
echo ">> loading $1"
|
||||
psql -d "$db" -f $1
|
||||
}
|
||||
|
||||
for db in ${dbs[@]}; do
|
||||
createlang plpgsql "$db"
|
||||
|
||||
# mandatory
|
||||
for sql in $sql_files; do
|
||||
PSQL $sql
|
||||
done
|
||||
|
||||
# optionally load some comments
|
||||
if [ -n "$LOAD_COMMENTS" ]; then
|
||||
PSQL $sql_comments
|
||||
fi
|
||||
done
|
@ -1,52 +0,0 @@
|
||||
#!/bin/sh
|
||||
libName=@libName@
|
||||
|
||||
# this is a quick and dirty implementation
|
||||
|
||||
do_help(){
|
||||
echo "$0 --str str in-file|- [out|-|psql:db]";
|
||||
echo "in: - = STDIN or filename";
|
||||
echo "out: - = STDIN or filename or psql:database_name"
|
||||
echo " psql:database_name will load the dump into the database"
|
||||
echo " if out is omitted in is used for out (same file)"
|
||||
echo "--str: different replacement string. Eg for Ubuntu use: '/usr/lib/postgresql/8.3/lib/liblwgeom'";
|
||||
echo "WARNING: A postgis dump is not meant to be distributed - it still may be useful :)"
|
||||
}
|
||||
|
||||
if [ -z "$1" -o "$1" = --help -o "$1" = -h ]; then
|
||||
do_help; exit 1
|
||||
fi
|
||||
|
||||
tostr='$libdir/'"$libName"
|
||||
if [ "$1" == "--str" ]; then
|
||||
to="$2"; shift 2
|
||||
fi
|
||||
|
||||
i=$1
|
||||
o="${2:-$1}"
|
||||
|
||||
cmd_in(){
|
||||
case "$i" in
|
||||
-) cat;;
|
||||
*) cat "$i";;
|
||||
esac
|
||||
}
|
||||
|
||||
cmd_out(){
|
||||
case "$o" in
|
||||
-) cat;; # stdout
|
||||
psql:*) psql "${o:5}";; # pipe into psql
|
||||
*)
|
||||
t=`mktemp`; cat > "$t"; mv "$t" "$o"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
cmd_replace(){
|
||||
contents=`cat`
|
||||
# get wrong library path:
|
||||
fromstr=$(echo "$contents" | head -n 50 | sed -n "s/.*AS '\([^']*\)'.*/\1/p" | head -n 1)
|
||||
echo "$contents" | sed "s@AS '$fromstr@AS '$tostr@g"
|
||||
}
|
||||
|
||||
cmd_in | cmd_replace | cmd_out
|
@ -10890,7 +10890,6 @@ with pkgs;
|
||||
};
|
||||
|
||||
postgis = callPackage ../development/libraries/postgis { };
|
||||
postgis_2_3 = callPackage ../development/libraries/postgis/2.3.nix { };
|
||||
|
||||
protobuf = callPackage ../development/libraries/protobuf/3.4.nix { };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user