summaryrefslogtreecommitdiff
blob: 121d9f7bdbd2cf43117451b0826422e664937aab (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
94
95
96
97
98
99
100
101
102
103
104
105
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/www-apache/anyterm/anyterm-1.1.8-r2.ebuild,v 1.1 2006/01/25 19:37:10 twp Exp $

inherit apache-module eutils toolchain-funcs webapp

DESCRIPTION="A terminal anywhere"
HOMEPAGE="http://anyterm.org/"
SRC_URI="http://anyterm.org/download/${P}.tbz2"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86"
IUSE="pam ssl opera"
DEPEND="
	dev-libs/boost
	>=dev-libs/rote-0.2.8
	>=sys-devel/gcc-3
	virtual/ssh
	pam? ( net-www/mod_auth_pam )
	"
RDEPEND="${DEPEND}"

APACHE2_MOD_CONF="50_${PN}"
APACHE2_MOD_DEFINE="ANYTERM"
useq ssl && APACHE2_MOD_DEFINE="${APACHE2_MOD_DEFINE} -D SSL"
useq pam && APACHE2_MOD_DEFINE="${APACHE2_MOD_DEFINE} -D AUTH_PAM"
APACHE2_MOD_FILE="${S}/apachemod/.libs/anyterm.so"
DOCFILES="CHANGELOG README"

WEBAPP_MANUAL_SLOT="yes"

need_apache2

pkg_setup() {
	webapp_pkg_setup

	apache-module_pkg_setup

	use ssl && ! built_with_use net-www/apache ssl && \
		eerror "Build net-www/apache with USE=ssl."
	use pam && ! built_with_use net-www/mod_auth_pam apache2 && \
		eerror "Build net-www/mod_auth_pam with USE=apache2."
}

src_unpack() {
	unpack ${A}

	epatch ${FILESDIR}/${P}-apachemod-Makefile.patch
	epatch ${FILESDIR}/${P}-common-extern.patch
	epatch ${FILESDIR}/${P}-browser-gentoo.patch

	# The bundled libpbe causes lots of problems because it links to various
	# assorted packages, without any checks. These packages may or not be
	# installed. Here we disable all packages which are not required.
	epatch ${FILESDIR}/${P}-libpbe-no-pg_config.patch
	for f in Database Recoder jpegsize; do
		rm ${S}/libpbe/src/${f}.{cc,hh}
	done
}

src_compile() {
	( cd apachemod && emake CC=$(tc-getCC) CXX=$(tc-getCXX) ) || die

	# Modify browser files to reflect USE flags.
	for flag in ssl pam opera; do
		if use ${flag}; then
			sed -i -e "s/^#USE=${flag}#//" browser/{*,.htaccess}
			sed -i -e "/^#USE=-${flag}#/D" browser/{*,.htaccess}
		else
			sed -i -e "s/^#USE=-${flag}#//" browser/{*,.htaccess}
			sed -i -e "/^#USE=${flag}#/D" browser/{*,.htaccess}
		fi
	done
}

src_install() {
	apache-module_src_install

	webapp_src_preinst
	cp browser/{*,.htaccess} ${D}/${MY_HTDOCSDIR}
	webapp_postinst_txt en ${FILESDIR}/${P}-postinst-en.txt
	webapp_src_install
}

pkg_postinst() {
	webapp_pkg_postinst

	apache-module_pkg_postinst

	if ! use ssl; then
		ewarn "USE=-ssl:   Anyterm without SSL is very insecure!"
	fi
	if ! use pam; then
		ewarn "USE=-pam:   You will have to add your own authentication"
		ewarn "            mechanism."
	fi
	if use opera; then
	    ewarn "USE=opera:  Be sure to disable some logging in your apache"
		ewarn "            configuration files!"
	fi
	if ! use ssl || ! use pam || use opera; then
		ewarn "For more information see http://anyterm.org/security.html"
	fi
}