File rc.spec of Package rc

%def_with edit
%def_without history

Name: rc
Version: 1.7.2
Release: 5
Summary: An implementation of the AT&T Plan9 shell
License: Other
URL: ftp://ftp.white.toronto.edu/pub/%name
Group: System/Shells
Source: %url/%name-%version.tar.gz
Patch1: rc-1.7.2-install-history.patch

BuildRequires: ncurses-devel %{?_with_edit:readline-devel}
BuildRequires: autoconf automake
#BuildRequires: expect

%description
%name is a command interpreter and programming language similar to sh(1).
It is based on the AT&T Plan 9 shell of the same name. The shell offers a C-like
syntax (much more so than the C shell), and a powerful mechanism for manipulating
variables. It is reasonably small and reasonably fast, especially when compared
to contemporary shells. Its use is intended to be interactive, but the language
lends itself well to scripts.


%prep
%setup -q
%patch1 -p1


%build
autoreconf -fisv
%global optflags %optflags -flto
%configure \
	LDFLAGS="-fwhole-program" \
%if_with edit
	--with-edit=gnu \
%endif
	%{subst_with history}
make %{?_smp_mflags}

gzip -9c ChangeLog > ChangeLog.gz


%install
%make_install


%if 0
%check
make check
%endif


%post
# Add rc to the list of allowed shells in /etc/shells
grep -q '^[[:blank:]]*%_bindir/%name[[:blank:]]*$' %_sysconfdir/shells || echo %_bindir/%name >> %_sysconfdir/shells

%postun
# Remove rc from the list of allowed shells in /etc/shells
if [ "$1" = 0 ] && grep -Fxq %_bindir/%name %_sysconfdir/shells; then
	sed -i '\|^[[:blank:]]*%_bindir/%name[[:blank:]]*$|d' %_sysconfdir/shells
fi


%files
%defattr(-,root,root,-)
%doc AUTHORS COPYING ChangeLog.* EXAMPLES NEWS README
%_bindir/*
%_mandir/man1/*
openSUSE Build Service is sponsored by