resetting manifest requested domain to floor
[platform/upstream/bash.git] / packaging / bash.spec
1 Name:           bash
2 Version:        4.2
3 Release:        1
4 License:        GPL-3.0+
5 Summary:        The GNU Bourne Again shell
6 Url:            http://www.gnu.org/software/bash
7 Group:          Base/Tools
8 Source0:        ftp://ftp.gnu.org/gnu/bash/%{name}-%{version}.tar.gz
9 Source1:        dot.bashrc
10 Source2:        dot.profile
11 Source1001:     bash.manifest
12 BuildRequires:  autoconf
13 BuildRequires:  bison
14 Provides:       /bin/bash
15 Provides:       /bin/sh
16
17 %description
18 The GNU Bourne Again shell (Bash) is a shell or command language
19 interpreter that is compatible with the Bourne shell (sh). Bash
20 incorporates useful features from the Korn shell (ksh) and the C shell
21 (csh). Most sh scripts can be run by bash without modification.
22
23
24 %prep
25 %setup -q
26 cp %{SOURCE1001} .
27
28 %build
29 %configure --enable-largefile \
30             --without-bash-malloc \
31             --disable-nls \
32             --enable-alias \
33             --enable-readline  \
34             --enable-history
35
36 # Recycles pids is neccessary. When bash's last fork's pid was X
37 # and new fork's pid is also X, bash has to wait for this same pid.
38 # Without Recycles pids bash will not wait.
39 make "CPPFLAGS=-D_GNU_SOURCE -DDEFAULT_PATH_VALUE='\"/usr/local/bin:/usr/bin\"' -DRECYCLES_PIDS `getconf LFS_CFLAGS`"
40 %check
41 make check
42
43 %install
44 %make_install
45
46 mkdir -p %{buildroot}/etc/bash_completion.d
47
48 #mkdir -p %{buildroot}/%{_bindir}
49 #mv %{buildroot}/bin/* %{buildroot}/%{_bindir}/
50
51 # make manpages for bash builtins as per suggestion in DOC/README
52 pushd doc
53 sed -e '
54 /^\.SH NAME/, /\\- bash built-in commands, see \\fBbash\\fR(1)$/{
55 /^\.SH NAME/d
56 s/^bash, //
57 s/\\- bash built-in commands, see \\fBbash\\fR(1)$//
58 s/,//g
59 b
60 }
61 d
62 ' builtins.1 > man.pages
63 for i in echo pwd test kill; do
64   perl -pi -e "s,$i,,g" man.pages
65   perl -pi -e "s,  , ,g" man.pages
66 done
67
68 install -c -m 644 builtins.1 %{buildroot}%{_mandir}/man1/builtins.1
69
70 for i in `cat man.pages` ; do
71   echo .so man1/builtins.1 > %{buildroot}%{_mandir}/man1/$i.1
72   chmod 0644 %{buildroot}%{_mandir}/man1/$i.1
73 done
74 popd
75
76 # Link bash man page to sh so that man sh works.
77 ln -s bash.1 %{buildroot}%{_mandir}/man1/sh.1
78
79 # Not for printf, true and false (conflict with coreutils)
80 rm -f %{buildroot}/%{_mandir}/man1/printf.1
81 rm -f %{buildroot}/%{_mandir}/man1/true.1
82 rm -f %{buildroot}/%{_mandir}/man1/false.1
83
84 pushd %{buildroot}
85 ln -sf bash ./usr/bin/sh
86 rm -f .%{_infodir}/dir
87 popd
88 mkdir -p %{buildroot}%{_sysconfdir}/skel
89 install -c -m644 %{SOURCE1} %{buildroot}%{_sysconfdir}/skel/.bashrc
90 install -c -m644 %{SOURCE2} %{buildroot}%{_sysconfdir}/skel/.bash_profile
91 LONG_BIT=$(getconf LONG_BIT)
92 mv %{buildroot}%{_bindir}/bashbug \
93    %{buildroot}%{_bindir}/bashbug-"${LONG_BIT}"
94
95 # Fix missing sh-bangs in example scripts (bug #225609).
96 for script in \
97   examples/scripts/krand.bash \
98   examples/scripts/bcsh.sh \
99   examples/scripts/precedence \
100   examples/scripts/shprompt
101 do
102   cp "$script" "$script"-orig
103   echo '#!/bin/bash' > "$script"
104   cat "$script"-orig >> "$script"
105   rm -f "$script"-orig
106 done
107
108 rm -rf %{buildroot}%{_bindir}/bashbug-*
109 chmod a-x doc/*.sh
110
111 %docs_package
112
113 %post -p <lua>
114 bashfound = false;
115 shfound = false;
116
117 f = io.open("/etc/shells", "r");
118 if f == nil
119 then
120   f = io.open("/etc/shells", "w");
121 else
122   repeat
123     t = f:read();
124     if t == "/bin/bash"
125     then
126       bashfound = true;
127     end
128     if t == "/bin/sh"
129     then
130       shfound = true;
131     end
132   until t == nil;
133 end
134 f:close()
135
136 f = io.open("/etc/shells", "a");
137 if not bashfound
138 then
139   f:write("/bin/bash\n")
140 end
141 if not shfound
142 then
143   f:write("/bin/sh\n")
144 end
145 f:close()
146
147 %postun
148 if [ "$1" = 0 ]; then
149     /bin/grep -v '^/bin/bash$' < /etc/shells | \
150       /bin/grep -v '^/bin/sh$' > /etc/shells.new
151     /bin/mv /etc/shells.new /etc/shells
152 fi
153
154
155
156 %files
157 %manifest %{name}.manifest
158 %license COPYING
159 %{_bindir}/sh
160 %{_bindir}/bash
161 %{_sysconfdir}/skel
162 %dir %{_sysconfdir}/bash_completion.d
163