tizen 2.0
[external/tizen-coreutils.git] / packaging / coreutils.spec
1 %define nopam 1
2
3 Summary: The GNU core utilities: a set of tools commonly used in shell scripts
4 Name:    coreutils
5 Version: 6.9
6 Release: 9
7 License: GPLv2+
8 Epoch: 1
9 Group:   System Environment/Base
10 Url:     http://www.gnu.org/software/coreutils/
11 Source0: ftp://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.bz2
12 Source1:  mktemp-1.5.tar.gz
13 Source101:  coreutils-DIR_COLORS
14 Source102:  coreutils-DIR_COLORS.xterm
15 Source105:  coreutils-colorls.sh
16 Source106:  coreutils-colorls.csh
17 Source200:  coreutils-su.pamd
18 Source202:  coreutils-su-l.pamd
19
20 # From upstream
21 Patch1: coreutils-futimens.patch
22 Patch2: coreutils-ls-x.patch
23 Patch3: coreutils-6.9-cp-i-u.patch
24
25 # Our patches
26 Patch100: coreutils-chgrp.patch
27
28 # sh-utils
29 Patch703: sh-utils-2.0.11-dateman.patch
30 Patch704: sh-utils-1.16-paths.patch
31 # RMS will never accept the PAM patch because it removes his historical
32 # rant about Twenex and the wheel group, so we'll continue to maintain
33 # it here indefinitely.
34 Patch706: coreutils-pam.patch
35 Patch713: coreutils-4.5.3-langinfo.patch
36 Patch715: coreutils-4.5.3-sysinfo.patch
37
38 # (sb) lin18nux/lsb compliance
39 Patch800: coreutils-i18n.patch
40
41 Patch900: coreutils-setsid.patch
42 Patch907: coreutils-5.2.1-runuser.patch
43 Patch908: coreutils-getgrouplist.patch
44 Patch912: coreutils-overflow.patch
45 Patch915: coreutils-split-pam.patch
46 Patch916: coreutils-getfacl-exit-code.patch
47
48 Patch1001: mktemp-1.5-build.patch
49
50 BuildRequires: libacl-devel
51 BuildRequires: bison
52 BuildRequires: autoconf >= 2.58
53 BuildRequires: automake >= 1.10
54 %{?!nopam:BuildRequires: pam-devel}
55
56 %{?!nopam:Requires: pam >= 0.66-12}
57
58 Provides: mktemp
59
60 %description
61 These are the GNU core utilities.  This package is the combination of
62 the old GNU fileutils, sh-utils, and textutils packages.
63
64 %prep
65 %setup -q -b 1
66
67 # From upstream
68 %patch1 -p1 -b .futimens
69 %patch2 -p1 -b .ls-x
70 %patch3 -p1 -b .cp-i-u
71
72 # Our patches
73 %patch100 -p1 -b .chgrp
74
75 # sh-utils
76 %patch703 -p1 -b .dateman
77 %patch704 -p1 -b .paths
78 %{?!nopam:%patch706 -p1 -b .pam}
79 %patch713 -p1 -b .langinfo
80 %patch715 -p1 -b .sysinfo
81
82 # li18nux/lsb
83 %patch800 -p1 -b .i18n
84
85 # Coreutils
86 #%patch900 -p1 -b .setsid
87 #%patch907 -p1 -b .runuser
88 %patch908 -p1 -b .getgrouplist
89 %patch912 -p1 -b .overflow
90 #%patch915 -p1 -b .splitl
91 %patch916 -p1 -b .getfacl-exit-code
92
93 sed -i -e 's/basic-1//g' tests/stty/Makefile*
94
95 chmod a+x tests/sort/sort-mb-tests
96 chmod a+x tests/ls/x-option
97
98 %build
99 pushd ../mktemp-1.5
100 patch -p1 < %{PATCH1001}
101 %configure
102 make
103 popd
104
105 %ifarch s390 s390x
106 # Build at -O1 for the moment (bug #196369).
107 export CFLAGS="$RPM_OPT_FLAGS -fPIC -O1"
108 %else
109 export CFLAGS="$RPM_OPT_FLAGS -fpic"
110 %endif
111 %{expand:%%global optflags %{optflags} -D_GNU_SOURCE=1}
112 %configure %{?!nopam:--enable-pam} \
113             --disable-nls \
114            DEFAULT_POSIX2_VERSION=200112 alternative=199209 || :
115 make all \
116          %{?!nopam:CPPFLAGS="-DUSE_PAM"} \
117          su_LDFLAGS="-pie %{?!nopam:-lpam -lpam_misc}"
118
119 # XXX docs should say /var/run/[uw]tmp not /etc/[uw]tmp
120 sed -i -e 's,/etc/utmp,/var/run/utmp,g;s,/etc/wtmp,/var/run/wtmp,g' doc/coreutils.texi
121
122
123 %check
124 #make check
125
126 %install
127 rm -rf $RPM_BUILD_ROOT
128
129 pushd ../mktemp-1.5
130 make bindir=$RPM_BUILD_ROOT/bin mandir=$RPM_BUILD_ROOT/usr/share/man install 
131 popd
132
133
134
135 make DESTDIR=$RPM_BUILD_ROOT install
136
137 # man pages are not installed with make install
138 make mandir=$RPM_BUILD_ROOT%{_mandir} install-man
139
140 # fix japanese catalog file
141 if [ -d $RPM_BUILD_ROOT%{_datadir}/locale/ja_JP.EUC/LC_MESSAGES ]; then
142    mkdir -p $RPM_BUILD_ROOT%{_datadir}/locale/ja/LC_MESSAGES
143    mv $RPM_BUILD_ROOT%{_datadir}/locale/ja_JP.EUC/LC_MESSAGES/*mo \
144       $RPM_BUILD_ROOT%{_datadir}/locale/ja/LC_MESSAGES
145    rm -rf $RPM_BUILD_ROOT%{_datadir}/locale/ja_JP.EUC
146 fi
147
148 bzip2 -9f ChangeLog
149
150 # let be compatible with old fileutils, sh-utils and textutils packages :
151 mkdir -p $RPM_BUILD_ROOT{/bin,%_bindir,%_sbindir,/sbin}
152 %{?!nopam:mkdir -p $RPM_BUILD_ROOT%_sysconfdir/pam.d}
153 for f in basename cat chgrp chmod chown cp cut date dd df echo env false link ln ls mkdir mknod mv nice pwd rm rmdir sleep sort stty sync touch true uname unlink
154 do
155     mv $RPM_BUILD_ROOT{%_bindir,/bin}/$f 
156 done
157
158 # chroot was in /usr/sbin :
159 mv $RPM_BUILD_ROOT{%_bindir,%_sbindir}/chroot
160 # {cat,sort,cut} were previously moved from bin to /usr/bin and linked into 
161 for i in env cut; do ln -sf ../../bin/$i $RPM_BUILD_ROOT/usr/bin; done
162
163 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/profile.d
164 install -p -c -m644 %SOURCE101 $RPM_BUILD_ROOT%{_sysconfdir}/DIR_COLORS
165 install -p -c -m644 %SOURCE102 $RPM_BUILD_ROOT%{_sysconfdir}/DIR_COLORS.xterm
166 install -p -c -m644 %SOURCE105 $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/colorls.sh
167 install -p -c -m644 %SOURCE106 $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/colorls.csh
168
169 # su
170 install -m 4755 src/su $RPM_BUILD_ROOT/bin
171 #install -m 755 src/runuser $RPM_BUILD_ROOT/sbin
172
173 # These come from util-linux and/or procps.
174 for i in hostname uptime kill ; do
175     rm $RPM_BUILD_ROOT{%_bindir/$i,%_mandir/man1/$i.1}
176 done
177
178 %{?!nopam:install -p -m 644 %SOURCE200 $RPM_BUILD_ROOT%_sysconfdir/pam.d/su}
179 %{?!nopam:install -p -m 644 %SOURCE202 $RPM_BUILD_ROOT%_sysconfdir/pam.d/su-l}
180 #%{?!nopam:install -p -m 644 %SOURCE201 $RPM_BUILD_ROOT%_sysconfdir/pam.d/runuser}
181 #%{?!nopam:install -p -m 644 %SOURCE203 $RPM_BUILD_ROOT%_sysconfdir/pam.d/runuser-l}
182
183 # Compress ChangeLogs from before the fileutils/textutils/etc merge
184 bzip2 -f9 old/*/C*
185
186 # Use hard links instead of symbolic links for LC_TIME files (bug #246729).
187 find %{buildroot}%{_datadir}/locale -type l | \
188 (while read link
189  do
190    target=$(readlink "$link")
191    rm -f "$link"
192    ln "$(dirname "$link")/$target" "$link"
193  done)
194
195
196 # (sb) Deal with Installed (but unpackaged) file(s) found
197 rm -f $RPM_BUILD_ROOT%{_infodir}/dir
198
199 %clean
200 rm -rf $RPM_BUILD_ROOT
201
202
203 %docs_package
204
205
206
207 %files 
208 %defattr(-,root,root,-)
209 %config(noreplace) %{_sysconfdir}/DIR_COLORS*
210 %{_sysconfdir}/profile.d/*
211 %{?!nopam:%config(noreplace) %{_sysconfdir}/pam.d/su}
212 %{?!nopam:%config(noreplace) %{_sysconfdir}/pam.d/su-l}
213 %doc COPYING 
214 /bin/basename
215 /bin/cat
216 /bin/chgrp
217 /bin/chmod
218 /bin/chown
219 /bin/cp
220 /bin/cut
221 /bin/date
222 /bin/dd
223 /bin/df
224 /bin/echo
225 /bin/env
226 /bin/false
227 /bin/link
228 /bin/ln
229 /bin/ls
230 /bin/mkdir
231 /bin/mknod
232 /bin/mv
233 /bin/nice
234 /bin/pwd
235 /bin/rm
236 /bin/rmdir
237 /bin/sleep
238 /bin/sort
239 /bin/stty
240 %attr(4755,root,root) /bin/su
241 /bin/sync
242 /bin/touch
243 /bin/true
244 /bin/uname
245 /bin/unlink
246 /bin/mktemp
247 %_bindir/*
248 %_sbindir/chroot
249 #/sbin/runuser
250