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