eaf6cb
%define _bindir   /bin
eaf6cb
Summary:          MirBSD enhanced version of the Korn Shell
eaf6cb
Name:             mksh
317dc6
Version:          50b
317dc6
Release:          1%{?dist}
e2f293
# BSD (setmode.c), ISC (strlcpy.c), MirOS (the rest)
e2f293
License:          MirOS and ISC and BSD
eaf6cb
Group:            System Environment/Shells
b3a1ea
URL:              https://www.mirbsd.org/mksh.htm
30f711
Source0:          https://www.mirbsd.org/MirOS/dist/mir/%{name}/%{name}-R%{version}.tgz
e2f293
Source1:          dot-mkshrc
037b08
Source2:          rtchecks.expected
eaf6cb
Requires(post):   grep
e2f293
Requires(postun): sed
b07ea3
BuildRequires:    util-linux, ed
eaf6cb
BuildRoot:        %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
eaf6cb
eaf6cb
%description
eaf6cb
mksh is the MirBSD enhanced version of the Public Domain Korn shell (pdksh),
eaf6cb
a bourne-compatible shell which is largely similar to the original AT&T Korn
eaf6cb
shell. It includes bug fixes and feature improvements in order to produce a
eaf6cb
modern, robust shell good for interactive and especially script use, being a
eaf6cb
bourne shell replacement, pdksh successor and an alternative to the C shell.
eaf6cb
eaf6cb
%prep
985421
%setup -q -n %{name}
eaf6cb
ee681d
# we'll need this later
985421
cat >rtchecks <<'EOF'
985421
typeset -i sari=0
985421
typeset -Ui uari=0
985421
typeset -i x=0
ee681d
print -r -- $((x++)):$sari=$uari. #0
985421
let --sari --uari
ee681d
print -r -- $((x++)):$sari=$uari. #1
985421
sari=2147483647 uari=2147483647
ee681d
print -r -- $((x++)):$sari=$uari. #2
985421
let ++sari ++uari
ee681d
print -r -- $((x++)):$sari=$uari. #3
985421
let --sari --uari
985421
let 'sari *= 2' 'uari *= 2'
985421
let ++sari ++uari
ee681d
print -r -- $((x++)):$sari=$uari. #4
985421
let ++sari ++uari
ee681d
print -r -- $((x++)):$sari=$uari. #5
985421
sari=-2147483648 uari=-2147483648
ee681d
print -r -- $((x++)):$sari=$uari. #6
985421
let --sari --uari
ee681d
print -r -- $((x++)):$sari=$uari. #7
ee681d
(( sari = -5 >> 1 ))
ee681d
((# uari = -5 >> 1 ))
ee681d
print -r -- $((x++)):$sari=$uari. #8
ee681d
(( sari = -2 ))
ee681d
((# uari = sari ))
ee681d
print -r -- $((x++)):$sari=$uari. #9
985421
EOF
eaf6cb
eaf6cb
%build
968f66
# Work around RHBZ #922974 on Fedora 19 and later
968f66
%if 0%{?fedora} >= 19
ee681d
CFLAGS="$RPM_OPT_FLAGS -DMKSH_DISABLE_EXPERIMENTAL" sh Build.sh -r
968f66
%else
ee681d
CFLAGS="$RPM_OPT_FLAGS -DMKSH_DISABLE_EXPERIMENTAL" sh Build.sh -r -c lto
968f66
%endif
70f573
cp test.sh test_mksh.sh
968f66
# Work around RHBZ #922974 on Fedora 19 and later
968f66
%if 0%{?fedora} >= 19
ee681d
CFLAGS="$RPM_OPT_FLAGS -DMKSH_DISABLE_EXPERIMENTAL" sh Build.sh -L -r
968f66
%else
ee681d
CFLAGS="$RPM_OPT_FLAGS -DMKSH_DISABLE_EXPERIMENTAL" sh Build.sh -L -r -c lto
968f66
%endif
70f573
cp test.sh test_lksh.sh
eaf6cb
eaf6cb
%install
eaf6cb
rm -rf $RPM_BUILD_ROOT
eaf6cb
install -D -m 755 %{name} $RPM_BUILD_ROOT%{_bindir}/%{name}
70f573
install -D -m 755 lksh $RPM_BUILD_ROOT%{_bindir}/lksh
eaf6cb
install -D -m 644 %{name}.1 $RPM_BUILD_ROOT%{_mandir}/man1/%{name}.1
037b08
install -D -m 644 lksh.1 $RPM_BUILD_ROOT%{_mandir}/man1/lksh.1
e2f293
install -D -p -m 644 dot.mkshrc $RPM_BUILD_ROOT%{_sysconfdir}/mkshrc
e2f293
install -D -p -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/skel/.mkshrc
eaf6cb
eaf6cb
%check
985421
./mksh rtchecks >rtchecks.got 2>&1
037b08
if ! cmp --quiet rtchecks.got %{SOURCE2}
985421
then
985421
  echo "rtchecks failed"
037b08
  diff -Naurp %{SOURCE2} rtchecks.got
985421
  exit 1
985421
fi
985421
70f573
for tf in test_mksh.sh test_lksh.sh
70f573
do
70f573
  echo > test.wait
70f573
  script -qc "./$tf"' -v; x=$?; rm -f test.wait; exit $x'
70f573
  maxwait=0
70f573
  while test -e test.wait; do
70f573
    sleep 1
70f573
    maxwait=$(expr $maxwait + 1)
70f573
    test $maxwait -lt 900 || break
70f573
  done
9f2060
done
eaf6cb
eaf6cb
%post
e2f293
grep -q "^%{_bindir}/%{name}$" %{_sysconfdir}/shells 2>/dev/null || \
eaf6cb
  echo "%{_bindir}/%{name}" >> %{_sysconfdir}/shells
eaf6cb
eaf6cb
%postun
eaf6cb
if [ ! -x %{_bindir}/%{name} ]; then
e2f293
  sed -e 's@^%{_bindir}/%{name}$@POSTUNREMOVE@' -e '/^POSTUNREMOVE$/d' -i %{_sysconfdir}/shells
eaf6cb
fi
eaf6cb
eaf6cb
%clean
eaf6cb
rm -rf $RPM_BUILD_ROOT
eaf6cb
eaf6cb
%files
c14208
%defattr(-,root,root,-)
8a4f27
%doc dot.mkshrc
eaf6cb
%{_bindir}/%{name}
70f573
%{_bindir}/lksh
e2f293
%config(noreplace) %{_sysconfdir}/mkshrc
e2f293
%config(noreplace) %{_sysconfdir}/skel/.mkshrc
eaf6cb
%{_mandir}/man1/%{name}.1*
70f573
%{_mandir}/man1/lksh.1*
eaf6cb
eaf6cb
%changelog
317dc6
* Thu Sep 11 2014 Robert Scheck <robert@fedoraproject.org> 50b-1
317dc6
- Upgrade to 50b
317dc6
97e4a7
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 50-2
97e4a7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
97e4a7
a2e7a9
* Thu Jul 03 2014 Robert Scheck <robert@fedoraproject.org> 50-1
a2e7a9
- Upgrade to 50
a2e7a9
0df96e
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 49-2
0df96e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
0df96e
b3a1ea
* Tue Jan 14 2014 Robert Scheck <robert@fedoraproject.org> 49-1
b3a1ea
- Upgrade to 49
b3a1ea
faab60
* Sun Aug 25 2013 Robert Scheck <robert@fedoraproject.org> 48b-1
faab60
- Upgrade to 48b
faab60
ef9375
* Sat Aug 03 2013 Robert Scheck <robert@fedoraproject.org> 47-1
ef9375
- Upgrade to 47
ef9375
c06572
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 46-2
c06572
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
c06572
037b08
* Fri May 03 2013 Thorsten Glaser <tg@mirbsd.org> 46-1
037b08
- Upgrade mksh to R46
037b08
ee681d
* Wed May 01 2013 Thorsten Glaser <tg@mirbsd.org> 45-1
ee681d
- Upgrade mksh to R45 and the other files to the accompanying versions
ee681d
- Drop workaround for GCC PR55009 (no longer needed)
ee681d
- Use https for homepage
ee681d
968f66
* Mon Mar 18 2013 Robert Scheck <robert@fedoraproject.org> 44-1
968f66
- Upgrade to 44 and work around bug in GCC 4.8 (#922974)
968f66
30780e
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 41-2
30780e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
30780e
985421
* Mon Dec 03 2012 Michal Hlavinka <mhlavink@redhat.com> - 41-1
985421
- Upgrade to 41
985421
70f573
* Fri Jul 20 2012 Michal Hlavinka <mhlavink@redhat.com> - 40i-0.20120630
70f573
- Upgrade to pre-release of 40i
70f573
- includes new legacy shell lksh for old scripts requiring pdksh or similar old
70f573
  ksh-88 shell, see man lksh for differences
70f573
2c26a0
* Fri Jul 20 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 40d-3
2c26a0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
2c26a0
cbbcec
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 40d-2
cbbcec
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
cbbcec
c473ff
* Sun Dec 11 2011 Robert Scheck <robert@fedoraproject.org> 40d-1
c473ff
- Upgrade to 40d
c473ff
16eae9
* Tue Nov 22 2011 Robert Scheck <robert@fedoraproject.org> 40c-1
16eae9
- Upgrade to 40c
16eae9
a43097
* Thu Jul 28 2011 Robert Scheck <robert@fedoraproject.org> 40b-2
a43097
- Use new "Build.sh -r -c lto" rather "Build.sh -r -combine"
a43097
c27143
* Thu Jul 28 2011 Robert Scheck <robert@fedoraproject.org> 40b-1
c27143
- Upgrade to 40b
c27143
fe4e10
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 39c-5
fe4e10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
fe4e10
a3f709
* Tue Jan 04 2011 Michal Hlavinka <mhlavink@redhat.com> 39c-4
a3f709
- fix crash when bad substitution is used
a3f709
5f1147
* Wed Jul 21 2010 Michal Hlavinka <mhlavink@redhat.com> 39c-3
5f1147
- fix crash when alias contains alias
5f1147
- fix crash when xtrace is enabled
5f1147
e2f293
* Sun Jul 11 2010 Robert Scheck <robert@fedoraproject.org> 39c-2
e2f293
- Added default configuration /etc/mkshrc & /etc/skel/.mkshrc
e2f293
  as default skel (like at bash; thanks to Michal Hlavinka)
e2f293
- Corrected the license tag (thanks to Michal Hlavinka)
e2f293
- Removed the arc4random.c file (upstream is phasing it out)
e2f293
c14208
* Sat Feb 27 2010 Robert Scheck <robert@fedoraproject.org> 39c-1
c14208
- Upgrade to 39c and updated arc4random.c file
c14208
3c7016
* Thu Aug 13 2009 Robert Scheck <robert@fedoraproject.org> 39-1
3c7016
- Upgrade to 39 and updated arc4random.c file
3c7016
390953
* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 38b-2
390953
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
390953
d2c52f
* Sun May 31 2009 Robert Scheck <robert@fedoraproject.org> 38b-1
d2c52f
- Upgrade to 38b
d2c52f
8a4f27
* Sun May 31 2009 Robert Scheck <robert@fedoraproject.org> 38-1
8a4f27
- Upgrade to 38 and updated arc4random.c file
8a4f27
- Used -combine (-fwhole-program) rather the old -j switch
8a4f27
0d04dc
* Sun Apr 05 2009 Robert Scheck <robert@fedoraproject.org> 37b-1
0d04dc
- Upgrade to 37b
0d04dc
eb6975
* Mon Feb 23 2009 Robert Scheck <robert@fedoraproject.org> 36b-2
eb6975
- Rebuild against gcc 4.4 and rpm 4.6
eb6975
f3c9d1
* Sun Dec 14 2008 Robert Scheck <robert@fedoraproject.org> 36b-1
f3c9d1
- Upgrade to 36b and updated arc4random.c file
f3c9d1
58cf9f
* Tue Dec 02 2008 Robert Scheck <robert@fedoraproject.org> 36-2
58cf9f
- Upstream patch for command hang/high cpu workload (#474115)
58cf9f
be846b
* Sat Oct 25 2008 Robert Scheck <robert@fedoraproject.org> 36-1
be846b
- Upgrade to 36
be846b
0f795b
* Sat Jul 19 2008 Robert Scheck <robert@fedoraproject.org> 35b-1
0f795b
- Upgrade to 35b
0f795b
90ac14
* Sun Jul 13 2008 Robert Scheck <robert@fedoraproject.org> 35-1
90ac14
- Upgrade to 35
90ac14
cdc3b3
* Sat Apr 12 2008 Robert Scheck <robert@fedoraproject.org> 33d-1
cdc3b3
- Upgrade to 33d
cdc3b3
4a8a84
* Fri Apr 04 2008 Robert Scheck <robert@fedoraproject.org> 33c-1
4a8a84
- Upgrade to 33c and updated arc4random.c file
4a8a84
0227da
* Mon Mar 03 2008 Robert Scheck <robert@fedoraproject.org> 33-1
0227da
- Upgrade to 33
0227da
9ed6b2
* Sun Feb 10 2008 Robert Scheck <robert@fedoraproject.org> 32-2
9ed6b2
- Rebuild against gcc 4.3
9ed6b2
9f2060
* Sat Nov 10 2007 Robert Scheck <robert@fedoraproject.org> 32-1
9f2060
- Upgrade to 32
9f2060
- Solved fork problems in %%check (thanks to Thorsten Glaser)
9f2060
5d8bd4
* Mon Oct 15 2007 Robert Scheck <robert@fedoraproject.org> 31d-1
5d8bd4
- Upgrade to 31d
5d8bd4
b07ea3
* Wed Sep 12 2007 Robert Scheck <robert@fedoraproject.org> 31c-1
b07ea3
- Upgrade to 31c
b07ea3
- Added a buildrequirement to ed, added arc4random.c file
b07ea3
9254e3
* Tue Sep 11 2007 Robert Scheck <robert@fedoraproject.org> 31b-1
9254e3
- Upgrade to 31b
9254e3
- Use script to get %%check happy (thanks to Thorsten Glaser)
9254e3
c987a0
* Sat Sep 08 2007 Robert Scheck <robert@fedoraproject.org> 31-1
c987a0
- Upgrade to 31
c987a0
2d7354
* Tue Aug 28 2007 Robert Scheck <robert@fedoraproject.org> 30-2
2d7354
- Updated the license tag according to the guidelines
2d7354
40990d
* Sat Jul 28 2007 Robert Scheck <robert@fedoraproject.org> 30-1
40990d
- Upgrade to 30
40990d
835ef0
* Sat Jul 14 2007 Robert Scheck <robert@fedoraproject.org> 29g-1
835ef0
- Upgrade to 29g
835ef0
eaf6cb
* Sun Jun 03 2007 Robert Scheck <robert@fedoraproject.org> 29f-1
eaf6cb
- Upgrade to 29f
eaf6cb
- Initial spec file for Fedora and Red Hat Enterprise Linux