File ksh.spec of Package ksh

#
# spec file for package ksh (Version 93t)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#

# norootforbuild


Name:           ksh
BuildRequires:  bind-utils bison flex gdbm-devel glibc-devel ncurses-devel procps psmisc pwdutils zlib-devel
%if %suse_version > 1020
BuildRequires:  bind-libs libbz2-devel
%endif
%if %suse_version > 1120
BuildRequires:  update-alternatives
%endif
Url:            http://www.research.att.com/~gsf/download/
License:        Common Public License Version 1.0 (CPL1.0)
Group:          System/Shells
Requires(post): /bin/ln /bin/rm /etc/bash.bashrc /bin/true
Requires(postun): /bin/ln /bin/rm /etc/bash.bashrc /bin/true
%if %suse_version > 1120
Requires(post):  update-alternatives
Requires(preun): update-alternatives
%endif
AutoReqProv:    on
Version:        93t
Release:        183
Summary:        Korn Shell
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Source:         INIT.2010-06-21.tar.bz2
Source1:        ast-ksh.2010-06-21.tar.bz2
Source2:        ast-ksh-locale.2010-02-02.tar.bz2
Source3:        CPL
Source10:       leak1.sh
Source11:       leak2.sh
Source12:       ifs-crash.sh
Source20:       Agreement
Source21:       Warning
Source30:       rpmlintrc
Source42:       sigexec.c
Patch:          ksh93.dif
Patch1:         workaround-stupid-build-system.diff
Patch2:         ksh-qemu.patch
Patch3:         ksh93-shift_ijs.dif
Patch4:         ksh93-gmt2utc.dif
Patch5:         ksh93-uname.dif
Patch6:         ksh93-vi.dif
Patch7:         ksh93-profile.dif
Patch8:         ksh93-test.dif
Patch9:         ksh93-compat.dif
Patch10:        ksh93-suid_exec.dif
Patch11:        ksh93-signals.dif
Patch12:        ksh93-limits.dif
Patch13:        ksh93-sigpipe.dif
Patch14:        ksh93-ia64.dif
Patch15:        ksh93-s390.dif
Patch16:        ksh93-leak.dif
Patch17:        ksh93-ifs.dif
Patch18:        ksh93-fdfn.dif
Patch19:        ksh93-fdleak.dif
%global         use_suid_exe 0
%global         use_locale 1
%global         debug_memleak 0

%description
The original Korn Shell.  The ksh is an sh-compatible command
interpreter that executes commands read from standard input or from a
file.



Authors:
--------
    David Korn <dgk@research.att.com>
    Glenn Fowler <gsf@research.att.com>
    Phong Vo <kpv@research.att.com>

%package -n ksh-devel
License:        Common Public License Version 1.0 (CPL1.0)
Summary:        Korn Shell development environment
Group:          Development/Libraries/C and C++
Requires:       ksh = %{version}-%{release}
AutoReqProv:    on

%description -n ksh-devel
The package includes C header files and the static libraries together
with the shared libraries for linking with other projects.  Please be
aware that the CPL licensed code can not be used within GPL licensed
project.



Authors:
--------
    David Korn <dgk@research.att.com>
    Glenn Fowler <gsf@research.att.com>
    Phong Vo <kpv@research.att.com>

%prep
%setup -q -n ksh93 -T -c -a 0 -a 1 -a 2
find share/ \( -name chef -o -name fudd -o -name piglatin -o -name valley \) -a -type d |\
  xargs -r rm -vrf
find share/ ! \( -name libast -o -name libcmd -o -name libdll -o -name libshell \) -a -type f |\
  xargs -r rm -vf
find share/ -type d -a -empty | xargs -r rm -vrf
find share/ -type d -a -empty | xargs -r rm -vrf
%patch
%patch1
%ifarch %arm
%patch2
%endif
%patch3
%patch4
%patch5
%patch6
%patch7
%patch8
%patch9
%patch10
%patch11
%patch12
%patch13
%ifarch ia64
%patch14
%endif
%patch15
%patch16
%patch17
%patch18
%patch19

%build
  typeset -i IGNORED=0x$(ps --no-headers -o ignored $$)
  typeset -i SIGPIPE=0x1000
  if ((IGNORED & SIGPIPE)) ; then
      # Warn and show signal state of this working shell
      echo Warning: signal SIGPIPE is ignored by this shell 1>&2
      ps s $$ 1>&2
      echo Warning: try to solve this 1>&2
      ${CC:-gcc} ${RPM_OPT_FLAGS} -o sigexec %{S:42}
      for fd in /proc/$$/fd/*; do
	  test -s $fd -a ! -c $fd && break || true
      done
      set -- $(readlink $fd)
      exec -a $SHELL ./sigexec $SHELL ${1+"$@"}
  fi
  nobuiltin=$(mktemp -u /tmp/nobuiltin.XXXXXX) || exit 1
  set -C
  (cat<<-EOF
	-fno-builtin-putenv
	-fno-builtin-setenv
	-fno-builtin-strftime
	-fno-builtin-strlcat
	-fno-builtin-strlcpy
	-fno-builtin-strptime
	-fno-builtin-strtod
	-fno-builtin-strtol
	-fno-builtin-strtold
	-fno-builtin-strtoll
	-fno-builtin-strtoul
	-fno-builtin-strtoull
	EOF
   find src/lib/ -name '*.h' | xargs \
   sed -nr '\@^extern[[:blank:]].*[[:blank:]](str|mem|(get|put|set)env|(c|m|re|v)alloc).*\(@{
	s@[[:blank:]]+_ARG_@@
	s@[a-zA-Z_\*]+[[:blank:]]+@@g
	s@([^\(\)]+)\(.*\);$@-fno-builtin-\1@; p}') | \
  sort -u > $nobuiltin
  set +C
  # This package failed when testing with -Wl,-as-needed being default.
  # So we disable it here, if you want to retest, just delete this
  # comment and the line below.
  export SUSE_ASNEEDED=0
  test -n "${!LC_*}" && unset "${!LC_*}"
  CC=gcc
  cflags ()
  {
      local flag=$1; shift
      local var=$1; shift
      test -n "${flag}" -a -n "${var}" || return
      case "${!var}" in
      *${flag}*) return
      esac
      case "$flag" in
      -Wl,*)
	  set -o noclobber
	  echo 'int main () { return 0; }' > ldtest.c
	  if ${CC:-gcc} -Werror $RPM_OPT_FLAGS $flag -o /dev/null -xc ldtest.c > /dev/null 2>&1 ; then
	      eval $var=\${$var:+\$$var\ }$flag
	  fi
	  set +o noclobber
	  rm -f ldtest.c
	  ;;
      *)
	  if ${CC:-gcc} -Werror $RPM_OPT_FLAGS $flag -S -o /dev/null -xc /dev/null > /dev/null 2>&1 ; then
	      eval $var=\${$var:+\$$var\ }$flag
	  fi
      esac
  }
  #
  LANG=POSIX
  export LANG
  #
  # If _you_ are knowing how to fix this in the autogenerated
  # sources of ksh/ast without breaking them, then let me know.
  #
  cflags -Wno-missing-braces		IGNORE
  cflags -Wno-unknown-pragmas		IGNORE
  cflags -Wno-parentheses		IGNORE
  cflags -Wno-char-subscripts		IGNORE
  cflags -Wno-uninitialized		IGNORE
  cflags -Wno-implicit			IGNORE
  cflags -Wno-unused-value		IGNORE
  cflags -Wno-type-limits		IGNORE
  #
  # Do not use -DSHOPT_SPAWN=1 and/or -DSHOPT_AMP=1 this would cause
  # errors due race conditions while executing the test suite.
  #
  feature=$(mktemp -u /tmp/feature.XXXXXX) || exit 1
  feature=${feature}.h
  set -C
  (cat > $feature)<<-'EOF'
	#define SHOPT_SYSRC	    1
	#define SHOPT_REMOTE	    1
	#define SHOPT_CMDLIB_BLTIN  1
	#define SHOPT_CMDLIB_DIR    1
	#define SH_CMDLIB_DIR	    "/%{_lib}/ast/bin"
	#define THISPROG	    "/%{_lib}/ast/bin/suid_exec"
	#define _AST_std_malloc	    0
	#define _map_malloc	    1
	EOF
  set +C
  FEATURE="-include $feature"
  cat $feature
  #
  #
  echo 'int main () { return !(sizeof(void*) >= 8); }' | $CC -x c -o test64 -
  if ./test64 ; then
      LARGEFILE=""
  else
      LARGEFILE="-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64"
  fi
  rm -f ./test64
  case "$RPM_ARCH" in
  ia64)   RPM_OPT_FLAGS="${RPM_OPT_FLAGS//-O[s0-9]/-O}" ;;
  s390*)  RPM_OPT_FLAGS="${RPM_OPT_FLAGS//-O[s0-9]/-O}" ;;
  ppc*)   RPM_OPT_FLAGS="${RPM_OPT_FLAGS//-O[s0-9]/-O}" ;;
  esac
  RPM_OPT_FLAGS=$(echo "${RPM_OPT_FLAGS}"|sed -r 's/[[:blank:]]+-g[0-9]?//g2')
  UNIVERSE=att
  LDFLAGS="-lm"
  LDSOFLG=""
  cflags -std=gnu99			RPM_OPT_FLAGS
  cflags -fPIC				RPM_OPT_FLAGS
  cflags @$nobuiltin			RPM_OPT_FLAGS
  cflags -fno-strict-aliasing		RPM_OPT_FLAGS
  cflags -fno-zero-initialized-in-bss	RPM_OPT_FLAGS
  cflags -fno-delete-null-pointer-checks RPM_OPT_FLAGS
  cflags -g				RPM_OPT_FLAGS
  cflags -pipe				RPM_OPT_FLAGS
  cflags -Wl,-O2			LDFLAGS
  cflags -Wl,--hash-size=16699		LDFLAGS
  cflags -Wl,-O2			LDSOFLG
  cflags -Wl,-warn-common		LDSOFLG
  cflags -Wl,--as-needed		LDSOFLG
  cflags -Wl,--hash-size=8599		LDSOFLG
  cflags -Wl,-rpath,/%{_lib}/ast	LDSOFLG
  RPM_OPT_FLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE $LARGEFILE"
  RPM_OPT_FLAGS="$RPM_OPT_FLAGS $IGNORE $FEATURE"
  HOSTTYPE=${RPM_ARCH%%*-linux*}
  mam_cc_L=use
  mam_cc_OPTIMIZE=-pipe
  export mam_cc_L mam_cc_OPTIMIZE HOSTTYPE LDFLAGS RPM_OPT_FLAGS UNIVERSE
  for mam in $(find ${PWD}/ -name Mamfile); do
      sed -ri '/^exec.*\$\{CC\}/{ s/(\$\{CC\})/\1 \$\{RPM_OPT_FLAGS\}/g; }' $mam
  done
  bin/package make CC="$CC"
  root=$(echo ${PWD}/arch/linux*)
  test -d $root || exit 1
  log=${root}/lib/package/gen/make.out
  test -s $log || exit 1
  for lib in libast libcmd libdll libshell ; do
      test -s ${root}/lib/${lib}.a || exit 1
      obj=$(ar t ${root}/lib/${lib}.a)
      test $? -eq 0 || exit 1
      case "$lib" in
      libshell)
	  base=src/cmd/ksh93
	  vers=$(grep ^VERSION  ${base}/Makefile | sed "s@.*\([0-9]\+\.[0-9]\+\).*@\1@")
	  link="-L${root}/lib/ -Wl,-rpath-link,${root}/lib -Wl,-rpath,/%{_lib}/ast $LDSOFLG $LDFLAGS -ldll -lcmd -last -lm -ldl"
	  ;;
      libdll)
	  base=src/lib/$lib
	  vers=$(grep :LIBRARY: ${base}/Makefile | sed "s@.*\([0-9]\+\.[0-9]\+\).*@\1@")
	  link="-L${root}/lib/ -Wl,-rpath-link,${root}/lib -Wl,-rpath,/%{_lib}/ast $LDSOFLG -ldl -last"
	  ;;
      libcmd)
	  base=src/lib/$lib
	  vers=$(grep :LIBRARY: ${base}/Makefile | sed "s@.*\([0-9]\+\.[0-9]\+\).*@\1@")
	  link="-L${root}/lib/ -Wl,-rpath-link,${root}/lib -Wl,-rpath,/%{_lib}/ast $LDSOFLG -last"
	  ;;
      libast)
	  base=src/lib/$lib
	  vers=$(grep :LIBRARY: ${base}/Makefile | sed "s@.*\([0-9]\+\.[0-9]\+\).*@\1@")
	  link="-L${root}/lib/ -Wl,-rpath-link,${root}/lib -Wl,-rpath,/%{_lib}/ast $LDSOFLG"
	  ;;
      esac
      soname="-Wl,-soname,${lib}.so.${vers%.*},-stats"
      pushd ${root}/${base}
      $CC -shared $soname -o ${root}/lib/${lib}.so.${vers} ${obj} $link
      ln -sf ${lib}.so.${vers} ${root}/lib/${lib}.so.${vers%.*}
      ln -sf ${lib}.so.${vers} ${root}/lib/${lib}.so
      popd
  done
  nm -D ${root}/lib/libast.so | \
      grep -E 'T[[:blank:]](str|mem|(get|put|set)env|(c|m|re|v)alloc)' | \
      awk '{print "-fno-builtin-"$3}' | \
      sort -u | \
      diff -u $nobuiltin - || true
  base=src/cmd/ksh93
  test=${PWD}/${base}/tests
  pushd ${root}/${base}
      rm -f libshell.a
      rm -f ${root}/bin/ksh
      rm -f ${root}/bin/shcomp
      ksh=$(grep -e '-o ksh' $log | tail -n 1 |\
	    sed "s@+ g\?cc@$CC@;s@-o ksh@-o ${root}/bin/ksh@;s@[a-zA-Z0-9_/\.-]*lib\([a-z]\+\)\.a@-l\1@g;s@'@@g")
      ksht=$(grep -e '-o ksh' $log | tail -n 1 |\
	    sed "s@+ g\?cc@$CC@;s@-o ksh@-o ${root}/bin/ksh.test@;s@[a-zA-Z0-9_/\.-]*lib\([a-z]\+\)\.a@-l\1@g;s@'@@g")
      test -n "${ksh}" || { echo build of ksh failed; exit 1; }
      shcomp=$(grep -e '-o shcomp' $log | tail -n 1 |\
	    sed "s@+ g\?cc@$CC@;s@-o shcomp@-o ${root}/bin/shcomp@;s@[a-zA-Z0-9_/\.-]*lib\([a-z]\+\)\.a@-l\1@g;s@'@@g")
      shcompt=$(grep -e '-o shcomp' $log | tail -n 1 |\
	    sed "s@+ g\?cc@$CC@;s@-o shcomp@-o ${root}/bin/shcomp.test@;s@[a-zA-Z0-9_/\.-]*lib\([a-z]\+\)\.a@-l\1@g;s@'@@g")
      test -n "${shcomp}" || { echo build of shcomp failed; exit 1; }
      suidex=$(grep -e '-o suid_exec' $log | tail -n 1 |\
	    sed "s@+ g\?cc@$CC@;s@-o shcomp@-o ${root}/bin/suid_exec@;s@[a-zA-Z0-9_/\.-]*lib\([a-z]\+\)\.a@-l\1@g;s@'@@g")
      test -n "${suidex}" || { echo build of suidex failed; exit 1; }
      ${ksht}    -Wl,-rpath,${root}/lib
      ${shcompt} -Wl,-rpath,${root}/lib
      ${ksh}	 -Wl,-rpath-link,${root}/lib -Wl,-rpath,/%{_lib}/ast
      ${shcomp}	 -Wl,-rpath-link,${root}/lib -Wl,-rpath,/%{_lib}/ast
      ${suidex}	 -Wl,-rpath-link,${root}/lib -Wl,-rpath,/%{_lib}/ast
      OPATH=$PATH
      OSHELL=$SHELL
      PATH=$PATH:${root}/bin
      SHELL=${root}/bin/ksh.test
      SHCOMP=${root}/bin/shcomp.test
      export PATH SHCOMP SHELL
      pushd ${test}
	  typeset -i failed=0
	  ln -sf ${root}/lib ${test}/../
 	  ${root}/bin/ksh.test shtests
	  ${root}/bin/ksh.test %{S:10}
	  ${root}/bin/ksh.test %{S:11}
	  ${root}/bin/ksh.test %{S:12}
          if test $((IGNORED & SIGPIPE)) -eq 0 ; then
	      # This may fail in current factory (aka next 11.3)
	      ${root}/bin/ksh.test -c 'g="false"; trap "print -u2 PIPED; \$g && exit 0 ; g=true" PIPE ; while true ; do echo hello ; done' | head -n 10
	  fi
	  killall -q -s 9 ${root}/bin/ksh.test || true
      popd
      pushd ${root}/bin
	  PATH=$PATH:.
	  set -- $(shcomp.test --version 2>&1)
	  eval version=\${$#}
	  shcomp.test --nroff 2>&1 | sed 's/\(\.TH .*\)/\1 "2003-03-02" "" "Korn shell utilities"/' > ../man/man1/shcomp.1
	  rm -v ksh.test shcomp.test
      popd
      SHELL=$OSHELL
      PATH=$OPATH
  popd

%install
  root=$(echo ${PWD}/arch/linux*)
  test -d $root || exit 1
  pushd $root || exit 1
  mkdir -p %{buildroot}/bin
  mkdir -p %{buildroot}%{_bindir}
  mkdir -p %{buildroot}/%{_lib}/ast/bin
  mkdir -p %{buildroot}%{_includedir}/ast
  mkdir -p %{buildroot}%{_libdir}/ast
  mkdir -p %{buildroot}%{_mandir}
  mkdir    %{buildroot}%{_mandir}/man1
  mkdir    %{buildroot}%{_mandir}/man3
%if %use_locale
  mkdir -p %{buildroot}%{_datadir}/locale
%endif
  mkdir -p %{buildroot}%{_datadir}/ksh/fun
  mkdir -p %{buildroot}%{_sysconfdir}/permissions.d
  install bin/ksh       %{buildroot}/%{_lib}/ast/bin/
  install bin/shcomp    %{buildroot}/%{_lib}/ast/bin/
%if %use_suid_exe
  install bin/suid_exec %{buildroot}/%{_lib}/ast/bin/
%endif
  ln -sf  bin/ksh	         %{buildroot}/%{_lib}/ast/ksh
  # create ghost files
  ln -sf /bin/true		 %{buildroot}/bin/ksh
  ln -sf /bin/true		 %{buildroot}%{_bindir}/ksh
%if %suse_version > 1120
  ln -sf ../man1/ksh93.1.gz	 %{buildroot}/%{_mandir}/man1/ksh.1.gz
  ln -sf /%{_lib}/ast/bin/ksh	 %{buildroot}/bin/ksh93
  ln -sf /%{_lib}/ast/bin/ksh	 %{buildroot}%{_bindir}/ksh93
%endif
  ln -sf /%{_lib}/ast/bin/ksh    %{buildroot}%{_bindir}/rksh
  ln -sf /%{_lib}/ast/bin/shcomp %{buildroot}%{_bindir}/shcomp
  ln -sf ast			 %{buildroot}/%{_lib}/ksh
  cp -a lib/*.so* %{buildroot}/%{_lib}/ast/
  cp -a fun/*     %{buildroot}%{_datadir}/ksh/fun/
  for so in %{buildroot}/%{_lib}/ast/*.so.*.* ; do
      so=${so##*/}
      ln -sf /%{_lib}/ast/$so %{buildroot}%{_libdir}/ast/${so%%%%.*}.so
  done
  rm -f %{buildroot}%{_libdir}/ast/*.so.*
  for man in man/man[13]/*.[13] ; do
      sed -i 's/\\f5/\\fB/g;s/^\.H/\.P\n\.H/g' $man
  done
  install -m 0644 lib/*.a		%{buildroot}%{_libdir}/ast/
%if %suse_version > 1120
  install -m 0644 man/man1/sh.1		%{buildroot}%{_mandir}/man1/ksh93.1
%else
  install -m 0644 man/man1/sh.1		%{buildroot}%{_mandir}/man1/ksh.1
%endif
  install -m 0644 man/man1/shcomp.1	%{buildroot}%{_mandir}/man1/shcomp.1
  for man in man/man3/*.3 ; do
      man=${man##*/}
      ast=${man}ast
      install -m 0644 man/man3/${man}	%{buildroot}%{_mandir}/man3/${ast}
  done
  install -m 0644 include/ast/*		%{buildroot}%{_includedir}/ast/
  popd
%if %use_locale
  for msg in share/lib/locale/* ; do
      test -d $msg || continue
      mkdir -p %{buildroot}%{_datadir}/locale/${msg##*/}/LC_MESSAGES
      cp -vp ${msg}/LC_MESSAGES/* 	%{buildroot}%{_datadir}/locale/${msg##*/}/LC_MESSAGES/
  done
  echo %%dir %{_datadir}/locale/C > ksh.lang
  echo %%dir %{_datadir}/locale/C/LC_MESSAGES >> ksh.lang
  find %{buildroot}/ -type f -o -type l | sed -r '
      s:%{buildroot}::
      s:(%{_datadir}/locale/)([^/_]+)(.*$):%%lang\(\2\) \1\2\3:
      s:^([^%%].*)::
      s:%%lang\(C\) ::
      /^ *$/d' >> ksh.lang
%else
  > ksh.lang
%endif
  if test -s lib/package/LICENSES/ast ; then
    cp lib/package/LICENSES/ast LICENSE
  else
    cp %{S:3} LICENSE
  fi
  mv  src/cmd/ksh93/OBSOLETE src/cmd/ksh93/OBSOLETE.mm
  cat src/cmd/ksh93/builtins.mm | sed 's/\\f5/\\fB/g;s/^\.H/\.P\n\.H/g' | troff -Tascii8 -t -mm | grotty -bou > Builtins
  cat src/cmd/ksh93/PROMO.mm    | sed 's/\\f5/\\fB/g;s/^\.H/\.P\n\.H/g' | troff -Tascii8 -t -mm | grotty -bou > PROMO
  cat src/cmd/ksh93/OBSOLETE.mm | sed 's/\\f5/\\fB/g;s/^\.H/\.P\n\.H/g' | troff -Tascii8 -t -mm | grotty -bou > OBSOLETE
  cat src/cmd/ksh93/sh.memo     | sed 's/\\f5/\\fB/g;s/^\.H/\.P\n\.H/g' | troff -Tascii8 -t -mm | grotty -bou > MEMORANDUM
  cp %{S:21} .
%if %use_suid_exe
  (cat > %{buildroot}%{_sysconfdir}/permissions.d/ksh) <<-EOF
	/%{_lib}/ast/bin/suid_exec		root:root	4755
	EOF
  (cat > %{buildroot}%{_sysconfdir}/permissions.d/ksh.paranoid) <<-EOF
	/%{_lib}/ast/bin/suid_exec		root:root	0755
	EOF
%endif

%post
test -e etc/bash.bashrc && ln -sf bash.bashrc etc/ksh.kshrc || true
%if %suse_version > 1120
%{_sbindir}/update-alternatives \
   --install /bin/ksh ksh /%{_lib}/ast/bin/ksh 20 \
   --slave %{_bindir}/ksh usr-bin-ksh /%{_lib}/ast/bin/ksh \
   --slave %{_mandir}/man1/ksh.1.gz ksh.1.gz %{_mandir}/man1/ksh93.1.gz
%else
if test -x  %{_lib}/ast/bin/ksh ; then
    rm -f bin/ksh
    ln -sf /%{_lib}/ast/bin/ksh bin/ksh
    rm -f %{_exec_prefix}/bin/ksh
    ln -sf /%{_lib}/ast/bin/ksh %{_exec_prefix}/bin/ksh
fi
%endif

%if %suse_version > 1120

%preun
if test $1 -eq 0 ; then
    %{_sbindir}/update-alternatives --remove ksh /%{_lib}/ast/bin/ksh
fi
%endif

%postun
if test ! -x %{_lib}/ast/bin/ksh ; then
    if test ! -x bin/pdksh ; then
	rm -f etc/ksh.kshrc
    fi
%if %suse_version <= 1120
    if test ! -e bin/ksh ; then
	rm -f bin/ksh %{_exec_prefix}/bin/ksh
    fi
%endif
fi

%files -f ksh.lang
%defattr(-,root,root)
%if %use_suid_exe
%{_sysconfdir}/permissions.d/ksh
%{_sysconfdir}/permissions.d/ksh.paranoid
%endif
%doc LICENSE src/cmd/ksh93/COMPATIBILITY src/cmd/ksh93/RELEASE*
%doc Builtins PROMO OBSOLETE MEMORANDUM
%doc %{_mandir}/man1/shcomp.1.gz
%ghost %verify(not link) /bin/ksh
%ghost %verify(not link) %{_bindir}/ksh
%if %suse_version > 1120
%ghost %verify(not link) %{_mandir}/man1/ksh.1.gz
%doc %{_mandir}/man1/ksh93.1.gz
/bin/ksh93
%{_bindir}/ksh93
%else
%doc %{_mandir}/man1/ksh.1.gz
%endif
%{_bindir}/rksh
%{_bindir}/shcomp
%dir /%{_lib}/ast
%dir /%{_lib}/ast/bin
/%{_lib}/ast/ksh
/%{_lib}/ast/bin/ksh
/%{_lib}/ast/bin/shcomp
%if %use_suid_exe
%attr(4755,root,root) /%{_lib}/ast/bin/suid_exec
%endif
/%{_lib}/ast/*.so*
/%{_lib}/ksh
%dir %{_datadir}/ksh
%dir %{_datadir}/ksh/fun
%{_datadir}/ksh/fun/*

%files -n ksh-devel
%defattr(-,root,root)
%doc LICENSE Warning
%dir %{_libdir}/ast/
%{_libdir}/ast/*.so
%{_libdir}/ast/*.a
%doc %{_mandir}/man3/*
%{_includedir}/ast/

%changelog
openSUSE Build Service is sponsored by