summaryrefslogtreecommitdiff
blob: c9e16f935dc5135aa7a0b8dbecb5da736a47ef6e (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
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sci-chemistry/eden/eden-5.3.ebuild,v 1.5 2008/02/15 11:46:17 markusle Exp $

inherit eutils multilib toolchain-funcs

MY_P="${PN}_V${PV}"
DESCRIPTION="A crystallographic real-space electron-density refinement and optimization program"
HOMEPAGE="http://www.edencrystallography.org/"
SRC_URI="http://www.edencrystallography.org/${MY_P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="x86"
IUSE="double-precision bindist"
RDEPEND="=sci-libs/fftw-2*
		!bindist? ( sci-libs/gsl )
		bindist? ( <sci-libs/gsl-1.10 )"

DEPEND="${RDEPEND}"
S="${WORKDIR}/${PN}"
SRC="${S}/source"

src_unpack() {
	unpack ${A}

	epatch "${FILESDIR}"/makefile-fixes.patch

	sed -i \
		-e "s:^\(FFTW.*=\).*:\1 /usr:g" \
		-e "s:^\(LIB.*=.*\$(FFTW)/\).*:\1$(get_libdir):g" \
		-e "s:^\(BIN.*=\).*:\1 ${D}usr/bin:g" \
		-e "s:^\(CFLAGS.*=\).*:\1 ${CFLAGS}:g" \
		${SRC}/Makefile

	if ! use double-precision; then
		sed -i -e "s:^\(DOUBLESWITCH.*=\).*:\1 OFF:g" ${SRC}/Makefile
		EXE="seden"
	else
		EXE="deden"
	fi
}

src_compile() {
	cd ${SRC}
	emake CC=$(tc-getCC) || die "emake failed"
}

src_install() {
	local EDENHOME="/usr/lib/eden"

	cd ${SRC}
	dodir /usr/bin
	make install || die "install failed"

	cd "${S}"
	exeinto ${EDENHOME}/python
	doexe python/*

	insinto ${EDENHOME}/help
	doins help/*

	insinto ${EDENHOME}/tools
	doins tools/*

	dodoc manual/UserManual.pdf

cat << EOF > "${T}"/eden
#!/bin/bash
export EDENHOME="${EDENHOME}"
${EXE} \$*
EOF

	dobin "${T}"/eden

cat << EOF > "${T}"/ieden
#!/bin/bash
export EDENHOME="${EDENHOME}"
\${EDENHOME}/python/eden.py
EOF

	dobin "${T}"/ieden
}