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