File mingw64-gwenhywfar.spec of Package mingw64-gwenhywfar

#
# spec file for package mingw64-gwenhywfar
#
# Copyright (c) 2017 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 _name gwenhywfar
%define	libversion	60
%define devversion 4.20
%define with_gtk2 0
%define with_fox 0
%define with_qt4 1
%define with_qt5 1
%define with_doc 0
%define with_lang 1
Name:           mingw64-%{_name}
Version:        4.20.1
Release:        0
Summary:        Multiplatform helper library for other libraries
License:        GPL-2.0-or-later and LGPL-2.1-or-later
Group:          System/Libraries
Url:            http://www.aqbanking.de/
Source:         %{_name}-%{version}.tar.gz
Patch0:         configure-qt4-fix-on-windows.patch
Patch1:         windows-fixes.patch
Patch2:         gwenhywfar-default-bundle-support-on-windows.patch
Patch3:         0001-ax_have_qt.m4-Fix-not-getting-variables-from-the-gen.patch
Patch4:         0001-Fix-finding-gwenhywfar-Qt5-library-for-cmake-build-sys.patch
Patch5:         0001-Fix-libtool-warning-undefined-symbols-not-allowed-in.patch
BuildRequires:  autoconf
BuildRequires:  automake
# configure.ac is broken
%if %{with_doc}
BuildRequires:  doxygen
%endif
BuildRequires:  libtool
BuildRequires:  mingw64-cross-gcc-c++
BuildRequires:  mingw64-cross-qmake
BuildRequires:  mingw64-cross-pkg-config
%if %{with_gtk2}
BuildRequires:  mingw64-gtk2-devel >= 1.4
%endif
# AM_xxx macros
BuildRequires:  libgcrypt-devel
BuildRequires:  mingw64-libgcrypt-devel >= 1.2.0
BuildRequires:  mingw64-libgnutls-devel >= 3.0
BuildRequires:  mingw64-win_iconv-devel
BuildRequires:  mingw64-libintl-devel
%if %{with_qt4}
BuildRequires:  mingw64-libqt4-devel
BuildRequires:  mingw64-libqt4-tools-devel
%endif
%if %{with_qt5}
# lrelease,lupdate
BuildRequires:  libqt4-linguist
BuildRequires:  mingw64-libqt5-qtbase-devel
%endif
%if %{with_fox}
%if 0%{?fedora} == 15
BuildRequires:  mingw64-fox-devel >= 1.6
%else
BuildRequires:  mingw64-fox16-devel
%endif
%endif
# For doc graphs
%if %{with_doc}
BuildRequires:  graphviz
BuildRequires:  graphviz-gd
BuildRequires:  xorg-x11-fonts
%endif
Recommends:     mingw64-lib%{_name}%{libversion}
%_mingw64_package_header_debug
BuildArch:      noarch

%description
Gwenhywfar is a base library used to provide OS abstraction functions
for Linux, FreeBSD, OpenBSD, NetBSD, and Windows. It also includes some
often needed functions (for example, handling and parsing of
configuration files, reading and writingof XML files, and interprocess
communication).

%package tools
Summary:        Multiplatform Helper Library for Other Libraries - Tools
License:        GPL-2.0-or-later and LGPL-2.1-or-later
Group:          System/Libraries
Requires:       mingw64-libgwenhywfar60 = %{version}

%description tools
Gwenhywfar is a base library used to provide OS abstraction functions
for Linux, FreeBSD, OpenBSD, NetBSD, and Windows. It also includes
some often needed functions (for example, for handling and parsing of
configuration files, reading and writing of XML files, and interprocess
communication).

%package -n mingw64-lib%{_name}%{libversion}-plugins
Summary:        Multiplatform Helper Library for Other Libraries - Plugins
License:        LGPL-2.1-or-later
Group:          System/Libraries
Requires:       %{name} = %{version}

%description -n mingw64-lib%{_name}%{libversion}-plugins
Gwenhywfar is a base library used to provide OS abstraction functions
for Linux, FreeBSD, OpenBSD, NetBSD, and Windows. It also includes
some often needed functions (for example, for handling and parsing of
configuration files, reading and writing of XML files, and interprocess
communication).

%package -n mingw64-lib%{_name}%{libversion}
Summary:        Multiplatform Helper Library for Other Libraries
License:        LGPL-2.1-or-later
Group:          System/Libraries
%if %{with_lang}
Recommends:     %{name}-lang
%endif
Recommends:     mingw64-lib%{_name}%{libversion}-plugins = %{version}

%description -n mingw64-lib%{_name}%{libversion}
Gwenhywfar is a base library used to provide OS abstraction functions
for Linux, FreeBSD, OpenBSD, NetBSD, and Windows. It also includes
some often needed functions (for example, for handling and parsing of
configuration files, reading and writing of XML files, and interprocess
communication).

%package -n mingw64-libgwengui-cpp0
Summary:        C++ interface for Gwenhywfar
License:        GPL-2.0-or-later and LGPL-2.1-or-later
Group:          System/Libraries

%description -n mingw64-libgwengui-cpp0
This package contains the C++ GUI interface for Gwenhywfar.

%if %{with_gtk2}
%package -n mingw64-libgwengui-gtk2-0
Summary:        Multiplatform Helper Library for Other Libraries -- GTK+ UI Backend
License:        LGPL-2.1-or-later
Group:          System/Libraries

%description -n mingw64-libgwengui-gtk2-0
Gwenhywfar is a base library used to provide OS abstraction functions
for Linux, FreeBSD, OpenBSD, NetBSD, and Windows. It also includes
some often needed functions (for example, for handling and parsing of
configuration files, reading and writing of XML files, and interprocess
communication).

This package provides the GTK+ implementation of the generic UI toolkit.
%endif

%if %{with_qt4}
%package -n mingw64-libgwengui-qt4-0
Summary:        Multiplatform Helper Library for Other Libraries -- Qt4 UI Backend
License:        LGPL-2.1-or-later
Group:          System/Libraries

%description -n mingw64-libgwengui-qt4-0
Gwenhywfar is a base library used to provide OS abstraction functions
for Linux, FreeBSD, OpenBSD, NetBSD, and Windows. It also includes
some often needed functions (for example, for handling and parsing of
configuration files, reading and writing of XML files, and interprocess
communication).

This package provides the Qt4 implementation of the generic UI toolkit.
%endif

%if %{with_qt5}
%package -n mingw64-libgwengui-qt5-0
Summary:        Multiplatform Helper Library for Other Libraries -- Qt5 UI Backend
License:        LGPL-2.1-or-later
Group:          System/Libraries

%description -n mingw64-libgwengui-qt5-0
Gwenhywfar is a base library used to provide OS abstraction functions
for Linux, FreeBSD, OpenBSD, NetBSD, and Windows. It also includes
some often needed functions (for example, for handling and parsing of
configuration files, reading and writing of XML files, and interprocess
communication).

This package provides the Qt5 implementation of the generic UI toolkit.
%endif

%if %{with_fox}
%package -n mingw64-libgwengui-fox16-0
Summary:        FOX interface for Gwenhywfar
License:        GPL-2.0-or-later and LGPL-2.1-or-later
Group:          System/Libraries

%description -n mingw64-libgwengui-fox16-0
This package contains the interface to the FOX toolkit
for Gwenhywfar.
%endif

%package devel
Summary:        Multi-Platform Helper Library for Other Libraries
#Requires:       glibc-devel
License:        LGPL-2.1-or-later
Group:          Development/Libraries/C and C++
Requires:       mingw64-lib%{_name}%{libversion} = %{version}
%if %{with_fox}
Requires:       mingw64-libgwengui-fox16-0 = %{version}
%endif
%if %{with_gtk2}
Requires:       mingw64-libgwengui-gtk2-0 = %{version}
%endif
%if %{with_qt4}
Requires:       mingw64-libgwengui-qt4-0 = %{version}
%endif
%if %{with_qt5}
Requires:       mingw64-libgwengui-qt5-0 = %{version}
%endif
Requires:       mingw64-libgwengui-cpp0

%description devel
Gwenhywfar is a base library used to provide OS abstraction functions
for Linux, FreeBSD, OpenBSD, NetBSD, and Windows. It also includes
some often needed functions (e.g. for handling and parsing of
configuration files, reading/writing of XML files, interprocess
communication etc).

%_mingw64_debug_package

%if %{with_lang}
%lang_package
%endif

%prep
%setup -q -n %{_name}-%{version}
%patch -P 0 -p1
%patch -P 1 -p1
%patch -P 2 -p1
%patch -P 3 -p1
%patch -P 4 -p1
%patch -P 5 -p1

%build
# quick fix for $CPP being unset and configure failing to handle include dirs properly
CPP=`which cpp`
export CPP
guis=
%if %{with_qt4}
guis="$guis qt4"
%endif
%if %{with_qt5}
guis="$guis qt5"
%endif
%if %{with_fox}
guis="$guis fox16"
%endif
%if %{with_gtk2}
guis="$guis gkt2"
%endif
autoreconf -fi
echo "lt_cv_deplibs_check_method='pass_all'" >>%{_mingw64_cache}
%_mingw64_configure\
	--disable-binreloc \
	--enable-release\
%if %{with_doc}
	--enable-full-doc\
	--with-docpath=%{_mingw64_docdir}/%{_name}/api \
%endif
	--disable-static \
%if %{with_qt4}
	--with-qt4-includes=%{_mingw64_includedir} \
	--with-qt4-libs=%{_mingw64_libdir} \
	--with-qt4-moc=%{_bindir}/%{_mingw64_target}-moc \
	--with-qt4-uic=%{_bindir}/%{_mingw64_target}-uic \
%endif
%if %{with_qt5}
	--with-qt5-qmake=%{_bindir}/%{_mingw64_target}-qmake-qt5 \
	--with-qt5-moc=%{_bindir}/%{_mingw64_target}-moc-qt5 \
	--with-qt5-uic=%{_bindir}/%{_mingw64_target}-uic-qt5 \
%endif
	--with-guis="$guis" \
	--with-plugins-cfgmgr=all \
	--with-pic
%__make
%if %{with_doc}
# fails on creating mklistdoc
%__make srcdoc
%endif

%install
%makeinstall
%if %{with_doc}
%makeinstall install-srcdoc
pushd %{buildroot}%{_mingw64_docdir}/%{_name}/api
    # we don't want another 'gwenhywfar' dir below docpath
    %__mv %{name}/* ./
    rm -rf %{name}
    # remove empty files
    `find -maxdepth 1 -type f -empty -print0 | xargs -0 echo %__rm -f`
popd
%endif
find %{buildroot} -type f -name "*.la" -delete -print
%if %{with_lang}
%_mingw64_find_lang %{_name} || true
%endif
# fix dll path
perl -pi -e 's,lib/libgwenhywfar.so.%{libversion},bin/libgwenhywfar-%{libversion}.dll,g' %{buildroot}%{_mingw64_libdir}/cmake/gwenhywfar-%{devversion}/gwenhywfar-config.cmake
perl -pi -e 's,lib/libgwengui-cpp.so,bin/libgwengui-cpp-0.dll,g' %{buildroot}%{_mingw64_libdir}/cmake/gwengui-cpp-%{devversion}/gwengui-cpp-config.cmake

%clean
rm -rf %{buildroot}

%files
%defattr (-,root,root)
%doc AUTHORS COPYING NEWS README TODO
%dir %{_mingw64_datadir}/%{_name}/
%{_mingw64_datadir}/%{_name}/ca-bundle.crt
%{_mingw64_datadir}/%{_name}/dialogs/
%dir %{_mingw64_libdir}/%{_name}
%dir %{_mingw64_libdir}/%{_name}/plugins
%dir %{_mingw64_libdir}/%{_name}/plugins/%{libversion}
%if %{with_doc}
%exclude %{_mingw64_docdir}/%{_name}/api
%endif

%files tools
%defattr (-, root, root)
%{_mingw64_bindir}/gct-tool.exe
%{_mingw64_bindir}/gsa.exe
%{_mingw64_bindir}/mklistdoc.exe
%{_mingw64_bindir}/typemaker*.exe
%{_mingw64_bindir}/xmlmerge.exe
%{_mingw64_datadir}/%{_name}/typemaker2/
%exclude %{_mingw64_bindir}/*.exe.debug

%files -n mingw64-lib%{_name}%{libversion}-plugins
%defattr (-, root, root)
%dir %{_mingw64_libdir}/%{_name}/plugins/%{libversion}/
%dir %{_mingw64_libdir}/%{_name}/plugins/%{libversion}/*/
%{_mingw64_libdir}/%{_name}/plugins/%{libversion}/*/*.dll
%{_mingw64_libdir}/%{_name}/plugins/%{libversion}/*/*.xml

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

%files -n mingw64-libgwengui-cpp0
%defattr (-,root,root)
%{_mingw64_bindir}/libgwengui-cpp*.dll

%if %{with_gtk2}
%files -n  mingw64-libgwengui-gtk2-0
%defattr (-, root, root)
%{_mingw64_bindir}/libgwengui-gtk2*.dll
%endif

%if %{with_qt4}
%files -n mingw64-libgwengui-qt4-0
%defattr (-, root, root)
%{_mingw64_bindir}/libgwengui-qt4*.dll
%endif

%if %{with_qt5}
%files -n mingw64-libgwengui-qt5-0
%defattr (-, root, root)
%{_mingw64_bindir}/libgwengui-qt5*.dll
%endif

%if %{with_fox}
%files -n mingw64-libgwengui-fox16-0
%defattr (-,root,root)
%{_mingw64_bindir}/libgwengui-fox16*.dll
%endif

%files devel
%defattr (-, root, root)
%{_mingw64_bindir}/%{_name}-config*
%dir %{_mingw64_datadir}/aclocal
%{_mingw64_datadir}/aclocal/%{_name}.m4
%if %{with_doc}
%doc %{_mingw64_docdir}/%{_name}/api/
%endif
%{_mingw64_includedir}/%{_name}4/
%{_mingw64_libdir}/*.dll.a
%{_mingw64_libdir}/%{_name}/plugins/%{libversion}/*/*.dll.a
%{_mingw64_libdir}/pkgconfig/%{_name}.pc
%if %{with_gtk2}
%{_mingw64_libdir}/pkgconfig/gwengui-gtk2.pc
%endif
%if %{with_qt4}
%{_mingw64_libdir}/pkgconfig/gwengui-qt4.pc
%endif
%if %{with_qt5}
%{_mingw64_libdir}/pkgconfig/gwengui-qt5.pc
%endif
%if %{with_fox}
%{_mingw64_libdir}/pkgconfig/gwengui-fox16.pc
%endif
%dir %{_mingw64_libdir}/cmake
%{_mingw64_libdir}/cmake/%{_name}-%{devversion}
%{_mingw64_libdir}/cmake/gwengui-cpp-%{devversion}
%if %{with_qt4}
%{_mingw64_libdir}/cmake/gwengui-qt4-%{devversion}
%endif
%if %{with_qt5}
%{_mingw64_libdir}/cmake/gwengui-qt5-%{devversion}
%endif

%if %{with_lang}
%files lang -f %{_name}.lang
%endif

%changelog
openSUSE Build Service is sponsored by