##
## sqlite.spec -- OpenPKG RPM Package Specification
## Copyright (c) 2000-2005 OpenPKG Foundation e.V.
## Copyright (c) 2000-2005 Ralf S. Engelschall
##
## Permission to use, copy, modify, and distribute this software for
## any purpose with or without fee is hereby granted, provided that
## the above copyright notice and this permission notice appear in all
## copies.
##
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
## SUCH DAMAGE.
##
# package version
%define V_v2 2.8.16
%define V_v3 3.2.4
# package information
Name: sqlite
Summary: SQL Lite
URL: http://www.sqlite.org/
Vendor: D. Richard Hipp
Packager: OpenPKG
Distribution: OpenPKG
Class: BASE
Group: Database
License: PD
Version: %{V_v2}
Release: 20050824
# package options
%option with_utf8 no
%option with_assert no
%option with_readline no
%option with_v3 no
# list of sources
Source0: http://www.sqlite.org/sqlite-%{V_v2}.tar.gz
Source1: http://www.sqlite.org/sqlite-%{V_v3}.tar.gz
Patch0: sqlite.patch
Patch1: sqlite.patch.v3
# build information
Prefix: %{l_prefix}
BuildRoot: %{l_buildroot}
BuildPreReq: OpenPKG, openpkg >= 20040130, make
PreReq: OpenPKG, openpkg >= 20040130
%if "%{with_readline}" == "yes"
BuildPreReq: readline
PreReq: readline
%endif
%if "%{with_v3}" == "yes"
BuildPreReq: gawk
%endif
AutoReq: no
AutoReqProv: no
%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. SQLite is not
a client library used to connect to a big database server. SQLite is
the server. The SQLite library reads and writes directly to and from
the database files on disk.
This package contains both SQLite 2 (%{V_v2}) and optionally the
forthcoming SQLite 3 (%{V_v3}). Notice that the two are API and
database format incompatible but can be used at the same time.
%track
prog sqlite = {
version = %{V_v2}
url = http://www.sqlite.org/download.html
regex = sqlite-(2\.\d+\.\d+)\.tar\.gz
}
prog sqlite:v3 = {
version = %{V_v3}
url = http://www.sqlite.org/download.html
regex = sqlite-(\d+\.\d+\.\d+)\.tar\.gz
}
%prep
%setup -q -c
%patch -p0 -d sqlite-%{V_v2} -P 0
%if "%{with_v3}" == "yes"
%setup -q -D -T -a 1
%patch -p0 -d sqlite-%{V_v3} -P 1
%endif
for v in %{V_v2} \
%if "%{with_v3}" == "yes"
%{V_v3} \
%endif
; do
%{l_shtool} subst \
-e '/LINENO: error: C[+]* preprocessor/{N;N;N;N;s/.*/:/;}' \
sqlite-$v/configure
done
%build
for v in %{V_v2} \
%if "%{with_v3}" == "yes"
%{V_v3} \
%endif
; do
( cd sqlite-$v
CC="%{l_cc}"
export CC
CPPFLAGS="%{l_cppflags}"
export CPPFLAGS
CFLAGS="%{l_cflags -O}"
export CFLAGS
LDFLAGS="%{l_ldflags}"
export LDFLAGS
LIBS=""
export LIBS
%if "%{with_assert}" == "no"
CFLAGS="$CFLAGS -DNDEBUG=1"
%endif
%if "%{with_readline}" == "yes"
config_TARGET_READLINE_INC="%{l_cppflags readline}"
export config_TARGET_READLINE_INC
config_TARGET_READLINE_LIBS="%{l_ldflags} -lreadline -ltermcap"
export config_TARGET_READLINE_LIBS
%endif
./configure \
--prefix=%{l_prefix} \
%if "%{with_utf8}" == "yes"
--enable-utf8 \
%endif
--disable-shared
%if "%{with_assert}" == "yes"
%{l_shtool} subst \
-e 's;-DNDEBUG;;' \
Makefile
%endif
%if "%{with_v3}" == "yes"
%{l_make} %{l_mflags -O} LIBPTHREAD=""
%else
%{l_make} %{l_mflags -O}
%endif
) || exit $?
done
%install
rm -rf $RPM_BUILD_ROOT
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/bin \
$RPM_BUILD_ROOT%{l_prefix}/lib \
$RPM_BUILD_ROOT%{l_prefix}/include \
$RPM_BUILD_ROOT%{l_prefix}/man/man1
%if "%{with_v3}" == "yes"
( cd sqlite-%{V_v3}
%{l_make} %{l_mflags} install \
prefix=$RPM_BUILD_ROOT%{l_prefix}
%{l_shtool} install -c -m 644 \
sqlite3.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/sqlite3.1
) || exit $?
%endif
( cd sqlite-%{V_v2}
%{l_make} %{l_mflags} install \
prefix=$RPM_BUILD_ROOT%{l_prefix}
%{l_shtool} install -c -m 644 \
sqlite.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/sqlite.1
) || exit $?
strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
%{l_files_std} \
'%not %dir %{l_prefix}/lib/pkgconfig'
%files -f files
%clean
rm -rf $RPM_BUILD_ROOT