File mingw64-ktoblzcheck.spec of Package mingw64-ktoblzcheck

# Copyright (c) 2005-2008 oc2pus
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments to toni@links2linux.de

# norootforbuild

%define with_python     1
%define _name   ktoblzcheck
Name:           mingw64-%{_name}
Summary:        A library to check account numbers and bank codes of German banks
Version:        1.53
Release:        1.2
Source:         http://downloads.sourceforge.net/project/%{_name}/%{_name}-%{version}.tar.gz
Group:          Productivity/Office/Finance
License:        LGPL-2.1-only
URL:            http://ktoblzcheck.sourceforge.net
BuildRequires:  mingw64-cross-cmake
BuildRequires:  doxygen
BuildRequires:  mingw64-cross-gcc-c++
BuildRequires:  mingw64-cross-pkg-config
%if %{with_python}
BuildRequires:  mingw64-python
BuildRequires:  mingw64-python-devel
BuildRequires:  python
%endif
%_mingw64_package_header_debug
BuildArch:      noarch

%description
KtoBLZCheck is a library to check account numbers and bank codes
of German banks. Both a library for other programs as well as a
short command-line tool is available. It is possible to check
pairs of account numbers and bank codes (BLZ) of German banks,
and to map bank codes (BLZ) to the clear-text name and location
of the bank.

Authors:
Fabian Kaiser <fabian@openhbci.de>
Christian Stimming <stimming@tuhh.de>

%package devel
Summary:    Libraries, includes etc to develop with ktoblzcheck library
Group:      Development/Libraries/C and C++
Requires:   mingw64-libktoblzcheck1 = %{version}
Provides:   mingw64-lib%{_name}1-devel = %{version}
Obsoletes:  mingw64-lib%{_name}1-devel < %{version}

%description devel
Libraries, includes etc to develop with ktoblzcheck library.

Authors:
Fabian Kaiser <fabian@openhbci.de>
Christian Stimming <stimming@tuhh.de>

%package -n mingw64-lib%{_name}1
Summary:    Shared Libraries for ktoblzcheck
Group:      System/Libraries

%description -n mingw64-lib%{_name}1
Shared Libraries for ktoblzcheck.

Authors:
Fabian Kaiser <fabian@openhbci.de>
Christian Stimming <stimming@tuhh.de>

%if %{with_python}
%package -n mingw64-python-%{_name}
Summary:    KtoBLZCheck python-bindings
Group:      Development/Libraries/Python
Requires:   %{name} = %{version}
Requires:   mingw64-lib%{_name}1 = %{version}
Requires:   mingw64-python >= 2.3

%description -n mingw64-python-%{_name}
This package contains the python-bindings for ktoblzcheck.

Authors:
Fabian Kaiser <fabian@openhbci.de>
Christian Stimming <stimming@tuhh.de>
%endif

%_mingw64_debug_package

%prep
%autosetup -p1 -n %{_name}-%{version}

%build
%_mingw64_cmake -DINSTALL_RAW_BANKDATA_FILE=1 -DENABLE_BANKDATA_DOWNLOAD=0
%_mingw64_cmake_build

%install
%if %{with_python}
%define _mingw64_py_dir %(echo `find %{_mingw64_libdir} -name 'python*' -type d`)
%define _mingw64_py_sitedir %{_mingw64_py_dir}/site-packages
%_mingw64_cmake_install  DESTDIR=%{buildroot} pythondir=%{buildroot}%{_mingw64_py_sitedir}

# Fix for Python files being installed in a host-specific Python directory.
# There seems to be a problem with the find_package support for Python provided by cmake,
# which finds the host's Python installation when it was actually restricted to the
# mingw64 prefix by mingw64-cmake.
if test -d %{buildroot}%{py_sitedir}/; then
    mkdir -p %{buildroot}%{_mingw64_py_sitedir}
    mv %{buildroot}%{py_sitedir}/* %{buildroot}%{_mingw64_py_sitedir}
    rm -rf %{buildroot}%{py_sitedir}
fi

if test -f %{buildroot}%{_mingw64_py_sitedir}/*.pyc; then
    rm %{buildroot}%{_mingw64_py_sitedir}/*.pyc
fi
if test -f %{buildroot}%{_mingw64_py_sitedir}/*.pyo; then
    rm %{buildroot}%{_mingw64_py_sitedir}/*.pyo
fi
%else
%_mingw64_cmake_install DESTDIR=%{buildroot}
%endif
# make copy for aqbanking
cp %{buildroot}%{_mingw64_datadir}/%{_name}/bankdata*.txt %{buildroot}%{_mingw64_datadir}/%{_name}/bankdata.txt
cp %{buildroot}%{_mingw64_datadir}/%{_name}/blz*.txt %{buildroot}%{_mingw64_datadir}/%{_name}/blz.txt 

%clean
[ -d "%{buildroot}" -a "%{buildroot}" != "" ] && %__rm -rf "%{buildroot}"

%files
%defattr(-,root,root)
%doc AUTHORS README.md COPYING ChangeLog NEWS
%{_mingw64_bindir}/%{_name}.exe
%{_mingw64_bindir}/ibanchk.exe
%{_mingw64_mandir}/man1/*.1*
%dir %{_mingw64_datadir}/%{_name}
%{_mingw64_datadir}/%{_name}/ibandata.txt
%{_mingw64_datadir}/%{_name}/bankdata*.txt
%{_mingw64_datadir}/%{_name}/blz*.txt

%files -n mingw64-lib%{_name}1
%defattr(-,root,root)
%{_mingw64_bindir}/*.dll

%files devel
%defattr(-,root,root)
%doc AUTHORS README.md COPYING ChangeLog NEWS
%{_mingw64_datadir}/doc/%{_name}
%{_mingw64_libdir}/*.dll.a
%{_mingw64_libdir}/cmake/KtoBlzCheck
%{_mingw64_libdir}/pkgconfig/%{_name}.pc
%{_mingw64_includedir}/%{_name}.h
%{_mingw64_includedir}/iban.h

%if %{with_python}
%files -n mingw64-python-%{_name}
%defattr(-,root,root)
%dir %{_mingw64_py_dir}
%dir %{_mingw64_py_sitedir}
%{_mingw64_py_sitedir}/*
%endif

%changelog
openSUSE Build Service is sponsored by