/[gentoo-x86]/sci-libs/cctbx/cctbx-2010.03.29.2334-r6.ebuild
Gentoo

Contents of /sci-libs/cctbx/cctbx-2010.03.29.2334-r6.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (show annotations) (download)
Fri Oct 19 10:36:38 2012 UTC (2 years, 2 months ago) by jlec
Branch: MAIN
Changes since 1.7: +4 -2 lines
sci-libs/cctbx: Remove virtual/fortran and always call fortran-2_pkg_setup as intend by the updated fortran-2.eclass

(Portage version: 2.2.0_alpha141/cvs/Linux x86_64, signed Manifest commit with key 70EB7916)

1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/sci-libs/cctbx/cctbx-2010.03.29.2334-r6.ebuild,v 1.7 2012/10/18 21:38:46 jlec Exp $
4
5 EAPI="3"
6
7 PYTHON_DEPEND="2"
8
9 inherit eutils fortran-2 prefix python toolchain-funcs
10
11 MY_PV="${PV//./_}"
12
13 DESCRIPTION="Computational Crystallography Toolbox"
14 HOMEPAGE="http://cctbx.sourceforge.net/"
15 SRC_URI="http://cci.lbl.gov/cctbx_build/results/${MY_PV}/${PN}_bundle.tar.gz -> ${P}.tar.gz"
16
17 LICENSE="cctbx-2.0"
18 SLOT="0"
19 KEYWORDS="amd64 ~ppc x86 ~amd64-linux ~x86-linux"
20 IUSE="+minimal openmp threads"
21
22 RDEPEND="
23 >=dev-libs/boost-1.48[python]
24 sci-libs/clipper
25 sci-libs/fftw
26 !minimal? (
27 sci-chemistry/cns
28 sci-chemistry/shelx )"
29 DEPEND="${RDEPEND}
30 !prefix? ( >=dev-util/scons-1.2 )"
31
32 S="${WORKDIR}"
33 MY_S="${WORKDIR}"/cctbx_sources
34 MY_B="${WORKDIR}"/cctbx_build
35
36 pkg_setup() {
37 use openmp && FORTRAN_NEED_OPENMP="1"
38 if use openmp && ! tc-has-openmp; then
39 ewarn "You are using gcc and OpenMP is only available with gcc >= 4.2 and icc"
40 ewarn "If you want to build ${PN} with OpenMP, abort now,"
41 ewarn "and switch CC to an OpenMP capable compiler"
42 FORTRAN_NEED_OPENMP=1
43 fi
44 fortran-2_pkg_setup
45 python_set_active_version 2
46 python_pkg_setup
47 }
48
49 src_prepare() {
50 local opts
51 local optsld
52
53 epatch \
54 "${FILESDIR}"/${PV}-tst_server.py.patch \
55 "${FILESDIR}"/${PV}-boost.patch \
56 "${FILESDIR}"/${PV}-clipper.patch \
57 "${FILESDIR}"/${PV}-flags.patch \
58 "${FILESDIR}"/${PV}-soname.patch \
59 "${FILESDIR}"/${PV}-gcc-4.6.patch \
60 "${FILESDIR}"/${PV}-gcc-4.7.patch
61
62 eprefixify "${MY_S}"/scitbx/libtbx_refresh.py
63
64 rm -rf "${MY_S}/boost" "${MY_S}/PyCifRW" || die
65 if ! use prefix; then
66 rm -rvf "${MY_S}/scons"
67 echo "import os, sys; os.execvp('scons', sys.argv)" > "${MY_S}"/libtbx/command_line/scons.py
68 fi
69
70 find "${MY_S}/clipper" -name "*.h" -delete || die
71
72 sed \
73 -e "/LIBS/s:boost_python:boost_python-${PYTHON_ABI}:g" \
74 -i "${MY_S}"/boost_adaptbx/SConscript "${MY_S}"/scitbx/boost_python/SConscript || die
75 }
76
77 src_configure() {
78 local compiler
79 local myconf
80
81 myconf="${MY_S}/libtbx/configure.py"
82
83 compiler=$(expr match "$(tc-getCC)" '.*\([a-z]cc\)')
84 myconf="${myconf} --compiler=${compiler}"
85
86 # Additional USE flag usage
87 check_use openmp
88 myconf="${myconf} --enable-openmp-if-possible=${USE_openmp}"
89
90 use threads && USEthreads="--enable-boost-threads" && \
91 ewarn "If using boost threads openmp support is disabled"
92
93 myconf="${myconf} ${USE_threads} --scan-boost --use_environment_flags"
94
95 mkdir "${MY_B}" && myconf="${myconf} --current_working_directory=${MY_B}"
96 cd "${MY_B}"
97
98 myconf="${myconf} --build=release fftw3tbx rstbx smtbx mmtbx clipper_adaptbx fable"
99 einfo "configuring with ${python} ${myconf}"
100
101 $(PYTHON) ${myconf} || die "configure failed"
102 }
103
104 src_compile() {
105 local makeopts_exp
106
107 cd "${MY_B}"
108
109 makeopts_exp=${MAKEOPTS/j/j }
110 makeopts_exp=${makeopts_exp%-l[0-9]*}
111
112 source setpaths_all.sh
113
114 einfo "compiling with libtbx.scons ${makeopts_exp}"
115 libtbx.scons ${makeopts_exp} .|| die "make failed"
116 }
117
118 src_test(){
119 source "${MY_B}"/setpaths_all.sh
120 libtbx.python $(libtbx.show_dist_paths boost_adaptbx)/tests/tst_rational.py && \
121 libtbx.python ${SCITBX_DIST}/run_tests.py ${MAKEOPTS_EXP} && \
122 libtbx.python ${CCTBX_DIST}/run_tests.py ${MAKEOPTS_EXP} \
123 || die "test failed"
124 }
125
126 src_install(){
127 local lib baselib
128 # find cctbx_build/ -type f \( -name "*.py" -o -name "*sh" \) -exec \
129 # sed -e "s:${MY_S}:${EPREFIX}/usr/$(get_libdir)/cctbx/cctbx_sources:g" \
130 # -e "s:${MY_B}:${EPREFIX}/usr/$(get_libdir)/cctbx/cctbx_build:g" \
131 # -i '{}' \; || die "Fail to correct path"
132
133 sed \
134 -e "s:${MY_B}:${EPREFIX}/usr:g" \
135 -e "s:${MY_S}:${EPREFIX}/$(python_get_sitedir):g" \
136 -i "${MY_B}/libtbx_env" || die
137
138 insinto /usr/share/cctbx
139 doins "${MY_B}/libtbx_env" || die
140
141 ebegin "removing unnessary files"
142 rm -r "${S}"/cctbx_sources/{clipper,ccp4io,ucs-fonts,TAG} || die "failed to remove uneeded scons"
143 find -O3 "${S}" -type f \
144 \( -name "*conftest*" -o -name "*.o" -o -name "*.c" -o -name "*.f" -o -name "*.cpp" -o \
145 -name "*.pyc" -o -name "SCons*" -o -name "Makefile" -o -name "config.log" \) -delete || die
146 find "${S}" -type d -empty -delete || die
147 find "${MY_B}" -maxdepth 1 -type f -delete || die
148 eend
149
150 dobin "${MY_B}"/bin/* || die
151 rm -rf "${MY_B}/bin"
152 dolib.so "${MY_B}"/lib/lib* || die
153 mv "${ED}"/usr/$(get_libdir)/libscitbx_min{,i}pack.so || die
154 rm -f "${MY_B}"/lib/lib*
155
156 for lib in "${ED}"/usr/$(get_libdir)/*.so; do
157 baselib=$(basename ${lib})
158 mv ${lib}{,.0.0}
159 dosym ${baselib}.0.0 /usr/$(get_libdir)/${baselib}
160 done
161
162 insinto /usr/include
163 doins -r "${MY_B}"/include/* || die
164 rm -rf "${MY_B}/include"
165
166 insinto /usr/libexec/${PN}
167 doins -r "${MY_B}"/* || die
168 find "${ED}"/usr/libexec/${PN} -type f -exec chmod 755 '{}' \;
169
170 cd "${MY_S}"
171 insinto $(python_get_sitedir)
172 doins -r * || die
173 exeinto $(python_get_sitedir)
174 doexe "${MY_B}"/lib/* || die
175 rm -rf "${MY_B}/lib"
176
177 sed \
178 -e "/PYTHONPATH/s:${MY_S}:$(python_get_sitedir):g" \
179 -e "/PYTHONPATH/s:${MY_B}:$(python_get_sitedir):g" \
180 -e "/LD_LIBRARY_PATH/s:${MY_B}/lib:${EPREFIX}/usr/$(get_libdir):g" \
181 -e "/PATH/s:${MY_B}/bin:${EPREFIX}/usr/bin:g" \
182 -e "/PATH/s:${MY_B}/exe:${EPREFIX}/usr/bin:g" \
183 -e "/exec/s:${MY_S}:$(python_get_sitedir):g" \
184 -e "/LIBTBX_BUILD/s:${MY_B}:${EPREFIX}/usr/share/cctbx:g" \
185 -e "s:${MY_B}/exe_dev/:${EPREFIX}/usr/libexec/${PN}/exe_dev/:g" \
186 -i "${ED}"/usr/bin/* || die
187
188 }
189
190 pkg_postinst () {
191 python_mod_optimize boost_adaptbx cbflib_adaptbx ccp4io_adaptbx cctbx chiltbx clipper_adaptbx crys3d fable fftw3tbx gltbx iotbx libtbx mmtbx omptbx rstbx scitbx smtbx spotfinder tntbx
192 }
193
194 pkg_postrm () {
195 python_mod_cleanup boost_adaptbx cbflib_adaptbx ccp4io_adaptbx cctbx chiltbx clipper_adaptbx crys3d fable fftw3tbx gltbx iotbx libtbx mmtbx omptbx rstbx scitbx smtbx spotfinder tntbx
196 }
197
198 check_use() {
199 for var in $@; do
200 if use ${var}; then
201 printf -v "USE_$var" True
202 else
203 printf -v "USE_$var" False
204 fi
205 shift
206 done
207 }

  ViewVC Help
Powered by ViewVC 1.1.20