]>
Commit | Line | Data |
---|---|---|
ad17dfd3 | 1 | SUMMARY = "The basic file, shell and text manipulation utilities" |
fa647b91 MH |
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." | |
98bd03a5 KT |
5 | HOMEPAGE = "http://www.gnu.org/software/coreutils/" |
6 | BUGTRACKER = "http://debbugs.gnu.org/coreutils" | |
ceda3238 | 7 | LICENSE = "GPL-3.0-or-later" |
6e1052d4 | 8 | LIC_FILES_CHKSUM = "file://COPYING;md5=1ebbd3e34237af26da5dc08a4e440464 \ |
fe6b74e6 | 9 | file://src/ls.c;beginline=1;endline=15;md5=b720a8b317035d66c555fc6d89e3674c \ |
6e1052d4 | 10 | " |
8f348cca | 11 | DEPENDS = "gmp libcap" |
42344347 | 12 | DEPENDS:class-native = "" |
98bd03a5 | 13 | |
e6fb2f9a | 14 | inherit autotools gettext texinfo |
98bd03a5 | 15 | |
77c6b5eb | 16 | SRC_URI = "${GNU_MIRROR}/coreutils/${BP}.tar.xz \ |
e9a49ebe | 17 | file://remove-usr-local-lib-from-m4.patch \ |
07fabf6a | 18 | file://0001-local.mk-fix-cross-compiling-problem.patch \ |
8f661c56 | 19 | file://0001-posixtm-pacify-clang-18.patch \ |
9a703f8e | 20 | file://run-ptest \ |
6e1052d4 | 21 | " |
a51b0456 | 22 | SRC_URI[sha256sum] = "ea613a4cf44612326e917201bbbcdfbd301de21ffc3b59b6e5c07e040b275e52" |
3d08b9f2 | 23 | |
2d273b5a | 24 | # http://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=v8.27-101-gf5d7c0842 |
1634ed40 AV |
25 | # |
26 | CVE_STATUS[CVE-2016-2781] = "disputed: runcon is not really a sandbox command, use `runcon ... setsid ...` to avoid this particular issue." | |
2d273b5a | 27 | |
42344347 RP |
28 | EXTRA_OECONF:class-target = "--enable-install-program=arch,hostname --libexecdir=${libdir}" |
29 | EXTRA_OECONF:class-nativesdk = "--enable-install-program=arch,hostname" | |
a8455a13 | 30 | |
025c348d | 31 | # acl and xattr are not default features |
a8455a13 | 32 | # |
42344347 | 33 | PACKAGECONFIG:class-target ??= "\ |
0a1427bf | 34 | ${@bb.utils.filter('DISTRO_FEATURES', 'acl xattr', d)} \ |
025c348d SE |
35 | " |
36 | ||
18ff7efe | 37 | # The lib/oe/path.py requires xattr |
42344347 | 38 | PACKAGECONFIG:class-native ??= "xattr" |
a8455a13 | 39 | |
80d7debf | 40 | # oe-core builds need xattr support |
42344347 | 41 | PACKAGECONFIG:class-nativesdk ??= "xattr" |
80d7debf | 42 | |
a8455a13 JS |
43 | # with, without, depends, rdepends |
44 | # | |
45 | PACKAGECONFIG[acl] = "--enable-acl,--disable-acl,acl," | |
025c348d | 46 | PACKAGECONFIG[xattr] = "--enable-xattr,--disable-xattr,attr," |
94ce5d25 | 47 | PACKAGECONFIG[single-binary] = "--enable-single-binary,--disable-single-binary,," |
ee48a2db | 48 | PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux" |
9859a812 | 49 | PACKAGECONFIG[openssl] = "--with-openssl=yes,--with-openssl=no,openssl" |
e58ca650 | 50 | |
ae947ffd | 51 | # [ df mktemp nice printenv base64 gets a special treatment and is not included in this |
9df8591a | 52 | bindir_progs = "arch basename chcon cksum comm csplit cut dir dircolors dirname du \ |
98bd03a5 | 53 | env expand expr factor fmt fold groups head hostid id install \ |
57b1b20a | 54 | join link logname md5sum mkfifo nl nohup nproc od paste pathchk \ |
ae947ffd | 55 | pinky pr printf ptx readlink realpath runcon seq sha1sum sha224sum sha256sum \ |
992cec44 | 56 | sha384sum sha512sum shred shuf sort split sum tac tail tee test timeout \ |
7f71e866 | 57 | tr truncate tsort tty unexpand uniq unlink uptime users vdir wc who whoami yes" |
98bd03a5 KT |
58 | |
59 | # hostname gets a special treatment and is not included in this | |
fbdc6768 | 60 | base_bindir_progs = "cat chgrp chmod chown cp date dd echo false hostname kill ln ls mkdir \ |
d98d6122 | 61 | mknod mv pwd rm rmdir sleep stty sync touch true uname stat" |
98bd03a5 KT |
62 | |
63 | sbindir_progs= "chroot" | |
64 | ||
74d24b5b RV |
65 | # Split stdbuf into its own package, so one can include |
66 | # coreutils-stdbuf without getting the rest of coreutils, but make | |
67 | # coreutils itself pull in stdbuf, so IMAGE_INSTALL += "coreutils" | |
68 | # always provides all coreutils | |
42344347 RP |
69 | PACKAGE_BEFORE_PN:class-target += "${@bb.utils.contains('PACKAGECONFIG', 'single-binary', '', 'coreutils-stdbuf', d)}" |
70 | FILES:coreutils-stdbuf = "${bindir}/stdbuf ${libdir}/coreutils/libstdbuf.so" | |
71 | RDEPENDS:coreutils:class-target += "${@bb.utils.contains('PACKAGECONFIG', 'single-binary', '', 'coreutils-stdbuf', d)}" | |
74d24b5b RV |
72 | |
73 | # However, when the single-binary PACKAGECONFIG is used, stdbuf | |
74 | # functionality is built into the single coreutils binary, so there's | |
75 | # no point splitting /usr/bin/stdbuf to its own package. Instead, add | |
76 | # an RPROVIDE so that rdepending on coreutils-stdbuf will work | |
77 | # regardless of whether single-binary is in effect. | |
42344347 | 78 | RPROVIDES:coreutils += "${@bb.utils.contains('PACKAGECONFIG', 'single-binary', 'coreutils-stdbuf', '', d)}" |
992cec44 | 79 | |
22ac8745 RY |
80 | # Let aclocal use the relative path for the m4 file rather than the |
81 | # absolute since coreutils has a lot of m4 files, otherwise there might | |
82 | # be an "Argument list too long" error when it is built in a long/deep | |
83 | # directory. | |
84 | acpaths = "-I ./m4" | |
85 | ||
29a6810a | 86 | # Deal with a separate builddir failure if src doesn't exist when creating version.c/version.h |
42344347 | 87 | do_compile:prepend () { |
29a6810a RP |
88 | mkdir -p ${B}/src |
89 | } | |
90 | ||
42344347 | 91 | do_install:class-native() { |
1b5b831d DD |
92 | autotools_do_install |
93 | # remove groups to fix conflict with shadow-native | |
94 | rm -f ${D}${STAGING_BINDIR_NATIVE}/groups | |
95 | # The return is a must since native doesn't need the | |
42344347 | 96 | # do_install:append() in the below. |
1b5b831d DD |
97 | return |
98 | } | |
99 | ||
42344347 | 100 | do_install:append() { |
ae947ffd | 101 | for i in df mktemp nice printenv base64; do mv ${D}${bindir}/$i ${D}${bindir}/$i.${BPN}; done |
98bd03a5 KT |
102 | |
103 | install -d ${D}${base_bindir} | |
4bed7f31 | 104 | [ "${base_bindir}" != "${bindir}" ] && for i in ${base_bindir_progs}; do mv ${D}${bindir}/$i ${D}${base_bindir}/$i.${BPN}; done |
98bd03a5 KT |
105 | |
106 | install -d ${D}${sbindir} | |
4bed7f31 | 107 | [ "${sbindir}" != "${bindir}" ] && for i in ${sbindir_progs}; do mv ${D}${bindir}/$i ${D}${sbindir}/$i.${BPN}; done |
98bd03a5 KT |
108 | |
109 | # [ requires special handling because [.coreutils will cause the sed stuff | |
110 | # in update-alternatives to fail, therefore use lbracket - the name used | |
111 | # for the actual source file. | |
4bed7f31 | 112 | mv ${D}${bindir}/[ ${D}${bindir}/lbracket.${BPN} |
98bd03a5 KT |
113 | } |
114 | ||
4bed7f31 | 115 | inherit update-alternatives |
98bd03a5 | 116 | |
770618eb | 117 | ALTERNATIVE_PRIORITY = "100" |
fbdc6768 CQ |
118 | # Make hostname's priority higher than busybox but lower than net-tools |
119 | ALTERNATIVE_PRIORITY[hostname] = "90" | |
42344347 RP |
120 | ALTERNATIVE:${PN} = "lbracket ${bindir_progs} ${base_bindir_progs} ${sbindir_progs} base32 base64 nice printenv mktemp df" |
121 | ALTERNATIVE:${PN}-doc = "base64.1 nice.1 mktemp.1 df.1 groups.1 kill.1 uptime.1 stat.1 hostname.1" | |
6cc65261 DC |
122 | |
123 | ALTERNATIVE_LINK_NAME[hostname.1] = "${mandir}/man1/hostname.1" | |
98bd03a5 | 124 | |
4bed7f31 MH |
125 | ALTERNATIVE_LINK_NAME[base64] = "${base_bindir}/base64" |
126 | ALTERNATIVE_TARGET[base64] = "${bindir}/base64.${BPN}" | |
1c0bdebb | 127 | ALTERNATIVE_LINK_NAME[base64.1] = "${mandir}/man1/base64.1" |
98bd03a5 | 128 | |
4bed7f31 MH |
129 | ALTERNATIVE_LINK_NAME[mktemp] = "${base_bindir}/mktemp" |
130 | ALTERNATIVE_TARGET[mktemp] = "${bindir}/mktemp.${BPN}" | |
1c0bdebb | 131 | ALTERNATIVE_LINK_NAME[mktemp.1] = "${mandir}/man1/mktemp.1" |
98bd03a5 | 132 | |
4bed7f31 MH |
133 | ALTERNATIVE_LINK_NAME[df] = "${base_bindir}/df" |
134 | ALTERNATIVE_TARGET[df] = "${bindir}/df.${BPN}" | |
1c0bdebb | 135 | ALTERNATIVE_LINK_NAME[df.1] = "${mandir}/man1/df.1" |
98bd03a5 | 136 | |
57b1b20a JR |
137 | ALTERNATIVE_LINK_NAME[nice] = "${base_bindir}/nice" |
138 | ALTERNATIVE_TARGET[nice] = "${bindir}/nice.${BPN}" | |
139 | ALTERNATIVE_LINK_NAME[nice.1] = "${mandir}/man1/nice.1" | |
140 | ||
ae947ffd MJ |
141 | ALTERNATIVE_LINK_NAME[printenv] = "${base_bindir}/printenv" |
142 | ALTERNATIVE_TARGET[printenv] = "${bindir}/printenv.${BPN}" | |
143 | ||
4bed7f31 MH |
144 | ALTERNATIVE_LINK_NAME[lbracket] = "${bindir}/[" |
145 | ALTERNATIVE_TARGET[lbracket] = "${bindir}/lbracket.${BPN}" | |
98bd03a5 | 146 | |
2cff20f4 KK |
147 | ALTERNATIVE_LINK_NAME[groups.1] = "${mandir}/man1/groups.1" |
148 | ALTERNATIVE_LINK_NAME[uptime.1] = "${mandir}/man1/uptime.1" | |
149 | ALTERNATIVE_LINK_NAME[kill.1] = "${mandir}/man1/kill.1" | |
150 | ALTERNATIVE_LINK_NAME[stat.1] = "${mandir}/man1/stat.1" | |
151 | ||
6c120d88 RY |
152 | # The statx() requires glibc >= 2.28 and linux kernel >= 4.11, it doesn't work |
153 | # when glibc >= 2.28 ((Ubuntu 20.04 in docker) and kernel < 4.11 (Host OS | |
154 | # CentOS 7), we can check kernel version and disable it, but that would cause | |
155 | # two different signatures for coreutils-native, so disable it unconditionally | |
156 | # for deterministic build. | |
157 | EXTRA_OECONF:append:class-native = " ac_cv_func_statx=0" | |
158 | ||
4bed7f31 | 159 | python __anonymous() { |
cbb6743d RY |
160 | for prog in d.getVar('base_bindir_progs').split(): |
161 | d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_bindir'), prog)) | |
98bd03a5 | 162 | |
cbb6743d RY |
163 | for prog in d.getVar('sbindir_progs').split(): |
164 | d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('sbindir'), prog)) | |
98bd03a5 KT |
165 | } |
166 | ||
da08f43a | 167 | BBCLASSEXTEND = "native nativesdk" |
9a703f8e TG |
168 | |
169 | inherit ptest | |
170 | ||
42344347 | 171 | RDEPENDS:${PN}-ptest += "bash findutils gawk liberror-perl make perl perl-modules python3-core sed shadow" |
9a703f8e | 172 | |
5463971d | 173 | # -dev automatic dependencies fails as we don't want libmodule-build-perl-dev, its too heavy |
ce20c915 | 174 | # may need tweaking if DEPENDS changes |
a5edae11 | 175 | # Can't use ${PN}-dev here since flags with overrides and key expansion not supported |
42344347 | 176 | RRECOMMENDS:coreutils-dev[nodeprrecs] = "1" |
a5edae11 | 177 | RRECOMMENDS:${PN}-dev += "acl-dev attr-dev gmp-dev libcap-dev bash-dev findutils-dev gawk-dev shadow-dev" |
5463971d | 178 | |
9a703f8e TG |
179 | do_install_ptest () { |
180 | install -d ${D}${PTEST_PATH}/tests | |
181 | cp -r ${S}/tests/* ${D}${PTEST_PATH}/tests | |
182 | sed -i 's/ginstall/install/g' `grep -R ginstall ${D}${PTEST_PATH}/tests | awk -F: '{print $1}' | uniq` | |
183 | install -d ${D}${PTEST_PATH}/build-aux | |
184 | install ${S}/build-aux/test-driver ${D}${PTEST_PATH}/build-aux/ | |
66ea2aab | 185 | install -Dm 0644 ${B}/lib/config.h ${D}${PTEST_PATH}/lib/config.h |
9a703f8e TG |
186 | cp ${B}/Makefile ${D}${PTEST_PATH}/ |
187 | cp ${S}/init.cfg ${D}${PTEST_PATH}/ | |
188 | cp -r ${B}/src ${D}${PTEST_PATH}/ | |
189 | cp -r ${S}/src/*.c ${D}${PTEST_PATH}/src | |
190 | sed -i '/^VPATH/s/= .*$/= ./g' ${D}${PTEST_PATH}/Makefile | |
191 | sed -i '/^PROGRAMS/s/^/#/g' ${D}${PTEST_PATH}/Makefile | |
192 | sed -i '/^Makefile: /s/^.*$/Makefile:/g' ${D}${PTEST_PATH}/Makefile | |
193 | sed -i '/^abs_srcdir/s/= .*$/= \$\{PWD\}/g' ${D}${PTEST_PATH}/Makefile | |
194 | sed -i '/^abs_top_builddir/s/= .*$/= \$\{PWD\}/g' ${D}${PTEST_PATH}/Makefile | |
195 | sed -i '/^abs_top_srcdir/s/= .*$/= \$\{PWD\}/g' ${D}${PTEST_PATH}/Makefile | |
196 | sed -i '/^built_programs/s/ginstall/install/g' ${D}${PTEST_PATH}/Makefile | |
e8ccb880 | 197 | sed -i '/^CC =/s/ --sysroot=.*recipe-sysroot/ /g' ${D}${PTEST_PATH}/Makefile |
9a703f8e TG |
198 | chmod -R 777 ${D}${PTEST_PATH} |
199 | ||
200 | # Disable subcase stty-pairs.sh, it will cause test framework hang | |
201 | sed -i '/stty-pairs.sh/d' ${D}${PTEST_PATH}/Makefile | |
202 | ||
203 | # Disable subcase tail-2/assert.sh as it has issues on 32-bit systems | |
204 | sed -i '/assert.sh/d' ${D}${PTEST_PATH}/Makefile | |
205 | ||
206 | # Tweak test d_type-check to use python3 instead of python | |
207 | sed -i "1s@.*@#!/usr/bin/python3@" ${D}${PTEST_PATH}/tests/d_type-check | |
208 | install ${B}/src/getlimits ${D}/${bindir} | |
209 | ||
210 | # handle multilib | |
211 | sed -i s:@libdir@:${libdir}:g ${D}${PTEST_PATH}/run-ptest | |
212 | } | |
213 | ||
cd31bb50 KR |
214 | do_install_ptest:append:libc-musl () { |
215 | # these tests fail due to bash on musl systems | |
216 | # xmalloc: cannot allocate 16146 bytes | |
217 | sed -i -e '/tests\/dd\/no-allocate.sh/d' ${D}${PTEST_PATH}/Makefile | |
218 | sed -i -e '/tests\/split\/line-bytes.sh/d' ${D}${PTEST_PATH}/Makefile | |
219 | } | |
42344347 | 220 | FILES:${PN}-ptest += "${bindir}/getlimits" |