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