]> git.pld-linux.org Git - packages/mksh.git/blame - mksh.spec
- up to 45
[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
5#
d979d194 6#
5cba9227 7Summary: MirBSD Korn Shell
246a15d9 8Summary(pl.UTF-8): Powłoka Korna z MirBSD
5cba9227 9Name: mksh
83f423ee 10Version: 45
cdde4aae 11Release: 1
5cba9227 12License: BSD
13Group: Applications/Shells
9b0c41bb 14Source0: http://www.mirbsd.org/MirOS/dist/mir/mksh/%{name}-R%{version}.tgz
83f423ee 15# Source0-md5: d3d90973119ae689d5300b690600e1dc
bbdaf468
KK
16Source1: %{name}-mkshrc
17Patch0: %{name}-mkshrc_support.patch
118a1201 18Patch1: %{name}-circumflex.patch
d4eb7072 19Patch2: %{name}-no_stop_alias.patch
90672aa5 20Patch3: %{name}-cmdline-length.patch
15b50001
KK
21URL: https://www.mirbsd.org/mksh.htm
22%if %{with tests}
23BuildRequires: ed
24BuildRequires: perl-base
25%endif
d979d194 26%{?with_static:BuildRequires: glibc-static}
64114d19 27BuildRequires: rpmbuild(macros) >= 1.462
d979d194
AM
28# is needed for /etc directory existence
29Requires(pre): FHS
30Requires: setup >= 2.4.6-2
31Obsoletes: pdksh
5cba9227 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
246a15d9 38(pdksh), a Bourne-compatible shell which is largely similar to the
5cba9227 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
5110d1d3 42emacs command line editing mode; corresponds to OpenBSD 4.2-current
5cba9227 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
246a15d9
JB
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
d979d194
AM
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
7a5709f6 79W tym pakiecie jest mksh skonsolidowany statycznie.
d979d194 80
5cba9227 81%prep
5110d1d3 82%setup -qcT
5cba9227 83gzip -dc %{SOURCE0} | cpio -mid
64114d19 84mv mksh/* .; rmdir mksh
5cba9227 85
bbdaf468 86%patch0 -p0
118a1201 87%patch1 -p1
d4eb7072 88%patch2 -p1
53554a18 89%patch3 -p1
a56c2c0a 90
90672aa5
AM
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
e38ec2b8 96sed -i -e 's#@DISTRO@#PLD/Linux 3.0#g' check.t sh.h
90672aa5
AM
97# sanity checks
98grep PLD/Linux check.t || exit 1
99grep PLD/Linux sh.h || exit 1
bbdaf468 100
9b0c41bb
JR
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
5cba9227 136%build
d979d194
AM
137install -d out
138
139CC="%{__cc}" \
9b0c41bb 140CFLAGS="%{rpmcflags} -DMKSH_GCC55009" \
d979d194 141LDFLAGS="%{rpmldflags}" \
eec2ce74 142CPPFLAGS="%{rpmcppflags}" \
a06946c0 143sh ./Build.sh -Q -r -j -c lto
abf806a4 144
1281d680
AM
145# skip some tests if not on terminal
146if ! tty -s; then
e14f3193 147 skip_tests="-C regress:no-ctty"
1281d680
AM
148fi
149
9b0c41bb
JR
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
d979d194
AM
159mv mksh out/mksh.dynamic
160
161%if %{with static}
162CC="%{__cc}" \
9b0c41bb 163CFLAGS="%{rpmcflags} -DMKSH_GCC55009" \
d979d194 164LDFLAGS="%{rpmldflags} -static" \
eec2ce74 165CPPFLAGS="%{rpmcppflags}" \
a06946c0 166sh ./Build.sh -Q -r -j -c lto
d979d194 167
9b0c41bb
JR
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
d979d194
AM
177mv mksh out/mksh.static
178%endif
179
5cba9227 180%install
181rm -rf $RPM_BUILD_ROOT
64114d19 182install -d $RPM_BUILD_ROOT{%{_bindir},%{_mandir}/man1}
d979d194
AM
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
64114d19 186cp -a mksh.1 $RPM_BUILD_ROOT%{_mandir}/man1/mksh.1
d979d194
AM
187echo ".so mksh.1" > $RPM_BUILD_ROOT%{_mandir}/man1/sh.1
188
bbdaf468 189install -D %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/mkshrc
d76a7e70 190ln -sf mksh $RPM_BUILD_ROOT%{_bindir}/sh
5cba9227 191
53554a18
AM
192# some pdksh scripts used that
193ln -sf mksh $RPM_BUILD_ROOT%{_bindir}/ksh
194
5cba9227 195%clean
196rm -rf $RPM_BUILD_ROOT
197
b4c63cbb
AM
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
5cba9227 202
53bc9e9e 203
de8a6e5f
JB
204%post static -p %add_etc_shells -p /bin/mksh.static
205%preun static -p %remove_etc_shells -p /bin/mksh.static
5cba9227 206
207%files
208%defattr(644,root,root,755)
209%doc dot.mkshrc
bbdaf468 210%config(noreplace,missingok) %verify(not md5 mtime size) %{_sysconfdir}/mkshrc
5cba9227 211%attr(755,root,root) %{_bindir}/mksh
53554a18 212%attr(755,root,root) %{_bindir}/ksh
7a5709f6 213%attr(755,root,root) %{_bindir}/sh
64114d19 214%{_mandir}/man1/mksh.1*
d979d194
AM
215%{_mandir}/man1/sh.1*
216
217%if %{with static}
218%files static
219%defattr(644,root,root,755)
220%attr(755,root,root) %{_bindir}/mksh.static
221%endif
This page took 0.133365 seconds and 4 git commands to generate.