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