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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Sun Feb 14 18:14:34 2010 UTC (10 years, 5 months ago) by jlec
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -1 lines
FILE REMOVED
Workaround for broken python.eclass
(Portage version: 2.2_rc62/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.ebuild,v 1.1 2010/02/04 22:56:26 jlec Exp $
4
5 EAPI="3"
6 PYTHON_DEPEND="2"
7
8 inherit toolchain-funcs python eutils
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="~x86 ~amd64"
19 IUSE="+minimal openmp threads"
20
21 RDEPEND="
22 >dev-libs/boost-1.39
23 sci-libs/fftw
24 !minimal? (
25 sci-chemistry/cns
26 sci-chemistry/shelx )"
27 DEPEND="${RDEPEND}
28 >=dev-util/scons-1.2"
29
30 S="${WORKDIR}"
31 MY_S="${WORKDIR}"/cctbx_sources
32 MY_B="${WORKDIR}"/cctbx_build
33
34 pkg_setup() {
35 if use openmp &&
36 [[ $(tc-getCC)$ == *gcc* ]] &&
37 ( [[ $(gcc-major-version)$(gcc-minor-version) -lt 42 ]] ||
38 ! built_with_use sys-devel/gcc openmp )
39 then
40 ewarn "You are using gcc and OpenMP is only available with gcc >= 4.2 "
41 ewarn "If you want to build ${PN} with OpenMP, abort now,"
42 ewarn "and switch CC to an OpenMP capable compiler"
43 fi
44 }
45
46 src_prepare() {
47 local opts
48 local optsld
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_compile, but as this script works we should stick to it.
94 ${EPREFIX}/usr/bin/python "${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"
109 einfo "configuring with ${python} ${myconf}"
110
111 ${EPREFIX}/usr/bin/python ${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/scons || die "failed to remove uneeded scons"
148 find "${S}" -type f -name "*conftest*" -exec rm -f '{}' \; || die "failed to remove uneeded *.o"
149 find "${S}" -type f -name "*.o" -exec rm -f '{}' \; || die "failed to remove uneeded *.o"
150 find "${S}" -type f -name "*.c" -exec rm -f '{}' \; || die "failed to remove uneeded *.c"
151 find "${S}" -type f -name "*.cpp" -exec rm -f '{}' \; || die "failed to remove uneeded *.cpp"
152 find "${S}" -type f -name "*.pyc" -exec rm -f '{}' \; || die "failed to remove uneeded *.pyc"
153 eend
154
155 insinto /usr/$(get_libdir)/${PN}
156 doins -r cctbx_sources cctbx_build || die
157
158 # fperms cannot handle wildcards
159 chmod 775 "${D}"/usr/$(get_libdir)/${PN}/cctbx_build/*sh && \
160 chmod 775 "${D}"/usr/$(get_libdir)/${PN}/cctbx_build/lib/* && \
161 chmod 775 "${D}"/usr/$(get_libdir)/${PN}/cctbx_build/scitbx/array_family/* && \
162 chmod 775 "${D}"/usr/$(get_libdir)/${PN}/cctbx_build/scitbx/serialization/* && \
163 chmod 775 "${D}"/usr/$(get_libdir)/${PN}/cctbx_build/scitbx/error/* && \
164 chmod 775 "${D}"/usr/$(get_libdir)/${PN}/cctbx_build/scitbx/fftpack/timing/* && \
165 chmod 775 "${D}"/usr/$(get_libdir)/${PN}/cctbx_build/scitbx/lbfgs/* && \
166 chmod 775 "${D}"/usr/$(get_libdir)/${PN}/cctbx_build/chiltbx/handle_test && \
167 chmod 775 "${D}"/usr/$(get_libdir)/${PN}/cctbx_build/bin/* || \
168 die
169
170 insinto /etc/profile.d/
171 newins "${MY_B}"/setpaths.sh 30cctbx.sh || die
172 newins "${MY_B}"/setpaths.csh 30cctbx.csh || die
173
174 cat >> "${T}"/30cctbx <<- EOF
175 LDPATH="${EPREFIX}/usr/$(get_libdir)/${PN}/cctbx_build/lib"
176 EOF
177
178 doenvd "${T}"/30cctbx || die
179 }
180
181 pkg_postinst () {
182 python_need_rebuild
183 python_mod_optimize /usr/$(get_libdir)/${PN}/cctbx_sources
184 }
185
186 pkg_postrm () {
187 python_mod_cleanup /usr/$(get_libdir)/${PN}/cctbx_sources
188 }
189
190 check_use() {
191 for var in $@; do
192 if use ${var}; then
193 printf -v "USE_$var" True
194 else
195 printf -v "USE_$var" False
196 fi
197 shift
198 done
199 }

  ViewVC Help
Powered by ViewVC 1.1.20