]> git.pld-linux.org Git - packages/mksh.git/blob - mksh.spec
- updated to 41
[packages/mksh.git] / mksh.spec
1 %bcond_without  static
2 %bcond_without  tests
3 #
4 Summary:        MirBSD Korn Shell
5 Summary(pl.UTF-8):      Powłoka Korna z MirBSD
6 Name:           mksh
7 Version:        41
8 Release:        1
9 License:        BSD
10 Group:          Applications/Shells
11 Source0:        http://www.mirbsd.org/MirOS/dist/mir/mksh/%{name}-R%{version}.tgz
12 # Source0-md5:  70eca50d9340412714ef09b7060ebde9
13 Source1:        %{name}-mkshrc
14 Patch0:         %{name}-mkshrc_support.patch
15 Patch1:         %{name}-circumflex.patch
16 Patch2:         %{name}-no_stop_alias.patch
17 Patch3:         %{name}-distro.patch
18 Patch4:         %{name}-cmdline-length.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.462
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 -qcT
81 gzip -dc %{SOURCE0} | cpio -mid
82 mv mksh/* .; rmdir mksh
83
84 %patch0 -p0
85 %patch1 -p1
86 %patch2 -p1
87 %patch3 -p1
88 %patch4 -p1
89
90 sed -i -e 's#@DISTRO@#PLD/Linux 3.0#g' check.t sh.h
91
92 # we'll need this later due to -DMKSH_GCC55009
93 cat >rtchecks <<'EOF'
94 typeset -i sari=0
95 typeset -Ui uari=0
96 typeset -i x=0
97 print -r -- $((x++)):$sari=$uari.
98 let --sari --uari
99 print -r -- $((x++)):$sari=$uari.
100 sari=2147483647 uari=2147483647
101 print -r -- $((x++)):$sari=$uari.
102 let ++sari ++uari
103 print -r -- $((x++)):$sari=$uari.
104 let --sari --uari
105 let 'sari *= 2' 'uari *= 2'
106 let ++sari ++uari
107 print -r -- $((x++)):$sari=$uari.
108 let ++sari ++uari
109 print -r -- $((x++)):$sari=$uari.
110 sari=-2147483648 uari=-2147483648
111 print -r -- $((x++)):$sari=$uari.
112 let --sari --uari
113 print -r -- $((x++)):$sari=$uari.
114 EOF
115
116 cat >rtchecks.expected <<'EOF'
117 0:0=0.
118 1:-1=4294967295.
119 2:2147483647=2147483647.
120 3:-2147483648=2147483648.
121 4:-1=4294967295.
122 5:0=0.
123 6:-2147483648=2147483648.
124 7:2147483647=2147483647.
125 EOF
126
127 %build
128 install -d out
129
130 CC="%{__cc}" \
131 CFLAGS="%{rpmcflags} -DMKSH_GCC55009" \
132 LDFLAGS="%{rpmldflags}" \
133 CPPFLAGS="%{rpmcppflags}" \
134 sh ./Build.sh -Q -r -j -c lto
135
136 # skip some tests if not on terminal
137 if ! tty -s; then
138         skip_tests="-C regress:no-ctty"
139 fi
140
141 %if %{with tests}
142 ./mksh rtchecks >rtchecks.got 2>&1
143 if ! cmp --quiet rtchecks.got rtchecks.expected ; then
144         echo "rtchecks failed"
145         diff -Naurp %{SOURCE3} rtchecks.got
146         exit 1
147 fi
148 ./test.sh -v $skip_tests
149 %endif
150 mv mksh out/mksh.dynamic
151
152 %if %{with static}
153 CC="%{__cc}" \
154 CFLAGS="%{rpmcflags} -DMKSH_GCC55009" \
155 LDFLAGS="%{rpmldflags} -static" \
156 CPPFLAGS="%{rpmcppflags}" \
157 sh ./Build.sh -Q -r -j -c lto
158
159 %if %{with tests}
160 ./test.sh -v $skip_tests
161 ./mksh rtchecks >rtchecks.got 2>&1
162 if ! cmp --quiet rtchecks.got rtchecks.expected ; then
163         echo "rtchecks failed"
164         diff -Naurp %{SOURCE3} rtchecks.got
165         exit 1
166 fi
167 %endif
168 mv mksh out/mksh.static
169 %endif
170
171 %install
172 rm -rf $RPM_BUILD_ROOT
173 install -d $RPM_BUILD_ROOT{%{_bindir},%{_mandir}/man1}
174 install -p out/mksh.dynamic $RPM_BUILD_ROOT%{_bindir}/mksh
175 %{?with_static:install -p out/mksh.static $RPM_BUILD_ROOT%{_bindir}/mksh.static}
176
177 cp -a mksh.1 $RPM_BUILD_ROOT%{_mandir}/man1/mksh.1
178 echo ".so mksh.1" > $RPM_BUILD_ROOT%{_mandir}/man1/sh.1
179
180 install -D %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/mkshrc
181 ln -sf mksh $RPM_BUILD_ROOT%{_bindir}/sh
182
183 # some pdksh scripts used that
184 ln -sf mksh $RPM_BUILD_ROOT%{_bindir}/ksh
185
186 %clean
187 rm -rf $RPM_BUILD_ROOT
188
189 %post   -p %add_etc_shells -p /bin/sh /bin/ksh /bin/mksh
190 %preun  -p %remove_etc_shells -p /bin/sh /bin/ksh /bin/mksh
191
192 %posttrans -p %add_etc_shells -p /bin/sh /bin/ksh
193
194
195 %post static -p %add_etc_shells -p /bin/mksh.static
196 %preun static -p %remove_etc_shells -p /bin/mksh.static
197
198 %files
199 %defattr(644,root,root,755)
200 %doc dot.mkshrc
201 %config(noreplace,missingok) %verify(not md5 mtime size) %{_sysconfdir}/mkshrc
202 %attr(755,root,root) %{_bindir}/mksh
203 %attr(755,root,root) %{_bindir}/ksh
204 %attr(755,root,root) %{_bindir}/sh
205 %{_mandir}/man1/mksh.1*
206 %{_mandir}/man1/sh.1*
207
208 %if %{with static}
209 %files static
210 %defattr(644,root,root,755)
211 %attr(755,root,root) %{_bindir}/mksh.static
212 %endif
This page took 0.069417 seconds and 4 git commands to generate.