blob: 01acf9a8747431c934304fcb13668d462b9b8037 [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"
Patrick Williams213cb262021-08-07 19:21:33 -050012DEPENDS:class-native = ""
Brad Bishopc342db32019-05-15 21:57:59 -040013
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 \
Andrew Geissler09036742021-06-25 14:25:14 -050024 file://0001-fts-remove-NOSTAT_LEAF_OPTIMIZATION.patch \
Andrew Geissler4b740dc2020-05-05 08:54:39 -050025 "
Brad Bishopc342db32019-05-15 21:57:59 -040026
Andrew Geissler4b740dc2020-05-05 08:54:39 -050027SRC_URI[md5sum] = "022042695b7d5bcf1a93559a9735e668"
28SRC_URI[sha256sum] = "4458d8de7849df44ccab15e16b1548b285224dbba5f08fac070c1c0e0bcc4cfa"
Brad Bishopc342db32019-05-15 21:57:59 -040029
William A. Kennington IIIac69b482021-06-02 12:28:27 -070030# http://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=v8.27-101-gf5d7c0842
31# runcon is not really a sandbox command, use `runcon ... setsid ...` to avoid this particular issue.
32CVE_CHECK_WHITELIST += "CVE-2016-2781"
33
Patrick Williams213cb262021-08-07 19:21:33 -050034EXTRA_OECONF:class-native = "--without-gmp"
35EXTRA_OECONF:class-target = "--enable-install-program=arch,hostname --libexecdir=${libdir}"
36EXTRA_OECONF:class-nativesdk = "--enable-install-program=arch,hostname"
Brad Bishopc342db32019-05-15 21:57:59 -040037
38# acl and xattr are not default features
39#
Patrick Williams213cb262021-08-07 19:21:33 -050040PACKAGECONFIG:class-target ??= "\
Brad Bishopc342db32019-05-15 21:57:59 -040041 ${@bb.utils.filter('DISTRO_FEATURES', 'acl xattr', d)} \
42"
43
44# The lib/oe/path.py requires xattr
Patrick Williams213cb262021-08-07 19:21:33 -050045PACKAGECONFIG:class-native ??= "xattr"
Brad Bishopc342db32019-05-15 21:57:59 -040046
Andrew Geisslerd1e89492021-02-12 15:35:20 -060047# oe-core builds need xattr support
Patrick Williams213cb262021-08-07 19:21:33 -050048PACKAGECONFIG:class-nativesdk ??= "xattr"
Andrew Geisslerd1e89492021-02-12 15:35:20 -060049
Brad Bishopc342db32019-05-15 21:57:59 -040050# with, without, depends, rdepends
51#
52PACKAGECONFIG[acl] = "--enable-acl,--disable-acl,acl,"
53PACKAGECONFIG[xattr] = "--enable-xattr,--disable-xattr,attr,"
54PACKAGECONFIG[single-binary] = "--enable-single-binary,--disable-single-binary,,"
Andrew Geissler5199d832021-09-24 16:47:35 -050055PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux"
Brad Bishopc342db32019-05-15 21:57:59 -040056
57# [ df mktemp nice printenv base64 gets a special treatment and is not included in this
58bindir_progs = "arch basename chcon cksum comm csplit cut dir dircolors dirname du \
59 env expand expr factor fmt fold groups head hostid id install \
60 join link logname md5sum mkfifo nl nohup nproc od paste pathchk \
61 pinky pr printf ptx readlink realpath runcon seq sha1sum sha224sum sha256sum \
Brad Bishop64c979e2019-11-04 13:55:29 -050062 sha384sum sha512sum shred shuf sort split sum tac tail tee test timeout \
Brad Bishopc342db32019-05-15 21:57:59 -040063 tr truncate tsort tty unexpand uniq unlink uptime users vdir wc who whoami yes"
64
65# hostname gets a special treatment and is not included in this
66base_bindir_progs = "cat chgrp chmod chown cp date dd echo false hostname kill ln ls mkdir \
67 mknod mv pwd rm rmdir sleep stty sync touch true uname stat"
68
69sbindir_progs= "chroot"
70
Andrew Geissler475cb722020-07-10 16:00:51 -050071# Split stdbuf into its own package, so one can include
72# coreutils-stdbuf without getting the rest of coreutils, but make
73# coreutils itself pull in stdbuf, so IMAGE_INSTALL += "coreutils"
74# always provides all coreutils
Patrick Williams213cb262021-08-07 19:21:33 -050075PACKAGE_BEFORE_PN:class-target += "${@bb.utils.contains('PACKAGECONFIG', 'single-binary', '', 'coreutils-stdbuf', d)}"
76FILES:coreutils-stdbuf = "${bindir}/stdbuf ${libdir}/coreutils/libstdbuf.so"
77RDEPENDS:coreutils:class-target += "${@bb.utils.contains('PACKAGECONFIG', 'single-binary', '', 'coreutils-stdbuf', d)}"
Andrew Geissler475cb722020-07-10 16:00:51 -050078
79# However, when the single-binary PACKAGECONFIG is used, stdbuf
80# functionality is built into the single coreutils binary, so there's
81# no point splitting /usr/bin/stdbuf to its own package. Instead, add
82# an RPROVIDE so that rdepending on coreutils-stdbuf will work
83# regardless of whether single-binary is in effect.
Patrick Williams213cb262021-08-07 19:21:33 -050084RPROVIDES:coreutils += "${@bb.utils.contains('PACKAGECONFIG', 'single-binary', 'coreutils-stdbuf', '', d)}"
Brad Bishop64c979e2019-11-04 13:55:29 -050085
Brad Bishopc342db32019-05-15 21:57:59 -040086# Let aclocal use the relative path for the m4 file rather than the
87# absolute since coreutils has a lot of m4 files, otherwise there might
88# be an "Argument list too long" error when it is built in a long/deep
89# directory.
90acpaths = "-I ./m4"
91
92# Deal with a separate builddir failure if src doesn't exist when creating version.c/version.h
Patrick Williams213cb262021-08-07 19:21:33 -050093do_compile:prepend () {
Brad Bishopc342db32019-05-15 21:57:59 -040094 mkdir -p ${B}/src
95}
96
Patrick Williams213cb262021-08-07 19:21:33 -050097do_install:class-native() {
Brad Bishopc342db32019-05-15 21:57:59 -040098 autotools_do_install
99 # remove groups to fix conflict with shadow-native
100 rm -f ${D}${STAGING_BINDIR_NATIVE}/groups
101 # The return is a must since native doesn't need the
Patrick Williams213cb262021-08-07 19:21:33 -0500102 # do_install:append() in the below.
Brad Bishopc342db32019-05-15 21:57:59 -0400103 return
104}
105
Patrick Williams213cb262021-08-07 19:21:33 -0500106do_install:append() {
Brad Bishopc342db32019-05-15 21:57:59 -0400107 for i in df mktemp nice printenv base64; do mv ${D}${bindir}/$i ${D}${bindir}/$i.${BPN}; done
108
109 install -d ${D}${base_bindir}
110 [ "${base_bindir}" != "${bindir}" ] && for i in ${base_bindir_progs}; do mv ${D}${bindir}/$i ${D}${base_bindir}/$i.${BPN}; done
111
112 install -d ${D}${sbindir}
113 [ "${sbindir}" != "${bindir}" ] && for i in ${sbindir_progs}; do mv ${D}${bindir}/$i ${D}${sbindir}/$i.${BPN}; done
114
115 # [ requires special handling because [.coreutils will cause the sed stuff
116 # in update-alternatives to fail, therefore use lbracket - the name used
117 # for the actual source file.
118 mv ${D}${bindir}/[ ${D}${bindir}/lbracket.${BPN}
119}
120
121inherit update-alternatives
122
123ALTERNATIVE_PRIORITY = "100"
124# Make hostname's priority higher than busybox but lower than net-tools
125ALTERNATIVE_PRIORITY[hostname] = "90"
Patrick Williams213cb262021-08-07 19:21:33 -0500126ALTERNATIVE:${PN} = "lbracket ${bindir_progs} ${base_bindir_progs} ${sbindir_progs} base32 base64 nice printenv mktemp df"
127ALTERNATIVE:${PN}-doc = "base64.1 nice.1 mktemp.1 df.1 groups.1 kill.1 uptime.1 stat.1 hostname.1"
Brad Bishopc342db32019-05-15 21:57:59 -0400128
129ALTERNATIVE_LINK_NAME[hostname.1] = "${mandir}/man1/hostname.1"
130
131ALTERNATIVE_LINK_NAME[base64] = "${base_bindir}/base64"
132ALTERNATIVE_TARGET[base64] = "${bindir}/base64.${BPN}"
133ALTERNATIVE_LINK_NAME[base64.1] = "${mandir}/man1/base64.1"
134
135ALTERNATIVE_LINK_NAME[mktemp] = "${base_bindir}/mktemp"
136ALTERNATIVE_TARGET[mktemp] = "${bindir}/mktemp.${BPN}"
137ALTERNATIVE_LINK_NAME[mktemp.1] = "${mandir}/man1/mktemp.1"
138
139ALTERNATIVE_LINK_NAME[df] = "${base_bindir}/df"
140ALTERNATIVE_TARGET[df] = "${bindir}/df.${BPN}"
141ALTERNATIVE_LINK_NAME[df.1] = "${mandir}/man1/df.1"
142
143ALTERNATIVE_LINK_NAME[nice] = "${base_bindir}/nice"
144ALTERNATIVE_TARGET[nice] = "${bindir}/nice.${BPN}"
145ALTERNATIVE_LINK_NAME[nice.1] = "${mandir}/man1/nice.1"
146
147ALTERNATIVE_LINK_NAME[printenv] = "${base_bindir}/printenv"
148ALTERNATIVE_TARGET[printenv] = "${bindir}/printenv.${BPN}"
149
150ALTERNATIVE_LINK_NAME[lbracket] = "${bindir}/["
151ALTERNATIVE_TARGET[lbracket] = "${bindir}/lbracket.${BPN}"
152
153ALTERNATIVE_LINK_NAME[groups.1] = "${mandir}/man1/groups.1"
154ALTERNATIVE_LINK_NAME[uptime.1] = "${mandir}/man1/uptime.1"
155ALTERNATIVE_LINK_NAME[kill.1] = "${mandir}/man1/kill.1"
156ALTERNATIVE_LINK_NAME[stat.1] = "${mandir}/man1/stat.1"
157
158python __anonymous() {
159 for prog in d.getVar('base_bindir_progs').split():
160 d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_bindir'), prog))
161
162 for prog in d.getVar('sbindir_progs').split():
163 d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('sbindir'), prog))
164}
165
166BBCLASSEXTEND = "native nativesdk"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500167
168inherit ptest
169
Patrick Williams213cb262021-08-07 19:21:33 -0500170RDEPENDS:${PN}-ptest += "bash findutils gawk liberror-perl make perl perl-modules python3-core sed shadow"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500171
172# -dev automatic dependencies fails as we don't want libmodule-build-perl-dev, its too heavy
173# may need tweaking if DEPENDS changes
Patrick Williams213cb262021-08-07 19:21:33 -0500174RRECOMMENDS:coreutils-dev[nodeprrecs] = "1"
175RRECOMMENDS:coreutils-dev = "acl-dev attr-dev gmp-dev libcap-dev bash-dev findutils-dev gawk-dev shadow-dev"
Andrew Geissler82c905d2020-04-13 13:39:40 -0500176
177do_install_ptest () {
178 install -d ${D}${PTEST_PATH}/tests
179 cp -r ${S}/tests/* ${D}${PTEST_PATH}/tests
180 sed -i 's/ginstall/install/g' `grep -R ginstall ${D}${PTEST_PATH}/tests | awk -F: '{print $1}' | uniq`
181 install -d ${D}${PTEST_PATH}/build-aux
182 install ${S}/build-aux/test-driver ${D}${PTEST_PATH}/build-aux/
183 cp ${B}/Makefile ${D}${PTEST_PATH}/
184 cp ${S}/init.cfg ${D}${PTEST_PATH}/
185 cp -r ${B}/src ${D}${PTEST_PATH}/
186 cp -r ${S}/src/*.c ${D}${PTEST_PATH}/src
187 sed -i '/^VPATH/s/= .*$/= ./g' ${D}${PTEST_PATH}/Makefile
188 sed -i '/^PROGRAMS/s/^/#/g' ${D}${PTEST_PATH}/Makefile
189 sed -i '/^Makefile: /s/^.*$/Makefile:/g' ${D}${PTEST_PATH}/Makefile
190 sed -i '/^abs_srcdir/s/= .*$/= \$\{PWD\}/g' ${D}${PTEST_PATH}/Makefile
191 sed -i '/^abs_top_builddir/s/= .*$/= \$\{PWD\}/g' ${D}${PTEST_PATH}/Makefile
192 sed -i '/^abs_top_srcdir/s/= .*$/= \$\{PWD\}/g' ${D}${PTEST_PATH}/Makefile
193 sed -i '/^built_programs/s/ginstall/install/g' ${D}${PTEST_PATH}/Makefile
194 chmod -R 777 ${D}${PTEST_PATH}
195
196 # Disable subcase stty-pairs.sh, it will cause test framework hang
197 sed -i '/stty-pairs.sh/d' ${D}${PTEST_PATH}/Makefile
198
199 # Disable subcase tail-2/assert.sh as it has issues on 32-bit systems
200 sed -i '/assert.sh/d' ${D}${PTEST_PATH}/Makefile
201
202 # Tweak test d_type-check to use python3 instead of python
203 sed -i "1s@.*@#!/usr/bin/python3@" ${D}${PTEST_PATH}/tests/d_type-check
204 install ${B}/src/getlimits ${D}/${bindir}
205
206 # handle multilib
207 sed -i s:@libdir@:${libdir}:g ${D}${PTEST_PATH}/run-ptest
208}
209
Patrick Williams213cb262021-08-07 19:21:33 -0500210FILES:${PN}-ptest += "${bindir}/getlimits"
Andrew Geissler09209ee2020-12-13 08:44:15 -0600211
212# These are specific to Opensuse
213CVE_WHITELIST += "CVE-2013-0221 CVE-2013-0222 CVE-2013-0223"