]>
Commit | Line | Data |
---|---|---|
1 | # | |
2 | # Conditional build: | |
3 | %bcond_without static # static version of mksh | |
4 | %bcond_without tests # rtchecks and test.sh checks | |
5 | # | |
6 | # | |
7 | Summary: MirBSD Korn Shell | |
8 | Summary(pl.UTF-8): Powłoka Korna z MirBSD | |
9 | Name: mksh | |
10 | Version: 46 | |
11 | Release: 2 | |
12 | License: BSD | |
13 | Group: Applications/Shells | |
14 | Source0: http://www.mirbsd.org/MirOS/dist/mir/mksh/%{name}-R%{version}.tgz | |
15 | # Source0-md5: 77c108d8143a6e7670954d77517d216d | |
16 | Source1: %{name}-mkshrc | |
17 | Patch0: %{name}-mkshrc_support.patch | |
18 | Patch1: %{name}-circumflex.patch | |
19 | Patch2: %{name}-no_stop_alias.patch | |
20 | Patch3: %{name}-cmdline-length.patch | |
21 | URL: https://www.mirbsd.org/mksh.htm | |
22 | %if %{with tests} | |
23 | BuildRequires: ed | |
24 | BuildRequires: perl-base | |
25 | %endif | |
26 | %{?with_static:BuildRequires: glibc-static} | |
27 | BuildRequires: rpmbuild(macros) >= 1.462 | |
28 | # is needed for /etc directory existence | |
29 | Requires(pre): FHS | |
30 | Requires: setup >= 2.4.6-2 | |
31 | Obsoletes: pdksh | |
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 | |
38 | (pdksh), a Bourne-compatible shell which is largely similar to the | |
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 | |
42 | emacs command line editing mode; corresponds to OpenBSD 4.2-current | |
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 | ||
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 | ||
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 | ||
79 | W tym pakiecie jest mksh skonsolidowany statycznie. | |
80 | ||
81 | %prep | |
82 | %setup -qcT | |
83 | gzip -dc %{SOURCE0} | cpio -mid | |
84 | mv mksh/* .; rmdir mksh | |
85 | ||
86 | %patch0 -p0 | |
87 | %patch1 -p1 | |
88 | %patch2 -p1 | |
89 | %patch3 -p1 | |
90 | ||
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 | |
96 | sed -i -e 's#@DISTRO@#PLD/Linux 3.0#g' check.t sh.h | |
97 | # sanity checks | |
98 | grep PLD/Linux check.t || exit 1 | |
99 | grep PLD/Linux sh.h || exit 1 | |
100 | ||
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 | ||
136 | %build | |
137 | install -d out | |
138 | ||
139 | CC="%{__cc}" \ | |
140 | CFLAGS="%{rpmcflags} -DMKSH_GCC55009" \ | |
141 | LDFLAGS="%{rpmldflags}" \ | |
142 | CPPFLAGS="%{rpmcppflags}" \ | |
143 | sh ./Build.sh -Q -r -j -c lto | |
144 | ||
145 | # skip some tests if not on terminal | |
146 | if ! tty -s; then | |
147 | skip_tests="-C regress:no-ctty" | |
148 | fi | |
149 | ||
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 | |
159 | mv mksh out/mksh.dynamic | |
160 | ||
161 | %if %{with static} | |
162 | CC="%{__cc}" \ | |
163 | CFLAGS="%{rpmcflags} -DMKSH_GCC55009" \ | |
164 | LDFLAGS="%{rpmldflags} -static" \ | |
165 | CPPFLAGS="%{rpmcppflags}" \ | |
166 | sh ./Build.sh -Q -r -j -c lto | |
167 | ||
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 | |
177 | mv mksh out/mksh.static | |
178 | %endif | |
179 | ||
180 | %install | |
181 | rm -rf $RPM_BUILD_ROOT | |
182 | install -d $RPM_BUILD_ROOT{%{_bindir},%{_mandir}/man1} | |
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 | ||
186 | cp -a mksh.1 $RPM_BUILD_ROOT%{_mandir}/man1/mksh.1 | |
187 | echo ".so mksh.1" > $RPM_BUILD_ROOT%{_mandir}/man1/sh.1 | |
188 | ||
189 | install -D %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/mkshrc | |
190 | ln -sf mksh $RPM_BUILD_ROOT%{_bindir}/sh | |
191 | ||
192 | # some pdksh scripts used that | |
193 | ln -sf mksh $RPM_BUILD_ROOT%{_bindir}/ksh | |
194 | ||
195 | %clean | |
196 | rm -rf $RPM_BUILD_ROOT | |
197 | ||
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 | ||
201 | %posttrans -p %add_etc_shells -p /bin/sh /bin/ksh /bin/mksh | |
202 | ||
203 | %post static -p %add_etc_shells -p /bin/mksh.static | |
204 | %preun static -p %remove_etc_shells -p /bin/mksh.static | |
205 | ||
206 | %files | |
207 | %defattr(644,root,root,755) | |
208 | %doc dot.mkshrc | |
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* | |
215 | ||
216 | %if %{with static} | |
217 | %files static | |
218 | %defattr(644,root,root,755) | |
219 | %attr(755,root,root) %{_bindir}/mksh.static | |
220 | %endif |