summaryrefslogtreecommitdiff
blob: 425c18c7b37e39de2b07d52b654bc63a62b2e9e5 (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
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=5

inherit eutils systemd toolchain-funcs user

DESCRIPTION="A simple, fast work queue"
HOMEPAGE="http://kr.github.io/beanstalkd/"
SRC_URI="https://github.com/kr/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="MIT"
SLOT="0"
KEYWORDS="amd64 ~mips x86 ~sparc-fbsd ~x86-fbsd ~amd64-linux ~x64-macos ~x86-macos"

RDEPEND=""
DEPEND=""

IUSE=""

DOCS=( README News docs/protocol.txt )

pkg_setup() {
	enewuser beanstalk -1 -1 /var/lib/beanstalkd daemon
}

src_prepare() {
	sed -i -e "s/CFLAGS=/CFLAGS?=/" \
		-e "s/LDLIBS/LDFLAGS/" \
		-e "s/LDFLAGS=/LDFLAGS?=/" Makefile
}

src_compile() {
	emake CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" CC="$(tc-getCC)" LD="$(tc-getLD)"
}

src_install() {
	dobin beanstalkd

	DATADIR=/var/lib/${PN}
	dodir ${DATADIR}
	fowners beanstalk:daemon ${DATADIR}

	doman doc/"${PN}".1

	newconfd "${FILESDIR}/conf-1.9" beanstalkd
	newinitd "${FILESDIR}/init-1.9" beanstalkd

	systemd_dounit "${S}/adm/systemd/${PN}".{service,socket}
}