File qxmledit.spec of Package qxmledit

#
# spec file for package qxmledit
#
# 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 major   0

Name:           qxmledit
Version:        0.8.17
Release:        0
Summary:        Simple XML Editor and XSD Viewer
License:        LGPL-2.0+ and LGPL-3.0+
Group:          Productivity/Publishing/XML
Url:            http://qxmledit.org/
Source0:        http://downloads.sourceforge.net/%{name}/%{name}-%{version}-src.tgz
Source1:        http://qxmledit.googlecode.com/svn/wiki/tutorials/xsltmode.pdf
Source99:       baselibs.conf
BuildRequires:  hicolor-icon-theme
BuildRequires:  update-desktop-files
%if 0%{?suse_version} > 1320
BuildRequires:  pkgconfig(Qt5Core)
BuildRequires:  pkgconfig(Qt5Gui)
BuildRequires:  pkgconfig(Qt5Network)
BuildRequires:  pkgconfig(Qt5Sql)
BuildRequires:  pkgconfig(Qt5Svg)
BuildRequires:  pkgconfig(Qt5Xml)
BuildRequires:  pkgconfig(Qt5XmlPatterns)
BuildRequires:  pkgconfig(Qt5Concurrent)
BuildRequires:  pkgconfig(Qt5PrintSupport)
%else
BuildRequires:  pkgconfig(QtCore)
BuildRequires:  pkgconfig(QtGui)
BuildRequires:  pkgconfig(QtNetwork)
BuildRequires:  pkgconfig(QtSql)
BuildRequires:  pkgconfig(QtSvg)
BuildRequires:  pkgconfig(QtXml)
BuildRequires:  pkgconfig(QtXmlPatterns)
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
QXmlEdit is a simple XML editor written in Qt4. Its main features are
unusual data visualization modes, nice XML manipulation and presentation and
it is multi platform. It can split very big XML files into fragments, and
compare XML files. It is one of the few graphical Open Source XSD viewers.

Main features:

* Hierarchical customizable view of XML elements.
* Fast XML hierarchy navigation.
* Split of big XML files.
* Search supporting XPath expressions.
* Base 64 data handling.
* Custom visualization styles.
* XML Schema (XSD) viewer.
* Columnar view.
* Sessions handling.
* Graphical XML file view.
* Map view of a XML document.
* Split and fragment extraction of big XML files.
* Visual compare of XML Schema files.
* Visual compare of XML files.
* XML Snippets.
* XSL specialized mode.
* Element display via user customizable rules.

%package -n libqxmledit%{major}
Summary:        Simple XML Editor Shared Libraries
Group:          System/Libraries

%description -n libqxmledit%{major}
QXmlEdit is a simple XML editor written in Qt4. It uses a tree based
interface to ease the edit of long files.

This package includes QXmlEdit shared libraries.

%package devel
Summary:        Simple XML Editor Development Files
Group:          Development/Libraries/C and C++
Requires:       libqxmledit%{major} = %{version}

%description devel
QXmlEdit is a simple XML editor written in Qt4. It uses a tree based
interface to ease the edit of long files.

This package includes QXmlEdit development files.

%prep
%setup -q

%build
export QXMLEDIT_INST_DATA_DIR=%{_datadir}/%{name}/
export QXMLEDIT_INST_DIR=%{_bindir}/
export QXMLEDIT_INST_DOC_DIR=%{_defaultdocdir}/%{name}/
export QXMLEDIT_INST_INCLUDE_DIR=%{_includedir}/%{name}/
export QXMLEDIT_INST_LIB_DIR=%{_libdir}/
export QXMLEDIT_INST_TRANSLATIONSDIR=%{_datadir}/%{name}/translations/
%if 0%{?suse_version} > 1320
qmake-qt5 \
%else
qmake \
%endif
    QMAKE_CFLAGS+="%{optflags}" \
    QMAKE_CXXFLAGS+="%{optflags}" \
    QMAKE_STRIP="true"
make %{?_smp_mflags}

%install
make INSTALL_ROOT=%{buildroot} install

cp %{SOURCE1} .

# Install icons.
install -Dm 0644 install_scripts/environment/icon/qxmledit_48x48.png \
    %{buildroot}%{_datadir}/icons/hicolor/48x48/apps/%{name}.png
install -Dm 0644 src/images/icon.svg \
    %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg

# Install an appdata file.
install -Dm 0644 install_scripts/environment/desktop/QXmlEdit.appdata.xml \
    %{buildroot}%{_datadir}/appdata/%{name}.appdata.xml

# Install a desktop file.
install -Dm 0644 install_scripts/environment/desktop/QXmlEdit.desktop \
    %{buildroot}%{_datadir}/applications/%{name}.desktop

# Remove redundant files.
rm -f \
    %{buildroot}%{_datadir}/%{name}/{QXmlEdit.appdata.xml,QXmlEdit.desktop}

%suse_update_desktop_file %{name} TextEditor Development Documentation Qt

%post
%desktop_database_post
%icon_theme_cache_post

%postun
%desktop_database_postun
%icon_theme_cache_postun

%post -n libqxmledit%{major} -p /sbin/ldconfig

%postun -n libqxmledit%{major} -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%doc AUTHORS COPYING GPLV3.txt LGPLV3.txt NEWS README ROADMAP TODO
%doc doc/QXmlEdit_manual.pdf xsltmode.pdf
%{_bindir}/%{name}
%{_datadir}/%{name}/
%if 0%{?suse_version} && 0%{?suse_version} < 1320
%dir %{_datadir}/appdata/
%endif
%{_datadir}/appdata/%{name}.appdata.xml
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/*/%{name}.*

%files -n libqxmledit%{major}
%defattr(-,root,root,-)
%{_libdir}/libQXmlEdit*.so.*

%files devel
%defattr(-,root,root,-)
%doc AUTHORS COPYING GPLV3.txt LGPLV3.txt NEWS README ROADMAP TODO
%{_includedir}/%{name}/
%{_libdir}/libQXmlEdit*.so

%changelog