]> git.pld-linux.org Git - packages/mksh.git/blame - mksh.spec
do pdksh migration via trigger
[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
f4608d8e 9Version: 47
1c7e5b2c 10Release: 2
5cba9227 11License: BSD
12Group: Applications/Shells
9b0c41bb 13Source0: http://www.mirbsd.org/MirOS/dist/mir/mksh/%{name}-R%{version}.tgz
f4608d8e 14# Source0-md5: 71c7cbcd78306897801b8b6691091e66
bbdaf468
KK
15Source1: %{name}-mkshrc
16Patch0: %{name}-mkshrc_support.patch
118a1201 17Patch1: %{name}-circumflex.patch
d4eb7072 18Patch2: %{name}-no_stop_alias.patch
90672aa5 19Patch3: %{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
5110d1d3 81%setup -qcT
5cba9227 82gzip -dc %{SOURCE0} | cpio -mid
64114d19 83mv mksh/* .; rmdir mksh
5cba9227 84
bbdaf468 85%patch0 -p0
118a1201 86%patch1 -p1
d4eb7072 87%patch2 -p1
53554a18 88%patch3 -p1
a56c2c0a 89
90672aa5
AM
90# sed rules instead of patch (needed update for every release)
91sed -i -e 's|\(#define.*MKSH_VERSION.*\)"|\1 @DISTRO@"|g' sh.h
92sed -i -e 's|\(@(#)MIRBSD KSH.*\)|\1 @DISTRO@|g' check.t
93
94# fill distro
e38ec2b8 95sed -i -e 's#@DISTRO@#PLD/Linux 3.0#g' check.t sh.h
90672aa5
AM
96# sanity checks
97grep PLD/Linux check.t || exit 1
98grep PLD/Linux sh.h || exit 1
bbdaf468 99
9b0c41bb
JR
100# we'll need this later due to -DMKSH_GCC55009
101cat >rtchecks <<'EOF'
102typeset -i sari=0
103typeset -Ui uari=0
104typeset -i x=0
105print -r -- $((x++)):$sari=$uari.
106let --sari --uari
107print -r -- $((x++)):$sari=$uari.
108sari=2147483647 uari=2147483647
109print -r -- $((x++)):$sari=$uari.
110let ++sari ++uari
111print -r -- $((x++)):$sari=$uari.
112let --sari --uari
113let 'sari *= 2' 'uari *= 2'
114let ++sari ++uari
115print -r -- $((x++)):$sari=$uari.
116let ++sari ++uari
117print -r -- $((x++)):$sari=$uari.
118sari=-2147483648 uari=-2147483648
119print -r -- $((x++)):$sari=$uari.
120let --sari --uari
121print -r -- $((x++)):$sari=$uari.
122EOF
123
124cat >rtchecks.expected <<'EOF'
1250:0=0.
1261:-1=4294967295.
1272:2147483647=2147483647.
1283:-2147483648=2147483648.
1294:-1=4294967295.
1305:0=0.
1316:-2147483648=2147483648.
1327:2147483647=2147483647.
133EOF
134
5cba9227 135%build
d979d194
AM
136install -d out
137
138CC="%{__cc}" \
9b0c41bb 139CFLAGS="%{rpmcflags} -DMKSH_GCC55009" \
d979d194 140LDFLAGS="%{rpmldflags}" \
eec2ce74 141CPPFLAGS="%{rpmcppflags}" \
a06946c0 142sh ./Build.sh -Q -r -j -c lto
abf806a4 143
1281d680
AM
144# skip some tests if not on terminal
145if ! tty -s; then
e14f3193 146 skip_tests="-C regress:no-ctty"
1281d680
AM
147fi
148
9b0c41bb
JR
149%if %{with tests}
150./mksh rtchecks >rtchecks.got 2>&1
151if ! cmp --quiet rtchecks.got rtchecks.expected ; then
152 echo "rtchecks failed"
f4608d8e 153 diff -Naurp rtchecks.expected rtchecks.got
9b0c41bb
JR
154 exit 1
155fi
156./test.sh -v $skip_tests
157%endif
d979d194
AM
158mv mksh out/mksh.dynamic
159
160%if %{with static}
161CC="%{__cc}" \
9b0c41bb 162CFLAGS="%{rpmcflags} -DMKSH_GCC55009" \
d979d194 163LDFLAGS="%{rpmldflags} -static" \
eec2ce74 164CPPFLAGS="%{rpmcppflags}" \
a06946c0 165sh ./Build.sh -Q -r -j -c lto
d979d194 166
9b0c41bb
JR
167%if %{with tests}
168./test.sh -v $skip_tests
169./mksh rtchecks >rtchecks.got 2>&1
170if ! cmp --quiet rtchecks.got rtchecks.expected ; then
171 echo "rtchecks failed"
172 diff -Naurp %{SOURCE3} rtchecks.got
173 exit 1
174fi
175%endif
d979d194
AM
176mv mksh out/mksh.static
177%endif
178
5cba9227 179%install
180rm -rf $RPM_BUILD_ROOT
64114d19 181install -d $RPM_BUILD_ROOT{%{_bindir},%{_mandir}/man1}
d979d194
AM
182install -p out/mksh.dynamic $RPM_BUILD_ROOT%{_bindir}/mksh
183%{?with_static:install -p out/mksh.static $RPM_BUILD_ROOT%{_bindir}/mksh.static}
184
64114d19 185cp -a mksh.1 $RPM_BUILD_ROOT%{_mandir}/man1/mksh.1
d979d194
AM
186echo ".so mksh.1" > $RPM_BUILD_ROOT%{_mandir}/man1/sh.1
187
bbdaf468 188install -D %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/mkshrc
d76a7e70 189ln -sf mksh $RPM_BUILD_ROOT%{_bindir}/sh
5cba9227 190
53554a18
AM
191# some pdksh scripts used that
192ln -sf mksh $RPM_BUILD_ROOT%{_bindir}/ksh
193
5cba9227 194%clean
195rm -rf $RPM_BUILD_ROOT
196
b4c63cbb
AM
197%post -p %add_etc_shells -p /bin/sh /bin/ksh /bin/mksh
198%preun -p %remove_etc_shells -p /bin/sh /bin/ksh /bin/mksh
199
de8a6e5f
JB
200%post static -p %add_etc_shells -p /bin/mksh.static
201%preun static -p %remove_etc_shells -p /bin/mksh.static
5cba9227 202
1c7e5b2c
ER
203%triggerpostun -p <lua> -- pdksh
204if arg[2] ~= 0 then
205%add_etc_shells /bin/sh /bin/ksh /bin/mksh
206end
207
5cba9227 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.074459 seconds and 4 git commands to generate.