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