migration from private to rsa
[external/bash.git] / packaging / bash.spec
1 Version: 4.1
2 Name: bash
3 Summary: The GNU Bourne Again shell
4 Release: 1
5 Group: System/Shells
6 License: GPLv2+
7 Url: http://www.gnu.org/software/bash
8 Source0: ftp://ftp.gnu.org/gnu/bash/%{name}-%{version}.tar.gz
9
10 # SLP patches
11 Patch0: bash41-001.patch
12 Patch1: bash41-002.patch
13 Patch2: bash41-003.patch
14 Patch3: bash41-004.patch
15 Patch4: bash41-005.patch
16 Patch5: deb-bash-config.patch
17 Patch6: privmode.patch
18 Patch7: bash-default-editor.patch
19 Patch8: bash-subst-param-length.patch
20 Patch9: pgrp-pipe.patch
21 Patch10: input-err.patch
22 Patch11: bash-aliases-repeat.patch
23 Patch12: builtins-declare-fix.patch
24
25 BuildRequires: bison
26 BuildRequires: autoconf
27
28 %description
29 The GNU Bourne Again shell (Bash) is a shell or command language
30 interpreter that is compatible with the Bourne shell (sh). Bash
31 incorporates useful features from the Korn shell (ksh) and the C shell
32 (csh). Most sh scripts can be run by bash without modification.
33
34 %package doc
35 Summary: Documentation files for %{name}
36 Group: Development/Languages
37 Requires: %{name} = %{version}-%{release}
38
39 %description doc
40 This package contains documentation files for %{name}.
41
42 %define pkgdocdir %{_datadir}/doc/%{name}-%{version}
43
44 %prep
45 %setup -q
46
47 %patch0 -p1 -b .bash41-001
48 %patch1 -p1 -b .bash41-002
49 %patch2 -p1 -b .bash41-003
50 %patch3 -p1 -b .bash41-004
51 %patch4 -p1 -b .bash41-005
52 %patch5 -p1 -b .deb-bash-config
53 %patch6 -p1 -b .privmode
54 %patch7 -p1 -b .bash-default-editor
55 %patch8 -p0 -b .bash-subst-param-length
56 %patch9 -p0 -b .pgrp-pipe
57 %patch10 -p0 -b .input-err
58 %patch11 -p0 -b .bash-aliases-repeat
59 %patch12 -p1 -b .builtins-declare-fix
60
61 %build
62 autoconf
63 %configure --enable-largefile --without-bash-malloc --disable-nls
64
65 # Recycles pids is neccessary. When bash's last fork's pid was X
66 # and new fork's pid is also X, bash has to wait for this same pid.
67 # Without Recycles pids bash will not wait.
68 make "CPPFLAGS=-D_GNU_SOURCE -DRECYCLES_PIDS `getconf LFS_CFLAGS`"
69 %check
70 make check
71
72 %install
73 rm -rf $RPM_BUILD_ROOT
74
75 if [ -e autoconf ]; then
76   # Yuck. We're using autoconf 2.1x.
77   export PATH=.:$PATH
78 fi
79
80 # Fix bug #83776
81 perl -pi -e 's,bashref\.info,bash.info,' doc/bashref.info
82
83 make DESTDIR=$RPM_BUILD_ROOT install
84
85 mkdir -p $RPM_BUILD_ROOT/etc
86
87 # make manpages for bash builtins as per suggestion in DOC/README
88 pushd doc
89 sed -e '
90 /^\.SH NAME/, /\\- bash built-in commands, see \\fBbash\\fR(1)$/{
91 /^\.SH NAME/d
92 s/^bash, //
93 s/\\- bash built-in commands, see \\fBbash\\fR(1)$//
94 s/,//g
95 b
96 }
97 d
98 ' builtins.1 > man.pages
99 for i in echo pwd test kill; do
100   perl -pi -e "s,$i,,g" man.pages
101   perl -pi -e "s,  , ,g" man.pages
102 done
103
104 install -c -m 644 builtins.1 ${RPM_BUILD_ROOT}%{_mandir}/man1/builtins.1
105
106 for i in `cat man.pages` ; do
107   echo .so man1/builtins.1 > ${RPM_BUILD_ROOT}%{_mandir}/man1/$i.1
108   chmod 0644 ${RPM_BUILD_ROOT}%{_mandir}/man1/$i.1
109 done
110 popd
111
112 # Link bash man page to sh so that man sh works.
113 ln -s bash.1 ${RPM_BUILD_ROOT}%{_mandir}/man1/sh.1
114
115 # Not for printf, true and false (conflict with coreutils)
116 rm -f $RPM_BUILD_ROOT/%{_mandir}/man1/printf.1
117 rm -f $RPM_BUILD_ROOT/%{_mandir}/man1/true.1
118 rm -f $RPM_BUILD_ROOT/%{_mandir}/man1/false.1
119
120 pushd $RPM_BUILD_ROOT
121 mkdir ./bin
122 mv ./usr/bin/bash ./bin
123 ln -sf bash ./bin/sh
124 rm -f .%{_infodir}/dir
125 popd
126 mkdir -p $RPM_BUILD_ROOT/etc/skel
127 #install -c -m644 %SOURCE1 $RPM_BUILD_ROOT/etc/skel/.bashrc
128 #install -c -m644 %SOURCE2 $RPM_BUILD_ROOT/etc/skel/.bash_profile
129 #install -c -m644 %SOURCE3 $RPM_BUILD_ROOT/etc/skel/.bash_logout
130 LONG_BIT=$(getconf LONG_BIT)
131 mv $RPM_BUILD_ROOT%{_bindir}/bashbug \
132    $RPM_BUILD_ROOT%{_bindir}/bashbug-"${LONG_BIT}"
133
134 # Fix missing sh-bangs in example scripts (bug #225609).
135 for script in \
136   examples/scripts/krand.bash \
137   examples/scripts/bcsh.sh \
138   examples/scripts/precedence \
139   examples/scripts/shprompt
140 do
141   cp "$script" "$script"-orig
142   echo '#!/bin/bash' > "$script"
143   cat "$script"-orig >> "$script"
144   rm -f "$script"-orig
145 done
146
147 rm -rf %{buildroot}%{_bindir}/bashbug-*
148 chmod a-x doc/*.sh
149
150 %clean
151 rm -rf $RPM_BUILD_ROOT
152
153 # ***** bash doesn't use install-info. It's always listed in %{_infodir}/dir
154 # to prevent prereq loops
155
156 # post is in lua so that we can run it without any external deps.  Helps
157 # for bootstrapping a new install.
158 # Jesse Keating 2009-01-29 (code from Ignacio Vazquez-Abrams)
159 %post -p <lua>
160 bashfound = false;
161 shfound = false;
162  
163 f = io.open("/etc/shells", "r");
164 if f == nil
165 then
166   f = io.open("/etc/shells", "w");
167 else
168   repeat
169     t = f:read();
170     if t == "/bin/bash"
171     then
172       bashfound = true;
173     end
174     if t == "/bin/sh"
175     then
176       shfound = true;
177     end
178   until t == nil;
179 end
180 f:close()
181  
182 f = io.open("/etc/shells", "a");
183 if not bashfound
184 then
185   f:write("/bin/bash\n")
186 end
187 if not shfound
188 then
189   f:write("/bin/sh\n")
190 end
191 f:close()
192
193 %postun
194 if [ "$1" = 0 ]; then
195     /bin/grep -v '^/bin/bash$' < /etc/shells | \
196       /bin/grep -v '^/bin/sh$' > /etc/shells.new
197     /bin/mv /etc/shells.new /etc/shells
198 fi
199
200
201 %docs_package
202
203 %files 
204 /bin/sh
205 /bin/bash
206