You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
281 lines
9.3 KiB
281 lines
9.3 KiB
## |
|
## sqlite.spec -- OpenPKG RPM Package Specification |
|
## Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/> |
|
## Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/> |
|
## |
|
## 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_v3 3.3.8 |
|
%define V_v2 2.8.17 |
|
%define V_odbc 0.70 |
|
|
|
# package information |
|
Name: sqlite |
|
Summary: SQL Lite |
|
URL: http://www.sqlite.org/ |
|
Vendor: D. Richard Hipp |
|
Packager: OpenPKG Foundation e.V. |
|
Distribution: OpenPKG Community |
|
Class: BASE |
|
Group: Database |
|
License: PD |
|
Version: %{V_v3} |
|
Release: 20061229 |
|
|
|
# package options |
|
%option with_v2 yes |
|
%option with_utf8 no |
|
%option with_assert no |
|
%option with_readline no |
|
%option with_fts1 no |
|
%option with_odbc no |
|
|
|
# list of sources |
|
Source0: http://www.sqlite.org/sqlite-%{V_v3}.tar.gz |
|
Source1: http://www.sqlite.org/sqlite-%{V_v2}.tar.gz |
|
Source2: http://www.ch-werner.de/sqliteodbc/sqliteodbc-%{V_odbc}.tar.gz |
|
Patch0: sqlite.patch |
|
|
|
# build information |
|
Prefix: %{l_prefix} |
|
BuildRoot: %{l_buildroot} |
|
BuildPreReq: OpenPKG, openpkg >= 20040130, make, gawk |
|
PreReq: OpenPKG, openpkg >= 20040130 |
|
%if "%{with_readline}" == "yes" |
|
BuildPreReq: readline, pkgconfig |
|
PreReq: readline |
|
%endif |
|
%if "%{with_odbc}" == "yes" |
|
BuildPreReq: ODBC |
|
PreReq: ODBC |
|
%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 3 (%{V_v3}) and optionally the old |
|
SQLite 2 (%{V_v2}). Notice that the two are API and database format |
|
incompatible but can be used in parallel (on different databases). |
|
Additionally, this package optionally provides the SQLite ODBC driver. |
|
|
|
%track |
|
prog sqlite = { |
|
version = %{V_v3} |
|
url = http://www.sqlite.org/download.html |
|
regex = sqlite-(\d+\.\d+\.\d+)\.tar\.gz |
|
} |
|
prog sqlite:v2 = { |
|
disabled |
|
comment = "rse: SQLite 2.x no longer available for download" |
|
version = %{V_v2} |
|
url = http://www.sqlite.org/download.html |
|
regex = sqlite-(2\.\d+\.\d+)\.tar\.gz |
|
} |
|
prog sqlite:odbc = { |
|
version = %{V_odbc} |
|
url = http://www.ch-werner.de/sqliteodbc/ |
|
regex = sqliteodbc-(__VER__)\.tar\.gz |
|
} |
|
|
|
%prep |
|
%setup -q -c |
|
%setup -q -D -T -a 1 |
|
%setup -q -D -T -a 2 |
|
%patch -p0 |
|
|
|
# post-adjust sources |
|
chmod a+x sqlite-%{V_v2}/install-sh |
|
%{l_shtool} subst \ |
|
-e '/LINENO: error: C[+]* preprocessor/{N;N;N;N;s/.*/:/;}' \ |
|
sqlite-%{V_v3}/configure sqlite-%{V_v2}/configure |
|
|
|
%build |
|
# configure and build SQLite 3 and optionally SQLite 2 |
|
for v in %{V_v3} \ |
|
%if "%{with_v2}" == "yes" |
|
%{V_v2} \ |
|
%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} `%{l_prefix}/bin/pkg-config --cflags readline`" |
|
export config_TARGET_READLINE_INC |
|
config_TARGET_READLINE_LIBS="%{l_ldflags} `%{l_prefix}/bin/pkg-config --libs readline`" |
|
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 |
|
MFLAGS="" |
|
%if "%{with_fts1}" == "yes" |
|
case $v in |
|
3.* ) MFLAGS="$MFLAGS FTS1=1" ;; |
|
esac |
|
%endif |
|
%{l_make} %{l_mflags -O} $MFLAGS |
|
) || exit $? |
|
done |
|
|
|
# optionally build ODBC driver |
|
%if "%{with_odbc}" == "yes" |
|
( cd sqliteodbc-%{V_odbc} |
|
export CC="%{l_cc}" |
|
export CFLAGS="%{l_cflags -O}" |
|
export CPPFLAGS="" |
|
export LDFLAGS="" |
|
CPPFLAGS="$CPPFLAGS -I../sqlite-%{V_v3}" |
|
LDFLAGS="$LDFLAGS -L../sqlite-%{V_v3}/.libs" |
|
%if "%{with_v2}" == "yes" |
|
CPPFLAGS="$CPPFLAGS -I../sqlite-%{V_v2}" |
|
LDFLAGS="$LDFLAGS -L../sqlite-%{V_v2}/.libs" |
|
%endif |
|
./configure \ |
|
--prefix=%{l_prefix} \ |
|
--with-sqlite3=../sqlite-%{V_v3} \ |
|
%if "%{with_v2}" == "yes" |
|
--with-sqlite=../sqlite-%{V_v2} \ |
|
%endif |
|
--with-odbc=%{l_prefix} \ |
|
--disable-static \ |
|
--enable-shared |
|
%{l_make} %{l_mflags -O} |
|
) || exit $? |
|
%endif |
|
|
|
%install |
|
# create installation hierarchy |
|
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 |
|
|
|
# install SQLite 3 |
|
( 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 $? |
|
|
|
# install SQLite 2 (optional) |
|
%if "%{with_v2}" == "yes" |
|
( 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 $? |
|
%endif |
|
|
|
# install SQLite ODBC driver (optional) |
|
%if "%{with_odbc}" == "yes" |
|
( cd sqliteodbc-%{V_odbc} |
|
%{l_make} %{l_mflags} install \ |
|
prefix=$RPM_BUILD_ROOT%{l_prefix} |
|
) || exit $? |
|
%endif |
|
|
|
# strip down installation files |
|
strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true |
|
|
|
# determine installation files |
|
%{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 |
|
|
|
%post |
|
if [ $1 -eq 1 ]; then : ; |
|
# optionally link into ODBC |
|
%if "%{with_odbc}" == "yes" |
|
( echo "[SQLite3]" |
|
echo "Description = SQLite 3 ODBC Driver" |
|
echo "Driver = $RPM_INSTALL_PREFIX/lib/libsqlite3odbc.so" |
|
echo "Setup = $RPM_INSTALL_PREFIX/lib/libsqlite3odbc.so" |
|
echo "FileUsage = 1" |
|
) | $RPM_INSTALL_PREFIX/bin/odbcinst -i -d -n "SQLite3" -r >/dev/null 2>&1 || true |
|
( echo "[SQLite3 DataSource]" |
|
echo "Driver = SQLite3" |
|
) | $RPM_INSTALL_PREFIX/bin/odbcinst -i -s -l -n "SQLite3 DataSource" -r >/dev/null 2>&1 || true |
|
%if "%{with_v2}" == "yes" |
|
( echo "[SQLite]" |
|
echo "Description = SQLite 2 ODBC Driver" |
|
echo "Driver = $RPM_INSTALL_PREFIX/lib/libsqliteodbc.so" |
|
echo "Setup = $RPM_INSTALL_PREFIX/lib/libsqliteodbc.so" |
|
echo "FileUsage = 1" |
|
) | $RPM_INSTALL_PREFIX/bin/odbcinst -i -d -n "SQLite" -r >/dev/null 2>&1 || true |
|
( echo "[SQLite DataSource]" |
|
echo "Driver = SQLite" |
|
) | $RPM_INSTALL_PREFIX/bin/odbcinst -i -s -l -n "SQLite DataSource" -r >/dev/null 2>&1 || true |
|
%endif |
|
%endif |
|
fi |
|
|
|
%preun |
|
if [ $1 -eq 1 ]; then : ; |
|
# optionally unlink from ODBC |
|
%if "%{with_odbc}" == "yes" |
|
$RPM_INSTALL_PREFIX/bin/odbcinst -u -s -l -n "SQLite3 DataSource" >/dev/null 2>&1 || true |
|
$RPM_INSTALL_PREFIX/bin/odbcinst -u -d -n "SQLite3" >/dev/null 2>&1 || true |
|
%if "%{with_v2}" == "yes" |
|
$RPM_INSTALL_PREFIX/bin/odbcinst -u -s -l -n "SQLite DataSource" >/dev/null 2>&1 || true |
|
$RPM_INSTALL_PREFIX/bin/odbcinst -u -d -n "SQLite" >/dev/null 2>&1 || true |
|
%endif |
|
%endif |
|
fi |
|
|
|
|