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