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: https://www.mirbsd.org/MirOS/dist/mir/mksh/%{name}-R%{version}.tgz
14 # Source0-md5: cd5b92fc2e455d33cbd59f3e7518f257
15 Source1: %{name}-mkshrc
16 Source2: get-source.sh
17 Patch0: %{name}-mkshrc_support.patch
18 Patch1: %{name}-circumflex.patch
19 Patch2: %{name}-cmdline-length.patch
20 URL: https://www.mirbsd.org/mksh.htm
23 BuildRequires: perl-base
25 %{?with_static:BuildRequires: glibc-static}
26 BuildRequires: rpmbuild(macros) >= 1.670
27 # is needed for /etc directory existence
29 Requires: setup >= 2.4.6-2
31 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
36 mksh is the MirBSD enhanced version of the Public Domain Korn shell
37 (pdksh), a Bourne-compatible shell which is largely similar to the
38 original AT&T Korn shell. It includes bug fixes and feature
39 improvements in order to produce a modern, robust shell good for
40 interactive and especially script use. It has UTF-8 support in the
41 emacs command line editing mode; corresponds to OpenBSD 4.2-current
42 ksh sans GNU bash-like $PS1; the build environment requirements are
43 autoconfigured; throughout code simplification/bugfix/enhancement has
44 been done, and the shell has extended compatibility to other modern
47 %description -l pl.UTF-8
48 mksh to pochodząca z MirBSD rozszerzona wersja powłoki Public Domain
49 Korn Shell (pdksh) - kompatybilnej z powłoką Bourne'a, w większości
50 zbliżonej do oryginalnej powłoki Korna z AT&T. Zawiera poprawki błędów
51 i rozszerzenia mające na celu stworzenie współczesnej powłoki o
52 bogatych możliwościach do użytku interaktywnego i (zwłaszcza) w
53 skryptach. Ma obsługę UTF-8 w trybie edycji linii poleceń w stylu
54 emacsa; $PS1 odpowiada temu z ksh obecnym w OpenBSD 4.2-current;
55 środowisko budowania jest automatycznie konfigurowane; dzięki
56 wykonanym uproszczeniom kodu, poprawkom i rozszerzeniom powłoka ma
57 rozszerzoną kompatybilność z innymi współczesnymi powłokami.
60 Summary: Statically linked the MirBSD enhanced version of pdksh
61 Summary(pl.UTF-8): Skonsolidowana statycznie powłoka mksh
62 Group: Applications/Shells
63 # requires base for /etc/mkshrc?
64 Requires: %{name} = %{version}-%{release}
67 mksh is the MirBSD enhanced version of the Public Domain Korn shell
68 (pdksh), a Bourne-compatible shell which is largely similar to the
69 original AT&T Korn shell.
71 This packege contains statically linked version of mksh.
73 %description static -l pl.UTF-8
74 mksh to pochodząca z MirBSD rozszerzona wersja powłoki Public Domain
75 Korn Shell (pdksh) - kompatybilnej z powłoką Bourne'a, w większości
76 zbliżonej do oryginalnej powłoki Korna z AT&T.
78 W tym pakiecie jest mksh skonsolidowany statycznie.
82 mv mksh/* .; rmdir mksh
88 # sed rules instead of patch (needed update for every release)
89 sed -i -e 's|\(#define.*MKSH_VERSION.*\)"|\1 @DISTRO@"|g' sh.h
90 sed -i -e 's|\(@(#)MIRBSD KSH.*\)|\1 @DISTRO@|g' check.t
93 sed -i -e 's#@DISTRO@#PLD/Linux 3.0#g' check.t sh.h
95 grep PLD/Linux check.t || exit 1
96 grep PLD/Linux sh.h || exit 1
98 # we'll need this later due to -DMKSH_GCC55009
103 print -r -- $((x++)):$sari=$uari.
105 print -r -- $((x++)):$sari=$uari.
106 sari=2147483647 uari=2147483647
107 print -r -- $((x++)):$sari=$uari.
109 print -r -- $((x++)):$sari=$uari.
111 let 'sari *= 2' 'uari *= 2'
113 print -r -- $((x++)):$sari=$uari.
115 print -r -- $((x++)):$sari=$uari.
116 sari=-2147483648 uari=-2147483648
117 print -r -- $((x++)):$sari=$uari.
119 print -r -- $((x++)):$sari=$uari.
122 cat >rtchecks.expected <<'EOF'
125 2:2147483647=2147483647.
126 3:-2147483648=2147483648.
129 6:-2147483648=2147483648.
130 7:2147483647=2147483647.
137 CFLAGS="%{rpmcflags} -DMKSH_GCC55009" \
138 LDFLAGS="%{rpmldflags}" \
139 CPPFLAGS="%{rpmcppflags}" \
140 sh ./Build.sh -Q -r -j -c lto
142 # skip some tests if not on terminal
144 skip_tests="-C regress:no-ctty"
148 ./mksh rtchecks >rtchecks.got 2>&1
149 if ! cmp --quiet rtchecks.got rtchecks.expected ; then
150 echo "rtchecks failed"
151 diff -Naurp rtchecks.expected rtchecks.got
154 ./test.sh -v $skip_tests
156 mv mksh out/mksh.dynamic
160 CFLAGS="%{rpmcflags} -DMKSH_GCC55009" \
161 LDFLAGS="%{rpmldflags} -static" \
162 CPPFLAGS="%{rpmcppflags}" \
163 sh ./Build.sh -Q -r -j -c lto
166 ./test.sh -v $skip_tests
167 ./mksh rtchecks >rtchecks.got 2>&1
168 if ! cmp --quiet rtchecks.got rtchecks.expected ; then
169 echo "rtchecks failed"
170 diff -Naurp %{SOURCE3} rtchecks.got
174 mv mksh out/mksh.static
178 rm -rf $RPM_BUILD_ROOT
179 install -d $RPM_BUILD_ROOT{%{_bindir},%{_mandir}/man1}
180 install -p out/mksh.dynamic $RPM_BUILD_ROOT%{_bindir}/mksh
181 %{?with_static:install -p out/mksh.static $RPM_BUILD_ROOT%{_bindir}/mksh.static}
183 cp -a mksh.1 $RPM_BUILD_ROOT%{_mandir}/man1/mksh.1
184 echo ".so mksh.1" > $RPM_BUILD_ROOT%{_mandir}/man1/sh.1
186 install -D %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/mkshrc
187 ln -sf mksh $RPM_BUILD_ROOT%{_bindir}/sh
189 # some pdksh scripts used that
190 ln -sf mksh $RPM_BUILD_ROOT%{_bindir}/ksh
193 rm -rf $RPM_BUILD_ROOT
195 %post -p %add_etc_shells -p /bin/sh /bin/ksh /bin/mksh
196 %preun -p %remove_etc_shells -p /bin/sh /bin/ksh /bin/mksh
198 %post static -p %add_etc_shells -p /bin/mksh.static
199 %preun static -p %remove_etc_shells -p /bin/mksh.static
201 %triggerpostun -p <lua> -- pdksh
203 %lua_add_etc_shells /bin/sh /bin/ksh /bin/mksh
207 %defattr(644,root,root,755)
209 %config(noreplace,missingok) %verify(not md5 mtime size) %{_sysconfdir}/mkshrc
210 %attr(755,root,root) %{_bindir}/mksh
211 %attr(755,root,root) %{_bindir}/ksh
212 %attr(755,root,root) %{_bindir}/sh
213 %{_mandir}/man1/mksh.1*
214 %{_mandir}/man1/sh.1*
218 %defattr(644,root,root,755)
219 %attr(755,root,root) %{_bindir}/mksh.static