Use https by default
[gentoo.git] / sci-chemistry / ccpn / ccpn-2.4.1_p150226.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=5
6
7 PYTHON_COMPAT=( python2_7 )
8 PYTHON_REQ_USE="ssl,tk"
9
10 inherit eutils flag-o-matic multilib portability python-single-r1 toolchain-funcs versionator
11
12 PATCHSET="${PV##*_p}"
13 MY_PN="${PN}mr"
14 MY_PV="$(replace_version_separator 3 _ ${PV%%_p*})"
15 MY_MAJOR="$(get_version_component_range 1-3)"
16
17 DESCRIPTION="The Collaborative Computing Project for NMR"
18 HOMEPAGE="http://www.ccpn.ac.uk/ccpn"
19 SRC_URI="http://www-old.ccpn.ac.uk/download/${MY_PN}/analysis${MY_PV}.tar.gz"
20 [[ -n ${PATCHSET} ]] \
21         && SRC_URI+=" https://dev.gentoo.org/~jlec/distfiles/ccpn-update-${MY_MAJOR}-${PATCHSET}.patch.xz"
22
23 SLOT="0"
24 LICENSE="|| ( CCPN LGPL-2.1 )"
25 KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
26 IUSE="+opengl"
27
28 REQUIRED_USE="${PYTHON_REQUIRED_USE}"
29
30 RDEPEND="
31         ${PYTHON_DEPS}
32         dev-lang/tk:0=[threads]
33         dev-python/numpy[${PYTHON_USEDEP}]
34         dev-tcltk/tix
35         =sci-libs/ccpn-data-"${MY_MAJOR}"*[${PYTHON_USEDEP}]
36         sci-biology/psipred
37         x11-libs/libXext
38         x11-libs/libX11
39         opengl? (
40                 media-libs/freeglut
41                 dev-python/pyglet[${PYTHON_USEDEP}]
42                 )"
43 DEPEND="${RDEPEND}"
44
45 RESTRICT="mirror"
46
47 S="${WORKDIR}"/${MY_PN}/${MY_PN}$(get_version_component_range 1-2)
48
49 src_prepare() {
50         [[ -n ${PATCHSET} ]] && \
51                 EPATCH_OPTS="-p2" epatch "${WORKDIR}"/ccpn-update-${MY_MAJOR}-${PATCHSET}.patch
52
53         epatch "${FILESDIR}"/2.3.1-parallel.patch
54
55         append-lfs-flags
56
57         sed \
58                 -e "/PSIPRED_DIR/s:'data':'share/psipred/data':g" \
59                 -e "s:weights_s:weights:g" \
60                 -i python/ccpnmr/analysis/wrappers/Psipred.py || die
61
62         local tk_ver
63         local myconf
64
65         tk_ver="$(best_version dev-lang/tk | cut -d- -f3 | cut -d. -f1,2)"
66
67         if use opengl; then
68                 GLUT_NEED_INIT="-DNEED_GLUT_INIT"
69                 IGNORE_GL_FLAG=""
70                 GL_FLAG="-DUSE_GL_TRUE"
71                 GL_DIR="${EPREFIX}/usr"
72                 GL_LIB="-lglut -lGLU -lGL"
73                 GL_INCLUDE_FLAGS="-I\$(GL_DIR)/include"
74                 GL_LIB_FLAGS=""
75         else
76                 IGNORE_GL_FLAG="-DIGNORE_GL"
77                 GL_FLAG="-DUSE_GL_FALSE"
78         fi
79
80         GLUT_NOT_IN_GL=""
81         GLUT_FLAG="\$(GLUT_NEED_INIT) \$(GLUT_NOT_IN_GL)"
82
83         rm -rf data model doc license || die
84
85         sed \
86                 -e "s|/usr|${EPREFIX}/usr|g" \
87                 -e "s|^\(CC =\).*|\1 $(tc-getCC)|g" \
88                 -e "s|^\(OPT_FLAG =\).*|\1 ${CPPFLAGS} ${CFLAGS}|g" \
89                 -e "s|^\(LINK_FLAGS =.*\)|\1 ${LDFLAGS}|g" \
90                 -e "s|^\(IGNORE_GL_FLAG =\).*|\1 ${IGNORE_GL_FLAG}|g" \
91                 -e "s|^\(GL_FLAG =\).*|\1 ${GL_FLAG}|g" \
92                 -e "s|^\(GL_DIR =\).*|\1 ${GL_DIR}|g" \
93                 -e "s|^\(GL_LIB =\).*|\1 ${GL_LIB}|g" \
94                 -e "s|^\(GL_LIB_FLAGS =\).*|\1 ${GL_LIB_FLAGS}|g" \
95                 -e "s|^\(GL_INCLUDE_FLAGS =\).*|\1 ${GL_INCLUDE_FLAGS}|g" \
96                 -e "s|^\(GLUT_NEED_INIT =\).*|\1 ${GLUT_NEED_INIT}|g" \
97                 -e "s|^\(GLUT_NOT_IN_GL =\).*|\1|g" \
98                 -e "s|^\(X11_LIB_FLAGS =\).*|\1 -L${EPREFIX}/usr/$(get_libdir)|g" \
99                 -e "s|^\(TCL_LIB_FLAGS =\).*|\1 -L${EPREFIX}/usr/$(get_libdir)|g" \
100                 -e "s|^\(TK_LIB =\).*|\1 -ltk|g" \
101                 -e "s|^\(TK_LIB_FLAGS =\).*|\1 -L${EPREFIX}/usr/$(get_libdir)|g" \
102                 -e "s|^\(PYTHON_INCLUDE_FLAGS =\).*|\1 -I$(python_get_includedir)|g" \
103                 -e "s|^\(PYTHON_LIB =\).*|\1 -l${EPYTHON}|g" \
104                 c/environment_default.txt > c/environment.txt || die
105
106         sed \
107                 -e 's:ln -s:cp -f:g' \
108                 -i $(find python -name linkSharedObjs) || die
109 }
110
111 src_compile() {
112         emake -C c all
113         emake -C c links
114 }
115
116 src_install() {
117         local libdir
118         local tkver
119         local _wrapper
120
121         find . -name "*.pyc" -type f -delete || die
122
123         libdir=$(get_libdir)
124         tkver=$(best_version dev-lang/tk | cut -d- -f3 | cut -d. -f1,2)
125
126         _wrapper="analysis dangle dataShifter depositionFileImporter eci formatConverter pipe2azara xeasy2azara extendNmr"
127         for wrapper in ${_wrapper}; do
128                 sed \
129                         -e "s|gentoo_sitedir|$(python_get_sitedir)|g" \
130                         -e "s|gentoolibdir|${EPREFIX}/usr/${libdir}|g" \
131                         -e "s|gentootk|${EPREFIX}/usr/${libdir}/tk${tkver}|g" \
132                         -e "s|gentootcl|${EPREFIX}/usr/${libdir}/tclk${tkver}|g" \
133                         -e "s|gentoopython|${EPYTHON}|g" \
134                         -e "s|gentoousr|${EPREFIX}/usr|g" \
135                         -e "s|//|/|g" \
136                         "${FILESDIR}"/${wrapper} > "${T}"/${wrapper} || die "Fail fix ${wrapper}"
137                 dobin "${T}"/${wrapper}
138         done
139
140         local in_path=$(python_get_sitedir)/${PN}
141         local files
142         local pydocs
143
144         pydocs="$(find python -name doc -type d)"
145         rm -rf ${pydocs} || die
146
147         for i in python/memops/format/compatibility/{Converters,part2/Converters2}.py; do
148         sed \
149                 -e 's|#from __future__|from __future__|g' \
150                 -i ${i} || die
151         done
152
153         dodir ${in_path#${EPREFIX}}/c
154
155         ebegin "Installing main files"
156                 python_moduleinto ${PN}
157                 python_domodule python
158         eend
159
160         ebegin "Adjusting permissions"
161         for _file in $(find "${ED}" -type f -name "*so"); do
162                 chmod 755 ${_file}
163         done
164         eend
165         python_optimize
166 }