File xmind.spec of Package XMind

#spec file for the program XMind
#
#This spec file is based on Tomas Tomecek repository at Github (https://github.com/TomasTomecek/fedora_rpm_xmind).
#I based almost all the commands he wrote here. The credit goes to him.
#The purpose of this repo is to give XMind support to most RPM-based systems, without depending of copr, which gives me problems
#on Korora, for example.

Name:           xmind
Version:        3.7.7
Release:        1%{?dist}
Summary:        Software to develop mind mapping and brainstorming diagrams
Group:          Productivity/Office/Other
License:        LGPL-3.0 or EPL-1.0
URL:            http://xmind.net
Source0:        %{name}-8-update7-linux.zip
Source1:        %{name}.desktop
Source2:        %{name}.png
Source3:        %{name}.xml
Source4:        %{name}
Patch0:         gtk3-java-modules.patch
BuildRequires:  unzip
BuildRequires:  hicolor-icon-theme
%if 0%{?suse_version} || 0%{?fedora}
BuildRequires:  fdupes
%endif

Requires:       java
Requires:       gtk3
Requires:       glibc

%description
XMind is a mind mapping and brainstorming software, that can capture ideas, clarify thinking,
manage complex information, and promote team collaboration for higher productivity

%prep
# unpack sources and patch
%setup -q -c
%patch0

# remove unneeded architecture
%ifarch x86_64 amd64
    %define archdir XMind_amd64
    rm -rf XMind_i386
%else
    %define archdir XMind_i386
    rm -rf XMind_amd64
%endif

%build
# Change pathes in start script
sed -i 's@==LIBEXEC==@%{_libexecdir}@g' %{SOURCE4}
sed -i 's@==NAME==@%{name}@g' %{SOURCE4}
sed -i 's@==ARCH==@%{archdir}@g' %{SOURCE4}

%install
mkdir -p %{buildroot}%{_libexecdir}/%{name}

install -Dm 755 %{SOURCE4} %{buildroot}%{_bindir}/%{name}
install -Dm 644 %{SOURCE1} %{buildroot}%{_datadir}/applications/%{name}.desktop
install -Dm 644 %{SOURCE2} %{buildroot}%{_datadir}/icons/hicolor/128x128/apps/%{name}.png
install -Dm 644 %{SOURCE3} %{buildroot}%{_datadir}/mime/packages/%{name}.xml

# Remove fonts from binary package, also remove original installation script
rm -r ./fonts
rm ./setup.sh

# copy remaining stuff to binary package
cp -af ./* %{buildroot}%{_libexecdir}/%{name}

%if 0%{?suse_version} || 0%{?fedora}
%fdupes %{buildroot}%{_libexecdir}
%endif

%clean

%files
%defattr(-,root,root)
%attr(755,root,root) %{_bindir}/%{name}
%{_libexecdir}/%{name}
%defattr(644,root,root)
%doc *.txt *.html
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.png
%{_datadir}/mime/packages/%{name}.xml

%changelog
* Mon Jul 09 2018 Martin Winter - 3.7.7
- remove fonts from binary package (should go to a separate package)
- remove that unneeded _setup.sh script

* Sun Jul 08 2018 Martin Winter - 3.7.7
- copied from open build service
- Updated to XMind 8 (3.7.7)
- Use original Linux download package for source instead of portable

* Sat Sep 10 2016 Pedro Rodríguez-de Oliveira <perodriguez@ic-itcr.ac.cr> - 6.0.4-1
- Added a "find and replace" to xmind, to make it work on OpenSUSE

* Tue Sep 06 2016 Pedro Rodríguez-de Oliveira <perodriguez@ic-itcr.ac.cr> - 3.6.1-1
- XMind repo is now opened
 
openSUSE Build Service is sponsored by