|
|
@@ -23,8 +23,9 @@
|
|
|
##
|
|
|
|
|
|
# package version
|
|
|
-%define V_v3 3.3.8
|
|
|
-%define V_v2 2.8.17
|
|
|
+%define V_v3 3.3.8
|
|
|
+%define V_v2 2.8.17
|
|
|
+%define V_odbc 0.69
|
|
|
|
|
|
# package information
|
|
|
Name: sqlite
|
|
|
@@ -45,12 +46,13 @@ Release: 20061218
|
|
|
%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
|
|
|
-Patch1: sqlite.patch.v2
|
|
|
|
|
|
# build information
|
|
|
Prefix: %{l_prefix}
|
|
|
@@ -61,6 +63,10 @@ PreReq: OpenPKG, openpkg >= 20040130
|
|
|
BuildPreReq: readline, pkgconfig
|
|
|
PreReq: readline
|
|
|
%endif
|
|
|
+%if "%{with_odbc}" == "yes"
|
|
|
+BuildPreReq: ODBC
|
|
|
+PreReq: ODBC
|
|
|
+%endif
|
|
|
AutoReq: no
|
|
|
AutoReqProv: no
|
|
|
|
|
|
@@ -78,6 +84,7 @@ AutoReqProv: no
|
|
|
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 = {
|
|
|
@@ -92,26 +99,26 @@ AutoReqProv: no
|
|
|
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
|
|
|
- %patch -p0 -d sqlite-%{V_v3} -P 0
|
|
|
-%if "%{with_v2}" == "yes"
|
|
|
- %patch -p0 -d sqlite-%{V_v2} -P 1
|
|
|
-%endif
|
|
|
+ %setup -q -D -T -a 2
|
|
|
+ %patch -p0
|
|
|
+
|
|
|
+ # post-adjust sources
|
|
|
chmod a+x sqlite-%{V_v2}/install-sh
|
|
|
- for v in %{V_v3} \
|
|
|
-%if "%{with_v2}" == "yes"
|
|
|
- %{V_v2} \
|
|
|
-%endif
|
|
|
- ; do
|
|
|
- %{l_shtool} subst \
|
|
|
- -e '/LINENO: error: C[+]* preprocessor/{N;N;N;N;s/.*/:/;}' \
|
|
|
- sqlite-$v/configure
|
|
|
- done
|
|
|
+ %{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} \
|
|
|
@@ -158,19 +165,50 @@ AutoReqProv: no
|
|
|
) || 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 \
|
|
|
@@ -179,7 +217,19 @@ AutoReqProv: no
|
|
|
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'
|
|
|
@@ -189,3 +239,43 @@ AutoReqProv: no
|
|
|
%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 0 ]; 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
|
|
|
+
|