aboutsummaryrefslogtreecommitdiff
blob: 3761537bc1024b192548aba7c314993040e989be (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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

inherit autotools eutils

MY_S_PV=${PV}-${PR}
MY_S_P=${PN}-${MY_S_PV}
MY_PV=${PV}
MY_P=${PN}-${MY_PV}

DESCRIPTION="Crystallographic Object-Oriented Toolkit for model building, completion and validation"
HOMEPAGE="http://www.biop.ox.ac.uk/coot/"
if [[ ${MY_PV} = *pre* ]]; then
	SRC_URI="http://www.biop.ox.ac.uk/coot/software/source/pre-releases/${MY_S_P}.tar.gz"
else
	SRC_URI="http://www.biop.ox.ac.uk/coot/software/source/releases/${MY_P}.tar.gz"
fi
LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""
RDEPEND=">=sci-libs/gsl-1.3
	>=x11-libs/gtk+-2.2
	gnome-base/libgnomecanvas
	=x11-libs/guile-gtk-2.1
	x11-libs/gtkglext
	virtual/glut
	virtual/opengl
	dev-lang/python
	dev-scheme/guile-gui
	dev-scheme/net-http
	dev-scheme/goosh
	dev-scheme/guile-www
	>=dev-scheme/guile-lib-0.1.6
	sci-libs/coot-data
	sci-chemistry/reduce
	sci-chemistry/refmac
	sci-chemistry/probe
	>=sci-libs/ccp4-libs-6.1
	>=sci-libs/clipper-20090210
	dev-python/pygtk
	gnome-base/librsvg
	>=dev-libs/gmp-4.2.2-r2"
DEPEND="${RDEPEND}
	dev-lang/swig"
S="${WORKDIR}/${MY_P}"

src_unpack() {
	unpack ${A}
	cd "${S}"

	# To send upstream
	epatch "${FILESDIR}"/${PV}-gcc-4.3.patch
	epatch "${FILESDIR}"/${PV}-gcc-4.4.patch

	epatch "${FILESDIR}"/${PV}-as-needed.patch
	epatch "${FILESDIR}"/link-against-guile-gtk-properly.patch
	epatch "${FILESDIR}"/fix-namespace-error.patch

	# Link against single-precision fftw
	sed -i \
		-e "s:lfftw:lsfftw:g" \
		-e "s:lrfftw:lsrfftw:g" \
		"${S}"/macros/clipper.m4

	# Fix where it looks for some binaries
	sed -i \
		-e "s:/y/people/emsley/coot/Linux/bin/probe.2.11.050121.linux.RH9:/usr/bin/probe:g" \
		-e "s:/y/people/emsley/coot/Linux/bin/reduce.2.21.030604:/usr/bin/reduce:g" \
		"${S}"/scheme/group-settings.scm

	# Look for clipper slotted with '-2' suffix
#	sed -i \
#		-e "s~\(-lclipper[[:alnum:]-]*\)~\1-2~g" \
#		"${S}"/macros/clipper.m4 \
#		|| die "sed to find -2 slotted libraries failed"
#	grep 'include.*clipper' -rl . \
#		| xargs sed -i \
#			-e "s~\(include.*clipper\)/~\1-2/~g" \
#			|| die "sed to find -2 slotted headers failed"

	# So we don't need to depend on crazy old gtk and friends
	cp "${FILESDIR}"/*.m4 "${S}"/macros/

	cd "${S}"
	eautoreconf
}

src_compile() {
	# All the --with's are used to activate various parts.
	# Yes, this is broken behavior.
	econf \
		--includedir='${prefix}/include/coot' \
		--with-gtkcanvas-prefix=/usr \
		--with-clipper-prefix=/usr \
		--with-mmdb-prefix=/usr \
		--with-ssmlib-prefix=/usr \
		--with-guile \
		--with-python=/usr \
		--with-guile-gtk \
		--with-gtk2 \
		--with-pygtk \
		|| die "econf failed"

	# Regenerate wrappers, otherwise at least gtk-2 build fails
	pushd src
	rm -f coot_wrap_python.cc coot_wrap_python_pre.cc \
		&& emake coot_wrap_python.cc \
		|| die "failed to regenerate python wrapper"

	rm -f coot_wrap_guile.cc coot_wrap_guile_pre.cc \
		&& emake coot_wrap_guile.cc \
		||die "failed to regenerate guile wrapper"
	popd

	emake || die "emake failed"
}

src_install() {
	emake DESTDIR="${D}" install || die "install failed"

	# Install misses this
	insinto /usr/share/coot/python
	doins "${S}"/src/coot.py
}