summaryrefslogtreecommitdiff
path: root/dev-libs/ntl
diff options
context:
space:
mode:
Diffstat (limited to 'dev-libs/ntl')
-rw-r--r--dev-libs/ntl/Manifest22
-rw-r--r--dev-libs/ntl/files/ntl-5.5.2-sage-tools.patch53
-rw-r--r--dev-libs/ntl/files/ntl-5.5.2-shared-r1.patch151
-rw-r--r--dev-libs/ntl/files/ntl-5.5.2-shared.patch166
-rw-r--r--dev-libs/ntl/files/ntl-5.5.2-singular.patch12
-rw-r--r--dev-libs/ntl/files/ntl-6.0.0-sage-tools.patch61
-rw-r--r--dev-libs/ntl/files/ntl-6.0.0-singular.patch12
-rw-r--r--dev-libs/ntl/files/ntl-9.2.0-sanitize-makefile.patch160
-rw-r--r--dev-libs/ntl/files/ntl-9.2.0-singular.patch13
-rw-r--r--dev-libs/ntl/files/ntl-9.6.4-sanitize-makefile.patch160
-rw-r--r--dev-libs/ntl/metadata.xml18
-rw-r--r--dev-libs/ntl/ntl-10.5.0.ebuild61
-rw-r--r--dev-libs/ntl/ntl-5.5.2.ebuild74
-rw-r--r--dev-libs/ntl/ntl-6.1.0.ebuild74
-rw-r--r--dev-libs/ntl/ntl-9.3.0.ebuild81
-rw-r--r--dev-libs/ntl/ntl-9.6.4.ebuild84
16 files changed, 1202 insertions, 0 deletions
diff --git a/dev-libs/ntl/Manifest b/dev-libs/ntl/Manifest
new file mode 100644
index 000000000000..976215ad9cb3
--- /dev/null
+++ b/dev-libs/ntl/Manifest
@@ -0,0 +1,22 @@
+AUX ntl-5.5.2-sage-tools.patch 1411 SHA256 ca3ab5d6fc295d8825c32e307086b686ccc56f58d3aa69bb810d1a50c4f05a27 SHA512 cf1d19629061e4495f24b0726d7480aa7bb23e9c00d80e66f034f82831d19adfee9dce94412494a12c033144d016074126ec8b23064766b0c6dd478a6a74e00d WHIRLPOOL bc65acf6878376c71c35c15cf95a55ab1f3e3a58f5ec94274eb6ec126c890c850f43e282ddf7263d9f9a457808d787d065c540f6da1471274fc9eb7bfe066da0
+AUX ntl-5.5.2-shared-r1.patch 4070 SHA256 9a9eb23802e746144441b86925da3e4885a73f2924e3281ad87214dd1c706079 SHA512 7e692fc4ee66d0b6a3e542627e438018f067c3a512d19e241085da630fe7203d258d01e647b5a00d8e3f85abe95e5169a903a51795151b6fce41630a8856d23e WHIRLPOOL 8333acfd05624389a0b841f357854bdc5a8c46891e73471d4b522e8939aad8ffe3174bddc6592392a8961293e3f22df91abc2396712cac09c84f2d2771ec08d8
+AUX ntl-5.5.2-shared.patch 4343 SHA256 38b298b4f4b6fa7083bc7a86dfb2dcc19e5fcbb2cad90a216b28110e8f0642a9 SHA512 e3f6c49a62c753e97f1606f90be13edfe997dcb1aec9df11ceb9efbfc14b7ec43d916f3f90ae687634b8672d16c9dad225ba7911ec8de761637d249d57611541 WHIRLPOOL 0baa24f6a177b69bc18f04eaa06f5511ccd6dbc4c3c5b154aed07b08fb53a310e9fdb7ed21f071d7db1d7b6abe4db800651908bf3d9d2efad36cdcc0361a5254
+AUX ntl-5.5.2-singular.patch 324 SHA256 2b9c1b1504ede6d9332fcb6e63bba93f81d528f0d035ebdbd8f32b2085c1f110 SHA512 8b62628b352ca8b15e894461c70a14b4d8ac87781d7bffaa2953d2ae3acca4a9a223d51da40ac76e553d0ea9a2ee1ea1a7c8c221a5e009771774e0ce7a50da95 WHIRLPOOL 2429ad058a8d97b3c2002d2369ff1b877135903f8c462ab4ccb6b95fb5d40e68dd2a927355152e132fec709d9d378c98f3ff0c0399faba673f16e93754f9a295
+AUX ntl-6.0.0-sage-tools.patch 1557 SHA256 dd999071c247c20b1030ec4f07e0f9fbd1ab3c978d06f4abb8c6abdf1578e7ac SHA512 5b028ef0b00d7ef0f82a260232bc130b300e175d31681b8f994e9037bc82d2d49491d8b495725388137cf3a2f73d17cdd6266592b3894189e11484159c70ce73 WHIRLPOOL c36cf93d45e481dcf95542d41aed81dc40be2973fdef4df9384dfaacb20450dc89306105f5a4ad1843ae3c825076f4a44049571dc6380d4ecf73af7d6e785568
+AUX ntl-6.0.0-singular.patch 330 SHA256 a09dec321bbbc5f88288b6d09a8c641b23cb658bb8ae467ab92a2c8ee0a62d6b SHA512 ea8fa036a3032231435de13578f01ce038d89ca35d1ff6250a72b6129cdcae1da329b3d273c98e34ed40dc09ac2cc172a5f1614184d44325a35ddc10b59e5fe5 WHIRLPOOL f87ef9128c9044842549568ab47f06f5687bee766768130d3b986a441eda127dd6facd4c113081e9bf6ac5462740374d703e835f1921fd179d2558de3af7fd02
+AUX ntl-9.2.0-sanitize-makefile.patch 4324 SHA256 3641fa0df71f2c3e4fb6b22f007c81e36a785330fb71c5a9fa12fa9ea973911c SHA512 d1b0d21fd136bf6548901486f6893d34c538b110bf50a9a8b4ca810f77a32bbd64d67962310bf7666afd935d380969fb832848d5779e1d1101a06691abedec80 WHIRLPOOL 7e93e6fa7153a2891028524bae6cde9ff6a4789d9669b557c36aa575a366b4aeeb053b90745b854cc47a5b4a42473cb512d5dab2e9f1bf85fde07137a4b2e325
+AUX ntl-9.2.0-singular.patch 391 SHA256 5a257f3620253772b60f5d7fed96f051e0d82bfc1651668932ef4e0d509b93e7 SHA512 ebb25e7755232ff72d75538213cbfa3a600e9b78af3943e73da4de1aab28d3c8dda43f84eec716bc52768d510f6a68c3f5c969c5dea2c6050b25023ba440fe04 WHIRLPOOL 85279ad45cce8121605424dcd5fab7a378cf8f5bdb7f09977e23d7b07af4119a624af7786d6dc879ad33111ad3f0ed66a0348bb5145908c93638ae377e61b122
+AUX ntl-9.6.4-sanitize-makefile.patch 4049 SHA256 ef8535910952afa567be0fbb397ad928d93cdcf221b5b759c85f718305d1cd00 SHA512 1af6473c85d75299db28542e244bcc1bc37011bc4a1b85cacd9c21a44c77a578d6d32b1295c10e00a25a50de88be479282060a3ab93ecb9738cb9e6888a9165f WHIRLPOOL 79fff7c391232959b566f354c33a6b713a67e699a90071fa07e9bca3b30158d17f48929171ebe94ea9cf5f2fd04672c1d1798c127c43b430f0252fb02d739217
+DIST ntl-10.5.0.tar.gz 1278729 SHA256 b90b36c9dd8954c9bc54410b1d57c00be956ae1db5a062945822bbd7a86ab4d2 SHA512 b299dfc29005079470972c2a9ca02acd0ebdbc31ff8923df02f3627dbc66daa0f527226972cef032e1e488c4272554634a96456e94653fdf8b01356160319aa0 WHIRLPOOL 270f76a0088c79b506a1e0bfa12cbe06419bb5c0421e7cdb9fcc3ec2bd6b22b4f4c2468bbe73001090db623e8a662d185e181f4390475513b32a388ecca7c3cc
+DIST ntl-5.5.2.tar.gz 707247 SHA256 ef7fe7c8b60ec6e05b2a279caad0081263f7fb68b7360120846644cde726ff56 SHA512 44892e00051ca743b1184c9ae30e62c8e2605edaa394358979ff990a535993a6f282d882871ca9ebb3c632971f806c41d9b8024c8fb2cc6fa0d22bc26c66db06 WHIRLPOOL 4587463c4b52be721a7feb164fab73341af97c6f451c0bb2fbf675503c8a5262a5d7615d628e97f082dde23ce49db0f0b314c625dae0526bb1abdfc88732896f
+DIST ntl-6.1.0.tar.gz 715439 SHA256 e16c30ceef1d47e94b8a37a8c4a1fb58729b8f8449c648e2a96280a3eecf9b6f SHA512 8c013bd4a250c8e29d57864585492be1f392c84356959d8100d5c45b420e411e5cd677524e2d50bbe265dda4c364185395780ba5d8490f6ac46da73c6a9728de WHIRLPOOL cf2a48cfe33cb58d8bda35d4a18d57a20ae23f2ba53f0f757d1bacc58ffa0bfdfd38363db38996e2e4069f5e3f2ad6a3ae9a859437a93404308512652190c765
+DIST ntl-9.3.0.tar.gz 888710 SHA256 8f31508a9176b3fc843f08468b1632017f2450677bfd5147ead5136e0f24b68f SHA512 dfb4ac7a66aaddcf5d0d0c9fcaff253b0196a9d9f727788127dd18e131528fe60dedf8bfb864503225fc5796987aec9c7019b74e0fc12cd12c20aa33a9cf9d7d WHIRLPOOL a1f7cf573d49a277f0b2f1d50d18e66ef83a54430c517fd5d3c75e800216b706e8b5ff10e6ed2dc02b6eb4f9290671b249c67f1937cced96ac987055aaa3ab99
+DIST ntl-9.6.4.tar.gz 915256 SHA256 c4a1f015a879b4a20f6b76a98eb6033a7936b0ff3b3f3ca6159d7e7b2afd89eb SHA512 ec8a4deb6996b31140edff978e07844ea8e30327491a6777d3982bffec01599b0cb5cc5dca297c8610ecb7ac9a4eae3407a59736fed840a2415a52a159370868 WHIRLPOOL 31ab69dc19b206868d1a9ac4f3d1cb52180980e751fe1431b738921b3816998797cf33a0ea9db8e1017e4face98efa897a4e42aa5be58365d1bc12e320a34354
+EBUILD ntl-10.5.0.ebuild 1445 SHA256 7d024a68d644fc0ad550904b495767fd6189535a4ef8392b58991bf78f1a4d45 SHA512 03d0f3b39d728b86c372d95d55d36dc3bf7c2c7f4a21f856d9dfb1f5162fd42f232465b737c47b9cf3c7f3d4903f5c893a226063449e07b977d55b1202c0b3ba WHIRLPOOL ad97546077c2e5b2203d4e5fc708aee271dd8357865b431b64855d8330cd47985b81a1b9fa0a0c2f2195e7cabaf021d53ca15f2a43b7da1c568dae10422b612b
+EBUILD ntl-5.5.2.ebuild 2034 SHA256 88ff831ea4ea35b0166b9b5125a15f9f46561a42eb0dad69075cf6d44b392ef2 SHA512 b530990749bb914612630fb60ac706a21f0ec5f2e814d8c0937cc77950134d4551319a8907ab988ba5037a3f97547a79c2d27e0b2449520a9fb9a165f5849c2f WHIRLPOOL 9a56aad8f51fd71d85ecc074b9b04e1fde8b4d86ef5123205ddb75610a48ed0138ffaf68203312b5aceef98bd9374a1de2cc7970e92e4e4fca16de9f7c8096a8
+EBUILD ntl-6.1.0.ebuild 2083 SHA256 f935f2ca3e4cbbb5ed77878ab005dbccc3a6ad1488ab7e770cf761a8d90b3a51 SHA512 6e13c0155c26e40e44860c36355f4e8698a914dd193cecdb070e95551e7dfdf017ad80d657428ca09f4376274f34ffc2257ac9fc9a4a140a8839719ec5335070 WHIRLPOOL 9a2fb2356053c3c24371d1b74210aafa82a84c139aa29bce396086bc3a456d418bcad6edddd476e9b9ebc89908fedbd2603c636b22d42e5fe150e89b9307be4c
+EBUILD ntl-9.3.0.ebuild 1778 SHA256 5b11a1be838e776568e1220368a0f5edf2a1b55416dce60c4d1f53e0f4e3f037 SHA512 4f7d415cdf3e94655983fe1795af856ef01a0f953a7b9b8eae9d10be0b691d0b49036cebf45afcad8e4ae097681912af6728e7e455ba0d306fd0a5c323515022 WHIRLPOOL 5def4a3bd1027cbe8f8abd9799eef9cdbed88c73e4068139f2a066b7e4b6f6e2a211370b71fc112feea3834a9445b35fe5c8be1ca7a3dd6f58e6d816e212f3dc
+EBUILD ntl-9.6.4.ebuild 1706 SHA256 653e9456f06231a948e1c1db6e536c46f518eb86fc1d6788c01e369d34425f24 SHA512 1aa1887d2665aaf3294b87404febbf941118be291a5111a92bbfce88ca163683661b396db358d2cacfed7ec63a72090ff96cc59b5723edd8bc56b1441fc0c857 WHIRLPOOL 2025e65cdfa2b942252a5d61757618ada3cf8687c45e63529a947e1f21c67742b4be22eabe5f1c65da718edd90143297212e6394b62b83243447bce7d1cbac6a
+MISC ChangeLog 4562 SHA256 ac9b0dddd90bbb4358662623187d0c90db2aa4c85a5ece0143dc82a4b26e58df SHA512 cc4fde3511a7915527d703d1189528b89da9cef333ec021eb2478acfe359ed412877dcbb3ef03ce54d9f125bd4a79942834cbe59ed9d991f59b41790da5414c2 WHIRLPOOL c67d5ac18938bbbb42cb3f1adac17659cd323d99c92af3b61f89e05f448af9eec1ba77611738f73279396869c0a4d76866223a4b0cacdad6937ebcd3f88064a6
+MISC ChangeLog-2015 4571 SHA256 bef85f4c427cab52311b94aaea0eb6adfb84e69a3a1c7fde8181d01cfd76d690 SHA512 24d374fbfe21dbe0cd5947e91c2dc2d1b4014437da218662ca2fa0999e5de24f155ab2dcdba65f6d9f38d67445923ac3a423c39aeaed2b1332f257149516e9e5 WHIRLPOOL 0a3c676932aea0404fcf4cf50b1744936343447eb1137f6486dd8c3b1f3aba5b7b289743d91cb0b282e821aee8f5ff2dbf70378931350107b4cd092fe26325a4
+MISC metadata.xml 652 SHA256 7745073f95ee4ff3c8bd9cfa3329aaa2aeb5320c7f1a305cb10ca0ed5a302bf0 SHA512 176c2411e076399cb80e69d2503c1b2e9b079334b1aa498898fc45eaadb04a74fb67c26816f8344e5a6ea4a08ea43391841c79267d52ca0b628638fd1c8ffc0a WHIRLPOOL 70f66d1ea9acbdcca77bb0486b9dec89a99f4b710b3b345f83e2b022d7610118a50e934b3cdd5bbc39ccc0621e8769faed3719100b46306896ff6b3ac0c47b3f
diff --git a/dev-libs/ntl/files/ntl-5.5.2-sage-tools.patch b/dev-libs/ntl/files/ntl-5.5.2-sage-tools.patch
new file mode 100644
index 000000000000..fafa97356cd8
--- /dev/null
+++ b/dev-libs/ntl/files/ntl-5.5.2-sage-tools.patch
@@ -0,0 +1,53 @@
+--- include/NTL/tools.h.orig 2008-05-06 22:14:06.000000000 +1200
++++ include/NTL/tools.h 2008-05-06 22:14:23.000000000 +1200
+@@ -249,6 +249,12 @@
+ char IntValToChar(long a);
+
+
++/*
++ This function is not present in vanilla NTL
++ See tools.c for documentation.
++ */
++void SetErrorCallbackFunction(void (*func)(const char *s, void *context), void *context);
++
+
+ void Error(const char *s);
+
+--- src/tools.c.orig 2008-05-06 22:15:32.000000000 +1200
++++ src/tools.c 2008-05-06 22:15:45.000000000 +1200
+@@ -8,8 +8,35 @@
+ NTL_START_IMPL
+
+
++/*
++ The following code differs from vanilla NTL
++
++ We add a SetErrorCallbackFunction(). This sets a global callback function _function_,
++ which gets called with parameter _context_ and an error message string whenever Error()
++ gets called.
++
++ Note that if the custom error handler *returns*, then NTL will dump the error message
++ back to stderr and abort() as it habitually does.
++
++ -- David Harvey (2008-04-12)
++*/
++
++void (*ErrorCallbackFunction)(const char*, void*) = NULL;
++void *ErrorCallbackContext = NULL;
++
++
++void SetErrorCallbackFunction(void (*function)(const char*, void*), void *context)
++{
++ ErrorCallbackFunction = function;
++ ErrorCallbackContext = context;
++}
++
++
+ void Error(const char *s)
+ {
++ if (ErrorCallbackFunction != NULL)
++ ErrorCallbackFunction(s, ErrorCallbackContext);
++
+ cerr << s << "\n";
+ abort();
+ }
diff --git a/dev-libs/ntl/files/ntl-5.5.2-shared-r1.patch b/dev-libs/ntl/files/ntl-5.5.2-shared-r1.patch
new file mode 100644
index 000000000000..1420f55f3285
--- /dev/null
+++ b/dev-libs/ntl/files/ntl-5.5.2-shared-r1.patch
@@ -0,0 +1,151 @@
+--- src/DoConfig.orig 2009-05-05 07:46:39.000000000 +0100
++++ src/DoConfig 2009-08-10 19:24:43.000000000 +0100
+@@ -25,14 +25,16 @@
+ 'LDFLAGS_CXX' => '$(LDFLAGS)',
+ 'LDLIBS' => '-lm',
+ 'LDLIBS_CXX' => '$(LDLIBS)',
++'PICFLAG' => '-fPIC',
+ 'CPPFLAGS' => '',
+
+-'DEF_PREFIX' => '/usr/local',
++'DEF_PREFIX' => '/usr',
+
+ 'PREFIX' => '$(DEF_PREFIX)',
+ 'LIBDIR' => '$(PREFIX)/lib',
+ 'INCLUDEDIR' => '$(PREFIX)/include',
+ 'DOCDIR' => '$(PREFIX)/share/doc',
++'SHMAKE' => 'non-gld',
+
+ 'GMP_PREFIX' => '$(DEF_PREFIX)',
+ 'GMP_INCDIR' => '$(GMP_PREFIX)/include',
+--- src/mfile.orig 2009-05-05 07:46:39.000000000 +0100
++++ src/mfile 2009-08-10 20:31:36.000000000 +0100
+@@ -141,6 +146,16 @@
+ WIZARD=@{WIZARD}
+ # Set to off if you want to bypass the wizard; otherwise, set to on.
+
++###############################################################
++#
++# New addition for shared library building. With gcc you need to
++# choose the Position Indepent Code flag. You have a choice of
++# -fpic better code but in rare case not available (ppc)
++# -fPIC slightly slower code but guaranted to work anywhere.
++#
++###############################################################
++
++PICFLAG=@{PICFLAG}
+
+ #################################################################
+ #
+@@ -173,6 +188,8 @@
+
+ OBJ=$(O19)
+
++SHOBJ=$(subst .o,.lo,$(OBJ))
++
+ # library source files
+
+
+@@ -320,7 +356,7 @@
+ LINK = $(CC) $(NTL_INCLUDE) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
+ LINK_CXX = $(CXX) $(NTL_INCLUDE) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS_CXX)
+
+-
++.SUFFIXES: .lo
+
+ # 'make all' does a complete make, including all setup.
+ # It also creates the file 'all', which means you should
+@@ -328,11 +364,11 @@
+ # again.
+
+ all:
+- make setup1
+- make setup2
+- make setup3
+- make setup4
+- make ntl.a
++ $(MAKE) setup1
++ $(MAKE) setup2
++ $(MAKE) setup3
++ $(MAKE) setup4
++ $(MAKE) ntl.a
+ touch all
+
+
+@@ -378,18 +414,31 @@
+ lip.o: lip.c g_lip_impl.h c_lip_impl.h lip_gmp_aux_impl.h
+ $(LCOMP) $(COMPILE) $(GMP_OPT_INCDIR) lip.c
+
++lip.lo: lip.c g_lip_impl.h c_lip_impl.h lip_gmp_aux_impl.h
++ $(LCOMP) $(COMPILE) $(PICFLAG) $(GMP_INCDIR) lip.c -o lip.lo
++
++
++
+ ctools.o: ctools.c
+ $(LCOMP) $(COMPILE) ctools.c
+
++ctools.lo: ctools.c
++ $(LCOMP) $(COMPILE) $(PICFLAG) ctools.c -o ctools.lo
++
+
+ GetTime.o: GetTime.c
+ $(LCOMP) $(COMPILE) GetTime.c
+
+-
++GetTime.lo: GetTime.c
++ $(LCOMP) $(COMPILE) $(PICFLAG) GetTime.c -o GetTime.lo
+
+ .c.o:
+ $(LCOMP) $(COMPILE_CXX) $(GF2X_OPT_INCDIR) $<
+
++.c.lo:
++ $(LCOMP) $(COMPILE_CXX) $(PICFLAG) $(GF2X_OPT_INCDIR) -o $@ $<
++
++
+ .c:
+ @{LSTAT} $(LINK_CXX) -o $@ $< ntl.a $(GMP_OPT_LIBDIR) $(GMP_OPT_LIB) $(GF2X_OPT_LIBDIR) $(GF2X_OPT_LIB) $(LDLIBS_CXX) #LSTAT
+ @{LSHAR} $(LIBTOOL) --mode=link $(LINK_CXX) -o $@ $< libntl.la #LSHAR
+@@ -403,7 +452,7 @@
+
+ check:
+ sh RemoveProg $(PROGS)
+- make QuickTest
++ $(MAKE) QuickTest
+ ./QuickTest
+ sh RemoveProg QuickTest
+ sh TestScript
+@@ -460,19 +509,18 @@
+ #
+ #################################################################
+
+-clobber:
++clobber: clean
+ rm -f ntl.a mach_desc.h ../include/NTL/mach_desc.h GetTime.c
+ rm -f lip_gmp_aux_impl.h ../include/NTL/gmp_aux.h
+- sh RemoveProg $(PROGS) MakeDesc TestGetTime gen_lip_gmp_aux gen_gmp_aux
+- rm -f *.o
+- rm -rf small
++ sh RemoveProg $(PROGS)
++ rm -f libntl*.so*
+ rm -f cfileout mfileout
+ rm -rf .libs *.lo libntl.la
+ rm -f all
+
+ clean:
+ sh RemoveProg MakeDesc TestGetTime gen_lip_gmp_aux gen_gmp_aux
+- rm -f *.o
++ rm -f *.o *.lo
+ rm -rf small
+ @{LSHAR} - $(LIBTOOL) --mode=clean rm -f libntl.la *.lo #LSHAR
+
+@@ -549,3 +597,10 @@
+
+
+
++sharedso: DIRNAME $(SHOBJ)
++ $(LINK_CXX) $(PICFLAG) -shared -Wl,-soname,lib`cat DIRNAME`.so -o lib`cat DIRNAME`.so $(SHOBJ) $(GMP_OPT_LIBDIR) $(GMP_OPT_LIB) $(GF2X_OPT_LIBDIR) $(GF2X_OPT_LIB)
++ ln -s lib`cat DIRNAME`.so libntl.so
++
++shareddylib: DIRNAME $(SHOBJ)
++ $(LINK_CXX) $(PICFLAG) -dynamiclib -install_name $(LIBDIR)/lib`cat DIRNAME`.dylib -o lib`cat DIRNAME`.dylib $(SHOBJ) $(GMP_OPT_LIBDIR) $(GMP_OPT_LIB) $(GF2X_OPT_LIBDIR) $(GF2X_OPT_LIB)
++ ln -s lib`cat DIRNAME`.dylib libntl.dylib
diff --git a/dev-libs/ntl/files/ntl-5.5.2-shared.patch b/dev-libs/ntl/files/ntl-5.5.2-shared.patch
new file mode 100644
index 000000000000..1ddd74507cf5
--- /dev/null
+++ b/dev-libs/ntl/files/ntl-5.5.2-shared.patch
@@ -0,0 +1,166 @@
+--- src/DoConfig.orig 2009-05-05 07:46:39.000000000 +0100
++++ src/DoConfig 2009-08-10 19:24:43.000000000 +0100
+@@ -25,14 +25,16 @@
+ 'LDFLAGS_CXX' => '$(LDFLAGS)',
+ 'LDLIBS' => '-lm',
+ 'LDLIBS_CXX' => '$(LDLIBS)',
++'PICFLAG' => '-fPIC',
+ 'CPPFLAGS' => '',
+
+-'DEF_PREFIX' => '/usr/local',
++'DEF_PREFIX' => '/usr',
+
+ 'PREFIX' => '$(DEF_PREFIX)',
+ 'LIBDIR' => '$(PREFIX)/lib',
+ 'INCLUDEDIR' => '$(PREFIX)/include',
+ 'DOCDIR' => '$(PREFIX)/share/doc',
++'SHMAKE' => 'non-gld',
+
+ 'GMP_PREFIX' => '$(DEF_PREFIX)',
+ 'GMP_INCDIR' => '$(GMP_PREFIX)/include',
+@@ -87,11 +89,6 @@
+
+ foreach $arg (@ARGV) {
+
+- if ($arg =~ '-h|help|-help|--help') {
+- system("more ../doc/config.txt");
+- exit;
+- }
+-
+ if (($name, $val) = ($arg =~ /(.*?)=(.*)/)) {
+
+ if (exists($MakeFlag{$name}) && ($val =~ 'on|off')) {
+
+
+
+--- src/mfile.orig 2009-05-05 07:46:39.000000000 +0100
++++ src/mfile 2009-08-10 20:31:36.000000000 +0100
+@@ -141,6 +146,16 @@
+ WIZARD=@{WIZARD}
+ # Set to off if you want to bypass the wizard; otherwise, set to on.
+
++###############################################################
++#
++# New addition for shared library building. With gcc you need to
++# choose the Position Indepent Code flag. You have a choice of
++# -fpic better code but in rare case not available (ppc)
++# -fPIC slightly slower code but guaranted to work anywhere.
++#
++###############################################################
++
++PICFLAG=@{PICFLAG}
+
+ #################################################################
+ #
+@@ -173,6 +188,8 @@
+
+ OBJ=$(O19)
+
++SHOBJ=$(subst .o,.lo,$(OBJ))
++
+ # library source files
+
+
+@@ -320,7 +356,7 @@
+ LINK = $(CC) $(NTL_INCLUDE) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
+ LINK_CXX = $(CXX) $(NTL_INCLUDE) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS_CXX)
+
+-
++.SUFFIXES: .lo
+
+ # 'make all' does a complete make, including all setup.
+ # It also creates the file 'all', which means you should
+@@ -328,11 +364,11 @@
+ # again.
+
+ all:
+- make setup1
+- make setup2
+- make setup3
+- make setup4
+- make ntl.a
++ $(MAKE) setup1
++ $(MAKE) setup2
++ $(MAKE) setup3
++ $(MAKE) setup4
++ $(MAKE) ntl.a
+ touch all
+
+
+@@ -378,18 +414,31 @@
+ lip.o: lip.c g_lip_impl.h c_lip_impl.h lip_gmp_aux_impl.h
+ $(LCOMP) $(COMPILE) $(GMP_OPT_INCDIR) lip.c
+
++lip.lo: lip.c g_lip_impl.h c_lip_impl.h lip_gmp_aux_impl.h
++ $(LCOMP) $(COMPILE) $(PICFLAG) $(GMP_INCDIR) lip.c -o lip.lo
++
++
++
+ ctools.o: ctools.c
+ $(LCOMP) $(COMPILE) ctools.c
+
++ctools.lo: ctools.c
++ $(LCOMP) $(COMPILE) $(PICFLAG) ctools.c -o ctools.lo
++
+
+ GetTime.o: GetTime.c
+ $(LCOMP) $(COMPILE) GetTime.c
+
+-
++GetTime.lo: GetTime.c
++ $(LCOMP) $(COMPILE) $(PICFLAG) GetTime.c -o GetTime.lo
+
+ .c.o:
+ $(LCOMP) $(COMPILE_CXX) $(GF2X_OPT_INCDIR) $<
+
++.c.lo:
++ $(LCOMP) $(COMPILE_CXX) $(PICFLAG) $(GF2X_OPT_INCDIR) -o $@ $<
++
++
+ .c:
+ @{LSTAT} $(LINK_CXX) -o $@ $< ntl.a $(GMP_OPT_LIBDIR) $(GMP_OPT_LIB) $(GF2X_OPT_LIBDIR) $(GF2X_OPT_LIB) $(LDLIBS_CXX) #LSTAT
+ @{LSHAR} $(LIBTOOL) --mode=link $(LINK_CXX) -o $@ $< libntl.la #LSHAR
+@@ -403,7 +452,7 @@
+
+ check:
+ sh RemoveProg $(PROGS)
+- make QuickTest
++ $(MAKE) QuickTest
+ ./QuickTest
+ sh RemoveProg QuickTest
+ sh TestScript
+@@ -460,19 +509,18 @@
+ #
+ #################################################################
+
+-clobber:
++clobber: clean
+ rm -f ntl.a mach_desc.h ../include/NTL/mach_desc.h GetTime.c
+ rm -f lip_gmp_aux_impl.h ../include/NTL/gmp_aux.h
+- sh RemoveProg $(PROGS) MakeDesc TestGetTime gen_lip_gmp_aux gen_gmp_aux
+- rm -f *.o
+- rm -rf small
++ sh RemoveProg $(PROGS)
++ rm -f libntl*.so*
+ rm -f cfileout mfileout
+ rm -rf .libs *.lo libntl.la
+ rm -f all
+
+ clean:
+ sh RemoveProg MakeDesc TestGetTime gen_lip_gmp_aux gen_gmp_aux
+- rm -f *.o
++ rm -f *.o *.lo
+ rm -rf small
+ @{LSHAR} - $(LIBTOOL) --mode=clean rm -f libntl.la *.lo #LSHAR
+
+@@ -549,3 +597,10 @@
+
+
+
++sharedso: DIRNAME $(SHOBJ)
++ $(LINK_CXX) $(PICFLAG) -shared -Wl,-soname,lib`cat DIRNAME`.so -o lib`cat DIRNAME`.so $(SHOBJ) $(GMP_OPT_LIBDIR) $(GMP_OPT_LIB) $(GF2X_OPT_LIBDIR) $(GF2X_OPT_LIB)
++ ln -s lib`cat DIRNAME`.so libntl.so
++
++shareddylib: DIRNAME $(SHOBJ)
++ $(LINK_CXX) $(PICFLAG) -dynamiclib -install_name $(LIBDIR)/lib`cat DIRNAME`.dylib -o lib`cat DIRNAME`.dylib $(SHOBJ) $(GMP_OPT_LIBDIR) $(GMP_OPT_LIB) $(GF2X_OPT_LIBDIR) $(GF2X_OPT_LIB)
++ ln -s lib`cat DIRNAME`.dylib libntl.dylib
diff --git a/dev-libs/ntl/files/ntl-5.5.2-singular.patch b/dev-libs/ntl/files/ntl-5.5.2-singular.patch
new file mode 100644
index 000000000000..9f0d13140cee
--- /dev/null
+++ b/dev-libs/ntl/files/ntl-5.5.2-singular.patch
@@ -0,0 +1,12 @@
+--- include/NTL/new.h.orig 2008-05-06 21:56:16.000000000 +1200
++++ include/NTL/new.h 2008-05-06 21:56:33.000000000 +1200
+@@ -12,7 +12,8 @@
+
+ #include <new>
+
+-#define NTL_NEW_OP new (std::nothrow)
++// uncommenting std::nothrow makes this ntl work properly with Singular
++#define NTL_NEW_OP new //(std::nothrow)
+
+
+ #else
diff --git a/dev-libs/ntl/files/ntl-6.0.0-sage-tools.patch b/dev-libs/ntl/files/ntl-6.0.0-sage-tools.patch
new file mode 100644
index 000000000000..e79731fc2fce
--- /dev/null
+++ b/dev-libs/ntl/files/ntl-6.0.0-sage-tools.patch
@@ -0,0 +1,61 @@
+--- src.orig/src/tools.c 2012-08-06 11:54:53.652334400 +0200
++++ src/src/tools.c 2012-08-06 11:59:18.183993600 +0200
+@@ -18,8 +18,35 @@
+ void (*ErrorCallback)() = 0;
+
+
++/*
++ The following code differs from vanilla NTL.
++
++ We add a SetErrorCallbackFunction(). This sets a global callback function _function_,
++ which gets called with parameter _context_ and an error message string whenever Error()
++ gets called.
++
++ Note that if the custom error handler *returns*, then NTL will dump the error message
++ back to stderr and abort() as it habitually does.
++
++ -- David Harvey (2008-04-12)
++*/
++
++void (*ErrorCallbackFunction)(const char*, void*) = NULL;
++void *ErrorCallbackContext = NULL;
++
++
++void SetErrorCallbackFunction(void (*function)(const char*, void*), void *context)
++{
++ ErrorCallbackFunction = function;
++ ErrorCallbackContext = context;
++}
++
++
+ void Error(const char *s)
+ {
++ if (ErrorCallbackFunction != NULL)
++ ErrorCallbackFunction(s, ErrorCallbackContext);
++
+ cerr << s << "\n";
+ _ntl_abort();
+ }
+--- src.orig/include/NTL/tools.h 2012-08-06 11:54:52.830333000 +0200
++++ src/include/NTL/tools.h 2012-08-06 11:59:18.143993600 +0200
+@@ -10,6 +10,7 @@
+
+ #include <cstdlib>
+ #include <cmath>
++#include <cstdio>
+ #include <iostream>
+
+ #else
+@@ -252,6 +253,12 @@
+ char IntValToChar(long a);
+
+
++/*
++ This function is not present in vanilla NTL.
++ See tools.c for documentation.
++ */
++void SetErrorCallbackFunction(void (*func)(const char *s, void *context), void *context);
++
+
+ void Error(const char *s);
+
diff --git a/dev-libs/ntl/files/ntl-6.0.0-singular.patch b/dev-libs/ntl/files/ntl-6.0.0-singular.patch
new file mode 100644
index 000000000000..c172386f3102
--- /dev/null
+++ b/dev-libs/ntl/files/ntl-6.0.0-singular.patch
@@ -0,0 +1,12 @@
+--- src.orig/include/NTL/new.h 2012-08-06 17:12:25.658913083 +0200
++++ src/include/NTL/new.h 2012-08-06 17:11:15.002915713 +0200
+@@ -12,7 +12,8 @@
+
+ #include <new>
+
+-#define NTL_NEW_OP new (std::nothrow)
++// commenting std::nothrow makes this ntl work properly with Singular
++#define NTL_NEW_OP new //(std::nothrow)
+
+
+ #else
diff --git a/dev-libs/ntl/files/ntl-9.2.0-sanitize-makefile.patch b/dev-libs/ntl/files/ntl-9.2.0-sanitize-makefile.patch
new file mode 100644
index 000000000000..2e8b77ae4b92
--- /dev/null
+++ b/dev-libs/ntl/files/ntl-9.2.0-sanitize-makefile.patch
@@ -0,0 +1,160 @@
+diff -Naur ntl-9.2.0.orig/src/DoConfig ntl-9.2.0/src/DoConfig
+--- ntl-9.2.0.orig/src/DoConfig 2015-07-09 21:45:26.959930693 +1200
++++ ntl-9.2.0/src/DoConfig 2015-07-09 21:46:52.250122780 +1200
+@@ -38,14 +38,16 @@
+
+ 'LDFLAGS' => '',
+ 'LDLIBS' => '-lm',
++'PICFLAG' => '-fPIC',
+ 'CPPFLAGS' => '',
+
+-'DEF_PREFIX' => '/usr/local',
++'DEF_PREFIX' => '/usr',
+
+ 'PREFIX' => '$(DEF_PREFIX)',
+ 'LIBDIR' => '$(PREFIX)/lib',
+ 'INCLUDEDIR' => '$(PREFIX)/include',
+ 'DOCDIR' => '$(PREFIX)/share/doc',
++'SHMAKE' => 'non-gld',
+
+ 'GMP_PREFIX' => '$(DEF_PREFIX)',
+ 'GMP_INCDIR' => '$(GMP_PREFIX)/include',
+diff -Naur ntl-9.2.0.orig/src/mfile ntl-9.2.0/src/mfile
+--- ntl-9.2.0.orig/src/mfile 2015-07-09 21:45:26.959930693 +1200
++++ ntl-9.2.0/src/mfile 2015-07-09 21:57:40.631583489 +1200
+@@ -109,6 +109,16 @@
+ WIZARD=@{WIZARD}
+ # Set to off if you want to bypass the wizard; otherwise, set to on.
+
++###############################################################
++#
++# New addition for shared library building. With gcc you need to
++# choose the Position Indepent Code flag. You have a choice of
++# -fpic better code but in rare case not available (ppc)
++# -fPIC slightly slower code but guaranted to work anywhere.
++#
++###############################################################
++
++PICFLAG=@{PICFLAG}
+
+ #################################################################
+ #
+@@ -141,6 +151,8 @@
+
+ OBJ=$(O19)
+
++SHOBJ=$(subst .o,.lo,$(OBJ))
++
+ # library source files
+
+
+@@ -314,6 +326,8 @@
+
+ LINK = $(CXX) $(NTL_INCLUDE) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS)
+
++.SUFFIXES: .lo
++
+
+
+ # 'make all' does a complete make, including all setup.
+@@ -322,11 +336,11 @@
+ # again.
+
+ all:
+- make setup1
+- make setup2
+- make setup3
+- make setup4
+- make ntl.a
++ ${MAKE} setup1
++ ${MAKE} setup2
++ ${MAKE} setup3
++ ${MAKE} setup4
++ ${MAKE} ntl.a
+ touch all
+
+
+@@ -373,22 +387,37 @@
+ lip.o: lip.c g_lip_impl.h c_lip_impl.h
+ $(LCOMP) $(COMPILE) $(GMP_OPT_INCDIR) lip.c
+
++lip.lo: lip.c g_lip_impl.h c_lip_impl.h
++ $(LCOMP) $(COMPILE) $(PICFLAG) $(GMP_OPT_INCDIR) lip.c -o lip.lo
++
+ ctools.o: ctools.c
+ $(LCOMP) $(COMPILE) ctools.c
+
++ctools.lo: ctools.c
++ $(LCOMP) $(COMPILE) $(PICFLAG) ctools.c -o ctools.lo
++
+
+ GetTime.o: GetTime.c
+ $(LCOMP) $(COMPILE) GetTime.c
+
++GetTime.lo: GetTime.c
++ $(LCOMP) $(COMPILE) $(PICFLAG) GetTime.c -o GetTime.lo
++
+ GetPID.o: GetPID.c
+ $(LCOMP) $(COMPILE) GetPID.c
+
++GetPID.lo: GetPID.c
++ $(LCOMP) $(COMPILE) $(PICFLAG) GetPID.c -o GetPID.lo
++
+ CheckPCLMUL: CheckPCLMUL.c
+ $(LINK) -o CheckPCLMUL CheckPCLMUL.c $(LDLIBS)
+
+ .c.o:
+ $(LCOMP) $(COMPILE) $(GF2X_OPT_INCDIR) $<
+
++.c.lo:
++ $(LCOMP) $(COMPILE) $(PICFLAG) $(GF2X_OPT_INCDIR) -o $@ $<
++
+ .c:
+ @{LSTAT} $(LINK) -o $@ $< ntl.a $(GMP_OPT_LIBDIR) $(GMP_OPT_LIB) $(GF2X_OPT_LIBDIR) $(GF2X_OPT_LIB) $(LDLIBS) #LSTAT
+ @{LSHAR} $(LIBTOOL) --tag=CXX --mode=link $(LINK) -o $@ $< libntl.la #LSHAR
+@@ -402,7 +431,7 @@
+
+ check:
+ sh RemoveProg $(PROGS)
+- make QuickTest
++ ${MAKE} QuickTest
+ ./QuickTest
+ sh RemoveProg QuickTest
+ sh TestScript
+@@ -459,21 +488,19 @@
+ #
+ #################################################################
+
+-clobber:
++clobber: clean
+ rm -f ntl.a mach_desc.h ../include/NTL/mach_desc.h GetTime.c GetPID.c
+ cp ../include/NTL/have_LL_no.h ../include/NTL/have_LL.h
+ cp ../include/NTL/have_builtin_clzl_no.h ../include/NTL/have_builtin_clzl.h
+ rm -f ../include/NTL/gmp_aux.h
+- sh RemoveProg $(PROGS) MakeDesc TestGetTime TestGetPID gen_gmp_aux
+- rm -f *.o
+- rm -rf small
++ sh RemoveProg $(PROGS)
+ rm -f cfileout mfileout
+ rm -rf .libs *.lo libntl.la
+ rm -f all
+
+ clean:
+ sh RemoveProg MakeDesc TestGetTime TestGetPID gen_gmp_aux
+- rm -f *.o
++ rm -f *.o *.lo
+ rm -rf small
+ @{LSHAR} - $(LIBTOOL) --mode=clean rm -f libntl.la *.lo #LSHAR
+
+@@ -558,4 +585,11 @@
+
+
+
++sharedso: DIRNAME $(SHOBJ)
++ $(LINK) $(PICFLAG) -shared -Wl,-soname,lib`cat DIRNAME`.so -o lib`cat DIRNAME`.so $(SHOBJ) $(GMP_OPT_LIBDIR) $(GMP_OPT_LIB) $(GF2X_OPT_LIBDIR) $(GF2X_OPT_LIB)
++ ln -s lib`cat DIRNAME`.so libntl.so
++
++shareddylib: DIRNAME $(SHOBJ)
++ $(LINK) $(PICFLAG) -dynamiclib -install_name $(LIBDIR)/lib`cat DIRNAME`.dylib -o lib`cat DIRNAME`.dylib $(SHOBJ) $(GMP_OPT_LIBDIR) $(GMP_OPT_LIB) $(GF2X_OPT_LIBDIR) $(GF2X_OPT_LIB)
++ ln -s lib`cat DIRNAME`.dylib libntl.dylib
+
diff --git a/dev-libs/ntl/files/ntl-9.2.0-singular.patch b/dev-libs/ntl/files/ntl-9.2.0-singular.patch
new file mode 100644
index 000000000000..58f9491c12a0
--- /dev/null
+++ b/dev-libs/ntl/files/ntl-9.2.0-singular.patch
@@ -0,0 +1,13 @@
+Modfiy new.h to accomodate Singular.
+--- src.orig/include/NTL/new.h 2012-08-06 17:12:25.658913083 +0200
++++ src/include/NTL/new.h 2012-08-06 17:11:15.002915713 +0200
+@@ -12,7 +12,8 @@
+ #include <NTL/config.h>
+ #include <new>
+
+-#define NTL_NEW_OP new (std::nothrow)
++// commenting std::nothrow makes this ntl work properly with Singular
++#define NTL_NEW_OP new //(std::nothrow)
+
+
+ #endif
diff --git a/dev-libs/ntl/files/ntl-9.6.4-sanitize-makefile.patch b/dev-libs/ntl/files/ntl-9.6.4-sanitize-makefile.patch
new file mode 100644
index 000000000000..ed2e533fe430
--- /dev/null
+++ b/dev-libs/ntl/files/ntl-9.6.4-sanitize-makefile.patch
@@ -0,0 +1,160 @@
+--- ntl-9.6.4/src/DoConfig
++++ ntl-9.6.4/src/DoConfig
+@@ -24,14 +24,16 @@
+
+ 'LDFLAGS' => '',
+ 'LDLIBS' => '-lm',
++'PICFLAG' => '-fPIC',
+ 'CPPFLAGS' => '',
+
+-'DEF_PREFIX' => '/usr/local',
++'DEF_PREFIX' => '/usr',
+
+ 'PREFIX' => '$(DEF_PREFIX)',
+ 'LIBDIR' => '$(PREFIX)/lib',
+ 'INCLUDEDIR' => '$(PREFIX)/include',
+ 'DOCDIR' => '$(PREFIX)/share/doc',
++'SHMAKE' => 'non-gld',
+
+ 'GMP_PREFIX' => '$(DEF_PREFIX)',
+ 'GMP_INCDIR' => '$(GMP_PREFIX)/include',
+--- ntl-9.6.4/src/mfile
++++ ntl-9.6.4/src/mfile
+@@ -113,6 +113,18 @@
+ # Set to off if you want to bypass the wizard; otherwise, set to on.
+
+
++###############################################################
++#
++# New addition for shared library building. With gcc you need to
++# choose the Position Indepent Code flag. You have a choice of
++# -fpic better code but in rare case not available (ppc)
++# -fPIC slightly slower code but guaranted to work anywhere.
++#
++###############################################################
++
++PICFLAG=@{PICFLAG}
++
++
+ #################################################################
+ #
+ # That's it! You can ignore everything else in this file!
+@@ -144,6 +156,8 @@
+
+ OBJ=$(O19)
+
++SHOBJ=$(subst .o,.lo,$(OBJ))
++
+ # library source files
+
+
+@@ -317,6 +331,7 @@
+
+ LINK = $(CXX) $(NTL_INCLUDE) $(CPPFLAGS) $(CXXAUTOFLAGS) $(CXXFLAGS) $(LDFLAGS)
+
++.SUFFIXES: .lo
+
+
+ # 'make all' does a complete make, including all setup.
+@@ -325,11 +340,11 @@
+ # again.
+
+ all:
+- make setup1
+- make setup2
+- make setup3
+- make setup4
+- make ntl.a
++ ${MAKE} setup1
++ ${MAKE} setup2
++ ${MAKE} setup3
++ ${MAKE} setup4
++ ${MAKE} ntl.a
+ touch all
+
+
+@@ -378,16 +393,28 @@
+ lip.o: lip.c g_lip_impl.h c_lip_impl.h
+ $(LCOMP) $(COMPILE) $(GMP_OPT_INCDIR) lip.c
+
++lip.lo: lip.c g_lip_impl.h c_lip_impl.h
++ $(LCOMP) $(COMPILE) $(PICFLAG) $(GMP_OPT_INCDIR) lip.c -o lip.lo
++
+ ctools.o: ctools.c
+ $(LCOMP) $(COMPILE) ctools.c
+
++ctools.lo: ctools.c
++ $(LCOMP) $(COMPILE) $(PICFLAG) ctools.c -o ctools.lo
++
+
+ GetTime.o: GetTime.c
+ $(LCOMP) $(COMPILE) GetTime.c
+
++GetTime.lo: GetTime.c
++ $(LCOMP) $(COMPILE) $(PICFLAG) GetTime.c -o GetTime.lo
++
+ GetPID.o: GetPID.c
+ $(LCOMP) $(COMPILE) GetPID.c
+
++GetPID.lo: GetPID.c
++ $(LCOMP) $(COMPILE) $(PICFLAG) GetPID.c -o GetPID.lo
++
+ CheckCompile: CheckCompile.c
+ $(LINK) -o CheckCompile CheckCompile.c $(LDLIBS)
+
+@@ -395,6 +422,9 @@
+ .c.o:
+ $(LCOMP) $(COMPILE) $(GF2X_OPT_INCDIR) $<
+
++.c.lo:
++ $(LCOMP) $(COMPILE) $(PICFLAG) $(GF2X_OPT_INCDIR) -o $@ $<
++
+ .c:
+ @{LSTAT} $(LINK) -o $@ $< ntl.a $(GMP_OPT_LIBDIR) $(GMP_OPT_LIB) $(GF2X_OPT_LIBDIR) $(GF2X_OPT_LIB) $(LDLIBS) #LSTAT
+ @{LSHAR} $(LIBTOOL) --tag=CXX --mode=link $(LINK) -o $@ $< libntl.la #LSHAR
+@@ -408,7 +438,7 @@
+
+ check:
+ sh RemoveProg $(PROGS)
+- make QuickTest
++ ${MAKE} QuickTest
+ ./QuickTest
+ sh RemoveProg QuickTest
+ sh TestScript
+@@ -465,20 +495,18 @@
+ #
+ #################################################################
+
+-clobber:
++clobber: clean
+ rm -f ntl.a mach_desc.h ../include/NTL/mach_desc.h GetTime.c GetPID.c
+ sh ResetFeatures '..'
+ rm -f ../include/NTL/gmp_aux.h
+- sh RemoveProg $(PROGS) MakeDesc $(AUXPROGS) gen_gmp_aux
+- rm -f *.o
+- rm -rf small
++ sh RemoveProg $(PROGS)
+ rm -f cfileout mfileout
+ rm -rf .libs *.lo libntl.la
+ rm -f all
+
+ clean:
+ sh RemoveProg $(PROGS) MakeDesc $(AUXPROGS) gen_gmp_aux
+- rm -f *.o
++ rm -f *.o *.lo
+ rm -rf small
+ @{LSHAR} - $(LIBTOOL) --mode=clean rm -f libntl.la *.lo #LSHAR
+
+@@ -570,5 +598,11 @@
+ $(LINK) -o DispSettings DispSettings.c $(LDLIBS)
+
+
+-
++sharedso: DIRNAME $(SHOBJ)
++ $(LINK) $(PICFLAG) -shared -Wl,-soname,lib`cat DIRNAME`.so -o lib`cat DIRNAME`.so $(SHOBJ) $(GMP_OPT_LIBDIR) $(GMP_OPT_LIB) $(GF2X_OPT_LIBDIR) $(GF2X_OPT_LIB)
++ ln -s lib`cat DIRNAME`.so libntl.so
++
++shareddylib: DIRNAME $(SHOBJ)
++ $(LINK) $(PICFLAG) -dynamiclib -install_name $(LIBDIR)/lib`cat DIRNAME`.dylib -o lib`cat DIRNAME`.dylib $(SHOBJ) $(GMP_OPT_LIBDIR) $(GMP_OPT_LIB) $(GF2X_OPT_LIBDIR) $(GF2X_OPT_LIB)
++ ln -s lib`cat DIRNAME`.dylib libntl.dylib
+
diff --git a/dev-libs/ntl/metadata.xml b/dev-libs/ntl/metadata.xml
new file mode 100644
index 000000000000..ff239d92d4de
--- /dev/null
+++ b/dev-libs/ntl/metadata.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer type="project">
+ <email>sci-mathematics@gentoo.org</email>
+ <name>Gentoo Mathematics Project</name>
+</maintainer>
+<maintainer type="project">
+ <email>cpp@gentoo.org</email>
+ <name>Gentoo C++ Project</name>
+</maintainer>
+<longdescription lang="en">
+ NTL is a high-performance, portable C++ library providing data
+ structures and algorithms for manipulating signed, arbitrary length
+ integers, and for vectors, matrices, and polynomials over the
+ integers and over finite fields.
+</longdescription>
+</pkgmetadata>
diff --git a/dev-libs/ntl/ntl-10.5.0.ebuild b/dev-libs/ntl/ntl-10.5.0.ebuild
new file mode 100644
index 000000000000..00821f04ef33
--- /dev/null
+++ b/dev-libs/ntl/ntl-10.5.0.ebuild
@@ -0,0 +1,61 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+inherit flag-o-matic toolchain-funcs
+
+DESCRIPTION="High-performance and portable Number Theory C++ library"
+HOMEPAGE="http://shoup.net/ntl/"
+SRC_URI="http://www.shoup.net/ntl/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0/35"
+KEYWORDS="~amd64 ~ppc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE="doc static-libs test threads bindist"
+
+RDEPEND="dev-libs/gmp:0=
+ >=dev-libs/gf2x-0.9"
+DEPEND="${RDEPEND}
+ dev-lang/perl"
+
+S="${WORKDIR}/${P}/src"
+
+pkg_setup() {
+ replace-flags -O[3-9] -O2
+}
+
+src_configure() {
+ # Currently the build system can build a static library or
+ # both static and shared libraries. But not only shared libraries.
+ perl DoConfig \
+ PREFIX="${EPREFIX}"/usr \
+ LIBDIR="${EPREFIX}"/usr/$(get_libdir) \
+ CXXFLAGS="${CXXFLAGS}" \
+ CPPFLAGS="${CPPFLAGS}" \
+ LDFLAGS="${LDFLAGS}" \
+ CXX="$(tc-getCXX)" \
+ AR="$(tc-getAR)" \
+ RANLIB="$(tc-getRANLIB)" \
+ SHARED=on \
+ NTL_GMP_LIP=on NTL_GF2X_LIB=on \
+ $(usex threads NTL_THREADS= NTL_THREADS= on off) \
+ $(usex bindist NATIVE= NATIVE= off on) \
+ || die "DoConfig failed"
+}
+
+src_install() {
+ default
+ if ! use static-libs; then
+ prune_libtool_files --all
+ rm -f "${ED}"/usr/$(get_libdir)/libntl.a
+ fi
+
+ cd ..
+ rm -rf "${ED}"/usr/share/doc/NTL
+ dodoc README
+ if use doc ; then
+ dodoc doc/*.txt
+ docinto html
+ dodoc doc/*.html doc/*.gif
+ fi
+}
diff --git a/dev-libs/ntl/ntl-5.5.2.ebuild b/dev-libs/ntl/ntl-5.5.2.ebuild
new file mode 100644
index 000000000000..c51e4b8d11db
--- /dev/null
+++ b/dev-libs/ntl/ntl-5.5.2.ebuild
@@ -0,0 +1,74 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=3
+inherit toolchain-funcs eutils multilib flag-o-matic
+
+DESCRIPTION="High-performance and portable Number Theory C++ library"
+HOMEPAGE="http://shoup.net/ntl/"
+SRC_URI="http://www.shoup.net/ntl/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ppc x86 ~amd64-linux ~x86-linux ~ppc-macos"
+IUSE="doc static-libs test"
+
+RDEPEND=">=dev-libs/gmp-4.3
+ >=dev-libs/gf2x-0.9"
+DEPEND="${RDEPEND}
+ dev-lang/perl"
+
+S="${WORKDIR}/${P}/src"
+
+src_prepare() {
+ # fix parallel make
+ sed -i -e "s/make/make ${MAKEOPTS}/g" WizardAux || die
+ cd ..
+ # enable compatibility with singular
+ epatch "$FILESDIR/${P}-singular.patch"
+ # implement a call back framework (submitted upstream)
+ epatch "$FILESDIR/${P}-sage-tools.patch"
+ # sanitize the makefile and allow the building of shared library
+ epatch "$FILESDIR/${P}-shared.patch"
+ replace-flags -O[3-9] -O2
+}
+
+src_configure() {
+ perl DoConfig \
+ PREFIX="${EPREFIX}"/usr \
+ CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" LDFLAGS="${LDFLAGS}" \
+ CC="$(tc-getCC)" CXX="$(tc-getCXX)" \
+ AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)" \
+ NTL_STD_CXX=on NTL_GMP_LIP=on NTL_GF2X_LIB=on \
+ || die "DoConfig failed"
+}
+
+src_compile() {
+ # split the targets to allow parallel make to run properly
+ emake setup1 setup2 || die "emake setup failed"
+ emake setup3 || die "emake setup failed"
+ sh Wizard on || die "Tuning wizard failed"
+ if use static-libs || use test; then
+ emake ntl.a || die "emake static failed"
+ fi
+ local trg=so
+ [[ ${CHOST} == *-darwin* ]] && trg=dylib
+ emake shared${trg} || die "emake shared failed"
+}
+
+src_install() {
+ if use static-libs; then
+ newlib.a ntl.a libntl.a || die "installation of static library failed"
+ fi
+ dolib.so lib*$(get_libname) || die "installation of shared library failed"
+
+ cd ..
+ insinto /usr/include
+ doins -r include/NTL || die "installation of the headers failed"
+
+ dodoc README
+ if use doc ; then
+ dodoc doc/*.txt || die
+ dohtml doc/* || die
+ fi
+}
diff --git a/dev-libs/ntl/ntl-6.1.0.ebuild b/dev-libs/ntl/ntl-6.1.0.ebuild
new file mode 100644
index 000000000000..d09a697040fa
--- /dev/null
+++ b/dev-libs/ntl/ntl-6.1.0.ebuild
@@ -0,0 +1,74 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+inherit toolchain-funcs eutils multilib flag-o-matic
+
+DESCRIPTION="High-performance and portable Number Theory C++ library"
+HOMEPAGE="http://shoup.net/ntl/"
+SRC_URI="http://www.shoup.net/ntl/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos ~x64-macos"
+IUSE="doc static-libs test"
+
+RDEPEND=">=dev-libs/gmp-4.3
+ >=dev-libs/gf2x-0.9"
+DEPEND="${RDEPEND}
+ dev-lang/perl"
+
+S="${WORKDIR}/${P}/src"
+
+src_prepare() {
+ # fix parallel make
+ sed -i -e "s/make/make ${MAKEOPTS}/g" WizardAux || die
+ cd ..
+ # enable compatibility with singular
+ epatch "$FILESDIR/${PN}-6.0.0-singular.patch"
+ # implement a call back framework (submitted upstream)
+ epatch "$FILESDIR/${PN}-6.0.0-sage-tools.patch"
+ # sanitize the makefile and allow the building of shared library
+ epatch "$FILESDIR/${PN}-5.5.2-shared-r1.patch"
+ replace-flags -O[3-9] -O2
+}
+
+src_configure() {
+ perl DoConfig \
+ PREFIX="${EPREFIX}"/usr \
+ CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" LDFLAGS="${LDFLAGS}" \
+ CC="$(tc-getCC)" CXX="$(tc-getCXX)" \
+ AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)" \
+ NTL_STD_CXX=on NTL_GMP_LIP=on NTL_GF2X_LIB=on \
+ || die "DoConfig failed"
+}
+
+src_compile() {
+ # split the targets to allow parallel make to run properly
+ emake setup1 setup2 || die "emake setup failed"
+ emake setup3 || die "emake setup failed"
+ sh Wizard on || die "Tuning wizard failed"
+ if use static-libs || use test; then
+ emake ntl.a || die "emake static failed"
+ fi
+ local trg=so
+ [[ ${CHOST} == *-darwin* ]] && trg=dylib
+ emake shared${trg} || die "emake shared failed"
+}
+
+src_install() {
+ if use static-libs; then
+ newlib.a ntl.a libntl.a || die "installation of static library failed"
+ fi
+ dolib.so lib*$(get_libname) || die "installation of shared library failed"
+
+ cd ..
+ insinto /usr/include
+ doins -r include/NTL || die "installation of the headers failed"
+
+ dodoc README
+ if use doc ; then
+ dodoc doc/*.txt || die
+ dohtml doc/* || die
+ fi
+}
diff --git a/dev-libs/ntl/ntl-9.3.0.ebuild b/dev-libs/ntl/ntl-9.3.0.ebuild
new file mode 100644
index 000000000000..29ace84f8f4a
--- /dev/null
+++ b/dev-libs/ntl/ntl-9.3.0.ebuild
@@ -0,0 +1,81 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+inherit toolchain-funcs eutils multilib flag-o-matic
+
+DESCRIPTION="High-performance and portable Number Theory C++ library"
+HOMEPAGE="http://shoup.net/ntl/"
+SRC_URI="http://www.shoup.net/ntl/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ppc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE="doc static-libs test"
+
+RDEPEND="dev-libs/gmp:=
+ >=dev-libs/gf2x-0.9"
+DEPEND="${RDEPEND}
+ dev-lang/perl"
+
+S="${WORKDIR}/${P}/src"
+
+src_prepare() {
+ # fix parallel make
+ sed -i -e "s/make/make ${MAKEOPTS}/g" WizardAux || die
+ cd ..
+ # sanitize the makefile and allow the building of shared library
+ epatch "${FILESDIR}"/${PN}-9.2.0-sanitize-makefile.patch
+ # enable compatibility with singular
+ epatch "${FILESDIR}"/${PN}-9.2.0-singular.patch
+ replace-flags -O[3-9] -O2
+}
+
+src_configure() {
+ perl DoConfig \
+ PREFIX="${EPREFIX}"/usr \
+ CXXFLAGS="${CXXFLAGS}" \
+ LDFLAGS="${LDFLAGS}" \
+ CXX="$(tc-getCXX)" \
+ AR="$(tc-getAR)" \
+ RANLIB="$(tc-getRANLIB)" \
+ NTL_GMP_LIP=on NTL_GF2X_LIB=on NTL_LEGACY_SP_MULMOD=on \
+ || die "DoConfig failed"
+}
+
+src_compile() {
+ # split the targets to allow parallel make to run properly
+ emake setup1 setup2
+ emake setup3
+ sh Wizard on || die "Tuning wizard failed"
+ if use static-libs; then
+ emake ntl.a
+ fi
+ local trg=so
+ [[ ${CHOST} == *-darwin* ]] && trg=dylib
+ emake shared${trg}
+}
+
+src_install() {
+ if use static-libs; then
+ newlib.a ntl.a libntl.a
+ fi
+ dolib.so lib*$(get_libname)
+
+ cd ..
+ insinto /usr/include
+ doins -r include/NTL
+
+ dodoc README
+ if use doc ; then
+ dodoc doc/*.txt
+ dohtml doc/*
+ fi
+}
+
+src_test(){
+ # the current ebuild need static library to run tests
+ emake ntl.a
+
+ default
+}
diff --git a/dev-libs/ntl/ntl-9.6.4.ebuild b/dev-libs/ntl/ntl-9.6.4.ebuild
new file mode 100644
index 000000000000..40c071f7ddbc
--- /dev/null
+++ b/dev-libs/ntl/ntl-9.6.4.ebuild
@@ -0,0 +1,84 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+inherit flag-o-matic toolchain-funcs
+
+DESCRIPTION="High-performance and portable Number Theory C++ library"
+HOMEPAGE="http://shoup.net/ntl/"
+SRC_URI="http://www.shoup.net/ntl/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE="doc static-libs test"
+
+RDEPEND="dev-libs/gmp:0=
+ >=dev-libs/gf2x-0.9"
+DEPEND="${RDEPEND}
+ dev-lang/perl"
+
+S="${WORKDIR}/${P}/src"
+PATCHES=(
+ "${FILESDIR}/${P}-sanitize-makefile.patch"
+ "${FILESDIR}/${PN}-9.2.0-singular.patch"
+)
+
+src_prepare() {
+ # fix parallel make
+ sed -i -e "s/make/make ${MAKEOPTS}/g" WizardAux || die
+ cd .. || die
+ default
+
+ replace-flags -O[3-9] -O2
+}
+
+src_configure() {
+ perl DoConfig \
+ PREFIX="${EPREFIX}"/usr \
+ CXXFLAGS="${CXXFLAGS}" \
+ LDFLAGS="${LDFLAGS}" \
+ CXX="$(tc-getCXX)" \
+ AR="$(tc-getAR)" \
+ RANLIB="$(tc-getRANLIB)" \
+ NTL_GMP_LIP=on NTL_GF2X_LIB=on NTL_LEGACY_SP_MULMOD=on \
+ || die "DoConfig failed"
+}
+
+src_compile() {
+ # split the targets to allow parallel make to run properly
+ emake setup1 setup2
+ emake setup3
+ sh Wizard on || die "Tuning wizard failed"
+ if use static-libs; then
+ emake ntl.a
+ fi
+ local trg=so
+ [[ ${CHOST} == *-darwin* ]] && trg=dylib
+ emake shared${trg}
+}
+
+src_install() {
+ if use static-libs; then
+ newlib.a ntl.a libntl.a
+ fi
+ dolib.so lib*$(get_libname)
+
+ cd .. || die
+ insinto /usr/include
+ doins -r include/NTL
+
+ dodoc README
+ if use doc ; then
+ dodoc doc/*.txt
+ docinto html
+ dodoc doc/*.html doc/*.gif
+ fi
+}
+
+src_test(){
+ # the current ebuild need static library to run tests
+ emake ntl.a
+
+ default
+}