%global opt %(test -x %{_bindir}/ocamlopt && echo 1 || echo 0)
%global debug_package %{nil}
%global _default_patch_fuzz 2

Name:          ocaml-facile
Version:       1.1
Release:       31%{?_dist_release}
Summary:       OCaml library for constraint programming
Summary(ja):   制約プログラミング向けの OCaml ライブラリ
Summary(fr):   Librairie OCaml de programmation par contraintes

License:       LGPLv2+
Group:         System Environment/Libraries
URL:           http://www.recherche.enac.fr/log/facile/

Source0:       http://www.recherche.enac.fr/log/facile/distrib/facile-%{version}.tar.gz

# makefile fixes by Steffen Joeris <white@debian.org>:
# * only build and install native binaries if ocamlopt is available
# * install .mli files
Patch0:        facile-1.1-makefile-fixes.patch

# Fix for OCaml 4.00.0.
Patch1:        ocaml-facile-ocaml-4.patch

BuildRoot:     %{_tmppath}/%{name}-%{version}-root
BuildRequires: ocaml >= 3.02
BuildRequires: ocaml-findlib-devel
Obsoletes:     facile < %{version}-%{release}
Provides:      facile = %{version}-%{release}

Vendor:        Project Vine
Distribution:  Vine Linux
Packager:      inagaki

%description
FaCiLe is a constraint programming library on integer and integer set finite
domains written in OCaml. It offers all usual facilities to create and
manipulate finite domain variables, arithmetic expressions and constraints
(possibly non-linear), built-in global constraints (difference, cardinality,
sorting etc.) and search and optimization goals. FaCiLe allows as well to build
easily user-defined constraints and goals (including recursive ones), making
pervasive use of OCaml higher-order functionals to provide a simple and flexible
interface for the user. As FaCiLe is an OCaml library and not "yet another
language", the user benefits from type inference and strong typing discipline,
high level of abstraction, modules and objects system, as well as native code
compilation efficiency, garbage collection and replay debugger, all features of
OCaml (among many others) that allow to prototype and experiment quickly:
modeling, data processing and interface are implemented with the same powerful
and efficient language.

%package        devel
Summary:        Development files for %{name}
Summary(ja):    %{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}.


%prep
%setup -q -n facile-%{version}
%patch0 -p1 -b .makefile-fixes
%patch1 -p1 -b .ocaml4

%build
# This is not autoconf, but a simple custom configure script.
# The --faciledir directory is only used for "make install".
./configure --faciledir $RPM_BUILD_ROOT%{_libdir}/ocaml/facile
make

%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{_libdir}/ocaml/facile
make install

%clean
rm -rf $RPM_BUILD_ROOT

%check
make check

%files
%defattr(-,root,root)
%doc LICENSE README
%{_libdir}/ocaml/facile/
%if %opt
%exclude %{_libdir}/ocaml/facile/*.a
%exclude %{_libdir}/ocaml/facile/*.cmxa
%endif
%exclude %{_libdir}/ocaml/facile/*.mli

%files devel
%if %opt
%{_libdir}/ocaml/facile/*.a
%{_libdir}/ocaml/facile/*.cmxa
%endif
%{_libdir}/ocaml/facile/*.mli


%changelog
* Mon Jan 26 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 1.1-31
- changed package name
- rebuilt with ocaml 4.02.1
- split development files into devel subpackage

* Tue May 15 2012 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.1-13
- rebuilt with ocaml-3.12.1

* Sat Jun 25 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.1-12
- rebuild with ocaml-3.12.0

* Wed Apr 27 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.1-11
- rebuilt with ocaml-3.12.0
- added Japanese summary
- added Vendor and Distribution tag

* Sun Sep 13 2009 NAKAMURA Kenta <kenta@vinelinux.org> 1.1-10
- rebuilt with ocaml-3.11.0 (x86_64 has not built with ocaml-3.11.0)

* Sat May  9 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.1-9
- rebuilt with ocaml-3.11.0

* Sat Jul 12 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.1-8
- rebuild with ocaml-3.10.2

* Thu Feb  7 2008 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.1-0vl5.2
- rebuild with ocaml-3.10.1 on Vine4.2

* Thu Feb  7 2008 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.1-0vl7
- rebuild with ocaml-3.10.1

* Tue Oct 23 2007 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.1-0vl5.1
- rebuild with ocaml-3.10.0 on Vine4.1

* Sun Sep 30 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.1-0vl6
- rebuild with ocaml-3.10.0

* Thu Jun 15 2006 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 1.1-0vl5
- rebuild with ocaml-3.09.2 on VineSeed

* Thu Mar 23 2006 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.1-0vl4
- rebuild with ocaml-3.09.1 on VineSeed

* Thu Mar 23 2006 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.1-0vl3
- rebuild with ocaml-3.09.1 on Vine3.2

* Mon Feb  6 2006 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.1-0vl2
- rebuild for VineSeed

* Mon Feb  6 2006 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.1-0vl1
- initial release
