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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (show annotations) (download)
Sat Jan 15 15:17:28 2011 UTC (9 years, 5 months ago) by jlec
Branch: MAIN
CVS Tags: HEAD
Changes since 1.6: +1 -1 lines
FILE REMOVED
Removed old

(Portage version: 2.2.0_alpha15/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-2009.11.01.0123-r1.ebuild,v 1.6 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 rm -rf "${MY_S}/scons"
49
50 mkdir -p "${MY_S}"/scons/src/ "${MY_S}/boost"
51
52 ln -sf "${EPREFIX}"/usr/$(get_libdir)/scons-* "${MY_S}"/scons/src/engine || die
53
54 # Get CXXFLAGS in format suitable for substitition into SConscript
55 for i in ${CXXFLAGS}; do
56 opts="${opts} \"${i}\","
57 done
58
59 # Strip off the last comma
60 opts=${opts%,}
61
62 # Fix CXXFLAGS
63 sed -i \
64 -e "s:\"-O3\", \"-ffast-math\":${opts}:g" \
65 ${MY_S}/libtbx/SConscript
66
67 # Get LDFLAGS in format suitable for substitition into SConscript
68 for i in ${LDFLAGS}; do
69 optsld="${optsld} \"${i}\","
70 done
71
72 optsld=${optsld%,}
73
74 # Fix LDFLAGS which should be as-needed ready
75 sed -i \
76 -e "s:\"-shared\":\"-shared\", ${optsld}:g" \
77 ${MY_S}/libtbx/SConscript
78 }
79
80 src_configure() {
81 local compiler
82 local myconf
83
84 myconf="${MY_S}/libtbx/configure.py"
85
86 # Get compiler in the right way
87 compiler=$(expr match "$(tc-getCC)" '.*\([a-z]cc\)')
88 myconf="${myconf} --compiler=${compiler}"
89
90 # Precompiling python scripts. It is done in upstreams install script.
91 # Perhaps use python_mod_optimize, but as this script works we should stick to it.
92 $(PYTHON -a) "${MY_S}/libtbx/command_line/py_compile_all.py"
93
94 # Additional USE flag usage
95 check_use openmp
96 myconf="${myconf} --enable-openmp-if-possible=${USE_openmp}"
97
98 use threads && USEthreads="--enable-boost-threads" && \
99 ewarn "If using boost threads openmp support is disabled"
100
101 myconf="${myconf} ${USE_threads} --scan-boost"
102
103 mkdir "${MY_B}" && myconf="${myconf} --current_working_directory=${MY_B}"
104 cd "${MY_B}"
105
106 myconf="${myconf} --build=release fftw3tbx rstbx smtbx mmtbx clipper"
107 einfo "configuring with ${python} ${myconf}"
108
109 $(PYTHON -a) ${myconf} \
110 || die "configure failed"
111 }
112
113 src_compile() {
114 local makeopts_exp
115
116 cd "${MY_B}"
117
118 makeopts_exp=${MAKEOPTS/j/j }
119 makeopts_exp=${makeopts_exp%-l[0-9]*}
120
121 source setpaths_all.sh
122
123 einfo "compiling with libtbx.scons ${makeopts_exp}"
124 libtbx.scons ${makeopts_exp} .|| die "make failed"
125 }
126
127 src_test(){
128 source "${MY_B}"/setpaths_all.sh
129 libtbx.python $(libtbx.show_dist_paths boost_adaptbx)/tests/tst_rational.py && \
130 libtbx.python ${SCITBX_DIST}/run_tests.py ${MAKEOPTS_EXP} && \
131 libtbx.python ${CCTBX_DIST}/run_tests.py ${MAKEOPTS_EXP} \
132 || die "test failed"
133 }
134
135 src_install(){
136 # This is what Bill Scott does in the fink package. Do we need this as well?
137 # -e "s:prepend:append:g" \
138
139 find cctbx_build/ -type f \( -name "*.py" -o -name "*sh" \) -exec \
140 sed -e "s:${MY_S}:${EPREFIX}/usr/$(get_libdir)/cctbx/cctbx_sources:g" \
141 -e "s:${MY_B}:${EPREFIX}/usr/$(get_libdir)/cctbx/cctbx_build:g" \
142 -i '{}' \; || die "Fail to correct path"
143
144 ebegin "removing unnessary files"
145 rm -r "${S}"/cctbx_sources/scons || die "failed to remove uneeded scons"
146 find "${S}" -type f -name "*conftest*" -exec rm -f '{}' \; || die "failed to remove uneeded *.o"
147 find "${S}" -type f -name "*.o" -exec rm -f '{}' \; || die "failed to remove uneeded *.o"
148 find "${S}" -type f -name "*.c" -exec rm -f '{}' \; || die "failed to remove uneeded *.c"
149 find "${S}" -type f -name "*.cpp" -exec rm -f '{}' \; || die "failed to remove uneeded *.cpp"
150 find "${S}" -type f -name "*.pyc" -exec rm -f '{}' \; || die "failed to remove uneeded *.pyc"
151 eend
152
153 insinto /usr/$(get_libdir)/${PN}
154 doins -r cctbx_sources cctbx_build || die
155
156 # fperms cannot handle wildcards
157 chmod 775 "${D}"/usr/$(get_libdir)/${PN}/cctbx_build/*sh && \
158 chmod 775 "${D}"/usr/$(get_libdir)/${PN}/cctbx_build/lib/* && \
159 chmod 775 "${D}"/usr/$(get_libdir)/${PN}/cctbx_build/scitbx/array_family/* && \
160 chmod 775 "${D}"/usr/$(get_libdir)/${PN}/cctbx_build/scitbx/serialization/* && \
161 chmod 775 "${D}"/usr/$(get_libdir)/${PN}/cctbx_build/scitbx/error/* && \
162 chmod 775 "${D}"/usr/$(get_libdir)/${PN}/cctbx_build/scitbx/fftpack/timing/* && \
163 chmod 775 "${D}"/usr/$(get_libdir)/${PN}/cctbx_build/scitbx/lbfgs/* && \
164 chmod 775 "${D}"/usr/$(get_libdir)/${PN}/cctbx_build/chiltbx/handle_test && \
165 chmod 775 "${D}"/usr/$(get_libdir)/${PN}/cctbx_build/bin/* || \
166 die
167
168 insinto /etc/profile.d/
169 newins "${MY_B}"/setpaths.sh 30cctbx.sh || die
170 newins "${MY_B}"/setpaths.csh 30cctbx.csh || die
171
172 cat >> "${T}"/30cctbx <<- EOF
173 LDPATH="${EPREFIX}/usr/$(get_libdir)/${PN}/cctbx_build/lib"
174 EOF
175
176 doenvd "${T}"/30cctbx || die
177 }
178
179 pkg_postinst () {
180 python_need_rebuild
181 python_mod_optimize /usr/$(get_libdir)/${PN}/cctbx_sources
182 }
183
184 pkg_postrm () {
185 python_mod_cleanup /usr/$(get_libdir)/${PN}/cctbx_sources
186 }
187
188 check_use() {
189 for var in $@; do
190 if use ${var}; then
191 printf -v "USE_$var" True
192 else
193 printf -v "USE_$var" False
194 fi
195 shift
196 done
197 }

  ViewVC Help
Powered by ViewVC 1.1.20