Name: gprolog
Summary: A native Prolog compiler with constraint solving over Finite Domains
Summary(ja): 有限領域の制約解決に適した Prolog コンパイラ
Version: 1.4.4
Release: 1%{?_dist_release}

License: LGPLv3 or GPLv2
Group: Development/Languages
URL: http://www.gprolog.org/

Source0: http://www.gprolog.org/%{name}-%{version}.tar.gz

Buildroot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: sed

Vendor: Project Vine
Distribution: Vine Linux

Packager: inagaki

%description 
GNU Prolog is a native Prolog compiler with constraint solving over finite
domains (FD) developed by Daniel Diaz (http://cri-dist.univ-paris1.fr/diaz/)

GNU Prolog is a very efficient native compiler producing (small) stand-alone
executables. GNU-Prolog also offers a classical top-level+debugger.

A lot of work has been devoted to the ISO compatibility. GNU Prolog is very
close to the ISO standard.

GNU Prolog also includes a powerful constraint solver over finite domains 
with many predefined constraints+heuristics.

More information can be found at http://www.gnu.org/software/prolog
or better at http://www.gprolog.org.

%description -l ja
GNU Prolog は有限領域 (FD) の制約解決に適したネイティブ Prolog コンパイラで、
Daniel Diaz (http://cri-dist.univ-paris1.fr/diaz/) によって開発されました。
GNU Prolog は (小さな) スタンドアロンの実行可能形式を生成する、非常に効率の
良いネイティブコンパイラです。
多くの作業が ISO 準拠に向けられました。GNU Prolog は ISO 標準に非常に近いです。 
GNU Prolog は多くの定義済の制約条件と発見的手法を用いて、有限領域の問題に
対して強力な制約解決機能も提供します。
詳しい情報は http://www.gnu.org/software/prolog や http://www.gprolog.org
(こちらの方が良い）で見つけることができます。

%prep
%setup -q 

%build
cd src

# gprolog only acccept -O0 and don't like -fomit-frame-pointer

CFLG="$(echo $RPM_OPT_FLAGS | sed -s "s/\-O2/-O1/g" \
     		    | sed -e "s/\-fomit-frame-pointer//")"

# Based on a gentoo ebuild (??)
CFLG="$CFLG -funsigned-char"

./configure \
    --with-install-dir=$RPM_BUILD_ROOT%{_libdir}/%{name}-%{version} \
    --without-links-dir \
    --with-examples-dir=$RPM_BUILD_ROOT%{_libdir}/%{name}-%{version}/examples \
    --with-doc-dir=dist-doc \
    --with-c-flags="$CFLG"

make

%check
cd src
#
export PATH=$RPM_BUILD_ROOT%{_bindir}:$PATH
#
make check

%install
rm -rf $RPM_BUILD_ROOT
rm -rf dist-doc

pushd src
make install-strip
popd
mkdir $RPM_BUILD_ROOT%{_bindir}
pushd $RPM_BUILD_ROOT%{_libdir}/%{name}-%{version}/bin
for i in *; do
	ln -s ../%{_lib}/%{name}-%{version}/bin/$i $RPM_BUILD_ROOT%{_bindir}/$i
done

#rm -rf docs_to_install
#mkdir -p docs_to_install
#mv $RPM_BUILD_ROOT%{_libdir}/%{name}-%{version}/doc/* docs_to_install
#rm -f $RPM_BUILD_ROOT%{_libdir}/%{name}-%{version}/{COPYING,ChangeLog,NEWS,VERSION}

rm -f dist-doc/*.{chm,dvi,ps}
rm -f dist-doc/compil-scheme.pdf
rm -f dist-doc/debug-box.pdf

for file in ChangeLog COPYING NEWS README VERSION gprolog.ico
do
    rm -f $RPM_BUILD_ROOT%{_libdir}/gprolog-%{version}/$file
done

popd



%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc README COPYING ChangeLog NEWS PROBLEMS VERSION gprolog.ico
%doc src/dist-doc/*
%{_bindir}/*
%{_libdir}/%{name}-%{version}/bin
%{_libdir}/%{name}-%{version}/examples
%{_libdir}/%{name}-%{version}/include
%{_libdir}/%{name}-%{version}/lib

%changelog
* Sat Sep  6 2014 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.4.4-1
- updated to 1.4.4
- updated summary and description
- updated License to LGPLv3 or GPLv2

* Sun May  1 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.3.1-2
- rebuilt with current VineSeed
- fixed compile option

* Wed Mar 11 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.3.1-1
- updated to 1.3.1
- applied new versioning policy
- spec in UTF-8

* Tue Aug 17 2004 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.2.17-0vl3
- rebuild for VinePlus/3.0 and VineSeedPlus
- updated Japanese Summary and description
- merged VinePlus/2.5 spec file
  * Fri Jul 23 2004 IKEDA Katsumi <ikeda@webmasters.gr.jp> 1.2.16-1vl2
  - Added Summary(ja) and %%description -l ja.

* Sat Feb 14 2004 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.2.17-0vl2
- merged VinePlus spec file
  * Thu Feb 12 2004 by IKEDA Katsumi <ikedak@rg8.so-net.ne.jp>
  - 1.2.161vl1
  - Modified %Vendor, %Buildroot and %build.
  - Add %Distribution.
  - Remove %Packager and %Prefix.
- added --with-examples-dir to ./configure
- fixed %files section to exclude %{_libdir}/%{name}-%{version}/doc

* Fri Feb 13 2004 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.2.17-0vl1
- rebuild for Vine Linux
- s/Copyright/License/
- use more rpm macros

* Tue Jul 25 2000 Daniel Diaz <Daniel.Diaz@inria.fr>
- initial specfile
