--- /dev/null
+%global tarversion 3330000
+
+Name: sqlite
+Version: 3.33.0
+Release: 0
+License: Public-Domain
+Summary: Embeddable SQL Database Engine
+Url: http://www.sqlite.org/
+Group: System/Database
+Source0: sqlite-autoconf-%{tarversion}.tar.gz
+Source1: baselibs.conf
+Source2: sqlite_journal_mode_persist.patch
+Source3: sqlite_default_flag.patch
+Source1001: sqlite.manifest
+BuildRequires: pkgconfig(pkg-config)
+Requires: libsqlite = %{version}
+Provides: sqlite3
+
+%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.
+
+SQLite is not a client library used to connect to a big database
+server. SQLite is a server and the SQLite library reads and writes
+directly to and from the database files on disk.
+
+SQLite can be used via the sqlite command line tool or via any
+application that supports the Qt database plug-ins.
+
+%package -n libsqlite
+Summary: Shared libraries for the Embeddable SQL Database Engine
+Group: System/Database
+Provides: libsqlite3
+
+%description -n libsqlite
+This package contains the shared libraries for the Embeddable SQL
+Database Engine.
+
+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.
+
+SQLite is not a client library used to connect to a big database
+server. SQLite is a server and the SQLite library reads and writes
+directly to and from the database files on disk.
+
+SQLite can be used via the sqlite command line tool or via any
+application that supports the Qt database plug-ins.
+
+%package devel
+Summary: Embeddable SQL Database Engine
+Group: Development/Libraries
+Requires: glibc-devel
+Requires: libsqlite = %{version}
+Requires: sqlite
+Provides: sqlite3-devel = %{version}
+Obsoletes: sqlite3-devel < %{version}
+Conflicts: sqlcipher-devel
+
+%description devel
+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.
+
+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.
+
+SQLite can be used via the sqlite command-line tool or via any
+application which supports the Qt database plug-ins.
+
+%prep
+%setup -q -n sqlite-autoconf-%tarversion
+cp %{SOURCE1001} .
+%{__patch} -p1 < %{SOURCE2}
+%{__patch} -p1 < %{SOURCE3}
+
+%build
+CFLAGS=`echo %{optflags} |sed -e 's/-ffast-math//g'`
+CFLAGS+=" -fPIE"
+LDFLAGS+=" -pie"
+%{?asan:CFLAGS+=" -lpthread -ldl "}
+chmod +x autogen.sh
+%autogen
+%configure -disable-dependency-tracking \
+ --enable-shared=yes \
+ --enable-static=no \
+ --enable-threadsafe \
+ --enable-fts5
+
+make
+
+%install
+%make_install
+
+%post -n libsqlite -p /sbin/ldconfig
+
+%postun -n libsqlite -p /sbin/ldconfig
+
+%files
+%manifest %{name}.manifest
+%defattr(-,root,root)
+%{_bindir}/sqlite3
+
+%files -n libsqlite
+%manifest %{name}.manifest
+%defattr(-,root,root)
+%{_libdir}/libsqlite*.so.*
+
+%files devel
+%manifest %{name}.manifest
+%defattr(-,root,root)
+%{_includedir}/*.h
+%{_libdir}/libsqlite*.so
+%{_libdir}/pkgconfig/sqlite3.pc
+
+%docs_package
--- /dev/null
+diff --git a/Makefile.am b/Makefile.am
+index 20af743..8c76d57 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -1,5 +1,18 @@
+
+-AM_CFLAGS = @BUILD_CFLAGS@
++AM_CFLAGS = @BUILD_CFLAGS@ \
++ -DSQLITE_ENABLE_COLUMN_METADATA \
++ -DSQLITE_ENABLE_MEMORY_MANAGEMENT \
++ -DSQLITE_DEFAULT_AUTOVACUUM=1 \
++ -DSQLITE_DEFAULT_PAGE_SIZE=4096 \
++ -Dfdatasync=fdatasync \
++ -DSQLITE_TIZEN_FEATURE \
++ -DSQLITE_TEMP_STORE=2 \
++ -DHAVE_USLEEP=1 \
++ -DSQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=4194304 \
++ -DSQLITE_DEFAULT_FILE_FORMAT=4 \
++ -DSQLITE_POWERSAFE_OVERWRITE=1 \
++ -DSQLITE_ENABLE_ATOMIC_WRITE
++
+ lib_LTLIBRARIES = libsqlite3.la
+ libsqlite3_la_SOURCES = sqlite3.c
+ libsqlite3_la_LDFLAGS = -no-undefined -version-info 8:6:8