diff --git a/tcsh-6.24.07.tar.gz b/tcsh-6.24.07.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..1375a3e9ec8116329f51a465d301fa4a38eff362 Binary files /dev/null and b/tcsh-6.24.07.tar.gz differ diff --git a/tcsh.spec b/tcsh.spec new file mode 100644 index 0000000000000000000000000000000000000000..b80be3a7493002b8805f838ce5889524e2c7777d --- /dev/null +++ b/tcsh.spec @@ -0,0 +1,142 @@ +%define anolis_release 1 + +%global _hardened_build 1 + +Name: tcsh +Summary: An enhanced version of csh, the C shell +Version: 6.24.07 +Release: %{anolis_release}%{?dist} +License: BSD + +URL: http://www.tcsh.org/ +Source0: http://ftp.funet.fi/pub/mirrors/ftp.astron.com/pub/%{name}/%{name}-%{version}.tar.gz + +Provides: csh = %{version} +Provides: /bin/csh +Provides: /bin/tcsh + +Requires(post): coreutils +Requires(post): grep +Requires(postun): sed + +BuildRequires: make +BuildRequires: gcc +BuildRequires: git +BuildRequires: autoconf +BuildRequires: gettext-devel +BuildRequires: ncurses-devel + +%description +Tcsh is an enhanced but completely compatible version of csh, the C shell. Tcsh +is a command language interpreter which can be used both as an interactive login +shell and as a shell script command processor. Tcsh includes a command line +editor, programmable word completion, spelling correction, a history mechanism, +job control and a C language like syntax. + +%package doc +Summary: Documentation files for %{name} +Requires: %{name} = %{EVR} +BuildArch: noarch + +%description doc +The %{name}-doc package contains documentation files for %{name}. + +%prep +%autosetup -N -S git + +# NOTE: If more files needs to be converted, add them here: +for file in Fixes; do + iconv -f iso-8859-1 -t utf-8 "$file" > "${file}.converted" && \ + touch -r "$file" "${file}.converted" && \ + mv "${file}.converted" "$file" +done + +# Also, rename the Copyright so we comply with more generally accepted name: +mv Copyright COPYING + +# Amend the converted files to the initial commit, and patch the source code: +git add --all --force +git commit --all --amend --no-edit > /dev/null +%autopatch -p1 + +%build +%configure +%make_build all + +%check +%make_build check + +%install +mkdir -p %{buildroot}%{_bindir} +mkdir -p %{buildroot}%{_mandir}/man1 +install -p -m 755 tcsh %{buildroot}%{_bindir}/tcsh +install -p -m 644 tcsh.man %{buildroot}%{_mandir}/man1/tcsh.1 +ln -sf tcsh %{buildroot}%{_bindir}/csh +ln -sf tcsh.1 %{buildroot}%{_mandir}/man1/csh.1 + +# NOTE: We have to construct tcsh.lang by ourselves, since upstream does not use +# standard naming/placing of localization files for the gettext... +while read lang language; do + dest="%{buildroot}%{_datadir}/locale/$lang/LC_MESSAGES" + if [[ -f "nls/$language.cat" ]]; then + mkdir -p "$dest" + install -p -m 644 "nls/$language.cat" "$dest/tcsh" + echo "%lang($lang) %{_datadir}/locale/$lang/LC_MESSAGES/tcsh" + fi +done > %{name}.lang << _EOF +de german +el greek +en C +es spanish +et et +fi finnish +fr french +it italian +ja ja +pl pl +ru russian +uk ukrainian +_EOF + +%generate_compatibility_deps + +%post +# Add login shell entries to /etc/shells only when installing the package +# for the first time (see 'man 5 SHELLS' for more info): +if [[ "$1" -eq 1 ]]; then + if [[ ! -f %{_sysconfdir}/shells ]]; then + echo "/bin/csh" >> %{_sysconfdir}/shells + echo "/bin/tcsh" >> %{_sysconfdir}/shells + echo "%{_bindir}/csh" >> %{_sysconfdir}/shells + echo "%{_bindir}/tcsh" >> %{_sysconfdir}/shells + else + grep -q "^/bin/csh$" %{_sysconfdir}/shells || echo "/bin/csh" >> %{_sysconfdir}/shells + grep -q "^/bin/tcsh$" %{_sysconfdir}/shells || echo "/bin/tcsh" >> %{_sysconfdir}/shells + grep -q "^%{_bindir}/csh$" %{_sysconfdir}/shells || echo "%{_bindir}/csh" >> %{_sysconfdir}/shells + grep -q "^%{_bindir}/tcsh$" %{_sysconfdir}/shells || echo "%{_bindir}/tcsh" >> %{_sysconfdir}/shells + fi +fi + +%postun +# Remove the login shell lines from /etc/shells only when uninstalling: +if [[ "$1" -eq 0 && -f %{_sysconfdir}/shells ]]; then + sed -i -e '\!^/bin/csh$!d' %{_sysconfdir}/shells + sed -i -e '\!^/bin/tcsh$!d' %{_sysconfdir}/shells + sed -i -e '\!^%{_bindir}/csh$!d' %{_sysconfdir}/shells + sed -i -e '\!^%{_bindir}/tcsh$!d' %{_sysconfdir}/shells +fi + +%files -f %{name}.lang +%license COPYING +%{_bindir}/tcsh +%{_bindir}/csh +%{_mandir}/man1/*.1* +%dir %{abidir} +%{abidir}/tcsh-option.list + +%files doc +%doc FAQ Fixes README.md complete.tcsh + +%changelog +* Mon Mar 27 2023 Yuanhong Peng - 6.24.07-1 +- Init from upstream