rpms/ocaml-mlgmpidl/F-10 import.log, NONE, 1.1 mlgmpidl-1.0-Makefile.patch, NONE, 1.1 mlgmpidl-META, NONE, 1.1 mlgmpidl_test.ml, NONE, 1.1 mlgmpidl_test_result, NONE, 1.1 ocaml-mlgmpidl.spec, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2

Alan Dunn amdunn at fedoraproject.org
Sat Mar 28 15:27:48 UTC 2009


Author: amdunn

Update of /cvs/pkgs/rpms/ocaml-mlgmpidl/F-10
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv8770/F-10

Modified Files:
	.cvsignore sources 
Added Files:
	import.log mlgmpidl-1.0-Makefile.patch mlgmpidl-META 
	mlgmpidl_test.ml mlgmpidl_test_result ocaml-mlgmpidl.spec 
Log Message:
Initial Fedora RPM version.



--- NEW FILE import.log ---
ocaml-mlgmpidl-1_0-1_fc10:F-10:ocaml-mlgmpidl-1.0-1.fc10.src.rpm:1238253748

mlgmpidl-1.0-Makefile.patch:

--- NEW FILE mlgmpidl-1.0-Makefile.patch ---
--- Makefile	2007-07-11 12:16:07.000000000 -0400
+++ Makefile	2009-03-25 07:47:41.000000000 -0400
@@ -5,12 +5,26 @@
 #---------------------------------------
 
 SRCDIR = $(shell pwd)
-#
-# Installation directory prefix
-# MLGMPIDL_PREFIX =
-#
 PREFIX = $(MLGMPIDL_PREFIX)
 
+# Location of includes
+GMP_INCLUDEDIR = $(GMP_PREFIX)/include
+MPFR_INCLUDEDIR = $(MPFR_PREFIX)/include
+
+# Location of C libraries
+GMP_LIBDIR = $(GMP_PREFIX)/lib
+MPFR_LIBDIR = $(MPFR_PREFIX)/lib
+
+# Location of OCaml libraries
+CAML_LIBDIR = $(CAML_PREFIX)/lib/ocaml
+CAMLIDL_LIBDIR = $(CAMLIDL_PREFIX)/lib/ocaml
+MLGMPIDL_LIBDIR = $(MLGMPIDL_PREFIX)/lib
+
+# Eventual installation destination directories
+INSTALL_INCLUDEDIR = $(PREFIX)/include
+INSTALL_OCAML_LIBDIR = $(PREFIX)/lib/ocaml/mlgmpidl
+INSTALL_BINDIR = $(PREFIX)/bin
+
 #---------------------------------------
 # CAML part
 #---------------------------------------
@@ -18,15 +32,15 @@
 OCAMLINC =
 ifeq ($(HAS_MPFR),0)
 OCAMLLDFLAGS = \
--ccopt "-L$(MLGMPIDL_PREFIX)/lib" -cclib "-lgmp_caml" \
--ccopt "-L$(GMP_PREFIX)/lib" -cclib "-lgmp" \
--ccopt "-L$(CAMLIDL_PREFIX)/lib/ocaml" -cclib "-lcamlidl"
+-ccopt "-L$(MLGMPIDL_LIBDIR)" -cclib "-lgmp_caml" \
+-ccopt "-L$(GMP_LIBDIR)" -cclib "-lgmp" \
+-ccopt "-L$(CAMLIDL_LIBDIR)" -cclib "-lcamlidl"
 else
 OCAMLLDFLAGS = \
--ccopt "-L$(MLGMPIDL_PREFIX)/lib" -cclib "-lgmp_caml" \
--ccopt "-L$(MPFR_PREFIX)/lib" -cclib "-lmpfr" \
--ccopt "-L$(GMP_PREFIX)/lib" -cclib "-lgmp" \
--ccopt "-L$(CAMLIDL_PREFIX)/lib/ocaml" -cclib "-lcamlidl"
+-ccopt "-L$(MLGMPIDL_LIBDIR)" -cclib "-lgmp_caml" \
+-ccopt "-L$(MPFR_LIBDIR)" -cclib "-lmpfr" \
+-ccopt "-L$(GMP_LIBDIR)" -cclib "-lgmp" \
+-ccopt "-L$(CAMLIDL_LIBDIR)" -cclib "-lcamlidl"
 endif
 
 #---------------------------------------
@@ -36,14 +50,14 @@
 ifeq ($(HAS_MPFR),0)
 ICFLAGS = \
 -DHAS_MPFR=$(HAS_MPFR) \
--I$(GMP_PREFIX)/include \
--I$(CAML_PREFIX)/lib/ocaml -I$(CAMLIDL_PREFIX)/lib/ocaml
+-I$(GMP_INCLUDEDIR) \
+-I$(CAML_LIBDIR) -I$(CAMLIDL_LIBDIR)
 else
 ICFLAGS = \
 -DHAS_MPFR=$(HAS_MPFR) \
--I$(GMP_PREFIX)/include \
--I$(MPFR_PREFIX)/include \
--I$(CAML_PREFIX)/lib/ocaml -I$(CAMLIDL_PREFIX)/lib/ocaml
+-I$(GMP_INCLUDEDIR) \
+-I$(MPFR_INCLUDEDIR) \
+-I$(CAML_LIBDIR) -I$(CAMLIDL_LIBDIR)
 endif
 
 #---------------------------------------
@@ -88,20 +102,20 @@
 	-ccopt "-L." gmp.cma bigarray.cma
 
 install:
-	mkdir -p $(PREFIX)/include $(PREFIX)/lib $(PREFIX)/bin
-	cp -f $(MLLIB_TOINSTALL) $(MLLIB_TOINSTALLx) $(PREFIX)/lib
-	cp -f $(CCINC_TOINSTALL) $(PREFIX)/include
-	for i in $(CCLIB_TOINSTALL); do if test -f $$i; then cp -f $$i $(PREFIX)/lib; fi; done
-	for i in $(CCBIN_TOINSTALL); do if test -f $$i; then cp -f $$i $(PREFIX)/bin; fi; done
+	mkdir -p $(INSTALL_INCLUDEDIR) $(INSTALL_OCAML_LIBDIR) $(INSTALL_BINDIR)
+	cp -f $(MLLIB_TOINSTALL) $(MLLIB_TOINSTALLx) $(INSTALL_OCAML_LIBDIR)
+	cp -f $(CCINC_TOINSTALL) $(INSTALL_INCLUDEDIR)
+	for i in $(CCLIB_TOINSTALL); do if test -f $$i; then cp -f $$i $(INSTALL_OCAML_LIBDIR); fi; done
+	for i in $(CCBIN_TOINSTALL); do if test -f $$i; then cp -f $$i $(INSTALL_BINDIR); fi; done
 
 #---------------------------------------
 # Misc rules
 #---------------------------------------
 
 distclean: clean
-	(cd $(PREFIX)/include; /bin/rm -f $(CCINC_TOINSTALL))
-	(cd $(PREFIX)/lib; /bin/rm -f $(MLLIB_TOINSTALL) $(MLLIB_TOINSTALLx) $(CCLIB_TOINSTALL))
-	(cd $(PREFIX)/bin; /bin/rm -f $(CCBIN_TOINSTALL))
+	(cd $(INSTALL_INCLUDEDIR); /bin/rm -f $(CCINC_TOINSTALL))
+	(cd $(INSTALL_OCAML_LIBDDIR); /bin/rm -f $(MLLIB_TOINSTALL) $(MLLIB_TOINSTALLx))
+	(cd $(INSTALL_BINDIR); /bin/rm -f $(CCBIN_TOINSTALL))
 
 clean:
 	/bin/rm -fr tmp html


--- NEW FILE mlgmpidl-META ---
version = "1.05"
description = "OCaml interface to GNU GMP and MPFR"
requires = "bigarray"
archive(byte) = "gmp.cma"
archive(native) = "gmp.cmxa"
linkopts = "-cclib -lgmp_caml -dllpath LIBDIR -dllib libgmp.so"

--- NEW FILE mlgmpidl_test.ml ---
open Format;;

(* Minor test from each of the GMP, MPFR modules*)

(* Mpz - integer functions *)

let a = Mpz.init_set_si 2 in
let b = Mpz.init_set_si 3 in
let c = Mpz.init () in
Mpz.add c a b;
Mpz.print std_formatter c;
print_newline ();;

(* Mpq - rational functions *)

let a = Mpq.init () in
let b = Mpq.init () in
let c = Mpq.init () in
let num = Mpz.init () in
Mpq.set_si a 2 3;
Mpq.set_si b 3 4;
Mpq.mul c a b;
Mpq.print std_formatter c; (* We get 1/2 -> appears to "auto-canonicalize"... even internally? *)
print_newline ();
Mpq.get_num num c;
Mpz.print std_formatter num; (* And we get 1 here too... *)
print_newline ();;

(* Mpf - multiprecision floating-point *)

let a = Mpf.init () in
let b = Mpf.init () in
let c = Mpf.init () in
Mpf.set_si a 2;
Mpf.set_si b 3;
Mpf.div c a b;
printf "%.3f" (Mpf.get_d c);
print_newline();;

(* Mpfr - multiprecision floating-point w/rounding *)
(* MPFR library, not GMP library *)

(* Create binary string from floating point number less than 1 *)
(* Use this to test the rounding of Mpfr - the printing function
    they have wasn't working as expected *)
let mpfr_to_bin_str x =
  let (_,one) = Mpfr.init_set_si 1 Mpfr.Near in
  let rec mpfr_to_bin_str_helper x s =
    if Mpfr.cmp_si x 0 = 0 then
      s
    else
      let sp = if Mpfr.cmp_si x 1 >= 0 then
	(let _ = Mpfr.sub x x one Mpfr.Near in "1")
      else
        "0"
      in
      let _ = Mpfr.mul_2si x x 1 Mpfr.Near in
      mpfr_to_bin_str_helper x (s ^ sp) in
  mpfr_to_bin_str_helper x "";;

let a = Mpfr.init() in
let b = Mpfr.init() in
let c = Mpfr.init2 3 in
let _ = Mpfr.set_si a 6875 Mpfr.Near in (* 6875/10000 = 0.1011 in base 2 *)
let _ = Mpfr.set_si b 10000 Mpfr.Near in
let _ = Mpfr.div c a b Mpfr.Near in (* Should round to 0.1100 in precision three *)
print_string (mpfr_to_bin_str c);
print_newline();
let _ = Mpfr.div c a b Mpfr.Down in (* Should round to 0.1010 in precision three *)
print_string (mpfr_to_bin_str c);;


--- NEW FILE mlgmpidl_test_result ---
5
1/2
1
0.667
011
0101

--- NEW FILE ocaml-mlgmpidl.spec ---
%define opt %(test -x %{_bindir}/ocamlopt && echo 1 || echo 0)
%define _use_internal_dependency_generator 0
%define __find_requires /usr/lib/rpm/ocaml-find-requires.sh
%define __find_provides /usr/lib/rpm/ocaml-find-provides.sh

# From previous experience it seemed that all of the following
# were necessary to prevent stripping of bytecode executables
%define __os_install_post /usr/lib/rpm/brp-compress %{nil}
%define _enable_debug_package 0
%define debug_package %{nil}

Name:           ocaml-mlgmpidl
Version:        1.0
Release:        1%{?dist}
Summary:        OCaml interface to GMP and MPFR libraries
Group:          Development/Libraries
License:        LGPLv2
URL:            http://www.inrialpes.fr/pop-art/people/bjeannet/mlxxxidl-forge/mlgmpidl/index.html
Source0:        http://gforge.inria.fr/frs/download.php/2460/mlgmpidl.tgz
Source1:        mlgmpidl_test.ml
Source2:        mlgmpidl_test_result
Source3:        mlgmpidl-META
Patch0:         mlgmpidl-1.0-Makefile.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires:  ocaml >= 3.07, ocaml-ocamldoc, ocaml-camlidl-devel, gmp-devel, mpfr-devel, prelink
# BuildRequires for documentation build
BuildRequires:  texlive-latex, texlive-texmf, ghostscript

%description
MLGMPIDL is an OCaml interface to the GMP and MPFR rational and real
number math libraries. Although there is another such interface, this
one is different in that it provides a more imperative (rather than
functional) interface to conserve memory and that this one uses
CAMLIDL to take care of the C/OCaml interface in a convenient and
modular way.

%package        devel
Summary:        Development files for %{name}
Group:          Development/Libraries
Requires:       %{name} = %{version}-%{release}


%description    devel
The %{name}-devel package contains libraries and signature files for
developing applications that use %{name}.

%package        doc
Summary:        Documentation files for %{name}
Group:          Documentation

%description    doc
The %{name}-doc package contains documentation for using %{name}.

%prep
%setup -q -n mlgmpidl
cp %{SOURCE1} %{SOURCE2} .
cp %{SOURCE3} ./META

# Patch makefile to take custom locations for libraries and installing
%patch0

%build
mv Makefile.config.model Makefile.config

%define ocaml_lib_dir %{_libdir}/ocaml
%define my_ocaml_lib_dir %{ocaml_lib_dir}/mlgmpidl

make PREFIX=%{_prefix} GMP_LIBDIR=%{_libdir} MPFR_LIBDIR=%{_libdir} \
     CAML_LIBDIR=%{ocaml_lib_dir} CAMLIDL_LIBDIR=%{ocaml_lib_dir} \
     MLGMPIDL_LIBDIR=%{_libdir} all gmptop
make mlgmpidl.dvi
make html
dvipdf mlgmpidl.dvi

# Put the C library location in the META file
sed -e 's|LIBDIR|%{_libdir}|' META > META.tmp && mv META.tmp META

%check
ocamlc -ccopt -L. -custom -dllib %{_libdir}/libgmp.so gmp.cma bigarray.cma mlgmpidl_test.ml
./a.out > mlgmpidl_test_myresult
diff mlgmpidl_test_myresult mlgmpidl_test_result

%install
rm -rf %{buildroot}

make INSTALL_INCLUDEDIR=%{buildroot}/%{_includedir} \
     INSTALL_OCAML_LIBDIR=%{buildroot}/%{my_ocaml_lib_dir} \
     INSTALL_BINDIR=%{buildroot}/%{_bindir} install

cp META %{buildroot}/%{my_ocaml_lib_dir}

# Install Documentation
%define doc_dir %{_docdir}/%{name}
mkdir -p %{buildroot}%{doc_dir}
cp -p *.pdf %{buildroot}%{doc_dir}
cp -pr html %{buildroot}%{doc_dir}

# Make sure that prelink does not foul up our bytecode executables by
# stripping them with a cron job. This is done in install to ensure
# that exactly the files that are eventually installed are in the
# list, not all of the files in the bin directory of the build

%define prelinkfilename %{name}-prelink.conf
cd %{buildroot}%{_bindir}
for f in *; do
file $f | grep "not stripped" | sed -e 's/:.*//' -e 's!^!-b %{_bindir}/!' >> %{prelinkfilename}
done

%define prelinkconfdir %{_sysconfdir}/prelink.conf.d
mkdir -p %{buildroot}%{prelinkconfdir}
mv %{prelinkfilename} %{buildroot}%{prelinkconfdir}

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root,-)
%{my_ocaml_lib_dir}
%if %opt
%exclude %{my_ocaml_lib_dir}/*.cmx*
%endif
%exclude %{my_ocaml_lib_dir}/*.idl
%exclude %{my_ocaml_lib_dir}/*.mli
%exclude %{my_ocaml_lib_dir}/*.a
%{_bindir}/gmptop
%doc COPYING README
%config %{prelinkconfdir}/%{prelinkfilename}

%files devel
%defattr(-,root,root,-)
%{_includedir}/*
%if %opt
%{my_ocaml_lib_dir}/*.cmx*
%endif
%{my_ocaml_lib_dir}/*.idl
%{my_ocaml_lib_dir}/*.mli
%{my_ocaml_lib_dir}/*.a

%files doc
%defattr(-,root,root,-)
%{_docdir}/%{name}

%changelog
* Sat Mar 28 2009 Alan Dunn <amdunn at gmail.com> 1.0-1
- Initial Fedora RPM version.


Index: .cvsignore
===================================================================
RCS file: /cvs/pkgs/rpms/ocaml-mlgmpidl/F-10/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore	27 Mar 2009 20:22:16 -0000	1.1
+++ .cvsignore	28 Mar 2009 15:27:17 -0000	1.2
@@ -0,0 +1 @@
+mlgmpidl.tgz


Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/ocaml-mlgmpidl/F-10/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources	27 Mar 2009 20:22:16 -0000	1.1
+++ sources	28 Mar 2009 15:27:17 -0000	1.2
@@ -0,0 +1 @@
+63ec244511e58bd1cbf5513dc7aaad8e  mlgmpidl.tgz




More information about the fedora-extras-commits mailing list