coreutils/coreutils.spec
2024-04-10 20:46:59 +09:00

232 lines
6.5 KiB
RPMSpec

%bcond_with crosscompile
%{?build_selinux}%{?!build_selinux:%bcond_with selinux}
%bcond_without single
# do not make coreutils-single depend on /usr/bin/coreutils
%global __requires_exclude ^%{_bindir}/coreutils$
# just hardening
%global ldflags %{ldflags} -Wl,-z,now
Summary: The GNU core utilities: a set of tools commonly used in shell scripts
Name: coreutils
Version: 9.5
Release: 1
License: GPLv3+
Group: System/Base
Url: http://www.gnu.org/software/coreutils/
Source0: http://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz
Source2: coreutils-DIR_COLORS.256color
Source3: coreutils-colorls.sh
Source4: coreutils-colorls.csh
# Russian man page
Source5: coreutils_man_ru.tar.gz
Source6: gcc-wrapper.sh
# need for patch2108
Source7: mbchar.h
# require_selinux_(): use selinuxenabled(8) if available
Patch105: coreutils-8.26-selinuxenable.patch
#SELINUX Patch - implements Redhat changes
#(upstream did some SELinux implementation unlike with RedHat patch)
Patch950: coreutils-selinux.patch
# fileutils
Patch118: fileutils-4.1-ls_h.patch
Patch500: coreutils-8.3-mem.patch
#add info about TZ envvar to date manpage
Patch703: coreutils-8.21-dateman.patch
Patch909: coreutils-5.1.0-64bit-fixes.patch
# https://qa.mandriva.com/show_bug.cgi?id=38577
Patch911: coreutils-8.3-groupfix.patch
Patch1011: coreutils-9.5-DIR_COLORS-mdkconf.patch
#(peroyvind): fix a test that fails to compile with -Werror=format-security
Patch1014: coreutils-8.22-check-string-format.patch
#(peroyvind): add missing header includes
Patch1015: coreutils-8.24-include-missing-headers.patch
Patch1017: coreutils-8.28-inline.patch
# fedora patches
#do display processor type for uname -p/-i based on uname(2) syscall
Patch2103: coreutils-9.3-uname-processortype.patch
#df --direct
Patch2104: coreutils-9.4-df-direct.patch
#add note about mkdir --mode behaviour into info documentation(#610559)
Patch2107: coreutils-8.4-mkdir-modenote.patch
# (sb) lin18nux/lsb compliance - expand/unexpand
Patch2108: coreutils-i18n-expand-unexpand.patch
# The unexpand patch above is not correct. Sent to the patch authors
Patch2110: coreutils-i18n-fix-unexpand.patch
#(un)expand - allow multiple files on input - broken by patch 801
Patch2111: coreutils-i18n-fix2-expand-unexpand.patch
#(un)expand - test BOM headers
Patch2112: coreutils-i18n-un-expand-BOM.patch
# do not use IF_LINT for initialization of scalar variables
# https://src.fedoraproject.org/rpms/coreutils/raw/master/f/coreutils-8.32-if-lint.patch
Patch2115: coreutils-9.4-if-lint.patch
#getgrouplist() patch from Ulrich Drepper.
Patch2908: coreutils-9.5-getgrouplist.patch
#BuildRequires: locales-fr
#BuildRequires: locales-ja
#BuildRequires: locales-zh
#BuildRequires: locales-tr
BuildRequires: bison
BuildRequires: flex
BuildRequires: gettext
BuildRequires: strace
BuildRequires: texinfo >= 4.3
BuildRequires: acl-devel
BuildRequires: attr-devel
BuildRequires: cap-devel
BuildRequires: net-tools
%if !%{with single}
# disabled when build as single binary
BuildRequires: gmp-devel
BuildRequires: pkgconfig(openssl)
%endif
%if %{with selinux}
BuildRequires: selinux-devel
%endif
Provides: /bin/chgrp
Provides: /bin/chmod
Provides: /bin/env
Provides: stat = %{EVRD}
Provides: mktemp = %{EVRD}
Recommends: coreutils-doc
%description
This package is the union of the old GNU fileutils, sh-utils, and
textutils packages.
These tools are the GNU versions of common useful and popular
file & text utilities which are used for:
- file management
- shell scripts
- modifying text file (spliting, joining, comparing, modifying, ...)
Most of these programs have significant advantages over their Unix
counterparts, such as greater speed, additional options, and fewer
arbitrary limits.
%package doc
Summary: Coreutils documentation in info format
Group: Books/Computer books
Requires: coreutils
BuildArch: noarch
%description doc
This package contains coreutils documentation in GNU info format.
%prep
%setup -q
cp %{SOURCE7} ./lib
%apply_patches
chmod +w ./src/dircolors.h
./src/dcgen ./src/dircolors.hin > ./src/dircolors.h
export DEFAULT_POSIX2_VERSION=200112
aclocal -I m4 --dont-fix
automake --gnits --add-missing
autoconf --force
# XXX docs should say /var/run/[uw]tmp not /etc/[uw]tmp
sed -e 's,/etc/utmp,/var/run/utmp,g;s,/etc/wtmp,/var/run/wtmp,g' -i doc/coreutils.texi
%build
# disabled when build as single binary:
# openssl
# gmp
%serverbuild
# libstdbuf cannot be compiled with -fPIE
export CC="bash %{SOURCE6}"
%configure \
--enable-largefile \
--enable-no-install-program=hostname,uptime,kill \
--enable-install-program=arch \
%if %{with selinux}
--with-selinux \
%else
--without-selinux \
%endif
--with-packager="%{packager}" \
--with-packager-version="%{version}-%{release}" \
--with-packager-bug-reports="%{bugurl}" \
%if %{with single}
--enable-single-binary=symlinks \
--without-openssl \
--without-gmp \
%else
--disable-single-binary \
--with-openssl \
--with-gmp \
%endif
--with-tty-group
# Regenerate manpages
touch man/*.x
%make_build
#check
#make check
%install
%make_install
# man pages are not installed with make install
make mandir=%{buildroot}%{_mandir} install-man
mkdir -p %{buildroot}%{_mandir}/ru/man1
install -p -m644 src/dircolors.hin -D %{buildroot}%{_sysconfdir}/DIR_COLORS
install -p -m644 %{SOURCE2} -D %{buildroot}%{_sysconfdir}/DIR_COLORS.256color
install -p -m644 %{SOURCE3} -D %{buildroot}%{_sysconfdir}/profile.d/90_colorls.sh
install -p -m644 %{SOURCE4} -D %{buildroot}%{_sysconfdir}/profile.d/90_colorls.csh
pushd %{buildroot}%{_mandir}/ru/man1
tar -xvzf %{SOURCE5}
popd
#TV# find_lang look for LC_MESSAGES, not LC_TIME:
find %{buildroot}%{_datadir}/locale/ -name coreutils.mo | grep LC_TIME | xargs rm -f
# (tpg) compress these files
xz --text ChangeLog
# see comment in %%files
mkdir -p %{buildroot}/var/spool/initramfs-regen
touch %{buildroot}/var/spool/initramfs-regen/coreutils
%find_lang %{name}
%files -f %{name}.lang
%config(noreplace) %{_sysconfdir}/DIR_COLORS
%config(noreplace) %{_sysconfdir}/DIR_COLORS.256color
%{_sysconfdir}/profile.d/90_colorls.sh
%{_sysconfdir}/profile.d/90_colorls.csh
%{_bindir}/*
%dir %{_libexecdir}/coreutils
%{_libexecdir}/coreutils/libstdbuf.so
# This file triggers rebuilding initrds when coreutils package is updated
# to keep them on the host and inside initrds in sync,
# but!!! unlike other packages with /var/spool/initramfs-regen/*,
# NO dependency from rosa-kernel-tools here to avoid too complex
# dependency graph which must not be complex in coreutils
/var/spool/initramfs-regen/coreutils
%files doc
%doc ABOUT-NLS ChangeLog.xz NEWS THANKS TODO README
%{_infodir}/coreutils*
%{_mandir}/man*/*
%{_mandir}/ru/man1/*