summaryrefslogtreecommitdiff
path: root/sci-mathematics/flint
diff options
context:
space:
mode:
Diffstat (limited to 'sci-mathematics/flint')
-rw-r--r--sci-mathematics/flint/Manifest16
-rw-r--r--sci-mathematics/flint/files/flint-2.4.3-cflags-ldflags.patch33
-rw-r--r--sci-mathematics/flint/files/flint-2.4.3-libdir.patch44
-rw-r--r--sci-mathematics/flint/files/flint-2.4.3-whitespaces.patch54
-rw-r--r--sci-mathematics/flint/files/flint-2.4.4-PIE-FTBFS.patch17
-rw-r--r--sci-mathematics/flint/files/flint-2.4.4-test.patch19
-rw-r--r--sci-mathematics/flint/files/flint-2.4.5-gmp6-compat.patch115
-rw-r--r--sci-mathematics/flint/files/flint-2.4.5-ntl62.patch13
-rw-r--r--sci-mathematics/flint/flint-2.4.4-r1.ebuild71
-rw-r--r--sci-mathematics/flint/flint-2.4.5.ebuild73
-rw-r--r--sci-mathematics/flint/flint-2.5.2.ebuild67
-rw-r--r--sci-mathematics/flint/metadata.xml16
12 files changed, 538 insertions, 0 deletions
diff --git a/sci-mathematics/flint/Manifest b/sci-mathematics/flint/Manifest
new file mode 100644
index 000000000000..18bae1baf6ee
--- /dev/null
+++ b/sci-mathematics/flint/Manifest
@@ -0,0 +1,16 @@
+AUX flint-2.4.3-cflags-ldflags.patch 1879 SHA256 a07c6d13a239a208f80561deb262af52c2d3da9bfb08744c10f4e50797f24408 SHA512 05fe22492d8e96eeabd30c5b28f8743354e8bf4e593eaf58d8be6bb47341a1c7148c13de681a5983fdae32cc246259ab69cff8b390002c0836ac2ae7d0a9b87e WHIRLPOOL 8210033b3ff8e1df2ad5a40ce9b4d6d34407b00c861b981cc785581099828a7a07c7f6d3f231d4ca7a5311bee26a39d880b3f89cc96378aa6b88791e7a008b65
+AUX flint-2.4.3-libdir.patch 1215 SHA256 def40bcf963341d11982f0ce2bd04567c0381ac085c9103320c780b95cd2d402 SHA512 92beca631043d9bf40f8174462a213e56963736b3b3926540cbd010938e57fd8eb3565185e1941d969700566e106adbd006396b65ba9877dbcf6c630287a7ac7 WHIRLPOOL 899eb997426883e49843a6dd998cce9842cd12446ba4037c03849fa7227eed877520341e95a0d2c22c9f3e4f2b78c8f4cc4af2020a9d2d09d4c4df5bb95dce10
+AUX flint-2.4.3-whitespaces.patch 1929 SHA256 e11afffa161207f73f905040dbede8246b4d96e2698ec780c9e1e1890f23bf71 SHA512 4bfa3bf3d7393ab577988b4def04fb2fe4107679a8f3eb2db7fd2c900d6ba0b79e685f5357d5d99633ea6eb8e4c7c38530f69f35fcfa250d6751e3d1f41a025f WHIRLPOOL 27b87df0bac1e74555c9f83cde575d1eaaeeec2a18245bd3df92b57b1c019168b33140275b18b7d89f67a69d0f3a488812e4a655d43d461fb6f34c6823d1ef86
+AUX flint-2.4.4-PIE-FTBFS.patch 615 SHA256 0e8ba7b48d70c703e511d71d4e59b6b359273c480b01f02879ca0aaaaa5395c3 SHA512 80b5c7f68a6a31d2e8a8e5182f6eb975bfecfeae4fc30a039d0dd047d7c0351207980d0688de523789d876f098b111c9ab8f26b97bf95cd57a1c2f95ed6e46b1 WHIRLPOOL ad489ceb047a0137033a1d9e51d45a1f2cebe9613834f042788c758b590d4f42b3b4ee88959ba2266cafcfe2286c87eac7083513a8747cd1d771c0bdd5390fb0
+AUX flint-2.4.4-test.patch 709 SHA256 41ba827bffa88c62ecdb93a2a7b1ddd01a3ad395e36b34b93a05c7c26e76ee57 SHA512 46f66ef5104b535c0004b63cac30bd0dcd66ff554502387597d0ab5f8d7a8189431872510c0666ad99dd7c15ec7756a87b670ef162ad6b085150c6eee7a7a376 WHIRLPOOL 29d73e80b43b06e7111dae44722967b5910850f7416aa03e5fd054aee8009a256fdf05e49b61370b8d4f9dd91aef1a5fc9535822c870cc9217fe45f75a2ee618
+AUX flint-2.4.5-gmp6-compat.patch 3495 SHA256 57e2ec6769844cada6a8cffda9da3ad9c323e945e10ab00b10d921152a0707b2 SHA512 e7caf37d900380eacb5bea67be1d2e78a1468b92dd21c052d8d5b5d362782425b52107cc97dc68ef73e0da494071f01e980e6b1fafed5bfc8a090f8b9e7e5c3b WHIRLPOOL 3d76de9620b213417cd97be2a937ddad96000c8f03ea0eb559d3659915c54d90b5282f504669f9b59acfb14ebe550cbc102890442f5bf36418a65b73c443f255
+AUX flint-2.4.5-ntl62.patch 454 SHA256 e4dc970d1aaea39621215843eb92643a5c5b27e66c8378d30229546f10588322 SHA512 c19092d0dd4060469e383aa0844cff40ab55d9f4dda77edf5f8dc7f1a8ad833541cdf92d196fc6b21ad43fadcba6d70d0ace4574e1c6828d2c25d9f74094fbb0 WHIRLPOOL ba14c88a1b661f35a2f23cad271bce7206d995831b85d10f106cefa9ab2afb8e9beafcdb4aa77aa3e530f92a0034b75da7e9fde0c3a90774229b3f6ba11ef72c
+DIST flint-2.4.4.tar.gz 1639262 SHA256 c4799e9394ef06d7b8625f7fd74ba2d8ca115dbb2aa506dcc6e369b49d0e5bc7 SHA512 236997cf64bdc96741740889f450fdbaf7d7e9b58252645f864d28005c9e7bdf87f7187cd17526606c605f0489f026398a1361b8f209f71158ca3b31c42d86d2 WHIRLPOOL 299820bc656e955d54dd06be3a1ba68440e8d9c72785ac54e7d9559da073b31c07b73598c9b18c98889f836dfd25ed8cd96d62a901a12a529698ae00ba30f1d1
+DIST flint-2.4.5.tar.gz 1640022 SHA256 e489354df00f0d84976ccdd0477028693977c87ccd14f3924a89f848bb0e01e3 SHA512 088ff512ea2330f9323a6ca0dc875e8c0926d755317d6007eba4b333a14d7612e82ebcfeabd26d1ec4b9204c4517dee08f914ad1ec852e37336fe378710a8bfc WHIRLPOOL cf5a22a9353cc23f1ab056cf6737d61d8de91ab0dc0c4a2ae46cf0777abee240a49f76de15bf854a8275023735101ce306789bca9a052151b09017e02d111069
+DIST flint-2.5.2.tar.gz 2212242 SHA256 cbf1fe0034533c53c5c41761017065f85207a1b770483e98b2392315f6575e87 SHA512 cce36947b558aabecaf780171b4bbc0e1330c3b1a7e3580717584be5cab4991d33b190531c7995b224a3a440e28c4a610d6f781901e29f48ced12a9c5ba960a2 WHIRLPOOL 74b237a8d258d17395aa0bf474c24a8ffe7ad01c4cbc4aa5b712fe14f1920191d9f96ef062461fbe8750b4461eacb0d88ff2a9d19990450363d87104e9ce203d
+EBUILD flint-2.4.4-r1.ebuild 1543 SHA256 71407bd86120707fa2439bcffb34a310c9c9e0b41006345b4249e3ea83ca05a9 SHA512 bee9f783ce831ff3c6a745d7c4ebdb046cc0c2b62136c3ba337bc5e47a0ba5782af9f0ead4573c12d695283b14087d2d5fe4d824f5b47bf474bb45a335758cee WHIRLPOOL 0d8f901aae14310ef1e908052cb53c2466a7fee0309328b6313ea5c839017be97bd65ad4f9fe17477065350fc9c2e58611754482f9635420c8308e708fb0f56f
+EBUILD flint-2.4.5.ebuild 1631 SHA256 805f1dd9889d743209e567d7b0ef796ed27c007a688a0f4ca04153d1d70325c8 SHA512 f1cb533494568b2f0c808a683285815fc34730d59030661bfab7c2a7819f43f08e69e3e8b47081f3b123565b3ce38d49c85f841600c7cff07e4e644c6556eda1 WHIRLPOOL c4ff98a1dcdb8d91313578b72801c423e8251f7d1188125ee1b7e5ebdfa1e45deef641ffe6838fdfe43a820acb6246b676fe1dbec97cf72bf8c907dbb70f3acc
+EBUILD flint-2.5.2.ebuild 1367 SHA256 1f29e2d316834b0f8c88f9d444900161b36726073f8dd367741b1a812ed61e1f SHA512 c886113d3cf3c19cc87817296d25695a7824c27ff30ff150721765766d11830f3e6c0bdf49b0b3e80ab33cf4439d42fe1bf5d1a055696d8396f79c1714cac04a WHIRLPOOL 57827583abb8e71f1903097fc1fa24a6f3b9dfa424f3bf39f51d1bc78ce4e8756b69d6be52b182f63fd04560bca9242cd73b48c70252cade8ff8a2c9c3fa9173
+MISC ChangeLog 3947 SHA256 58c11335d1a7fee292c6297e47cdb579aacc41cb3e2f2a3011f91cfa1ae6db42 SHA512 a635cc0ba1d7c8066f020007aa2cf4a766dfb3213d22ade4793879f631d74a0b39348bf22218633a37e79164822940b2b0b110971ca6c18343e8056e6a4e910a WHIRLPOOL f705b1b655642a102ba1fc04d768137e753a6cbf80a2c9b47bbf2bf0433b803821a93544267cdf6e0e61f7954f45ca99627cd87a3ea9aacf7df9dd461f91534c
+MISC ChangeLog-2015 2034 SHA256 0cbf5344cf945ccd4e168451219af7c7ab3e168209abc92db0292116f4e2f10d SHA512 51e6a829ed7fbc519e5109306d89c9a339c0480de321929f5ac4481afb71b6e2fbe072bacc1675d5dc39690ba60d37f25593c70925c346796daef99e6a2db005 WHIRLPOOL c37d0d8a42ef5456fb50ad983b315d019a54c79eb5724fa08a0969a26cafded8215364bd29f53e7231e6137f7f175d7a2aaef7c6cf149ba393e3256f7f1a8b27
+MISC metadata.xml 481 SHA256 aa0c6c478e6d1b531548b1c78a5960d47f68903edb5ebb8094f8b9d5dba1e936 SHA512 63b38afaf08270df42d3a26cca9f5f491562dd89d8e9c43def3849a624d6694343147e47a602d75e44a656a8db1f7cb06885534fe39917cb46f2f895efc8ff16 WHIRLPOOL b25a9ad37cc33b17c4b696b46490800b875b0b89d634cc9ba2ada509e044508ded783e3e1d8bb5de3a0f5531404da52384d087c1d45890b3f1a60c0810dc3459
diff --git a/sci-mathematics/flint/files/flint-2.4.3-cflags-ldflags.patch b/sci-mathematics/flint/files/flint-2.4.3-cflags-ldflags.patch
new file mode 100644
index 000000000000..f0a2ec8531b0
--- /dev/null
+++ b/sci-mathematics/flint/files/flint-2.4.3-cflags-ldflags.patch
@@ -0,0 +1,33 @@
+commit afadc8d05674a0e3e2fcf6dfbcf5f3c8f9133119
+Author: hasufell <hasufell@hasufell.de>
+Date: Sun May 18 19:32:59 2014 +0200
+
+ Respect CFLAGS/CXXFLAGS/LDFLAGS, fixes #66
+
+ Even in linking command CFLAGS should be respected, no matter
+ if all objects have already been compiled or not. Some flags
+ affect both linking and object compilation and users shouldn't
+ be required to figure them out. This is standard in most build
+ systems anyway.
+
+ Reorderd the linker line a bit, so it matches common practice,
+ although this doesn't matter technically (except that LDFLAGS
+ must go before libraries we link against).
+
+diff --git a/Makefile.in b/Makefile.in
+index a522ac1..6dda689 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -104,10 +104,10 @@ $(FLINT_LIB): $(LOBJS) $(LIB_SOURCES) $(EXT_SOURCES) $(HEADERS) $(EXT_HEADERS) |
+ $(AT)$(foreach dir, $(BUILD_DIRS), mkdir -p build/$(dir); BUILD_DIR=../build/$(dir); export BUILD_DIR; MOD_DIR=$(dir); export MOD_DIR; $(MAKE) -f ../Makefile.subdirs -C $(dir) shared || exit $$?;)
+ $(AT)if [ "$(WANT_NTL)" -eq "1" ]; then \
+ $(MAKE) build/interfaces/NTL-interface.lo; \
+- $(CXX) $(ABI_FLAG) -shared $(EXTRA_SHARED_FLAGS) build/interfaces/NTL-interface.lo $(LOBJS) $(MOD_LOBJS) $(EXT_OBJS) $(LIBS2) -o $(FLINT_LIB); \
++ $(CXX) $(CXXFLAGS) $(ABI_FLAG) -shared $(EXTRA_SHARED_FLAGS) build/interfaces/NTL-interface.lo $(LOBJS) $(MOD_LOBJS) $(EXT_OBJS) -o $(FLINT_LIB) $(LDFLAGS) $(LIBS2); \
+ fi
+ $(AT)if [ "$(WANT_NTL)" -ne "1" ]; then \
+- $(CC) $(ABI_FLAG) -shared $(EXTRA_SHARED_FLAGS) $(LOBJS) $(MOD_LOBJS) $(EXT_OBJS) $(LIBS2) -o $(FLINT_LIB); \
++ $(CC) $(CFLAGS) $(ABI_FLAG) -shared $(EXTRA_SHARED_FLAGS) $(LOBJS) $(MOD_LOBJS) $(EXT_OBJS) -o $(FLINT_LIB) $(LDFLAGS) $(LIBS2); \
+ fi
+
+ libflint.a: $(OBJS) $(LIB_SOURCES) $(EXT_SOURCES) $(HEADERS) $(EXT_HEADERS) | build build/interfaces
diff --git a/sci-mathematics/flint/files/flint-2.4.3-libdir.patch b/sci-mathematics/flint/files/flint-2.4.3-libdir.patch
new file mode 100644
index 000000000000..a569be40b8b8
--- /dev/null
+++ b/sci-mathematics/flint/files/flint-2.4.3-libdir.patch
@@ -0,0 +1,44 @@
+From 27eb23c1844029ee64907500bd8aa87097ffcd32 Mon Sep 17 00:00:00 2001
+From: hasufell <hasufell@hasufell.de>
+Date: Sun, 18 May 2014 18:46:24 +0200
+Subject: [PATCH] Allow to control LIBDIR
+
+Some distributions have lib32/lib64 and need to control
+the destination properly.
+---
+ Makefile.in | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/Makefile.in b/Makefile.in
+index c16f838..b6ea4c9 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -4,6 +4,8 @@ else
+ $(DLPATH):=$(DLPATH_ADD)
+ endif
+
++LIBDIR=lib
++
+ QUIET_CC = @echo ' ' CC ' ' $@;
+ QUIET_CXX = @echo ' ' CXX ' ' $@;
+ QUIET_AR = @echo ' ' AR ' ' $@;
+@@ -169,13 +171,13 @@ else
+ endif
+
+ install: library
+- mkdir -p $(DESTDIR)$(PREFIX)/lib
++ mkdir -p $(DESTDIR)$(PREFIX)/$(LIBDIR)
+ mkdir -p $(DESTDIR)$(PREFIX)/include/flint
+ $(AT)if [ "$(FLINT_SHARED)" -eq "1" ]; then \
+- cp $(FLINT_LIB) $(DESTDIR)$(PREFIX)/lib; \
++ cp $(FLINT_LIB) $(DESTDIR)$(PREFIX)/$(LIBDIR); \
+ fi
+ $(AT)if [ "$(FLINT_STATIC)" -eq "1" ]; then \
+- cp libflint.a $(DESTDIR)$(PREFIX)/lib; \
++ cp libflint.a $(DESTDIR)$(PREFIX)/$(LIBDIR); \
+ fi
+ cp $(HEADERS) $(DESTDIR)$(PREFIX)/include/flint
+ $(AT)if [ ! -z $(EXT_HEADERS) ]; then \
+--
+1.9.3
+
diff --git a/sci-mathematics/flint/files/flint-2.4.3-whitespaces.patch b/sci-mathematics/flint/files/flint-2.4.3-whitespaces.patch
new file mode 100644
index 000000000000..3d63aedeab3c
--- /dev/null
+++ b/sci-mathematics/flint/files/flint-2.4.3-whitespaces.patch
@@ -0,0 +1,54 @@
+From 3506d617ef9dfc5184aa99be05a25e4f73d6c3f6 Mon Sep 17 00:00:00 2001
+From: hasufell <hasufell@hasufell.de>
+Date: Sun, 18 May 2014 18:47:27 +0200
+Subject: [PATCH] Quote variables that could contain whitespaces
+
+Make does NOT take care of this in this context. It's
+not a variable assignment and installation would fail
+if DESTDIR contains any whitespace.
+---
+ Makefile.in | 22 +++++++++++-----------
+ 1 file changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/Makefile.in b/Makefile.in
+index b6ea4c9..a522ac1 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -171,23 +171,23 @@ else
+ endif
+
+ install: library
+- mkdir -p $(DESTDIR)$(PREFIX)/$(LIBDIR)
+- mkdir -p $(DESTDIR)$(PREFIX)/include/flint
++ mkdir -p "$(DESTDIR)$(PREFIX)/$(LIBDIR)"
++ mkdir -p "$(DESTDIR)$(PREFIX)/include/flint"
+ $(AT)if [ "$(FLINT_SHARED)" -eq "1" ]; then \
+- cp $(FLINT_LIB) $(DESTDIR)$(PREFIX)/$(LIBDIR); \
++ cp $(FLINT_LIB) "$(DESTDIR)$(PREFIX)/$(LIBDIR)"; \
+ fi
+ $(AT)if [ "$(FLINT_STATIC)" -eq "1" ]; then \
+- cp libflint.a $(DESTDIR)$(PREFIX)/$(LIBDIR); \
++ cp libflint.a "$(DESTDIR)$(PREFIX)/$(LIBDIR)"; \
+ fi
+- cp $(HEADERS) $(DESTDIR)$(PREFIX)/include/flint
++ cp $(HEADERS) "$(DESTDIR)$(PREFIX)/include/flint"
+ $(AT)if [ ! -z $(EXT_HEADERS) ]; then \
+- cp $(EXT_HEADERS) $(DESTDIR)$(PREFIX)/include/flint; \
++ cp $(EXT_HEADERS) "$(DESTDIR)$(PREFIX)/include/flint"; \
+ fi
+- mkdir -p $(DESTDIR)$(FLINT_CPIMPORT_DIR)
+- cp qadic/CPimport.txt $(DESTDIR)$(FLINT_CPIMPORT_DIR)
+- mkdir -p $(DESTDIR)$(PREFIX)/include/flint/flintxx
+- cp flintxx/*.h $(DESTDIR)$(PREFIX)/include/flint/flintxx
+- cp *xx.h $(DESTDIR)$(PREFIX)/include/flint
++ mkdir -p "$(DESTDIR)$(FLINT_CPIMPORT_DIR)"
++ cp qadic/CPimport.txt "$(DESTDIR)$(FLINT_CPIMPORT_DIR)"
++ mkdir -p "$(DESTDIR)$(PREFIX)/include/flint/flintxx"
++ cp flintxx/*.h "$(DESTDIR)$(PREFIX)/include/flint/flintxx"
++ cp *xx.h "$(DESTDIR)$(PREFIX)/include/flint"
+
+ build:
+ mkdir -p build
+--
+1.9.3
+
diff --git a/sci-mathematics/flint/files/flint-2.4.4-PIE-FTBFS.patch b/sci-mathematics/flint/files/flint-2.4.4-PIE-FTBFS.patch
new file mode 100644
index 000000000000..5689e3633ee4
--- /dev/null
+++ b/sci-mathematics/flint/files/flint-2.4.4-PIE-FTBFS.patch
@@ -0,0 +1,17 @@
+Description: invoke $(CC) with -r and not -Wl,-r to fix FTBFS with PIE enabled
+Author: Logan Rosen <logan@ubuntu.com>
+Forwarded: yes
+
+diff --git a/Makefile.subdirs b/Makefile.subdirs
+index ec05fb0..f2d8b37 100644
+--- a/Makefile.subdirs
++++ b/Makefile.subdirs
+@@ -59,7 +59,7 @@ $(BUILD_DIR)/$(MOD_DIR)_%.o: %.c
+ $(QUIET_CC) $(CC) $(CFLAGS) $(INCS) -c $< -o $@ -MMD -MP -MF "$(BUILD_DIR)/$(MOD_DIR)_$*.d" -MT "$(BUILD_DIR)/$(MOD_DIR)_$*.d" -MT "$@"
+
+ $(MOD_LOBJ): $(LOBJS)
+- $(QUIET_CC) $(CC) $(ABI_FLAG) -Wl,-r $^ -o $@ -nostdlib
++ $(QUIET_CC) $(CC) $(ABI_FLAG) -r $^ -o $@ -nostdlib
+
+ -include $(LOBJS:.lo=.d)
+
diff --git a/sci-mathematics/flint/files/flint-2.4.4-test.patch b/sci-mathematics/flint/files/flint-2.4.4-test.patch
new file mode 100644
index 000000000000..11b7cfe21115
--- /dev/null
+++ b/sci-mathematics/flint/files/flint-2.4.4-test.patch
@@ -0,0 +1,19 @@
+commit 5e3d4a0504158f70d227e7cfc03985fe9a646797
+Author: hasufell <hasufell@hasufell.de>
+Date: Wed Jul 2 12:58:50 2014 +0200
+
+ Fix NTL test build
+
+diff --git a/Makefile.in b/Makefile.in
+index 6dda689..e9de7da 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -214,7 +214,7 @@ build/interfaces/NTL-interface.o: interfaces/NTL-interface.cpp NTL-interface.h
+ $(QUIET_CXX) $(CXX) $(CFLAGS) $(INCS) -c $< -o $@;
+
+ build/interfaces/test/t-NTL-interface$(EXEEXT): interfaces/test/t-NTL-interface.cpp
+- $(QUIET_CXX) $(CXX) $(CFLAGS) $(INCS) $< build/interfaces/NTL-interface.o -o $@ $(LIBS);
++ $(QUIET_CXX) $(CXX) $(CFLAGS) $(INCS) $< build/interfaces/NTL-interface.lo -o $@ $(LIBS);
+
+ print-%:
+ @echo '$*=$($*)'
diff --git a/sci-mathematics/flint/files/flint-2.4.5-gmp6-compat.patch b/sci-mathematics/flint/files/flint-2.4.5-gmp6-compat.patch
new file mode 100644
index 000000000000..559cbe51fb28
--- /dev/null
+++ b/sci-mathematics/flint/files/flint-2.4.5-gmp6-compat.patch
@@ -0,0 +1,115 @@
+From a7f911140e7d0a0125653a40aa2c5fe257bd78f5 Mon Sep 17 00:00:00 2001
+From: Fredrik Johansson <fredrik.johansson@gmail.com>
+Date: Thu, 18 Sep 2014 14:49:05 +0200
+Subject: [PATCH] redefine fmpz_invmod to consider any integer invertible mod 1
+ (for gmp 6.0 compatibility)
+
+---
+ fmpz/doc/fmpz.txt | 3 ++-
+ fmpz/invmod.c | 11 +++++++++--
+ fmpz/test/t-invmod.c | 21 +++++++++++++++++----
+ 3 files changed, 28 insertions(+), 7 deletions(-)
+
+diff --git a/fmpz/doc/fmpz.txt b/fmpz/doc/fmpz.txt
+index fb422d8..2ada719 100644
+--- a/fmpz/doc/fmpz.txt
++++ b/fmpz/doc/fmpz.txt
+@@ -899,7 +899,8 @@ int fmpz_invmod(fmpz_t f, const fmpz_t g, const fmpz_t h)
+ Sets $f$ to the inverse of $g$ modulo $h$. The value of $h$ may
+ not be $0$ otherwise an exception results. If the inverse exists
+ the return value will be non-zero, otherwise the return value will
+- be $0$ and the value of $f$ undefined.
++ be $0$ and the value of $f$ undefined. As a special case, we
++ consider any number invertible modulo $h = \pm 1$, with inverse 0.
+
+ void fmpz_negmod(fmpz_t f, const fmpz_t g, const fmpz_t h)
+
+diff --git a/fmpz/invmod.c b/fmpz/invmod.c
+index a0cf601..0e20f39 100644
+--- a/fmpz/invmod.c
++++ b/fmpz/invmod.c
+@@ -67,7 +67,11 @@ fmpz_invmod(fmpz_t f, const fmpz_t g, const fmpz_t h)
+ if (c2 < WORD(0))
+ c2 = -c2;
+ if (c2 == WORD(1))
+- return 0; /* special case not handled by n_invmod */
++ {
++ fmpz_zero(f);
++ return 1; /* special case not handled by n_invmod */
++ }
++
+ gcd = z_gcdinv(&inv, c1, c2);
+
+ return (gcd == UWORD(1) ? fmpz_set_si(f, inv), 1 : 0);
+@@ -106,7 +110,10 @@ fmpz_invmod(fmpz_t f, const fmpz_t g, const fmpz_t h)
+ if (c2 < WORD(0))
+ c2 = -c2;
+ if (c2 == WORD(1))
+- return 0; /* special case not handled by z_gcd_invert */
++ {
++ fmpz_zero(f);
++ return 1; /* special case not handled by z_gcd_invert */
++ }
+ /* reduce g mod h first */
+
+ r = flint_mpz_fdiv_ui(COEFF_TO_PTR(c1), c2);
+diff --git a/fmpz/test/t-invmod.c b/fmpz/test/t-invmod.c
+index aea236e..8ff1c7f 100644
+--- a/fmpz/test/t-invmod.c
++++ b/fmpz/test/t-invmod.c
+@@ -30,6 +30,19 @@
+ #include "ulong_extras.h"
+ #include "fmpz.h"
+
++/* Use the definiton of GMP versions >= 6.0 */
++int
++mpz_invert2(mpz_t a, const mpz_t b, const mpz_t c)
++{
++ if (mpz_cmpabs_ui(c, 1) == 0)
++ {
++ mpz_set_ui(a, 0);
++ return 1;
++ }
++ else
++ return mpz_invert(a, b, c);
++}
++
+ int
+ main(void)
+ {
+@@ -63,7 +76,7 @@ main(void)
+ fmpz_get_mpz(e, b);
+
+ r1 = fmpz_invmod(c, a, b);
+- r2 = mpz_invert(f, d, e);
++ r2 = mpz_invert2(f, d, e);
+
+ fmpz_get_mpz(g, c);
+
+@@ -106,7 +119,7 @@ main(void)
+ fmpz_get_mpz(d, a);
+
+ r1 = fmpz_invmod(c, a, a);
+- r2 = mpz_invert(f, d, d);
++ r2 = mpz_invert2(f, d, d);
+
+ fmpz_get_mpz(g, c);
+
+@@ -149,7 +162,7 @@ main(void)
+ fmpz_get_mpz(e, b);
+
+ r1 = fmpz_invmod(a, a, b);
+- r2 = mpz_invert(f, d, e);
++ r2 = mpz_invert2(f, d, e);
+
+ fmpz_get_mpz(g, a);
+
+@@ -192,7 +205,7 @@ main(void)
+ fmpz_get_mpz(e, b);
+
+ r1 = fmpz_invmod(b, a, b);
+- r2 = mpz_invert(f, d, e);
++ r2 = mpz_invert2(f, d, e);
+
+ fmpz_get_mpz(g, b);
+
diff --git a/sci-mathematics/flint/files/flint-2.4.5-ntl62.patch b/sci-mathematics/flint/files/flint-2.4.5-ntl62.patch
new file mode 100644
index 000000000000..e08fa774e298
--- /dev/null
+++ b/sci-mathematics/flint/files/flint-2.4.5-ntl62.patch
@@ -0,0 +1,13 @@
+diff -druN flint-2.5.orig/interfaces/NTL-interface.cpp flint-2.5/interfaces/NTL-interface.cpp
+--- flint-2.5.orig/interfaces/NTL-interface.cpp 2014-07-16 07:50:40.000000000 -0700
++++ flint-2.5/interfaces/NTL-interface.cpp 2014-08-26 07:51:55.585884615 -0700
+@@ -32,9 +32,7 @@
+ #include <NTL/ZZ.h>
+ #include <NTL/ZZX.h>
+ #include <NTL/mat_ZZ.h>
+-#include <NTL/lip.h>
+ #include <NTL/ctools.h>
+-#include <NTL/g_lip.h>
+ #include <gmp.h>
+
+ #include "flint.h"
diff --git a/sci-mathematics/flint/flint-2.4.4-r1.ebuild b/sci-mathematics/flint/flint-2.4.4-r1.ebuild
new file mode 100644
index 000000000000..1068395a40c3
--- /dev/null
+++ b/sci-mathematics/flint/flint-2.4.4-r1.ebuild
@@ -0,0 +1,71 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+
+inherit eutils multilib toolchain-funcs
+
+DESCRIPTION="Fast Library for Number Theory"
+HOMEPAGE="http://www.flintlib.org/"
+SRC_URI="http://www.flintlib.org/${P}.tar.gz"
+
+RESTRICT="mirror"
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ppc x86"
+IUSE="doc gc ntl static-libs test"
+
+RDEPEND="dev-libs/gmp:0=
+ dev-libs/mpfr:0
+ gc? ( dev-libs/boehm-gc )
+ ntl? ( dev-libs/ntl )"
+DEPEND="${RDEPEND}
+ doc? (
+ app-text/texlive-core
+ dev-texlive/texlive-latex
+ dev-texlive/texlive-latexextra
+ )"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-2.4.3-libdir.patch \
+ "${FILESDIR}"/${PN}-2.4.3-whitespaces.patch \
+ "${FILESDIR}"/${PN}-2.4.3-cflags-ldflags.patch \
+ "${FILESDIR}"/${PN}-2.4.4-test.patch \
+ "${FILESDIR}"/${PN}-2.4.4-PIE-FTBFS.patch
+
+ sed -i \
+ -e '/echo "DLPATH_ADD=/s/\$DLPATH_ADD/\\\$(CURDIR)/' \
+ ./configure || die
+}
+
+src_configure() {
+ ./configure \
+ --prefix="${EPREFIX}/usr" \
+ --with-gmp="${EPREFIX}/usr" \
+ --with-mpfr="${EPREFIX}/usr" \
+ $(usex ntl "--with-ntl=${EPREFIX}/usr" "") \
+ $(use_enable static-libs static) \
+ $(usex gc "--with-gc=${EPREFIX}/usr" "") \
+ CC=$(tc-getCC) \
+ CXX=$(tc-getCXX) \
+ AR=$(tc-getAR) \
+ || die
+}
+
+src_compile() {
+ emake verbose
+
+ if use doc ; then
+ emake -C doc/latex
+ fi
+}
+
+src_test() {
+ emake AT= QUIET_CC= QUIET_CXX= QUIET_AR= check
+}
+
+src_install() {
+ emake DESTDIR="${D}" LIBDIR="$(get_libdir)" install
+ einstalldocs
+ use doc && dodoc doc/latex/flint-manual.pdf
+}
diff --git a/sci-mathematics/flint/flint-2.4.5.ebuild b/sci-mathematics/flint/flint-2.4.5.ebuild
new file mode 100644
index 000000000000..b36ea8b5f2b3
--- /dev/null
+++ b/sci-mathematics/flint/flint-2.4.5.ebuild
@@ -0,0 +1,73 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+
+inherit eutils multilib toolchain-funcs
+
+DESCRIPTION="Fast Library for Number Theory"
+HOMEPAGE="http://www.flintlib.org/"
+SRC_URI="http://www.flintlib.org/${P}.tar.gz"
+
+RESTRICT="mirror"
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc gc ntl static-libs test"
+
+RDEPEND="dev-libs/gmp:0=
+ dev-libs/mpfr:0
+ gc? ( dev-libs/boehm-gc )
+ ntl? ( dev-libs/ntl )"
+DEPEND="${RDEPEND}
+ doc? (
+ app-text/texlive-core
+ dev-texlive/texlive-latex
+ dev-texlive/texlive-latexextra
+ )"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-2.4.3-libdir.patch \
+ "${FILESDIR}"/${PN}-2.4.3-whitespaces.patch \
+ "${FILESDIR}"/${PN}-2.4.3-cflags-ldflags.patch \
+ "${FILESDIR}"/${PN}-2.4.4-test.patch \
+ "${FILESDIR}"/${PN}-2.4.5-gmp6-compat.patch \
+ "${FILESDIR}"/${PN}-2.4.5-ntl62.patch \
+ "${FILESDIR}"/${PN}-2.4.4-PIE-FTBFS.patch
+
+ sed -i \
+ -e '/echo "DLPATH_ADD=/s/\$DLPATH_ADD/\\\$(CURDIR)/' \
+ ./configure || die
+}
+
+src_configure() {
+ ./configure \
+ --prefix="${EPREFIX}/usr" \
+ --with-gmp="${EPREFIX}/usr" \
+ --with-mpfr="${EPREFIX}/usr" \
+ $(usex ntl "--with-ntl=${EPREFIX}/usr" "") \
+ $(use_enable static-libs static) \
+ $(usex gc "--with-gc=${EPREFIX}/usr" "") \
+ CC=$(tc-getCC) \
+ CXX=$(tc-getCXX) \
+ AR=$(tc-getAR) \
+ || die
+}
+
+src_compile() {
+ emake verbose
+
+ if use doc ; then
+ emake -C doc/latex
+ fi
+}
+
+src_test() {
+ emake AT= QUIET_CC= QUIET_CXX= QUIET_AR= check
+}
+
+src_install() {
+ emake DESTDIR="${D}" LIBDIR="$(get_libdir)" install
+ einstalldocs
+ use doc && dodoc doc/latex/flint-manual.pdf
+}
diff --git a/sci-mathematics/flint/flint-2.5.2.ebuild b/sci-mathematics/flint/flint-2.5.2.ebuild
new file mode 100644
index 000000000000..64f94ae79dcf
--- /dev/null
+++ b/sci-mathematics/flint/flint-2.5.2.ebuild
@@ -0,0 +1,67 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+
+inherit eutils multilib toolchain-funcs
+
+DESCRIPTION="Fast Library for Number Theory"
+HOMEPAGE="http://www.flintlib.org/"
+SRC_URI="http://www.flintlib.org/${P}.tar.gz"
+
+RESTRICT="mirror"
+LICENSE="GPL-2"
+SLOT="0/13"
+KEYWORDS="~amd64 ~arm ~x86"
+IUSE="doc gc ntl static-libs test"
+
+RDEPEND="dev-libs/gmp:=
+ dev-libs/mpfr:=
+ gc? ( dev-libs/boehm-gc )
+ ntl? ( dev-libs/ntl:= )"
+DEPEND="${RDEPEND}
+ doc? (
+ app-text/texlive-core
+ dev-texlive/texlive-latex
+ dev-texlive/texlive-latexextra
+ )"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-2.4.4-PIE-FTBFS.patch
+
+ sed -i \
+ -e '/echo "DLPATH_ADD=/s/\$DLPATH_ADD/\\\$(CURDIR)/' \
+ ./configure || die
+}
+
+src_configure() {
+ ./configure \
+ --prefix="${EPREFIX}/usr" \
+ --with-gmp="${EPREFIX}/usr" \
+ --with-mpfr="${EPREFIX}/usr" \
+ $(usex ntl "--with-ntl=${EPREFIX}/usr" "") \
+ $(use_enable static-libs static) \
+ $(usex gc "--with-gc=${EPREFIX}/usr" "") \
+ CC=$(tc-getCC) \
+ CXX=$(tc-getCXX) \
+ AR=$(tc-getAR) \
+ || die
+}
+
+src_compile() {
+ emake verbose
+
+ if use doc ; then
+ emake -C doc/latex
+ fi
+}
+
+src_test() {
+ emake AT= QUIET_CC= QUIET_CXX= QUIET_AR= check
+}
+
+src_install() {
+ emake DESTDIR="${D}" LIBDIR="$(get_libdir)" install
+ einstalldocs
+ use doc && dodoc doc/latex/flint-manual.pdf
+}
diff --git a/sci-mathematics/flint/metadata.xml b/sci-mathematics/flint/metadata.xml
new file mode 100644
index 000000000000..d455fe29d0e2
--- /dev/null
+++ b/sci-mathematics/flint/metadata.xml
@@ -0,0 +1,16 @@
+<?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>
+ <upstream>
+ <remote-id type="github">wbhart/flint2</remote-id>
+ </upstream>
+ <use>
+ <flag name="gc">Enable garbage collection
+ support via <pkg>dev-libs/boehm-gc</pkg></flag>
+ <flag name="ntl">Build NTL interface</flag>
+ </use>
+</pkgmetadata>