2 # TODO: https://bugs.launchpad.net/mksh/+bug/1179287
5 %bcond_without static # static version of mksh
6 %bcond_without tests # rtchecks and test.sh checks
9 Summary: MirBSD Korn Shell
10 Summary(pl.UTF-8): Powłoka Korna z MirBSD
15 Group: Applications/Shells
16 Source0: http://www.mirbsd.org/MirOS/dist/mir/mksh/%{name}-R%{version}.tgz
17 # Source0-md5: 71c7cbcd78306897801b8b6691091e66
18 Source1: %{name}-mkshrc
19 Patch0: %{name}-mkshrc_support.patch
20 Patch1: %{name}-circumflex.patch
21 Patch2: %{name}-no_stop_alias.patch
22 Patch3: %{name}-cmdline-length.patch
23 URL: https://www.mirbsd.org/mksh.htm
26 BuildRequires: perl-base
28 %{?with_static:BuildRequires: glibc-static}
29 BuildRequires: rpmbuild(macros) >= 1.462
30 # is needed for /etc directory existence
32 Requires: setup >= 2.4.6-2
34 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
39 mksh is the MirBSD enhanced version of the Public Domain Korn shell
40 (pdksh), a Bourne-compatible shell which is largely similar to the
41 original AT&T Korn shell. It includes bug fixes and feature
42 improvements in order to produce a modern, robust shell good for
43 interactive and especially script use. It has UTF-8 support in the
44 emacs command line editing mode; corresponds to OpenBSD 4.2-current
45 ksh sans GNU bash-like $PS1; the build environment requirements are
46 autoconfigured; throughout code simplification/bugfix/enhancement has
47 been done, and the shell has extended compatibility to other modern
50 %description -l pl.UTF-8
51 mksh to pochodząca z MirBSD rozszerzona wersja powłoki Public Domain
52 Korn Shell (pdksh) - kompatybilnej z powłoką Bourne'a, w większości
53 zbliżonej do oryginalnej powłoki Korna z AT&T. Zawiera poprawki błędów
54 i rozszerzenia mające na celu stworzenie współczesnej powłoki o
55 bogatych możliwościach do użytku interaktywnego i (zwłaszcza) w
56 skryptach. Ma obsługę UTF-8 w trybie edycji linii poleceń w stylu
57 emacsa; $PS1 odpowiada temu z ksh obecnym w OpenBSD 4.2-current;
58 środowisko budowania jest automatycznie konfigurowane; dzięki
59 wykonanym uproszczeniom kodu, poprawkom i rozszerzeniom powłoka ma
60 rozszerzoną kompatybilność z innymi współczesnymi powłokami.
63 Summary: Statically linked the MirBSD enhanced version of pdksh
64 Summary(pl.UTF-8): Skonsolidowana statycznie powłoka mksh
65 Group: Applications/Shells
66 # requires base for /etc/mkshrc?
67 Requires: %{name} = %{version}-%{release}
70 mksh is the MirBSD enhanced version of the Public Domain Korn shell
71 (pdksh), a Bourne-compatible shell which is largely similar to the
72 original AT&T Korn shell.
74 This packege contains statically linked version of mksh.
76 %description static -l pl.UTF-8
77 mksh to pochodząca z MirBSD rozszerzona wersja powłoki Public Domain
78 Korn Shell (pdksh) - kompatybilnej z powłoką Bourne'a, w większości
79 zbliżonej do oryginalnej powłoki Korna z AT&T.
81 W tym pakiecie jest mksh skonsolidowany statycznie.
85 gzip -dc %{SOURCE0} | cpio -mid
86 mv mksh/* .; rmdir mksh
93 # sed rules instead of patch (needed update for every release)
94 sed -i -e 's|\(#define.*MKSH_VERSION.*\)"|\1 @DISTRO@"|g' sh.h
95 sed -i -e 's|\(@(#)MIRBSD KSH.*\)|\1 @DISTRO@|g' check.t
98 sed -i -e 's#@DISTRO@#PLD/Linux 3.0#g' check.t sh.h
100 grep PLD/Linux check.t || exit 1
101 grep PLD/Linux sh.h || exit 1
103 # we'll need this later due to -DMKSH_GCC55009
104 cat >rtchecks <<'EOF'
108 print -r -- $((x++)):$sari=$uari.
110 print -r -- $((x++)):$sari=$uari.
111 sari=2147483647 uari=2147483647
112 print -r -- $((x++)):$sari=$uari.
114 print -r -- $((x++)):$sari=$uari.
116 let 'sari *= 2' 'uari *= 2'
118 print -r -- $((x++)):$sari=$uari.
120 print -r -- $((x++)):$sari=$uari.
121 sari=-2147483648 uari=-2147483648
122 print -r -- $((x++)):$sari=$uari.
124 print -r -- $((x++)):$sari=$uari.
127 cat >rtchecks.expected <<'EOF'
130 2:2147483647=2147483647.
131 3:-2147483648=2147483648.
134 6:-2147483648=2147483648.
135 7:2147483647=2147483647.
142 CFLAGS="%{rpmcflags} -DMKSH_GCC55009" \
143 LDFLAGS="%{rpmldflags}" \
144 CPPFLAGS="%{rpmcppflags}" \
145 sh ./Build.sh -Q -r -j -c lto
147 # skip some tests if not on terminal
149 skip_tests="-C regress:no-ctty"
153 ./mksh rtchecks >rtchecks.got 2>&1
154 if ! cmp --quiet rtchecks.got rtchecks.expected ; then
155 echo "rtchecks failed"
156 diff -Naurp rtchecks.expected rtchecks.got
159 ./test.sh -v $skip_tests
161 mv mksh out/mksh.dynamic
165 CFLAGS="%{rpmcflags} -DMKSH_GCC55009" \
166 LDFLAGS="%{rpmldflags} -static" \
167 CPPFLAGS="%{rpmcppflags}" \
168 sh ./Build.sh -Q -r -j -c lto
171 ./test.sh -v $skip_tests
172 ./mksh rtchecks >rtchecks.got 2>&1
173 if ! cmp --quiet rtchecks.got rtchecks.expected ; then
174 echo "rtchecks failed"
175 diff -Naurp %{SOURCE3} rtchecks.got
179 mv mksh out/mksh.static
183 rm -rf $RPM_BUILD_ROOT
184 install -d $RPM_BUILD_ROOT{%{_bindir},%{_mandir}/man1}
185 install -p out/mksh.dynamic $RPM_BUILD_ROOT%{_bindir}/mksh
186 %{?with_static:install -p out/mksh.static $RPM_BUILD_ROOT%{_bindir}/mksh.static}
188 cp -a mksh.1 $RPM_BUILD_ROOT%{_mandir}/man1/mksh.1
189 echo ".so mksh.1" > $RPM_BUILD_ROOT%{_mandir}/man1/sh.1
191 install -D %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/mkshrc
192 ln -sf mksh $RPM_BUILD_ROOT%{_bindir}/sh
194 # some pdksh scripts used that
195 ln -sf mksh $RPM_BUILD_ROOT%{_bindir}/ksh
198 rm -rf $RPM_BUILD_ROOT
200 %post -p %add_etc_shells -p /bin/sh /bin/ksh /bin/mksh
201 %preun -p %remove_etc_shells -p /bin/sh /bin/ksh /bin/mksh
203 %posttrans -p %add_etc_shells -p /bin/sh /bin/ksh /bin/mksh
205 %post static -p %add_etc_shells -p /bin/mksh.static
206 %preun static -p %remove_etc_shells -p /bin/mksh.static
209 %defattr(644,root,root,755)
211 %config(noreplace,missingok) %verify(not md5 mtime size) %{_sysconfdir}/mkshrc
212 %attr(755,root,root) %{_bindir}/mksh
213 %attr(755,root,root) %{_bindir}/ksh
214 %attr(755,root,root) %{_bindir}/sh
215 %{_mandir}/man1/mksh.1*
216 %{_mandir}/man1/sh.1*
220 %defattr(644,root,root,755)
221 %attr(755,root,root) %{_bindir}/mksh.static