File tke.spec of Package tke

#
# spec file for package tke
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2017 Huaren Zhong <huaren.zhong@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/
#


Name:           tke
Version:        3.6
Release:        2
Summary:        Advanced Programmer's Editor
License:        GPL-2.0-or-later
Group:          Productivity/Text/Editors
URL:            http://tke.sourceforge.net/
Source0:        https://jaist.dl.sourceforge.net/project/%{name}/%{version}/%{name}-%{version}.tgz
Source1:        %{name}.desktop
Source99:       %{name}-rpmlintrc
BuildRequires:  fdupes
Requires:       expect
Requires:       tcl
Requires:       tcllib
Requires:       tclx
Requires:       tk
Requires:       tkdnd
Requires:       tklib
BuildArch:      noarch

%description
TKE is a full-featured source code editor written in Tcl/Tk with a minimalist UI.

%prep
%setup -q
# set proper shebang
sed '/^#!/c#!\/usr\/bin\/perl -w' -i lib/tkcon/docs/perl.txt
sed -i '1s|^#!/bin/tclsh..*$|#!%_bindir/tclsh|' lib/ctext/function_finder.tcl
sed -i '1s|^#!.*tclkit.*$|#!%_bindir/tclsh|' lib/webdav/*.test
# remove hidden files
find \( -name .DS_Store -o -name .tkesort \) -delete
# remove executable bit
chmod -x lib/ctext/REGRESSION lib/ctext/install.tcl lib/lang.tcl \
 lib/tkcon/docs/bindings.html lib/tkcon/docs/changes.txt \
 lib/tkcon/docs/dump.html lib/tkcon/docs/idebug.html \
 lib/tkcon/docs/index.html lib/tkcon/docs/license.terms \
 lib/tkcon/docs/limits.html lib/tkcon/docs/nontcl.html \
 lib/tkcon/docs/observe.html lib/tkcon/docs/plugin.html \
 lib/tkcon/docs/procs.html lib/tkcon/docs/purpose.html \
 lib/tkcon/docs/start.html lib/tkcon/docs/tkcon.html \
 lib/tkcon/docs/todo.html lib/tkcon/index.html plugins/e_menu/README.md \
 plugins/e_menu/e_menu/menus/fossil.mnu \
 plugins/e_menu/e_menu/menus/fossil2.mnu \
 plugins/e_menu/e_menu/menus/git.mnu plugins/e_menu/e_menu/menus/git2.mnu \
 plugins/e_menu/e_menu/menus/links.mnu \
 plugins/e_menu/e_menu/menus/links2.mnu \
 plugins/e_menu/e_menu/menus/menu.mnu \
 plugins/e_menu/e_menu/menus/python.mnu \
 plugins/e_menu/e_menu/menus/side.mnu \
 plugins/e_menu/e_menu/menus/tcltk.mnu \
 plugins/e_menu/e_menu/menus/test1.mnu \
 plugins/e_menu/e_menu/menus/test2.mnu \
 plugins/e_menu/e_menu/menus/test3.mnu plugins/e_menu/e_menu/menus/utils.mnu \
 plugins/e_menu/e_menu/src/procs.tcl plugins/e_menu/e_menu/src/run_pause.bat \
 plugins/e_menu/header.tkedat plugins/e_menu/main.tcl
# set right interpreter
sed -i 's|^#!.*/usr/bin/env |#!%{_bindir}/|' lib/tablelist6.3/scripts/repair.tcl \
 plugins/e_menu/e_menu/e_menu.tcl plugins/e_menu/e_menu/src/ch_.tcl \
 plugins/e_menu/e_menu/src/e_help.tcl lib/webdav/davvfs.test \
 lib/webdav/webdav.test
sed -i 's|^#!.*|#!%{_bindir}/tclsh|' data/msgs/check.tcl data/msgs/update.tcl

# make scripts executable
chmod +x lib/ptwidgets1.2/common/htmllib.tcl lib/specl/lib/htmllib.tcl \
 lib/webdav/davvfs.test lib/webdav/webdav.test

%build
cat > %{name}.sh <<EOF
#!/bin/sh
cd %{_datadir}/tke
wish lib/tke.tcl -name tke -- \$@
EOF

%install
install -Dm755 %{name}.sh %{buildroot}%{_bindir}/%{name}
install -d %{buildroot}%{_datadir}/%{name}
cp -a data doc lib plugins specl %{buildroot}%{_datadir}/%{name}
install -Dm644 %{SOURCE1} %{buildroot}%{_datadir}/applications/%{name}.desktop
install -Dm644 data/%{name}.appdata.xml %{buildroot}%{_datadir}/appdata/%{name}.appdata.xml
install -Dm644 lib/images/tke_logo.svg %{buildroot}%{_datadir}/pixmaps/%{name}.svg
%fdupes -s %{buildroot}

%files
%license LICENSE
%doc README ChangeLog AUTHORS
%{_bindir}/%{name}
%{_datadir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/appdata/%{name}.appdata.xml
%{_datadir}/pixmaps/%{name}.svg

%changelog
openSUSE Build Service is sponsored by