%define build_compat32 %{?_with_compat32:1}%{!?_with_compat32:0}
Summary: shared library for C like extension language
Summary(ja): C とよく似た拡張言語ライブラリ
Name: slang1
%define ever 1.4.9
%define jver jp0
Version: %{ever}
Release: 1%{?_dist_release}
License: GPL
Group: System Environment/Libraries
Source: ftp://space.mit.edu/pub/davis/slang/v1.4/slang-%{ever}.tar.bz2
Patch0: slang-%{ever}%{jver}.patch
Patch10: slang-1.4.9-nointerlibc.patch
Patch20: slang-1.4.9-fix.patch
Patch30: slang-1.4.9-buildfix.patch
URL: http://space.mit.edu/~davis/slang.html

BuildRoot: %{_tmppath}/%{name}-%{version}-root
Provides: slang = %{version}-%{release}
Obsoletes: slang < %{version}-%{release}

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.

This is Japanese visible version.
This package is patched for linux console and kon.

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


## to build compat32 for x86_64 architecture support
%package -n compat32-%{name}
Summary: shared library for C like extension language
Group: System Environment/Libraries
%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.

This is Japanese visible version.
This package is patched for linux console and kon.



%prep
%setup -q -n slang-%{ever}
%patch0 -p1 -b .jp
%patch10 -p1 -b .nointerlibc
%patch20 -p1 -b .fixed-tick
%patch30 -p1 -b .buildfix

%build
%if %{build_compat32}
export CC='gcc -m32'
%endif
#CFLAGS="$RPM_OPT_FLAGS" LDFLAGS=-s ./configure --prefix=%{_prefix}
CFLAGS="$RPM_OPT_FLAGS" LDFLAGS=-s %configure
make all elf "ELF_CFLAGS=$RPM_OPT_FLAGS -fPIC"
( cd src
  make untic "ELF_CFLAGS=$RPM_OPT_FLAGS -fPIC"
)

%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{_bindir}

make DESTDIR=$RPM_BUILD_ROOT \
     install_include_dir=%{_includedir}/slang \
     install install-elf
install -s -m 755 src/objs/untic $RPM_BUILD_ROOT%{_bindir}
chmod 755 $RPM_BUILD_ROOT%{_libdir}/libslang.so.%{ever}
ln -sf libslang.so.%{ever} $RPM_BUILD_ROOT%{_libdir}/libslang.so.1

# remove unneeded files
rm -rf $RPM_BUILD_ROOT%{_includedir}
rm -f $RPM_BUILD_ROOT%{_libdir}/*.{a,so}
rm -rf $RPM_BUILD_ROOT%{_prefix}/doc
rm -rf $RPM_BUILD_ROOT%{_bindir}

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%if %{build_compat32}
%post -n compat32-%{name} -p /sbin/ldconfig
%postun -n compat32-%{name} -p /sbin/ldconfig
%endif

%clean
rm -rf $RPM_BUILD_ROOT

%if !%{build_compat32}
%files
%defattr(- , root, root)
%doc README COPY* UPGRADE.txt NEWS INSTALL* changes.txt
%doc doc/ slang-j.doc
%{_libdir}/libslang.so.*
%endif

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

%changelog
* Sun May 11 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 1.4.9-1
- rename to slang1
  - build as compat package

* 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
