File typora.spec of Package typora

#
# spec file for package typora
#
# Copyright (c) 2021 Fusion Future <qydwhotmail@gmail.com>
#
# 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 source_dir bin/Typora-linux-x64
%global __provides_exclude_from ^%{_libexecdir}/.*$
%global __requires_exclude_from ^%{_libexecdir}/.*$
%global debug_package %{nil}
%define program_version 1.10.8
%undefine _missing_build_ids_terminate_build

Name:           typora
Version:        %{program_version}
Release:        0%{?dist}
Summary:        A markdown text editor
License:        SUSE-NonFree
Group:          Productivity/Text/Editors
Url:            https://www.typora.io/
Source:         Typora-linux-x64.tar.gz
Source1:        Typora.desktop
BuildRequires:  hicolor-icon-theme
BuildRequires:  desktop-file-utils
%if 0%{?suse_version}
BuildRequires:  update-desktop-files
%endif
%if 0%{?suse_version} || 0%{?fedora} || 0%{?mageia}
BuildRequires:  fdupes
Recommends:     pandoc
%endif
Requires:       libXss1

Provides:       application(typora.desktop)
ExclusiveArch:  x86_64

%description
Typora gives you a seamless experience as both a reader and a writer. It removes the preview window, mode switcher, syntax symbols of markdown source code, and all other unnecessary distractions. Instead, it provides a real live preview feature to help you concentrate on the content itself.

%prep
%setup -n bin -q

%build

%install
mkdir -p %{buildroot}%{_bindir} %{buildroot}%{_datadir}/applications %{buildroot}%{_libexecdir}/%{name}
cp -r %{_builddir}/%{source_dir}/* %{buildroot}%{_libexecdir}/%{name}/
ln -s ../../%{_libexecdir}/%{name}/Typora %{buildroot}/%{_bindir}/%{name}

# install icons
for x in 16 32 128 256 512
do
install -Dm644 %{_builddir}/%{source_dir}/resources/assets/icon/icon_${x}x${x}.png %{buildroot}%{_datadir}/icons/hicolor/${x}x${x}/apps/typora.png
done

desktop-file-install --dir %{buildroot}%{_datadir}/applications %{SOURCE1}
%if 0%{?suse_version}
%suse_update_desktop_file Typora
%endif

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

%files
%{_bindir}/%{name}
%{_datadir}/applications/Typora.desktop
%{_libexecdir}/%{name}
%{_datadir}/icons/*/*/*/typora.png

%changelog
openSUSE Build Service is sponsored by