summaryrefslogtreecommitdiff
blob: a97eead588451a7adf102af2fc7dfc80d737d9b4 (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
84
85
86
87
88
89
90
91
92
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI="2"

inherit flag-o-matic

MY_PN="MonetDB-SQL"
MY_P=${MY_PN}-${PV}

DESCRIPTION="SQL server built on top of (targeted on) MonetDB5"
HOMEPAGE="http://monetdb.cwi.nl/"
SRC_URI="http://dev.monetdb.org/downloads/sources/Jun2010-SP1/${MY_P}.tar.bz2"
RESTRICT="primaryuri"

LICENSE="MonetDBPL-1.1"
SLOT="5"
KEYWORDS="~amd64 ~x86"
IUSE="bzip2 curl debug iconv rdf xml zlib"

RDEPEND=">=dev-libs/libpcre-4.5
	>=dev-libs/openssl-0.9.8
	sys-libs/readline
	curl? ( net-misc/curl )
	iconv? ( virtual/libiconv )
	bzip2? ( || ( app-arch/bzip2 app-arch/pbzip2 ) )
	zlib? ( sys-libs/zlib )
	>=dev-db/monetdb-common-1.38.0
	>=dev-db/monetdb-client-1.38.0
	>=dev-db/monetdb5-server-5.20.0[rdf?,xml?]
	!!dev-db/monetdb"
DEPEND="${RDEPEND}"

S="${WORKDIR}/${MY_P}"

pkg_setup() {
	enewgroup monetdb 61 || die "problem adding 'monetdb' group"
	enewuser monetdb 61 -1 /dev/null monetdb || die "problem adding 'monetdb' user"
}

src_configure() {
	local myconf=

	if use debug; then
		myconf+=" --enable-strict --disable-optimize --enable-debug --enable-assert"
	else
		myconf+=" --disable-strict --disable-debug --disable-assert"
	fi

	# Deal with auto-dependencies
	use curl    && myconf+=" $(use_with curl)"
	use iconv   && myconf+=" $(use_with iconv)"
	use bzip2   && myconf+=" $(use_with bzip2 bz2)"
	use zlib    && myconf+=" $(use_with zlib z)"

	econf ${myconf} || die "econf"
}

src_compile() {
	emake || die "emake"
}

src_install() {
	emake DESTDIR="${D}" install || die "install"

	newinitd "${FILESDIR}"/monetdb.init-5.2.0 monetdb || die "init.d script"
	newconfd "${FILESDIR}"/monetdb.conf-5.2.0 monetdb || die "conf.d file"
	einfo
	einfo "Remember to set a vault password. See /etc/monetdb5.conf."
	einfo "You can start MonetDB/SQL servers by /etc/init.d/monetdb."
	einfo

	if use arm; then
		ewarn
		ewarn "merovingian (the MonetDB manager) behaves quirky,"
		ewarn "therefore the init script may yield an error despite"
		ewarn "the process merovingian having been launched correctly."
		ewarn
	fi

	# prevent binaries from being installed in wrong paths (FHS 2.3)
	rm "${D}"/usr/bin/monetdb-sql-config
	dosbin conf/monetdb-sql-config
	rm "${D}"/usr/bin/monetdb
	dosbin src/backends/monet5/merovingian/monetdb
	rm "${D}"/usr/bin/merovingian
	dosbin src/backends/monet5/merovingian/merovingian

	# remove windows cruft
	find "${D}" -name "*.bat" -exec rm "{}" \; || die "removing windows stuff"
}