| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268 |
- ##
- ## sqlite.spec -- OpenPKG RPM Package Specification
- ## Copyright (c) 2000-2012 OpenPKG Foundation e.V. <http://openpkg.net/>
- ##
- ## 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_sqlite 3.7.10.0
- %define V_dist 3071000
- %define V_odbc 0.93
- %define V_jdbc 20120202
- # package information
- Name: sqlite
- Summary: Lightweight Embedded SQL Database
- 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_sqlite}
- Release: 20120206
- # package options
- %option with_debug no
- %option with_readline no
- %option with_threads no
- %option with_fts3 no
- %option with_rtree no
- %option with_odbc no
- %option with_jdbc no
- %option with_regexp yes
- # list of sources
- Source0: http://www.sqlite.org/sqlite-src-%{V_dist}.zip
- Source1: http://www.ch-werner.de/sqliteodbc/sqliteodbc-%{V_odbc}.tar.gz
- Source2: http://www.ch-werner.de/javasqlite/javasqlite-%{V_jdbc}.tar.gz
- Patch0: sqlite.patch
- Patch1: sqlite.patch.odbc
- # build information
- BuildPreReq: OpenPKG, openpkg >= 20100101, make, gawk, tcl
- PreReq: OpenPKG, openpkg >= 20100101
- %if "%{with_readline}" == "yes"
- BuildPreReq: readline, pkgconfig
- PreReq: readline
- %endif
- %if "%{with_odbc}" == "yes"
- BuildPreReq: ODBC
- PreReq: ODBC
- %endif
- %if "%{with_jdbc}" == "yes"
- BuildPreReq: java, JAVA-JDK
- PreReq: java, JAVA-JDK
- %endif
- %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.
- %track
- prog sqlite = {
- version = %{V_dist}
- url = http://www.sqlite.org/download.html
- regex = sqlite-src-(\d+)\.zip
- }
- prog sqlite:odbc = {
- version = %{V_odbc}
- url = http://www.ch-werner.de/sqliteodbc/
- regex = sqliteodbc-(__VER__)\.tar\.gz
- }
- prog sqlite:jdbc = {
- version = %{V_jdbc}
- url = http://www.ch-werner.de/javasqlite/overview-summary.html
- regex = javasqlite-(\d{8})\.tar\.gz
- }
- %prep
- %setup -q -n sqlite-src-%{V_dist}
- %patch -p0 -P 0
- %if "%{with_odbc}" == "yes"
- %setup -q -n sqlite-src-%{V_dist} -D -T -a 1
- %patch -p0 -d sqliteodbc-%{V_odbc} -P 1
- %endif
- %if "%{with_jdbc}" == "yes"
- %setup -q -n sqlite-src-%{V_dist} -D -T -a 2
- %endif
- %build
- # configure and build SQLite
- CC="%{l_cc}"
- CFLAGS="%{l_cflags -O}"
- CPPFLAGS="-I. %{l_cppflags}"
- LDFLAGS="-L. %{l_ldflags}"
- LIBS="-lm"
- export CC
- export CPPFLAGS
- export CFLAGS
- export LDFLAGS
- export LIBS
- GREP="grep" \
- ./configure \
- --prefix=%{l_prefix} \
- %if "%{with_threads}" == "yes"
- --enable-threadsafe \
- %else
- --disable-threadsafe \
- %endif
- %if "%{with_readline}" == "yes"
- --enable-readline \
- --with-readline-lib="`%{l_prefix}/bin/pkg-config --libs readline`" \
- --with-readline-inc="`%{l_prefix}/bin/pkg-config --cflags readline`" \
- %else
- --disable-readline \
- %endif
- %if "%{with_debug}" == "yes"
- --enable-debug \
- %else
- --disable-debug \
- %endif
- --disable-tcl \
- --disable-amalgamation \
- --disable-shared
- MFLAGS=""
- %if "%{with_regexp}" == "yes"
- MFLAGS="$MFLAGS REGEXP=1"
- %endif
- %if "%{with_fts3}" == "yes"
- MFLAGS="$MFLAGS FTS3=1"
- %endif
- %if "%{with_rtree}" == "yes"
- MFLAGS="$MFLAGS RTREE=1"
- %endif
- %{l_make} %{l_mflags -O} $MFLAGS
- # 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.."
- LDFLAGS="$LDFLAGS -L../.libs"
- ./configure \
- --prefix=%{l_prefix} \
- --with-sqlite3=.. \
- --with-odbc=%{l_prefix} \
- --disable-static \
- --enable-shared
- %{l_make} %{l_mflags -O}
- ) || exit $?
- %endif
- # optionally build JDBC driver
- %if "%{with_jdbc}" == "yes"
- ( cd javasqlite-%{V_jdbc}
- export JAVA_PLATFORM="sun-jdk"
- eval `%{l_prefix}/bin/java-toolkit -e`
- export CC="%{l_cc}"
- export CFLAGS="%{l_cflags -O}"
- export CPPFLAGS=""
- export LDFLAGS=""
- CPPFLAGS="$CPPFLAGS -I.."
- LDFLAGS="$LDFLAGS -L../.libs"
- ./configure \
- --prefix=%{l_prefix} \
- --with-jardir=%{l_prefix}/lib \
- --with-jdk=$JAVA_HOME \
- --with-sqlite3=..
- %{l_make} %{l_mflags}
- ) || exit $?
- %endif
- %install
- # create installation hierarchy
- %{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
- %{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
- # 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
- # install SQLite JDBC driver (optional)
- %if "%{with_jdbc}" == "yes"
- ( cd javasqlite-%{V_jdbc}
- %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
- ) || exit $?
- %endif
- # strip down installation files
- strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
- # provide convenient symlinks
- ln $RPM_BUILD_ROOT%{l_prefix}/bin/sqlite3 \
- $RPM_BUILD_ROOT%{l_prefix}/bin/sqlite
- ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/sqlite3.1 \
- $RPM_BUILD_ROOT%{l_prefix}/man/man1/sqlite.1
- # determine installation files
- %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
- %{l_files_std}
- %files -f files
- %clean
- %post
- # optionally link into ODBC
- %if "%{with_odbc}" == "yes"
- if ! $RPM_INSTALL_PREFIX/bin/odbcinst -q -d -n "SQLite3" >/dev/null 2>&1; then
- ( 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
- fi
- %endif
- %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
- %endif
- fi
|