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