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