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