This is a short hands-on tutorial on creating SQLite 3 RPM packages for Enterprise Linux, including, but not limited to, Red Hat Enterprise Linux (RHEL), CentOS and Scientific Linux (SL).

SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. SQLite is the most widely deployed SQL database engine in the world. The source code for SQLite is in the public domain.” — source

NOTE: The commands on this guide were tested on both CentOS 6.2 and Scientific Linux 6.2 (2.6.32-220.17.1.el6.x86_64) virtual machines, using the SQLite 3.7.12.

To build the RPM packages we first need to setup an RPM development environment as described on the article: How to set up a build environment for RPM packages on Enterprise Linux.

Once the development environment is correctly setup, login as as root and install the additional required packages:

$ su root
# yum install ncurses-devel readline-devel glibc-devel
# exit

Log in as makerpm user and create the following SPEC file on ~/rpmbuild/SPECS:

$ cd ~/rpmbuild/SPECS
$ touch sqlite.spec
$ cat > sqlite.spec

Copy and paste the following code:

%define realver 3071200
%define docver 3071200
%define rpmver 3.7.12

Summary:		Library that implements an embeddable SQL database engine
Name:			sqlite
Version:		%{rpmver}
Release:		1%{?dist}
License:		Public Domain
Group:			Applications/Databases
Source0:		sqlite-autoconf-%{realver}.tar.gz

BuildRequires:	ncurses-devel readline-devel glibc-devel

BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

SQLite is a C library that implements an SQL database engine. A large
subset of SQL92 is supported. A complete database is stored in a
single disk file. The API is designed for convenience and ease of use.
Applications that link against SQLite can enjoy the power and
flexibility of an SQL database without the administrative hassles of
supporting a separate database server.  Version 2 and version 3 binaries
are named to permit each to be installed on a single host

%package devel
Summary: Development tools for the sqlite3 embeddable SQL database engine
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
Requires: pkgconfig

%description devel
This package contains the header files and development documentation
for %{name}. If you like to develop programs using %{name}, you will need
to install %{name}-devel.

%setup -n %{name}-autoconf-%{realver}



make clean

%defattr(-, root, root)

%files devel
%defattr(-, root, root)
%exclude %{_libdir}/*.la

* Thu May 17 2012 Nicola Asuni - 3.7.12-1
- First version or autoconf.

Press [Ctrl]-[D] to end.

Copy the SQLite source code to the ~/rpmbuild/SOURCES:

$ cd ~/rpmbuild/SOURCES
$ wget

The SQLite source file is a tarball containing the amalgamation for SQLite 3.7.12 together with a configuration script and makefile for building it.

To create the RPM packages you can use the following commands:

$ cd ~/rpmbuild/SPECS
$ QA_RPATHS=$[ 0x0001|0x0010 ] rpmbuild -ba sqlite.spec

You should now find the RPM packages at ~/rpmbuild/RPMS/$(uname -m).
The sqlite-devel package contains the header files required to embed the SQLite on other programs.

To install them you can type:

$cd ~/rpmbuild/RPMS/x86_64/
$su root
#rpm -U --force sqlite-3.7.12-1.el6.x86_64.rpm sqlite-devel-3.7.12-1.el6.x86_64.rpm

Labs Technology

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. […] Please follow the instructions on the follow guides to create and install the RPM packages: How to create SQLite 3 RPM packages for Enterprise Linux, How to create SystemTap 7 RPM packages for Enterprise […]

  2. Michael says:

    This saved my hind-end, thanks. I ended-up having to use /usr/src .. instead of my home dir but it still worked like magic.

  3. Faiz Shiraji Doller says:

    Your tutorial is for SQLite 3.7.12 / SQLite-devel 3.7.12 But, If I want to make rpm of sqlite-devel-3.0.0 then what to do. I am finding the rpm of sqlite-devel-3.0.0 last 7 days. but I cannot find. And now I find your blog. But it is also upgraded version which is easily find in web. I cannot find the source code also. So, please help me.

    Best regards,