summaryrefslogtreecommitdiff
path: root/net-libs/kcgi/kcgi-1.0.1.ebuild
blob: a8e9093cc5644a20b49b5c8f471c57a9af729959 (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
# Copyright 2019-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit flag-o-matic toolchain-funcs

DESCRIPTION="Minimal CGI library for web applications"
HOMEPAGE="https://kristaps.bsd.lv/kcgi/"

if [[ ${PV} == 9999 ]]; then
	inherit git-r3
	EGIT_REPO_URI="https://github.com/kristapsdz/${PN}"
else
	SRC_URI="https://kristaps.bsd.lv/${PN}/snapshots/${P}.tgz"
	KEYWORDS="~amd64 ~x86"
fi

LICENSE="ISC"
SLOT="0"
IUSE="debug static-libs test"
RESTRICT="!test? ( test )"

RDEPEND="
	app-crypt/libmd
	dev-libs/libbsd
	virtual/libcrypt:=
	virtual/zlib:=
"
DEPEND="${RDEPEND}
	test? ( net-misc/curl )
"
BDEPEND="
	dev-build/bmake
	virtual/pkgconfig
	kernel_linux? ( sys-kernel/linux-headers )
	test? ( net-misc/curl )
"

# bug 921122
QA_CONFIG_IMPL_DECL_SKIP=( "*" )

src_prepare() {
	default

	# bug 921120
	sed "/CFLAGS=/s/ -g / /" -i configure || die
}

src_configure() {
	tc-export CC AR
	append-cppflags $(usex debug "-DSANDBOX_SECCOMP_DEBUG" "-DNDEBUG")

	# Recommended by upstream
	append-cflags $(pkg-config --cflags libbsd-overlay)
	append-ldflags $(pkg-config --libs libbsd-overlay)

	# note: not an autoconf configure script
	local conf_args=(
		CFLAGS="${CFLAGS}"
		CPPFLAGS="${CPPFLAGS}"
		LDFLAGS="${LDFLAGS}"
		PREFIX="${EPREFIX}/usr"
		MANDIR="${EPREFIX}/usr/share/man"
		LIBDIR="${EPREFIX}/usr/$(get_libdir)"
		SBINDIR="${EPREFIX}/usr/sbin"
	)

	./configure "${conf_args[@]}" || die
}

src_compile() {
	bmake all || die
}

src_test() {
	# TODO: add `afl` tests
	bmake regress || die
}

src_install() {
	bmake DESTDIR="${D}" \
		DATADIR="${EPREFIX}/usr/share/doc/${PF}/examples" \
		install || die

	docompress -x /usr/share/doc/${PF}/examples
	einstalldocs

	# bug 921121
	find "${ED}"/usr/$(get_libdir) -name "*.a" -delete || die
}