ntl-6.0.0.

Add -sagemath patch to let sagemath handle NTL errors.
This commit is contained in:
Jerry James 2013-05-06 11:37:06 -06:00
parent d77c8f2ead
commit e28334b0d9
4 changed files with 66 additions and 7 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
ntl-5.5.2.tar.gz /ntl-6.0.0.tar.gz

51
ntl-sagemath.patch Normal file
View File

@ -0,0 +1,51 @@
--- ./include/NTL/tools.h.orig 2013-02-15 07:44:27.000000000 -0700
+++ ./include/NTL/tools.h 2013-05-03 15:15:53.879506639 -0600
@@ -289,6 +289,12 @@ long CharToIntVal(long c);
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 2013-02-15 07:44:26.000000000 -0700
+++ ./src/tools.c 2013-05-03 15:14:35.486648170 -0600
@@ -17,9 +17,33 @@ NTL_START_IMPL
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();
}

View File

@ -6,16 +6,19 @@
Summary: High-performance algorithms for vectors, matrices, and polynomials Summary: High-performance algorithms for vectors, matrices, and polynomials
Name: ntl Name: ntl
Version: 5.5.2 Version: 6.0.0
Release: 9%{?dist} Release: 1%{?dist}
License: GPLv2+ License: GPLv2+
URL: http://shoup.net/ntl/ URL: http://shoup.net/ntl/
Group: System Environment/Libraries Group: System Environment/Libraries
Source0: http://shoup.net/ntl/ntl-%{version}.tar.gz Source0: http://shoup.net/ntl/%{name}-%{version}.tar.gz
Source1: multilib_template.h Source1: multilib_template.h
# Apply sagemath patch to let sagemath handle NTL errors.
Patch0: %{name}-sagemath.patch
BuildRequires: gf2x-devel BuildRequires: gf2x-devel
BuildRequires: gmp-devel BuildRequires: gmp-devel
BuildRequires: libtool BuildRequires: libtool
@ -56,6 +59,7 @@ Requires: %{name}-devel%{?_isa} = %{version}-%{release}
%prep %prep
%setup -q %setup -q
%patch0
# omit for now, fixes arm ftbfs when CC != gcc, but causes regression: # omit for now, fixes arm ftbfs when CC != gcc, but causes regression:
# http://bugzilla.redhat.com/904348 # http://bugzilla.redhat.com/904348
@ -130,7 +134,7 @@ done
%files %files
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc README doc/copying.txt %doc README doc/copying.txt
%{_libdir}/libntl.so.0* %{_libdir}/libntl.so.2*
%files devel %files devel
%defattr(-,root,root,-) %defattr(-,root,root,-)
@ -146,6 +150,10 @@ done
%changelog %changelog
* Mon May 6 2013 Jerry James <loganjerry@gmail.com> - 6.0.0-1
- ntl-6.0.0
- Add -sagemath patch to let sagemath handle NTL errors
* Sat Jan 26 2013 Rex Dieter <rdieter@fedoraproject.org> 5.5.2-9 * Sat Jan 26 2013 Rex Dieter <rdieter@fedoraproject.org> 5.5.2-9
- ntl should explicitly link to libstdc++ (#904348) - ntl should explicitly link to libstdc++ (#904348)
@ -213,7 +221,7 @@ done
* Fri Feb 08 2008 Rex Dieter <rdieter@fedoraproject.org> 5.4.1-2 * Fri Feb 08 2008 Rex Dieter <rdieter@fedoraproject.org> 5.4.1-2
- respin (gcc43) - respin (gcc43)
* Tue Dec 08 2007 Rex Dieter <rdieter[AT]fedoraproject.org> 5.4.1-1 * Tue Dec 18 2007 Rex Dieter <rdieter[AT]fedoraproject.org> 5.4.1-1
- ntl-5.4.1 - ntl-5.4.1
* Sat Aug 11 2007 Rex Dieter <rdieter[AT]fedoraproject.org> 5.4-6 * Sat Aug 11 2007 Rex Dieter <rdieter[AT]fedoraproject.org> 5.4-6

View File

@ -1 +1 @@
2e0afa1fa3b325e562ce89da57cba983 ntl-5.5.2.tar.gz 71e603b8314feff8a446d8629e69d596 ntl-6.0.0.tar.gz