summaryrefslogtreecommitdiff
blob: 1ecd1bd9d60a7cb8ed9dcd263a0946ac7086e7c1 (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
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/lsh/lsh-2.0.1-r2.ebuild,v 1.10 2007/12/26 22:25:43 coldwind Exp $

inherit eutils

DESCRIPTION="A GNU implementation of the Secure Shell protocols"
HOMEPAGE="http://www.lysator.liu.se/~nisse/lsh/"
SRC_URI="ftp://ftp.lysator.liu.se/pub/security/lsh/${P}.tar.gz
	http://www.lysator.liu.se/~nisse/archive/${P}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ppc sparc x86"
IUSE="pam tcpd ipv6 zlib X"

RDEPEND="dev-libs/gmp
	dev-libs/liboop
	dev-libs/nettle
	zlib? ( sys-libs/zlib )
	X? ( x11-libs/libXau )
	tcpd? ( sys-apps/tcp-wrappers )
	pam? ( sys-libs/pam )"
#	kerberos? ( virtual/krb5 )
# need guile because the source changes
DEPEND="${RDEPEND}
	dev-scheme/guile"

pkg_setup() {
	if ! built_with_use -a dev-libs/nettle gmp ssl ; then
		eerror "Please rebuild dev-libs/nettle with gmp and ssl"
		eerror "useflags enabled."
		die "dev-libs/nettle needs rebuilding with gmp and ssl useflags"
	fi
}

src_unpack() {
	unpack ${A}
	cd "${S}"
	epatch "${FILESDIR}"/${P}-fix-fd-leak.patch
	# Rename 'sftp-server' to something that doesn't conflict with openssh
	sed -i \
		-e 's:sftp-server:lsh-sftp-server:' \
		doc/{lshd.8,lsh.info} src/lshd.c src/sftp/sftp-server.[c8] \
		|| die "rename sftp-server"
	# remove bundled nettle crap #56156 ... this is pretty ugly sed foo,
	# but the alternative is a bigger, uglier patch which would probably
	# need updating with every version :/
	sed -i -e '/src\/nettle/d' configure || die "sed configure failed"
	sed -i \
		-e '/^SUBDIRS/s:nettle::' \
		-e '/^LDADD/s:nettle/libnettle\.a:-lnettle:' \
		-e 's:nettle/libnettle\.a::' \
		src/Makefile.in || die "sed src failed"
	sed -i \
		-e 's:\.\./\.\./nettle/libnettle\.a::' \
		src/spki/tools/Makefile.in || die "sed spki failed"
	sed -i \
		-e '/^LDADD/s:\.\./nettle/libnettle\.a:-lnettle:' \
		-e 's:\.\./nettle/libnettle\.a::' \
		src/testsuite/Makefile.in || die "sed test failed"
	rm -r src/nettle
}

src_compile() {
	# configure script checks /dev/ptmx in order to enable
	# proper unix pty support ... so lets fake that it works :)
	addpredict /dev/ptmx
#		$(use_enable kerberos)
	econf \
		--disable-kerberos \
		$(use_enable pam) \
		$(use_enable ipv6) \
		$(use_with zlib) \
		$(use_with tcpd tcpwrappers) \
		$(use_with X x) \
		|| die
	emake || die "emake failed"
}

src_install() {
	emake -j1 install DESTDIR="${D}" || die "install failed"
	dodoc ANNOUNCE AUTHORS ChangeLog FAQ NEWS README

	newinitd "${FILESDIR}"/lsh.rc lshd
	newconfd "${FILESDIR}"/lsh.confd lshd

	# cleanup conflicting crap
	mv "${D}"/usr/sbin/{,lsh-}sftp-server || die
	mv "${D}"/usr/share/man/man8/{,lsh-}sftp-server.8
	rm -r "${D}"/usr/share/man/man5
}