%define name sqlite
%define version 2.8.17
%define release 4%{?_dist_release}

Name: %{name}
Summary: SQLite is a C library that implements an embeddable SQL database engine
Summary(ja): SQLite は組み込み型SQLデータベースエンジンを実装するCライブラリです。
Version: %{version}
Release: %{release}
Group: System Environment/Libraries
URL: http://www.sqlite.org
License: Public Domain

Source: %{name}-%{version}.tar.gz
Patch0: %{name}-2.8.15-ja-patch
Patch1: %{name}-2.8.14-lib64.patch.bz2
Patch2: %{name}-64bit-fixes.patch.bz2

BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: tcl-devel, chrpath, ncurses-devel, readline-devel

%description
SQLite is a C library that implements an embeddable SQL database engine.
Programs that link with the SQLite library can have SQL database access
without running a separate RDBMS process. The distribution comes with a
standalone command-line access program (sqlite) that can be used to
administer an SQLite database and which serves as an example of how to
use the SQLite library.
%description -l ja
SQLite は組み込み型SQLデータベースエンジンを実装するCライブラリです。
SQLiteライブラリにリンクされたプログラムではSQLデータベースアクセスが
できるようになります。その際、別のRDBMSプロセスは不要です。


%package devel
Summary: Header files and libraries for developing apps which will use sqlite
Summary(ja): SQLiteを使ってアプリを開発するためのヘッダファイルやライブラリ
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}

%description devel
The sqlite-devel package contains the header files and libraries needed
to develop programs that use the sqlite database library.

%description devel -l ja
qlite-develパッケージはSQLiteデータベースライブラリを使ってプログラムを
開発するために必要なヘッダファイルやライブラリを含んでいます。

%package        static-devel
Summary:        Static development library for the SQLite library
Summary(ja):	SQLiteライブラリのstaticな開発用ライブラリ
Group:          Development/Libraries
Requires:       %{name}-devel = %{version}-%{release}
Provides:       %{name}-static-devel = %{version}-%{release}

%description    static-devel
The sqlite-static-devel package contains the static header files 
and libraries needed to develop programs that use the sqlite database library.

%description    static-devel -l ja
sqlite-static-develはSQLiteデータベースライブラリを使ってプログラムを開発する時に必要なstaticなヘッダファイルとライブラリを含んでいます

%package        tools
Summary:        Command line tools for managing the sqlite library.
Summary(ja):	SQLiteライブラリを管理するコマンドラインツール
Group:          Applications/Databases
Requires:       %{name} = %{version}-%{release}

%description    tools
The sqlite-tool package contains command line tools for managing 
the sqlite library.

%description    tools -l ja
sqlite-toolはSQLiteライブラリを管理するコマンドラインツールです。

%prep
%setup -q 
%patch0 -p0 -b .jp
%patch1 -p0 -b .lib64
%patch2 -p1 -b .64bit-fixes

%build
CFLAGS="%optflags -DNDEBUG=1" CXXFLAGS="%optflags -DNDEBUG=1" %configure -enable-utf8

make
make doc

%install
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}

install -d %{buildroot}%{_bindir}
install -d %{buildroot}%{_includedir}
install -d %{buildroot}%{_libdir}
install -d %{buildroot}%{_mandir}/man1

%makeinstall
install -m644 sqlite.1 %{buildroot}%{_mandir}/man1/
chrpath -d %{buildroot}%{_bindir}/*
## remove unuse files
rm -rf $RPM_BUILD_ROOT%{_libdir}/*.la


%clean
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}


%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig


%files
%defattr(-, root, root)
%doc README
%{_libdir}/*.so.*

%files 	devel
%defattr(-, root, root)
%doc doc/*.html doc/*.png
%{_libdir}/*.a
#%{_libdir}/*.la
%{_libdir}/lib*.so
%{_includedir}/*.h
%{_libdir}/pkgconfig/*.pc

%files static-devel
%defattr(-, root, root)
%{_libdir}/lib*.a

%files tools
%defattr(-, root, root)
%{_bindir}/*
%{_mandir}/man1/*

%changelog
* Sun Mar 22 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 2.8.17-4
- rebuilt with readline 6.3
- changed BuildRequires: tcl-devel instead of tcl

* Mon Jan 12 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.8.17-3
- rebuild with VineSeed environment

* Sun Oct 03 2010 Shu KONNO <owa@bg.wakwak.com> 2.8.17-2
- rebuilt with rpm-4.8.1 for pkg-config

* Sat Sep 20 2008 Shu KONNO <owa@bg.wakwak.com> 2.8.17-1vl5
- applied new versioning policy, spec in utf-8
- removed *.la

* Mon May 08 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.8.17-0vl1
- updated to 2.8.17
- changed Group:
- run /sbin/ldconfig at %post, %postun

* Mon Nov 08 2004 Satoshi MACHINO <machino@vinelinux.org> 2.8.15-0vl2
- added BuildRequires: chrpath, ncurses-devel, readline-devel
- separated sub packages to static-devel, tool
- added ja subscription

* Tue Aug 17 2004 HOTTA Michihide <hotta@net-newbie.com> 2.8.15-0vl1
- add BuildRequires: tcl
- upstream release

* Tue Nov 11 2003 HOTTA Michihide <hotta@net-newbie.com> 2.8.6-0vl1
- 1st release
