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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations) (download)
Mon Jan 24 15:53:27 2011 UTC (9 years, 5 months ago) by jlec
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +1 -1 lines
FILE REMOVED
Removed old

(Portage version: 2.2.0_alpha18/cvs/Linux x86_64)

1 # Copyright 1999-2010 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-r1.ebuild,v 1.3 2010/12/29 15:16:29 jlec Exp $
4
5 EAPI="3"
6 PYTHON_DEPEND="2"
7
8 inherit eutils python toolchain-funcs
9
10 MY_PV="${PV//./_}"
11
12 DESCRIPTION="Computational Crystallography Toolbox"
13 HOMEPAGE="http://cctbx.sourceforge.net/"
14 SRC_URI="http://cci.lbl.gov/cctbx_build/results/${MY_PV}/${PN}_bundle.tar.gz -> ${P}.tar.gz"
15
16 LICENSE="cctbx-2.0"
17 SLOT="0"
18 KEYWORDS="amd64 ~x86 ~amd64-linux ~x86-linux"
19 IUSE="+minimal openmp threads"
20
21 RDEPEND="
22 >dev-libs/boost-1.39
23 sci-libs/clipper
24 sci-libs/fftw
25 !minimal? (
26 sci-chemistry/cns
27 sci-chemistry/shelx )"
28 DEPEND="${RDEPEND}
29 >=dev-util/scons-1.2"
30
31 S="${WORKDIR}"
32 MY_S="${WORKDIR}"/cctbx_sources
33 MY_B="${WORKDIR}"/cctbx_build
34
35 pkg_setup() {
36 if use openmp && ! tc-has-openmp; then
37 ewarn "You are using gcc and OpenMP is only available with gcc >= 4.2 and icc"
38 ewarn "If you want to build ${PN} with OpenMP, abort now,"
39 ewarn "and switch CC to an OpenMP capable compiler"
40 fi
41 python_set_active_version 2
42 }
43
44 src_prepare() {
45 local opts
46 local optsld
47
48 epatch "${FILESDIR}"/${PV}-tst_server.py.patch
49
50 rm -rf "${MY_S}/scons"
51
52 mkdir -p "${MY_S}"/scons/src/ "${MY_S}/boost"
53
54 ln -sf "${EPREFIX}"/usr/$(get_libdir)/scons-* "${MY_S}"/scons/src/engine || die
55
56 # Get CXXFLAGS in format suitable for substitition into SConscript
57 for i in ${CXXFLAGS}; do
58 opts="${opts} \"${i}\","
59 done
60
61 # Strip off the last comma
62 opts=${opts%,}
63
64 # Fix CXXFLAGS
65 sed -i \
66 -e "s:\"-O3\", \"-ffast-math\":${opts}:g" \
67 ${MY_S}/libtbx/SConscript
68
69 # Get LDFLAGS in format suitable for substitition into SConscript
70 for i in ${LDFLAGS}; do
71 optsld="${optsld} \"${i}\","
72 done
73
74 optsld=${optsld%,}
75
76 # Fix LDFLAGS which should be as-needed ready
77 sed -i \
78 -e "s:\"-shared\":\"-shared\", ${optsld}:g" \
79 ${MY_S}/libtbx/SConscript
80 }
81
82 src_configure() {
83 local compiler
84 local myconf
85
86 myconf="${MY_S}/libtbx/configure.py"
87
88 # Get compiler in the right way
89 compiler=$(expr match "$(tc-getCC)" '.*\([a-z]cc\)')
90 myconf="${myconf} --compiler=${compiler}"
91
92 # Precompiling python scripts. It is done in upstreams install script.
93 # Perhaps use python_mod_optimize, but as this script works we should stick to it.
94 $(PYTHON -a) "${MY_S}/libtbx/command_line/py_compile_all.py"
95
96 # Additional USE flag usage
97 check_use openmp
98 myconf="${myconf} --enable-openmp-if-possible=${USE_openmp}"
99
100 use threads && USEthreads="--enable-boost-threads" && \
101 ewarn "If using boost threads openmp support is disabled"
102
103 myconf="${myconf} ${USE_threads} --scan-boost"
104
105 mkdir "${MY_B}" && myconf="${myconf} --current_working_directory=${MY_B}"
106 cd "${MY_B}"
107
108 myconf="${myconf} --build=release fftw3tbx rstbx smtbx mmtbx clipper fable"
109 einfo "configuring with ${python} ${myconf}"
110
111 $(PYTHON -a) ${myconf} \
112 || die "configure failed"
113 }
114
115 src_compile() {
116 local makeopts_exp
117
118 cd "${MY_B}"
119
120 makeopts_exp=${MAKEOPTS/j/j }
121 makeopts_exp=${makeopts_exp%-l[0-9]*}
122
123 source setpaths_all.sh
124
125 einfo "compiling with libtbx.scons ${makeopts_exp}"
126 libtbx.scons ${makeopts_exp} .|| die "make failed"
127 }
128
129 src_test(){
130 source "${MY_B}"/setpaths_all.sh
131 libtbx.python $(libtbx.show_dist_paths boost_adaptbx)/tests/tst_rational.py && \
132 libtbx.python ${SCITBX_DIST}/run_tests.py ${MAKEOPTS_EXP} && \
133 libtbx.python ${CCTBX_DIST}/run_tests.py ${MAKEOPTS_EXP} \
134 || die "test failed"
135 }
136
137 src_install(){
138 # This is what Bill Scott does in the fink package. Do we need this as well?
139 # -e "s:prepend:append:g" \
140
141 find cctbx_build/ -type f \( -name "*.py" -o -name "*sh" \) -exec \
142 sed -e "s:${MY_S}:${EPREFIX}/usr/$(get_libdir)/cctbx/cctbx_sources:g" \
143 -e "s:${MY_B}:${EPREFIX}/usr/$(get_libdir)/cctbx/cctbx_build:g" \
144 -i '{}' \; || die "Fail to correct path"
145
146 ebegin "removing unnessary files"
147 rm -r "${S}"/cctbx_sources/{boost,scons} || die "failed to remove uneeded scons"
148 find "${S}" -type f -name "*conftest*" -delete || die "failed to remove uneeded *.o"
149 find "${S}" -type f -name "*.o" -delete || die "failed to remove uneeded *.o"
150 find "${S}" -type f -name "*.c" -delete || die "failed to remove uneeded *.c"
151 find "${S}" -type f -name "*.f" -delete || die "failed to remove uneeded *.c"
152 find "${S}" -type f -name "*.cpp" -delete || die "failed to remove uneeded *.cpp"
153 find "${S}" -type f -name "*.pyc" -delete || die "failed to remove uneeded *.pyc"
154 find "${S}" -type d -empty -delete || die
155 eend
156
157 insinto /usr/$(get_libdir)/${PN}
158 doins -r cctbx_sources cctbx_build || die
159
160 # fperms cannot handle wildcards
161 chmod 775 "${ED}"/usr/$(get_libdir)/${PN}/cctbx_build/*sh && \
162 chmod 775 "${ED}"/usr/$(get_libdir)/${PN}/cctbx_build/lib/* && \
163 chmod 775 "${ED}"/usr/$(get_libdir)/${PN}/cctbx_build/scitbx/array_family/* && \
164 chmod 775 "${ED}"/usr/$(get_libdir)/${PN}/cctbx_build/scitbx/serialization/* && \
165 chmod 775 "${ED}"/usr/$(get_libdir)/${PN}/cctbx_build/scitbx/error/* && \
166 chmod 775 "${ED}"/usr/$(get_libdir)/${PN}/cctbx_build/scitbx/fftpack/timing/* && \
167 chmod 775 "${ED}"/usr/$(get_libdir)/${PN}/cctbx_build/scitbx/lbfgs/* && \
168 chmod 775 "${ED}"/usr/$(get_libdir)/${PN}/cctbx_build/chiltbx/handle_test && \
169 chmod 775 "${ED}"/usr/$(get_libdir)/${PN}/cctbx_build/bin/* || \
170 die
171
172 insinto /etc/profile.d/
173 newins "${MY_B}"/setpaths.sh 30cctbx.sh || die
174 newins "${MY_B}"/setpaths.csh 30cctbx.csh || die
175
176 cat >> "${T}"/30cctbx <<- EOF
177 LDPATH="${EPREFIX}/usr/$(get_libdir)/${PN}/cctbx_build/lib"
178 EOF
179
180 doenvd "${T}"/30cctbx || die
181 }
182
183 pkg_postinst () {
184 python_need_rebuild
185 python_mod_optimize /usr/$(get_libdir)/${PN}/cctbx_sources
186 }
187
188 pkg_postrm () {
189 python_mod_cleanup /usr/$(get_libdir)/${PN}/cctbx_sources
190 }
191
192 check_use() {
193 for var in $@; do
194 if use ${var}; then
195 printf -v "USE_$var" True
196 else
197 printf -v "USE_$var" False
198 fi
199 shift
200 done
201 }

  ViewVC Help
Powered by ViewVC 1.1.20