File XaraLX.spec of Package xaralx

#
# spec file for package XaraLX
#
# Copyright (c) 2021 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/
#

%define _use_internal_dependency_generator 0
%define __find_requires %{wx_requires}

Name:           XaraLX
Version:        0.7r1785
Release:        0
Summary:        Xara Xtreme for Linux is a powerful, general purpose vector graphics program
License:        GPL-2.0-only
Group:          Productivity/Graphics/Vector Editors
URL:            http://www.xaraxtreme.org/developers/general/source_code__building.html
# Source:         http://downloads2.xara.com/opensource/%name-%version.tar.bz2
Source:         %{name}-%{version}.tar.bz2
Source1:        XARFormatDocument.pdf
Source2:        xaralx.desktop
Patch0:         abuild.diff
Patch2:         XaraLX-0.7r1785-missing-declaration.patch
# PATCH-FIX-OPENSUSE xaralx-pragma.patch sbrabec@suse.cz -- Fix of #pragma inside array definition.
Patch3:         xaralx-pragma.patch
# PATCH-FIX-OPENSUSE xaralx-gsocket.patch sbrabec@suse.cz -- Work-around of wxWidgets x GIO clash of GSocket.
Patch4:         xaralx-gsocket.patch
# PATCH-FIX-OPENSUSE xaralx-libpng.patch -- Ported to new libpng.
Patch5:         xaralx-0.7r1785-libpng15.patch
# PATCH-FIX-UPSTREAM -- add missing library to the linker command line
Patch6:         xaralx-missing_lib.patch
Patch7:         no-pic.patch
BuildRequires:  autoconf
BuildRequires:  automake
# documentation has wrong file end of line encoding
BuildRequires:  dos2unix
BuildRequires:  gcc-c++
BuildRequires:  gettext-devel
BuildRequires:  libjpeg8-devel
BuildRequires:  libtiff-devel
BuildRequires:  libxml2-devel
BuildRequires:  perl
BuildRequires:  unzip
BuildRequires:  wxWidgets-wxcontainer-devel
BuildRequires:  zip
Requires:       ImageMagick
Requires:       libwx_gtk2u_richtext-2_8-0-wxcontainer
ExclusiveArch:  %{ix86}  x86_64
BuildRequires:  libpng12-devel
BuildRequires:  update-desktop-files
BuildRequires:  fdupes

%description
Xara Xtreme for Linux is a powerful, general purpose vector graphics program for Unix
platforms including Linux, FreeBSD and (in development) OS-X.  Formely known as
Xara LX, it is based on Xara Xtreme for Windows, which is the fastest graphics
program available, period. The Xara Xtreme source code was made available
open-source in early 2006, and is being ported to Linux. This process is almost
complete and Xara Xtreme for Linux is available for download now.

Authors:
--------
    dev@xaraxtreme.org


%package devel
Summary:        Development files for XaraLX
Group:          Development/Other
Requires:       %{name} = %{version}
Requires:       libjpeg8-devel
Requires:       libpng-devel
Requires:       libtiff-devel
Requires:       wxGTK-devel

%description devel
Files to develop applications using XaraLX.

Authors:
--------
    dev@xaraxtreme.org


%prep
%setup -q -n XaraLX-%{version}
%patch0 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1

find -type d -name .svn -print0 | xargs -0 rm -rf {} \;

%build
export SUSE_ASNEEDED=0
./autogen.sh

CXXFLAGS="%{optflags} -fno-strict-aliasing -fpermissive -fno-pic" \
CFLAGS="%{optflags} -fno-strict-aliasing -fno-pic" \
LDFLAGS="-lgobject-2.0" \
%configure --enable-unicode \
           --enable-xarlib \
           --enable-filters \
           --disable-svnversion

%make_build

%install
mkdir -p %{buildroot}/%{_bindir}
%make_install
(cd %{buildroot}%{_bindir} && ln -s XaraLX xara  && ln -s XaraLX xaralx)
mkdir -p %{buildroot}/%{_datadir}/%{name}
(cd %{buildroot}/%{_datadir} && ln -s %{name} xaralx)

# /usr/share/xaralx/doc/xarax/ is used by the application for online help
(cd %{buildroot}/%{_datadir}/%{name} && ln -s %{_docdir}/%{name}/help doc)

install -m 644 %{SOURCE1} %{buildroot}%{_datadir}/%{name}
install -D -m 644 doc/en/LICENSE %{buildroot}%{_docdir}/%{name}/help/LICENSE

cp -a Designs TextDesigns Templates filters/SVGFilter/{tests,images,openclipart,samples} testfiles %{buildroot}/%{_datadir}/%{name}
cat doc/en/xaralxHelp.tar.gz | (cd %{buildroot}/%{_docdir}/%{name}/help; tar zxvf - )

find %{buildroot}/%{_docdir} -type f -print0 | xargs -0 dos2unix -q -o;
find %{buildroot}/%{_datadir} %{buildroot}/%{_docdir} -type f -print0 | xargs -0 chmod 644;

perl -ape 's{((src|document.location\s+)=.?")}{$1help/}g;' < %{buildroot}/%{_docdir}/%{name}/help/xaralx.htm > %{buildroot}/%{_docdir}/%{name}/help.html

install -m 644 COPYING LICENSE README MTRand.txt doc/gifutil.txt doc/XSVG.txt %{buildroot}/%{_docdir}/%{name}/

install -D -m 644 doc/xaralx.1 %{buildroot}%{_mandir}/man1/XaraLX.1
(cd %{buildroot}%{_mandir}/man1 && ln -s XaraLX.1 xaralx.1 && ln -s XaraLX.1 xara.1)

install -D -m 644 xaralx.png %{buildroot}%{_datadir}/pixmaps/xaralx.png
# install -D -m 644 %SOURCE2 %buildroot%_datadir/applications/xaralx.desktop

%suse_update_desktop_file -i -n xaralx Graphics VectorGraphics

chmod 750 %{buildroot}%{_datadir}/XaraLX/tests/makerandom.sh

# avoid duplicates and save space...
%fdupes -s %{buildroot}

dos2unix %{buildroot}%{_docdir}/%{name}/MTRand.txt


%files
%doc %{_docdir}/%{name}
%{_bindir}/*ara*
%{_bindir}/expandxar
%dir %{_datadir}/%{name}
%dir %{_datadir}/xaralx
%dir %{_datadir}/xaralx/filters
%{_datadir}/%{name}/*
%{_datadir}/xaralx/*
%{_datadir}/xaralx/filters/*
%{_datadir}/applications/*.desktop
%{_datadir}/pixmaps/xaralx.png
%{_mandir}/man1/*

%files devel
%dir %{_includedir}/xarlib
%{_includedir}/xarlib/*.h
%{_libdir}/libXar.a
%{_libdir}/pkgconfig/Xar.pc

%changelog
openSUSE Build Service is sponsored by