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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (show annotations) (download)
Thu Aug 6 13:05:31 2015 UTC (4 years, 11 months ago) by jlec
Branch: MAIN
CVS Tags: HEAD
Changes since 1.7: +3 -2 lines
Fix for format-security, bug #547082

Signed-off-by: Justin Lecher <jlec@gentoo.org>
(Portage version: 2.2.20/cvs/Linux x86_64, signed Manifest commit with key E9402A79B03529A2!)

1 # Copyright 1999-2015 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-r7.ebuild,v 1.7 2015/04/21 17:50:14 pacho Exp $
4
5 EAPI=5
6
7 PYTHON_COMPAT=( python2_7 )
8
9 inherit eutils fortran-2 multilib prefix python-single-r1 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 REQUIRED_USE="
23 ${PYTHON_REQUIRED_USE}
24 ?? ( openmp threads )"
25
26 RDEPEND="
27 ${PYTHON_DEPS}
28 >=dev-libs/boost-1.48[python,${PYTHON_USEDEP}]
29 sci-libs/clipper
30 sci-libs/fftw:3.0=
31 !minimal? (
32 sci-chemistry/cns
33 sci-chemistry/shelx )"
34 DEPEND="${RDEPEND}
35 !prefix? ( >=dev-util/scons-1.2[${PYTHON_USEDEP}] )"
36
37 S="${WORKDIR}"
38 MY_S="${WORKDIR}"/cctbx_sources
39 MY_B="${WORKDIR}"/cctbx_build
40
41 pkg_setup() {
42 use openmp && FORTRAN_NEED_OPENMP="1"
43 if use openmp && ! tc-has-openmp; then
44 ewarn "You are using gcc and OpenMP is only available with gcc >= 4.2 and icc"
45 ewarn "If you want to build ${PN} with OpenMP, abort now,"
46 ewarn "and switch CC to an OpenMP capable compiler"
47 FORTRAN_NEED_OPENMP=1
48 fi
49 fortran-2_pkg_setup
50 python-single-r1_pkg_setup
51 }
52
53 src_prepare() {
54 local opts
55 local optsld
56
57 epatch \
58 "${FILESDIR}"/${PV}-tst_server.py.patch \
59 "${FILESDIR}"/${PV}-boost.patch \
60 "${FILESDIR}"/${PV}-clipper.patch \
61 "${FILESDIR}"/${PV}-flags.patch \
62 "${FILESDIR}"/${PV}-soname.patch \
63 "${FILESDIR}"/${PV}-gcc-4.6.patch \
64 "${FILESDIR}"/${PV}-gcc-4.7.patch \
65 "${FILESDIR}"/${PV}-format-security.patch
66
67 eprefixify "${MY_S}"/scitbx/libtbx_refresh.py
68
69 rm -rvf "${MY_S}/boost" "${MY_S}/PyCifRW" >> "${T}"/clean.log || die
70 if ! use prefix; then
71 rm -rvf "${MY_S}/scons" >> "${T}"/clean.log || die
72 echo "import os, sys; os.execvp('scons', sys.argv)" > "${MY_S}"/libtbx/command_line/scons.py || die
73 fi
74
75 find "${MY_S}/clipper" -name "*.h" -print -delete >> "${T}"/clean.log || die
76
77 sed \
78 -e "/LIBS/s:boost_python:boost_python-$(echo ${EPYTHON} | sed 's/python//'):g" \
79 -i "${MY_S}"/boost_adaptbx/SConscript "${MY_S}"/scitbx/boost_python/SConscript || die
80 }
81
82 src_configure() {
83 local compiler
84 local myconf
85
86 myconf="${MY_S}/libtbx/configure.py"
87
88 compiler=$(expr match "$(tc-getCC)" '.*\([a-z]cc\)')
89 myconf="${myconf} --compiler=${compiler}"
90
91 # Additional USE flag usage
92 myconf="${myconf} --enable-openmp-if-possible=$(usex openmp true false)"
93
94 use threads && USEthreads="--enable-boost-threads"
95
96 myconf="${myconf} ${USE_threads} --scan-boost --use_environment_flags"
97
98 mkdir "${MY_B}" && myconf="${myconf} --current_working_directory=${MY_B}"
99 cd "${MY_B}"
100
101 myconf="${myconf} --build=release fftw3tbx rstbx smtbx mmtbx clipper_adaptbx fable"
102 einfo "configuring with ${python} ${myconf}"
103
104 ${EPYTHON} ${myconf} || die "configure failed"
105 }
106
107 src_compile() {
108 local makeopts_exp
109
110 cd "${MY_B}"
111
112 makeopts_exp=${MAKEOPTS/j/j }
113 makeopts_exp=${makeopts_exp%-l[0-9]*}
114
115 source setpaths_all.sh
116
117 einfo "compiling with libtbx.scons ${makeopts_exp}"
118 libtbx.scons ${makeopts_exp} .|| die "make failed"
119 }
120
121 src_test(){
122 source "${MY_B}"/setpaths_all.sh
123 libtbx.python $(libtbx.show_dist_paths boost_adaptbx)/tests/tst_rational.py && \
124 libtbx.python ${SCITBX_DIST}/run_tests.py ${MAKEOPTS_EXP} && \
125 libtbx.python ${CCTBX_DIST}/run_tests.py ${MAKEOPTS_EXP} \
126 || die "test failed"
127 }
128
129 src_install(){
130 local lib baselib
131 # find cctbx_build/ -type f \( -name "*.py" -o -name "*sh" \) -exec \
132 # sed -e "s:${MY_S}:${EPREFIX}/usr/$(get_libdir)/cctbx/cctbx_sources:g" \
133 # -e "s:${MY_B}:${EPREFIX}/usr/$(get_libdir)/cctbx/cctbx_build:g" \
134 # -i '{}' \; || die "Fail to correct path"
135
136 sed \
137 -e "s:${MY_B}:${EPREFIX}/usr:g" \
138 -e "s:${MY_S}:${EPREFIX}/$(python_get_sitedir):g" \
139 -i "${MY_B}/libtbx_env" || die
140
141 insinto /usr/share/cctbx
142 doins "${MY_B}/libtbx_env" || die
143
144 ebegin "removing unnessary files"
145 rm -r "${S}"/cctbx_sources/{clipper,ccp4io,ucs-fonts,TAG} || die "failed to remove uneeded scons"
146 find -O3 "${S}" -type f \
147 \( -name "*conftest*" -o -name "*.o" -o -name "*.c" -o -name "*.f" -o -name "*.cpp" -o \
148 -name "*.pyc" -o -name "SCons*" -o -name "Makefile" -o -name "config.log" \) -delete \
149 -print >> "${T}"/clean.log || die
150 find "${S}" -type d -empty -delete -print >> "${T}"/clean.log || die
151 find "${MY_B}" -maxdepth 1 -type f -delete -print >> "${T}"/clean.log || die
152 eend
153
154 dobin "${MY_B}"/bin/*
155 rm -vrf "${MY_B}/bin" >> "${T}"/clean.log || die
156 dolib.so "${MY_B}"/lib/lib*
157 mv "${ED}"/usr/$(get_libdir)/libscitbx_min{,i}pack.so || die
158 rm -vf "${MY_B}"/lib/lib* >> "${T}"/clean.log || die
159
160 for lib in "${ED}"/usr/$(get_libdir)/*.so; do
161 baselib=$(basename ${lib})
162 mv ${lib}{,.0.0} || die
163 dosym ${baselib}.0.0 /usr/$(get_libdir)/${baselib}
164 done
165
166 insinto /usr/include
167 doins -r "${MY_B}"/include/* || die
168 rm -rvf "${MY_B}/include" >> "${T}"/clean.log || die
169
170 insinto /usr/libexec/${PN}
171 doins -r "${MY_B}"/* || die
172 find "${ED}"/usr/libexec/${PN} -type f -exec chmod 755 '{}' \;
173
174 cd "${MY_S}"
175 python_domodule * "${MY_B}"/lib/*
176 rm -rvf "${MY_B}/lib" >> "${T}"/clean.log || die
177
178 sed \
179 -e "/PYTHONPATH/s:${MY_S}:$(python_get_sitedir):g" \
180 -e "/PYTHONPATH/s:${MY_B}:$(python_get_sitedir):g" \
181 -e "/LD_LIBRARY_PATH/s:${MY_B}/lib:${EPREFIX}/usr/$(get_libdir):g" \
182 -e "/PATH/s:${MY_B}/bin:${EPREFIX}/usr/bin:g" \
183 -e "/PATH/s:${MY_B}/exe:${EPREFIX}/usr/bin:g" \
184 -e "/exec/s:${MY_S}:$(python_get_sitedir):g" \
185 -e "/LIBTBX_BUILD/s:${MY_B}:${EPREFIX}/usr/share/cctbx:g" \
186 -e "s:${MY_B}/exe_dev/:${EPREFIX}/usr/libexec/${PN}/exe_dev/:g" \
187 -i "${ED}"/usr/bin/* || die
188
189 python_optimize
190 }

  ViewVC Help
Powered by ViewVC 1.1.20