Name: qhexedit2
Version: 0.6.6
Release: 1%{?dist}
Summary: Binary Editor for Qt
License: LGPLv2
URL: https://github.com/Simsys/qhexedit2
Source0: https://github.com/Simsys/%{name}/archive/v%{version}.tar.gz
Source1: qhexedit.desktop
# Fix build issues
Patch0: qhexedit2_build.patch
BuildRequires: qt4-devel
BuildRequires: qt5-qtbase-devel
BuildRequires: sip
BuildRequires: python3-sip
BuildRequires: PyQt4-devel
BuildRequires: python-qt5-devel
BuildRequires: python3-PyQt4-devel
BuildRequires: python3-qt5-devel
BuildRequires: desktop-file-utils
Requires: %{name}-qt5-libs%{?_isa} = %{version}-%{release}
%description
QHexEdit is a hex editor widget written in C++ for the Qt framework.
It is a simple editor for binary data, just like QPlainTextEdit is for text
data.
%package libs
Summary: %{name} Qt4 library
%description libs
%{name} Qt4 library.
%package devel
Summary: Development files for %{name} Qt4
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
%description devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name} Qt4.
%package qt5-libs
Summary: %{name} Qt5 library
%description qt5-libs
%{name} Qt5 library.
%package qt5-devel
Summary: Development files for %{name} Qt5
Requires: %{name}-qt5-libs%{?_isa} = %{version}-%{release}
%description qt5-devel
The %{name}-qt5-devel package contains libraries and header files for
developing applications that use %{name} Qt5.
%package doc
Summary: Documentation and examples for %{name}
Provides: bundled(jquery)
BuildArch: noarch
%description doc
The %{name}-doc package contains the documentation and examples for %{name}.
%package -n python-%{name}
Summary: %{name} Qt4 Python2 bindings
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
%description -n python-%{name}
%{name} Python2 bindings.
%package -n python-%{name}-devel
Summary: Development files for the %{name} Python2 bindings
Requires: python-%{name}%{?_isa} = %{version}-%{release}
Requires: sip-devel
%description -n python-%{name}-devel
Development files for the %{name} Python2 bindings.
%package -n python3-%{name}
Summary: %{name} Qt4 Python3 bindings
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
%description -n python3-%{name}
%{name} Python3 bindings.
%package -n python3-%{name}-devel
Summary: Development files for the %{name} Python3 bindings
Requires: python3-%{name}%{?_isa} = %{version}-%{release}
Requires: python3-sip-devel
%description -n python3-%{name}-devel
Development files for the %{name} Python3 bindings
%prep
%setup -q -n %{name}-%{version}
%patch0 -p1
# Prevent rpmlint W: doc-file-dependency /usr/share/doc/qhexedit2-doc/html/installdox /usr/bin/perl
rm -f doc/html/installdox
%build
# Build library, qt4
mkdir build-lib-qt4
pushd build-lib-qt4
LDFLAGS="%{__global_ldflags} -Wl,--as-needed" %qmake_qt4 ../sip/qhexedit.pro
make %{?_smp_mflags}
popd
# Build sip bindings, qt4, python2
mkdir build-sip-qt4-py2
pushd build-sip-qt4-py2
%{__python2} ../sip/configure.py
make %{?_smp_mflags}
popd
# Build sip bindings, qt4, python3
mkdir build-sip-qt4-py3
pushd build-sip-qt4-py3
%{__python3} ../sip/configure.py
make %{?_smp_mflags}
popd
# Build library, qt5
mkdir build-lib-qt5
pushd build-lib-qt5
LDFLAGS="%{__global_ldflags} -Wl,--as-needed" %qmake_qt5 ../sip/qhexedit.pro
make %{?_smp_mflags}
popd
# Build application
mkdir build-example
pushd build-example
%qmake_qt5 ../example/qhexedit.pro
make %{?_smp_mflags}
popd
%install
# Library and headers
install -d %{buildroot}%{_includedir}/%{name}
cp -a src/*.h %{buildroot}%{_includedir}/%{name}
install -d %{buildroot}%{_libdir}
chmod 0755 build-lib-qt4/*.so.*.*
cp -a build-lib-qt4/*.so* %{buildroot}%{_libdir}
chmod 0755 build-lib-qt5/*.so.*.*
cp -a build-lib-qt5/*.so* %{buildroot}%{_libdir}
# pkg-config files
install -d %{buildroot}%{_libdir}/pkgconfig/
cat > %{buildroot}%{_libdir}/pkgconfig/%{name}.pc <<EOF
libdir=%{_libdir}
includedir=%{_includedir}/%{name}
Name: %{name}
Description: %{summary}
Version: %{version}
Cflags: -I\${includedir}
Libs: -L\${libdir} -lqhexedit
EOF
cat > %{buildroot}%{_libdir}/pkgconfig/%{name}-qt5.pc <<EOF
libdir=%{_libdir}
includedir=%{_includedir}/%{name}
Name: %{name}-qt5
Description: %{summary}
Version: %{version}
Cflags: -I\${includedir}
Libs: -L\${libdir} -lqhexedit-qt5
EOF
# Python bindings
%make_install -C build-sip-qt4-py2
%make_install -C build-sip-qt4-py3
# Application
install -Dpm 0755 build-example/qhexedit %{buildroot}%{_bindir}/qhexedit
desktop-file-install --dir=%{buildroot}%{_datadir}/applications/ %{SOURCE1}
%post
/usr/bin/update-desktop-database &> /dev/null || :
%postun
/usr/bin/update-desktop-database &> /dev/null || :
%post libs -p /sbin/ldconfig
%postun libs -p /sbin/ldconfig
%post qt5-libs -p /sbin/ldconfig
%postun qt5-libs -p /sbin/ldconfig
%files
%{_bindir}/qhexedit
%{_datadir}/applications/qhexedit.desktop
%files libs
%doc doc/release.txt
%license src/license.txt
%{_libdir}/libqhexedit.so.1*
%files devel
%{_includedir}/%{name}/
%{_libdir}/libqhexedit.so
%{_libdir}/pkgconfig/%{name}.pc
%files qt5-libs
%doc doc/release.txt
%license src/license.txt
%{_libdir}/libqhexedit-qt5.so.1*
%files qt5-devel
%{_includedir}/%{name}/
%{_libdir}/libqhexedit-qt5.so
%{_libdir}/pkgconfig/%{name}-qt5.pc
%files doc
%license src/license.txt
%doc doc/html
%files -n python-%{name}
%{python2_sitearch}/*.so
%files -n python-%{name}-devel
%{_datadir}/sip/qhexedit/
%files -n python3-%{name}
%{python3_sitearch}/*.so
%files -n python3-%{name}-devel
%{_datadir}/python3-sip/qhexedit/
%changelog
* Fri May 01 2015 Sandro Mani <manisandro@gmail.com> - 0.6.6-1
- Update to 0.6.6
* Wed Apr 29 2015 Sandro Mani <manisandro@gmail.com> - 0.6.5-2
- Build Qt5 library
* Thu Apr 16 2015 Sandro Mani <manisandro@gmail.com> - 0.6.5-1
- Update to 0.6.5
* Tue Dec 16 2014 Sandro Mani <manisandro@gmail.com> - 0.6.3-3.20141212svnr41
- Fix incorrect Requires
* Fri Dec 12 2014 Sandro Mani <manisandro@gmail.com> - 0.6.3-2.20141212svnr41
- Update source file name to include svn revision
- Fix license LGPLv2+ -> LGPLv2
- Added -Wl,--as-needed to fix unused-direct-shlib-dependency
* Sun Aug 10 2014 Sandro Mani <manisandro@gmail.com> - 0.6.3-1
- Initial package