Gentoo Archives: gentoo-commits

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