File sam.spec of Package sam

#
# spec file for package sam
#
# Copyright (c) 2020 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:           sam
Version:        0+git.1759613702.d2e167d
Release:        0
Summary:        A line-oriented text editor
License:        ISC
Group:          Productivity/Text/Editors
URL:            https://github.com/japanoise/sam
Source0:        sam-%{version}.tar.xz
# PATCH-FIX-UPSTREAM manpage-build.patch mcepl@suse.com
# Essentially gh#deadpixi/sam!109
# Don't use absolute pathnames in %%{_mandir}
Patch0:         manpage-build.patch
BuildRequires:  gcc
BuildRequires:  pkgconfig(xft)
BuildRequires:  pkgconfig(xi)
BuildRequires:  pkgconfig(xt)
BuildRequires:  xdg-utils
BuildRequires:  ghostscript
BuildRequires:  pandoc-cli
BuildRequires:  groff-full
Recommends:     openssh

%description
A minimalist text editor with a graphical user interface,
a very powerful command language and remote editing capabilities.

%prep
%autosetup -p1
cp config.mk.def config.mk
make clean

# manpage shouldn't have executable bits
chmod -x doc/ssam.1

%build
make MODE=system
ps2pdf doc/sam.ps doc/sam.pdf
ps2pdf doc/se.ps doc/se.pdf
pandoc -f markdown -t pdf --pdf-engine=pdfroff -o doc/sam_tut.pdf doc/sam_tut.md

%install
mkdir -p %{buildroot}/usr/share/desktop-directories
make MODE=system DESTDIR=%{buildroot}%{_prefix} install
install -p -m644 -D -t %{buildroot}%{_datadir}/applications *.desktop

%files
%license LICENSE
%doc README.rst
%doc doc/*.pdf
%{_bindir}/%{name}
%{_bindir}/s%{name}
%{_bindir}/%{name}term
%{_bindir}/B
%{_datadir}/applications/*%{name}.desktop
%{_mandir}/man1/sam.1%{?ext_man}
%{_mandir}/man1/sam.save.1%{?ext_man}
%{_mandir}/man1/samterm.1%{?ext_man}
%{_mandir}/man1/rsam.1%{?ext_man}
%{_mandir}/man1/ssam.1%{?ext_man}
%{_mandir}/man1/B.1%{?ext_man}
%{_mandir}/man5/samrc.5%{?ext_man}

%changelog
openSUSE Build Service is sponsored by