--- mlgmp-20021123.orig/debian/copyright
+++ mlgmp-20021123/debian/copyright
@@ -0,0 +1,44 @@
+This package was debianized by Mike Furr <mfurr@debian.org> on
+Fri, 9 Apr 2004 02:05:56 -0400.
+
+It was downloaded from http://www.di.ens.fr/~monniaux/download/mlgmp-20021123.tar.gz
+
+Upstream Author: David Monniaux <David.Monniaux@ens.fr>
+
+Copyright:
+
+ Copyright (C) 2001-2002 David Monniaux
+ Copyright (C) 2000 Jean-Christophe Filliatre
+
+Quote the README:
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Library General Public License version 2, as
+published by the Free Software Foundation, or any more recent version
+published by the Free Software Foundation, at your choice.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+See the GNU Library General Public License version 2 for more details
+(enclosed in the file LGPL.txt).
+
+As a special exception to the GNU Library General Public License, you
+may link, statically or dynamically, a "work that uses the Library"
+with a publicly distributed version of the Library to produce an
+executable file containing portions of the Library, and distribute
+that executable file under terms of your choice, without any of the
+additional requirements listed in clause 6 of the GNU Library General
+Public License. By "a publicly distributed version of the Library",
+we mean either the unmodified Library as distributed by the author, or a
+modified version of the Library that is distributed under the
+conditions defined in clause 3 of the GNU Library General Public
+License. This exception does not however invalidate any other reasons
+why the executable file might be covered by the GNU Library General
+Public License.
+
+End Quoate.
+Note, the LGPL is available as
+ /usr/share/common-licenses/LGPL-2
+on Debian systems
--- mlgmp-20021123.orig/debian/libgmp-ocaml.files.in
+++ mlgmp-20021123/debian/libgmp-ocaml.files.in
@@ -0,0 +1,2 @@
+@OCamlDllDir@
+
--- mlgmp-20021123.orig/debian/changelog
+++ mlgmp-20021123/debian/changelog
@@ -0,0 +1,163 @@
+mlgmp (20021123-17) unstable; urgency=low
+
+ * debian/patches/20_mlgmp_z.dpatch: fix wrong conversion from int on
+ 64 bits computers (Closes: #573978).
+ * Bump ocaml-nox version to (>= 3.11.1-3~) and dh-ocaml to (>= 0.9~).
+ * Bump standards to 3.8.4, no changes needed.
+ * Remove Zack from Uploaders (on his request).
+ * Add debian/source/format (keep 1.0 for now).
+
+ -- Mehdi Dogguy <mehdi@debian.org> Thu, 03 Jun 2010 23:05:36 +0200
+
+mlgmp (20021123-16) unstable; urgency=low
+
+ [ Sylvain Le Gall ]
+ * Switch to dh-ocaml 0.9
+ * Use ocaml:Depends/Provides in debian/control
+ * Use debian/libgmp-ocaml-dev.ocamldoc to generate documentation
+ (Closes: #549844)
+ * Move .../gmp/META to .../METAS/META.gmp since this is a debian
+ specific META
+
+ [ Mehdi Dogguy ]
+ * Update my e-mail address
+
+ -- Mehdi Dogguy <mehdi@debian.org> Tue, 06 Oct 2009 18:47:11 +0200
+
+mlgmp (20021123-15) unstable; urgency=low
+
+ * Use new Ocaml's stdlib location
+ * Move library packages to the new ocaml section
+ * Add myself to uploaders
+ * Bump standards to 3.8.2
+ * Add a README.source
+ * Generate documentation
+ * Register documentation with docbase
+ * Add a watch file
+
+ -- Mehdi Dogguy <dogguy@pps.jussieu.fr> Wed, 24 Jun 2009 21:57:04 +0200
+
+mlgmp (20021123-14) unstable; urgency=low
+
+ [ Mike Furr ]
+ * Changed packaging to git and updated VCS field
+ * Changed Maintainer to d-o-m, added self to uploaders
+ * Chnaged compat file to 7
+ * Bump standards to 3.8.0
+ * Cleaned up rules file and added build-dep on dh-ocaml
+ * Changed *.in to use new substitutation vars
+ * Added Homepage
+ * Install the .so file directly into the proper package tree via the
+ makefile, instead of moving it there manually in rules
+
+ [ Sylvain Le Gall ]
+ * Update my email address
+
+ -- Mike Furr <mfurr@debian.org> Fri, 27 Feb 2009 16:28:55 -0500
+
+mlgmp (20021123-13) unstable; urgency=medium
+
+ [ Stefano Zacchiroli ]
+ * fix vcs-svn field to point just above the debian/ dir
+ * fix typo in Sylvain's name
+ * bump urgency to medium for the OCaml 3.10.1 transition
+
+ [ Stephane Glondu ]
+ * Fix binNMU safety (Closes: #464312)
+ * Fix OCaml spelling in description
+ * Fix copyright file
+ * Use ${binary:Version} instead of deprecated ${Source-Version} in
+ debian/control
+ * Add Section:libs for source package
+ * Add descriptions to patches
+ * Fix lintian debian-rules-ignores-make-clean-error
+ * Removing empty stublibs directory from -dev package
+ * Update Standards-Version to 3.7.3
+
+ -- Stefano Zacchiroli <zack@debian.org> Sun, 02 Mar 2008 15:24:05 +0100
+
+mlgmp (20021123-12) unstable; urgency=low
+
+ * Rebuild with 3.10.0 (Closes: #441187)
+
+ -- Mike Furr <mfurr@debian.org> Fri, 07 Sep 2007 17:05:56 -0400
+
+mlgmp (20021123-11) unstable; urgency=low
+
+ * Standards-Version 3.7.2 (no change)
+ * Rebuild with Ocaml 3.09.2 (closes: Bug#369711)
+ * Package description: replaced "O'Caml" by "OCaml"
+ * debian/rules: changed name of the target "transition" into "debian/control"
+
+ -- Ralf Treinen <treinen@debian.org> Wed, 7 Jun 2006 22:24:56 +0200
+
+mlgmp (20021123-10) unstable; urgency=low
+
+ * Remove hard-coded ABI version
+ * Rebuild with 3.09.1
+
+ -- Mike Furr <mfurr@debian.org> Sat, 7 Jan 2006 18:04:32 -0500
+
+mlgmp (20021123-9) unstable; urgency=low
+
+ * Rebuild with 3.09
+
+ -- Mike Furr <mfurr@debian.org> Tue, 8 Nov 2005 22:29:07 -0500
+
+mlgmp (20021123-8) unstable; urgency=low
+
+ * Moved the binary packages into their proper sections of
+ libs && libdevel
+
+ -- Mike Furr <mfurr@debian.org> Mon, 5 Sep 2005 12:07:48 -0400
+
+mlgmp (20021123-7) unstable; urgency=low
+
+ * Use -O2 instead of -O3 to hopefully avoid an ICE on m68k
+ * Several bug fixes from Pascal Zimmer including
+ - Z2.copy is really Z.copy
+ - Added a real Z2.copy
+ - _mlgmp_z2_from_[int|string_base|float] now use mpz_set
+ insetad of mpz_init_set
+ - Added test suite for these functions
+
+ -- Mike Furr <mfurr@debian.org> Sat, 3 Sep 2005 15:11:10 -0400
+
+mlgmp (20021123-6) unstable; urgency=low
+
+ * Rebuild against new gmp package.
+
+ -- Mike Furr <mfurr@debian.org> Fri, 29 Jul 2005 12:31:36 -0400
+
+mlgmp (20021123-5) unstable; urgency=medium
+
+ * Rebuild against 3.08.3
+ * Set [Build-]Depends to 3.08.3
+
+ -- Mike Furr <mfurr@debian.org> Wed, 23 Mar 2005 12:54:24 -0500
+
+mlgmp (20021123-4) unstable; urgency=low
+
+ * Rebuild with ocaml 3.08
+ * Change deps to use ocaml-nox-3.08
+
+ -- Mike Furr <mfurr@debian.org> Thu, 22 Jul 2004 13:10:24 -0400
+
+mlgmp (20021123-3) unstable; urgency=low
+
+ * Added a depends on libgmp3-dev for libgmp-ocaml-dev pkg.
+
+ -- Mike Furr <mfurr@debian.org> Sun, 18 Apr 2004 21:32:08 -0400
+
+mlgmp (20021123-2) unstable; urgency=low
+
+ * Added -fPIC flag so it compiles on all archs
+ * Added ocaml team to uploaders field.
+
+ -- Mike Furr <mfurr@debian.org> Sun, 18 Apr 2004 12:26:51 -0400
+
+mlgmp (20021123-1) unstable; urgency=low
+
+ * Initial Release (Closes: 242841)
+
+ -- Mike Furr <mfurr@debian.org> Fri, 9 Apr 2004 02:05:56 -0400
--- mlgmp-20021123.orig/debian/rules
+++ mlgmp-20021123/debian/rules
@@ -0,0 +1,40 @@
+#!/usr/bin/make -f
+
+PACKAGE=libgmp-ocaml
+
+include /usr/share/ocaml/ocamlvars.mk
+include /usr/share/dpatch/dpatch.make
+
+ifeq ($(OCAML_HAVE_OCAMLOPT),yes)
+HAS_OPT="HAS_OPT=1"
+else
+HAS_OPT=
+endif
+
+build: build-stamp
+build-stamp: patch
+ dh build --with ocaml
+ $(MAKE) depend
+ $(MAKE) $(HAS_OPT)
+ touch build-stamp
+
+clean: clean1 unpatch
+clean1:
+ $(MAKE) clean
+ dh clean --with ocaml
+
+install: build install-stamp
+install-stamp:
+ dh install --before auto_install --with ocaml
+ $(MAKE) $(HAS_OPT) install \
+ DESTDIR=$(CURDIR)/debian/$(PACKAGE)-dev \
+ STUBDIR=$(CURDIR)/debian/$(PACKAGE)/$(OCAML_DLL_DIR)
+ dh install --after auto_install --with ocaml
+ touch $@
+
+binary-arch binary-indep: install-stamp
+ dh $@ --with ocaml
+
+binary: binary-arch binary-indep
+
+.PHONY: build clean clean1 binary-indep binary-arch binary install
--- mlgmp-20021123.orig/debian/control
+++ mlgmp-20021123/debian/control
@@ -0,0 +1,54 @@
+Source: mlgmp
+Priority: optional
+Maintainer: Debian OCaml Maintainers <debian-ocaml-maint@lists.debian.org>
+Uploaders:
+ Ralf Treinen <treinen@debian.org>,
+ Sven Luther <luther@debian.org>,
+ Remi Vanicat <vanicat@debian.org>,
+ Sylvain Le Gall <gildor@debian.org>,
+ Mehdi Dogguy <mehdi@debian.org>,
+ Mike Furr <mfurr@debian.org>
+Build-Depends:
+ ocaml-nox (>= 3.11.1-3~),
+ debhelper (>= 7.0.0),
+ dpatch,
+ libgmp3-dev,
+ libmpfr-dev,
+ dh-ocaml (>= 0.9~)
+Homepage: http://www-verimag.imag.fr/~monniaux/programmes.html.en
+Standards-Version: 3.8.4
+Section: ocaml
+Vcs-Git: git://git.debian.org/git/pkg-ocaml-maint/packages/mlgmp.git
+Vcs-Browser: http://git.debian.org/?p=pkg-ocaml-maint/packages/perl4caml.git
+
+Package: libgmp-ocaml
+Architecture: any
+Depends:
+ ${shlibs:Depends},
+ ${misc:Depends},
+ ${ocaml:Depends}
+Provides: ${ocaml:Provides}
+Description: OCaml bindings for the GNU multiprecision arithmetic library
+ This package provides bindings for the GNU multiprecision library
+ (GNU MP) for the language OCaml (caml.inria.fr). It is mostly a 1-1 mapping
+ of the C functions into the OCaml namespace, but also includes some
+ infix operators to make for a cleaner syntax.
+ .
+ This package provides the shared library for running applications linked
+ against libgmp-ocaml
+
+Package: libgmp-ocaml-dev
+Architecture: any
+Depends:
+ ${ocaml:Depends},
+ libgmp3-dev,
+ ${misc:Depends}
+Provides: ${ocaml:Provides}
+Description: OCaml bindings for the GNU multiprecision arithmetic library
+ This package provides bindings for the GNU multiprecision library
+ (GNU MP) for the language OCaml(caml.inria.fr). It is mostly a 1-1 mapping
+ of the C functions into the OCaml namespace, but also includes some
+ infix operators to make for a cleaner syntax.
+ .
+ This package provides the static library, OCaml library and interface
+ for developing applications to use libgmp-ocaml
--- mlgmp-20021123.orig/debian/clean
+++ mlgmp-20021123/debian/clean
@@ -0,0 +1 @@
+depend
--- mlgmp-20021123.orig/debian/libgmp-ocaml-dev.install.in
+++ mlgmp-20021123/debian/libgmp-ocaml-dev.install.in
@@ -0,0 +1 @@
+debian/META.gmp @OCamlStdlibDir@/METAS
--- mlgmp-20021123.orig/debian/compat
+++ mlgmp-20021123/debian/compat
@@ -0,0 +1 @@
+7
--- mlgmp-20021123.orig/debian/README.Debian
+++ mlgmp-20021123/debian/README.Debian
@@ -0,0 +1,7 @@
+mlgmp for Debian
+----------------
+
+Note that this original source package contains creal v0.1 which is
+not built since creal v0.4 is packaged as a separate entity.
+
+ -- Mike Furr <mfurr@debian.org>, Fri Apr 9 22:20:43 2004
--- mlgmp-20021123.orig/debian/META.gmp
+++ mlgmp-20021123/debian/META.gmp
@@ -0,0 +1,7 @@
+name="gmp"
+version="20021123"
+description="bindings to GNU MP library"
+archive(byte)="gmp.cma"
+archive(native)="gmp.cmxa"
+requires=""
+directory="+gmp"
--- mlgmp-20021123.orig/debian/libgmp-ocaml-dev.ocamldoc
+++ mlgmp-20021123/debian/libgmp-ocaml-dev.ocamldoc
@@ -0,0 +1 @@
+# This file must not be empty to be represented in .diff.gz!
--- mlgmp-20021123.orig/debian/watch
+++ mlgmp-20021123/debian/watch
@@ -0,0 +1,2 @@
+version=3
+http://www-verimag.imag.fr/~monniaux/download/mlgmp-([0-9]+)\.tar\.gz
--- mlgmp-20021123.orig/debian/docs
+++ mlgmp-20021123/debian/docs
@@ -0,0 +1 @@
+README
--- mlgmp-20021123.orig/debian/gbp.conf
+++ mlgmp-20021123/debian/gbp.conf
@@ -0,0 +1,2 @@
+[DEFAULT]
+pristine-tar = True
--- mlgmp-20021123.orig/debian/README.source
+++ mlgmp-20021123/debian/README.source
@@ -0,0 +1,20 @@
+mlgmp Debian source package
+===========================
+
+Patching upstream sources
+-------------------------
+
+This package uses dpatch to manage all modifications to the upstream
+source. Changes are stored in the source package as diffs in
+debian/patches and applied during the build.
+
+To get the fully patched source after unpacking the source package, cd
+to the root level of the source package and run:
+
+ debian/rules patch
+
+Removing a patch is as simple as removing its entry from the
+debian/patches/00list file, and please also remove the patch file
+itself.
+
+ -- Mehdi Dogguy <dogguy@pps.jussieu.fr>, Tue, 30 Jun 2009 23:07:54 +0200
--- mlgmp-20021123.orig/debian/source/format
+++ mlgmp-20021123/debian/source/format
@@ -0,0 +1 @@
+1.0
--- mlgmp-20021123.orig/debian/patches/00list
+++ mlgmp-20021123/debian/patches/00list
@@ -0,0 +1,4 @@
+10_config.dpatch
+11_Makefile.dpatch
+15_bugfixes.dpatch
+20_mlgmp_z.dpatch
--- mlgmp-20021123.orig/debian/patches/20_mlgmp_z.dpatch
+++ mlgmp-20021123/debian/patches/20_mlgmp_z.dpatch
@@ -0,0 +1,216 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## Description: Fix wrong conversion from int on 64 bits computers
+## Origin/Author: Jean-Christophe Filliâtre
+## Bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=573978
+## 20_mlgmp_z.dpatch by Mehdi Dogguy <mehdi@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Fix wrong conversion from int on 64 bits computers.
+
+@DPATCH@
+diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' mlgmp~/mlgmp_z.c mlgmp/mlgmp_z.c
+--- mlgmp~/mlgmp_z.c 2010-06-03 22:34:02.000000000 +0200
++++ mlgmp/mlgmp_z.c 2010-06-03 22:38:50.000000000 +0200
+@@ -63,7 +63,7 @@
+ CAMLparam1(ml_val);
+ CAMLlocal1(r);
+ r=alloc_mpz();
+- mpz_init_set_si(*mpz_val(r), Int_val(ml_val));
++ mpz_init_set_si(*mpz_val(r), Long_val(ml_val)); /* FIX */
+ CAMLreturn(r);
+ }
+
+@@ -88,7 +88,7 @@
+ value _mlgmp_z2_from_int(value r, value ml_val)
+ {
+ CAMLparam2(r, ml_val);
+- mpz_set_si(*mpz_val(r), Int_val(ml_val));
++ mpz_set_si(*mpz_val(r), Long_val(ml_val));
+ CAMLreturn(Val_unit);
+ }
+
+@@ -151,14 +151,14 @@
+ CAMLparam2(a, b); \
+ CAMLlocal1(r); \
+ r=alloc_init_mpz(); \
+- mpz_##op(*mpz_val(r), *mpz_val(a), Int_val(b)); \
++ mpz_##op(*mpz_val(r), *mpz_val(a), Long_val(b)); \
+ CAMLreturn(r); \
+ } \
+ \
+ value _mlgmp_z2_##op(value r, value a, value b) \
+ { \
+ CAMLparam3(r, a, b); \
+- mpz_##op(*mpz_val(r), *mpz_val(a), Int_val(b)); \
++ mpz_##op(*mpz_val(r), *mpz_val(a), Long_val(b)); \
+ CAMLreturn(Val_unit); \
+ }
+
+@@ -196,7 +196,7 @@
+ CAMLparam3(a, b, modulus);
+ CAMLlocal1(r);
+ r=alloc_init_mpz();
+- mpz_powm_ui(*mpz_val(r), *mpz_val(a), Int_val(b), *mpz_val(modulus));
++ mpz_powm_ui(*mpz_val(r), *mpz_val(a), Long_val(b), *mpz_val(modulus));
+ CAMLreturn(r);
+ }
+
+@@ -205,7 +205,7 @@
+ CAMLparam2(a, b);
+ CAMLlocal1(r);
+ r=alloc_init_mpz();
+- mpz_ui_pow_ui(*mpz_val(r), Int_val(a), Int_val(b));
++ mpz_ui_pow_ui(*mpz_val(r), Long_val(a), Long_val(b));
+ CAMLreturn(r);
+ }
+
+@@ -221,14 +221,14 @@
+ value _mlgmp_z2_powm_ui(value r, value a, value b, value modulus)
+ {
+ CAMLparam4(r, a, b, modulus);
+- mpz_powm_ui(*mpz_val(r), *mpz_val(a), Int_val(b), *mpz_val(modulus));
++ mpz_powm_ui(*mpz_val(r), *mpz_val(a), Long_val(b), *mpz_val(modulus));
+ CAMLreturn(Val_unit);
+ }
+
+ value _mlgmp_z2_ui_pow_ui(value r, value a, value b)
+ {
+ CAMLparam3(r, a, b);
+- mpz_ui_pow_ui(*mpz_val(r), Int_val(a), Int_val(b));
++ mpz_ui_pow_ui(*mpz_val(r), Long_val(a), Long_val(b));
+ CAMLreturn(Val_unit);
+ }
+
+@@ -376,7 +376,7 @@
+ { \
+ CAMLparam2(n, d); \
+ CAMLlocal3(q, r, qr); \
+- unsigned long int ui_d = Int_val(d); \
++ unsigned long int ui_d = Long_val(d); \
+ \
+ if (! ui_d) division_by_zero(); \
+ \
+@@ -395,7 +395,7 @@
+ { \
+ CAMLparam2(n, d); \
+ CAMLlocal1(q); \
+- unsigned long int ui_d = Int_val(d); \
++ unsigned long int ui_d = Long_val(d); \
+ \
+ if (! ui_d) division_by_zero(); \
+ \
+@@ -409,7 +409,7 @@
+ value _mlgmp_z2_##kind##div_q_ui(value q, value n, value d) \
+ { \
+ CAMLparam3(q, n, d); \
+- unsigned long int ui_d = Int_val(d); \
++ unsigned long int ui_d = Long_val(d); \
+ \
+ if (! ui_d) division_by_zero(); \
+ \
+@@ -422,7 +422,7 @@
+ { \
+ CAMLparam2(n, d); \
+ CAMLlocal1(r); \
+- unsigned long int ui_d = Int_val(d); \
++ unsigned long int ui_d = Long_val(d); \
+ \
+ if (! ui_d) division_by_zero(); \
+ \
+@@ -436,7 +436,7 @@
+ value _mlgmp_z2_##kind##div_r_ui(value r, value n, value d) \
+ { \
+ CAMLparam3(r, n, d); \
+- unsigned long int ui_d = Int_val(d); \
++ unsigned long int ui_d = Long_val(d); \
+ \
+ if (! ui_d) division_by_zero(); \
+ \
+@@ -448,7 +448,7 @@
+ value _mlgmp_z_##kind##div_ui(value n, value d) \
+ { \
+ CAMLparam2(n, d); \
+- unsigned long int ui_d = Int_val(d); \
++ unsigned long int ui_d = Long_val(d); \
+ \
+ if (! ui_d) division_by_zero(); \
+ \
+@@ -492,7 +492,7 @@
+ { \
+ CAMLparam2(n, d); \
+ CAMLlocal1(q); \
+- unsigned int ld = Int_val(d); \
++ unsigned int ld = Long_val(d); \
+ \
+ if (! ld) \
+ division_by_zero(); \
+@@ -507,7 +507,7 @@
+ value _mlgmp_z2_##op(value q, value n, value d) \
+ { \
+ CAMLparam3(q, n, d); \
+- unsigned int ld = Int_val(d); \
++ unsigned int ld = Long_val(d); \
+ \
+ if (! ld) \
+ division_by_zero(); \
+@@ -584,7 +584,7 @@
+ value _mlgmp_z_compare_si(value a, value b)
+ {
+ CAMLparam2(a, b);
+- CAMLreturn(Val_int(mpz_cmp_si(*mpz_val(a), Int_val(b))));
++ CAMLreturn(Val_int(mpz_cmp_si(*mpz_val(a), Long_val(b))));
+ }
+
+ /*** Number theory */
+@@ -645,13 +645,13 @@
+ value _mlgmp_z_kronecker_si(value a, value b)
+ {
+ CAMLparam2(a, b);
+- CAMLreturn(Val_int(mpz_kronecker_si(*mpz_val(a), Int_val(b))));
++ CAMLreturn(Val_int(mpz_kronecker_si(*mpz_val(a), Long_val(b))));
+ }
+
+ value _mlgmp_z_si_kronecker(value a, value b)
+ {
+ CAMLparam2(a, b);
+- CAMLreturn(Val_int(mpz_si_kronecker(Int_val(a), *mpz_val(b))));
++ CAMLreturn(Val_int(mpz_si_kronecker(Long_val(a), *mpz_val(b))));
+ }
+
+ value _mlgmp_z_remove(value a, value b)
+@@ -673,7 +673,7 @@
+ CAMLparam1(a); \
+ CAMLlocal1(r); \
+ r = alloc_init_mpz(); \
+- mpz_##op(*mpz_val(r), Int_val(a)); \
++ mpz_##op(*mpz_val(r), Long_val(a)); \
+ CAMLreturn(r); \
+ }
+
+@@ -686,7 +686,7 @@
+ CAMLparam2(n, k);
+ CAMLlocal1(r);
+ r = alloc_init_mpz();
+- mpz_bin_uiui(*mpz_val(r), Int_val(n), Int_val(k));
++ mpz_bin_uiui(*mpz_val(r), Long_val(n), Long_val(k));
+ CAMLreturn(r);
+ }
+
+@@ -711,7 +711,7 @@
+ value _mlgmp_z_##op(value a, value b) \
+ { \
+ CAMLparam2(a, b); \
+- CAMLreturn(Val_int(mpz_##op(*mpz_val(a), Int_val(b)))); \
++ CAMLreturn(Val_int(mpz_##op(*mpz_val(a), Long_val(b)))); \
+ }
+
+ z_int_binary_op_ui(scan0)
+@@ -724,7 +724,7 @@
+ CAMLparam2(state, n); \
+ CAMLlocal1(r); \
+ r = alloc_init_mpz(); \
+- mpz_##op(*mpz_val(r), *randstate_val(state), Int_val(n)); \
++ mpz_##op(*mpz_val(r), *randstate_val(state), Long_val(n)); \
+ CAMLreturn(r); \
+ }
+
--- mlgmp-20021123.orig/debian/patches/11_Makefile.dpatch
+++ mlgmp-20021123/debian/patches/11_Makefile.dpatch
@@ -0,0 +1,161 @@
+#! /bin/sh -e
+## 10_Makefile.dpatch by Mike Furr <mfurr@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Handling non-native archs and proper handling of .so generation
+
+[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
+patch_opts="${patch_opts:--f --no-backup-if-mismatch ${2:+-d $2}}"
+
+if [ $# -lt 1 ]; then
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1
+fi
+case "$1" in
+ -patch) patch $patch_opts -p1 < $0;;
+ -unpatch) patch $patch_opts -p1 -R < $0;;
+ *)
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1;;
+esac
+
+exit 0
+@DPATCH@
+diff -urNad --exclude=CVS --exclude=.svn ./Makefile /tmp/dpep-work.HWFzlv/mlgmp-20021123/Makefile
+--- ./Makefile 2005-09-03 15:15:47.339340437 -0400
++++ /tmp/dpep-work.HWFzlv/mlgmp-20021123/Makefile 2005-09-03 15:15:56.140184593 -0400
+@@ -2,12 +2,14 @@
+ RANLIB= ranlib
+
+ OCAML_LIBDIR:= $(shell ocamlc -where)
+-GMP_INCLUDES= -I/opt/gmp/include -I/users/absint2/local/include -I$(HOME)/packages/gmp/include
++GMP_INCLUDES=
+
+-GMP_LIBDIR=/opt/gmp/lib
+-DESTDIR= $(OCAML_LIBDIR)/gmp
++GMP_LIBDIR=
++PREFIX= $(OCAML_LIBDIR)
++PKGDIR= $(PREFIX)/gmp/
++STUBDIR= $(PREFIX)/stublibs/
+
+-RLIBFLAGS= -cclib "-Wl,-rpath $(GMP_LIBDIR)" # Linux, FreeBSD
++#RLIBFLAGS= -cclib "-Wl,-rpath $(GMP_LIBDIR)" # Linux, FreeBSD
+ #RLIBFLAGS= -cclib "-Wl,-R $(GMP_LIBDIR)" # Solaris
+ # RLIBFLAGS= # MacOS X
+
+@@ -15,33 +17,53 @@
+ -cclib -lmpfr -cclib -lgmp -cclib -L$(DESTDIR)
+
+ CC= gcc
+-CFLAGS_MISC= -Wall -Wno-unused -g -O3
++CFLAGS_MISC= -Wall -Wno-unused -g -O2 -fPIC
+ #CFLAGS_MISC=
+ CFLAGS_INCLUDE= -I $(OCAML_LIBDIR) $(GMP_INCLUDES)
+ CFLAGS= $(CFLAGS_MISC) $(CFLAGS_INCLUDE)
+
+ OCAMLC= ocamlc -g
+ OCAMLOPT= ocamlopt
++OCAMLMKLIB= ocamlmklib
+ OCAMLFLAGS=
+
+ CMODULES= mlgmp_z.c mlgmp_q.c mlgmp_f.c mlgmp_fr.c mlgmp_random.c mlgmp_misc.c
+ CMODULES_O= $(CMODULES:%.c=%.o)
+
+-LIBS= libmlgmp.a gmp.a gmp.cma gmp.cmxa gmp.cmi
+
+ PROGRAMS= test_creal test_creal.opt essai essai.opt toplevel\
+ test_suite test_suite.opt
+-TESTS= test_suite test_suite.opt
++
++C_STATIC = libgmpstub.a
++C_SHARED = dllgmpstub.so
++
++HAS_OPT=
++BYTE_LIBS= gmp.cma gmp.cmi
++BYTE_TESTS= test_suite
++
++ifdef HAS_OPT
++ OPT_LIBS= gmp.cmxa
++ OPT_CMX= gmp.cmx
++ OPT_TESTS= test_suite.opt
++else
++ OPT_LIBS=
++ OPT_CMX=
++ OPT_TESTS=
++endif
++
++LIBS = $(C_SHARED) $(BYTE_LIBS) $(OPT_LIBS)
+
+ all: $(LIBS) tests
+
+ install: all
+- -mkdir $(DESTDIR)
+- cp $(LIBS) gmp.mli $(DESTDIR)
++ install -d $(DESTDIR)$(PKGDIR)
++ install -m 0644 -c $(BYTE_LIBS) $(OPT_LIBS) *.a gmp.mli $(DESTDIR)$(PKGDIR)
++ install -d $(STUBDIR)
++ install -m 0644 -c $(C_SHARED) $(STUBDIR)
+
+-tests: $(LIBS) $(TESTS)
++tests: $(LIBS) $(BYTE_TESTS) $(OPT_TESTS)
+ ./test_suite
+- ./test_suite.opt
++ if [ -e ./test_suite.opt ]; then ./test_suite.opt; fi
+
+ %.i: %.c
+ $(CC) $(CFLAGS) -E $*.c > $*.i
+@@ -63,15 +85,9 @@
+
+ $(CMODULES_O): conversions.c config.h
+
+-libmlgmp.a: $(CMODULES_O)
+- $(AR) -rc $@ $+
+- $(RANLIB) $@
+-
+-gmp.cma: gmp.cmo libmlgmp.a
+- $(OCAMLC) $(OCAMLFLAGS) -a gmp.cmo -cclib -lmlgmp $(LIBFLAGS) -o $@
+-
+-gmp.a gmp.cmxa: gmp.cmx libmlgmp.a
+- $(OCAMLOPT) $(OCAMLFLAGS) -a gmp.cmx -cclib -lmlgmp $(LIBFLAGS) -o $@
++dllgmpstub.so libgmpstub.a gmp.cma gmp.cmxa: gmp.cmo $(OPT_CMX) $(CMODULES_O)
++ $(OCAMLMKLIB) $(OCAMLFLAGS) -o gmp -oc gmpstub gmp.cmo \
++ $(OPT_CMX) $(CMODULES_O) -lgmp
+
+ pretty_gmp.cmo: pretty_gmp.cmi gmp.cmo
+
+@@ -81,27 +97,27 @@
+ essai: gmp.cma essai.cmo
+ $(OCAMLC) -custom $+ -o $@
+
+-essai.opt: gmp.cmxa essai.cmx
++essai.opt: gmp.cmxa essai.cmx
+ $(OCAMLOPT) $+ -o $@
+
+-test_creal: gmp.cma creal.cmo test_creal.cmo
+- $(OCAMLC) -custom $+ -o $@
++test_creal: gmp.cma creal.cmo test_creal.cmo
++ $(OCAMLC) $+ -o $@
+
+ test_creal.opt: gmp.cmxa creal.cmx test_creal.cmx
+ $(OCAMLOPT) $+ -o $@
+
+-test_suite: gmp.cma test_suite.cmo
+- $(OCAMLC) -custom $+ -o $@
++test_suite: gmp.cma test_suite.cmo
++ $(OCAMLC) -custom $+ -o $@ -cclib -L.
+
+ test_suite.opt: gmp.cmxa test_suite.cmx
+- $(OCAMLOPT) $+ -o $@
++ $(OCAMLOPT) $+ -o $@ -cclib -L.
+
+ clean:
+- rm -f *.o *.cm* $(PROGRAMS) *.a
++ -rm -f *.o *.cm* $(PROGRAMS) *.a *.so
+
+ depend:
+ ocamldep *.ml *.mli > depend
+
+ .PHONY: clean
+
+-include depend
++-include depend
--- mlgmp-20021123.orig/debian/patches/15_bugfixes.dpatch
+++ mlgmp-20021123/debian/patches/15_bugfixes.dpatch
@@ -0,0 +1,104 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 15_bugfixes.dpatch by Mike Furr <mfurr@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Various bugfixes in C bindings
+
+@DPATCH@
+diff -urNad --exclude=CVS --exclude=.svn ./gmp.ml /tmp/dpep-work.FYBj8e/mlgmp-20021123/gmp.ml
+--- ./gmp.ml 2002-11-23 08:13:53.000000000 -0500
++++ /tmp/dpep-work.FYBj8e/mlgmp-20021123/gmp.ml 2005-09-03 15:18:53.505890041 -0400
+@@ -66,7 +66,7 @@
+ external from_float: dest: t->float->unit = "_mlgmp_z2_from_float";;
+
+ external create: unit->t = "_mlgmp_z_create";;
+- external copy: dest: t-> from: t-> unit = "_mlgmp_z_copy";;
++ external copy: dest: t-> from: t-> unit = "_mlgmp_z2_copy";;
+ external add: dest: t-> t->t->unit = "_mlgmp_z2_add";;
+ external sub: dest: t-> t->t->unit = "_mlgmp_z2_sub";;
+ external mul: dest: t-> t->t->unit = "_mlgmp_z2_mul";;
+@@ -85,6 +85,7 @@
+
+ module Z = struct
+ type t = Z2.t;;
++ external copy: t->t = "_mlgmp_z_copy";;
+ external of_int: int->t = "_mlgmp_z_from_int";;
+ external from_int: int->t = "_mlgmp_z_from_int";;
+ external from_string_base: base: int->string->t="_mlgmp_z_from_string_base";;
+diff -urNad --exclude=CVS --exclude=.svn ./gmp.mli /tmp/dpep-work.FYBj8e/mlgmp-20021123/gmp.mli
+--- ./gmp.mli 2002-11-23 08:13:54.000000000 -0500
++++ /tmp/dpep-work.FYBj8e/mlgmp-20021123/gmp.mli 2005-09-03 15:18:53.505890041 -0400
+@@ -14,7 +14,7 @@
+ = "_mlgmp_z2_from_string_base"
+ external from_float : dest:t -> float -> unit = "_mlgmp_z2_from_float"
+ external create : unit -> t = "_mlgmp_z_create"
+- external copy : dest:t -> from:t -> unit = "_mlgmp_z_copy"
++ external copy : dest:t -> from:t -> unit = "_mlgmp_z2_copy"
+ external add : dest:t -> t -> t -> unit = "_mlgmp_z2_add"
+ external sub : dest:t -> t -> t -> unit = "_mlgmp_z2_sub"
+ external mul : dest:t -> t -> t -> unit = "_mlgmp_z2_mul"
+@@ -31,6 +31,7 @@
+ module Z :
+ sig
+ type t = Z2.t
++ external copy : t -> t = "_mlgmp_z_copy"
+ external from_int : int -> t = "_mlgmp_z_from_int"
+ external of_int : int -> t = "_mlgmp_z_from_int"
+ external from_string_base : base:int -> string -> t
+diff -urNad --exclude=CVS --exclude=.svn ./mlgmp_z.c /tmp/dpep-work.FYBj8e/mlgmp-20021123/mlgmp_z.c
+--- ./mlgmp_z.c 2002-11-23 12:47:20.000000000 -0500
++++ /tmp/dpep-work.FYBj8e/mlgmp-20021123/mlgmp_z.c 2005-09-03 15:18:53.506889909 -0400
+@@ -58,6 +58,13 @@
+ CAMLreturn(r);
+ }
+
++value _mlgmp_z2_copy(value dest, value from)
++{
++ CAMLparam2(dest, from);
++ mpz_set(*mpz_val(dest), *mpz_val(from));
++ CAMLreturn(Val_unit);
++}
++
+ value _mlgmp_z_from_int(value ml_val)
+ {
+ CAMLparam1(ml_val);
+@@ -88,21 +95,21 @@
+ value _mlgmp_z2_from_int(value r, value ml_val)
+ {
+ CAMLparam2(r, ml_val);
+- mpz_init_set_si(*mpz_val(r), Int_val(ml_val));
++ mpz_set_si(*mpz_val(r), Int_val(ml_val));
+ CAMLreturn(Val_unit);
+ }
+
+ value _mlgmp_z2_from_string_base(value r, value base, value ml_val)
+ {
+ CAMLparam3(r, base, ml_val);
+- mpz_init_set_str(*mpz_val(r), String_val(ml_val), Int_val(base));
++ mpz_set_str(*mpz_val(r), String_val(ml_val), Int_val(base));
+ CAMLreturn(Val_unit);
+ }
+
+ value _mlgmp_z2_from_float(value r, value ml_val)
+ {
+ CAMLparam2(r, ml_val);
+- mpz_init_set_d(*mpz_val(r), Double_val(ml_val));
++ mpz_set_d(*mpz_val(r), Double_val(ml_val));
+ CAMLreturn(Val_unit);
+ }
+
+diff -urNad --exclude=CVS --exclude=.svn ./test_suite.ml /tmp/dpep-work.FYBj8e/mlgmp-20021123/test_suite.ml
+--- ./test_suite.ml 2002-11-21 07:26:37.000000000 -0500
++++ /tmp/dpep-work.FYBj8e/mlgmp-20021123/test_suite.ml 2005-09-03 15:18:53.506889909 -0400
+@@ -1,5 +1,11 @@
+ open Gmp;;
+
++assert ((Z.from_int 578) = (let r = Z2.create () in Z2.copy r (Z.from_int 578); r));
++assert ((Z.from_int 578) = (let r = Z2.create () in Z2.from_int r 578; r));
++assert ((Z.from_int 578) = (let r = Z2.create () in Z2.from_string_base r 10 "578"; r));
++(*to be used only with corrected sources *)
++(*assert ((Z.from_int 578) = (Z.copy (Z.from_int 578)));*)
++assert ((Z.from_int 578) = (let r = Z2.create () in Z2.from_float r 578.; r));
+ assert ((Z.from_int 578) = (Z.from_string_base ~base: 10 "578"));
+ assert ((Z.from_int 578) = (Z.from_float 578.));
+ assert ((Z.to_string_base ~base: 10 (Z.from_int 578)) = "578");
--- mlgmp-20021123.orig/debian/patches/10_config.dpatch
+++ mlgmp-20021123/debian/patches/10_config.dpatch
@@ -0,0 +1,31 @@
+#! /bin/sh -e
+## 10_Makefile.dpatch by Mike Furr <mfurr@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Disabling MPFR
+
+[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
+patch_opts="${patch_opts:--f --no-backup-if-mismatch ${2:+-d $2}}"
+
+if [ $# -lt 1 ]; then
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1
+fi
+case "$1" in
+ -patch) patch $patch_opts -p1 < $0;;
+ -unpatch) patch $patch_opts -p1 -R < $0;;
+ *)
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1;;
+esac
+
+exit 0
+@DPATCH@
+--- mlgmp-20021123.orig/config.h
++++ mlgmp-20021123/config.h
+@@ -1,5 +1,5 @@
+ #define SERIALIZE
+-#define USE_MPFR
++/*#define USE_MPFR*/
+ #define NDEBUG
+ #undef TRACE