]>
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 | |
5 | # | |
d979d194 | 6 | # |
5cba9227 | 7 | Summary: MirBSD Korn Shell |
246a15d9 | 8 | Summary(pl.UTF-8): Powłoka Korna z MirBSD |
5cba9227 | 9 | Name: mksh |
570f989b | 10 | Version: 46 |
6bf9e2cc | 11 | Release: 2 |
5cba9227 | 12 | License: BSD |
13 | Group: Applications/Shells | |
9b0c41bb | 14 | Source0: http://www.mirbsd.org/MirOS/dist/mir/mksh/%{name}-R%{version}.tgz |
570f989b | 15 | # Source0-md5: 77c108d8143a6e7670954d77517d216d |
bbdaf468 KK |
16 | Source1: %{name}-mkshrc |
17 | Patch0: %{name}-mkshrc_support.patch | |
118a1201 | 18 | Patch1: %{name}-circumflex.patch |
d4eb7072 | 19 | Patch2: %{name}-no_stop_alias.patch |
90672aa5 | 20 | Patch3: %{name}-cmdline-length.patch |
15b50001 KK |
21 | URL: https://www.mirbsd.org/mksh.htm |
22 | %if %{with tests} | |
23 | BuildRequires: ed | |
24 | BuildRequires: perl-base | |
25 | %endif | |
d979d194 | 26 | %{?with_static:BuildRequires: glibc-static} |
64114d19 | 27 | BuildRequires: rpmbuild(macros) >= 1.462 |
d979d194 AM |
28 | # is needed for /etc directory existence |
29 | Requires(pre): FHS | |
30 | Requires: setup >= 2.4.6-2 | |
31 | Obsoletes: pdksh | |
5cba9227 | 32 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
33 | ||
34 | %define _bindir /bin | |
35 | ||
36 | %description | |
37 | mksh is the MirBSD enhanced version of the Public Domain Korn shell | |
246a15d9 | 38 | (pdksh), a Bourne-compatible shell which is largely similar to the |
5cba9227 | 39 | original AT&T Korn shell. It includes bug fixes and feature |
40 | improvements in order to produce a modern, robust shell good for | |
41 | interactive and especially script use. It has UTF-8 support in the | |
5110d1d3 | 42 | emacs command line editing mode; corresponds to OpenBSD 4.2-current |
5cba9227 | 43 | ksh sans GNU bash-like $PS1; the build environment requirements are |
44 | autoconfigured; throughout code simplification/bugfix/enhancement has | |
45 | been done, and the shell has extended compatibility to other modern | |
46 | shells. | |
47 | ||
246a15d9 JB |
48 | %description -l pl.UTF-8 |
49 | mksh to pochodząca z MirBSD rozszerzona wersja powłoki Public Domain | |
50 | Korn Shell (pdksh) - kompatybilnej z powłoką Bourne'a, w większości | |
51 | zbliżonej do oryginalnej powłoki Korna z AT&T. Zawiera poprawki błędów | |
52 | i rozszerzenia mające na celu stworzenie współczesnej powłoki o | |
53 | bogatych możliwościach do użytku interaktywnego i (zwłaszcza) w | |
54 | skryptach. Ma obsługę UTF-8 w trybie edycji linii poleceń w stylu | |
55 | emacsa; $PS1 odpowiada temu z ksh obecnym w OpenBSD 4.2-current; | |
56 | środowisko budowania jest automatycznie konfigurowane; dzięki | |
57 | wykonanym uproszczeniom kodu, poprawkom i rozszerzeniom powłoka ma | |
58 | rozszerzoną kompatybilność z innymi współczesnymi powłokami. | |
59 | ||
d979d194 AM |
60 | %package static |
61 | Summary: Statically linked the MirBSD enhanced version of pdksh | |
62 | Summary(pl.UTF-8): Skonsolidowana statycznie powłoka mksh | |
63 | Group: Applications/Shells | |
64 | # requires base for /etc/mkshrc? | |
65 | Requires: %{name} = %{version}-%{release} | |
66 | ||
67 | %description static | |
68 | mksh is the MirBSD enhanced version of the Public Domain Korn shell | |
69 | (pdksh), a Bourne-compatible shell which is largely similar to the | |
70 | original AT&T Korn shell. | |
71 | ||
72 | This packege contains statically linked version of mksh. | |
73 | ||
74 | %description static -l pl.UTF-8 | |
75 | mksh to pochodząca z MirBSD rozszerzona wersja powłoki Public Domain | |
76 | Korn Shell (pdksh) - kompatybilnej z powłoką Bourne'a, w większości | |
77 | zbliżonej do oryginalnej powłoki Korna z AT&T. | |
78 | ||
7a5709f6 | 79 | W tym pakiecie jest mksh skonsolidowany statycznie. |
d979d194 | 80 | |
5cba9227 | 81 | %prep |
5110d1d3 | 82 | %setup -qcT |
5cba9227 | 83 | gzip -dc %{SOURCE0} | cpio -mid |
64114d19 | 84 | mv mksh/* .; rmdir mksh |
5cba9227 | 85 | |
bbdaf468 | 86 | %patch0 -p0 |
118a1201 | 87 | %patch1 -p1 |
d4eb7072 | 88 | %patch2 -p1 |
53554a18 | 89 | %patch3 -p1 |
a56c2c0a | 90 | |
90672aa5 AM |
91 | # sed rules instead of patch (needed update for every release) |
92 | sed -i -e 's|\(#define.*MKSH_VERSION.*\)"|\1 @DISTRO@"|g' sh.h | |
93 | sed -i -e 's|\(@(#)MIRBSD KSH.*\)|\1 @DISTRO@|g' check.t | |
94 | ||
95 | # fill distro | |
e38ec2b8 | 96 | sed -i -e 's#@DISTRO@#PLD/Linux 3.0#g' check.t sh.h |
90672aa5 AM |
97 | # sanity checks |
98 | grep PLD/Linux check.t || exit 1 | |
99 | grep PLD/Linux sh.h || exit 1 | |
bbdaf468 | 100 | |
9b0c41bb JR |
101 | # we'll need this later due to -DMKSH_GCC55009 |
102 | cat >rtchecks <<'EOF' | |
103 | typeset -i sari=0 | |
104 | typeset -Ui uari=0 | |
105 | typeset -i x=0 | |
106 | print -r -- $((x++)):$sari=$uari. | |
107 | let --sari --uari | |
108 | print -r -- $((x++)):$sari=$uari. | |
109 | sari=2147483647 uari=2147483647 | |
110 | print -r -- $((x++)):$sari=$uari. | |
111 | let ++sari ++uari | |
112 | print -r -- $((x++)):$sari=$uari. | |
113 | let --sari --uari | |
114 | let 'sari *= 2' 'uari *= 2' | |
115 | let ++sari ++uari | |
116 | print -r -- $((x++)):$sari=$uari. | |
117 | let ++sari ++uari | |
118 | print -r -- $((x++)):$sari=$uari. | |
119 | sari=-2147483648 uari=-2147483648 | |
120 | print -r -- $((x++)):$sari=$uari. | |
121 | let --sari --uari | |
122 | print -r -- $((x++)):$sari=$uari. | |
123 | EOF | |
124 | ||
125 | cat >rtchecks.expected <<'EOF' | |
126 | 0:0=0. | |
127 | 1:-1=4294967295. | |
128 | 2:2147483647=2147483647. | |
129 | 3:-2147483648=2147483648. | |
130 | 4:-1=4294967295. | |
131 | 5:0=0. | |
132 | 6:-2147483648=2147483648. | |
133 | 7:2147483647=2147483647. | |
134 | EOF | |
135 | ||
5cba9227 | 136 | %build |
d979d194 AM |
137 | install -d out |
138 | ||
139 | CC="%{__cc}" \ | |
9b0c41bb | 140 | CFLAGS="%{rpmcflags} -DMKSH_GCC55009" \ |
d979d194 | 141 | LDFLAGS="%{rpmldflags}" \ |
eec2ce74 | 142 | CPPFLAGS="%{rpmcppflags}" \ |
a06946c0 | 143 | sh ./Build.sh -Q -r -j -c lto |
abf806a4 | 144 | |
1281d680 AM |
145 | # skip some tests if not on terminal |
146 | if ! tty -s; then | |
e14f3193 | 147 | skip_tests="-C regress:no-ctty" |
1281d680 AM |
148 | fi |
149 | ||
9b0c41bb JR |
150 | %if %{with tests} |
151 | ./mksh rtchecks >rtchecks.got 2>&1 | |
152 | if ! cmp --quiet rtchecks.got rtchecks.expected ; then | |
153 | echo "rtchecks failed" | |
154 | diff -Naurp %{SOURCE3} rtchecks.got | |
155 | exit 1 | |
156 | fi | |
157 | ./test.sh -v $skip_tests | |
158 | %endif | |
d979d194 AM |
159 | mv mksh out/mksh.dynamic |
160 | ||
161 | %if %{with static} | |
162 | CC="%{__cc}" \ | |
9b0c41bb | 163 | CFLAGS="%{rpmcflags} -DMKSH_GCC55009" \ |
d979d194 | 164 | LDFLAGS="%{rpmldflags} -static" \ |
eec2ce74 | 165 | CPPFLAGS="%{rpmcppflags}" \ |
a06946c0 | 166 | sh ./Build.sh -Q -r -j -c lto |
d979d194 | 167 | |
9b0c41bb JR |
168 | %if %{with tests} |
169 | ./test.sh -v $skip_tests | |
170 | ./mksh rtchecks >rtchecks.got 2>&1 | |
171 | if ! cmp --quiet rtchecks.got rtchecks.expected ; then | |
172 | echo "rtchecks failed" | |
173 | diff -Naurp %{SOURCE3} rtchecks.got | |
174 | exit 1 | |
175 | fi | |
176 | %endif | |
d979d194 AM |
177 | mv mksh out/mksh.static |
178 | %endif | |
179 | ||
5cba9227 | 180 | %install |
181 | rm -rf $RPM_BUILD_ROOT | |
64114d19 | 182 | install -d $RPM_BUILD_ROOT{%{_bindir},%{_mandir}/man1} |
d979d194 AM |
183 | install -p out/mksh.dynamic $RPM_BUILD_ROOT%{_bindir}/mksh |
184 | %{?with_static:install -p out/mksh.static $RPM_BUILD_ROOT%{_bindir}/mksh.static} | |
185 | ||
64114d19 | 186 | cp -a mksh.1 $RPM_BUILD_ROOT%{_mandir}/man1/mksh.1 |
d979d194 AM |
187 | echo ".so mksh.1" > $RPM_BUILD_ROOT%{_mandir}/man1/sh.1 |
188 | ||
bbdaf468 | 189 | install -D %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/mkshrc |
d76a7e70 | 190 | ln -sf mksh $RPM_BUILD_ROOT%{_bindir}/sh |
5cba9227 | 191 | |
53554a18 AM |
192 | # some pdksh scripts used that |
193 | ln -sf mksh $RPM_BUILD_ROOT%{_bindir}/ksh | |
194 | ||
5cba9227 | 195 | %clean |
196 | rm -rf $RPM_BUILD_ROOT | |
197 | ||
b4c63cbb AM |
198 | %post -p %add_etc_shells -p /bin/sh /bin/ksh /bin/mksh |
199 | %preun -p %remove_etc_shells -p /bin/sh /bin/ksh /bin/mksh | |
200 | ||
6bf9e2cc | 201 | %posttrans -p %add_etc_shells -p /bin/sh /bin/ksh /bin/mksh |
53bc9e9e | 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 | |
206 | %files | |
207 | %defattr(644,root,root,755) | |
208 | %doc dot.mkshrc | |
bbdaf468 | 209 | %config(noreplace,missingok) %verify(not md5 mtime size) %{_sysconfdir}/mkshrc |
5cba9227 | 210 | %attr(755,root,root) %{_bindir}/mksh |
53554a18 | 211 | %attr(755,root,root) %{_bindir}/ksh |
7a5709f6 | 212 | %attr(755,root,root) %{_bindir}/sh |
64114d19 | 213 | %{_mandir}/man1/mksh.1* |
d979d194 AM |
214 | %{_mandir}/man1/sh.1* |
215 | ||
216 | %if %{with static} | |
217 | %files static | |
218 | %defattr(644,root,root,755) | |
219 | %attr(755,root,root) %{_bindir}/mksh.static | |
220 | %endif |