summaryrefslogtreecommitdiff
blob: 8b4569b7a0fb06434df76e521325cdac89bf735f (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
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-libs/djbfft/djbfft-0.76.ebuild,v 1.4 2004/06/03 16:40:32 agriffis Exp $

inherit eutils flag-o-matic

DESCRIPTION="djbfft is an extremely fast library for floating-point convolution"
HOMEPAGE="http://cr.yp.to/djbfft.html"
SRC_URI="http://cr.yp.to/djbfft/${P}.tar.gz"

SLOT="0"
LICENSE="as-is"
KEYWORDS="~x86 ~amd64"
IUSE="static"

src_unpack() {
	MY_PV="${PV:0:1}.${PV:2:1}.${PV:3:1}" # a.bc -> a.b.c
	MY_D="${D}usr"

	# mask out everything, which is not suggested by the author (RTFM)!
	ALLOWED_FLAGS="-fstack-protector -march -mcpu -pipe -mpreferred-stack-boundary -ffast-math"
	strip-flags

	MY_CFLAGS="$CFLAGS -O1 -fomit-frame-pointer"
	use x86 && MY_CFLAGS="$MY_CFLAGS -malign-double"

	if use static
	then
		LIBPERMS="0644"
		LIBDJBFFT="libdjbfft.a"
	else
		LIBPERMS="0755"
		LIBDJBFFT="libdjbfft.so.${MY_PV}"
	fi

	unpack "${A}"
	cd "${S}"
	epatch "${FILESDIR}/${P}-gcc3.patch"
	epatch "${FILESDIR}/${P}-shared.patch"
	if use static
	then
		echo "$CC $MY_CFLAGS" > "conf-cc"
	else
		echo "$CC $MY_CFLAGS -fPIC -DPIC" > "conf-cc"
	fi
	echo "$CC $LDFLAGS" > "conf-ld"
	echo "${MY_D}" > "conf-home"
	einfo "conf-cc: $(<conf-cc)"
}

src_compile() {
	emake LIBDJBFFT="$LIBDJBFFT" LIBPERMS="$LIBPERMS" || die
}

src_install() {
	make LIBDJBFFT="$LIBDJBFFT" setup check || die
	if ! use static
	then
		ln -snf "${LIBDJBFFT}" "${MY_D}/lib/libdjbfft.so"
		ln -snf "${LIBDJBFFT}" "${MY_D}/lib/libdjbfft.so.${MY_PV%%.*}"
	fi
	dodoc CHANGES README TODO VERSION
}