]>
Commit | Line | Data |
---|---|---|
de8a6e5f JB |
1 | # |
2 | # Conditional build: | |
7438aa93 | 3 | %bcond_with lto # enable link time optimisations (breaks tests) |
de8a6e5f JB |
4 | %bcond_without static # static version of mksh |
5 | %bcond_without tests # rtchecks and test.sh checks | |
1c7e5b2c | 6 | |
5cba9227 | 7 | Summary: MirBSD Korn Shell |
246a15d9 | 8 | Summary(pl.UTF-8): Powłoka Korna z MirBSD |
5cba9227 | 9 | Name: mksh |
7438aa93 | 10 | Version: 56 |
f9942231 | 11 | Release: 1 |
5cba9227 | 12 | License: BSD |
13 | Group: Applications/Shells | |
62eadf67 | 14 | Source0: https://www.mirbsd.org/MirOS/dist/mir/mksh/%{name}-R%{version}.tgz |
7438aa93 | 15 | # Source0-md5: fedd42b11d2bda84921afcc8de3912e3 |
bbdaf468 | 16 | Source1: %{name}-mkshrc |
f9769367 | 17 | Source2: get-source.sh |
bbdaf468 | 18 | Patch0: %{name}-mkshrc_support.patch |
118a1201 | 19 | Patch1: %{name}-circumflex.patch |
15b50001 KK |
20 | URL: https://www.mirbsd.org/mksh.htm |
21 | %if %{with tests} | |
22 | BuildRequires: ed | |
23 | BuildRequires: perl-base | |
24 | %endif | |
d979d194 | 25 | %{?with_static:BuildRequires: glibc-static} |
20fe49cb | 26 | BuildRequires: rpmbuild(macros) >= 1.670 |
d979d194 AM |
27 | # is needed for /etc directory existence |
28 | Requires(pre): FHS | |
29 | Requires: setup >= 2.4.6-2 | |
30 | Obsoletes: pdksh | |
5cba9227 | 31 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
32 | ||
33 | %define _bindir /bin | |
34 | ||
35 | %description | |
36 | mksh is the MirBSD enhanced version of the Public Domain Korn shell | |
246a15d9 | 37 | (pdksh), a Bourne-compatible shell which is largely similar to the |
5cba9227 | 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 | |
5110d1d3 | 41 | emacs command line editing mode; corresponds to OpenBSD 4.2-current |
5cba9227 | 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 | |
45 | shells. | |
46 | ||
246a15d9 JB |
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. | |
58 | ||
d979d194 AM |
59 | %package static |
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} | |
65 | ||
66 | %description static | |
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. | |
70 | ||
71 | This packege contains statically linked version of mksh. | |
72 | ||
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. | |
77 | ||
7a5709f6 | 78 | W tym pakiecie jest mksh skonsolidowany statycznie. |
d979d194 | 79 | |
5cba9227 | 80 | %prep |
62eadf67 | 81 | %setup -qc |
a311ce57 | 82 | %{__mv} mksh/* .; rmdir mksh |
5cba9227 | 83 | |
e42128b9 | 84 | %patch0 -p1 |
118a1201 | 85 | %patch1 -p1 |
a56c2c0a | 86 | |
90672aa5 AM |
87 | # sed rules instead of patch (needed update for every release) |
88 | sed -i -e 's|\(#define.*MKSH_VERSION.*\)"|\1 @DISTRO@"|g' sh.h | |
89 | sed -i -e 's|\(@(#)MIRBSD KSH.*\)|\1 @DISTRO@|g' check.t | |
90 | ||
91 | # fill distro | |
e38ec2b8 | 92 | sed -i -e 's#@DISTRO@#PLD/Linux 3.0#g' check.t sh.h |
90672aa5 AM |
93 | # sanity checks |
94 | grep PLD/Linux check.t || exit 1 | |
95 | grep PLD/Linux sh.h || exit 1 | |
bbdaf468 | 96 | |
9b0c41bb JR |
97 | # we'll need this later due to -DMKSH_GCC55009 |
98 | cat >rtchecks <<'EOF' | |
99 | typeset -i sari=0 | |
100 | typeset -Ui uari=0 | |
101 | typeset -i x=0 | |
102 | print -r -- $((x++)):$sari=$uari. | |
103 | let --sari --uari | |
104 | print -r -- $((x++)):$sari=$uari. | |
105 | sari=2147483647 uari=2147483647 | |
106 | print -r -- $((x++)):$sari=$uari. | |
107 | let ++sari ++uari | |
108 | print -r -- $((x++)):$sari=$uari. | |
109 | let --sari --uari | |
110 | let 'sari *= 2' 'uari *= 2' | |
111 | let ++sari ++uari | |
112 | print -r -- $((x++)):$sari=$uari. | |
113 | let ++sari ++uari | |
114 | print -r -- $((x++)):$sari=$uari. | |
115 | sari=-2147483648 uari=-2147483648 | |
116 | print -r -- $((x++)):$sari=$uari. | |
117 | let --sari --uari | |
118 | print -r -- $((x++)):$sari=$uari. | |
119 | EOF | |
120 | ||
121 | cat >rtchecks.expected <<'EOF' | |
122 | 0:0=0. | |
123 | 1:-1=4294967295. | |
124 | 2:2147483647=2147483647. | |
125 | 3:-2147483648=2147483648. | |
126 | 4:-1=4294967295. | |
127 | 5:0=0. | |
128 | 6:-2147483648=2147483648. | |
129 | 7:2147483647=2147483647. | |
130 | EOF | |
131 | ||
5cba9227 | 132 | %build |
d979d194 AM |
133 | install -d out |
134 | ||
135 | CC="%{__cc}" \ | |
e054616e | 136 | CFLAGS="%{rpmcflags} -DMKSH_GCC55009" \ |
d979d194 | 137 | LDFLAGS="%{rpmldflags}" \ |
eec2ce74 | 138 | CPPFLAGS="%{rpmcppflags}" \ |
7438aa93 | 139 | sh ./Build.sh -Q -r -j %{?with_lto:-c lto} |
abf806a4 | 140 | |
1281d680 AM |
141 | # skip some tests if not on terminal |
142 | if ! tty -s; then | |
e14f3193 | 143 | skip_tests="-C regress:no-ctty" |
1281d680 AM |
144 | fi |
145 | ||
9b0c41bb JR |
146 | %if %{with tests} |
147 | ./mksh rtchecks >rtchecks.got 2>&1 | |
148 | if ! cmp --quiet rtchecks.got rtchecks.expected ; then | |
149 | echo "rtchecks failed" | |
f4608d8e | 150 | diff -Naurp rtchecks.expected rtchecks.got |
9b0c41bb JR |
151 | exit 1 |
152 | fi | |
153 | ./test.sh -v $skip_tests | |
154 | %endif | |
d979d194 AM |
155 | mv mksh out/mksh.dynamic |
156 | ||
157 | %if %{with static} | |
158 | CC="%{__cc}" \ | |
e054616e | 159 | CFLAGS="%{rpmcflags} -DMKSH_GCC55009" \ |
d979d194 | 160 | LDFLAGS="%{rpmldflags} -static" \ |
eec2ce74 | 161 | CPPFLAGS="%{rpmcppflags}" \ |
7438aa93 | 162 | sh ./Build.sh -Q -r -j %{?with_lto:-c lto} |
d979d194 | 163 | |
9b0c41bb JR |
164 | %if %{with tests} |
165 | ./test.sh -v $skip_tests | |
166 | ./mksh rtchecks >rtchecks.got 2>&1 | |
167 | if ! cmp --quiet rtchecks.got rtchecks.expected ; then | |
168 | echo "rtchecks failed" | |
169 | diff -Naurp %{SOURCE3} rtchecks.got | |
170 | exit 1 | |
171 | fi | |
172 | %endif | |
d979d194 AM |
173 | mv mksh out/mksh.static |
174 | %endif | |
175 | ||
5cba9227 | 176 | %install |
177 | rm -rf $RPM_BUILD_ROOT | |
64114d19 | 178 | install -d $RPM_BUILD_ROOT{%{_bindir},%{_mandir}/man1} |
d979d194 AM |
179 | install -p out/mksh.dynamic $RPM_BUILD_ROOT%{_bindir}/mksh |
180 | %{?with_static:install -p out/mksh.static $RPM_BUILD_ROOT%{_bindir}/mksh.static} | |
181 | ||
64114d19 | 182 | cp -a mksh.1 $RPM_BUILD_ROOT%{_mandir}/man1/mksh.1 |
d979d194 AM |
183 | echo ".so mksh.1" > $RPM_BUILD_ROOT%{_mandir}/man1/sh.1 |
184 | ||
bbdaf468 | 185 | install -D %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/mkshrc |
d76a7e70 | 186 | ln -sf mksh $RPM_BUILD_ROOT%{_bindir}/sh |
5cba9227 | 187 | |
53554a18 AM |
188 | # some pdksh scripts used that |
189 | ln -sf mksh $RPM_BUILD_ROOT%{_bindir}/ksh | |
190 | ||
5cba9227 | 191 | %clean |
192 | rm -rf $RPM_BUILD_ROOT | |
193 | ||
b4c63cbb AM |
194 | %post -p %add_etc_shells -p /bin/sh /bin/ksh /bin/mksh |
195 | %preun -p %remove_etc_shells -p /bin/sh /bin/ksh /bin/mksh | |
196 | ||
de8a6e5f JB |
197 | %post static -p %add_etc_shells -p /bin/mksh.static |
198 | %preun static -p %remove_etc_shells -p /bin/mksh.static | |
5cba9227 | 199 | |
1c7e5b2c ER |
200 | %triggerpostun -p <lua> -- pdksh |
201 | if arg[2] ~= 0 then | |
7660cf00 | 202 | %lua_add_etc_shells /bin/sh /bin/ksh /bin/mksh |
1c7e5b2c ER |
203 | end |
204 | ||
5cba9227 | 205 | %files |
206 | %defattr(644,root,root,755) | |
207 | %doc dot.mkshrc | |
bbdaf468 | 208 | %config(noreplace,missingok) %verify(not md5 mtime size) %{_sysconfdir}/mkshrc |
5cba9227 | 209 | %attr(755,root,root) %{_bindir}/mksh |
53554a18 | 210 | %attr(755,root,root) %{_bindir}/ksh |
7a5709f6 | 211 | %attr(755,root,root) %{_bindir}/sh |
64114d19 | 212 | %{_mandir}/man1/mksh.1* |
d979d194 AM |
213 | %{_mandir}/man1/sh.1* |
214 | ||
215 | %if %{with static} | |
216 | %files static | |
217 | %defattr(644,root,root,755) | |
218 | %attr(755,root,root) %{_bindir}/mksh.static | |
219 | %endif |