%define year		2002
%define month		07
%define day		25
%define name 		clisp
%define version		2.49
%define release         1%{?_dist_release}
%define clisp_build	vine

Summary:      Common Lisp (ANSI CL) implementation
Summary(ja):  関数型言語 Common Lisp (ANSI CL) の実装
Name:         clisp
Version:      %{version}
Release:      %{release}
Icon:         clisp.gif
License:      GPL
Group:        Development/Languages
Source:       ftp://ftp.gnu.org/pub/gnu/clisp/release/%{version}/%{name}-%{version}.tar.bz2
Patch0:         clisp-2.47-cpp.patch
#Patch:	      %{name}-2.32-hfs.patch
#Patch1:	      %{name}-2.27-dvi.patch

URL:          http://www.clisp.org/
Provides:     clisp, ansi-cl
BuildRoot:    %{_tmppath}/%{name}-%{version}-root
BuildRequires:	imake
BuildRequires:	libsigsegv-devel
BuildRequires:	readline-devel
BuildRequires:  dbus-devel
BuildRequires:  diffutils
BuildRequires:  fcgi-devel
BuildRequires:  ffcall
BuildRequires:  gdbm-devel
BuildRequires:  gettext
BuildRequires:  gtk2-devel
BuildRequires:  libICE-devel
BuildRequires:  libSM-devel
BuildRequires:  libX11-devel
BuildRequires:  libXaw-devel
BuildRequires:  libXext-devel
BuildRequires:  libXft-devel
BuildRequires:  libXmu-devel
BuildRequires:  libXrender-devel
BuildRequires:  libXt-devel
BuildRequires:  libglade2-devel
BuildRequires:  pcre-devel
BuildRequires:  postgresql-devel
BuildRequires:  zlib-devel

%description
Common Lisp is a high-level, general-purpose, object-oriented, dynamic,
functional programming language.

CLISP is a Common Lisp implementation by Bruno Haible, then of Karlsruhe
University, and Michael Stoll, then of Munich University, both in Germany. 
It supports the Lisp described in the ANSI Common Lisp standard plus many
extensions.

CLISP includes an interpreter, a compiler, a debugger, CLOS, MOP, a foreign
language interface, i18n, regular expressions, a socket interface, and more. 
An X11 interface is available through CLX, Garnet and CLUE/CLIO. Command line
editing is provided by readline. CLISP runs Maxima, ACL2 and many other
Common Lisp packages.

CLISP runs on most GNU and Unix systems (Linux, FreeBSD, NetBSD, OpenBSD, 
Solaris, Tru64, HP-UX, BeOS, NeXTstep, IRIX, AIX and others) and on other
systems (Windows NT/2000/XP, Windows 95/98/ME) and needs only 4 MB of RAM.

CLISP is Free Software and may be distributed under the terms of GNU GPL.
You may distribute commercial proprietary applications compiled with CLISP,
see file COPYRIGHT in the CLISP distribution.

The user interface comes in English, German, French, Spanish, Dutch, Russian
and Danish, and can be changed at run time.

%prep
%setup -q 
sed -i 's|http://www.lisp.org/HyperSpec/|http://www.lispworks.com/documentation/HyperSpec/|g' \
    doc/* src/*.d src/*.lisp

%build
%ifarch ppc ppc64
%define opt_flags "$RPM_OPT_FLAGS -DNO_GENERATIONAL_GC -DNO_MULTIMAP_FILE -DNO_SINGLEMAP"
ulimit -s unlimited
%else
%define opt_flags "$RPM_OPT_FLAGS"
%endif

./configure --prefix=%{_prefix} \
            --libdir=%{_libdir} \
            --mandir=%{_mandir} \
            --docdir=%{_docdir}/clisp-%{version} \
            --fsstnd=redhat \
            --hyperspec=http://www.lispworks.com/documentation/HyperSpec/ \
            --with-module=bindings/glibc \
            --with-module=clx/new-clx \
            --with-module=dbus \
            --with-module=fastcgi \
            --with-module=gdbm \
            --with-module=gtk2 \
            --with-module=i18n \
            --with-module=pcre \
            --with-module=postgresql \
            --with-module=rawsock \
            --with-module=regexp \
            --with-module=syscalls \
            --with-module=wildcard \
            --with-module=zlib \
            --with-readline \
            --cbc \
            build CFLAGS=%opt_flags

%install
rm -rf $RPM_BUILD_ROOT
make -C build DESTDIR=$RPM_BUILD_ROOT install
rm -f $RPM_BUILD_ROOT%{_docdir}/clisp-%{version}/doc/clisp.{dvi,1,ps}
cp -p doc/mop-spec.pdf $RPM_BUILD_ROOT%{_docdir}/clisp-%{version}/doc
cp -p doc/*.png $RPM_BUILD_ROOT%{_docdir}/clisp-%{version}/doc
cp -p doc/Why-CLISP* $RPM_BUILD_ROOT%{_docdir}/clisp-%{version}/doc
cp -p doc/regexp.html $RPM_BUILD_ROOT%{_docdir}/clisp-%{version}/doc
find $RPM_BUILD_ROOT%{_libdir} -name '*.dvi' | xargs rm -f
%find_lang %{name}
%find_lang %{name}low
cat %{name}low.lang >> %{name}.lang

## ad-hoc fix <BTS:VineLinux:825>: '--vimdir' option is broken...
%__mkdir_p $RPM_BUILD_ROOT%{_sysconfdir}/vim
%__mv $RPM_BUILD_ROOT%{_datadir}/vim/vimfiles/after $RPM_BUILD_ROOT%{_sysconfdir}/vim

%clean
rm -rf %{buildroot}


%files -f %{name}.lang
%defattr(-,root,root,-)
%{_bindir}/%{name}
%{_mandir}/man1/*
%{_libdir}/%{name}-%{version}
%{_datadir}/aclocal/*.m4
%{_datadir}/emacs/site-lisp/*
%{_sysconfdir}/vim
%doc %{_docdir}/clisp-%{version}

%changelog
* Tue Apr 19 2011 IWAI, Masaharu <iwai@alib.jp> 2.49-1
- new upstream release
- ad-hoc fix <BTS:VineLinux:825>: but '--vimdir' option is broken...

* Tue Apr 12 2011 Shu KONNO <owa@bg.wakwak.com> 2.48-2
- rebuilt with postgresql-9.0.3

* Sat Mar  6 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.48-1
- new upstream release
- built with new toolchain, libsigsegv-2.8
- updated build dependencies

* Sun Sep 21 2008 Shu KONNO <owa@bg.wakwak.com> 2.43-1vl5
- applied new versioning policy, spec in utf-8

* Mon Nov 26 2007 Shu KONNO <owa@bg.wakwak.ne.jp> 2.43-0vl1
- version up to 2.43
- updated source url
- changed %%{_libdir}/clisp to %%{_libdir}/clisp-%%{version}
- added option "--libdir=%%{_libdir}" to configure for lib64

* Sun Mar 18 2007 USAMI Kosuke <usami-k@yc5.so-net.ne.jp> 2.41-0vl1
- version up to 2.41
- add BuildRequires : readline-devel, gettext, libsigsegv-devel
- update %%description, %%files, configure options
- drop hfs patch

* Tue Jan  6 2004 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.32-0vl1
- version up to 2.32
- rebuild with new toolchains
- updated hfs patch

* Sat Aug 25 2002 Yoshihiro Ota <ota@j.email.ne.jp>
- version up to 2.29

* Sat Mar 9 2002 Yoshihiro Ota <ota@j.email.ne.jp>
- version up to 2.28
- added BuildRequires : ncurses-devel and removed groff patch

* Fri Jan 18 2002 Yoshihiro Ota <ota@j.email.ne.jp>
- create rpm for release 2.27
