%define build_compat32 %{?_with_compat32:1}%{!?_with_compat32:0}

Summary: The shared library for the S-Lang extension language
Summary(ja): S-Lang 拡張言語ライブラリ
Name: slang
Version: 2.1.4
Release: 4%{?_dist_release}

License: GPLv2+
Group: System Environment/Libraries
URL: http://www.jedsoft.org/slang/

Source: ftp://space.mit.edu/pub/davis/slang/v2.1/%{name}-%{version}.tar.bz2
Patch1: slang-2.1.4-makefile.patch
Patch2: slang-nointerlibc2.patch

BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: libpng-devel
BuildRequires: oniguruma-devel
BuildRequires: pcre-devel

Vendor: Project Vine
Distribution: Vine Linux
Packager: Daisuke SUZUKI <daisuke@linux.or.jp>

%description
S-lang (pronounced `sssslang'') is a powerful stack based interpreter
that supports a C-like syntax.  It has been designed from the beginning
to be easily embedded into a program to make it extensible. Slang also
provides a way to quickly develop and debug the application embedding it
in a safe and efficient manner.  Since slang resembles C, it is easy to
recode slang procedures in C if the need arises.

%description -l ja 
S-lang (`sssslang'' と発音します)は、Cとよく似た文法のスタックベース
・インタプリタです。開発初期から、プログラムに容易に組み込めるように
デザインされてきました。また、S-lang を用いると、アプリケーションを安
全にかつ効率良くデバッグ・開発できます。S-lang は C と似ていますから、
必要になれば、S-lang の手続きをCに簡単に変換することもできます。

%package slsh
Summary: Interpreter for S-Lang scripts
Summary(ja): S-Lang スクリプトインタプリタ
Group: Development/Languages
Requires: %{name} = %{version}-%{release}

%description slsh
slsh (slang-shell) is a program for interpreting S-Lang scripts. 
It supports dynamic loading of S-Lang modules and includes a readline
interface for interactive use.

This package also includes S-Lang modules that are distributed with
the S-Lang distribution.

%package devel
Summary: Development package for %{name}
Summary(ja): %{name} の開発パッケージ
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}

%description devel
This package contains files which you'll need if you want to
develop S-Lang based applications.  Documentation which may help
you write S-Lang based applications is also included.

Install the slang-devel package if you want to develop applications
based on the S-Lang extension language.
#'

%description devel -l ja
このパッケージには S-lang を用いたアプリケーションの開発に必要な静的
ライブラリとヘッダファイルが含まれています。S-lang を記述する助けに
なるようなドキュメントも含まれています。

もし S-lang を使ったアプリケーションを開発するなら、このパッケージを
インストールしてください。

## to build compat32 for x86_64 architecture support
%package -n compat32-%{name}
Summary: The shared library for the S-Lang extension language
Summary(ja): S-Lang 拡張言語ライブラリ
Group: System Environment/Libraries
Requires: %{name} = %{version}-%{release}

%description -n compat32-%{name}
S-lang (pronounced `sssslang'') is a powerful stack based interpreter
that supports a C-like syntax.  It has been designed from the beginning
to be easily embedded into a program to make it extensible. Slang also
provides a way to quickly develop and debug the application embedding it
in a safe and efficient manner.  Since slang resembles C, it is easy to
recode slang procedures in C if the need arises.

%description -n compat32-%{name} -l ja 
S-lang (`sssslang'' と発音します)は、Cとよく似た文法のスタックベース
・インタプリタです。開発初期から、プログラムに容易に組み込めるように
デザインされてきました。また、S-lang を用いると、アプリケーションを安
全にかつ効率良くデバッグ・開発できます。S-lang は C と似ていますから、
必要になれば、S-lang の手続きをCに簡単に変換することもできます。

%package -n compat32-%{name}-devel
Summary: Development package for %{name}
Summary(ja): %{name} の開発パッケージ
Group: Development/Libraries
Requires: compat32-%{name} = %{version}-%{release}
Requires: %{name}-devel = %{version}-%{release}

%description -n compat32-%{name}-devel
This package contains files which you'll need if you want to
develop S-Lang based applications.  Documentation which may help
you write S-Lang based applications is also included.

Install the slang-devel package if you want to develop applications
based on the S-Lang extension language.
#'

%prep
%setup -q
%patch1 -p1 -b .makefile
%patch2 -p1 -b .nointerlibc2

%build
%configure --includedir=%{_includedir}/slang
make %{?_smp_mflags} install_doc_dir=%{_docdir}/%{name}-%{version}

%install
rm -rf ${RPM_BUILD_ROOT}

make install-all INSTALL="install -p" DESTDIR=$RPM_BUILD_ROOT
rm -rf $RPM_BUILD_ROOT%{_docdir}/{slang,slsh}

%clean
rm -rf ${RPM_BUILD_ROOT}

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%post -n compat32-%{name} -p /sbin/ldconfig

%postun -n compat32-%{name} -p /sbin/ldconfig


%files
%defattr(-,root,root)
%doc COPYING doc/README changes.txt doc/*/slang*.txt doc/*.txt
%{_libdir}/libslang*.so.*

%files slsh
%defattr(-,root,root)
%doc slsh/doc/html/slsh*.html
%config(noreplace) %{_sysconfdir}/slsh.rc
%{_bindir}/slsh
%{_libdir}/slang
%{_mandir}/man1/slsh.1*
%{_datadir}/slsh

%files devel
%defattr(-,root,root)
%doc doc/*/cslang*.txt doc/*/cref.txt
%{_libdir}/libslang*.so
%{_libdir}/libslang*.a
%{_includedir}/slang

%if %{build_compat32}
%files -n compat32-%{name}
%defattr(- , root, root)
%{_libdir}/libslang.so.*

%files -n compat32-%{name}-devel
%defattr(- , root, root)
%{_libdir}/libslang.a
%{_libdir}/libslang.so
%endif


%changelog
* Tue Mar 22 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.1.4-4
- rebuilt with new toolchains

* Sun Jul 05 2009 NAKAMURA Kenta <kenta@vinelinux.org> 2.1.4-3
- removed unneccesary %if !%{build_compat32} case condition

* Thu Mar 19 2009 Toshiharu Kudoh <toshi.kd2@gmail.com> 2.1.4-2
- rebuilt with oniguruma-5.9.1

* Wed Mar 04 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 2.1.4-1
- new upstream release

* Sat May 10 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 2.1.3-1
- new upstream release
- drop slang_jp patch

* Sun Aug 06 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 1.4.9-0vl1
- update to slang-1.4.9
- rediffed slang_jp patch

* Thu Feb 16 2006 Shu KONNO <owa@bg.wakwak.com> 1.4.4-0vl5
- change ./configure to %%configure
- uncommented a script to make symbolic link of %%{_libdir}/libslang.so.1
- added compat32-* packages for x86_64 architecture support

* Fri Jul 18 2003 Ryoiochi INAGAKI <ryo1@bc.wakwak.com> 1.4.4-0vl4
- rebuild with new toolchains
- s/Copyright/License/

* Sat Feb  9 2002 MATUBARA Kazuyuki <matubara@mb.asmnet.ne.jp> 1.4.4-0vl3
- bug fixed canna input for jed
- change patch: bug fixed slsng-console.patch

* Mon Jan 21 2002 MATUBARA Kazuyuki <matubara@mb.asmnet.ne.jp> 1.4.4-0vl2
- rebuild with glibc-2.2.4

* Wed Jun 27 2001 MATUBARA Kazuyuki <matubara@mb.asmnet.ne.jp> 1.4.4-0vl1
- update to 1.4.4
- use jp0 patch
- use better macros
- use Release No for Vine Linux

* Fri Jan  7 2000 Jun Nishii <jun@vinelinux.org>
[1.2.2_jp-7]
- Japanese summary and description
- change group

* Mon Sep 12 1999 Norihito Ohmori <ohmori@flatout.org>
- rebuild for new environment.

* Fri Jul 16 1999 Daisuke SUZUKI <daisuke@linux.or.jp>
[1.2.2_jp-5]
- Updated to 1.2.2j056

* Sun Feb 21 1999 MATSUMOTO Shoji <vine@flatout.org>
[1.2.2_jp-4]
- fix box bug with KANJI

* Tue Feb 16 1999 Daisuke SUZUKI <daisuke@linux.or.jp>
[1.2.2_jp-2]
- Updated to 1.2.2j054

* Mon Dec 21 1998 MATSUMOTO Shoji <shom@flatout.org>
[1.2.2j052-2]
- patch for linux console and kon
- bug fix for no-kanji version
- separate devel

* Sat Jul  4 1998 Daisuke SUZUKI <daisuke@linux.or.jp>
[1.2.1j-1]
- Updated to 1.2.2 (j052)

* Fri Jun  5 1998 Daisuke SUZUKI <daisuke@linux.or.jp>
[1.2.1j-1]
- japanize patch added

* Mon Apr 13 1998 Manoj Kasichainula <manojk@io.com>
[1.2.1-1]
- Updated to 1.2.1

* Sun Apr 12 1998 Manoj Kasichainula <manojk@io.com>
[1.2.0-1]
- Updated to 1.2.0, the first 1.x non-beta version

* Wed Feb 11 1998 Manoj Kasichainula <manojk@io.com>
[1.0.3-1]
- Updated to 1.0.3
- Minor fixes

* Tue Feb 3 1998 Manoj Kasichainula <manojk@io.com>

- Earlier changes were lost, because of misplacement of RPM:
 - BuildRoot
 - RPM_OPT_FLAGS
 - %clean section
 - other minor spec file changes
- Should be buildable by non-root now
- Included untic, a very cool terminfo interpreter (this probably out to be
  split out eventually)
- Added bug fix from JED

* Thu Jan 29 1998 Bill Nottingham <wen1@cec.wustl.edu>

- upgraded to 1.0.2

* Wed Jan 28 1998 Bill Nottingham <wen1@cec.wustl.edu>

- Apparently so, Donnie. :)
- upgraded to 1.0.0beta

* Tue Oct 14 1997 Donnie Barnes <djb@redhat.com>

- spec file cleanups

* Mon Sep 1 1997 Donnie Barnes <djb@redhat.com>

- upgraded to 0.99.38 (will it EVER go 1.0???)
- all patches removed (all appear to be in this version)

* Thu Jun 19 1997 Erik Troan <ewt@redhat.com>

- built against glibc
