Gentoo Archives: gentoo-commits

From: Andrew Ammerlaan <andrewammerlaan@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-libs/scotch/
Date: Thu, 10 Jun 2021 12:15:12
Message-Id: 1623327305.4af10b0593cbc3fa93b62b3755ba2bed748dbf7d.andrewammerlaan@gentoo
1 commit: 4af10b0593cbc3fa93b62b3755ba2bed748dbf7d
2 Author: Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jun 10 12:13:51 2021 +0000
4 Commit: Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
5 CommitDate: Thu Jun 10 12:15:05 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4af10b05
7
8 sci-libs/scotch: add version 6.1.0 and EAPI bump
9
10 Closes: https://bugs.gentoo.org/743421
11 Package-Manager: Portage-3.0.19, Repoman-3.0.3
12 Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> gentoo.org>
13
14 sci-libs/scotch/Manifest | 1 +
15 sci-libs/scotch/scotch-6.1.0.ebuild | 173 ++++++++++++++++++++++++++++++++++++
16 2 files changed, 174 insertions(+)
17
18 diff --git a/sci-libs/scotch/Manifest b/sci-libs/scotch/Manifest
19 index 44a8a4eac78..da7f4e25fe8 100644
20 --- a/sci-libs/scotch/Manifest
21 +++ b/sci-libs/scotch/Manifest
22 @@ -1 +1,2 @@
23 +DIST scotch-v6.1.0.tar.gz 6292006 BLAKE2B 5b76b01c0fa752468a36830a15c190cd78efc851c3b6831eb2d16b7cf34a71d55463b266ffdee4c6addd4e66ca7caf75e63825051e600ee8a32494e5033cabbd SHA512 e6d217a23e39635f8749811a3fc64c8da14d0396a71b4042a4f8f3ce32ff1f0b4ed033ebae90f3785443dae9b35ded68ea512ed1e3e7f9ea9a471a499ae26b89
24 DIST scotch_6.0.4_esmumps.tar.gz 4804966 BLAKE2B 63c058fac9206e70975463b1748eb5ce7cd2ba01d9fcbb28eba8f5914ac49a71fcf87941fafd6047712fa519f3b5523ce199bdf5228a8b094bbb465dd64a1083 SHA512 0fcf639ab1a09451256444005f1a4a739403159e3ab22c34fbcedc481be387cd4c86be6fb029b4b5816220564f64f662434bf7f1d3921ed18be081ae2a7a9ee2
25
26 diff --git a/sci-libs/scotch/scotch-6.1.0.ebuild b/sci-libs/scotch/scotch-6.1.0.ebuild
27 new file mode 100644
28 index 00000000000..ebd2b1e8d84
29 --- /dev/null
30 +++ b/sci-libs/scotch/scotch-6.1.0.ebuild
31 @@ -0,0 +1,173 @@
32 +# Copyright 1999-2021 Gentoo Authors
33 +# Distributed under the terms of the GNU General Public License v2
34 +
35 +EAPI=7
36 +
37 +inherit toolchain-funcs flag-o-matic multilib
38 +
39 +SOVER=$(ver_cut 1)
40 +
41 +DESCRIPTION="Software for graph, mesh and hypergraph partitioning"
42 +HOMEPAGE="https://www.labri.u-bordeaux.fr/perso/pelegrin/scotch/ https://gitlab.inria.fr/scotch/scotch"
43 +SRC_URI="https://gitlab.inria.fr/${PN}/${PN}/-/archive/v${PV}/${PN}-v${PV}.tar.gz"
44 +S="${WORKDIR}/${PN}-v${PV}"
45 +
46 +LICENSE="CeCILL-2"
47 +SLOT="0/${SOVER}"
48 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux"
49 +IUSE="doc int64 mpi static-libs test tools threads"
50 +# bug #532620
51 +REQUIRED_USE="test? ( threads )"
52 +RESTRICT="!test? ( test )"
53 +
54 +DEPEND="
55 + sys-libs/zlib
56 + mpi? ( virtual/mpi )"
57 +RDEPEND="${DEPEND}"
58 +
59 +static_to_shared() {
60 + local libstatic=${1}; shift
61 + local libname=$(basename ${libstatic%.a})
62 + local soname=${libname}$(get_libname ${SOVER})
63 + local libdir=$(dirname ${libstatic})
64 +
65 + einfo "Making ${soname} from ${libstatic}"
66 + if [[ ${CHOST} == *-darwin* ]] ; then
67 + ${LINK:-$(tc-getCC)} ${LDFLAGS} \
68 + -dynamiclib -install_name "${EPREFIX}"/usr/lib/"${soname}" \
69 + -Wl,-all_load -Wl,${libstatic} \
70 + "$@" -o ${libdir}/${soname} || die "${soname} failed"
71 + else
72 + ${LINK:-$(tc-getCC)} ${LDFLAGS} \
73 + -shared -Wl,-soname=${soname} \
74 + -Wl,--whole-archive ${libstatic} -Wl,--no-whole-archive \
75 + "$@" -o ${libdir}/${soname} || die "${soname} failed"
76 + VERS_COMP=${PV//.}
77 + [[ "${#VERS_COMP}" -gt 1 ]] && \
78 + ln -s ${soname} ${libdir}/${libname}$(get_libname ${SOVER})
79 + ln -s ${soname} ${libdir}/${libname}$(get_libname)
80 + fi
81 +}
82 +
83 +src_prepare() {
84 + default
85 + use int64 && append-cflags -DIDXSIZE64
86 + if use threads; then
87 + append-cflags "-DSCOTCH_PTHREAD_NUMBER=$(nproc)"
88 + else
89 + append-cflags "-DSCOTCH_PTHREAD_NUMBER=1"
90 + sed -i \
91 + -e 's/ -DSCOTCH_PTHREAD//' \
92 + src/Make.inc/Makefile.inc.i686_pc_linux3 || die
93 + fi
94 +
95 + # Be careful with replacing here, bug #577272
96 + sed -e "s/= gcc$/= $(tc-getCC)/" \
97 + -e "s/-O3/${CFLAGS} -pthread/" \
98 + -e "s/= ar$/= $(tc-getAR)/" \
99 + -e "s/= ranlib$/= $(tc-getRANLIB)/" \
100 + -e "s/= ranlib$/= $(tc-getRANLIB)/" \
101 + -e "/^LDFLAGS/ s/$/ ${LDFLAGS}/" \
102 + src/Make.inc/Makefile.inc.i686_pc_linux3 > src/Makefile.inc || die
103 +}
104 +
105 +src_compile() {
106 + emake -C src CLIBFLAGS=-fPIC scotch esmumps
107 + static_to_shared lib/libscotcherr.a
108 + static_to_shared lib/libscotcherrexit.a
109 + static_to_shared lib/libscotch.a -Llib -lz -lm -lrt -lpthread -lscotcherr
110 + static_to_shared lib/libesmumps.a -Llib -lscotch
111 + static_to_shared lib/libscotchmetis.a -Llib -lscotch
112 +
113 + if use mpi; then
114 + emake -C src CLIBFLAGS=-fPIC ptscotch ptesmumps
115 + export LINK=mpicc
116 + static_to_shared lib/libptscotcherr.a
117 + static_to_shared lib/libptscotcherrexit.a
118 + static_to_shared lib/libptscotch.a -Llib -lscotch -lptscotcherr -lz -lm -lrt
119 + static_to_shared lib/libptesmumps.a -Llib -lscotch -lptscotch
120 + static_to_shared lib/libptscotchparmetis.a -Llib -lscotch -lptscotch
121 + fi
122 + if use static-libs; then
123 + emake -C src clean
124 + emake -C src
125 + use mpi && emake -C src ptscotch
126 + fi
127 +}
128 +
129 +src_test() {
130 + LD_LIBRARY_PATH="${S}/lib" emake -C src check
131 +}
132 +
133 +src_install() {
134 + dolib.so lib/lib*$(get_libname)*
135 + use static-libs && dolib.a lib/*.a
136 +
137 + #install metis headers into a subdir
138 + #to allow usage of real metis and scotch
139 + #in the same code
140 + insinto /usr/include/scotch/metis
141 + doins include/*metis*
142 + rm include/*metis*
143 + insinto /usr/include/scotch
144 + doins include/*
145 +
146 + cat <<-EOF > scotchmetis.pc
147 + prefix=${EPREFIX}/usr
148 + libdir=\${prefix}/$(get_libdir)
149 + includedir=\${prefix}/include
150 + Name: scotchmetis
151 + Description: ${DESCRIPTION}
152 + Version: ${PV}
153 + URL: ${HOMEPAGE}
154 + Libs: -L\${libdir} -lscotchmetis -lscotcherr -lscotch
155 + Private: -lm -lz -lrt
156 + Cflags: -I\${includedir}/scotch/metis
157 + EOF
158 + insinto /usr/$(get_libdir)/pkgconfig
159 + doins scotchmetis.pc
160 +
161 + # not sure it is actually a full replacement of metis
162 + #alternatives_for metis scotch 0 \
163 + # /usr/$(get_libdir)/pkgconfig/metis.pc scotchmetis.pc
164 +
165 + if use mpi; then
166 + cat <<-EOF > ptscotchparmetis.pc
167 + prefix=${EPREFIX}/usr
168 + libdir=\${prefix}/$(get_libdir)
169 + includedir=\${prefix}/include
170 + Name: ptscotchparmetis
171 + Description: ${DESCRIPTION}
172 + Version: ${PV}
173 + URL: ${HOMEPAGE}
174 + Libs: -L\${libdir} -lptscotchparmetis -lptscotcherr -lptscotch
175 + Private: -lm -lz -lrt
176 + Cflags: -I\${includedir}/scotch/metis
177 + Requires: scotchmetis
178 + EOF
179 + insinto /usr/$(get_libdir)/pkgconfig
180 + doins ptscotchparmetis.pc
181 + # not sure it is actually a full replacement of parmetis
182 + #alternatives_for metis-mpi ptscotch 0 \
183 + # /usr/$(get_libdir)/pkgconfig/metis-mpi.pc ptscotchparmetis.pc
184 + fi
185 +
186 + dodoc README.txt
187 +
188 + if use tools; then
189 + local b m
190 + pushd bin > /dev/null || die
191 + for b in *; do
192 + newbin ${b} scotch_${b}
193 + done
194 + popd > /dev/null || die
195 +
196 + pushd man/man1 > /dev/null || die
197 + for m in *.1; do
198 + newman ${m} scotch_${m}
199 + done
200 + popd > /dev/null || die
201 + fi
202 +
203 + use doc && dodoc doc/*.pdf
204 +}