]> git.pld-linux.org Git - packages/mksh.git/blame - mksh.spec
- up to 42b
[packages/mksh.git] / mksh.spec
CommitLineData
d979d194 1%bcond_without static
abf806a4 2%bcond_without tests
d979d194 3#
5cba9227 4Summary: MirBSD Korn Shell
246a15d9 5Summary(pl.UTF-8): Powłoka Korna z MirBSD
5cba9227 6Name: mksh
90672aa5 7Version: 42b
cdde4aae 8Release: 1
5cba9227 9License: BSD
10Group: Applications/Shells
9b0c41bb 11Source0: http://www.mirbsd.org/MirOS/dist/mir/mksh/%{name}-R%{version}.tgz
90672aa5 12# Source0-md5: 8b4b9182eb63b47390f164246959b661
bbdaf468
KK
13Source1: %{name}-mkshrc
14Patch0: %{name}-mkshrc_support.patch
118a1201 15Patch1: %{name}-circumflex.patch
d4eb7072 16Patch2: %{name}-no_stop_alias.patch
90672aa5 17Patch3: %{name}-cmdline-length.patch
15b50001
KK
18URL: https://www.mirbsd.org/mksh.htm
19%if %{with tests}
20BuildRequires: ed
21BuildRequires: perl-base
22%endif
d979d194 23%{?with_static:BuildRequires: glibc-static}
64114d19 24BuildRequires: rpmbuild(macros) >= 1.462
d979d194
AM
25# is needed for /etc directory existence
26Requires(pre): FHS
27Requires: setup >= 2.4.6-2
28Obsoletes: pdksh
5cba9227 29BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
30
31%define _bindir /bin
32
33%description
34mksh is the MirBSD enhanced version of the Public Domain Korn shell
246a15d9 35(pdksh), a Bourne-compatible shell which is largely similar to the
5cba9227 36original AT&T Korn shell. It includes bug fixes and feature
37improvements in order to produce a modern, robust shell good for
38interactive and especially script use. It has UTF-8 support in the
5110d1d3 39emacs command line editing mode; corresponds to OpenBSD 4.2-current
5cba9227 40ksh sans GNU bash-like $PS1; the build environment requirements are
41autoconfigured; throughout code simplification/bugfix/enhancement has
42been done, and the shell has extended compatibility to other modern
43shells.
44
246a15d9
JB
45%description -l pl.UTF-8
46mksh to pochodząca z MirBSD rozszerzona wersja powłoki Public Domain
47Korn Shell (pdksh) - kompatybilnej z powłoką Bourne'a, w większości
48zbliżonej do oryginalnej powłoki Korna z AT&T. Zawiera poprawki błędów
49i rozszerzenia mające na celu stworzenie współczesnej powłoki o
50bogatych możliwościach do użytku interaktywnego i (zwłaszcza) w
51skryptach. Ma obsługę UTF-8 w trybie edycji linii poleceń w stylu
52emacsa; $PS1 odpowiada temu z ksh obecnym w OpenBSD 4.2-current;
53środowisko budowania jest automatycznie konfigurowane; dzięki
54wykonanym uproszczeniom kodu, poprawkom i rozszerzeniom powłoka ma
55rozszerzoną kompatybilność z innymi współczesnymi powłokami.
56
d979d194
AM
57%package static
58Summary: Statically linked the MirBSD enhanced version of pdksh
59Summary(pl.UTF-8): Skonsolidowana statycznie powłoka mksh
60Group: Applications/Shells
61# requires base for /etc/mkshrc?
62Requires: %{name} = %{version}-%{release}
63
64%description static
65mksh is the MirBSD enhanced version of the Public Domain Korn shell
66(pdksh), a Bourne-compatible shell which is largely similar to the
67original AT&T Korn shell.
68
69This packege contains statically linked version of mksh.
70
71%description static -l pl.UTF-8
72mksh to pochodząca z MirBSD rozszerzona wersja powłoki Public Domain
73Korn Shell (pdksh) - kompatybilnej z powłoką Bourne'a, w większości
74zbliżonej do oryginalnej powłoki Korna z AT&T.
75
7a5709f6 76W tym pakiecie jest mksh skonsolidowany statycznie.
d979d194 77
5cba9227 78%prep
5110d1d3 79%setup -qcT
5cba9227 80gzip -dc %{SOURCE0} | cpio -mid
64114d19 81mv mksh/* .; rmdir mksh
5cba9227 82
bbdaf468 83%patch0 -p0
118a1201 84%patch1 -p1
d4eb7072 85%patch2 -p1
53554a18 86%patch3 -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}" \
9b0c41bb 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"
151 diff -Naurp %{SOURCE3} rtchecks.got
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}" \
9b0c41bb 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
198%posttrans -p %add_etc_shells -p /bin/sh /bin/ksh
5cba9227 199
53bc9e9e 200
d979d194
AM
201%post static -p %add_etc_shells -p /bin/mksh.static
202%preun static -p %remove_etc_shells -p /bin/mksh.static
5cba9227 203
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.090203 seconds and 4 git commands to generate.