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