Compare commits
36 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
56f0b30345 | ||
|
13d664ec46 | ||
|
3a995b9be6 | ||
|
ef715e7ad3 | ||
|
9dc45b49e4 | ||
|
6313bc2939 | ||
|
d9581084f4 | ||
|
83410ac2cb | ||
|
c49dddefb1 | ||
|
cb322b569e | ||
|
ca8a82d0b5 | ||
|
c728fe35f0 | ||
|
6cfeea9be4 | ||
|
d937709009 | ||
|
2895eee114 | ||
|
823def308a | ||
|
49914c20d5 | ||
|
ba98b87ae2 | ||
|
390a6058cc | ||
|
073f643246 | ||
|
73a6dc8ca0 | ||
|
1b533114f6 | ||
|
e413852354 | ||
|
5f69608aae | ||
|
d4d9fa565a | ||
|
89f77a207e | ||
|
89fae6f006 | ||
|
3ad4e6853f | ||
|
e4cb14a3ab | ||
|
217a2f865f | ||
|
76ac5c961c | ||
|
2eed69c543 | ||
|
5158c72e11 | ||
|
a4b8f7c376 | ||
|
4135bf0b9f | ||
|
1601506283 |
153
ocaml-tplib-mlgmpidl.patch
Normal file
153
ocaml-tplib-mlgmpidl.patch
Normal file
@ -0,0 +1,153 @@
|
|||||||
|
--- src/numeric_plugins/mlgmp_plugin.ml.orig 2013-02-14 04:08:25.000000000 -0700
|
||||||
|
+++ src/numeric_plugins/mlgmp_plugin.ml 2017-12-03 14:00:36.471566987 -0700
|
||||||
|
@@ -19,48 +19,69 @@
|
||||||
|
|
||||||
|
*)
|
||||||
|
|
||||||
|
-open Gmp
|
||||||
|
-
|
||||||
|
-let bits_of_string s =
|
||||||
|
- let s' = String.sub s 2 ((String.length s)-2) in (* remove prefix "0b" *)
|
||||||
|
- Z.from_string_base ~base:2 s'
|
||||||
|
+let randobj = Gmp_random.init_default ();
|
||||||
|
|
||||||
|
module Mlgmp_int =
|
||||||
|
struct
|
||||||
|
- type t = Z.t
|
||||||
|
+ type t = Mpz.t
|
||||||
|
|
||||||
|
- let zero = Z.of_int 0
|
||||||
|
- let max x y = if Z.cmp x y >= 0 then x else y
|
||||||
|
- let min x y = if Z.cmp x y >= 0 then y else x
|
||||||
|
- let add = Z.add
|
||||||
|
- let neg = Z.neg
|
||||||
|
- let mul = Z.mul
|
||||||
|
- let div = Z.cdiv_q
|
||||||
|
- let pow = Z.pow_ui
|
||||||
|
- let compare = Z.cmp
|
||||||
|
+ let zero = Mpz.of_int 0
|
||||||
|
+ let max x y = if Mpz.cmp x y >= 0 then x else y
|
||||||
|
+ let min x y = if Mpz.cmp x y >= 0 then y else x
|
||||||
|
+ let add x y =
|
||||||
|
+ let res = Mpz.init () in
|
||||||
|
+ Mpz.add res x y;
|
||||||
|
+ res
|
||||||
|
+ let neg x =
|
||||||
|
+ let res = Mpz.init () in
|
||||||
|
+ Mpz.neg res x;
|
||||||
|
+ res
|
||||||
|
+ let mul x y =
|
||||||
|
+ let res = Mpz.init () in
|
||||||
|
+ Mpz.mul res x y;
|
||||||
|
+ res
|
||||||
|
+ let div x y =
|
||||||
|
+ let res = Mpz.init () in
|
||||||
|
+ Mpz.cdiv_q res x y;
|
||||||
|
+ res
|
||||||
|
+ let pow x y =
|
||||||
|
+ let res = Mpz.init () in
|
||||||
|
+ Mpz.pow_ui res x y;
|
||||||
|
+ res
|
||||||
|
+ let compare = Mpz.cmp
|
||||||
|
let random n =
|
||||||
|
- bits_of_string (Random_generator.to_string n)
|
||||||
|
- let of_int = Z.from_int
|
||||||
|
- let of_string x =
|
||||||
|
- try
|
||||||
|
- Z.from_string_base ~base:10 x
|
||||||
|
- with Invalid_argument _ ->
|
||||||
|
- raise (Failure ("Mpzf.of_string: "^x^" is not well-formatted"))
|
||||||
|
- let to_string = Z.to_string_base ~base:10
|
||||||
|
+ let res = Mpz.init () in
|
||||||
|
+ Gmp_random.Mpz.urandomb res randobj n;
|
||||||
|
+ res
|
||||||
|
+ let of_int = Mpz.of_int
|
||||||
|
+ let of_string = Mpz.of_string
|
||||||
|
+ let to_string = Mpz.get_str ~base:10
|
||||||
|
end
|
||||||
|
|
||||||
|
module Mlgmp_rat =
|
||||||
|
struct
|
||||||
|
- type t = Q.t
|
||||||
|
+ type t = Mpq.t
|
||||||
|
|
||||||
|
- let zero = Q.from_int 0
|
||||||
|
- let one = Q.from_int 1
|
||||||
|
- let max x y = if Q.cmp x y >= 0 then x else y
|
||||||
|
- let min x y = if Q.cmp x y >= 0 then y else x
|
||||||
|
- let add = Q.add
|
||||||
|
- let neg = Q.neg
|
||||||
|
- let mul = Q.mul
|
||||||
|
- let div = Q.div
|
||||||
|
+ let zero = Mpq.of_int 0
|
||||||
|
+ let one = Mpq.of_int 1
|
||||||
|
+ let max x y = if Mpq.cmp x y >= 0 then x else y
|
||||||
|
+ let min x y = if Mpq.cmp x y >= 0 then y else x
|
||||||
|
+ let add x y =
|
||||||
|
+ let res = Mpq.init () in
|
||||||
|
+ Mpq.add res x y;
|
||||||
|
+ res
|
||||||
|
+ let neg x =
|
||||||
|
+ let res = Mpq.init () in
|
||||||
|
+ Mpq.neg res x;
|
||||||
|
+ res
|
||||||
|
+ let mul x y =
|
||||||
|
+ let res = Mpq.init () in
|
||||||
|
+ Mpq.mul res x y;
|
||||||
|
+ res
|
||||||
|
+ let div x y =
|
||||||
|
+ let res = Mpq.init () in
|
||||||
|
+ Mpq.div res x y;
|
||||||
|
+ res
|
||||||
|
|
||||||
|
let pow x n =
|
||||||
|
let rec pow_aux x n =
|
||||||
|
@@ -68,31 +89,29 @@ struct
|
||||||
|
if n = 0 then one
|
||||||
|
else
|
||||||
|
let y = pow_aux x (n/2) in
|
||||||
|
- let z = mul y y in
|
||||||
|
- if n mod 2 = 0 then
|
||||||
|
- z
|
||||||
|
- else
|
||||||
|
- mul x z
|
||||||
|
+ let z = Mpq.init () in
|
||||||
|
+ Mpq.mul z y y;
|
||||||
|
+ if n mod 2 != 0 then
|
||||||
|
+ Mpq.mul z x z;
|
||||||
|
+ z
|
||||||
|
in
|
||||||
|
if n >= 0 then
|
||||||
|
pow_aux x n
|
||||||
|
else
|
||||||
|
- pow_aux (Q.inv x) (-n)
|
||||||
|
+ pow_aux (Mpq.inv x x; x) (-n)
|
||||||
|
|
||||||
|
- let compare = Q.cmp
|
||||||
|
+ let compare = Mpq.cmp
|
||||||
|
let random n =
|
||||||
|
- let num = bits_of_string (Random_generator.to_string n) in
|
||||||
|
- let den = bits_of_string (Random_generator.to_string n) in
|
||||||
|
- Q.div (Q.from_z num) (Q.add Q.one (Q.from_z den))
|
||||||
|
- let of_int = Q.from_int
|
||||||
|
- let of_string x =
|
||||||
|
- try
|
||||||
|
- let i = String.index x '/' in
|
||||||
|
- let num = Z.from_string_base ~base:10 (String.sub x 0 i) in
|
||||||
|
- let den = Z.from_string_base ~base:10 (String.sub x (i+1) ((String.length x)-(i+1))) in
|
||||||
|
- Q.div (Q.from_z num) (Q.from_z den)
|
||||||
|
- with Not_found -> Q.from_z (Z.from_string_base ~base:10 x)
|
||||||
|
- let to_string = Q.to_string
|
||||||
|
+ let num = Mpz.init () in
|
||||||
|
+ let den = Mpz.init () in
|
||||||
|
+ Gmp_random.Mpz.urandomb num randobj n;
|
||||||
|
+ Gmp_random.Mpz.urandomb den randobj n;
|
||||||
|
+ let res = Mpq.init () in
|
||||||
|
+ Mpq.div res (Mpq.init_set_z num) (Mpq.add res one (Mpq.init_set_z den); res);
|
||||||
|
+ res
|
||||||
|
+ let of_int = Mpq.of_int
|
||||||
|
+ let of_string = Mpq.of_string
|
||||||
|
+ let to_string = Mpq.to_string
|
||||||
|
end
|
||||||
|
|
||||||
|
let _ =
|
126
ocaml-tplib.spec
126
ocaml-tplib.spec
@ -1,8 +1,6 @@
|
|||||||
%global opt %(test -x %{_bindir}/ocamlopt && echo 1 || echo 0)
|
|
||||||
|
|
||||||
Name: ocaml-tplib
|
Name: ocaml-tplib
|
||||||
Version: 1.3
|
Version: 1.3
|
||||||
Release: 29%{?dist}
|
Release: 61%{?dist}
|
||||||
Summary: Tropical Polyhedra Library
|
Summary: Tropical Polyhedra Library
|
||||||
|
|
||||||
License: LGPLv2+
|
License: LGPLv2+
|
||||||
@ -20,16 +18,22 @@ Source6: compute_tropical_complex.1
|
|||||||
# Upstream patch to adapt to new ocamlbuild behavior. See
|
# Upstream patch to adapt to new ocamlbuild behavior. See
|
||||||
# https://github.com/ocaml/opam-repository/blob/master/packages/tplib/tplib.1.3/files/fix-makefile.diff
|
# https://github.com/ocaml/opam-repository/blob/master/packages/tplib/tplib.1.3/files/fix-makefile.diff
|
||||||
Patch0: %{name}-ocamlbuild.patch
|
Patch0: %{name}-ocamlbuild.patch
|
||||||
|
# Adapt to current versions of mlgmpidl
|
||||||
|
Patch1: %{name}-mlgmpidl.patch
|
||||||
|
|
||||||
|
BuildRequires: make
|
||||||
|
BuildRequires: mpfr-devel
|
||||||
BuildRequires: ocaml
|
BuildRequires: ocaml
|
||||||
BuildRequires: ocaml-ocamlbuild
|
BuildRequires: ocaml-ocamlbuild-devel
|
||||||
BuildRequires: ocaml-camlidl-devel
|
BuildRequires: ocaml-camlidl-devel
|
||||||
BuildRequires: ocaml-findlib-devel
|
BuildRequires: ocaml-findlib-devel
|
||||||
|
BuildRequires: ocaml-mlgmpidl-devel
|
||||||
|
BuildRequires: ocaml-num-devel
|
||||||
BuildRequires: ocaml-ocamldoc
|
BuildRequires: ocaml-ocamldoc
|
||||||
BuildRequires: ocaml-zarith-devel
|
BuildRequires: ocaml-zarith-devel
|
||||||
|
|
||||||
# This is an internal symbol that winds up in Requires, but not Provides
|
# This is an internal symbol that winds up in Requires, but not Provides
|
||||||
%global __requires_exclude ocaml\\\(Numeric_plugin\\\)
|
%global __requires_exclude ocamlx?\\\(Numeric_plugin\\\)
|
||||||
|
|
||||||
# Don't advertise the numeric plugins
|
# Don't advertise the numeric plugins
|
||||||
%global __provides_exclude plugin
|
%global __provides_exclude plugin
|
||||||
@ -59,10 +63,18 @@ Tools that use TPLib.
|
|||||||
%prep
|
%prep
|
||||||
%setup -q -n tplib-%{version}
|
%setup -q -n tplib-%{version}
|
||||||
%patch0
|
%patch0
|
||||||
|
%patch1
|
||||||
|
|
||||||
# Enable debuginfo generation
|
# Enable debuginfo generation
|
||||||
sed -i 's/@OCAMLBUILD@/& -cflag -g -lflag -g/' Makefile.in
|
sed -i 's/@OCAMLBUILD@/& -cflag -g -lflag -g/' Makefile.in
|
||||||
|
|
||||||
|
# Use the PIC version of libasmrun
|
||||||
|
sed -i 's/-lasmrun/&_pic/g' Makefile.in configure
|
||||||
|
sed -i 's/libasmrun\.a/libasmrun_pic.a/' Makefile.in
|
||||||
|
|
||||||
|
# Build the bindings with -fPIC
|
||||||
|
sed -i 's,CFLAGS += -I\$(OCAML_HOME_DIR),& -fPIC,' Makefile.in
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%configure
|
%configure
|
||||||
# Don't use %%{?_smp_mflags}; it leads to build failures
|
# Don't use %%{?_smp_mflags}; it leads to build failures
|
||||||
@ -80,9 +92,16 @@ cp -p %{SOURCE1} %{SOURCE2} %{SOURCE3} %{SOURCE4} %{SOURCE5} %{SOURCE6} \
|
|||||||
%{buildroot}%{_mandir}/man1
|
%{buildroot}%{_mandir}/man1
|
||||||
|
|
||||||
%check
|
%check
|
||||||
|
# Disable tests on ppc64le for now. With ocaml 4.09.0, errors like this occur
|
||||||
|
# when linking the tests:
|
||||||
|
# _build/src/bindings/libtplib_double.a(tplib_double_callback.obj.o): in function `camlStdlib__arg__assoc3_118':
|
||||||
|
# (.text+0xe9258): relocation truncated to fit: R_PPC64_TOC16_DS against `.toc'+101d0
|
||||||
|
# (.text+0xe9298): relocation truncated to fit: R_PPC64_TOC16_DS against `.toc'+ffe8
|
||||||
|
%ifnarch %{power64}
|
||||||
make test
|
make test
|
||||||
_build/tests/test_tplib_double
|
_build/tests/test_tplib_double
|
||||||
_build/tests/test_tplib_rational
|
_build/tests/test_tplib_rational
|
||||||
|
%endif
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%doc README
|
%doc README
|
||||||
@ -104,6 +123,103 @@ _build/tests/test_tplib_rational
|
|||||||
%doc %{_mandir}/man1/*
|
%doc %{_mandir}/man1/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Mar 15 2021 Richard W.M. Jones <rjones@redhat.com> - 1.3-61
|
||||||
|
- Bump and rebuild for updated ocaml-findlib.
|
||||||
|
|
||||||
|
* Wed Mar 3 2021 Jerry James <loganjerry@gmail.com> - 1.3-60
|
||||||
|
- Rebuild for ocaml-zarith 1.12
|
||||||
|
|
||||||
|
* Mon Mar 1 17:06:22 GMT 2021 Richard W.M. Jones <rjones@redhat.com> - 1.3-59
|
||||||
|
- OCaml 4.12.0 build
|
||||||
|
|
||||||
|
* Wed Feb 17 2021 Jerry James <loganjerry@gmail.com> - 1.3-58
|
||||||
|
- Bump and rebuild for updated ocaml Dynlink dependency
|
||||||
|
|
||||||
|
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.3-57
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||||
|
|
||||||
|
* Mon Nov 23 2020 Jerry James <loganjerry@gmail.com> - 1.3-56
|
||||||
|
- Rebuild for ocaml-zarith 1.11
|
||||||
|
|
||||||
|
* Fri Sep 25 2020 Jerry James <loganjerry@gmail.com> - 1.3-55
|
||||||
|
- Rebuild for ocaml-zarith 1.10
|
||||||
|
|
||||||
|
* Tue Sep 01 2020 Richard W.M. Jones <rjones@redhat.com> - 1.3-54
|
||||||
|
- OCaml 4.11.1 rebuild
|
||||||
|
|
||||||
|
* Fri Aug 21 2020 Richard W.M. Jones <rjones@redhat.com> - 1.3-53
|
||||||
|
- OCaml 4.11.0 rebuild
|
||||||
|
|
||||||
|
* Sat Aug 01 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.3-52
|
||||||
|
- Second attempt - Rebuilt for
|
||||||
|
https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||||
|
|
||||||
|
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.3-51
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||||
|
|
||||||
|
* Mon May 04 2020 Richard W.M. Jones <rjones@redhat.com> - 1.3-50
|
||||||
|
- OCaml 4.11.0+dev2-2020-04-22 rebuild
|
||||||
|
|
||||||
|
* Tue Apr 21 2020 Richard W.M. Jones <rjones@redhat.com> - 1.3-49
|
||||||
|
- OCaml 4.11.0 pre-release attempt 2
|
||||||
|
|
||||||
|
* Fri Apr 17 2020 Richard W.M. Jones <rjones@redhat.com> - 1.3-48
|
||||||
|
- OCaml 4.11.0 pre-release
|
||||||
|
|
||||||
|
* Mon Apr 13 2020 Jerry James <loganjerry@gmail.com> - 1.3-47
|
||||||
|
- Exclude ocamlx(Numeric_plugin) from Requires
|
||||||
|
|
||||||
|
* Thu Apr 02 2020 Richard W.M. Jones <rjones@redhat.com> - 1.3-46
|
||||||
|
- Update all OCaml dependencies for RPM 4.16.
|
||||||
|
|
||||||
|
* Wed Feb 26 2020 Richard W.M. Jones <rjones@redhat.com> - 1.3-45
|
||||||
|
- OCaml 4.10.0 final.
|
||||||
|
|
||||||
|
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.3-44
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||||
|
|
||||||
|
* Sun Jan 19 2020 Richard W.M. Jones <rjones@redhat.com> - 1.3-43
|
||||||
|
- OCaml 4.10.0+beta1 rebuild.
|
||||||
|
|
||||||
|
* Fri Dec 06 2019 Richard W.M. Jones <rjones@redhat.com> - 1.3-42
|
||||||
|
- OCaml 4.09.0 (final) rebuild.
|
||||||
|
|
||||||
|
* Fri Oct 11 2019 Jerry James <loganjerry@gmail.com> - 1.3-41
|
||||||
|
- Rebuild for mpfr 4
|
||||||
|
|
||||||
|
* Tue Sep 3 2019 Jerry James <loganjerry@gmail.com> - 1.3-40
|
||||||
|
- Rebuild for ocaml-zarith 1.9
|
||||||
|
|
||||||
|
* Fri Aug 16 2019 Richard W.M. Jones <rjones@redhat.com> - 1.3-39
|
||||||
|
- OCaml 4.08.1 (final) rebuild.
|
||||||
|
|
||||||
|
* Thu Aug 01 2019 Richard W.M. Jones <rjones@redhat.com> - 1.3-38
|
||||||
|
- OCaml 4.08.1 (rc2) rebuild.
|
||||||
|
|
||||||
|
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.3-37
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||||
|
|
||||||
|
* Thu Jul 4 2019 Jerry James <loganjerry@gmail.com> - 1.3-36
|
||||||
|
- Rebuild for ocaml 4.08.0
|
||||||
|
|
||||||
|
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.3-35
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||||
|
|
||||||
|
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.3-34
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
||||||
|
|
||||||
|
* Wed Jul 11 2018 Richard W.M. Jones <rjones@redhat.com> - 1.3-33
|
||||||
|
- OCaml 4.07.0 (final) rebuild.
|
||||||
|
|
||||||
|
* Wed Jun 20 2018 Richard W.M. Jones <rjones@redhat.com> - 1.3-32
|
||||||
|
- OCaml 4.07.0-rc1 rebuild.
|
||||||
|
|
||||||
|
* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.3-31
|
||||||
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
|
||||||
|
|
||||||
|
* Sat Nov 18 2017 Richard W.M. Jones <rjones@redhat.com> - 1.3-30
|
||||||
|
- OCaml 4.06.0 rebuild.
|
||||||
|
|
||||||
* Wed Aug 09 2017 Richard W.M. Jones <rjones@redhat.com> - 1.3-29
|
* Wed Aug 09 2017 Richard W.M. Jones <rjones@redhat.com> - 1.3-29
|
||||||
- OCaml 4.05.0 rebuild.
|
- OCaml 4.05.0 rebuild.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user