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