3 %bcond_without static # static version of mksh
4 %bcond_without tests # rtchecks and test.sh checks
6 Summary: MirBSD Korn Shell
7 Summary(pl.UTF-8): Powłoka Korna z MirBSD
12 Group: Applications/Shells
13 Source0: http://www.mirbsd.org/MirOS/dist/mir/mksh/%{name}-R%{version}.tgz
14 # Source0-md5: be0a6fb93b4a5f927bcc1893bb6692f8
15 Source1: %{name}-mkshrc
16 Patch0: %{name}-mkshrc_support.patch
17 Patch1: %{name}-circumflex.patch
18 URL: https://www.mirbsd.org/mksh.htm
21 BuildRequires: perl-base
23 %{?with_static:BuildRequires: glibc-static}
24 BuildRequires: rpmbuild(macros) >= 1.670
25 # is needed for /etc directory existence
27 Requires: setup >= 2.4.6-2
29 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
34 mksh is the MirBSD enhanced version of the Public Domain Korn shell
35 (pdksh), a Bourne-compatible shell which is largely similar to the
36 original AT&T Korn shell. It includes bug fixes and feature
37 improvements in order to produce a modern, robust shell good for
38 interactive and especially script use. It has UTF-8 support in the
39 emacs command line editing mode; corresponds to OpenBSD 4.2-current
40 ksh sans GNU bash-like $PS1; the build environment requirements are
41 autoconfigured; throughout code simplification/bugfix/enhancement has
42 been done, and the shell has extended compatibility to other modern
45 %description -l pl.UTF-8
46 mksh to pochodząca z MirBSD rozszerzona wersja powłoki Public Domain
47 Korn Shell (pdksh) - kompatybilnej z powłoką Bourne'a, w większości
48 zbliżonej do oryginalnej powłoki Korna z AT&T. Zawiera poprawki błędów
49 i rozszerzenia mające na celu stworzenie współczesnej powłoki o
50 bogatych możliwościach do użytku interaktywnego i (zwłaszcza) w
51 skryptach. Ma obsługę UTF-8 w trybie edycji linii poleceń w stylu
52 emacsa; $PS1 odpowiada temu z ksh obecnym w OpenBSD 4.2-current;
53 środowisko budowania jest automatycznie konfigurowane; dzięki
54 wykonanym uproszczeniom kodu, poprawkom i rozszerzeniom powłoka ma
55 rozszerzoną kompatybilność z innymi współczesnymi powłokami.
58 Summary: Statically linked the MirBSD enhanced version of pdksh
59 Summary(pl.UTF-8): Skonsolidowana statycznie powłoka mksh
60 Group: Applications/Shells
61 # requires base for /etc/mkshrc?
62 Requires: %{name} = %{version}-%{release}
65 mksh is the MirBSD enhanced version of the Public Domain Korn shell
66 (pdksh), a Bourne-compatible shell which is largely similar to the
67 original AT&T Korn shell.
69 This packege contains statically linked version of mksh.
71 %description static -l pl.UTF-8
72 mksh to pochodząca z MirBSD rozszerzona wersja powłoki Public Domain
73 Korn Shell (pdksh) - kompatybilnej z powłoką Bourne'a, w większości
74 zbliżonej do oryginalnej powłoki Korna z AT&T.
76 W tym pakiecie jest mksh skonsolidowany statycznie.
80 mv mksh/* .; rmdir mksh
85 # sed rules instead of patch (needed update for every release)
86 sed -i -e 's|\(#define.*MKSH_VERSION.*\)"|\1 @DISTRO@"|g' sh.h
87 sed -i -e 's|\(@(#)MIRBSD KSH.*\)|\1 @DISTRO@|g' check.t
90 sed -i -e 's#@DISTRO@#TLD/Linux#g' check.t sh.h
92 grep TLD/Linux check.t || exit 1
93 grep TLD/Linux sh.h || exit 1
95 # we'll need this later due to -DMKSH_GCC55009
100 print -r -- $((x++)):$sari=$uari.
102 print -r -- $((x++)):$sari=$uari.
103 sari=2147483647 uari=2147483647
104 print -r -- $((x++)):$sari=$uari.
106 print -r -- $((x++)):$sari=$uari.
108 let 'sari *= 2' 'uari *= 2'
110 print -r -- $((x++)):$sari=$uari.
112 print -r -- $((x++)):$sari=$uari.
113 sari=-2147483648 uari=-2147483648
114 print -r -- $((x++)):$sari=$uari.
116 print -r -- $((x++)):$sari=$uari.
119 cat >rtchecks.expected <<'EOF'
122 2:2147483647=2147483647.
123 3:-2147483648=2147483648.
126 6:-2147483648=2147483648.
127 7:2147483647=2147483647.
134 CFLAGS="%{rpmcflags} -DMKSH_GCC55009" \
135 LDFLAGS="%{rpmldflags}" \
136 CPPFLAGS="%{rpmcppflags}" \
137 sh ./Build.sh -Q -r -j -c lto
139 # skip some tests if not on terminal
141 skip_tests="-C regress:no-ctty"
145 ./mksh rtchecks >rtchecks.got 2>&1
146 if ! cmp --quiet rtchecks.got rtchecks.expected ; then
147 echo "rtchecks failed"
148 diff -Naurp rtchecks.expected rtchecks.got
151 ./test.sh -v $skip_tests
153 mv mksh out/mksh.dynamic
157 CFLAGS="%{rpmcflags} -DMKSH_GCC55009" \
158 LDFLAGS="%{rpmldflags} -static" \
159 CPPFLAGS="%{rpmcppflags}" \
160 sh ./Build.sh -Q -r -j -c lto
163 ./test.sh -v $skip_tests
164 ./mksh rtchecks >rtchecks.got 2>&1
165 if ! cmp --quiet rtchecks.got rtchecks.expected ; then
166 echo "rtchecks failed"
167 diff -Naurp %{SOURCE3} rtchecks.got
171 mv mksh out/mksh.static
175 rm -rf $RPM_BUILD_ROOT
176 install -d $RPM_BUILD_ROOT{%{_bindir},%{_mandir}/man1}
177 install -p out/mksh.dynamic $RPM_BUILD_ROOT%{_bindir}/mksh
178 %{?with_static:install -p out/mksh.static $RPM_BUILD_ROOT%{_bindir}/mksh.static}
180 cp -a mksh.1 $RPM_BUILD_ROOT%{_mandir}/man1/mksh.1
181 echo ".so mksh.1" > $RPM_BUILD_ROOT%{_mandir}/man1/sh.1
183 install -D %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/mkshrc
184 ln -sf mksh $RPM_BUILD_ROOT%{_bindir}/sh
186 # some pdksh scripts used that
187 ln -sf mksh $RPM_BUILD_ROOT%{_bindir}/ksh
190 rm -rf $RPM_BUILD_ROOT
192 %post -p %add_etc_shells -p /bin/sh /bin/ksh /bin/mksh
193 %preun -p %remove_etc_shells -p /bin/sh /bin/ksh /bin/mksh
195 %post static -p %add_etc_shells -p /bin/mksh.static
196 %preun static -p %remove_etc_shells -p /bin/mksh.static
198 %triggerpostun -p <lua> -- pdksh
200 %lua_add_etc_shells /bin/sh /bin/ksh /bin/mksh
204 %defattr(644,root,root,755)
206 %config(noreplace,missingok) %verify(not md5 mtime size) %{_sysconfdir}/mkshrc
207 %attr(755,root,root) %{_bindir}/mksh
208 %attr(755,root,root) %{_bindir}/ksh
209 %attr(755,root,root) %{_bindir}/sh
210 %{_mandir}/man1/mksh.1*
211 %{_mandir}/man1/sh.1*
215 %defattr(644,root,root,755)
216 %attr(755,root,root) %{_bindir}/mksh.static