%define pkg_version %(echo %version | tr . - ) Name: ksh Version: 2011.02.08 Release: 1mamba Summary: The Original ATT Korn Shell Group: Applications/Shells Vendor: openmamba Distribution: openmamba Packager: Silvan Calarco URL: http://www.kornshell.com/ Source0: http://www2.research.att.com/~gsf/download/tgz/ast-ksh.%{pkg_version}.tgz Source1: http://www2.research.att.com/~gsf/download/tgz/INIT.%{pkg_version}.tgz # from fedora Source2: dotkshrc Source3: kshrc.mamba Source4: expectedresults.log Patch0: ksh-20070328-builtins.patch Patch1: ksh-20100826-fixregr.patch License: Common Public License Version 1.0 BuildRequires: bison BuildRequires: diffutils ## AUTOBUILDREQ-BEGIN BuildRequires: glibc-devel ## AUTOBUILDREQ-END BuildRequires: procps Requires: coreutils Requires: grep BuildRoot: %{_tmppath}/%{name}-%{version}-root %description KSH-93 is the most recent version of the Korn Shell by David Korn of AT&T Bell Laboratories. Korn Shell is a shell programming language, which is upward compatible with "sh" (the Bourne Shell). %prep %setup -q -c %{name}-%{version} %setup -q -T -D -a 1 %patch0 -p1 %patch1 -p1 sed -i 's|ls /dev/fd|ls /proc/self/fd|' src/cmd/ksh93/features/options %build ./bin/package ./bin/package make mamake ||: ./bin/package make mamake ||: export CCFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" export CC=gcc ./bin/package "make" cp lib/package/LICENSES/ast LICENSE %install [ "%{buildroot}" != / ] && rm -rf "%{buildroot}" mkdir -p %{buildroot}{/bin,%{_bindir},%{_mandir}/man1} install -c -m 755 arch/*/bin/ksh %{buildroot}/bin/ksh install -c -m 755 arch/*/bin/shcomp %{buildroot}%{_bindir}/shcomp install -c -m 644 arch/*/man/man1/sh.1 %{buildroot}%{_mandir}/man1/ksh.1 mkdir -p %{buildroot}%{_sysconfdir}/skel install -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/skel/.kshrc install -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/kshrc %check export SHELL=$(ls $(pwd)/arch/*/bin/ksh) cd src/cmd/ksh93/tests/ ulimit -c unlimited if [ ! -e /dev/fd ] then echo "ERROR: /dev/fd does not exist, regression tests skipped" exit 0 fi $SHELL ./shtests 2>&1 | tee testresults.log sed -e '/begins at/d' -e '/ 0 error/d' -e 's/at [^\[]*\[/\[/' testresults.log -e '/tests skipped/d' >filteredresults.log if ! cmp filteredresults.log %{SOURCE4} >/dev/null || ls core.* then echo "Regression tests failed (ignoring)" diff -Naurp %{SOURCE4} filteredresults.log || true # exit -1 fi : %clean [ "%{buildroot}" != / ] && rm -rf "%{buildroot}" %post if [ ! -f %{_sysconfdir}/shells ]; then echo "/bin/ksh" > %{_sysconfdir}/shells else if ! grep -q '^/bin/ksh$' %{_sysconfdir}/shells ; then echo "/bin/ksh" >> %{_sysconfdir}/shells fi fi %postun if [ ! -f /bin/ksh ]; then sed -i '/^\/bin\/ksh$/ d' %{_sysconfdir}/shells fi %files %defattr(-,root,root) %config(noreplace) %{_sysconfdir}/skel/.kshrc %config(noreplace) %{_sysconfdir}/kshrc /bin/ksh %{_bindir}/shcomp %{_mandir}/man1/ksh.1.gz %doc LICENSE README %changelog * Sat Feb 12 2011 gil 20110208-1mamba - package created by autospec