blob: f3fe31fd3bd1eb6faaa18d19d8bb1ed5b6c5f364 [file] [log] [blame]
Brad Bishopc342db32019-05-15 21:57:59 -04001SUMMARY = "The basic file, shell and text manipulation utilities"
2DESCRIPTION = "The GNU Core Utilities provide the basic file, shell and text \
3manipulation utilities. These are the core utilities which are expected to exist on \
4every system."
5HOMEPAGE = "http://www.gnu.org/software/coreutils/"
6BUGTRACKER = "http://debbugs.gnu.org/coreutils"
7LICENSE = "GPLv3+"
Andrew Geissler4b740dc2020-05-05 08:54:39 -05008LIC_FILES_CHKSUM = "file://COPYING;md5=1ebbd3e34237af26da5dc08a4e440464 \
9 file://src/ls.c;beginline=1;endline=15;md5=b7d80abf5b279320fb0e4b1007ed108b \
10 "
Brad Bishopc342db32019-05-15 21:57:59 -040011DEPENDS = "gmp libcap"
12DEPENDS_class-native = ""
13
14inherit autotools gettext texinfo
15
16SRC_URI = "${GNU_MIRROR}/coreutils/${BP}.tar.xz \
17 file://remove-usr-local-lib-from-m4.patch \
18 file://fix-selinux-flask.patch \
19 file://0001-uname-report-processor-and-hardware-correctly.patch \
20 file://disable-ls-output-quoting.patch \
21 file://0001-local.mk-fix-cross-compiling-problem.patch \
Andrew Geissler82c905d2020-04-13 13:39:40 -050022 file://run-ptest \
Andrew Geissler4b740dc2020-05-05 08:54:39 -050023 file://0001-ls-restore-8.31-behavior-on-removed-directories.patch \
24 "
Brad Bishopc342db32019-05-15 21:57:59 -040025
Andrew Geissler4b740dc2020-05-05 08:54:39 -050026SRC_URI[md5sum] = "022042695b7d5bcf1a93559a9735e668"
27SRC_URI[sha256sum] = "4458d8de7849df44ccab15e16b1548b285224dbba5f08fac070c1c0e0bcc4cfa"
Brad Bishopc342db32019-05-15 21:57:59 -040028
William A. Kennington IIIac69b482021-06-02 12:28:27 -070029# http://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=v8.27-101-gf5d7c0842
30# runcon is not really a sandbox command, use `runcon ... setsid ...` to avoid this particular issue.
31CVE_CHECK_WHITELIST += "CVE-2016-2781"
32
Brad Bishopc342db32019-05-15 21:57:59 -040033EXTRA_OECONF_class-native = "--without-gmp"
34EXTRA_OECONF_class-target = "--enable-install-program=arch,hostname --libexecdir=${libdir}"
35EXTRA_OECONF_class-nativesdk = "--enable-install-program=arch,hostname"
36
37# acl and xattr are not default features
38#
39PACKAGECONFIG_class-target ??= "\
40 ${@bb.utils.filter('DISTRO_FEATURES', 'acl xattr', d)} \
41"
42
43# The lib/oe/path.py requires xattr
44PACKAGECONFIG_class-native ??= "xattr"
45
Andrew Geisslerd1e89492021-02-12 15:35:20 -060046# oe-core builds need xattr support
47PACKAGECONFIG_class-nativesdk ??= "xattr"
48
Brad Bishopc342db32019-05-15 21:57:59 -040049# with, without, depends, rdepends
50#
51PACKAGECONFIG[acl] = "--enable-acl,--disable-acl,acl,"
52PACKAGECONFIG[xattr] = "--enable-xattr,--disable-xattr,attr,"
53PACKAGECONFIG[single-binary] = "--enable-single-binary,--disable-single-binary,,"
54
55# [ df mktemp nice printenv base64 gets a special treatment and is not included in this
56bindir_progs = "arch basename chcon cksum comm csplit cut dir dircolors dirname du \
57 env expand expr factor fmt fold groups head hostid id install \
58 join link logname md5sum mkfifo nl nohup nproc od paste pathchk \
59 pinky pr printf ptx readlink realpath runcon seq sha1sum sha224sum sha256sum \
Brad Bishop64c979e2019-11-04 13:55:29 -050060 sha384sum sha512sum shred shuf sort split sum tac tail tee test timeout \
Brad Bishopc342db32019-05-15 21:57:59 -040061 tr truncate tsort tty unexpand uniq unlink uptime users vdir wc who whoami yes"
62
63# hostname gets a special treatment and is not included in this
64base_bindir_progs = "cat chgrp chmod chown cp date dd echo false hostname kill ln ls mkdir \
65 mknod mv pwd rm rmdir sleep stty sync touch true uname stat"
66
67sbindir_progs= "chroot"
68
Andrew Geissler475cb722020-07-10 16:00:51 -050069# Split stdbuf into its own package, so one can include
70# coreutils-stdbuf without getting the rest of coreutils, but make
71# coreutils itself pull in stdbuf, so IMAGE_INSTALL += "coreutils"
72# always provides all coreutils
73PACKAGE_BEFORE_PN_class-target += "${@bb.utils.contains('PACKAGECONFIG', 'single-binary', '', 'coreutils-stdbuf', d)}"
Brad Bishop64c979e2019-11-04 13:55:29 -050074FILES_coreutils-stdbuf = "${bindir}/stdbuf ${libdir}/coreutils/libstdbuf.so"
Andrew Geissler475cb722020-07-10 16:00:51 -050075RDEPENDS_coreutils_class-target += "${@bb.utils.contains('PACKAGECONFIG', 'single-binary', '', 'coreutils-stdbuf', d)}"
76
77# However, when the single-binary PACKAGECONFIG is used, stdbuf
78# functionality is built into the single coreutils binary, so there's
79# no point splitting /usr/bin/stdbuf to its own package. Instead, add
80# an RPROVIDE so that rdepending on coreutils-stdbuf will work
81# regardless of whether single-binary is in effect.
82RPROVIDES_coreutils += "${@bb.utils.contains('PACKAGECONFIG', 'single-binary', 'coreutils-stdbuf', '', d)}"
Brad Bishop64c979e2019-11-04 13:55:29 -050083
Brad Bishopc342db32019-05-15 21:57:59 -040084# Let aclocal use the relative path for the m4 file rather than the
85# absolute since coreutils has a lot of m4 files, otherwise there might
86# be an "Argument list too long" error when it is built in a long/deep
87# directory.
88acpaths = "-I ./m4"
89
90# Deal with a separate builddir failure if src doesn't exist when creating version.c/version.h
91do_compile_prepend () {
92 mkdir -p ${B}/src
93}
94
95do_install_class-native() {
96 autotools_do_install
97 # remove groups to fix conflict with shadow-native
98 rm -f ${D}${STAGING_BINDIR_NATIVE}/groups
99 # The return is a must since native doesn't need the
100 # do_install_append() in the below.
101 return
102}
103
104do_install_append() {
105 for i in df mktemp nice printenv base64; do mv ${D}${bindir}/$i ${D}${bindir}/$i.${BPN}; done
106
107 install -d ${D}${base_bindir}
108 [ "${base_bindir}" != "${bindir}" ] && for i in ${base_bindir_progs}; do mv ${D}${bindir}/$i ${D}${base_bindir}/$i.${BPN}; done
109
110 install -d ${D}${sbindir}
111 [ "${sbindir}" != "${bindir}" ] && for i in ${sbindir_progs}; do mv ${D}${bindir}/$i ${D}${sbindir}/$i.${BPN}; done
112
113 # [ requires special handling because [.coreutils will cause the sed stuff
114 # in update-alternatives to fail, therefore use lbracket - the name used
115 # for the actual source file.
116 mv ${D}${bindir}/[ ${D}${bindir}/lbracket.${BPN}
117}
118
119inherit update-alternatives
120
121ALTERNATIVE_PRIORITY = "100"
122# Make hostname's priority higher than busybox but lower than net-tools
123ALTERNATIVE_PRIORITY[hostname] = "90"
Andrew Geissler90fd73c2021-03-05 15:25:55 -0600124ALTERNATIVE_${PN} = "lbracket ${bindir_progs} ${base_bindir_progs} ${sbindir_progs} base32 base64 nice printenv mktemp df"
Brad Bishopc342db32019-05-15 21:57:59 -0400125ALTERNATIVE_${PN}-doc = "base64.1 nice.1 mktemp.1 df.1 groups.1 kill.1 uptime.1 stat.1 hostname.1"
126
127ALTERNATIVE_LINK_NAME[hostname.1] = "${mandir}/man1/hostname.1"
128
129ALTERNATIVE_LINK_NAME[base64] = "${base_bindir}/base64"
130ALTERNATIVE_TARGET[base64] = "${bindir}/base64.${BPN}"
131ALTERNATIVE_LINK_NAME[base64.1] = "${mandir}/man1/base64.1"
132
133ALTERNATIVE_LINK_NAME[mktemp] = "${base_bindir}/mktemp"
134ALTERNATIVE_TARGET[mktemp] = "${bindir}/mktemp.${BPN}"
135ALTERNATIVE_LINK_NAME[mktemp.1] = "${mandir}/man1/mktemp.1"
136
137ALTERNATIVE_LINK_NAME[df] = "${base_bindir}/df"
138ALTERNATIVE_TARGET[df] = "${bindir}/df.${BPN}"
139ALTERNATIVE_LINK_NAME[df.1] = "${mandir}/man1/df.1"
140
141ALTERNATIVE_LINK_NAME[nice] = "${base_bindir}/nice"
142ALTERNATIVE_TARGET[nice] = "${bindir}/nice.${BPN}"
143ALTERNATIVE_LINK_NAME[nice.1] = "${mandir}/man1/nice.1"
144
145ALTERNATIVE_LINK_NAME[printenv] = "${base_bindir}/printenv"
146ALTERNATIVE_TARGET[printenv] = "${bindir}/printenv.${BPN}"
147
148ALTERNATIVE_LINK_NAME[lbracket] = "${bindir}/["
149ALTERNATIVE_TARGET[lbracket] = "${bindir}/lbracket.${BPN}"
150
151ALTERNATIVE_LINK_NAME[groups.1] = "${mandir}/man1/groups.1"
152ALTERNATIVE_LINK_NAME[uptime.1] = "${mandir}/man1/uptime.1"
153ALTERNATIVE_LINK_NAME[kill.1] = "${mandir}/man1/kill.1"
154ALTERNATIVE_LINK_NAME[stat.1] = "${mandir}/man1/stat.1"
155
156python __anonymous() {
157 for prog in d.getVar('base_bindir_progs').split():
158 d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_bindir'), prog))
159
160 for prog in d.getVar('sbindir_progs').split():
161 d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('sbindir'), prog))
162}
163
164BBCLASSEXTEND = "native nativesdk"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500165
166inherit ptest
167
Andrew Geisslerf0343792020-11-18 10:42:21 -0600168RDEPENDS_${PN}-ptest += "bash findutils gawk liberror-perl make perl perl-modules python3-core sed shadow"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500169
170# -dev automatic dependencies fails as we don't want libmodule-build-perl-dev, its too heavy
171# may need tweaking if DEPENDS changes
172RRECOMMENDS_coreutils-dev[nodeprrecs] = "1"
173RRECOMMENDS_coreutils-dev = "acl-dev attr-dev gmp-dev libcap-dev bash-dev findutils-dev gawk-dev shadow-dev"
174
175do_install_ptest () {
176 install -d ${D}${PTEST_PATH}/tests
177 cp -r ${S}/tests/* ${D}${PTEST_PATH}/tests
178 sed -i 's/ginstall/install/g' `grep -R ginstall ${D}${PTEST_PATH}/tests | awk -F: '{print $1}' | uniq`
179 install -d ${D}${PTEST_PATH}/build-aux
180 install ${S}/build-aux/test-driver ${D}${PTEST_PATH}/build-aux/
181 cp ${B}/Makefile ${D}${PTEST_PATH}/
182 cp ${S}/init.cfg ${D}${PTEST_PATH}/
183 cp -r ${B}/src ${D}${PTEST_PATH}/
184 cp -r ${S}/src/*.c ${D}${PTEST_PATH}/src
185 sed -i '/^VPATH/s/= .*$/= ./g' ${D}${PTEST_PATH}/Makefile
186 sed -i '/^PROGRAMS/s/^/#/g' ${D}${PTEST_PATH}/Makefile
187 sed -i '/^Makefile: /s/^.*$/Makefile:/g' ${D}${PTEST_PATH}/Makefile
188 sed -i '/^abs_srcdir/s/= .*$/= \$\{PWD\}/g' ${D}${PTEST_PATH}/Makefile
189 sed -i '/^abs_top_builddir/s/= .*$/= \$\{PWD\}/g' ${D}${PTEST_PATH}/Makefile
190 sed -i '/^abs_top_srcdir/s/= .*$/= \$\{PWD\}/g' ${D}${PTEST_PATH}/Makefile
191 sed -i '/^built_programs/s/ginstall/install/g' ${D}${PTEST_PATH}/Makefile
192 chmod -R 777 ${D}${PTEST_PATH}
193
194 # Disable subcase stty-pairs.sh, it will cause test framework hang
195 sed -i '/stty-pairs.sh/d' ${D}${PTEST_PATH}/Makefile
196
197 # Disable subcase tail-2/assert.sh as it has issues on 32-bit systems
198 sed -i '/assert.sh/d' ${D}${PTEST_PATH}/Makefile
199
200 # Tweak test d_type-check to use python3 instead of python
201 sed -i "1s@.*@#!/usr/bin/python3@" ${D}${PTEST_PATH}/tests/d_type-check
202 install ${B}/src/getlimits ${D}/${bindir}
203
204 # handle multilib
205 sed -i s:@libdir@:${libdir}:g ${D}${PTEST_PATH}/run-ptest
206}
207
208FILES_${PN}-ptest += "${bindir}/getlimits"
Andrew Geissler09209ee2020-12-13 08:44:15 -0600209
210# These are specific to Opensuse
211CVE_WHITELIST += "CVE-2013-0221 CVE-2013-0222 CVE-2013-0223"