summaryrefslogtreecommitdiff
blob: a87c2104420146059bac645eb24dff55bfcbae7f (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
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-libs/xyssl/xyssl-0.9.ebuild,v 1.1 2008/03/29 23:35:06 pylon Exp $

DESCRIPTION="Cryptographic library for embedded systems"
HOMEPAGE="http://xyssl.org/"
SRC_URI="http://xyssl.org/code/download/${P}-gpl.tgz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~ppc ~sparc ~x86"
IUSE="examples sse2"

DEPEND="virtual/libc"

src_compile() {
	cd "${S}/library"
	if use sse2 ; then
		sed -i '15iCFLAGS += -DHAVE_SSE2 -fPIC' Makefile
	else
		sed -i '15iCFLAGS += -fPIC' Makefile
	fi
	emake libxyssl.a || die "emake failed"
	emake libxyssl.so || die "emake failed"

	if use examples ; then
		cd "${S}"/programs
		emake all
	fi
}

src_test() {
	cd "${S}"/programs
	emake test/selftest
	./test/selftest || die "selftest failed"
}

src_install() {
	dodir /usr/include/xyssl
	insinto /usr/include/xyssl
	doins include/xyssl/*.h
	dolib.so library/libxyssl.so
	dolib.a library/libxyssl.a

	if use examples ; then
		for p in programs/*/* ; do
			if [ -x "${p}" ] ; then
				f=xyssl_`basename "${p}"`
				newbin "${p}" "${f}"
			fi
		done
		for e in aes hash pkey ssl test ; do
			docinto "${e}"
			dodoc programs/"${e}"/*.c
			dodoc programs/"${e}"/*.txt
		done
	fi
}