Gentoo Archives: gentoo-commits

From: Jens-Malte Gottfried <jmg@××××××××××.de>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/sci:master commit in: sci-mathematics/petsc/
Date: Sat, 03 Mar 2012 14:28:42
Message-Id: 1330784814.c1e83820b43f582dd4e6c8b3c33d243522220809.jmg@gentoo
1 commit: c1e83820b43f582dd4e6c8b3c33d243522220809
2 Author: Jens-Malte Gottfried <jmgottfried <AT> web <DOT> de>
3 AuthorDate: Sat Mar 3 14:26:54 2012 +0000
4 Commit: Jens-Malte Gottfried <jmg <AT> godefridus <DOT> de>
5 CommitDate: Sat Mar 3 14:26:54 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=c1e83820
7
8 further simplification, added more optional deps
9
10 simplification using the petsc_with script proposed by
11 bicatali (slightly reworked, some fixes)
12 added boost dependency and thread support
13
14 ---
15 sci-mathematics/petsc/metadata.xml | 1 +
16 sci-mathematics/petsc/petsc-3.2_p6.ebuild | 64 +++++++++++++++++------------
17 2 files changed, 38 insertions(+), 27 deletions(-)
18
19 diff --git a/sci-mathematics/petsc/metadata.xml b/sci-mathematics/petsc/metadata.xml
20 index 079f8ff..7f25b9f 100644
21 --- a/sci-mathematics/petsc/metadata.xml
22 +++ b/sci-mathematics/petsc/metadata.xml
23 @@ -3,6 +3,7 @@
24 <pkgmetadata>
25 <herd>sci-mathematics</herd>
26 <use>
27 + <flag name="boost">Use boost (dev-libs/boost)</flag>
28 <flag name="hypre">Use HYPRE (sci-mathematics/hypre) for preconditioning</flag>
29 <flag name="metis">Use METIS (sci-libs/parmetis) for partitioning</flag>
30 <flag name="complex-scalars">Make scalars complex</flag>
31
32 diff --git a/sci-mathematics/petsc/petsc-3.2_p6.ebuild b/sci-mathematics/petsc/petsc-3.2_p6.ebuild
33 index 643e146..7f090fc 100644
34 --- a/sci-mathematics/petsc/petsc-3.2_p6.ebuild
35 +++ b/sci-mathematics/petsc/petsc-3.2_p6.ebuild
36 @@ -15,7 +15,7 @@ SRC_URI="http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/${MY_P}.tar.gz"
37 LICENSE="petsc"
38 SLOT="0"
39 KEYWORDS="~x86 ~amd64"
40 -IUSE="complex-scalars cxx debug doc fortran hdf5 hypre metis mpi X"
41 +IUSE="boost complex-scalars cxx debug doc fortran hdf5 hypre metis mpi threads X"
42
43 RDEPEND="mpi? ( virtual/mpi[cxx?,fortran?] )
44 X? ( x11-libs/libX11 )
45 @@ -24,6 +24,7 @@ RDEPEND="mpi? ( virtual/mpi[cxx?,fortran?] )
46 hypre? ( sci-libs/hypre )
47 metis? ( sci-libs/parmetis )
48 hdf5? ( sci-libs/hdf5[!mpi?] )
49 + boost? ( dev-libs/boost )
50 "
51
52 DEPEND="${RDEPEND}
53 @@ -37,6 +38,7 @@ S="${WORKDIR}/${MY_P}"
54
55 src_prepare(){
56 epatch "${FILESDIR}/${PN}-configure-pic.patch"
57 + epatch "${FILESDIR}/${PN}-disable-env-warnings.patch"
58 epatch "${FILESDIR}/${PN}-disable-rpath.patch"
59 }
60
61 @@ -45,14 +47,28 @@ src_configure(){
62 petsc_enable(){
63 use "$1" && echo "--with-${2:-$1}=1" || echo "--with-${2:-$1}=0"
64 }
65 + # add external library:
66 + # petsc_with use_flag libname libdir
67 + # petsc_with use_flag libname lib include
68 + petsc_with() {
69 + local myuse p=${2:-${1}}
70 + if use ${1}; then
71 + myuse="--with-${p}=1"
72 + if [[ $# == 4 ]]; then
73 + myuse="${myuse} --with-${p}-lib=\"${3}\""
74 + myuse="${myuse} --with-${p}-include=${4}"
75 + else
76 + myuse="${myuse} --with-${p}-dir=${EPREFIX}${3:-/usr}"
77 + fi
78 + else
79 + myuse="--with-${p}=0"
80 + fi
81 + echo ${myuse}
82 + }
83 # select between configure options depending on use flag
84 - pestc_select() {
85 + petsc_select() {
86 use "$1" && echo "--with-$2=$3" || echo "--with-$2=$4"
87 }
88 - # add info about library include dirs and lib file
89 - petsc_lib_info(){
90 - use "$1" && echo "--with-${4:-$1}-include=$2 --with-${4:-$1}-lib=$3"
91 - }
92
93 local mylang
94 local myopt
95 @@ -64,21 +80,17 @@ src_configure(){
96 export PETSC_DIR="${S}"
97 export PETSC_ARCH="linux-gnu-${mylang}-${myopt}"
98
99 - # flags difficult to pass due to correct quoting of spaces
100 - local myconf
101 - myconf[1]="CFLAGS=${CFLAGS}"
102 - myconf[2]="CXXFLAGS=${CXXFLAGS}"
103 - myconf[3]="LDFLAGS=${LDFLAGS}"
104 - myconf[4]="--with-blas-lapack-lib=$(pkg-config --libs lapack)"
105 -
106 if use debug; then
107 strip-flags
108 filter-flags -O*
109 fi
110
111 # run petsc configure script
112 - python "${S}/config/configure.py" \
113 + ./configure \
114 --prefix="${EPREFIX}/usr" \
115 + CFLAGS="${CFLAGS}" \
116 + CXXFLAGS="${CXXFLAGS}" \
117 + LDFLAGS="${LDFLAGS}" \
118 --with-shared-libraries \
119 --with-single-library \
120 --with-clanguage=${mylang} \
121 @@ -86,27 +98,28 @@ src_configure(){
122 --with-petsc-arch=${PETSC_ARCH} \
123 --with-precision=double \
124 --with-gnu-compilers \
125 + --with-blas-lapack-lib="$(pkg-config --libs lapack)" \
126 $(petsc_enable debug debugging) \
127 - $(petsc_enable fortran) \
128 $(petsc_enable mpi) \
129 $(petsc_select mpi cc /usr/bin/mpicc $(tc-getCC)) \
130 $(petsc_select mpi cxx /usr/bin/mpicxx $(tc-getCXX)) \
131 - $(use fortran && $(pestc_select mpi fc /usr/bin/mpif77 $(tc-getF77))) \
132 + $(petsc_enable fortran) \
133 + $(use fortran && echo "$(petsc_select mpi fc /usr/bin/mpif77 $(tc-getF77))") \
134 $(petsc_enable mpi mpi-compilers) \
135 - $(petsc_enable X) \
136 + $(petsc_with X) \
137 + $(petsc_with boost) \
138 + $(petsc_enable threads pthread) \
139 + $(petsc_enable threads pthreadclasses) \
140 --with-windows-graphics=0 \
141 --with-matlab=0 \
142 --with-python=0 \
143 --with-cmake=/usr/bin/cmake \
144 - $(petsc_enable hdf5) \
145 - $(petsc_lib_info hdf5 /usr/include /usr/$(get_libdir)/libhdf5.so) \
146 - $(petsc_enable hypre) \
147 - $(petsc_lib_info hypre /usr/include/hypre /usr/$(get_libdir)/libHYPRE.so) \
148 - $(petsc_enable metis parmetis) \
149 - $(petsc_lib_info metis /usr/include/parmetis /usr/$(get_libdir)/libparmetis.so parmetis) \
150 + $(petsc_with hdf5) \
151 + $(petsc_with hypre hypre /usr/$(get_libdir)/libHYPRE.so /usr/include/hypre) \
152 + $(petsc_with metis parmetis) \
153 $(petsc_select complex-scalars scalar-type complex real) \
154 --with-scotch=0 \
155 - "${myconf[@]}"
156 + ${EXTRA_ECONF} || die "configuration failed"
157 }
158
159 src_install(){
160 @@ -159,7 +172,4 @@ pkg_postinst() {
161 elog "The petsc ebuild is still under development."
162 elog "Help us improve the ebuild in:"
163 elog "http://bugs.gentoo.org/show_bug.cgi?id=53386"
164 - elog "Note that PETSC_ARCH may be dropped in future since " \
165 - "upstream now also supports installations without " \
166 - "different subdirectories."
167 }