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

EAPI=7

inherit autotools

DESCRIPTION="Modular, multithreaded web application server extensible with C++"
HOMEPAGE="http://www.tntnet.org/"
SRC_URI="http://www.tntnet.org/download/${P}.tar.gz"

LICENSE="LGPL-2.1"
SLOT="0"
KEYWORDS="~amd64 ~sparc ~x86"
IUSE="gnutls libressl server ssl examples"

RDEPEND="
	>=dev-libs/cxxtools-2.2.1
	sys-libs/zlib[minizip]
	ssl? (
		gnutls? (
			net-libs/gnutls:0=
			dev-libs/libgcrypt:0
		)
		!gnutls? (
			!libressl? ( dev-libs/openssl:0= )
			libressl? ( dev-libs/libressl:0= )
		)
	)"
DEPEND="${RDEPEND}"
BDEPEND="
	app-arch/zip
	virtual/pkgconfig"

PATCHES=( "${FILESDIR}"/${PN}-2.0-zlib-minizip.patch )

src_prepare() {
	# Both fixed in the next release
	default
	rm framework/common/{ioapi,unzip}.[ch] || die

	# bug 426262
	mv configure.{in,ac} || die

	# bug 423697
	sed -e "s:unzip.h:minizip/unzip.h:" -i framework/defcomp/unzipcomp.cpp || die

	eautoreconf

	sed -i -e 's:@localstatedir@:/var:' etc/tntnet/tntnet.xml.in || die
}

src_configure() {
	# default enabled, will not compile without sdk
	local myconf=( --with-sdk )

	# Prefer gnutls over SSL
	if use gnutls; then
		einfo "Using gnutls for ssl support."
		myconf+=( --with-ssl=gnutls )
	elif use ssl; then
		einfo "Using openssl for ssl support."
		myconf+=( --with-ssl=openssl )
	else
		myconf+=( --with-ssl=no )
	fi

	econf \
		--disable-static \
		$(use_with server) \
		"${myconf[@]}"
}

src_install() {
	default
	dodoc doc/tntnet.pdf

	if use examples; then
		emake -C sdk/demos maintainer-clean
		rm -r sdk/demos/{Makefile*,*/Makefile*,*/*.{la,lo},*/.libs} || die

		docinto examples
		dodoc -r sdk/demos/.
	fi

	if use server; then
		rm -f "${ED}"/etc/init.d/tntnet || die
		newinitd "${FILESDIR}"/tntnet.initd tntnet
	fi

	# bug 737184
	find "${ED}" -name '*.la' -delete || die
}