File ocaml.spec of Package ocaml

#
# spec file for package ocaml (Version 3.12.0)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild


Name:           ocaml
BuildRequires:  emacs-nox fdupes gdbm-devel ncurses-devel tk-devel
License:        GPLv2+ ; QPL ..
Group:          Development/Languages/Other
AutoReqProv:    on
Version:        3.12.0
Release:        1
%define doc_version 3.12
%ifarch s390 s390x
%define do_opt 0
%else
%define do_opt 1
%endif
Source0:        ftp://ftp.inria.fr/lang/caml-light/ocaml-%{version}.tar.bz2
Source1:        ftp://ftp.inria.fr/lang/caml-light/ocaml-%{doc_version}-refman.html.tar.bz2
Source2:        ftp://ftp.inria.fr/lang/caml-light/ocaml-%{doc_version}-refman.ps.bz2
Source3:        ftp://ftp.inria.fr/lang/caml-light/ocaml-%{doc_version}-refman.info.tar.bz2
Source4:        rpmlintrc
Patch0:         ocaml-3.00-camldebug_el.patch
Patch1:         ocaml-3.04-info.patch
Patch2:         ocaml-3.04-ocamltags--no-site-start.patch
Patch3:         ocaml-rpath.patch
Patch5:         ocaml-3.08.3-gcc4.patch
Patch6:         ocaml-3.08.3.patch
Patch7:         ocaml-3.09-emacs_localcompile.patch
Patch8:         ocaml-3.09-rpmoptflags.patch
Url:            http://caml.inria.fr/
Summary:        The Objective Caml Compiler and Programming Environment
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
PreReq:         %install_info_prereq
ExcludeArch:    ppc64

%description
Objective Caml is a high-level, strongly-typed, functional and
object-oriented programming language from the ML family of languages.

This package comprises two batch compilers (a fast bytecode compiler
and an optimizing native-code compiler), an interactive top level
system, Lex&Yacc tools, a replay debugger, and a comprehensive library.



Authors:
--------
    Pierre Weis <Pierre.Weis@inria.fr>

%package devel
License:        GPLv2+ ; QPL ..
Summary:        The Objective Caml Compiler and Programming Environment
Group:          Development/Languages/Other
Provides:       libz:/usr/include/zlib.h
Requires:       zlib = %{version}
AutoReqProv:    on

%description devel
Objective Caml is a high-level, strongly-typed, functional and
object-oriented programming language from the ML family of languages.

This package comprises two batch compilers (a fast bytecode compiler
and an optimizing native-code compiler), an interactive top level
system, Lex&Yacc tools, a replay debugger, and a comprehensive library.



Authors:
--------
    Pierre Weis <Pierre.Weis@inria.fr>

%package -n labltk
License:        GPLv2+ ; QPL ..
Group:          Development/Languages/Other
Summary:        The Objective Caml Compiler and Programming Environment
Requires:       ocaml = %{version}-%{release}

%description -n labltk
Objective Caml is a high-level, strongly-typed, functional and
object-oriented programming language from the ML family of languages.

This package comprises two batch compilers (a fast bytecode compiler
and an optimizing native-code compiler), an interactive top level
system, Lex&Yacc tools, a replay debugger, and a comprehensive library.



Authors:
--------
    Pierre Weis <Pierre.Weis@inria.fr>

%package -n camlp4
License:        GPLv2+ ; QPL ..
Group:          Development/Languages/Other
Summary:        The Objective Caml compiler and programming environment
Requires:       ocaml = %{version}-%{release}

%description -n camlp4
Objective Caml is a high-level, strongly-typed, functional and
object-oriented programming language from the ML family of languages.

This package comprises two batch compilers (a fast bytecode compiler
and an optimizing native-code compiler), an interactive toplevel
system, Lex&Yacc tools, a replay debugger, and a comprehensive library.



Authors:
--------
    Pierre Weis <Pierre.Weis@inria.fr>

%package ocamldoc
License:        GPLv2+ ; QPL ..
Group:          Development/Languages/Other
Summary:        The Objective Caml Compiler and Programming Environment
Requires:       ocaml = %{version}-%{release}

%description ocamldoc
Objective Caml is a high-level, strongly-typed, functional and
object-oriented programming language from the ML family of languages.

This package comprises two batch compilers (a fast bytecode compiler
and an optimizing native-code compiler), an interactive top level
system, Lex&Yacc tools, a replay debugger, and a comprehensive library.



Authors:
--------
    Pierre Weis <Pierre.Weis@inria.fr>

%package emacs
License:        GPLv2+ ; QPL ..
Group:          Development/Languages/Other
Summary:        The Objective Caml Compiler and Programming Environment
Requires:       ocaml = %{version}-%{release}
Requires:       emacs

%description emacs
Objective Caml is a high-level, strongly-typed, functional and
object-oriented programming language from the ML family of languages.

This package comprises two batch compilers (a fast bytecode compiler
and an optimizing native-code compiler), an interactive top level
system, Lex&Yacc tools, a replay debugger, and a comprehensive library.



Authors:
--------
    Pierre Weis <Pierre.Weis@inria.fr>

%package docs
License:        GPLv2+ ; QPL ..
Group:          Development/Languages/Other
Summary:        The Objective Caml Compiler and Programming Environment
Requires:       ocaml = %{version}-%{release}

%description docs
Objective Caml is a high-level, strongly-typed, functional and
object-oriented programming language from the ML family of languages.

This package comprises two batch compilers (a fast bytecode compiler
and an optimizing native-code compiler), an interactive top level
system, Lex&Yacc tools, a replay debugger, and a comprehensive library.



Authors:
--------
    Pierre Weis <Pierre.Weis@inria.fr>

%prep
%setup -q -T -b 0
%setup -q -T -D -a 1
%setup -q -T -D -a 3
%patch0 -p1
gzip -d infoman/ocaml.info.gz
%patch1 -p1
%patch2 -p1
%patch3
%patch5
%patch6
%patch7
%patch8
find -name ".cvsignore" | xargs -r rm -f

%build
%ifarch %ix86
export RPM_OPT_FLAGS="${RPM_OPT_FLAGS/-fomit-frame-pointer/} -O0"
%endif
./configure -bindir %{_bindir} \
            -libdir %{_libdir}/ocaml \
	    -mandir %{_mandir} \
            -x11include %{_includedir} \
            -x11lib %{_libdir}
#
make world
%if %{do_opt}
make opt ocamlc.opt ocamlopt.opt
%endif

%install
make install BINDIR="$RPM_BUILD_ROOT%{_bindir}" LIBDIR="$RPM_BUILD_ROOT%{_libdir}/ocaml" MANDIR="$RPM_BUILD_ROOT%{_mandir}"
%if %{do_opt}
make installopt BINDIR="$RPM_BUILD_ROOT%{_bindir}" LIBDIR="$RPM_BUILD_ROOT%{_libdir}/ocaml" MANDIR="$RPM_BUILD_ROOT%{_mandir}"
%endif
#
install -d $RPM_BUILD_ROOT%{_infodir} \
           $RPM_BUILD_ROOT%{_datadir}/emacs/site-lisp
(cd emacs
make install BINDIR=$RPM_BUILD_ROOT/%{_bindir} EMACSDIR=$RPM_BUILD_ROOT%{_datadir}/emacs/site-lisp
make install-ocamltags BINDIR=$RPM_BUILD_ROOT/%{_bindir}
)
(cd infoman; cp -f ocaml* $RPM_BUILD_ROOT%{_infodir})
# fix bnc#411232
echo '(load "ocaml.el" nil t t)' >$RPM_BUILD_ROOT%{_datadir}/emacs/site-lisp/suse-start-ocaml.el
cat <<EOF >$RPM_BUILD_ROOT%{_datadir}/emacs/site-lisp/%{name}.el
(autoload 'caml-mode "caml" "Caml editing mode" t)
(add-hook 'caml-mode-hook 'font-lock-mode)
(add-to-list 'auto-mode-alist '("\\\\.mli?$" . caml-mode))
EOF
export EXCLUDE_FROM_STRIP="ocamldebug ocamlbrowser"
sed s,$RPM_BUILD_ROOT,,g < $RPM_BUILD_ROOT%{_libdir}/ocaml/ld.conf >/tmp/buildroot_sucks_ass
mv /tmp/buildroot_sucks_ass $RPM_BUILD_ROOT%{_libdir}/ocaml/ld.conf
sed -i -e "s@$RPM_BUILD_ROOT@@" $RPM_BUILD_ROOT/%{_libdir}/ocaml/Makefile.config
sed -i '1s/^/#!\/usr\/bin\/ocaml\n/' $RPM_BUILD_ROOT/%{_bindir}/ocamltags
%fdupes $RPM_BUILD_ROOT

%post
%install_info --info-dir=%{_infodir} %{_infodir}/%{name}.info.gz

%postun
%install_info_delete --info-dir=%{_infodir} %{_infodir}/%{name}.info.gz

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc Changes LICENSE README
%{_bindir}/*
%{_mandir}/*/*
%{_libdir}/ocaml
%{_infodir}/*
%exclude %{_bindir}/camlp4*
%exclude %{_bindir}/mkcamlp4
%exclude %{_bindir}/labltk
%exclude %{_bindir}/ocamltags
%exclude %{_bindir}/ocamlbrowser
%exclude %{_bindir}/ocamldoc*
%exclude %{_libdir}/ocaml/camlp4
%exclude %{_libdir}/ocaml/labltk
%exclude %{_libdir}/ocaml/ocamldoc
%exclude %{_libdir}/ocaml/stublibs/dlllabltk.so

%files -n labltk
%defattr(-,root,root,-)
%{_bindir}/labltk
%{_bindir}/ocamlbrowser
%{_libdir}/ocaml/labltk
%{_libdir}/ocaml/stublibs/dlllabltk.so
%doc otherlibs/labltk/examples_labltk
%doc otherlibs/labltk/examples_camltk

%files -n camlp4
%defattr(-,root,root,-)
%{_bindir}/camlp4*
%{_bindir}/mkcamlp4
%{_libdir}/ocaml/camlp4

%files ocamldoc
%defattr(-,root,root,-)
%{_bindir}/ocamldoc*
%{_libdir}/ocaml/ocamldoc
%doc ocamldoc/Changes.txt

%files docs
%defattr(-,root,root,-)
%doc htmlman

%files emacs
%defattr(-,root,root,-)
%doc emacs/README
%dir %{_datadir}/emacs
%dir %{_datadir}/emacs/site-lisp
%{_datadir}/emacs/site-lisp/*
%{_bindir}/ocamltags

%changelog
openSUSE Build Service is sponsored by