summaryrefslogtreecommitdiff
blob: d9479c70b7b0829dc9b7b1ac9066426470e24368 (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
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit flag-o-matic toolchain-funcs

DESCRIPTION="Bind sockets to privileged ports without root"
HOMEPAGE="https://www.chiark.greenend.org.uk/ucgi/~ian/git/authbind.git/"
SRC_URI="mirror://debian/pool/main/${PN:0:1}/${PN}/${PN}_${PV}.tar.gz"
S="${WORKDIR}/${PN}"

LICENSE="GPL-2+"
SLOT="0"
KEYWORDS="~amd64"

BDEPEND="virtual/awk"

PATCHES=(
	"${FILESDIR}/${PN}-2.1.2-respect-flags.patch"
)

src_configure() {
	tc-export CC LD

	sed -i \
		-e "s|^prefix=.*|prefix=/usr|" \
		-e "s|^lib_dir=.*|lib_dir=\$(prefix)/$(get_libdir)|" \
		-e "s|^libexec_dir=.*|libexec_dir=\$(prefix)/libexec/authbind|" \
		-e "s|^SHARED_LDFLAGS=.*|SHARED_LDFLAGS=$(raw-ldflags)|" \
		Makefile || die "sed failed"

	sed -i \
		-e 's|/usr/lib|/usr/libexec|' \
		authbind-helper.8 || die "sed failed"
}

src_install() {
	dobin authbind
	doman authbind.1 authbind-helper.8

	local major=$(awk -F= '/MAJOR=/ { print $2 }' Makefile || die)
	ln -s libauthbind.so.* libauthbind.so.${major} || die
	dolib.so libauthbind.so*

	exeinto /usr/libexec/authbind
	exeopts -m4755
	doexe helper

	keepdir /etc/authbind/by{addr,port,uid}

	dodoc debian/changelog
}