1 |
commit: ce059d82f9dde19a8a4a286f8b44061e4af32a11 |
2 |
Author: Nicholas Vinson <nvinson234 <AT> gmail <DOT> com> |
3 |
AuthorDate: Mon Jan 2 18:33:49 2017 +0000 |
4 |
Commit: Justin Lecher <jlec <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Jan 2 20:00:47 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ce059d82 |
7 |
|
8 |
sci-libs/scotch: Add flex-2.6.3 compatibility patch |
9 |
|
10 |
Flex-2.6.3 changed and is different from the behavior shown in 2.6.1 and |
11 |
older. The behaviorial differences prevent scotch from building with |
12 |
2.6.3. This patch adds code to detect 2.6.3 or newer and apply fixes |
13 |
that correctly reflect the new flex behavior. |
14 |
|
15 |
Package-Manager: Portage-2.3.3, Repoman-2.3.1 |
16 |
Closes: https://github.com/gentoo/gentoo/pull/3307 |
17 |
|
18 |
.../scotch/files/scotch-6.0.4-flex-2.6.3-fix.patch | 33 ++++ |
19 |
sci-libs/scotch/scotch-6.0.4-r2.ebuild | 173 +++++++++++++++++++++ |
20 |
2 files changed, 206 insertions(+) |
21 |
|
22 |
diff --git a/sci-libs/scotch/files/scotch-6.0.4-flex-2.6.3-fix.patch b/sci-libs/scotch/files/scotch-6.0.4-flex-2.6.3-fix.patch |
23 |
new file mode 100644 |
24 |
index 00000000..c1301f5 |
25 |
--- /dev/null |
26 |
+++ b/sci-libs/scotch/files/scotch-6.0.4-flex-2.6.3-fix.patch |
27 |
@@ -0,0 +1,33 @@ |
28 |
+--- scotch_6.0.4/src/libscotch/parser_ll.l.old 2017-01-02 08:42:41.216249106 -0800 |
29 |
++++ scotch-6.0.4-r1/work/scotch_6.0.4/src/libscotch/parser_ll.l 2017-01-02 09:50:14.572579444 -0800 |
30 |
+@@ -84,20 +84,29 @@ |
31 |
+ #endif /* X_OSDOS */ |
32 |
+ |
33 |
+ #ifdef FLEX_SCANNER |
34 |
+ #define YY_ALWAYS_INTERACTIVE 1 /* Set the parser as interactive and read one char at a time */ |
35 |
+ #define YY_INPUT(buf,result,max_size) { int c = stratParserInput (); result = (c == 0) ? YY_NULL : ((buf)[0] = c, 1); } |
36 |
++ |
37 |
++# if YY_FLEX_MAJOR_VERSION > 2 || \ |
38 |
++ YY_FLEX_MAJOR_VERSION == 2 && YY_FLEX_MINOR_VERSION > 6 || \ |
39 |
++ YY_FLEX_MAJOR_VERSION == 2 && YY_FLEX_MINOR_VERSION == 6 && YY_FLEX_SUBMINOR_VERSION >= 3 |
40 |
++ int yywrap() { return 1; } |
41 |
++# else |
42 |
++# define yywrap() (1) /* Always return end-of-file on end-of-string */ |
43 |
++# endif |
44 |
++ |
45 |
+ #else /* FLEX_SCANNER */ |
46 |
+ #undef getc /* Redirect I/O functions */ |
47 |
+ #define getc yygetc |
48 |
+ #undef yygetc |
49 |
+ #define yygetc(stream) stratParserInput () |
50 |
++#define yywrap() (1) /* Always return end-of-file on end-of-string */ |
51 |
+ #endif /* FLEX_SCANNER */ |
52 |
+ |
53 |
+ #define YY_NO_UNPUT /* No prototype for yyunput as not defined */ |
54 |
+ #define YY_SKIP_YYWRAP /* No prototype for yywrap as defined as macro */ |
55 |
+-#define yywrap() (1) /* Always return end-of-file on end-of-string */ |
56 |
+ |
57 |
+ /* |
58 |
+ ** The static variables. |
59 |
+ */ |
60 |
+ |
61 |
|
62 |
diff --git a/sci-libs/scotch/scotch-6.0.4-r2.ebuild b/sci-libs/scotch/scotch-6.0.4-r2.ebuild |
63 |
new file mode 100644 |
64 |
index 00000000..df015cf |
65 |
--- /dev/null |
66 |
+++ b/sci-libs/scotch/scotch-6.0.4-r2.ebuild |
67 |
@@ -0,0 +1,173 @@ |
68 |
+# Copyright 1999-2017 Gentoo Foundation |
69 |
+# Distributed under the terms of the GNU General Public License v2 |
70 |
+# $Id$ |
71 |
+ |
72 |
+EAPI=5 |
73 |
+ |
74 |
+inherit eutils toolchain-funcs versionator flag-o-matic multilib |
75 |
+ |
76 |
+# use esmumps version to allow linking with mumps |
77 |
+MYP="${PN}_${PV}_esmumps" |
78 |
+# download id on gforge changes every goddamn release |
79 |
+DID=34618 |
80 |
+SOVER=$(get_major_version) |
81 |
+ |
82 |
+DESCRIPTION="Software for graph, mesh and hypergraph partitioning" |
83 |
+HOMEPAGE="http://www.labri.u-bordeaux.fr/perso/pelegrin/scotch/" |
84 |
+SRC_URI="http://gforge.inria.fr/frs/download.php/${DID}/${MYP}.tar.gz" |
85 |
+ |
86 |
+LICENSE="CeCILL-2" |
87 |
+SLOT="0/${SOVER}" |
88 |
+KEYWORDS="~alpha ~amd64 ~x86 ~amd64-linux ~x86-linux" |
89 |
+IUSE="doc int64 mpi static-libs tools threads" |
90 |
+ |
91 |
+DEPEND=" |
92 |
+ sys-libs/zlib |
93 |
+ mpi? ( virtual/mpi )" |
94 |
+RDEPEND="${DEPEND}" |
95 |
+ |
96 |
+S=${WORKDIR}/${P/-/_} |
97 |
+ |
98 |
+static_to_shared() { |
99 |
+ local libstatic=${1}; shift |
100 |
+ local libname=$(basename ${libstatic%.a}) |
101 |
+ local soname=${libname}$(get_libname ${SOVER}) |
102 |
+ local libdir=$(dirname ${libstatic}) |
103 |
+ |
104 |
+ einfo "Making ${soname} from ${libstatic}" |
105 |
+ if [[ ${CHOST} == *-darwin* ]] ; then |
106 |
+ ${LINK:-$(tc-getCC)} ${LDFLAGS} \ |
107 |
+ -dynamiclib -install_name "${EPREFIX}"/usr/lib/"${soname}" \ |
108 |
+ -Wl,-all_load -Wl,${libstatic} \ |
109 |
+ "$@" -o ${libdir}/${soname} || die "${soname} failed" |
110 |
+ else |
111 |
+ ${LINK:-$(tc-getCC)} ${LDFLAGS} \ |
112 |
+ -shared -Wl,-soname=${soname} \ |
113 |
+ -Wl,--whole-archive ${libstatic} -Wl,--no-whole-archive \ |
114 |
+ "$@" -o ${libdir}/${soname} || die "${soname} failed" |
115 |
+ [[ $(get_version_component_count) -gt 1 ]] && \ |
116 |
+ ln -s ${soname} ${libdir}/${libname}$(get_libname $(get_major_version)) |
117 |
+ ln -s ${soname} ${libdir}/${libname}$(get_libname) |
118 |
+ fi |
119 |
+} |
120 |
+ |
121 |
+src_prepare() { |
122 |
+ epatch "${FILESDIR}"/${P}-as-needed.patch |
123 |
+ epatch "${FILESDIR}"/${P}-flex-2.6.3-fix.patch |
124 |
+ use int64 && append-cflags -DIDXSIZE64 |
125 |
+ if use threads; then |
126 |
+ append-cflags "-DSCOTCH_PTHREAD_NUMBER=$(nproc)" |
127 |
+ else |
128 |
+ append-cflags "-DSCOTCH_PTHREAD_NUMBER=1" |
129 |
+ sed -i \ |
130 |
+ -e 's/ -DSCOTCH_PTHREAD//' \ |
131 |
+ src/Make.inc/Makefile.inc.i686_pc_linux3 || die |
132 |
+ fi |
133 |
+ sed -e "s/gcc/$(tc-getCC)/" \ |
134 |
+ -e "s/-O3/${CFLAGS} -pthread/" \ |
135 |
+ -e "s/ ar/ $(tc-getAR)/" \ |
136 |
+ -e "s/ranlib/$(tc-getRANLIB)/" \ |
137 |
+ -e "s/LDFLAGS/LIBS/" \ |
138 |
+ src/Make.inc/Makefile.inc.i686_pc_linux3 > src/Makefile.inc || die |
139 |
+} |
140 |
+ |
141 |
+src_compile() { |
142 |
+ emake -C src CLIBFLAGS=-fPIC scotch esmumps |
143 |
+ static_to_shared lib/libscotcherr.a |
144 |
+ static_to_shared lib/libscotcherrexit.a |
145 |
+ static_to_shared lib/libscotch.a -Llib -lz -lm -lrt -lpthread -lscotcherr |
146 |
+ static_to_shared lib/libesmumps.a -Llib -lscotch |
147 |
+ static_to_shared lib/libscotchmetis.a -Llib -lscotch |
148 |
+ |
149 |
+ if use mpi; then |
150 |
+ emake -C src CLIBFLAGS=-fPIC ptscotch ptesmumps |
151 |
+ export LINK=mpicc |
152 |
+ static_to_shared lib/libptscotcherr.a |
153 |
+ static_to_shared lib/libptscotcherrexit.a |
154 |
+ static_to_shared lib/libptscotch.a -Llib -lscotch -lptscotcherr -lz -lm -lrt |
155 |
+ static_to_shared lib/libptesmumps.a -Llib -lscotch -lptscotch |
156 |
+ static_to_shared lib/libptscotchparmetis.a -Llib -lscotch -lptscotch |
157 |
+ fi |
158 |
+ if use static-libs; then |
159 |
+ emake -C src clean |
160 |
+ emake -C src |
161 |
+ use mpi && emake -C src ptscotch |
162 |
+ fi |
163 |
+} |
164 |
+ |
165 |
+src_test() { |
166 |
+ LD_LIBRARY_PATH="${S}/lib" emake -C src check |
167 |
+} |
168 |
+ |
169 |
+src_install() { |
170 |
+ dolib.so lib/lib*$(get_libname)* |
171 |
+ use static-libs && dolib.a lib/*.a |
172 |
+ |
173 |
+ #install metis headers into a subdir |
174 |
+ #to allow usage of real metis and scotch |
175 |
+ #in the same code |
176 |
+ insinto /usr/include/scotch/metis |
177 |
+ doins include/*metis* |
178 |
+ rm include/*metis* |
179 |
+ insinto /usr/include/scotch |
180 |
+ doins include/* |
181 |
+ |
182 |
+ cat <<-EOF > scotchmetis.pc |
183 |
+ prefix=${EPREFIX}/usr |
184 |
+ libdir=\${prefix}/$(get_libdir) |
185 |
+ includedir=\${prefix}/include |
186 |
+ Name: scotchmetis |
187 |
+ Description: ${DESCRIPTION} |
188 |
+ Version: ${PV} |
189 |
+ URL: ${HOMEPAGE} |
190 |
+ Libs: -L\${libdir} -lscotchmetis -lscotcherr -lscotch |
191 |
+ Private: -lm -lz -lrt |
192 |
+ Cflags: -I\${includedir}/scotch/metis |
193 |
+ EOF |
194 |
+ insinto /usr/$(get_libdir)/pkgconfig |
195 |
+ doins scotchmetis.pc |
196 |
+ |
197 |
+ # not sure it is actually a full replacement of metis |
198 |
+ #alternatives_for metis scotch 0 \ |
199 |
+ # /usr/$(get_libdir)/pkgconfig/metis.pc scotchmetis.pc |
200 |
+ |
201 |
+ if use mpi; then |
202 |
+ cat <<-EOF > ptscotchparmetis.pc |
203 |
+ prefix=${EPREFIX}/usr |
204 |
+ libdir=\${prefix}/$(get_libdir) |
205 |
+ includedir=\${prefix}/include |
206 |
+ Name: ptscotchparmetis |
207 |
+ Description: ${DESCRIPTION} |
208 |
+ Version: ${PV} |
209 |
+ URL: ${HOMEPAGE} |
210 |
+ Libs: -L\${libdir} -lptscotchparmetis -lptscotcherr -lptscotch |
211 |
+ Private: -lm -lz -lrt |
212 |
+ Cflags: -I\${includedir}/scotch/metis |
213 |
+ Requires: scotchmetis |
214 |
+ EOF |
215 |
+ insinto /usr/$(get_libdir)/pkgconfig |
216 |
+ doins ptscotchparmetis.pc |
217 |
+ # not sure it is actually a full replacement of parmetis |
218 |
+ #alternatives_for metis-mpi ptscotch 0 \ |
219 |
+ # /usr/$(get_libdir)/pkgconfig/metis-mpi.pc ptscotchparmetis.pc |
220 |
+ fi |
221 |
+ |
222 |
+ dodoc README.txt |
223 |
+ |
224 |
+ if use tools; then |
225 |
+ local b m |
226 |
+ pushd bin > /dev/null |
227 |
+ for b in *; do |
228 |
+ newbin ${b} scotch_${b} |
229 |
+ done |
230 |
+ popd > /dev/null |
231 |
+ |
232 |
+ pushd man/man1 > /dev/null |
233 |
+ for m in *; do |
234 |
+ newman ${m} scotch_${m} |
235 |
+ done |
236 |
+ popd > /dev/null |
237 |
+ fi |
238 |
+ |
239 |
+ use doc && dodoc doc/*.pdf |
240 |
+} |