%bcond_with qt5

Summary: A multi-platform helper library for other libraries
Name: gwenhywfar
Version: 5.9.0
Release: 1%{?_dist_release}
Group: system
Vendor: Project Vine
Distribution: Vine Linux

License: LGPLv2+
URL: https://www.aquamaniac.de/sites/aqbanking/index.php
Source0: https://github.com/aqbanking/gwenhywfar/archive/refs/tags/%{version}.tar.gz#/%{name}-%{version}.tar.gz

BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: openssl-devel
BuildRequires: gnutls-devel
BuildRequires: libgcrypt-devel
BuildRequires: gettext
%if %{with qt5}
Requires: %{name}-gui-qt5 = %{version}-%{release}
%else
Obsoletes: %{name}-gui-qt5 < 5.7.3
%endif

%description
This is Gwenhywfar, a multi-platform helper library for networking and
security applications and libraries. It is heavily used by libchipcard
and AqBanking/AqHBCI, the German online banking libraries.


%package devel
Summary: Gwenhywfar development kit
Group: programming
Requires: %{name} = %{version}-%{release}
Requires: %{name}-gui-cpp = %{version}-%{release}
Requires: %{name}-gui-gtk3 = %{version}-%{release}
%if %{with qt5}
Requires: %{name}-gui-qt5 = %{version}-%{release}
%endif
Requires: pkgconfig

%description devel
This package contains gwenhywfar-config and header files for writing and
compiling programs using Gwenhywfar.


%package gui-cpp
Summary: Gwenhywfar GUI framework for cpp
Group: system
Requires: %{name} = %{version}-%{release}

%description gui-cpp
This package contains the cpp gwenhywfar GUI backend.


%package gui-gtk3
Summary: Gwenhywfar GUI framework for GTK3
Group: system
BuildRequires: gtk3-devel
Requires: %{name} = %{version}-%{release}
Obsoletes: %{name}-gui-gtk2 < 5.7.0

%description gui-gtk3
This package contains the gtk3 gwenhywfar GUI backend.


%if %{with qt5}
%package gui-qt5
Summary: Gwenhywfar GUI framework for Qt5
Group: system
BuildRequires: qt5-rpm-macros
BuildRequires: qt5-qtbase-devel
BuildRequires: qt5-linguist
Requires: %{name} = %{version}-%{release}
Obsoletes: %{name}-gui-qt4 < 5.7.0

%description gui-qt5
This package contains the qt5 gwenhywfar GUI backend.
%endif


%debug_package


%prep
%setup -q
autoreconf -iv


%build
# help configure find qt5 lrelease/lupdate
export PATH=$PATH:%{_qt5_bindir}

%configure \
	--disable-static \
	--enable-system-certs \
	--with-guis="gtk3" \
%if %{with qt5}
	--with-qt5-qmake=%{_bindir}/qmake-qt5 \
	--with-qt5-moc=%{_bindir}/moc-qt5 \
	--with-qt5-uic=%{_bindir}/uic-qt5 \
%endif
	%{nil}

# kill rpath
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool

make %{?_smp_mflags}


%install
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install

# use system ca-certificates
rm -f $RPM_BUILD_ROOT%{_datadir}/%{name}/ca-bundle.crt
ln -sf %{_sysconfdir}/pki/tls/certs/ca-bundle.crt \
    $RPM_BUILD_ROOT%{_datadir}/%{name}/ca-bundle.crt

find $RPM_BUILD_ROOT -name *.la -exec rm -f {} \;

%find_lang %{name}


%clean
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT


%files -f %{name}.lang
%defattr(-,root,root)
%license COPYING
%doc AUTHORS README ChangeLog
%{_bindir}/gct-tool
%{_libdir}/libgwenhywfar.so.*
%{_libdir}/%{name}
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/dialogs
%{_datadir}/%{name}/ca-bundle.crt

%files devel
%defattr(-,root,root)
%exclude %{_bindir}/gct-tool
%{_bindir}/*
%{_includedir}/gwenhywfar*
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc
%{_libdir}/cmake/*
%{_datadir}/aclocal/gwenhywfar.m4
%{_datadir}/gwenbuild
%{_datadir}/%{name}/gwenbuild
%{_datadir}/%{name}/typemaker*

%files gui-cpp
%defattr(-,root,root)
%{_libdir}/libgwengui-cpp.so.*

%files gui-gtk3
%defattr(-,root,root)
%{_libdir}/libgwengui-gtk3.so.*

%if %{with qt5}
%files gui-qt5
%defattr(-,root,root)
%{_libdir}/libgwengui-qt5.so.*
%endif


%changelog
* Wed Nov 01 2023 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 5.9.0-1
- new upstream release.

* Sat Oct 30 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 5.7.3-1
- new upstream release.
- built with openssl-3.0.0.
- dropped ldconfig scriptlets.
- disabled qt5 as default.

* Sat Feb 20 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 5.6.0-1
- new upstream release.

* Wed Sep 11 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 4.20.2-1
- new upstream release.
- switched guis to gtk3 and qt5.
- added a subpackage "gui-cpp".

* Sat Dec  6 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 4.3.3-2
- rebuilt with libgcrypt 1.6.0 and gnutls 3.2.20

* Sun Sep 02 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.3.3-1
- new upstream release
- add BuildRequires: gtk2-devel, qt4-devel
- create gui-gtk2, gui-qt4 subpackages (based on Fedora)

* Sat Mar 12 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 3.11.3-3
- rebuilt with openssl-1.0.0d

* Sat Oct 02 2010 Shu KONNO <owa@bg.wakwak.com> 3.11.3-2
- rebuilt with rpm-4.8.1 for pkg-config

* Sat Feb 13 2010 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 3.11.3-1
- new upstream release

* Mon Jan 19 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 3.6.0-1
- new upstream release
- built with gnutls-2.6.3

* Sat Sep 27 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 3.4.1-1
- new upstream release
- applied new versioning policy

* Sat Dec 29 2007 NAKAMURA Kenta <kenta@vinelinux.org> 2.6.2-0vl1
- new upstream release

* Sat Dec 29 2007 NAKAMURA Kenta <kenta@vinelinux.org> 2.6.1-2vl1
- initial build for VineSeed

* Wed Oct 10 2007 Bill Nottingham <notting@redhat.com> - 2.6.1-2
- fix build, rebuild for buildid

* Fri Aug  3 2007 Bill Nottingham <notting@redhat.com>
- tweak license tag

* Wed Jul 11 2007 Bill Nottingham <notting@redhat.com> - 2.6.1-1
- update to 2.6.1

* Mon Jun 11 2007 Bill Nottingham <notting@redhat.com> - 2.6.0-1
- update to 2.6.0

* Mon Mar 19 2007 Bill Nottingham <notting@redhat.com> - 2.5.4-1
- update to 2.5.4

* Thu Feb 22 2007 Bill Nottingham <notting@redhat.com> - 2.3.0-7
- build for Extras

* Wed Jan 10 2007 Bill Nottingham <notting@redhat.com> - 2.3.0-6
- make gwen-public-ca.crt %%config(noreplace)

* Tue Jan  9 2007 Bill Nottingham <notting@redhat.com> - 2.3.0-5
- spec tweaks

* Thu Sep  7 2006 Bill Nottingham <notting@redhat.com> - 2.3.0-4
- rebuild for fixed debuginfo (#205501)

* Tue Sep  5 2006 Bill Nottingham <notting@redhat.com> - 2.3.0-3
- fix multilib conflicts (#205213)

* Fri Jul 14 2006 Bill Nottingham <notting@redhat.com> - 2.3.0-2
- rather than modifying the m4 file, make gwenhywfar-config use pkgconfig

* Wed Jul 12 2006 Jesse Keating <jkeating@redhat.com> - 2.3.0-1.1
- rebuild

* Tue Jul 11 2006 Bill Nottingham <notting@redhat.com> - 2.3.0-1
- update to 2.3.0

* Fri Feb 10 2006 Jesse Keating <jkeating@redhat.com> - 1.99.2-1.2
- bump again for double-long bug on ppc(64)

* Tue Feb 07 2006 Jesse Keating <jkeating@redhat.com> - 1.99.2-1.1
- rebuilt for new gcc4.1 snapshot and glibc changes

* Thu Dec 22 2005 Bill Nottingham <notting@redhat.com> 1.99.2-1
- update to 1.99.2
- use the pkgconfig file, not gwenhywfar-config

* Fri Dec 09 2005 Jesse Keating <jkeating@redhat.com>
- rebuilt

* Wed Nov  9 2005 Tomas Mraz <tmraz@redhat.com> 1.7.2-3
- rebuilt against new openssl

* Wed Mar  2 2005 Bill Nottingham <notting@redhat.com> 1.7.2-2
- rebuild against new openssl

* Wed Feb  9 2005 Bill Nottingham <notting@redhat.com> 1.7.2-1
- initial packaging, adopt upstream package
