summaryrefslogtreecommitdiff
blob: 79e1c067fde8ffc6801e1d0ad5deef8acd84d1ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-db/postgis/postgis-1.0.0_p20050512.ebuild,v 1.1 2005/05/24 21:18:52 nakano Exp $

DESCRIPTION="Geographic Objects for PostgreSQL"
HOMEPAGE="http://postgis.refractions.net"
SRC_URI="mirror://gentoo/${P}.tar.gz
	http://dev.gentoo.org/~nakano/${P}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86 ~ppc ~amd64"
IUSE="doc geos proj"

RDEPEND=">=dev-db/postgresql-7.2
	geos? ( sci-libs/geos )
	proj? ( sci-libs/proj )"
DEPEND="${RDEPEND}
	doc? ( app-text/docbook-xsl-stylesheets )
	sys-devel/autoconf"

S="${WORKDIR}/${PN}-cvs"
src_compile(){
	local myconf

	use ppc && CFLAGS="-pipe -fsigned-char"
	myconf="${myconf} --enable-autoconf --with-maxbackends=1024"

	cd ${S}
	if use doc; then
		local xslv=$(best_version app-text/docbook-xsl-stylesheets |\
			cut -d'/' -f2 | sed s/"docbook-"//)
		einfo "Building doc with ${xslv}"
		cat configure.in |\
			sed s/"xsl-stylesheets"/"${xslv}"/ > configure.in
	fi

	autoconf
	if use geos; then
		myconf="${myconf} $(use_with geos)=$(which geos-config)"
	fi
	if use proj; then
	    myconf="${myconf} $(use_with proj)=/usr"
	fi
	econf ${myconf} \
		|| die "Error: econf failed"
	if use doc; then
		einfo "doc will be built"
	else
		einfo "removing build directives for doc from Makefile"
		sed -e s/"utils docs"/"utils"/ \
			-e s/"loaderdumper-install docs-install"/"loaderdumper-install"/ \
				Makefile > Makefile.new
		mv Makefile.new Makefile
	fi

	emake || die "Error: emake failed"
}

src_install(){
	into /usr
	cd ${S}
	einstall || die "Error: einstall failed"
	dodir /usr/share/postgresql /usr/share/postgresql/contrib/
	mv ${D}/usr/share/*.sql ${D}/usr/share/postgresql/contrib/
	dodoc CHANGES COPYING CREDITS README.postgis TODO
	if use doc; then
		cd ${S}/doc
		dohtml -r html/*
		dodoc *.txt
	fi
}

pkg_postinst() {
	einfo "To create your first postgis database do the followings commands :"
	einfo " # su postgres"
	einfo " # createdb -E SQL_ASCII poolp"
	einfo " # createlang plpgsql poolp"
	einfo " # psql -d poolp -f /usr/share/postgresql/contrib/lwpostgis.sql"
	einfo " # psql -d poolp -f /usr/share/postgresql/contrib/spatial_ref_sys.sql"
	einfo "For more informations go to : http://postgis.refractions.net/documentation.php"
	einfo "(For french user only see http://techer.pascal.free.fr/postgis)"
}