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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (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.4: +1 -1 lines
FILE REMOVED
Removed old

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

1 # Copyright 1999-2011 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-r2.ebuild,v 1.4 2011/01/15 14:44:16 jlec Exp $
4
5 EAPI="3"
6
7 PYTHON_DEPEND="2"
8
9 inherit eutils 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 ~x86 ~amd64-linux ~x86-linux"
20 IUSE="+minimal openmp threads"
21
22 RDEPEND="
23 >dev-libs/boost-1.39
24 sci-libs/clipper
25 sci-libs/fftw
26 !minimal? (
27 sci-chemistry/cns
28 sci-chemistry/shelx )"
29 DEPEND="${RDEPEND}
30 >=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 if use openmp && ! tc-has-openmp; then
38 ewarn "You are using gcc and OpenMP is only available with gcc >= 4.2 and icc"
39 ewarn "If you want to build ${PN} with OpenMP, abort now,"
40 ewarn "and switch CC to an OpenMP capable compiler"
41 fi
42 python_set_active_version 2
43 }
44
45 src_prepare() {
46 local opts
47 local optsld
48
49 epatch \
50 "${FILESDIR}"/${PV}-tst_server.py.patch \
51 "${FILESDIR}"/${PV}-boost.patch \
52 "${FILESDIR}"/${PV}-clipper.patch \
53 "${FILESDIR}"/${PV}-flags.patch \
54 "${FILESDIR}"/${PV}-soname.patch
55
56 eprefixify "${MY_S}"/scitbx/libtbx_refresh.py
57
58 rm -rf "${MY_S}/scons" "${MY_S}/boost" "${MY_S}/PyCifRW"
59 find "${MY_S}/clipper" -name "*.h" -delete
60
61 echo "import os, sys; os.execvp('scons', sys.argv)" > "${MY_S}"/libtbx/command_line/scons.py
62 }
63
64 src_configure() {
65 local compiler
66 local myconf
67
68 myconf="${MY_S}/libtbx/configure.py"
69
70 compiler=$(expr match "$(tc-getCC)" '.*\([a-z]cc\)')
71 myconf="${myconf} --compiler=${compiler}"
72
73 # Additional USE flag usage
74 check_use openmp
75 myconf="${myconf} --enable-openmp-if-possible=${USE_openmp}"
76
77 use threads && USEthreads="--enable-boost-threads" && \
78 ewarn "If using boost threads openmp support is disabled"
79
80 myconf="${myconf} ${USE_threads} --scan-boost --use_environment_flags"
81
82 mkdir "${MY_B}" && myconf="${myconf} --current_working_directory=${MY_B}"
83 cd "${MY_B}"
84
85 myconf="${myconf} --build=release fftw3tbx rstbx smtbx mmtbx clipper_adaptbx fable"
86 einfo "configuring with ${python} ${myconf}"
87
88 $(PYTHON) ${myconf} || die "configure failed"
89 }
90
91 src_compile() {
92 local makeopts_exp
93
94 cd "${MY_B}"
95
96 makeopts_exp=${MAKEOPTS/j/j }
97 makeopts_exp=${makeopts_exp%-l[0-9]*}
98
99 source setpaths_all.sh
100
101 einfo "compiling with libtbx.scons ${makeopts_exp}"
102 libtbx.scons ${makeopts_exp} .|| die "make failed"
103 }
104
105 src_test(){
106 source "${MY_B}"/setpaths_all.sh
107 libtbx.python $(libtbx.show_dist_paths boost_adaptbx)/tests/tst_rational.py && \
108 libtbx.python ${SCITBX_DIST}/run_tests.py ${MAKEOPTS_EXP} && \
109 libtbx.python ${CCTBX_DIST}/run_tests.py ${MAKEOPTS_EXP} \
110 || die "test failed"
111 }
112
113 src_install(){
114 # find cctbx_build/ -type f \( -name "*.py" -o -name "*sh" \) -exec \
115 # sed -e "s:${MY_S}:${EPREFIX}/usr/$(get_libdir)/cctbx/cctbx_sources:g" \
116 # -e "s:${MY_B}:${EPREFIX}/usr/$(get_libdir)/cctbx/cctbx_build:g" \
117 # -i '{}' \; || die "Fail to correct path"
118
119 ebegin "removing unnessary files"
120 rm -r "${S}"/cctbx_sources/{clipper,ccp4io,ucs-fonts,TAG} || die "failed to remove uneeded scons"
121 find "${S}" -type f -name "*conftest*" -delete || die "failed to remove uneeded *.o"
122 find "${S}" -type f -name "*.o" -delete || die "failed to remove uneeded *.o"
123 find "${S}" -type f -name "*.c" -delete || die "failed to remove uneeded *.c"
124 find "${S}" -type f -name "*.f" -delete || die "failed to remove uneeded *.c"
125 find "${S}" -type f -name "*.cpp" -delete || die "failed to remove uneeded *.cpp"
126 find "${S}" -type f -name "*.pyc" -delete || die "failed to remove uneeded *.pyc"
127 find "${S}" -type f -name "SCons*" -delete || die "failed to remove uneeded *.pyc"
128 find "${S}" -type f -name "Makefile" -delete || die "failed to remove uneeded *.pyc"
129 find "${S}" -type f -name "config.log" -delete || die "failed to remove uneeded *.pyc"
130 find "${S}" -type d -empty -delete || die
131 find ${MY_B} -maxdepth 1 -type f
132 find ${MY_B} -maxdepth 1 -type f -delete
133 eend
134
135 dobin ${MY_B}/bin/* || die
136 rm -rf ${MY_B}/bin
137 dolib.so ${MY_B}/lib/lib* || die
138 rm -f ${MY_B}/lib/lib*
139
140 insinto /usr/include
141 doins -r ${MY_B}/include/* || die
142 rm -rf ${MY_B}/include
143
144 insinto /usr/libexec/${PN}
145 doins -r ${MY_B}/* || die
146 find "${ED}"/usr/libexec/${PN} -type f -exec chmod 755 '{}' \;
147
148 cd ${MY_S}
149 insinto $(python_get_sitedir)
150 doins -r * || die
151 exeinto $(python_get_sitedir)
152 doexe ${MY_B}/lib/* || die
153 rm -rvf ${MY_B}/lib
154
155 sed \
156 -e "/PYTHONPATH/s:${MY_S}:$(python_get_sitedir):g" \
157 -e "/PYTHONPATH/s:${MY_B}:$(python_get_sitedir):g" \
158 -e "/LD_LIBRARY_PATH/s:${MY_B}/lib:${EPREFIX}/usr/$(get_libdir):g" \
159 -e "/PATH/s:${MY_B}/bin:${EPREFIX}/usr/bin:g" \
160 -e "/PATH/s:${MY_B}/exe:${EPREFIX}/usr/bin:g" \
161 -e "/exec/s:${MY_S}:$(python_get_sitedir):g" \
162 -e "/LIBTBX_BUILD/s:${MY_B}:/usr:g" \
163 -i "${ED}"/usr/bin/* || die
164
165 }
166
167 pkg_postinst () {
168 python_need_rebuild
169 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
170 }
171
172 pkg_postrm () {
173 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
174 }
175
176 check_use() {
177 for var in $@; do
178 if use ${var}; then
179 printf -v "USE_$var" True
180 else
181 printf -v "USE_$var" False
182 fi
183 shift
184 done
185 }

  ViewVC Help
Powered by ViewVC 1.1.20