File sqliteodbc.spec of Package sqliteodbc

#
# spec file for package sqliteodbc
#
# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


Name:           sqliteodbc
Version:        0.9998
Release:        oe2403sp1
Summary:        ODBC driver for SQLite
License:        BSD-2-Clause
Group:          Development/Libraries/C and C++
URL:            http://www.ch-werner.de/sqliteodbc
Source0:        http://www.ch-werner.de/sqliteodbc/%{name}-%{version}.tar.gz
# This is not typical shared library but plugin for unixODBC
Source1:        %{name}-rpmlintrc
BuildRequires:  dos2unix
BuildRequires:  doxygen
BuildRequires:  graphviz
BuildRequires:  libxml2
BuildRequires:  sqlite-devel
BuildRequires:  unixODBC
BuildRequires:  zlib-devel
Requires:       unixODBC
Requires(post): unixODBC
Requires(preun): unixODBC

%description
ODBC driver for SQLite interfacing SQLite 3.x using the
unixODBC or iODBC driver managers. For more information refer to
http://www.sqlite.org    -  SQLite engine
http://www.unixodbc.org  -  unixODBC Driver Manager
http://www.iodbc.org     -  iODBC Driver Manager

%package doc
Summary:        Documentation for %{name}
Group:          Documentation/HTML

%description doc
ODBC driver for SQLite interfacing SQLite 3.x using the
unixODBC or iODBC driver managers. This package contains generated
documentation.

%prep
%setup -q
# Fix bug https://bugzilla.novell.com/show_bug.cgi?id=969496
# No more changing time stamp for every time this builds
echo "HTML_TIMESTAMP         = NO" >> doxygen.conf

%build
%configure \
	--enable-static=no
%make_build all doxy
dos2unix README

%install
mkdir -p %{buildroot}%{_libdir}
%make_install
find %{buildroot} -type f \( -name '*.a' -o -name '*.la' \) -delete -print

%post
/sbin/ldconfig
if [ -x %{_bindir}/odbcinst ] ; then
	INST=$(%{_bindir}/mktemp)

	if [ -r %{_libdir}/libsqliteodbc.so ] ; then
		%{_bindir}/cat > $INST <<- 'EOD'
			[SQLITE]
			Description=SQLite ODBC 2.X
			Driver=%{_libdir}/libsqliteodbc.so
			Setup=%{_libdir}/libsqliteodbc.so
			Threading=2
			FileUsage=1
		EOD

		%{_bindir}/odbcinst -q -d -n SQLITE | %{_bindir}/grep '^\[SQLITE\]' >/dev/null || {
			%{_bindir}/odbcinst -i -d -n SQLITE -f $INST || true
		}

		%{_bindir}/cat > $INST <<- 'EOD'
			[SQLite Datasource]
			Driver=SQLITE
		EOD

		%{_bindir}/odbcinst -q -s -n "SQLite Datasource" | \
		%{_bindir}/grep '^\[SQLite Datasource\]' >/dev/null || {
			%{_bindir}/odbcinst -i -l -s -n "SQLite Datasource" -f $INST || true
		}
	fi

	if [ -r %{_libdir}/libsqlite3odbc.so ] ; then
		%{_bindir}/cat > $INST <<- 'EOD'
			[SQLITE3]
			Description=SQLite ODBC 3.X
			Driver=%{_libdir}/libsqlite3odbc.so
			Setup=%{_libdir}/libsqlite3odbc.so
			Threading=2
			FileUsage=1
		EOD

		%{_bindir}/odbcinst -q -d -n SQLITE3 | %{_bindir}/grep '^\[SQLITE3\]' >/dev/null || {
			%{_bindir}/odbcinst -i -d -n SQLITE3 -f $INST || true
		}

		%{_bindir}/cat > $INST <<- 'EOD'
			[SQLite3 Datasource]
			Driver=SQLITE3
		EOD

		%{_bindir}/odbcinst -q -s -n "SQLite3 Datasource" | \
		%{_bindir}/grep '^\[SQLite3 Datasource\]' >/dev/null || {
			%{_bindir}/odbcinst -i -l -s -n "SQLite3 Datasource" -f $INST || true
		}
	fi

	%{_bindir}/rm -f $INST || true
fi

%preun
if [ "$1" = "0" ] ; then
	test -x %{_bindir}/odbcinst && {
		%{_bindir}/odbcinst -u -d -n SQLITE || true
		%{_bindir}/odbcinst -u -l -s -n "SQLite Datasource" || true
		%{_bindir}/odbcinst -u -d -n SQLITE3 || true
		%{_bindir}/odbcinst -u -l -s -n "SQLite3 Datasource" || true
	}

	true
fi

%postun -p /sbin/ldconfig

%files
%license license.terms
%doc README ChangeLog
%{_libdir}/libsqlite3_mod_blobtoxy-%{version}.so
%{_libdir}/libsqlite3_mod_blobtoxy.so
%{_libdir}/libsqlite3_mod_csvtable-%{version}.so
%{_libdir}/libsqlite3_mod_csvtable.so
%{_libdir}/libsqlite3_mod_impexp-%{version}.so
%{_libdir}/libsqlite3_mod_impexp.so
%{_libdir}/libsqlite3_mod_xpath-%{version}.so
%{_libdir}/libsqlite3_mod_xpath.so
%{_libdir}/libsqlite3_mod_zipfile-%{version}.so
%{_libdir}/libsqlite3_mod_zipfile.so
%{_libdir}/libsqlite3odbc-%{version}.so
%{_libdir}/libsqlite3odbc.so

%files doc
%license license.terms
%doc README ChangeLog
%doc html

%changelog
* Mon Aug 17 2020 Dirk Mueller <dmueller@suse.com>
- update to 0.9998
  * update to SQLite 3.32.3
  * make all comparisons for table names etc. in SQLTables()
    and friends case insensitive (thanks Kris Habraken for
    initial fix)
  * update to SQLite 3.32.2
  * fix info for SQL_OUTER_JOINS/SQL_OJ_CAPABILITIES
  * provide more clean quote hints in type info
  * improve SQLBulkOperations()
  * better deal with auto column names in csvtable module
* Mon May  4 2020 Martin Pluskal <mpluskal@suse.com>
- Adjust scriplets to resolve boo#1171041 CVE-2020-12050
* Mon Mar 18 2019 Tuukka Pasanen <tuukka.pasanen@ilmi.fi>
- Update to version 0.9996
  * update to SQLite 3.22.0
  * fixes in handling DDL in SQLExecDirect() et.al., thanks Andre Mikulec for testing
  * cleanup utf8/unicode conversion functions
* Fri Dec  9 2016 mpluskal@suse.com
- Update to version 0.9225:
  * update to SQLite 3.15.2
  * don't statically buffer result of localeconv()
  * increased some internal string buffers
  * fixes in SQLSetPos()
  * fix locking in xpath module, thanks Abramo Bagnara
- Changes for version 0.9994:
  * update to SQLite 3.13.0
  * fix to present file names with slashes to sqlite3_load_extension()
* Mon Apr  4 2016 tuukka.pasanen@ilmi.fi
- Update to 0.9223
  * update to SQLite 3.10.0
  * fixes in SQLStatistic() for decting unique indices
  * for SQLGetPrivateProfileString() try to load libodbcinst.so.2
    first, then libodbcinst.so.1
  * eliminated some valgrind warnings regarding strcpy()
  * increased max. length for data source name in Win32
    config dialog
  * configure: detect presence of sqlite3_columndatabasename()
    and sqlite3_columnoriginname()
- Doxygen.conf add 'HTML_TIMESTAMP         = NO' (boo#969496)
* Mon Feb  8 2016 mpluskal@suse.com
- Fix removal of .la and .a files
* Wed Feb  3 2016 mpluskal@suse.com
- Add missing build dependencies
* Fri Dec 18 2015 mpluskal@suse.com
- Add sqliteodbc-rpmlintrc
  * this is not regular shared library but plugin for unixODBC
* Fri Apr 17 2015 mpluskal@suse.com
- Update to 0.9992
  * update to SQLite 3.8.9
  * fixed buffer length return in SQLGetStmtAttr*()
  * report SQL_SC_SQL92_ENTRY level for
    SQLGetInfo(...SQL_SQL_CONFORMANCE...)
  * improved configure for cross-compiling
* Tue Feb 10 2015 mpluskal@suse.com
- Enable building of documentation
- Add unixODBC dependency for scriplets
* Mon Feb  9 2015 tuukka.pasanen@ilmi.fi
- New version 0.9991 released
* Mon Feb  9 2015 tuukka.pasanen@ilmi.fi
- Adding changes file to project
openSUSE Build Service is sponsored by