File dia.spec of Package dia.13497

#
# spec file for package dia
#
# Copyright (c) 2019 SUSE LLC.
#
# 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 https://bugs.opensuse.org/
#


Name:           dia
Version:        0.97.3
Release:        0
Summary:        A Diagram Creation Program
License:        GPL-2.0-or-later
Group:          Productivity/Graphics/Other
URL:            http://live.gnome.org/Dia
Source0:        http://download.gnome.org/sources/dia/0.97/%{name}-%{version}.tar.xz
Source1:        font-test-japanese.dia
Source2:        font-test-czech.dia
Source3:        font-test-german-euro.dia
Source4:        dia.appdata.xml
# PATCH-FIX-UPSTREAM dia-intltool-0.51.patch bgo#737255 dimstar@opensuse.org -- Fix installation of locales with intltool 0.51
Patch0:         dia-intltool-0.51.patch
# PATCH-FIX-OPENSUSE dia-0.92.2-no-strict-aliasing.patch
Patch3:         dia-0.92.2-no-strict-aliasing.patch
# PATCH-FIX-OPENSUSE dia-remove-datetime.patch vuntz@novell.com -- Do not put date/time in the compiled binary (needed for build-compare)
Patch17:        dia-remove-datetime.patch
# PATCH-FIX-UPSTREAM dia-libemf-64bit.patch bgo#675495 sbrabec@suse.cz -- Fix build with libEMF on 64-bit platforms.
Patch20:        dia-libemf-64bit.patch
# PATCH-FIX-OPENSUSE dia-enable-html-doc.patch mgorse@suse.com -- Always enable html docs if xsltproc present.
Patch23:        dia-enable-html-doc.patch
# PATCH-FIX-UPSTREAM dia-CVE-2019-19451.patch glgo#GNOME/dia#428 CVE-2019-19451 bsc#1158194 qkzhu@suse.com -- Fix endless loop on filenames with invalid encoding.
Patch24:        dia-CVE-2019-19451.patch
BuildRequires:  docbook-toys
BuildRequires:  docbook-xsl-stylesheets
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  intltool
BuildRequires:  libtool
BuildRequires:  libxslt-devel
BuildRequires:  python-devel
BuildRequires:  python-gtk-devel
BuildRequires:  scrollkeeper
BuildRequires:  sgml-skel
BuildRequires:  swig
BuildRequires:  translation-update-upstream
BuildRequires:  update-desktop-files
# Only needed because we don't (and won't) support building xz tarballs by default... See bnc#697467
BuildRequires:  xz
Requires:       ghostscript-fonts-std
Requires:       python-gtk
# for xdg-open
Requires:       xdg-utils
Recommends:     %{name}-lang
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} > 1210
BuildRequires:  libEMF-devel
%else
%ifarch %ix86
# libEMF was not on x86_64 before 12.2
BuildRequires:  libEMF-devel
%endif
%endif

%description
Dia is designed to be much like the commercial program 'Visio.' It can
be used to draw many different kinds of diagrams. It has special
objects to help draw entity relationship diagrams, UML diagrams, SADT,
flowcharts, network diagrams, and simple circuits. It is possible to
add support for new shapes by writing simple XML files, and using a
subset of SVG to draw the shape.

Dia can load and save diagrams to a custom XML format (gzipped by
default to save space), can export diagrams to EPS, PNG, CGM, or SVG
formats, and can print diagrams (including ones that span multiple
pages).

%lang_package

%prep
%setup -q
translation-update-upstream
%patch0 -p1
%patch3
%patch17 -p1
%patch20 -p1
%patch23 -p1
%patch24 -p1
cp $RPM_SOURCE_DIR/font-test*dia .

%build
autoreconf -f -i
intltoolize --force
%configure\
	--disable-static\
	--enable-db2html\
	--disable-gnome\
	--with-python\
	--with-cairo\
	--with-swig \
	--docdir=%{_docdir}/%{name}
make %{?_smp_mflags}

%install
make DESTDIR=%{buildroot} install %{?_smp_mflags}
find %{buildroot} -type f -name "*.la" -delete -print
%suse_update_desktop_file -r -N Dia -C "" -G "Diagram Editor" dia Office FlowChart
%find_lang %{name} %{?no_lang_C}
# No need for mime-info-to-mime, application/x-dia-diagram is defined in freedesktop.org.xml
rm -r %{buildroot}%{_datadir}/mime-info
rm samples/Makefile* samples/*png
if [ -f %{buildroot}%{_datadir}/appdata/dia.appdata.xml ]; then
  echo "Please remove the added dia.appdata.xml file from the sources - the tarball installs it"
  false
else
  mkdir -p %{buildroot}%{_datadir}/appdata
  cp %{S:4} %{buildroot}%{_datadir}/appdata/
fi

%fdupes %{buildroot}%{_datadir}

%if 0%{?suse_version} > 1130
%post
%desktop_database_post
%icon_theme_cache_post
%endif

%if 0%{?suse_version} > 1130
%postun
%desktop_database_postun
%icon_theme_cache_postun
%endif

%files
%defattr(-,root,root)
%doc AUTHORS COPYING ChangeLog INSTALL KNOWN_BUGS NEWS README TODO samples/ font-test*dia
%{_bindir}/*
%{_libdir}/dia
%dir %{_datadir}/appdata
%{_datadir}/appdata/dia.appdata.xml
%{_datadir}/applications/*.desktop
%{_datadir}/dia
%{_datadir}/icons/hicolor/*/apps/dia.*
%doc %{_mandir}/man1/*.*
%doc %{_mandir}/fr/man1/*.*

%files lang -f %{name}.lang
%defattr(-,root,root)

%changelog
openSUSE Build Service is sponsored by