summaryrefslogtreecommitdiff
path: root/sci-libs/scotch
diff options
context:
space:
mode:
Diffstat (limited to 'sci-libs/scotch')
-rw-r--r--sci-libs/scotch/Manifest15
-rw-r--r--sci-libs/scotch/files/scotch-5.1.12b-as-needed.patch112
-rw-r--r--sci-libs/scotch/files/scotch-6.0.0-as-needed.patch128
-rw-r--r--sci-libs/scotch/files/scotch-6.0.4-as-needed.patch128
-rw-r--r--sci-libs/scotch/files/scotch-6.0.4-flex-2.6.3-fix.patch33
-rw-r--r--sci-libs/scotch/metadata.xml37
-rw-r--r--sci-libs/scotch/scotch-5.1.12b.ebuild157
-rw-r--r--sci-libs/scotch/scotch-6.0.0.ebuild165
-rw-r--r--sci-libs/scotch/scotch-6.0.4-r1.ebuild171
-rw-r--r--sci-libs/scotch/scotch-6.0.4-r2.ebuild172
-rw-r--r--sci-libs/scotch/scotch-6.0.4.ebuild165
11 files changed, 1283 insertions, 0 deletions
diff --git a/sci-libs/scotch/Manifest b/sci-libs/scotch/Manifest
new file mode 100644
index 000000000000..18ca1e967d9c
--- /dev/null
+++ b/sci-libs/scotch/Manifest
@@ -0,0 +1,15 @@
+AUX scotch-5.1.12b-as-needed.patch 4878 SHA256 e9084641e7cea9fdf21293a4ae7dcf65b73837e3ba59881d32dafa08bde88a8a SHA512 9f5bf65999978d851b0c61de2235af982e6d1d057af5906d328f2a4b83775f8dd567f1386eecc186d6ec1287d8e84215a88b879ec77de4ac6de5b129ad263411 WHIRLPOOL 122321a4d85a936aceb96a6a2c522c7ee3493e5b1ec76f30d2815388464f3f7681928c71d11595c983a3825b44bba7e8c54b95af94539041bb1cd7b4c3107c7e
+AUX scotch-6.0.0-as-needed.patch 5874 SHA256 b9159d4808c91d8846ce05bfe96cd787d777a7195dfd17bc1f589dbcec22495b SHA512 efb458b53ceaa40c140e0920a3e31ab563f347a3bc21d727c338f4b971e4312ef680bb248e99dd609b5191f9e91460a1aa2149932d4277c5bc6406ef0206c24e WHIRLPOOL ecb7f9accb734521414e405a040f31b55065f101d62f82cfed9059994ce5d4ab6b762d1e1b83bc32a1894c0ffbf7bd0b00adad5f054f5edf04af74b925f01b8a
+AUX scotch-6.0.4-as-needed.patch 6168 SHA256 7fc05da3c313df9ef94511c0e70465c52b63d6470419bbcf384720084c2ebaf4 SHA512 cd58425866a1726f776318e3792e72d7250686f033ceeda57f0f007fdb4c5e1c2bc3c9346630e39f16023f2a3d70cd106b357c21e5406a1c44b49a316655d8dd WHIRLPOOL ce0b8aa2b22d8153247920bfc8b8de09c07fa95ab67c8b1331992d2346cfbd48402a7b0bb40812725d41995a64c8f6b1f226d3eeb6437d0457d745f3503303bf
+AUX scotch-6.0.4-flex-2.6.3-fix.patch 1623 SHA256 334c39717ef20ac89eba2d587c5318a6492ad817d9baefc53ee32065e3fdfb40 SHA512 1a2a5a363e1dd59e1cced76928da15132cd1c8af57d6d0ad0eec04e02d029c6ae275e202e8c87bc65ff0188f41e379865829b5b61e4f1e44a885d48c4462b09e WHIRLPOOL a62f134fe5042b1a35e81ee9e9b56130a271a4c3fbfca6f222fe80ff8328c206bab46bba923bd41af6a034a5fee2fd2f0aa63aeb899875283f0592220d80e7b9
+DIST scotch_5.1.12b_esmumps.tar.gz 3989632 SHA256 82654e63398529cd3bcc8eefdd51d3b3161c0429bb11770e31f8eb0c3790db6e SHA512 8d6e085029f1ec13b74bd583b8fb378db9aef8a005b96bfb726b68a4608caeb31bf7ecaf1af27566e2e4a38dfea03a017d5c2e8dd262562b238cfb113b223671 WHIRLPOOL 85679809826ce09df8a05b09026179dcf4a1424f9f9c44ce97ba172fd18b7dc3af669c686d4ea5b169501dcb011ceab419d0391ae378712302977fb55f35abb8
+DIST scotch_6.0.0_esmumps.tar.gz 4534976 SHA256 8206127d038bda868dda5c5a7f60ef8224f2e368298fbb01bf13fa250e378dd4 SHA512 4509a58363957b009cfc56a0a1ade31e2cb718f50edf7674d00471ee375251d03630e988036e14f545f9f4f270ff4a8b4ebe66a6f9e05b5d769b643bcf9d6067 WHIRLPOOL 7083a767d13d24b7b2640109643bb309bfc267a191537d77d6e31828eb1f875f2d0055f18e4038ebb24536c7d098b1d365524ea06092e1253f894351ba1157c3
+DIST scotch_6.0.4_esmumps.tar.gz 4804966 SHA256 f53f4d71a8345ba15e2dd4e102a35fd83915abf50ea73e1bf6efe1bc2b4220c7 SHA512 0fcf639ab1a09451256444005f1a4a739403159e3ab22c34fbcedc481be387cd4c86be6fb029b4b5816220564f64f662434bf7f1d3921ed18be081ae2a7a9ee2 WHIRLPOOL cadceb30086d586faaefe992dd75329565ce44c4da252526147a88a47be61b92f5ccdeec8cc1c5e3ff5f560c7f296e1aa1e872495ed91c70f3e8272a07435105
+EBUILD scotch-5.1.12b.ebuild 4446 SHA256 b495a0bc0f9647556ad86dd53657f6d1389ab52938abb5b18172f5f015659bb4 SHA512 8020ca4ed7709607e1bc9f4cf21b96efd03ad413912304d70bde02606b1c2cba6abcb6e3a14ae0ff59c19ab82a40efb02567bafe1bce53d0e39d192f3aff1dbb WHIRLPOOL b3300d3ee559c78171685d20bc861381db780d29ba6b200d57234ec7b0061bee5e09cf6bd329488eaaab97d4915143deb6212e28cbb91ab5570887c63eecfd12
+EBUILD scotch-6.0.0.ebuild 4628 SHA256 7c7a46a8937476cc5b4d72412e3be440011f27d14f97540da190f00ec8170293 SHA512 f7f348526f0ae65c3154e432cef738131b9b6d1cb8cba66bc3dfc25cbfe5138c0cd05b0f0a20fa2f572c7d92532ad3d5e90db574ff13b28c1980eb6b041ae1f3 WHIRLPOOL 8bb0c9b91f1e33be85a7baa1d7a0c05bb254f8e0a755279233bd240e48bb54e7fc656eed9499434dd229c9d4e8e8857bc2449da12d863b9c3805a6200f491c23
+EBUILD scotch-6.0.4-r1.ebuild 4824 SHA256 2a70cd66fa35f2d6c8c7566085de9af9f90c1e958ae3bf27e3f1e566ee52fdb3 SHA512 71110eb916825346450636f7f78a84032dd1a51405654ad50c77e4b717f9bc71c55f6a3f3a7d874ae23fadddbd2c8e3e3a2b8706c895da7eacbac00da9e068ab WHIRLPOOL 74aecd29225e116d5a32ee611e09f5158122a80fb9e0f2c8c1993ef49c1b0cd24cd22de7f201d5a3a6cab50dbbdd4a696e7682dd2cf02be3261d17cc71ae7d76
+EBUILD scotch-6.0.4-r2.ebuild 4908 SHA256 d3217c63173679d62b17a35e64bce22368b183cd2332c5cd3ea5c9c71134662f SHA512 f08e6560e9a19160c08dbaa5beaee7a501729e0c33944f0f854bde03bb9607a0e575d33f358dd798af15b7bab0af1337aeb99f27956573c58062c1b2573c0534 WHIRLPOOL 2db189b706e90bb93dd4de888aae78dbe17231f2897c16a5b3f69a109546448274ec45643548687f9a67538bb775c837a5636703b69c3e26fe4658ea39e9e516
+EBUILD scotch-6.0.4.ebuild 4628 SHA256 59840923e3a2e03cd5b760575460dcd3dca98d00f44fa0c4d76426d7817e74ba SHA512 0dd2f53982da1fc085f4cca6be9c0ca2c7b0c98548171ed3ad1bb2159389ebd55c6654d95372f47709c108aa7258c291f5f3e23e9e5054a5ebe0b16316fbe14e WHIRLPOOL 64932fb7175477e94dc6226f5c065ee10b58302e22843674c425a33774295383ea098b838c225fb2b2df8a11e25780e35f6d1bd63177b62ea198998efb890646
+MISC ChangeLog 2995 SHA256 1db07f15fb65b5f7131a3d7c5a4365c856994d1e843ce1638c3d042812a789ef SHA512 c294b07aeccfb070d205a2d50b33b547c4f6aeb5fcf2af08a15c9956050bbb33a1f397780570afb537fb75ce892979a17e603456b33b3357e250e2b59be9afa0 WHIRLPOOL 604d58660ff929f149007e20695e3af89405d75ce9a48b5847db305eae21c837e1443e433c9023668650797b63847d87c2f97026a112828b9ba3c8b4255303d4
+MISC ChangeLog-2015 3780 SHA256 cf4827e85ca121e1c8c84fdadfd65d2394ad65fdba205dde06bfbd83292ea41c SHA512 f2801e46d2710f1c529e5e09a66ba20815fa1e190684ea160a442194508db5e3ae4a4a88be5583f51943f513b99b78c57200630cf75a708413e88569f4fb14c9 WHIRLPOOL 4b3d4cfcab5882e5a251873b7874a863617bfb465caaedd14ff48916be388c0731172ff9715b60da6425d1b0a9089c0fd4629cdb50fbb041f8ba35ea3072b365
+MISC metadata.xml 1415 SHA256 9f291d7307dbb4c27c40e3da8494219a235af23daede2c19bc32e1e83b00b180 SHA512 059e33b0e1021dc07c716e0d04b61fe56e97be1ae26c771c8641ce0a2dac83cdc10b6582730778edcd9bb4a25a050e81ae6d8331451c272b2b3727a03b601712 WHIRLPOOL 4b0d9e7f59f92a46eb85a670b62cedd8ca08291ad4da7208b5fe54543ff64976eee03cb557322d513cb46d372cfad1b38eae09afef76ad93d2d37122a60eccf3
diff --git a/sci-libs/scotch/files/scotch-5.1.12b-as-needed.patch b/sci-libs/scotch/files/scotch-5.1.12b-as-needed.patch
new file mode 100644
index 000000000000..73888d8797e7
--- /dev/null
+++ b/sci-libs/scotch/files/scotch-5.1.12b-as-needed.patch
@@ -0,0 +1,112 @@
+diff -Nur src.orig/esmumps/Makefile src/esmumps/Makefile
+--- src.orig/esmumps/Makefile 2012-03-12 00:14:14.536109811 +0000
++++ src/esmumps/Makefile 2012-03-12 04:26:12.884108074 +0000
+@@ -44,7 +44,7 @@
+ $(CC) $(CFLAGS) $(CLIBFLAGS) -I$(includedir) -c $(<) -o $(@)
+
+ %$(EXE) : %.c
+- $(CC) $(CFLAGS) -I$(includedir) $(<) -o $(@) -L$(libdir) $(LDFLAGS) -L. -l$(ESMUMPSLIB) -l$(SCOTCHLIB) -l$(SCOTCHLIB)errexit
++ $(CC) $(CFLAGS) -I$(includedir) $(<) -L$(libdir) -L. -l$(ESMUMPSLIB) -l$(SCOTCHLIB) -l$(SCOTCHLIB)errexit $(LDFLAGS) -o $(@)
+
+ ##
+ ## Project rules.
+@@ -57,9 +57,9 @@
+ libesmumps$(LIB) \
+ main_esmumps$(EXE)
+
+-ptscotch : clean
++ptscotch : clean common.h
+ $(MAKE) CFLAGS="$(CFLAGS) -DSCOTCH_PTSCOTCH" CC=$(CCP) SCOTCHLIB=ptscotch ESMUMPSLIB=ptesmumps \
+- libesmumps$(LIB) \
++ libptesmumps$(LIB) \
+ main_esmumps$(EXE)
+
+ install :
+@@ -142,7 +142,7 @@
+ common.h \
+ esmumps.h
+
+-libesmumps$(LIB) : graph_graph$(OBJ) \
++lib$(ESMUMPSLIB)$(LIB) : graph_graph$(OBJ) \
+ order$(OBJ) \
+ order_scotch_graph$(OBJ) \
+ dof$(OBJ) \
+diff -Nur src.orig/libscotch/Makefile src/libscotch/Makefile
+--- src.orig/libscotch/Makefile 2012-03-12 00:14:14.496108751 +0000
++++ src/libscotch/Makefile 2012-03-12 01:32:28.562403624 +0000
+@@ -43,7 +43,7 @@
+ $(CC) $(CFLAGS) $(CLIBFLAGS) -c $(<) -o $(@)
+
+ %$(EXE) : %.c
+- $(CC) $(CFLAGS) -DSCOTCH_VERSION=$(VERSION) -DSCOTCH_RELEASE=$(RELEASE) -DSCOTCH_PATCHLEVEL=$(PATCHLEVEL) $(<) -o $(@) $(LDFLAGS)
++ $(CC) $(CFLAGS) -DSCOTCH_VERSION=$(VERSION) -DSCOTCH_RELEASE=$(RELEASE) -DSCOTCH_PATCHLEVEL=$(PATCHLEVEL) $(<) $(LDFLAGS) -o $(@)
+
+ ##
+ ## Project rules.
+@@ -2543,7 +2543,7 @@
+ mapping.h \
+ order.h \
+ parser.h
+- $(CCD) $(CFLAGS) -DSCOTCH_VERSION=$(VERSION) -DSCOTCH_RELEASE=$(RELEASE) -DSCOTCH_PATCHLEVEL=$(PATCHLEVEL) $(<) -o $(@) $(LDFLAGS)
++ $(CCD) $(CFLAGS) -DSCOTCH_VERSION=$(VERSION) -DSCOTCH_RELEASE=$(RELEASE) -DSCOTCH_PATCHLEVEL=$(PATCHLEVEL) $(<) $(LDFLAGS) -o $(@)
+
+ scotch.h : dummysizes$(EXE) \
+ library.h
+diff -Nur src.orig/libscotchmetis/Makefile src/libscotchmetis/Makefile
+--- src.orig/libscotchmetis/Makefile 2012-03-12 00:14:14.456107691 +0000
++++ src/libscotchmetis/Makefile 2012-03-12 01:35:00.166422784 +0000
+@@ -44,7 +44,7 @@
+ $(CC) $(CFLAGS) $(CLIBFLAGS) -I$(includedir) -I../libscotch -c $(<) -o $(@)
+
+ %$(EXE) : %.c
+- $(CC) $(CFLAGS) -I$(includedir) -I../libscotch $(<) -o $(@) -L$(libdir) $(LDFLAGS)
++ $(CC) $(CFLAGS) -I$(includedir) -I../libscotch $(<) -L$(libdir) $(LDFLAGS) -o $(@)
+
+ ##
+ ## Project rules.
+diff -Nur src.orig/scotch/Makefile src/scotch/Makefile
+--- src.orig/scotch/Makefile 2012-03-12 00:14:14.536109811 +0000
++++ src/scotch/Makefile 2012-03-12 00:50:22.033571205 +0000
+@@ -41,13 +41,13 @@
+ include ../Makefile.inc
+
+ %$(EXE) : %$(OBJ)
+- $(CC) $(CFLAGS) -I$(includedir) -I../libscotch $(<) -o $(@) -L$(libdir) -l$(SCOTCHLIB) -l$(SCOTCHLIB)errexit $(LDFLAGS)
++ $(CC) $(CFLAGS) -I$(includedir) -I../libscotch $(<) -L$(libdir) -l$(SCOTCHLIB) -l$(SCOTCHLIB)errexit $(LDFLAGS) -o $(@)
+
+ %$(OBJ) : %.c
+ $(CC) $(CFLAGS) -I$(includedir) -I../libscotch -c $(<) -o $(@)
+
+ %$(EXE) : %.c
+- $(CC) $(CFLAGS) -I$(includedir) -I../libscotch $(<) -o $(@) -L$(libdir) -l$(SCOTCHLIB) -l$(SCOTCHLIB)errexit $(LDFLAGS)
++ $(CC) $(CFLAGS) -I$(includedir) -I../libscotch $(<) -L$(libdir) -l$(SCOTCHLIB) -l$(SCOTCHLIB)errexit $(LDFLAGS) -o $(@)
+
+ ##
+ ## Project rules.
+@@ -205,7 +205,7 @@
+ $(libdir)/libptscotch$(LIB) \
+ $(libdir)/libptscotcherrexit$(LIB) \
+ dgmap.h
+- $(CC) $(CFLAGS) -I$(includedir) -I../libscotch $(<) -DSCOTCH_COMPILE_PART -o $(@) -L$(libdir) -l$(SCOTCHLIB) -l$(SCOTCHLIB)errexit $(LDFLAGS)
++ $(CC) $(CFLAGS) -I$(includedir) -I../libscotch $(<) -DSCOTCH_COMPILE_PART -L$(libdir) -l$(SCOTCHLIB) -l$(SCOTCHLIB)errexit $(LDFLAGS) -o $(@)
+
+ dgscat$(EXE) : dgscat.c \
+ ../libscotch/module.h \
+@@ -315,7 +315,7 @@
+ gout_o.c \
+ $(includedir)/scotch.h \
+ $(libdir)/libscotch$(LIB)
+- $(CC) $(CFLAGS) -I../libscotch -I$(includedir) gout_c.c gout_o.c -o $(@) -L$(libdir) -lscotch -lscotcherrexit $(LDFLAGS)
++ $(CC) $(CFLAGS) -I../libscotch -I$(includedir) gout_c.c gout_o.c -L$(libdir) -lscotch -lscotcherrexit $(LDFLAGS) -o $(@)
+
+ gpart$(EXE) : gmap.c \
+ ../libscotch/module.h \
+@@ -324,7 +324,7 @@
+ $(libdir)/libscotch$(LIB) \
+ $(libdir)/libscotcherrexit$(LIB) \
+ gmap.h
+- $(CC) $(CFLAGS) -I$(includedir) -I../libscotch $(<) -DSCOTCH_COMPILE_PART -o $(@) -L$(libdir) -l$(SCOTCHLIB) -l$(SCOTCHLIB)errexit $(LDFLAGS)
++ $(CC) $(CFLAGS) -I$(includedir) -I../libscotch $(<) -DSCOTCH_COMPILE_PART -L$(libdir) -l$(SCOTCHLIB) -l$(SCOTCHLIB)errexit $(LDFLAGS) -o $(@)
+
+
+ gscat$(EXE) : gscat.c \
diff --git a/sci-libs/scotch/files/scotch-6.0.0-as-needed.patch b/sci-libs/scotch/files/scotch-6.0.0-as-needed.patch
new file mode 100644
index 000000000000..ad41380de884
--- /dev/null
+++ b/sci-libs/scotch/files/scotch-6.0.0-as-needed.patch
@@ -0,0 +1,128 @@
+diff -Nur src.orig/check/Makefile src/check/Makefile
+--- src.orig/check/Makefile 2013-02-07 17:27:00.000000000 +0000
++++ src/check/Makefile 2013-02-07 17:27:21.000000000 +0000
+@@ -48,7 +48,7 @@
+ $(CC) $(CFLAGS) $(CLIBFLAGS) -I$(SCOTCHINCLUDEDIR) -c $(<) -o $(@)
+
+ %$(EXE) : %.c
+- $(CC) $(CFLAGS) -I$(SCOTCHINCLUDEDIR) -L$(SCOTCHLIBDIR) $(<) -o $(@) $(SCOTCHLIBS) $(LDFLAGS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -I$(SCOTCHINCLUDEDIR) -L$(SCOTCHLIBDIR) $(<) $(SCOTCHLIBS) $(LIBS) -o $(@)
+
+ ##
+ ## Project rules.
+diff -Nur src.orig/esmumps/Makefile src/esmumps/Makefile
+--- src.orig/esmumps/Makefile 2013-02-07 17:27:00.000000000 +0000
++++ src/esmumps/Makefile 2013-02-07 17:28:11.000000000 +0000
+@@ -44,7 +44,7 @@
+ $(CC) $(CFLAGS) $(CLIBFLAGS) -I$(includedir) -c $(<) -o $(@)
+
+ %$(EXE) : %.c
+- $(CC) $(CFLAGS) -I$(includedir) $(<) -o $(@) -L$(libdir) $(LDFLAGS) -L. -l$(ESMUMPSLIB) -l$(SCOTCHLIB) -lscotch -l$(SCOTCHLIB)errexit -lm
++ $(CC) $(CFLAGS) $(LDFLAGS) -I$(includedir) $(<) -L$(libdir) -L. -l$(ESMUMPSLIB) -l$(SCOTCHLIB) -lscotch -l$(SCOTCHLIB)errexit $(LIBS) -o $(@)
+
+ ##
+ ## Project rules.
+@@ -57,7 +57,7 @@
+ libesmumps$(LIB) \
+ main_esmumps$(EXE)
+
+-ptscotch : clean
++ptscotch : clean common.h
+ $(MAKE) CFLAGS="$(CFLAGS) -DSCOTCH_PTSCOTCH" CC=$(CCP) SCOTCHLIB=ptscotch ESMUMPSLIB=ptesmumps \
+ libesmumps$(LIB) \
+ main_esmumps$(EXE)
+@@ -160,6 +160,6 @@
+ order.h \
+ symbol.h \
+ esmumps.h \
+- lib$(ESMUMPSLIB)$(LIB) \
++ libesmumps$(LIB) \
+ $(libdir)/lib$(SCOTCHLIB)$(LIB) \
+ $(libdir)/lib$(SCOTCHLIB)errexit$(LIB)
+diff -Nur src.orig/libscotch/Makefile src/libscotch/Makefile
+--- src.orig/libscotch/Makefile 2013-02-07 17:27:00.000000000 +0000
++++ src/libscotch/Makefile 2013-02-07 17:27:21.000000000 +0000
+@@ -43,7 +43,7 @@
+ $(CC) $(CFLAGS) $(CLIBFLAGS) -c $(<) -o $(@)
+
+ %$(EXE) : %.c
+- $(CC) $(CFLAGS) -DSCOTCH_VERSION=$(VERSION) -DSCOTCH_RELEASE=$(RELEASE) -DSCOTCH_PATCHLEVEL=$(PATCHLEVEL) $(<) -o $(@) $(LDFLAGS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -DSCOTCH_VERSION=$(VERSION) -DSCOTCH_RELEASE=$(RELEASE) -DSCOTCH_PATCHLEVEL=$(PATCHLEVEL) $(<) $(LIBS) -o $(@)
+
+ ##
+ ## Project rules.
+@@ -2908,14 +2908,14 @@
+ mapping.h \
+ order.h \
+ parser.h
+- $(CCD) $(CFLAGS) -DSCOTCH_VERSION=$(VERSION) -DSCOTCH_RELEASE=$(RELEASE) -DSCOTCH_PATCHLEVEL=$(PATCHLEVEL) $(<) -o $(@) $(LDFLAGS)
++ $(CCD) $(CFLAGS) $(LDFLAGS) -DSCOTCH_VERSION=$(VERSION) -DSCOTCH_RELEASE=$(RELEASE) -DSCOTCH_PATCHLEVEL=$(PATCHLEVEL) $(<) $(LIBS) -o $(@)
+
+ ptdummysizes$(EXE) : dummysizes.c \
+ module.h \
+ common.h \
+ dgraph.h \
+ dorder.h
+- $(CCD) $(CFLAGS) -DSCOTCH_VERSION=$(VERSION) -DSCOTCH_RELEASE=$(RELEASE) -DSCOTCH_PATCHLEVEL=$(PATCHLEVEL) $(<) -o $(@) $(LDFLAGS)
++ $(CCD) $(CFLAGS) $(LDFLAGS) -DSCOTCH_VERSION=$(VERSION) -DSCOTCH_RELEASE=$(RELEASE) -DSCOTCH_PATCHLEVEL=$(PATCHLEVEL) $(<) $(LIBS) -o $(@)
+
+ scotch.h : dummysizes$(EXE) \
+ library.h
+diff -Nur src.orig/libscotchmetis/Makefile src/libscotchmetis/Makefile
+--- src.orig/libscotchmetis/Makefile 2013-02-07 17:27:00.000000000 +0000
++++ src/libscotchmetis/Makefile 2013-02-07 17:27:21.000000000 +0000
+@@ -44,7 +44,7 @@
+ $(CC) $(CFLAGS) $(CLIBFLAGS) -I$(includedir) -I../libscotch -c $(<) -o $(@)
+
+ %$(EXE) : %.c
+- $(CC) $(CFLAGS) -I$(includedir) -I../libscotch $(<) -o $(@) -L$(libdir) $(LDFLAGS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -I$(includedir) -I../libscotch $(<) -L$(libdir) -o $(@)
+
+ ##
+ ## Project rules.
+diff -Nur src.orig/scotch/Makefile src/scotch/Makefile
+--- src.orig/scotch/Makefile 2013-02-07 17:27:00.000000000 +0000
++++ src/scotch/Makefile 2013-02-07 17:27:21.000000000 +0000
+@@ -41,13 +41,13 @@
+ include ../Makefile.inc
+
+ %$(EXE) : %$(OBJ)
+- $(CC) $(CFLAGS) -I$(includedir) -I../libscotch $(<) -o $(@) -L$(libdir) -l$(SCOTCHLIB) -lscotch -l$(SCOTCHLIB)errexit $(LDFLAGS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -I$(includedir) -I../libscotch $(<) -L$(libdir) -l$(SCOTCHLIB) -lscotch -l$(SCOTCHLIB)errexit $(LIBS) -o $(@)
+
+ %$(OBJ) : %.c
+ $(CC) $(CFLAGS) -I$(includedir) -I../libscotch -c $(<) -o $(@)
+
+ %$(EXE) : %.c
+- $(CC) $(CFLAGS) -I$(includedir) -I../libscotch $(<) -o $(@) -L$(libdir) -l$(SCOTCHLIB) -lscotch -l$(SCOTCHLIB)errexit $(LDFLAGS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -I$(includedir) -I../libscotch $(<) -L$(libdir) -l$(SCOTCHLIB) -lscotch -l$(SCOTCHLIB)errexit $(LIBS) -o $(@)
+
+ ##
+ ## Project rules.
+@@ -205,7 +205,7 @@
+ $(libdir)/libptscotch$(LIB) \
+ $(libdir)/libptscotcherrexit$(LIB) \
+ dgmap.h
+- $(CC) $(CFLAGS) -I$(includedir) -I../libscotch $(<) -DSCOTCH_COMPILE_PART -o $(@) -L$(libdir) -lptscotch -lscotch -lptscotcherrexit $(LDFLAGS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -I$(includedir) -I../libscotch $(<) -DSCOTCH_COMPILE_PART -L$(libdir) -lptscotch -lscotch -lptscotcherrexit $(LIBS) -o $(@)
+
+ dgscat$(EXE) : dgscat.c \
+ ../libscotch/module.h \
+@@ -315,7 +315,7 @@
+ gout_o.c \
+ $(includedir)/scotch.h \
+ $(libdir)/libscotch$(LIB)
+- $(CC) $(CFLAGS) -I../libscotch -I$(includedir) gout_c.c gout_o.c -o $(@) -L$(libdir) -lscotch -lscotcherrexit $(LDFLAGS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -I../libscotch -I$(includedir) gout_c.c gout_o.c -L$(libdir) -lscotch -lscotcherrexit $(LIBS) -o $(@)
+
+ gpart$(EXE) : gmap.c \
+ ../libscotch/module.h \
+@@ -324,7 +324,7 @@
+ $(libdir)/libscotch$(LIB) \
+ $(libdir)/libscotcherrexit$(LIB) \
+ gmap.h
+- $(CC) $(CFLAGS) -I$(includedir) -I../libscotch $(<) -DSCOTCH_COMPILE_PART -o $(@) -L$(libdir) -lscotch -lscotcherrexit $(LDFLAGS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -I$(includedir) -I../libscotch $(<) -DSCOTCH_COMPILE_PART -L$(libdir) -lscotch -lscotcherrexit $(LIBS) -o $(@)
+
+ gscat$(EXE) : gscat.c \
+ ../libscotch/module.h \
diff --git a/sci-libs/scotch/files/scotch-6.0.4-as-needed.patch b/sci-libs/scotch/files/scotch-6.0.4-as-needed.patch
new file mode 100644
index 000000000000..449449bec073
--- /dev/null
+++ b/sci-libs/scotch/files/scotch-6.0.4-as-needed.patch
@@ -0,0 +1,128 @@
+diff -Nur scotch_6.0.4/src/check/Makefile scotch_6.0.4_patched/src/check/Makefile
+--- scotch_6.0.4/src/check/Makefile 2015-03-01 03:18:02.000000000 -0700
++++ scotch_6.0.4_patched/src/check/Makefile 2015-07-17 15:15:58.447398954 -0600
+@@ -53,7 +53,7 @@
+ $(CC) $(CFLAGS) $(CLIBFLAGS) -I$(SCOTCHINCLUDEDIR) -c $(<) -o $(@)
+
+ %$(EXE) : %.c
+- $(CC) $(CFLAGS) -I$(SCOTCHINCLUDEDIR) -L$(SCOTCHLIBDIR) $(<) -o $(@) $(SCOTCHLIBS) $(LDFLAGS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -I$(SCOTCHINCLUDEDIR) -L$(SCOTCHLIBDIR) $(<) $(SCOTCHLIBS) $(LIBS) -o $(@)
+
+ ##
+ ## Project rules.
+diff -Nur scotch_6.0.4/src/esmumps/Makefile scotch_6.0.4_patched/src/esmumps/Makefile
+--- scotch_6.0.4/src/esmumps/Makefile 2015-03-13 17:32:06.000000000 -0600
++++ scotch_6.0.4_patched/src/esmumps/Makefile 2015-07-17 15:17:47.389600699 -0600
+@@ -44,7 +44,7 @@
+ $(CC) $(CFLAGS) $(CLIBFLAGS) -I$(includedir) -c $(<) -o $(@)
+
+ %$(EXE) : %.c
+- $(CC) $(CFLAGS) -I$(includedir) $(<) -o $(@) -L$(libdir) $(LDFLAGS) -L. -l$(ESMUMPSLIB) -l$(SCOTCHLIB) -lscotch -l$(SCOTCHLIB)errexit -lm
++ $(CC) $(CFLAGS) $(LDFLAGS) -I$(includedir) $(<) -L$(libdir) -L. -l$(ESMUMPSLIB) -l$(SCOTCHLIB) -lscotch -l$(SCOTCHLIB)errexit $(LIBS) -o $(@)
+
+ ##
+ ## Project rules.
+@@ -57,7 +57,7 @@
+ libesmumps$(LIB) \
+ main_esmumps$(EXE)
+
+-ptscotch : clean
++ptscotch : clean common.h
+ $(MAKE) CFLAGS="$(CFLAGS) -DSCOTCH_PTSCOTCH" CC="$(CCP)" SCOTCHLIB=ptscotch ESMUMPSLIB=ptesmumps \
+ libesmumps$(LIB) \
+ main_esmumps$(EXE)
+@@ -160,6 +160,6 @@
+ order.h \
+ symbol.h \
+ esmumps.h \
+- lib$(ESMUMPSLIB)$(LIB) \
++ libesmumps$(LIB) \
+ $(libdir)/lib$(SCOTCHLIB)$(LIB) \
+ $(libdir)/lib$(SCOTCHLIB)errexit$(LIB)
+diff -Nur scotch_6.0.4/src/libscotch/Makefile scotch_6.0.4_patched/src/libscotch/Makefile
+--- scotch_6.0.4/src/libscotch/Makefile 2014-09-23 13:28:28.000000000 -0600
++++ scotch_6.0.4_patched/src/libscotch/Makefile 2015-07-17 15:19:17.320116484 -0600
+@@ -43,7 +43,7 @@
+ $(CC) $(CFLAGS) $(CLIBFLAGS) -c $(<) -o $(@)
+
+ %$(EXE) : %.c
+- $(CC) $(CFLAGS) -DSCOTCH_VERSION=$(VERSION) -DSCOTCH_RELEASE=$(RELEASE) -DSCOTCH_PATCHLEVEL=$(PATCHLEVEL) $(<) -o $(@) $(LDFLAGS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -DSCOTCH_VERSION=$(VERSION) -DSCOTCH_RELEASE=$(RELEASE) -DSCOTCH_PATCHLEVEL=$(PATCHLEVEL) $(<) $(LIBS) -o $(@)
+
+ ##
+ ## Project rules.
+@@ -2937,14 +2937,14 @@
+ mapping.h \
+ order.h \
+ parser.h
+- $(CCD) $(CFLAGS) -DSCOTCH_VERSION=$(VERSION) -DSCOTCH_RELEASE=$(RELEASE) -DSCOTCH_PATCHLEVEL=$(PATCHLEVEL) $(<) -o $(@) $(LDFLAGS)
++ $(CCD) $(CFLAGS) $(LDFLAGS) -DSCOTCH_VERSION=$(VERSION) -DSCOTCH_RELEASE=$(RELEASE) -DSCOTCH_PATCHLEVEL=$(PATCHLEVEL) $(<) $(LIBS) -o $(@)
+
+ ptdummysizes$(EXE) : dummysizes.c \
+ module.h \
+ common.h \
+ dgraph.h \
+ dorder.h
+- $(CCD) $(CFLAGS) -DSCOTCH_VERSION=$(VERSION) -DSCOTCH_RELEASE=$(RELEASE) -DSCOTCH_PATCHLEVEL=$(PATCHLEVEL) $(<) -o $(@) $(LDFLAGS)
++ $(CCD) $(CFLAGS) $(LDFLAGS) -DSCOTCH_VERSION=$(VERSION) -DSCOTCH_RELEASE=$(RELEASE) -DSCOTCH_PATCHLEVEL=$(PATCHLEVEL) $(<) $(LIBS) -o $(@)
+
+ scotch.h : dummysizes$(EXE) \
+ library.h
+diff -Nur scotch_6.0.4/src/libscotchmetis/Makefile scotch_6.0.4_patched/src/libscotchmetis/Makefile
+--- scotch_6.0.4/src/libscotchmetis/Makefile 2011-09-06 10:46:48.000000000 -0600
++++ scotch_6.0.4_patched/src/libscotchmetis/Makefile 2015-07-17 15:19:42.648698497 -0600
+@@ -44,7 +44,7 @@
+ $(CC) $(CFLAGS) $(CLIBFLAGS) -I$(includedir) -I../libscotch -c $(<) -o $(@)
+
+ %$(EXE) : %.c
+- $(CC) $(CFLAGS) -I$(includedir) -I../libscotch $(<) -o $(@) -L$(libdir) $(LDFLAGS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -I$(includedir) -I../libscotch $(<) -L$(libdir) -o $(@)
+
+ ##
+ ## Project rules.
+diff -Nur scotch_6.0.4/src/scotch/Makefile scotch_6.0.4_patched/src/scotch/Makefile
+--- scotch_6.0.4/src/scotch/Makefile 2015-02-24 15:39:44.000000000 -0700
++++ scotch_6.0.4_patched/src/scotch/Makefile 2015-07-17 15:22:25.275015105 -0600
+@@ -41,13 +41,13 @@
+ include ../Makefile.inc
+
+ %$(EXE) : %$(OBJ)
+- $(CC) $(CFLAGS) -I$(includedir) -I../libscotch $(<) -o $(@) -L$(libdir) -l$(SCOTCHLIB) -lscotch -l$(SCOTCHLIB)errexit $(LDFLAGS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -I$(includedir) -I../libscotch $(<) -L$(libdir) -l$(SCOTCHLIB) -lscotch -l$(SCOTCHLIB)errexit $(LIBS) -o $(@)
+
+ %$(OBJ) : %.c
+ $(CC) $(CFLAGS) -I$(includedir) -I../libscotch -c $(<) -o $(@)
+
+ %$(EXE) : %.c
+- $(CC) $(CFLAGS) -I$(includedir) -I../libscotch $(<) -o $(@) -L$(libdir) -l$(SCOTCHLIB) -lscotch -l$(SCOTCHLIB)errexit $(LDFLAGS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -I$(includedir) -I../libscotch $(<) -L$(libdir) -l$(SCOTCHLIB) -lscotch -l$(SCOTCHLIB)errexit $(LIBS) -o $(@)
+
+ ##
+ ## Project rules.
+@@ -209,7 +209,7 @@
+ $(libdir)/libptscotch$(LIB) \
+ $(libdir)/libptscotcherrexit$(LIB) \
+ dgmap.h
+- $(CC) $(CFLAGS) -I$(includedir) -I../libscotch $(<) -DSCOTCH_COMPILE_PART -o $(@) -L$(libdir) -lptscotch -lscotch -lptscotcherrexit $(LDFLAGS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -I$(includedir) -I../libscotch $(<) -DSCOTCH_COMPILE_PART -L$(libdir) -lptscotch -lscotch -lptscotcherrexit $(LIBS) -o $(@)
+
+ dgscat$(EXE) : dgscat.c \
+ ../libscotch/module.h \
+@@ -321,7 +321,7 @@
+ gout_o.c \
+ $(includedir)/scotch.h \
+ $(libdir)/libscotch$(LIB)
+- $(CC) $(CFLAGS) -I../libscotch -I$(includedir) gout_c.c gout_o.c -o $(@) -L$(libdir) -lscotch -lscotcherrexit $(LDFLAGS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -I../libscotch -I$(includedir) gout_c.c gout_o.c -L$(libdir) -lscotch -lscotcherrexit $(LIBS) -o $(@)
+
+ gpart$(EXE) : gmap.c \
+ ../libscotch/module.h \
+@@ -330,7 +330,7 @@
+ $(libdir)/libscotch$(LIB) \
+ $(libdir)/libscotcherrexit$(LIB) \
+ gmap.h
+- $(CC) $(CFLAGS) -I$(includedir) -I../libscotch $(<) -DSCOTCH_COMPILE_PART -o $(@) -L$(libdir) -lscotch -lscotcherrexit $(LDFLAGS)
++ $(CC) $(CFLAGS) $(LDFLAGS) -I$(includedir) -I../libscotch $(<) -DSCOTCH_COMPILE_PART -L$(libdir) -lscotch -lscotcherrexit $(LIBS) -o $(@)
+
+ gscat$(EXE) : gscat.c \
+ ../libscotch/module.h \
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
new file mode 100644
index 000000000000..c1301f57076a
--- /dev/null
+++ b/sci-libs/scotch/files/scotch-6.0.4-flex-2.6.3-fix.patch
@@ -0,0 +1,33 @@
+--- scotch_6.0.4/src/libscotch/parser_ll.l.old 2017-01-02 08:42:41.216249106 -0800
++++ scotch-6.0.4-r1/work/scotch_6.0.4/src/libscotch/parser_ll.l 2017-01-02 09:50:14.572579444 -0800
+@@ -84,20 +84,29 @@
+ #endif /* X_OSDOS */
+
+ #ifdef FLEX_SCANNER
+ #define YY_ALWAYS_INTERACTIVE 1 /* Set the parser as interactive and read one char at a time */
+ #define YY_INPUT(buf,result,max_size) { int c = stratParserInput (); result = (c == 0) ? YY_NULL : ((buf)[0] = c, 1); }
++
++# if YY_FLEX_MAJOR_VERSION > 2 || \
++ YY_FLEX_MAJOR_VERSION == 2 && YY_FLEX_MINOR_VERSION > 6 || \
++ YY_FLEX_MAJOR_VERSION == 2 && YY_FLEX_MINOR_VERSION == 6 && YY_FLEX_SUBMINOR_VERSION >= 3
++ int yywrap() { return 1; }
++# else
++# define yywrap() (1) /* Always return end-of-file on end-of-string */
++# endif
++
+ #else /* FLEX_SCANNER */
+ #undef getc /* Redirect I/O functions */
+ #define getc yygetc
+ #undef yygetc
+ #define yygetc(stream) stratParserInput ()
++#define yywrap() (1) /* Always return end-of-file on end-of-string */
+ #endif /* FLEX_SCANNER */
+
+ #define YY_NO_UNPUT /* No prototype for yyunput as not defined */
+ #define YY_SKIP_YYWRAP /* No prototype for yywrap as defined as macro */
+-#define yywrap() (1) /* Always return end-of-file on end-of-string */
+
+ /*
+ ** The static variables.
+ */
+
diff --git a/sci-libs/scotch/metadata.xml b/sci-libs/scotch/metadata.xml
new file mode 100644
index 000000000000..9b35c1ac8b7f
--- /dev/null
+++ b/sci-libs/scotch/metadata.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer type="person">
+ <email>patrick@gentoo.org</email>
+ <name>Patrick Lauer</name>
+</maintainer>
+<maintainer type="person">
+ <email>oli.borm@web.de</email>
+ <name>Oliver Borm</name>
+</maintainer>
+<maintainer type="project">
+ <email>sci@gentoo.org</email>
+ <name>Gentoo Science Project</name>
+</maintainer>
+<maintainer type="project">
+ <email>proxy-maint@gentoo.org</email>
+ <name>Proxy Maintainers</name>
+</maintainer>
+<use>
+ <flag name="int64">Build the 64 bits integer library (needed for &gt; 2^31 vertices)</flag>
+ <flag name="tools">Build and install extra exec tools</flag>
+</use>
+<longdescription lang="en">
+ SCOTCH is a software package and libraries for graph, mesh and
+ hypergraph partitioning, static mapping, and sparse matrix block
+ ordering.
+ Its purpose of Scotch is to apply graph theory, with a divide and
+ conquer approach, to scientific computing problems such as graph and
+ mesh partitioning, static mapping, and sparse matrix ordering, in
+ application domains ranging from structural mechanics to operating
+ systems or bio-chemistry.
+ The SCOTCH distribution is a set of programs and libraries which
+ implement the static mapping and sparse matrix reordering algorithms
+ developed within the SCOTCH project.
+</longdescription>
+</pkgmetadata>
diff --git a/sci-libs/scotch/scotch-5.1.12b.ebuild b/sci-libs/scotch/scotch-5.1.12b.ebuild
new file mode 100644
index 000000000000..7188b5ab48f2
--- /dev/null
+++ b/sci-libs/scotch/scotch-5.1.12b.ebuild
@@ -0,0 +1,157 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=4
+
+inherit eutils toolchain-funcs versionator flag-o-matic multilib
+
+# use esmumps version to allow linking with mumps
+MYP="${PN}_${PV}_esmumps"
+# download id on gforge changes every goddamn release
+DID=28978
+
+DESCRIPTION="Software for graph, mesh and hypergraph partitioning"
+HOMEPAGE="http://www.labri.u-bordeaux.fr/perso/pelegrin/scotch/"
+# broken ssl cert, so mirroring
+#SRC_URI="http://gforge.inria.fr/frs/download.php/${DID}/${MYP}.tar.gz"
+SRC_URI="http://dev.gentooexperimental.org/~patrick/${MYP}.tar.gz"
+
+LICENSE="CeCILL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="doc examples int64 mpi static-libs tools"
+
+DEPEND="sys-libs/zlib
+ mpi? ( virtual/mpi )"
+RDEPEND="${DEPEND}"
+
+S="${WORKDIR}/${MYP/b}"
+
+static_to_shared() {
+ local libstatic=${1}; shift
+ local libname=$(basename ${libstatic%.a})
+ local soname=${libname}$(get_libname $(get_version_component_range 1-2))
+ local libdir=$(dirname ${libstatic})
+
+ einfo "Making ${soname} from ${libstatic}"
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ ${LINK:-$(tc-getCC)} ${LDFLAGS} \
+ -dynamiclib -install_name "${EPREFIX}"/usr/lib/"${soname}" \
+ -Wl,-all_load -Wl,${libstatic} \
+ "$@" -o ${libdir}/${soname} || die "${soname} failed"
+ else
+ ${LINK:-$(tc-getCC)} ${LDFLAGS} \
+ -shared -Wl,-soname=${soname} \
+ -Wl,--whole-archive ${libstatic} -Wl,--no-whole-archive \
+ "$@" -o ${libdir}/${soname} || die "${soname} failed"
+ [[ $(get_version_component_count) -gt 1 ]] && \
+ ln -s ${soname} ${libdir}/${libname}$(get_libname $(get_major_version))
+ ln -s ${soname} ${libdir}/${libname}$(get_libname)
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-as-needed.patch
+ sed -e "s/gcc/$(tc-getCC)/" \
+ -e "s/-O3/${CFLAGS} -pthread/" \
+ -e "s/ ar/ $(tc-getAR)/" \
+ -e "s/ranlib/$(tc-getRANLIB)/" \
+ src/Make.inc/Makefile.inc.i686_pc_linux2 > src/Makefile.inc || die
+ use int64 && append-cflags -DIDXSIZE64
+}
+
+src_compile() {
+ emake -C src CLIBFLAGS=-fPIC
+ static_to_shared lib/libscotcherr.a
+ static_to_shared lib/libscotcherrexit.a
+ static_to_shared lib/libscotch.a -Llib -lz -lm -lrt -lscotcherr
+ static_to_shared lib/libesmumps.a -Llib -lscotch
+ static_to_shared lib/libscotchmetis.a -Llib -lscotch
+
+ if use mpi; then
+ emake -C src CLIBFLAGS=-fPIC ptscotch
+ export LINK=mpicc
+ static_to_shared lib/libptscotcherr.a
+ static_to_shared lib/libptscotcherrexit.a
+ static_to_shared lib/libptscotch.a -Llib -lptscotcherr -lz -lm -lrt
+ static_to_shared lib/libptesmumps.a -Llib -lptscotch
+ static_to_shared lib/libptscotchparmetis.a -Llib -lptscotch
+ fi
+ if use static-libs; then
+ emake -C src clean
+ emake -C src
+ use mpi && emake -C src ptscotch
+ fi
+}
+
+src_install() {
+ dolib.so lib/lib*$(get_libname)*
+ use static-libs && dolib.a lib/*.a
+
+ insinto /usr/include/scotch
+ doins include/*
+
+ cat <<-EOF > scotchmetis.pc
+ prefix=${EPREFIX}/usr
+ libdir=\${prefix}/$(get_libdir)
+ includedir=\${prefix}/include
+ Name: scotchmetis
+ Description: ${DESCRIPTION}
+ Version: ${PV}
+ URL: ${HOMEPAGE}
+ Libs: -L\${libdir} -lscotchmetis -lscotcherr -lscotch
+ Private: -lm -lz -lrt
+ Cflags: -I\${includedir}/scotch
+ EOF
+ insinto /usr/$(get_libdir)/pkgconfig
+ doins scotchmetis.pc
+
+ # not sure it is actually a full replacement of metis
+ #alternatives_for metis scotch 0 \
+ # /usr/$(get_libdir)/pkgconfig/metis.pc scotchmetis.pc
+
+ if use mpi; then
+ cat <<-EOF > ptscotchparmetis.pc
+ prefix=${EPREFIX}/usr
+ libdir=\${prefix}/$(get_libdir)
+ includedir=\${prefix}/include
+ Name: ptscotchparmetis
+ Description: ${DESCRIPTION}
+ Version: ${PV}
+ URL: ${HOMEPAGE}
+ Libs: -L\${libdir} -lptscotchparmetis -lptscotcherr -lptscotch
+ Private: -lm -lz -lrt
+ Cflags: -I\${includedir}/scotch
+ Requires: scotchmetis
+ EOF
+ insinto /usr/$(get_libdir)/pkgconfig
+ doins ptscotchparmetis.pc
+ # not sure it is actually a full replacement of parmetis
+ #alternatives_for metis-mpi ptscotch 0 \
+ # /usr/$(get_libdir)/pkgconfig/metis-mpi.pc ptscotchparmetis.pc
+ fi
+
+ dodoc README.txt
+
+ if use tools; then
+ local b m
+ pushd bin > /dev/null
+ for b in *; do
+ newbin ${b} scotch_${b}
+ done
+ popd > /dev/null
+
+ pushd man/man1 > /dev/null
+ for m in *; do
+ newman ${m} scotch_${m}
+ done
+ popd > /dev/null
+ fi
+
+ use doc && dodoc doc/*.pdf
+
+ if use examples; then
+ insinto /usr/share/doc/${PF}/examples
+ doins -r examples/* tgt grf
+ fi
+}
diff --git a/sci-libs/scotch/scotch-6.0.0.ebuild b/sci-libs/scotch/scotch-6.0.0.ebuild
new file mode 100644
index 000000000000..c88bdc8a91c5
--- /dev/null
+++ b/sci-libs/scotch/scotch-6.0.0.ebuild
@@ -0,0 +1,165 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+inherit eutils toolchain-funcs versionator flag-o-matic multilib
+
+# use esmumps version to allow linking with mumps
+MYP="${PN}_${PV}_esmumps"
+# download id on gforge changes every goddamn release
+DID=31832
+SOVER=$(get_major_version)
+
+DESCRIPTION="Software for graph, mesh and hypergraph partitioning"
+HOMEPAGE="http://www.labri.u-bordeaux.fr/perso/pelegrin/scotch/"
+SRC_URI="http://gforge.inria.fr/frs/download.php/${DID}/${MYP}.tar.gz"
+
+LICENSE="CeCILL-2"
+SLOT="0/${SOVER}"
+KEYWORDS="amd64 x86 ~amd64-linux ~x86-linux"
+IUSE="doc int64 mpi static-libs tools threads"
+
+DEPEND="
+ sys-libs/zlib
+ mpi? ( virtual/mpi )"
+RDEPEND="${DEPEND}"
+
+S="${WORKDIR}/${MYP/b}"
+
+static_to_shared() {
+ local libstatic=${1}; shift
+ local libname=$(basename ${libstatic%.a})
+ local soname=${libname}$(get_libname ${SOVER})
+ local libdir=$(dirname ${libstatic})
+
+ einfo "Making ${soname} from ${libstatic}"
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ ${LINK:-$(tc-getCC)} ${LDFLAGS} \
+ -dynamiclib -install_name "${EPREFIX}"/usr/lib/"${soname}" \
+ -Wl,-all_load -Wl,${libstatic} \
+ "$@" -o ${libdir}/${soname} || die "${soname} failed"
+ else
+ ${LINK:-$(tc-getCC)} ${LDFLAGS} \
+ -shared -Wl,-soname=${soname} \
+ -Wl,--whole-archive ${libstatic} -Wl,--no-whole-archive \
+ "$@" -o ${libdir}/${soname} || die "${soname} failed"
+ [[ $(get_version_component_count) -gt 1 ]] && \
+ ln -s ${soname} ${libdir}/${libname}$(get_libname $(get_major_version))
+ ln -s ${soname} ${libdir}/${libname}$(get_libname)
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-as-needed.patch
+ use int64 && append-cflags -DIDXSIZE64
+ if use threads; then
+ append-cflags "-DSCOTCH_PTHREAD_NUMBER=$(nproc)"
+ else
+ append-cflags "-DSCOTCH_PTHREAD_NUMBER=1"
+ sed -i \
+ -e 's/ -DSCOTCH_PTHREAD//' \
+ src/Make.inc/Makefile.inc.i686_pc_linux3 || die
+ fi
+ sed -e "s/gcc/$(tc-getCC)/" \
+ -e "s/-O3/${CFLAGS} -pthread/" \
+ -e "s/ ar/ $(tc-getAR)/" \
+ -e "s/ranlib/$(tc-getRANLIB)/" \
+ -e "s/LDFLAGS/LIBS/" \
+ src/Make.inc/Makefile.inc.i686_pc_linux3 > src/Makefile.inc || die
+}
+
+src_compile() {
+ emake -C src CLIBFLAGS=-fPIC scotch esmumps
+ static_to_shared lib/libscotcherr.a
+ static_to_shared lib/libscotcherrexit.a
+ static_to_shared lib/libscotch.a -Llib -lz -lm -lrt -lpthread -lscotcherr
+ static_to_shared lib/libesmumps.a -Llib -lscotch
+ static_to_shared lib/libscotchmetis.a -Llib -lscotch
+
+ if use mpi; then
+ emake -C src CLIBFLAGS=-fPIC ptscotch ptesmumps
+ export LINK=mpicc
+ static_to_shared lib/libptscotcherr.a
+ static_to_shared lib/libptscotcherrexit.a
+ static_to_shared lib/libptscotch.a -Llib -lscotch -lptscotcherr -lz -lm -lrt
+ static_to_shared lib/libptesmumps.a -Llib -lscotch -lptscotch
+ static_to_shared lib/libptscotchparmetis.a -Llib -lscotch -lptscotch
+ fi
+ if use static-libs; then
+ emake -C src clean
+ emake -C src
+ use mpi && emake -C src ptscotch
+ fi
+}
+
+src_test() {
+ LD_LIBRARY_PATH="${S}/lib" emake -C src check
+}
+
+src_install() {
+ dolib.so lib/lib*$(get_libname)*
+ use static-libs && dolib.a lib/*.a
+
+ insinto /usr/include/scotch
+ doins include/*
+
+ cat <<-EOF > scotchmetis.pc
+ prefix=${EPREFIX}/usr
+ libdir=\${prefix}/$(get_libdir)
+ includedir=\${prefix}/include
+ Name: scotchmetis
+ Description: ${DESCRIPTION}
+ Version: ${PV}
+ URL: ${HOMEPAGE}
+ Libs: -L\${libdir} -lscotchmetis -lscotcherr -lscotch
+ Private: -lm -lz -lrt
+ Cflags: -I\${includedir}/scotch
+ EOF
+ insinto /usr/$(get_libdir)/pkgconfig
+ doins scotchmetis.pc
+
+ # not sure it is actually a full replacement of metis
+ #alternatives_for metis scotch 0 \
+ # /usr/$(get_libdir)/pkgconfig/metis.pc scotchmetis.pc
+
+ if use mpi; then
+ cat <<-EOF > ptscotchparmetis.pc
+ prefix=${EPREFIX}/usr
+ libdir=\${prefix}/$(get_libdir)
+ includedir=\${prefix}/include
+ Name: ptscotchparmetis
+ Description: ${DESCRIPTION}
+ Version: ${PV}
+ URL: ${HOMEPAGE}
+ Libs: -L\${libdir} -lptscotchparmetis -lptscotcherr -lptscotch
+ Private: -lm -lz -lrt
+ Cflags: -I\${includedir}/scotch
+ Requires: scotchmetis
+ EOF
+ insinto /usr/$(get_libdir)/pkgconfig
+ doins ptscotchparmetis.pc
+ # not sure it is actually a full replacement of parmetis
+ #alternatives_for metis-mpi ptscotch 0 \
+ # /usr/$(get_libdir)/pkgconfig/metis-mpi.pc ptscotchparmetis.pc
+ fi
+
+ dodoc README.txt
+
+ if use tools; then
+ local b m
+ pushd bin > /dev/null
+ for b in *; do
+ newbin ${b} scotch_${b}
+ done
+ popd > /dev/null
+
+ pushd man/man1 > /dev/null
+ for m in *; do
+ newman ${m} scotch_${m}
+ done
+ popd > /dev/null
+ fi
+
+ use doc && dodoc doc/*.pdf
+}
diff --git a/sci-libs/scotch/scotch-6.0.4-r1.ebuild b/sci-libs/scotch/scotch-6.0.4-r1.ebuild
new file mode 100644
index 000000000000..28112e3244c3
--- /dev/null
+++ b/sci-libs/scotch/scotch-6.0.4-r1.ebuild
@@ -0,0 +1,171 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+inherit eutils toolchain-funcs versionator flag-o-matic multilib
+
+# use esmumps version to allow linking with mumps
+MYP="${PN}_${PV}_esmumps"
+# download id on gforge changes every goddamn release
+DID=34618
+SOVER=$(get_major_version)
+
+DESCRIPTION="Software for graph, mesh and hypergraph partitioning"
+HOMEPAGE="http://www.labri.u-bordeaux.fr/perso/pelegrin/scotch/"
+SRC_URI="http://gforge.inria.fr/frs/download.php/${DID}/${MYP}.tar.gz"
+
+LICENSE="CeCILL-2"
+SLOT="0/${SOVER}"
+KEYWORDS="~alpha ~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="doc int64 mpi static-libs tools threads"
+
+DEPEND="
+ sys-libs/zlib
+ mpi? ( virtual/mpi )"
+RDEPEND="${DEPEND}"
+
+S=${WORKDIR}/${P/-/_}
+
+static_to_shared() {
+ local libstatic=${1}; shift
+ local libname=$(basename ${libstatic%.a})
+ local soname=${libname}$(get_libname ${SOVER})
+ local libdir=$(dirname ${libstatic})
+
+ einfo "Making ${soname} from ${libstatic}"
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ ${LINK:-$(tc-getCC)} ${LDFLAGS} \
+ -dynamiclib -install_name "${EPREFIX}"/usr/lib/"${soname}" \
+ -Wl,-all_load -Wl,${libstatic} \
+ "$@" -o ${libdir}/${soname} || die "${soname} failed"
+ else
+ ${LINK:-$(tc-getCC)} ${LDFLAGS} \
+ -shared -Wl,-soname=${soname} \
+ -Wl,--whole-archive ${libstatic} -Wl,--no-whole-archive \
+ "$@" -o ${libdir}/${soname} || die "${soname} failed"
+ [[ $(get_version_component_count) -gt 1 ]] && \
+ ln -s ${soname} ${libdir}/${libname}$(get_libname $(get_major_version))
+ ln -s ${soname} ${libdir}/${libname}$(get_libname)
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-as-needed.patch
+ use int64 && append-cflags -DIDXSIZE64
+ if use threads; then
+ append-cflags "-DSCOTCH_PTHREAD_NUMBER=$(nproc)"
+ else
+ append-cflags "-DSCOTCH_PTHREAD_NUMBER=1"
+ sed -i \
+ -e 's/ -DSCOTCH_PTHREAD//' \
+ src/Make.inc/Makefile.inc.i686_pc_linux3 || die
+ fi
+ sed -e "s/gcc/$(tc-getCC)/" \
+ -e "s/-O3/${CFLAGS} -pthread/" \
+ -e "s/ ar/ $(tc-getAR)/" \
+ -e "s/ranlib/$(tc-getRANLIB)/" \
+ -e "s/LDFLAGS/LIBS/" \
+ src/Make.inc/Makefile.inc.i686_pc_linux3 > src/Makefile.inc || die
+}
+
+src_compile() {
+ emake -C src CLIBFLAGS=-fPIC scotch esmumps
+ static_to_shared lib/libscotcherr.a
+ static_to_shared lib/libscotcherrexit.a
+ static_to_shared lib/libscotch.a -Llib -lz -lm -lrt -lpthread -lscotcherr
+ static_to_shared lib/libesmumps.a -Llib -lscotch
+ static_to_shared lib/libscotchmetis.a -Llib -lscotch
+
+ if use mpi; then
+ emake -C src CLIBFLAGS=-fPIC ptscotch ptesmumps
+ export LINK=mpicc
+ static_to_shared lib/libptscotcherr.a
+ static_to_shared lib/libptscotcherrexit.a
+ static_to_shared lib/libptscotch.a -Llib -lscotch -lptscotcherr -lz -lm -lrt
+ static_to_shared lib/libptesmumps.a -Llib -lscotch -lptscotch
+ static_to_shared lib/libptscotchparmetis.a -Llib -lscotch -lptscotch
+ fi
+ if use static-libs; then
+ emake -C src clean
+ emake -C src
+ use mpi && emake -C src ptscotch
+ fi
+}
+
+src_test() {
+ LD_LIBRARY_PATH="${S}/lib" emake -C src check
+}
+
+src_install() {
+ dolib.so lib/lib*$(get_libname)*
+ use static-libs && dolib.a lib/*.a
+
+ #install metis headers into a subdir
+ #to allow usage of real metis and scotch
+ #in the same code
+ insinto /usr/include/scotch/metis
+ doins include/*metis*
+ rm include/*metis*
+ insinto /usr/include/scotch
+ doins include/*
+
+ cat <<-EOF > scotchmetis.pc
+ prefix=${EPREFIX}/usr
+ libdir=\${prefix}/$(get_libdir)
+ includedir=\${prefix}/include
+ Name: scotchmetis
+ Description: ${DESCRIPTION}
+ Version: ${PV}
+ URL: ${HOMEPAGE}
+ Libs: -L\${libdir} -lscotchmetis -lscotcherr -lscotch
+ Private: -lm -lz -lrt
+ Cflags: -I\${includedir}/scotch/metis
+ EOF
+ insinto /usr/$(get_libdir)/pkgconfig
+ doins scotchmetis.pc
+
+ # not sure it is actually a full replacement of metis
+ #alternatives_for metis scotch 0 \
+ # /usr/$(get_libdir)/pkgconfig/metis.pc scotchmetis.pc
+
+ if use mpi; then
+ cat <<-EOF > ptscotchparmetis.pc
+ prefix=${EPREFIX}/usr
+ libdir=\${prefix}/$(get_libdir)
+ includedir=\${prefix}/include
+ Name: ptscotchparmetis
+ Description: ${DESCRIPTION}
+ Version: ${PV}
+ URL: ${HOMEPAGE}
+ Libs: -L\${libdir} -lptscotchparmetis -lptscotcherr -lptscotch
+ Private: -lm -lz -lrt
+ Cflags: -I\${includedir}/scotch/metis
+ Requires: scotchmetis
+ EOF
+ insinto /usr/$(get_libdir)/pkgconfig
+ doins ptscotchparmetis.pc
+ # not sure it is actually a full replacement of parmetis
+ #alternatives_for metis-mpi ptscotch 0 \
+ # /usr/$(get_libdir)/pkgconfig/metis-mpi.pc ptscotchparmetis.pc
+ fi
+
+ dodoc README.txt
+
+ if use tools; then
+ local b m
+ pushd bin > /dev/null
+ for b in *; do
+ newbin ${b} scotch_${b}
+ done
+ popd > /dev/null
+
+ pushd man/man1 > /dev/null
+ for m in *; do
+ newman ${m} scotch_${m}
+ done
+ popd > /dev/null
+ fi
+
+ use doc && dodoc doc/*.pdf
+}
diff --git a/sci-libs/scotch/scotch-6.0.4-r2.ebuild b/sci-libs/scotch/scotch-6.0.4-r2.ebuild
new file mode 100644
index 000000000000..b5daf21f66a8
--- /dev/null
+++ b/sci-libs/scotch/scotch-6.0.4-r2.ebuild
@@ -0,0 +1,172 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+inherit eutils toolchain-funcs versionator flag-o-matic multilib
+
+# use esmumps version to allow linking with mumps
+MYP="${PN}_${PV}_esmumps"
+# download id on gforge changes every goddamn release
+DID=34618
+SOVER=$(get_major_version)
+
+DESCRIPTION="Software for graph, mesh and hypergraph partitioning"
+HOMEPAGE="http://www.labri.u-bordeaux.fr/perso/pelegrin/scotch/"
+SRC_URI="http://gforge.inria.fr/frs/download.php/${DID}/${MYP}.tar.gz"
+
+LICENSE="CeCILL-2"
+SLOT="0/${SOVER}"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="doc int64 mpi static-libs tools threads"
+
+DEPEND="
+ sys-libs/zlib
+ mpi? ( virtual/mpi )"
+RDEPEND="${DEPEND}"
+
+S=${WORKDIR}/${P/-/_}
+
+static_to_shared() {
+ local libstatic=${1}; shift
+ local libname=$(basename ${libstatic%.a})
+ local soname=${libname}$(get_libname ${SOVER})
+ local libdir=$(dirname ${libstatic})
+
+ einfo "Making ${soname} from ${libstatic}"
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ ${LINK:-$(tc-getCC)} ${LDFLAGS} \
+ -dynamiclib -install_name "${EPREFIX}"/usr/lib/"${soname}" \
+ -Wl,-all_load -Wl,${libstatic} \
+ "$@" -o ${libdir}/${soname} || die "${soname} failed"
+ else
+ ${LINK:-$(tc-getCC)} ${LDFLAGS} \
+ -shared -Wl,-soname=${soname} \
+ -Wl,--whole-archive ${libstatic} -Wl,--no-whole-archive \
+ "$@" -o ${libdir}/${soname} || die "${soname} failed"
+ [[ $(get_version_component_count) -gt 1 ]] && \
+ ln -s ${soname} ${libdir}/${libname}$(get_libname $(get_major_version))
+ ln -s ${soname} ${libdir}/${libname}$(get_libname)
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-as-needed.patch
+ epatch "${FILESDIR}"/${P}-flex-2.6.3-fix.patch
+ use int64 && append-cflags -DIDXSIZE64
+ if use threads; then
+ append-cflags "-DSCOTCH_PTHREAD_NUMBER=$(nproc)"
+ else
+ append-cflags "-DSCOTCH_PTHREAD_NUMBER=1"
+ sed -i \
+ -e 's/ -DSCOTCH_PTHREAD//' \
+ src/Make.inc/Makefile.inc.i686_pc_linux3 || die
+ fi
+ sed -e "s/gcc/$(tc-getCC)/" \
+ -e "s/-O3/${CFLAGS} -pthread/" \
+ -e "s/ ar/ $(tc-getAR)/" \
+ -e "s/ranlib/$(tc-getRANLIB)/" \
+ -e "s/LDFLAGS/LIBS/" \
+ src/Make.inc/Makefile.inc.i686_pc_linux3 > src/Makefile.inc || die
+}
+
+src_compile() {
+ emake -C src CLIBFLAGS=-fPIC scotch esmumps
+ static_to_shared lib/libscotcherr.a
+ static_to_shared lib/libscotcherrexit.a
+ static_to_shared lib/libscotch.a -Llib -lz -lm -lrt -lpthread -lscotcherr
+ static_to_shared lib/libesmumps.a -Llib -lscotch
+ static_to_shared lib/libscotchmetis.a -Llib -lscotch
+
+ if use mpi; then
+ emake -C src CLIBFLAGS=-fPIC ptscotch ptesmumps
+ export LINK=mpicc
+ static_to_shared lib/libptscotcherr.a
+ static_to_shared lib/libptscotcherrexit.a
+ static_to_shared lib/libptscotch.a -Llib -lscotch -lptscotcherr -lz -lm -lrt
+ static_to_shared lib/libptesmumps.a -Llib -lscotch -lptscotch
+ static_to_shared lib/libptscotchparmetis.a -Llib -lscotch -lptscotch
+ fi
+ if use static-libs; then
+ emake -C src clean
+ emake -C src
+ use mpi && emake -C src ptscotch
+ fi
+}
+
+src_test() {
+ LD_LIBRARY_PATH="${S}/lib" emake -C src check
+}
+
+src_install() {
+ dolib.so lib/lib*$(get_libname)*
+ use static-libs && dolib.a lib/*.a
+
+ #install metis headers into a subdir
+ #to allow usage of real metis and scotch
+ #in the same code
+ insinto /usr/include/scotch/metis
+ doins include/*metis*
+ rm include/*metis*
+ insinto /usr/include/scotch
+ doins include/*
+
+ cat <<-EOF > scotchmetis.pc
+ prefix=${EPREFIX}/usr
+ libdir=\${prefix}/$(get_libdir)
+ includedir=\${prefix}/include
+ Name: scotchmetis
+ Description: ${DESCRIPTION}
+ Version: ${PV}
+ URL: ${HOMEPAGE}
+ Libs: -L\${libdir} -lscotchmetis -lscotcherr -lscotch
+ Private: -lm -lz -lrt
+ Cflags: -I\${includedir}/scotch/metis
+ EOF
+ insinto /usr/$(get_libdir)/pkgconfig
+ doins scotchmetis.pc
+
+ # not sure it is actually a full replacement of metis
+ #alternatives_for metis scotch 0 \
+ # /usr/$(get_libdir)/pkgconfig/metis.pc scotchmetis.pc
+
+ if use mpi; then
+ cat <<-EOF > ptscotchparmetis.pc
+ prefix=${EPREFIX}/usr
+ libdir=\${prefix}/$(get_libdir)
+ includedir=\${prefix}/include
+ Name: ptscotchparmetis
+ Description: ${DESCRIPTION}
+ Version: ${PV}
+ URL: ${HOMEPAGE}
+ Libs: -L\${libdir} -lptscotchparmetis -lptscotcherr -lptscotch
+ Private: -lm -lz -lrt
+ Cflags: -I\${includedir}/scotch/metis
+ Requires: scotchmetis
+ EOF
+ insinto /usr/$(get_libdir)/pkgconfig
+ doins ptscotchparmetis.pc
+ # not sure it is actually a full replacement of parmetis
+ #alternatives_for metis-mpi ptscotch 0 \
+ # /usr/$(get_libdir)/pkgconfig/metis-mpi.pc ptscotchparmetis.pc
+ fi
+
+ dodoc README.txt
+
+ if use tools; then
+ local b m
+ pushd bin > /dev/null
+ for b in *; do
+ newbin ${b} scotch_${b}
+ done
+ popd > /dev/null
+
+ pushd man/man1 > /dev/null
+ for m in *; do
+ newman ${m} scotch_${m}
+ done
+ popd > /dev/null
+ fi
+
+ use doc && dodoc doc/*.pdf
+}
diff --git a/sci-libs/scotch/scotch-6.0.4.ebuild b/sci-libs/scotch/scotch-6.0.4.ebuild
new file mode 100644
index 000000000000..9ce7d7b3a14b
--- /dev/null
+++ b/sci-libs/scotch/scotch-6.0.4.ebuild
@@ -0,0 +1,165 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+inherit eutils toolchain-funcs versionator flag-o-matic multilib
+
+# use esmumps version to allow linking with mumps
+MYP="${PN}_${PV}_esmumps"
+# download id on gforge changes every goddamn release
+DID=34618
+SOVER=$(get_major_version)
+
+DESCRIPTION="Software for graph, mesh and hypergraph partitioning"
+HOMEPAGE="http://www.labri.u-bordeaux.fr/perso/pelegrin/scotch/"
+SRC_URI="http://gforge.inria.fr/frs/download.php/${DID}/${MYP}.tar.gz"
+
+LICENSE="CeCILL-2"
+SLOT="0/${SOVER}"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="doc int64 mpi static-libs tools threads"
+
+DEPEND="
+ sys-libs/zlib
+ mpi? ( virtual/mpi )"
+RDEPEND="${DEPEND}"
+
+S=${WORKDIR}/${P/-/_}
+
+static_to_shared() {
+ local libstatic=${1}; shift
+ local libname=$(basename ${libstatic%.a})
+ local soname=${libname}$(get_libname ${SOVER})
+ local libdir=$(dirname ${libstatic})
+
+ einfo "Making ${soname} from ${libstatic}"
+ if [[ ${CHOST} == *-darwin* ]] ; then
+ ${LINK:-$(tc-getCC)} ${LDFLAGS} \
+ -dynamiclib -install_name "${EPREFIX}"/usr/lib/"${soname}" \
+ -Wl,-all_load -Wl,${libstatic} \
+ "$@" -o ${libdir}/${soname} || die "${soname} failed"
+ else
+ ${LINK:-$(tc-getCC)} ${LDFLAGS} \
+ -shared -Wl,-soname=${soname} \
+ -Wl,--whole-archive ${libstatic} -Wl,--no-whole-archive \
+ "$@" -o ${libdir}/${soname} || die "${soname} failed"
+ [[ $(get_version_component_count) -gt 1 ]] && \
+ ln -s ${soname} ${libdir}/${libname}$(get_libname $(get_major_version))
+ ln -s ${soname} ${libdir}/${libname}$(get_libname)
+ fi
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-as-needed.patch
+ use int64 && append-cflags -DIDXSIZE64
+ if use threads; then
+ append-cflags "-DSCOTCH_PTHREAD_NUMBER=$(nproc)"
+ else
+ append-cflags "-DSCOTCH_PTHREAD_NUMBER=1"
+ sed -i \
+ -e 's/ -DSCOTCH_PTHREAD//' \
+ src/Make.inc/Makefile.inc.i686_pc_linux3 || die
+ fi
+ sed -e "s/gcc/$(tc-getCC)/" \
+ -e "s/-O3/${CFLAGS} -pthread/" \
+ -e "s/ ar/ $(tc-getAR)/" \
+ -e "s/ranlib/$(tc-getRANLIB)/" \
+ -e "s/LDFLAGS/LIBS/" \
+ src/Make.inc/Makefile.inc.i686_pc_linux3 > src/Makefile.inc || die
+}
+
+src_compile() {
+ emake -C src CLIBFLAGS=-fPIC scotch esmumps
+ static_to_shared lib/libscotcherr.a
+ static_to_shared lib/libscotcherrexit.a
+ static_to_shared lib/libscotch.a -Llib -lz -lm -lrt -lpthread -lscotcherr
+ static_to_shared lib/libesmumps.a -Llib -lscotch
+ static_to_shared lib/libscotchmetis.a -Llib -lscotch
+
+ if use mpi; then
+ emake -C src CLIBFLAGS=-fPIC ptscotch ptesmumps
+ export LINK=mpicc
+ static_to_shared lib/libptscotcherr.a
+ static_to_shared lib/libptscotcherrexit.a
+ static_to_shared lib/libptscotch.a -Llib -lscotch -lptscotcherr -lz -lm -lrt
+ static_to_shared lib/libptesmumps.a -Llib -lscotch -lptscotch
+ static_to_shared lib/libptscotchparmetis.a -Llib -lscotch -lptscotch
+ fi
+ if use static-libs; then
+ emake -C src clean
+ emake -C src
+ use mpi && emake -C src ptscotch
+ fi
+}
+
+src_test() {
+ LD_LIBRARY_PATH="${S}/lib" emake -C src check
+}
+
+src_install() {
+ dolib.so lib/lib*$(get_libname)*
+ use static-libs && dolib.a lib/*.a
+
+ insinto /usr/include/scotch
+ doins include/*
+
+ cat <<-EOF > scotchmetis.pc
+ prefix=${EPREFIX}/usr
+ libdir=\${prefix}/$(get_libdir)
+ includedir=\${prefix}/include
+ Name: scotchmetis
+ Description: ${DESCRIPTION}
+ Version: ${PV}
+ URL: ${HOMEPAGE}
+ Libs: -L\${libdir} -lscotchmetis -lscotcherr -lscotch
+ Private: -lm -lz -lrt
+ Cflags: -I\${includedir}/scotch
+ EOF
+ insinto /usr/$(get_libdir)/pkgconfig
+ doins scotchmetis.pc
+
+ # not sure it is actually a full replacement of metis
+ #alternatives_for metis scotch 0 \
+ # /usr/$(get_libdir)/pkgconfig/metis.pc scotchmetis.pc
+
+ if use mpi; then
+ cat <<-EOF > ptscotchparmetis.pc
+ prefix=${EPREFIX}/usr
+ libdir=\${prefix}/$(get_libdir)
+ includedir=\${prefix}/include
+ Name: ptscotchparmetis
+ Description: ${DESCRIPTION}
+ Version: ${PV}
+ URL: ${HOMEPAGE}
+ Libs: -L\${libdir} -lptscotchparmetis -lptscotcherr -lptscotch
+ Private: -lm -lz -lrt
+ Cflags: -I\${includedir}/scotch
+ Requires: scotchmetis
+ EOF
+ insinto /usr/$(get_libdir)/pkgconfig
+ doins ptscotchparmetis.pc
+ # not sure it is actually a full replacement of parmetis
+ #alternatives_for metis-mpi ptscotch 0 \
+ # /usr/$(get_libdir)/pkgconfig/metis-mpi.pc ptscotchparmetis.pc
+ fi
+
+ dodoc README.txt
+
+ if use tools; then
+ local b m
+ pushd bin > /dev/null
+ for b in *; do
+ newbin ${b} scotch_${b}
+ done
+ popd > /dev/null
+
+ pushd man/man1 > /dev/null
+ for m in *; do
+ newman ${m} scotch_${m}
+ done
+ popd > /dev/null
+ fi
+
+ use doc && dodoc doc/*.pdf
+}