From 16ac6fee8dc3469fecbc7d59e0cf49035434880e Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 1 Jan 1970 00:00:00 +0000 Subject: [PATCH] Added libgmp. --- .hgignore | 1 + gmp/mingw32-gmp-4.2.4-sscanf-test.patch | 35 ++++++++++ gmp/mingw32-gmp.spec | 117 ++++++++++++++++++++++++++++++++ 3 files changed, 153 insertions(+) create mode 100644 gmp/mingw32-gmp-4.2.4-sscanf-test.patch create mode 100644 gmp/mingw32-gmp.spec diff --git a/.hgignore b/.hgignore index 752b352..9102bd0 100644 --- a/.hgignore +++ b/.hgignore @@ -41,6 +41,7 @@ glib2/glib-2.18.0.tar.bz2 glib2/glib-2.18.1.tar.bz2 glib2/glib-2.19.5.tar.bz2 glibmm24/glibmm-2.18.1.tar.bz2 +gmp/gmp-4.2.4.tar.bz2 gnutls/gnutls-2.4.1.tar.bz2 gnutls/gnutls-2.4.2-nosrp.tar.bz2 gnutls/gnutls-2.6.3-nosrp.tar.bz2 diff --git a/gmp/mingw32-gmp-4.2.4-sscanf-test.patch b/gmp/mingw32-gmp-4.2.4-sscanf-test.patch new file mode 100644 index 0000000..e2f34c4 --- /dev/null +++ b/gmp/mingw32-gmp-4.2.4-sscanf-test.patch @@ -0,0 +1,35 @@ +--- gmp-4.2.4.orig/tests/misc/t-scanf.c 2008-08-02 21:11:59.000000000 +0100 ++++ gmp-4.2.4.sscanf/tests/misc/t-scanf.c 2009-01-28 16:42:26.000000000 +0000 +@@ -93,6 +93,24 @@ + return result; + } + ++/* This is a problem found on i686-pc-mingw32, running binaries under ++ Wine. Windows scanf functions don't skip whitespace before %-specifiers ++ [http://msdn.microsoft.com/en-us/library/kwwtf9ch(VS.71).aspx] */ ++int ++test_sscanf_s_skips_whitespace (void) ++{ ++ char str[16]; ++ ++ if (sscanf (" ", "%s", str) == EOF) ++ return 1; ++ else ++ { ++ printf ("Warning, sscanf (\" \", \"%s\", str) != EOF.\n"); ++ printf ("This affects gmp_sscanf, some tests will be suppressed.\n"); ++ return 0; ++ } ++} ++ + + /* Convert fmt from a GMP scanf format string to an equivalent for a plain + libc scanf, for example "%Zd" becomes "%ld". Return 1 if this succeeds, +@@ -1489,6 +1507,7 @@ + } + + /* EOF for no matching */ ++ if (test_sscanf_s_skips_whitespace ()) + { + char buf[128]; + ret = gmp_sscanf (" ", "%s", buf); diff --git a/gmp/mingw32-gmp.spec b/gmp/mingw32-gmp.spec new file mode 100644 index 0000000..711867d --- /dev/null +++ b/gmp/mingw32-gmp.spec @@ -0,0 +1,117 @@ +%define __strip %{_mingw32_strip} +%define __objdump %{_mingw32_objdump} +%define _use_internal_dependency_generator 0 +%define __find_requires %{_mingw32_findrequires} +%define __find_provides %{_mingw32_findprovides} + +# Define this to run tests (requires Wine, and won't work +# inside mock or Koji). +%define run_tests 0 + +Name: mingw32-gmp +Version: 4.2.4 +Release: 1%{?dist} +Summary: Windows port of GNU arbitrary precision library + +License: LGPLv3+ +Group: Development/Libraries + +URL: http://gmplib.org/ +Source0: ftp://ftp.gnu.org/pub/gnu/gmp/gmp-%{version}.tar.bz2 + +# Present in the Fedora native package, but shouldn't be needed for +# Windows since we are only building on a single architecture. +#Source2: gmp.h +#Source3: gmp-mparam.h + +# S390 patch is not applicable for Windows. +#Patch0: gmp-4.0.1-s390.patch + +# Fix broken sscanf test (sent upstream 2009-01-28). +Patch1000: mingw32-gmp-4.2.4-sscanf-test.patch + +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildArch: noarch + +BuildRequires: mingw32-filesystem >= 44 +BuildRequires: mingw32-gcc +BuildRequires: mingw32-gcc-c++ +BuildRequires: mingw32-binutils + +BuildRequires: mingw32-dlfcn +BuildRequires: mingw32-readline + +BuildRequires: flex + +%if %run_tests +BuildRequires: wine +%endif + + +%description +The gmp package contains GNU MP, a library for arbitrary precision +arithmetic, signed integers operations, rational numbers and floating +point numbers. GNU MP is designed for speed, for both small and very +large operands. GNU MP is fast because it uses fullwords as the basic +arithmetic type, it uses fast algorithms, it carefully optimizes +assembly code for many CPUs' most common inner loops, and it generally +emphasizes speed over simplicity/elegance in its operations. + +Install the gmp package if you need a fast arbitrary precision +library. + +This is the development package for Windows cross-compilation. + + +%prep +%setup -q -n gmp-%{version} + +%patch1000 -p1 + + +%build +%{_mingw32_configure} \ + --enable-mpbsd \ + --enable-cxx \ + --disable-static \ + --enable-shared +make %{?_smp_mflags} + + +%check +%if %run_tests +make %{?_smp_mflags} check +%endif + + +%install +rm -rf $RPM_BUILD_ROOT + +make DESTDIR=$RPM_BUILD_ROOT install +install -m 644 gmp-mparam.h ${RPM_BUILD_ROOT}%{_mingw32_includedir} + +rm -rf $RPM_BUILD_ROOT%{_mingw32_infodir} + + +%clean +rm -rf $RPM_BUILD_ROOT + + +%files +%defattr(-,root,root) +%doc COPYING.LIB README +%{_mingw32_bindir}/libgmp-3.dll +%{_mingw32_bindir}/libgmpxx-4.dll +%{_mingw32_bindir}/libmp-3.dll +%{_mingw32_libdir}/libgmp.dll.a +%{_mingw32_libdir}/libgmp.la +%{_mingw32_libdir}/libgmpxx.dll.a +%{_mingw32_libdir}/libgmpxx.la +%{_mingw32_libdir}/libmp.dll.a +%{_mingw32_libdir}/libmp.la +%{_mingw32_includedir}/*.h + + +%changelog +* Wed Jan 28 2009 Richard W.M. Jones - 2.3.2-1 +- Initial RPM release (on behalf of Ralf Corsepius). -- 1.8.3.1