c066b0e0f587625731399ed7b1653ad9e3a31535
[gentoo.git] / dev-db / drizzle / drizzle-7.2.4.ebuild
1 # Copyright 1999-2014 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6
7 inherit python flag-o-matic libtool autotools eutils pam user versionator
8
9 MY_P="${P}-alpha"
10 S="${WORKDIR}/${MY_P}"
11
12 DESCRIPTION="Database optimized for Cloud and Net applications"
13 HOMEPAGE="http://drizzle.org"
14 SRC_URI="https://launchpad.net/drizzle/$(get_version_component_range 1-2)/${PV}/+download/${MY_P}.tar.gz"
15
16 LICENSE="GPL-2"
17 SLOT="0"
18 KEYWORDS="~amd64 ~x86"
19 IUSE="debug tcmalloc doc memcache curl pam gearman +md5 ldap v8"
20
21 RDEPEND="tcmalloc? ( dev-util/google-perftools )
22                 sys-libs/readline
23                 sys-apps/util-linux
24                 dev-libs/libpcre
25                 dev-libs/openssl
26                 >=dev-libs/libevent-1.4
27                 >=dev-libs/protobuf-2.1.0
28                 dev-libs/libaio
29                 >=dev-libs/boost-1.52.0-r1:=[threads]
30                 gearman? ( >=sys-cluster/gearmand-0.12 )
31                 pam? ( sys-libs/pam )
32                 curl? ( net-misc/curl )
33                 memcache? ( >=dev-libs/libmemcached-0.39 )
34                 md5? ( >=dev-libs/libgcrypt-1.4.2:0 )
35                 ldap? ( net-nds/openldap )
36                 v8? ( dev-lang/v8 )
37                 !dev-db/libdrizzle"
38
39 DEPEND="${RDEPEND}
40                 =dev-lang/python-2*
41                 sys-devel/gettext
42                 dev-util/intltool
43                 dev-util/gperf
44                 sys-devel/flex
45                 dev-python/sphinx
46                 doc? ( app-doc/doxygen )"
47
48 pkg_setup() {
49         enewuser drizzle -1 -1 /dev/null nogroup
50         python_set_active_version 2
51         python_pkg_setup
52 }
53
54 src_prepare() {
55         epatch \
56                 "${FILESDIR}/${PN}-7.2.3-libtool.patch" \
57                 "${FILESDIR}/${PN}-7.2.3+automake-1.12.patch" \
58                 "${FILESDIR}/${PN}-7.2.4+boost-1.50.patch" \
59                 "${FILESDIR}/${P}-fix-boost_thread-detection.patch"
60
61         python_convert_shebangs -r 2 .
62
63         epatch_user
64         eautoreconf
65 }
66
67 src_configure() {
68         local myconf=
69
70         if use debug; then
71                 append-cppflags -DDEBUG
72         fi
73
74         # while I applaud upstreams goal of 0 compiler warnings
75         # the 1412 release didn't achieve it.
76         append-flags -Wno-error
77
78         # NOTE disable-all and without-all no longer recognized options
79         # NOTE using --enable on some plugins can cause test failures.
80         # --with should be used instead. A discussion about this here:
81         # https://bugs.launchpad.net/drizzle/+bug/598659
82         # TODO (upstream)
83         # $(use_with memcache memcached-stats-plugin) \
84         # $(use_with memcache memcached-functions-plugin) \
85
86         econf \
87                 --disable-static \
88                 --disable-dependency-tracking \
89                 --disable-mtmalloc \
90                 --without-hello-world-plugin \
91                 --disable-rabbitmq-plugin --without-rabbitmq-plugin \
92                 --disable-zeromq-plugin --without-zeromq-plugin \
93                 --with-auth-test-plugin \
94                 --with-auth-file-plugin \
95                 --with-simple-user-policy-plugin \
96                 --enable-logging-stats-plugin \
97                 --with-logging-stats-plugin \
98                 --enable-console-plugin \
99                 $(use_enable gearman libgearman) \
100                 $(use_enable ldap libldap) \
101                 $(use_enable memcache libmemcached) \
102                 $(use_enable tcmalloc) \
103                 $(use_with curl auth-http-plugin) \
104                 $(use_with gearman gearman-udf-plugin) \
105                 $(use_with gearman logging-gearman-plugin) \
106                 $(use_with ldap auth-ldap-plugin) \
107                 $(use_with md5 md5-plugin) \
108                 $(use_with pam auth-pam-plugin) \
109                 $(use_with v8 js-plugin) \
110                 ${myconf}
111 }
112
113 src_compile() {
114         emake V=1 all $(use doc && echo doxygen)
115 }
116
117 # currently not working as of 7.2.3
118 RESTRICT=test
119
120 src_test() {
121         if [[ ${EUID} == 0 ]]; then
122                 eerror "You cannot run tests as root."
123                 eerror "Please enable FEATURES=userpriv before proceeding."
124                 return 1
125         fi
126
127         default
128 }
129
130 DOCS=( AUTHORS NEWS README )
131
132 src_install() {
133         default
134
135         find "${D}" -name '*.la' -delete || die
136
137         if use doc; then
138                 docinto apidoc
139                 pushd docs/html
140                 dohtml -r .
141                 popd
142         fi
143
144         newinitd "${FILESDIR}"/drizzle.init.d.2 drizzled
145         newconfd "${FILESDIR}"/drizzle.conf.d drizzled
146
147         if ! use gearman; then
148                 sed -i -e '/need gearmand/d' "${D}"/etc/init.d/drizzled \
149                         || die "unable to sed init script (gearman)"
150         fi
151
152         if ! use memcache; then
153                 sed -i -e '/need memcached/d' "${D}"/etc/init.d/drizzled \
154                         || die "unable to sed init script (memcache)"
155         fi
156
157         keepdir /var/log/drizzle
158         keepdir /var/lib/drizzle/drizzled
159         keepdir /etc/drizzle
160
161         fperms 0755 /var/log/drizzle
162         fperms -R 0700 /var/lib/drizzle
163
164         fowners drizzle:nogroup /var/log/drizzle
165         fowners -R drizzle:nogroup /var/lib/drizzle
166
167         pamd_mimic system-auth drizzle auth account session
168 }