%define srcname XaraLX
%define appid org.xaraxtreme.XaraLX
%define ver 0.7
%define rev 1785
################################################################################
%define disable_svnversion %{nil}
%define disable_svnversion 1
%define disable_svnversion 0
# org.gnome.Sdk//3.28 && org.gnome.Platform//3.28
%define fix_xml2 %{nil}
%define fix_xml2 1
%if 0%{?rhel}%{?fedora}
%define fix_xml2 0
%endif
################################################################################
%define wx_version_major 2
%define wx_version_minor 8
%define force_wx_gtk2 %{nil}
%define force_wx_gtk2 1
################################################################################
%define wx_version %{wx_version_major}.%{wx_version_minor}
%define wx_name_postfix %{nil}
%if 0%{?wx_version_major} >= 3
%if 0%{?wx_version_minor} == 0
%define wx_name_postfix %{wx_version_major}
%else
%define wx_name_postfix %{wx_version_major}%{wx_version_minor}
%endif
%endif
# Force toolkit
# e.g. gtk2 instead of gtk3
%define wx_toolkit %{nil}
%if 0%{?force_wx_gtk2}
%if 0%{?wx_version_major} >= 3
%if 0%{?wx_version_minor} == 0
%define wx_toolkit gtk2
%endif
%endif
%endif
################################################################################
# see https://bugzilla.altlinux.org/show_bug.cgi?id=10382
%if 0%{!?_localstatedir:1}
%define _localstatedir %{_var}
%endif
################################################################################
%if 0%{!?makeinstall_std:1}
%define makeinstall_std %makeinstall
%endif
################################################################################
# https://logic-cone.blogspot.com/2018/03/building-tachyon-cvc-simulator-on.html
# https://copr-be.cloud.fedoraproject.org/results/scx/xaralx/fedora-rawhide-x86_64/00747088-xaralx/builder-live.log
# make[1]: Entering directory '/builddir/build/BUILD/XaraLX-0.7r1785'
# g++ -Wl,--start-group Kernel/libKernel.a wxOil/libwxOil.a tools/libTools.a wxXtra/libwxXtra.a -Wl,--end-group --debug -L./libs/x86_64 -pthread -Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -lwx_gtk2u_richtext-2.8 -lwx_gtk2u_aui-2.8 -lwx_gtk2u_xrc-2.8 -lwx_gtk2u_qa-2.8 -lwx_gtk2u_html-2.8 -lwx_gtk2u_adv-2.8 -lwx_gtk2u_core-2.8 -lwx_baseu_xml-2.8 -lwx_baseu_net-2.8 -lwx_baseu-2.8 -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfribidi -lfontconfig -lfreetype -lxml2 -lz -llzma -lm -ldl -ljpeg -lpng -lCDraw -o XaraLX
# /usr/bin/ld: ./libs/x86_64/libCDraw.a(libCDraw_la-GBevel.o): relocation R_X86_64_32 against `.bss' can not be used when making a PIE object; recompile with -fPIC
# ...
# /usr/bin/ld: ./libs/x86_64/libCDraw.a(libCDraw_la-gclip2.o): relocation R_X86_64_32 against symbol `_ZTIi@@CXXABI_1.3' can not be used when making a PIE object; recompile with -fPIC
# /usr/bin/ld: final link failed: Nonrepresentable section on output
# collect2: error: ld returned 1 exit status
%undefine flags_nopie
%if 0%{?__isa_bits} > 32
%if 0%{?rhel}%{?fedora}
%if 0%{?rhel}
%if 0%{?rhel} >= 8
%define flags_nopie 1
%endif
%else
%if 0%{?fedora} >= 20
%define flags_nopie 1
%endif
%endif
%endif
%endif
# https://fedoraproject.org/wiki/Changes/Harden_All_Packages
#%%define _hardened_build 1
%undefine _hardened_build
%define flags %{nil}
%define flags %{?flags_nopie:-no-pie}
################################################################################
# Define ix86 macro if it is not defined
%if 0%{!?ix86:1}
%define ix86 i386 i486 i586 i686 pentium3 pentium4 athlon geode
%endif
%if 0%{!?arch_x86_32:1}
%define arch_x86_32 %{ix86}
%endif
%if 0%{!?arch_x86_64:1}
%if 0%{?rhel}%{?fedora}
%define arch_x86_64 x86_64 amd64 ia32e
%else
%if 0%{?suse_version}
%define arch_x86_64 amd64
%else
%define arch_x86_64 x86_64 amd64 ia32e
%endif
%endif
%endif
%if 0%{!?arch_x86:1}
%define arch_x86 %{arch_x86_32} %{arch_x86_64}
%endif
%if 0%{!?arch_ppc_32:1}
%define arch_ppc_32 ppc
%endif
%if 0%{!?arch_ppc_64:1}
%define arch_ppc_64 ppc64 ppc64le
%endif
%if 0%{!?arch_ppc:1}
%define arch_ppc %{arch_ppc_32} %{arch_ppc_64}
%endif
%if 0%{!?arch_arm_32:1}
%define arch_arm_32 %{arm}
%endif
%if 0%{!?arch_arm_64:1}
%define arch_arm_64 aarch64
%endif
%if 0%{!?arch_arm:1}
%define arch_arm %{arch_arm_32} %{arch_arm_64}
%endif
# Define supported arches
# $ find libs/ -mindepth 2 -maxdepth 2 -xtype f -name '*.a' | sort -V | xargs -I{} file '{}'
# libs/darwin/libCDraw.a: Mach-O fat file with 2 architectures
# libs/ppc/libCDraw.a: current ar archive
# libs/x86/libCDraw.a: current ar archive
# libs/x86_64/libCDraw.a: current ar archive
%if 0%{!?xaralx_arches:1}
#%%define %%{ix86} x86_64 ppc
#%%define xaralx_arches %%{arch_x86} %%{arch_ppc} %%{arch_arm}
%define xaralx_arches %{arch_x86} %{arch_ppc_32}
%endif
################################################################################
%define dir_appdata metainfo
%if 0%{?rhel}%{?fedora}
%if 0%{?rhel}
%if 0%{?rhel} <= 7
%define dir_appdata appdata
%endif
%endif
%endif
%if 0%{!?_metainfodir:1}
%define _metainfodir %{_datadir}/%{dir_appdata}
%endif
%define dir_metainfo %( echo "%{_metainfodir}" | xargs -I{} basename '{}' )
################################################################################
%define doc_license %{nil}
%define doc_license 1
%if 0%{?rhel}%{?fedora}
%if 0%{?rhel}
%if 0%{?rhel} < 7
%define doc_license 0
%endif
%else
%if 0%{?fedora} < 19
%define doc_license 0
%endif
%endif
%else
%define doc_license 0
%endif
%define license_files COPYING LICENSE GPL libs/LIBS-LICENSE
################################################################################
Name: xaralx
Version: %{ver}r%{rev}
Release: 15%{?dist}
#Group: Graphics
Group: Applications/Multimedia
License: GPLv2
Summary: Xara Xtreme for Linux is a powerful, general purpose vector graphics program
URL: http://www.xaraxtreme.org
BuildRequires: gcc-c++
#
#BuildRequires: libstdc++-static
#
#BuildRequires: libjpeg-devel libturbojpeg-devel
#BuildRequires: pkgconfig(libtiff-4)
#BuildRequires: pkgconfig(libpng)
#BuildRequires: pkgconfig(libxml-2.0)
#BuildRequires: gettext-tools libasprintf-devel
#BuildRequires: libwxGTK-contrib-gizmos-devel libwxGTK-contrib-ogl-devel libwxGTK-contrib-stc-devel libwxGTK-devel
# documentation has wrong file end of line encoding
BuildRequires: dos2unix
BuildRequires: zip
BuildRequires: unzip
BuildRequires: pkgconfig
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: fdupes
BuildRequires: tar
BuildRequires: gzip
BuildRequires: bzip2
BuildRequires: bash
BuildRequires: coreutils
BuildRequires: findutils
BuildRequires: grep
BuildRequires: sed
BuildRequires: xmlstarlet
# BEGIN SourceDeps(oneline):
#BuildRequires: perl(Digest/MD5.pm) perl(Fcntl.pm) perl(FileHandle.pm)
#BuildRequires: pkgconfig(gtk+-2.0)
#BuildRequires: pkgconfig(pangox)
# END SourceDeps(oneline)
#Requires: ImageMagick-tools
%define packages_libjpeg libjpeg-turbo
%define packages_libpng libpng
%define packages_libtiff libtiff
%define packages_libxml libxml2
%define packages_wxgtk wxGTK
%define packages_gtk2 gtk2
%define packages_gtk3 gtk3
%define packages_pangox pangox
%define packages_perl perl perl-Digest-MD5 perl-File-FcntlLock perl-FileHandle-Unget
%define packages_gettext gettext gettext-devel
%define packages_desktop desktop-file-utils gtk-update-icon-cache libappstream-glib
%define packages_imagemagick ImageMagick
%define pkgconfig_libtiff pkgconfig(libtiff-4)
%define pkgconfig_libxml pkgconfig(libxml-2.0)
%define pkgconfig_gtk2 pkgconfig(gtk+-2.0)
%define pkgconfig_gtk3 pkgconfig(gtk+-3.0)
%define pkgconfig_pangox pkgconfig(pangox)
# https://en.opensuse.org/openSUSE:Build_Service_cross_distribution_howto
# https://www.altlinux.org/Packaging_Automation/%D0%98%D0%BC%D0%BF%D0%BE%D1%80%D1%82_%D0%9F%D0%B0%D0%BA%D0%B5%D1%82%D0%BE%D0%B2_%D0%B8%D0%B7_%D0%B4%D1%80%D1%83%D0%B3%D0%B8%D1%85_%D0%B4%D0%B8%D1%81%D1%82%D1%80%D0%B8%D0%B1%D1%83%D1%82%D0%B8%D0%B2%D0%BE%D0%B2
%if 0%{?rhel}%{?fedora}
%if "%{?wx_toolkit}" != ""
%define packages_wxgtk compat-wxGTK%{?wx_name_postfix}-%{wx_toolkit}
%else
%define packages_wxgtk wxGTK%{?wx_name_postfix}
%endif
%define pkgconfig_libpng pkgconfig(libpng)
%if 0%{?fedora} >= 24 || 0%{?rhel} >= 8
%define pkgconfig_libjpeg pkgconfig(libjpeg)
%endif
%else
%if 0%{?suse_version}
%define packages_libjpeg libjpeg
%define packages_wxgtk wxGTK
%define packages_gettext gettext-devel
%define packages_desktop update-desktop-files
%define packages_imagemagick imagemagick
%if 0%{?suse_version} > 1110
%define packages_libpng libpng12
%else
%define packages_libpng libpng
%endif
%else
%if 0%{?mdkversion}0%{?mgaversion}
%define packages_libjpeg jpeg
%define pkgconfig_libpng pkgconfig(libpng)
%define packages_wxgtk wxgtku
%define packages_gettext gettext-devel
%define packages_imagemagick imagemagick
%else
%if 0%{?alt_version}
%define packages_libjpeg libjpeg libturbojpeg
%define pkgconfig_libpng pkgconfig(libpng)
%define packages_wxgtk libwxGTK-contrib-gizmos libwxGTK-contrib-ogl libwxGTK-contrib-stc libwxGTK
%define packages_perl perl(Digest/MD5.pm) perl(Fcntl.pm) perl(FileHandle.pm)
%define packages_gettext gettext-tools libasprintf-devel
%define packages_imagemagick ImageMagick-tools
%endif
%endif
%endif
%endif
%{?packages_libjpeg:%define packages_libjpeg_devel %( echo '%{packages_libjpeg}' | tr ' ' '\n' | sed -re 's/$/-devel/' | tr '\n' ' ' )}
%{?packages_libpng:%define packages_libpng_devel %( echo '%{packages_libpng}' | tr ' ' '\n' | sed -re 's/$/-devel/' | tr '\n' ' ' )}
%{?packages_libtiff:%define packages_libtiff_devel %( echo '%{packages_libtiff}' | tr ' ' '\n' | sed -re 's/$/-devel/' | tr '\n' ' ' )}
%{?packages_libxml:%define packages_libxml_devel %( echo '%{packages_libxml}' | tr ' ' '\n' | sed -re 's/$/-devel/' | tr '\n' ' ' )}
%{?packages_wxgtk:%define packages_wxgtk_devel %( echo '%{packages_wxgtk}' | tr ' ' '\n' | sed -re 's/$/-devel/' | tr '\n' ' ' )}
%{?packages_gtk2:%define packages_gtk2_devel %( echo '%{packages_gtk2}' | tr ' ' '\n' | sed -re 's/$/-devel/' | tr '\n' ' ' )}
%{?packages_gtk3:%define packages_gtk3_devel %( echo '%{packages_gtk3}' | tr ' ' '\n' | sed -re 's/$/-devel/' | tr '\n' ' ' )}
%define pkgconfig_gtk %{pkgconfig_gtk2}
%define packages_gtk %{packages_gtk2}
%if 0%{?rhel}%{?fedora}
%if 0%{?wx_version_major} >= 3 && "%{?wx_toolkit}" != "gtk2"
%define pkgconfig_gtk %{pkgconfig_gtk3}
%define packages_gtk %{packages_gtk3}
%endif
%endif
%{?pkgconfig_libjpeg:BuildRequires: %{pkgconfig_libjpeg}}%{!?pkgconfig_libjpeg:%{?packages_libjpeg_devel:BuildRequires: %{packages_libjpeg_devel}}}
%{?pkgconfig_libpng:BuildRequires: %{pkgconfig_libpng}}%{!?pkgconfig_libpng:%{?packages_libpng_devel:BuildRequires: %{packages_libpng_devel}}}
%{?pkgconfig_libtiff:BuildRequires: %{pkgconfig_libtiff}}%{!?pkgconfig_libtiff:%{?packages_libtiff_devel:BuildRequires: %{packages_libtiff_devel}}}
%{?pkgconfig_libxml:BuildRequires: %{pkgconfig_libxml}}%{!?pkgconfig_libxml:%{?packages_libxml_devel:BuildRequires: %{packages_libxml_devel}}}
%{?pkgconfig_wxgtk:BuildRequires: %{pkgconfig_wxgtk}}%{!?pkgconfig_wxgtk:%{?packages_wxgtk_devel:BuildRequires: %{packages_wxgtk_devel}}}
%{?pkgconfig_gtk:BuildRequires: %{pkgconfig_gtk}}%{!?pkgconfig_gtk:%{?packages_gtk_devel:BuildRequires: %{packages_gtk_devel}}}
%{?pkgconfig_pangox:BuildRequires: %{pkgconfig_pangox}}%{!?pkgconfig_pangox:%{?packages_pangox_devel:BuildRequires: %{packages_pangox_devel}}}
%{?packages_perl:BuildRequires: %{packages_perl}}
%{?packages_gettext:BuildRequires: %{packages_gettext}}
%{?packages_desktop:BuildRequires: %{packages_desktop}}
%{?packages_imagemagick:BuildRequires: %{packages_imagemagick}}
%{?packages_imagemagick:Requires: %{packages_imagemagick}}
%if 0%{?rhel}%{?fedora}
# https://fedoraproject.org/wiki/Packaging:Scriptlets
# https://fedoraproject.org/wiki/PackagingDrafts/ScriptletSnippets
# gtk-update-icon-cache
Requires(post): gtk-update-icon-cache
Requires(postun): gtk-update-icon-cache
Requires(posttrans): gtk-update-icon-cache
# update-mime-database
#Requires(post): shared-mime-info
#Requires(postun): shared-mime-info
#Requires(posttrans): shared-mime-info
# update-desktop-database
Requires(post): desktop-file-utils
Requires(postun): desktop-file-utils
#Requires(posttrans): desktop-file-utils
# ldconfig
#Requires(post): glibc
#Requires(postun): glibc
#Requires(posttrans): glibc
%endif
# http://downloads.xara.com/opensource/xaralx0.7_rev1785.tar.bz2
# http://downloads.xara.com/opensource/%{name}%{ver}_rev%{rev}.tar.bz2
#Source0: http://downloads.xara.com/opensource/%{name}%{ver}_rev%{rev}.tar.bz2#/%{srcname}-%{ver}r%{rev}.tar.bz2
Source0: http://archive.ubuntu.com/ubuntu/pool/multiverse/x/%{name}/%{name}_%{ver}r%{rev}.orig.tar.gz#/%{srcname}-%{ver}r%{rev}.tar.gz
#Source0: %{srcname}-%{ver}r%{rev}.tar.bz2
#from OpenSuse
Source1: XARFormatDocument.pdf
Source2: %{name}.desktop
#from https://translations.launchpad.net/xaralx
Source3: %{srcname}-i18n-0.7r1785.tar.gz
Source4: xaralx.svg
Source5: xaralx.appdata.xml
#Source44: import.info
Patch1: abuild.diff
Patch2: XaraLX-0.7r1785-missing-declaration.patch
Patch3: xaralx-0.7_p1785-pragma-gentoo.patch
Patch4: xaralx-gsocket.patch
Patch5: xaralx-0.7_p1785-libpng15-gentoo.patch
Patch6: 30_gtk_wxwidgets_symbol_clash-deb.patch
Patch7: 50_update_imagemagick_version_parser-deb.patch
#Patch8: add-linker-flags-deb-mga.patch
Patch8: add-linker-flags-deb-mga-el.patch
Patch9: wxOil-wxHandleFatalError.patch
Patch10: xaralx-pragma.patch
Provides: %{srcname} = %{?epoch:%{epoch}:}%{version}-%{release}
#ExclusiveArch: %%{ix86} x86_64 ppc
ExclusiveArch: %{xaralx_arches}
%description
Xara Xtreme for Linux is a powerful, general purpose
vector graphics program for Unix platforms including
Linux, FreeBSD and (in development) Mac 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.
%package devel
#Group: Development/Other
Group: Development/Libraries
License: GPLv2
Summary: Development files for %{srcname}
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
%{?pkgconfig_libjpeg:Requires: %{pkgconfig_libjpeg}}%{!?pkgconfig_libjpeg:%{?packages_libjpeg_devel:Requires: %{packages_libjpeg_devel}}}
%{?pkgconfig_libpng:Requires: %{pkgconfig_libpng}}%{!?pkgconfig_libpng:%{?packages_libpng_devel:Requires: %{packages_libpng_devel}}}
%{?pkgconfig_libtiff:Requires: %{pkgconfig_libtiff}}%{!?pkgconfig_libtiff:%{?packages_libtiff_devel:Requires: %{packages_libtiff_devel}}}
%{?pkgconfig_libxml:Requires: %{pkgconfig_libxml}}%{!?pkgconfig_libxml:%{?packages_libxml_devel:Requires: %{packages_libxml_devel}}}
%{?pkgconfig_wxgtk:Requires: %{pkgconfig_wxgtk}}%{!?pkgconfig_wxgtk:%{?packages_wxgtk_devel:Requires: %{packages_wxgtk_devel}}}
%description devel
Files to develop applications using %{srcname}.
%prep
%setup -q -n "%{srcname}-%{ver}r%{rev}"
pushd "po" >/dev/null 2>&1
%{__tar} -xf "%{SOURCE3}"
popd >/dev/null 2>&1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
file_makefile="Makefile.am"
date_orig_makefile="$( stat -c "%Y" "${file_makefile}" )"
%patch8 -p1
# Fix build on Fedora x86-64
# https://lists.debian.org/debian-devel/2016/05/msg00309.html
# code compiled without -fPIC and without -fPIE can be used only
# in non-PIE executables
%if 0%{?flags_nopie}
#sed -r -i 's/([[:blank:]]+)(\-lCDraw)([[:blank:]]+|$)/\1\-Wl,\-Bstatic \2\3 \-Wl,\-Bdynamic /' "${file_makefile}"
#sed -r -i 's/^(XaraLX_C.*)$/\1 \-fPIC \-DPIC /' "${file_makefile}"
#sed -r -i 's/^(XaraLX_C.*)$/\1 \-fno\-PIC \-Dno\-PIC /' "${file_makefile}"
#sed -r -i 's/^(XaraLX_C.*)$/\1 \-fPIE \-pie /' "${file_makefile}"
#sed -r -i 's/^(XaraLX_C.*)$/\1 \-fno\-PIE \-no\-pie /' "${file_makefile}"
#sed -r -i 's/^(XaraLX_LDFLAGS.*)$/\1 \-fPIC \-DPIC /' "${file_makefile}"
#sed -r -i 's/^(XaraLX_LDFLAGS.*)$/\1 \-fno\-PIC \-Dno\-PIC /' "${file_makefile}"
#sed -r -i 's/^(XaraLX_LDFLAGS.*)$/\1 \-fPIE \-pie /' "${file_makefile}"
#sed -r -i 's/^(XaraLX_LDFLAGS.*)$/\1 \-fno\-PIE \-no\-pie /' "${file_makefile}"
sed -r -i 's/^(XaraLX_LDFLAGS.*)$/\1 \-no\-pie /' "${file_makefile}"
%endif
touch -d "@${date_orig_makefile}" "${file_makefile}"
%patch9 -p0
%patch10 -p0
#find -type d -name ".svn" -print0 | xargs -0 rm -rf {} \;
find . -type d -name '.svn' -prune -exec rm -rf {} +
#string "800_by_600_drawing.xar" must not be translated
%{__sed} -i 's|msgstr "800 на 600 drawing.xar"|msgstr ""|g' "po/ru.po"
%if 0%{?fix_xml2}
echo 'fix configure: xml2'
find * -xtype f \( -name 'configure' -o -name 'configure.in' -o -name 'output.0' -o -name 'output.1' \) | sort -V | while read -r filename; do
sed -r -i 's/^([[:blank:]]*XML2CONFIG=)(xml2-config)([[:blank:]]*)$/\1"pkg-config libxml-2.0"\3/' "${filename}"
sed -r -i 's/([[:blank:]]*|^)(test "\$xml2version" -lt )([0-9]+)([^0-9]|$)/\1\20\4/g' "${filename}"
done
grep -HERi 'XML2CONFIG=' * || :
grep -HERi '\$xml2version' * || :
%endif
%{__cp} %{SOURCE1} %{SOURCE2} %{SOURCE4} %{SOURCE5} .
%build
%if 0%{wx_version_major} < 3
WXCONFIG="wx-config"
%else
WXCONFIG="wx-config-%{wx_version}"
%endif
export WXCONFIG
%if "%{?wx_toolkit}" != ""
if hash "${WXCONFIG}-%{?wx_toolkit}" >/dev/null 2>&1 ; then
WXCONFIG="${WXCONFIG}-%{?wx_toolkit}"
export WXCONFIG
fi
%endif
WXCONFIG_PATH="$( command -v "${WXCONFIG}" )"
#export GTK_LIBS="$( pkg-config --libs gtk+-2.0 )
./autogen.sh
pushd "filters/SVGFilter" >/dev/null 2>&1
autoreconf -f -i
popd >/dev/null 2>&1
export CFLAGS="%{optflags} -fno-strict-aliasing "
export CXXFLAGS="%{optflags} -fno-strict-aliasing -fpermissive "
export LDFLAGS="${LDFLAGS} -lgobject-2.0 "
%if 0%{?flags_nopie}
#export CFLAGS="%{optflags} -fno-strict-aliasing -fPIC -DPIC -fno-PIE "
#export CXXFLAGS="%{optflags} -fno-strict-aliasing -fpermissive -fPIC -DPIC -fno-PIE "
#export LDFLAGS="${LDFLAGS} -lgobject-2.0 -fno-PIE -no-pie "
#export CFLAGS="%{optflags} -fno-strict-aliasing -fno-PIC -Dno-PIC -fno-PIE -no-pie "
#export CXXFLAGS="%{optflags} -fno-strict-aliasing -fpermissive -fno-PIC -Dno-PIC -fno-PIE -no-pie "
#export LDFLAGS="${LDFLAGS} -lgobject-2.0 -fno-PIC -Dno-PIC -fno-PIE -no-pie "
#export CXXFLAGS="$( sed -re 's/[^[:blank:]]*hardened[^[:blank:]]*//g' <<< "${CXXFLAGS}" )"
#export CFLAGS="$( sed -re 's/[^[:blank:]]*hardened[^[:blank:]]*//g' <<< "${CFLAGS}" )"
#export LDFLAGS="$( sed -re 's/[^[:blank:]]*hardened[^[:blank:]]*//g' <<< "${LDFLAGS}" )"
%endif
%configure --enable-unicode \
--enable-xarlib \
--enable-filters \
%if 0%{?disable_svnversion}
--disable-svnversion \
%endif
--with-wx-config="${WXCONFIG_PATH}"
echo "Test: wx-config"
"${WXCONFIG_PATH}" --libs
echo
echo "Test: Flags"
echo "${CFLAGS}"
echo "${CXXFLAGS}"
echo "${LDFLAGS}"
echo
echo "Test: hardening before fix"
grep -HERi 'hardened|hardening' * || :
echo
# Fix build on Fedora x86-64
# $ /usr/bin/wx-config --libs
# -pthread -Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -lwx_gtk2u_richtext-2.8 -lwx_gtk2u_aui-2.8 -lwx_gtk2u_xrc-2.8 -lwx_gtk2u_qa-2.8 -lwx_gtk2u_html-2.8 -lwx_gtk2u_adv-2.8 -lwx_gtk2u_core-2.8 -lwx_baseu_xml-2.8 -lwx_baseu_net-2.8 -lwx_baseu-2.8
%if 0%{?flags_nopie}
for text in "%{_hardening_cflags}" "%{_hardening_ldflags}" ; do
text_cleared="$( sed -re 's/^[[:blank:]]*//;s/[[:blank:]]*$//' <<< "${text}" )"
[[ -n "${text_cleared}" ]] || continue
#sed_cmd="s#([[:blank:]]+|^)(${text_cleared})([[:blank:]]+|$)#\1\3#g"
#find * -xtype f \( -name 'Makefile' -o -name 'config.log' -o -name 'config.status' \) | xargs -I{} sed -r -i "${sed_cmd}" '{}'
sed -re 's/[[:blank:]]+/\n/g' <<< "${text_cleared}" | grep -Ei 'hardened' | while read -r subtext_cleared ; do
#[[ "${subtext_cleared}" != "${text_cleared} ]] || continue
sed_cmd="s#([[:blank:]]+|^)(${subtext_cleared})([[:blank:]]+|$)#\1\3#g"
find * -xtype f \( -name 'Makefile' -o -name 'config.log' -o -name 'config.status' \) | xargs -I{} sed -r -i "${sed_cmd}" '{}'
done
done
%endif
echo "Test: hardening after fix"
grep -HERi 'hardened|hardening' * || :
echo
%{__make} %{?_smp_mflags}
# Compile locales by hand.
pushd "po" >/dev/null 2>&1
for f in *.po; do
t="${f#%{name}-}"
msgfmt -v -o "${t%.po}.mo" "${f}"
done
popd >/dev/null 2>&1
# Create icons.
%{__mkdir} -p "rpm_icons"
#for s in {16,24,32,48} ; do
for s in {16,22,24,32,48,64,72,96,128,192,256,512}; do
size="${s}x${s}"
#ext="png"
#sc="$(( s % 12 ))"
#if [[ "${sc}" -ne "0" ]]; then
# ext="xpm"
#fi
#file="xaralx.${ext}"
file="xaralx.svg"
%{__mkdir} -p "rpm_icons/${size}"
#convert "${file}" -resize "${size}" "rpm_icons/${size}/xaralx.png"
convert -background none -density 1024 -resize "${size}" "${file}" "rpm_icons/${size}/xaralx.png"
done
# Update desktop file.
#echo "FilePattern=xaralx;" >> "%{name}.desktop"
#echo "TryExec=xaralx" >> "%{name}.desktop"
desktop-file-edit --set-key='Icon' --set-value="%{name}" "xaralx.desktop"
desktop-file-edit --set-key='FilePattern' --set-value="%{name}" "xaralx.desktop"
desktop-file-edit --set-key='TryExec' --set-value="%{name}" "xaralx.desktop"
app_id='%{appid}';
echo "app_id: ${app_id}";
app_ver="$( grep -Ei '^[[:blank:]]*VERSION[[:blank:]]*=[[:blank:]]*([^[:blank:]]*)*[[:blank:]]*$' 'configure' 2>/dev/null | tail -n 1 2>/dev/null | sed -re 's/^[[:blank:]]*VERSION[[:blank:]]*=[[:blank:]]*([^[:blank:]]*)*[[:blank:]]*$/\1/' 2>/dev/null || :; )";
echo "app_ver: ${app_ver}";
app_rev="$( grep -E 'DECLARE_SOURCE\("\$Revision: [0-9]+ \$"\);' 'Kernel/snapops.cpp' 2>/dev/null | grep -Eo '[0-9]+' 2>/dev/null | head -n 1 2>/dev/null || :; )";
echo "app_rev: ${app_rev}";
app_version='';
if [[ -n "${app_ver}" ]]; then
app_version="${app_ver}";
if [[ -n "${app_rev}" ]]; then
app_version+="r${app_rev}";
fi;
fi;
echo "app_version: ${app_version}";
app_date="$( date --reference 'ChangeLog' -u '+%Y-%m-%d' 2>/dev/null || :; )";
echo "app_date: ${app_date}";
find . -mindepth 0 -maxdepth 0 -xtype f -name '*.appdata.xml' | sort -V | while read -r filename; do
if [[ -n "${app_version}" && -n "${app_date}" ]]; then
need_fix='0';
xmlstarlet sel -t -v '/component/releases/release/@version' "${filename}" || need_fix='1';
if [[ "${need_fix}" -ne "0" ]]; then
echo 'updating release info';
xmlstarlet ed --inplace -d '/component/releases' -s '/component' -t elem -n 'releases' -s '/component/releases' -t elem -n 'release' -s '/component/releases/release' -t attr -n 'version' -v \"${app_version}\" -s '/component/releases/release' -t attr -n 'date' -v "${app_date}" "${filename}";
xmlstarlet sel -t -c '/component/releases/release' "${filename}" | sed -re 's/$/\n/' || :;
fi
fi;
if [[ -n "${app_id}" ]]; then
id="$( xmlstarlet sel -t -v '/component/id' "${filename}" 2>/dev/null | head -n 1 2>/dev/null || :; )";
if [[ "${id}" != "${app_id}.desktop" ]]; then
xmlstarlet ed --inplace -d '/component/id' -s '/component' -t elem -n 'id' -v "${app_id}.desktop" "${filename}";
fi;
need_fix='0';
xmlstarlet sel -t -v '/component/launchable' "${filename}" || need_fix='2';
if [[ "${need_fix}" -ne "0" ]]; then
echo 'adding additional tags: launchable';
xmlstarlet ed --inplace -d '/component/launchable' -s '/component' -t elem -n 'launchable' -v "${app_id}.desktop" -s '/component/launchable' -t attr -n 'type' -v 'desktop-id' "${filename}";
xmlstarlet sel -t -c '/component/launchable' "${filename}" | sed -re 's/$/\n/' || :;
fi;
fi;
done;
%install
%{__mkdir} -p "%{buildroot}%{_bindir}"
%makeinstall_std
( cd "%{buildroot}%{_bindir}" && ln -s "%{srcname}" xara && ln -s "%{srcname}" "%{name}" )
( cd "%{buildroot}%{_datadir}" && ln -s "%{name}" "%{srcname}" )
# /usr/share/%{name}/doc/%{name}/ is used by the application for online help
( cd "%{buildroot}%{_datadir}/%{name}" && ln -s "%{_docdir}/%{name}/help" "doc" )
%{__install} -D -m 644 "doc/en/LICENSE" "%{buildroot}%{_docdir}/%{name}/help/LICENSE"
%{__install} -m 644 "XARFormatDocument.pdf" "%{buildroot}%{_docdir}/%{name}"
%{__cp} -a "Designs" "TextDesigns" "Templates" "filters/SVGFilter"/{tests,images,openclipart,samples} "testfiles" "%{buildroot}%{_datadir}/%{name}"
%{__cat} "doc/en/%{name}Help.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/%{name}.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/%{name}.1" "%{buildroot}%{_mandir}/man1/%{name}.1"
( cd "%{buildroot}%{_mandir}/man1" && ln -s "%{name}.1" "%{srcname}.1" && ln -s "%{name}.1" "xara.1" )
%{__install} -D -m 644 "%{name}.png" "%{buildroot}%{_datadir}/pixmaps/%{appid}.png"
%{__ln_s} "%{appid}.png" "%{buildroot}%{_datadir}/pixmaps/%{name}.png"
%{__install} -D -m 644 "%{name}.desktop" "%{buildroot}%{_datadir}/applications/%{appid}.desktop"
%{__chmod} 755 "%{buildroot}%{_datadir}/%{name}/tests/makerandom.sh"
# Install icons.
find "rpm_icons" -mindepth 2 -maxdepth 2 -type f -name 'xaralx.png' | sort -V | xargs -I{} dirname '{}' | xargs -I{} basename '{}' | while read -r size ; do
%{__install} -p -D -m 0644 "rpm_icons/${size}/xaralx.png" "%{buildroot}%{_datadir}/icons/hicolor/${size}/apps/%{appid}.png"
%{__ln_s} "%{appid}.png" "%{buildroot}%{_datadir}/icons/hicolor/${size}/apps/%{name}.png"
done
%{__install} -p -D -m 644 "%{name}.appdata.xml" "%{buildroot}%{_metainfodir}/%{appid}.appdata.xml"
# Install locales by hand.
pushd "po" >/dev/null 2>&1
for f in *.mo; do
%{__install} -pD -m644 "${f}" "%{buildroot}%_datadir/locale/${f%.mo}/LC_MESSAGES/%{srcname}.mo"
done
popd >/dev/null 2>&1
%find_lang "%{srcname}"
%check
desktop-file-validate "%{buildroot}/%{_datadir}/applications/%{appid}.desktop"
appstream-util validate-relax --nonet "%{buildroot}%{_metainfodir}/%{appid}.appdata.xml"
%post
touch --no-create "%{_datadir}/icons/hicolor" &>/dev/null || :
gtk-update-icon-cache "%{_datadir}/icons/hicolor" &>/dev/null || :
#update-mime-database "%{_datadir}/mime" &>/dev/null || :
update-desktop-database &>/dev/null ||:
#/sbin/ldconfig
%postun
if [[ "${1}" -eq "0" ]] ; then
touch --no-create "%{_datadir}/icons/hicolor" &>/dev/null
gtk-update-icon-cache "%{_datadir}/icons/hicolor" &>/dev/null || :
#update-mime-database "%{_datadir}/mime" &>/dev/null || :
fi
update-desktop-database &>/dev/null ||:
#/sbin/ldconfig
%posttrans
gtk-update-icon-cache "%{_datadir}/icons/hicolor" &>/dev/null || :
#update-mime-database -n %{_datadir}/mime &>/dev/null || :
#/sbin/ldconfig
%files -f "%{srcname}.lang"
%doc %{_docdir}/%{name}
%doc ABOUT-NLS INSTALL
%doc buildServerLog.txt MTRand.txt Pragmas.txt
%doc ChangeLog Doxyfile NEWS portnotes
%if 0%{?doc_license}
%license %{license_files}
%else
%doc %{license_files}
%endif
%{_bindir}/*
%{_datadir}/%{srcname}
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/*
%{_datadir}/applications/*.desktop
%{_datadir}/pixmaps/*.png
%{_datadir}/icons/hicolor/*/apps/*.??g
%{_mandir}/man1/*
%{_metainfodir}/%{appid}.appdata.xml
%files devel
%dir %{_includedir}/xarlib
%{_includedir}/xarlib/*.h
%{_libdir}/libXar.a
%{_libdir}/pkgconfig/Xar.pc
%changelog
* Mon May 14 2018 Tomasz Tomasik - 0.7r1785-15
- Update Source0 URL
- Update icons
- Update desktop file
- Update docs
- Add AppData file
- Rebuilt for EL7
* Mon Apr 30 2018 Tomasz Tomasik - 0.7r1785-14
- Fix build for x86-64 Fedora >= 28
- Rebuilt for EL7
* Mon Apr 30 2018 Tomasz Tomasik - 0.7r1785-13
- SPEC file cleanups
- Fix build for EL
- Rebuilt for EL7
* Mon Apr 30 2018 Tomasz Tomasik - 0.7r1785-12
- Fix build for x86-64 Fedora
- Rebuilt for EL7
* Sun Apr 29 2018 Tomasz Tomasik - 0.7r1785-11
- Fix build for mock
- Rebuilt for EL7
* Sun Apr 29 2018 Tomasz Tomasik - 0.7r1785-10
- SPEC file cleanups
- Update requirements
- Update desktop file
- Add icons
- Add check, post, postun, posttrans sections
- Rebuilt for EL7
* Sun Apr 29 2018 Tomasz Tomasik - 0.7r1785-9
- SPEC file cleanups
- Use license macro
- Update requirements for EL/Fedora, SUSE/openSUSE, Mageia/Mandrake, ALT Linux
- Rebuilt for EL7
* Sun Mar 18 2018 Igor Vlasenko - 0.7-alt1_0.rev17858
- new version