summaryrefslogtreecommitdiff
blob: 55bcb6fc9de62e4eda3bc43a84225db4067e56a4 (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
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=5

inherit flag-o-matic toolchain-funcs multilib-minimal

DESCRIPTION="high-speed software library for network communication, encryption, decryption, signatures"
HOMEPAGE="http://nacl.cr.yp.to/"
SRC_URI="http://hyperelliptic.org/nacl/${P/0_p}.tar.bz2"

LICENSE="public-domain"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="test"

DEPEND=""
RDEPEND="${DEPEND}"

S=${WORKDIR}/${P/0_p}

MULTILIB_WRAPPED_HEADERS=(
	/usr/include/nacl/cpucycles.h
	/usr/include/nacl/crypto_core_hsalsa20.h
	/usr/include/nacl/crypto_hashblocks_sha256.h
	/usr/include/nacl/crypto_hashblocks_sha512.h
	/usr/include/nacl/crypto_onetimeauth_poly1305.h
	/usr/include/nacl/crypto_scalarmult_curve25519.h
	/usr/include/nacl/crypto_stream_aes128ctr.h
	/usr/include/nacl/crypto_stream_salsa20.h
	/usr/include/nacl/crypto_stream_salsa2012.h
	/usr/include/nacl/crypto_stream_salsa208.h )

src_prepare() {
	#drop useless path elements, verbose output, predictable include dir
	sed -e '/^export/d' \
		-e '/^PATH/d' \
		-e '/^LD_LIBRARY_PATH/d' \
		-e '/^DYLD_LIBRARY_PATH/d' \
		-e '/^exec >/d' \
		-e '/^shorthostname/s:=.*:=gentoo:' \
		-i do || die
	sed -e 's:=== `date` === ::' \
		-i $(find . -name do) || die
	rm -r tests

	multilib_copy_sources

	filter-flags "-O*"
	append-cflags -O3 -fomit-frame-pointer -funroll-loops
	append-cxxflags -O3 -fomit-frame-pointer -funroll-loops
}

multilib_src_configure() {
	echo "$(tc-getCC) ${CFLAGS}" > okcompilers/c
	echo "$(tc-getCXX) ${CXXFLAGS}" > okcompilers/cpp
	echo "$(tc-getAR)" > okcompilers/archivers

	sed -e "1aexport PATH=\"${BUILD_DIR}/build/gentoo/bin:${PATH}\"" \
		-i do || die
}

multilib_src_compile() {
	./do || die
}

multilib_src_install() {
	insinto /usr/$(get_libdir)/${PN}
	doins build/gentoo/lib/*/*

	insinto /usr/include/${PN}
	doins build/gentoo/include/*/*
}