File mdbtools.spec of Package mdbtools

#
# spec file for package mdbtools
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#


%define gnome_prefix %(pkg-config libgnomeui-2.0 --variable=prefix)
%define gnome_datadir %{gnome_prefix}/share
%define libmdb    libmdb2
%define libmdbsql libmdbsql2
Name:           mdbtools
Version:        0.7.1
Release:        0
Summary:        A Suite of Libraries and Programs to Access Microsoft Access Databases
License:        GPL-2.0+
Group:          Productivity/Databases/Tools
Url:            https://github.com/brianb/mdbtools
Source:         https://github.com/brianb/mdbtools/archive/%{version}.tar.gz
Source1:        gmdb2.desktop
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  bison
BuildRequires:  flex
BuildRequires:  gnome-common
BuildRequires:  gtk-doc
BuildRequires:  libglade2-devel
BuildRequires:  libgnomeui-devel
BuildRequires:  libtool
BuildRequires:  libxml2-devel
BuildRequires:  pkg-config
BuildRequires:  readline-devel
BuildRequires:  scrollkeeper
BuildRequires:  txt2man
BuildRequires:  unixODBC-devel
BuildRequires:  update-desktop-files
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Mdbtools contains:
mdb-dump -- simple hex dump utility for looking at mdb files
mdb-schema -- prints DDL for the specified table
mdb-export -- export table to CSV format
mdb-tables -- a simple dump of table names to be used with shell scripts
mdb-header -- generates a C header to be used in exporting mdb data to a C prog
mdb-parsecvs -- generates a C program given a CSV file made with mdb-export
mdb-sql -- demo SQL engine program
mdb-ver -- print version of database

%package devel
Summary:        All files necessary for development with the MDB Tools libraries
Group:          Development/Libraries/C and C++
Requires:       %{libmdbsql} = %{version}
Requires:       %{libmdb} = %{version}
Requires:       flex
Requires:       glib2-devel
Requires:       unixODBC-devel

%description devel
Mdbtools contains:
mdb-dump -- simple hex dump utility for looking at mdb files
mdb-schema -- prints DDL for the specified table
mdb-export -- export table to CSV format
mdb-tables -- a simple dump of table names to be used with shell scripts
mdb-header -- generates a C header to be used in exporting mdb data to a C prog
mdb-parsecvs -- generates a C program given a CSV file made with mdb-export
mdb-sql -- demo SQL engine program
mdb-ver -- print version of database

%package gui
Summary:        A Suite of libraries and programs to access Microsoft Access databases
Group:          Productivity/Databases/Tools
Requires(post): update-desktop-files
Requires(postun): update-desktop-files

%description gui
Mdbtools contains:
mdb-dump -- simple hex dump utility for looking at mdb files
mdb-schema -- prints DDL for the specified table
mdb-export -- export table to CSV format
mdb-tables -- a simple dump of table names to be used with shell scripts
mdb-header -- generates a C header to be used in exporting mdb data to a C prog
mdb-parsecvs -- generates a C program given a CSV file made with mdb-export
mdb-sql -- demo SQL engine program
mdb-ver -- print version of database

%package -n %{libmdb}
Summary:        MDB Tools ODBC driver for unixODBC
Group:          Productivity/Databases/Tools

%description -n %{libmdb}
Contains shared library %{libmdb} from %{name}

%package -n %{libmdbsql}
Summary:        MDB Tools ODBC driver for unixODBC
Group:          Productivity/Databases/Tools

%description -n %{libmdbsql}
Contains shared library %{libmdbsql} from %{name}

%prep
%setup -q

%build
autoreconf -fiv
%configure \
  --disable-static \
  --with-pic \
  --enable-sql \
  --with-unixodbc=%{_prefix} \
  --enable-gtk-doc
make %{?_smp_mflags} V=1

%check
make %{?_smp_mflags} check

%install
make DESTDIR=%{buildroot} install %{?_smp_mflags}
install -D -m 0644 %{SOURCE1} %{buildroot}%{gnome_datadir}/applications/gmdb2.desktop
%suse_update_desktop_file gmdb2 Office Database
find %{buildroot} -type f -name "*.la" -delete -print

%post -n %{libmdb} -p /sbin/ldconfig

%post -n %{libmdbsql} -p /sbin/ldconfig

%post gui
%desktop_database_post

%postun -n %{libmdb} -p /sbin/ldconfig

%postun -n %{libmdbsql} -p /sbin/ldconfig

%postun gui
%desktop_database_postun

%files
%defattr(-,root,root)
%doc README AUTHORS COPYING NEWS HACKING ChangeLog TODO
%{_bindir}/mdb-*
%{_mandir}/man1/mdb-*

%files -n %{libmdb}
%defattr(-,root,root)
%{_libdir}/libmdb.so.2
%{_libdir}/libmdb.so.2.0.1

%files -n %{libmdbsql}
%defattr(-,root,root)
%{_libdir}/libmdbsql.so.2
%{_libdir}/libmdbsql.so.2.0.0

%files devel
%defattr(-,root,root)
%{_includedir}/mdb*.h
%{_includedir}/gmdb.h
%{_libdir}/libmdbsql.so
%{_libdir}/libmdb.so
%{_libdir}/libmdbodbc.so
%{_libdir}/libmdbodbcW.so
%{_libdir}/pkgconfig/libmdb.pc
%{_libdir}/pkgconfig/libmdbsql.pc

%files gui
%defattr(-,root,root)
%{gnome_prefix}/bin/gmdb2
%{gnome_datadir}/gmdb
%doc %{gnome_datadir}/gnome/help/gmdb
%{gnome_datadir}/applications/gmdb2.desktop
%dir %{_datadir}/omf
%dir %{_datadir}/omf/mdbtools
%{_datadir}/omf/mdbtools/gmdb-C.omf
%{_mandir}/man1/gmdb2.1.*

%changelog
openSUSE Build Service is sponsored by