Sophie

Sophie

distrib > Mandriva > 2009.1 > i586 > by-pkgid > e0966e3bfb342e29ae0cddb974c2596c > files > 3

ocaml-sha-1.4-4mdv2009.1.src.rpm

# The upstream Makefile doesn't work "as is" on Mandriva.
# On Debian too, there the Makefile was replaced by a custom
# one with OCamlMakefile.  With this way the lib is not build
# in the same way than the upstream.
# A lot of OCaml users are under Debian.

Name:           ocaml-sha
Version:        1.4
Release:        %mkrel 4
Summary:        SHA Cryptographic Hash Functions for OCaml
License:        GPL2
Group:          Development/Other
URL:            http://tab.snarc.org/projects/ocaml_sha
Source0:        http://tab.snarc.org/download/ocaml/ocaml_sha-%{version}.tar.bz2
# I don't understand this patch, let's trust its author
Patch0:         ocaml-sha-fixed-makefile.patch
# the command line utilities use argv.(0) (cf mlcmd_renamed)
Patch1:         ocaml-sha-1.4_sumrenamed.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}
BuildRequires:  ocaml-findlib
# used to generate the documentation
BuildRequires:  ocamlmakefile
BuildRequires:  tetex-latex
BuildRequires:  gzip

%description
SHA is a cryptographic hash function.
This provide an interface for OCaml program to use
SHA1, SHA256 and SHA512 functions.

SHA1 implements the second implementation that produce
a 160 bit digest from its input.
SHA256 implements newer version that produce 256 bits digest.
SHA512 produces 512 bits digest.

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

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

%prep
%setup -q -n ocaml_sha-%{version}

# custom Makefile which uses OCamlMakefile
cat > Makefile.cust <<EOF
OCAMLMAKEFILE = /usr/share/ocamlmakefile/OCamlMakefile

SOURCES =             \
    sha.ml            \
    sha1.ml           \
    sha1.mli          \
    sha1_stubs.c      \
    sha256.ml         \
    sha256.mli        \
    sha256_stubs.c    \
    sha512.ml         \
    sha512.mli        \
    sha512_stubs.c

RESULT = sha

-include \$(OCAMLMAKEFILE)
EOF

# patch the upstream's Makefile
%patch0 -p1

%patch1 -p1

# Adding a META file
cat > META.in <<EOF
name="sha"
description="SHA cryptographic hash functions"
version="%{version}"
archive(byte)="sha.cma"
archive(native)="sha.cmxa"
EOF

# in case it would appear in a futur version
test -f META && (echo "Warning: there is a META file" > /dev/stderr)
test -f META || mv META.in META

%build
# upstream's Makefile
make       # the lib
make bins  # the progs

# custom's Makefile
make -f Makefile.cust doc
gzip --best doc/sha/latex/doc.ps

%install
rm -rf %{buildroot}
export DESTDIR=%{buildroot}
export OCAMLFIND_DESTDIR=%{buildroot}/%{_libdir}/ocaml
export DLLDIR=$OCAMLFIND_DESTDIR/stublibs
mkdir -p $OCAMLFIND_DESTDIR/stublibs
mkdir -p $OCAMLFIND_DESTDIR/sha
ocamlfind install sha META ./{*.mli,*.cmi,*.cma,*.a,*.cmxa,*.cmx}
install -d -m 0755 %{buildroot}%{_bindir}
for p in sha*sum ; do mv $p ml$p ; done
# mlcmd_renamed: rename shaXsum by mlshaXsum (conflict with coreutils)
install -m 0755 mlsha*sum %{buildroot}%{_bindir}/
install -m 0755 mlsha1sum %{buildroot}%{_bindir}/

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root)
%doc README
%dir %{_libdir}/ocaml/sha
%{_libdir}/ocaml/sha/META
%{_libdir}/ocaml/sha/*.cma
%{_libdir}/ocaml/sha/*.cmi
%{_bindir}/mlsha1sum
%{_bindir}/mlsha256sum
%{_bindir}/mlsha512sum

%files devel
%defattr(-,root,root)
%doc sha.test.ml
%doc doc/sha/html
%doc doc/sha/latex/*.{dvi,ps.gz,pdf}
%{_libdir}/ocaml/sha/*.a
%{_libdir}/ocaml/sha/*.cmxa
%{_libdir}/ocaml/sha/*.cmx
%{_libdir}/ocaml/sha/*.ml*



%changelog
* Wed Feb 25 2009 Florent Monnier <blue_prawn@mandriva.org> 1.4-4mdv2009.1
+ Revision: 344631
- incremented release number
- cmd tools fixed

* Fri Feb 13 2009 Florent Monnier <blue_prawn@mandriva.org> 1.4-3mdv2009.1
+ Revision: 340097
- unpackaged file(s)
- forgot to increm the rel number
- bug with sha(256|512)sum

* Fri Feb 13 2009 Florent Monnier <blue_prawn@mandriva.org> 1.4-2mdv2009.1
+ Revision: 340089
- updated release number
- conflict with coreutils

* Fri Feb 13 2009 Florent Monnier <blue_prawn@mandriva.org> 1.4-1mdv2009.1
+ Revision: 340073
- import ocaml-sha