Name coreutils
Description The basic file, shell and text manipulation utilities
Version 9.7-r1
Package Base coreutils
Homepage https://www.gnu.org/software/coreutils/
Maintainers ['Natanael Copa <ncopa@alpinelinux.org>']
Contributors ['Michael Mason <ms13sp@gmail.com>', 'Valery Kartel <valery.kartel@gmail.com>']
Distro-repo https://gitlab.alpinelinux.org/alpine/aports/-/tree/3.22-stable/main/coreutils
Sources ['https://ftp.gnu.org/gnu/coreutils/coreutils-9.7-r1.tar.xz', 'renameat2-fakeroot.patch']
Dependencies ['/bin/sh', 'coreutils-env', 'coreutils-fmt', 'coreutils-sha512sum', 'libacl.so.1', 'libattr.so.1', 'libc.musl-x86_64.so.1', 'libcrypto.so.3', 'libutmps.so.0.1']
Optional-Dependencies []
Build-Dependencies ['acl-dev', 'attr-dev', 'utmps-dev', 'perl', 'openssl-dev']
Provides ['cmd:[=9.7-r1', 'cmd:b2sum=9.7-r1', 'cmd:base32=9.7-r1', 'cmd:base64=9.7-r1', 'cmd:basename=9.7-r1', 'cmd:basenc=9.7-r1', 'cmd:cat=9.7-r1', 'cmd:chcon=9.7-r1', 'cmd:chgrp=9.7-r1', 'cmd:chmod=9.7-r1', 'cmd:chown=9.7-r1', 'cmd:chroot=9.7-r1', 'cmd:cksum=9.7-r1', 'cmd:comm=9.7-r1', 'cmd:coreutils=9.7-r1', 'cmd:cp=9.7-r1', 'cmd:csplit=9.7-r1', 'cmd:cut=9.7-r1', 'cmd:date=9.7-r1', 'cmd:dd=9.7-r1', 'cmd:df=9.7-r1', 'cmd:dir=9.7-r1', 'cmd:dircolors=9.7-r1', 'cmd:dirname=9.7-r1', 'cmd:du=9.7-r1', 'cmd:echo=9.7-r1', 'cmd:expand=9.7-r1', 'cmd:expr=9.7-r1', 'cmd:factor=9.7-r1', 'cmd:false=9.7-r1', 'cmd:fold=9.7-r1', 'cmd:head=9.7-r1', 'cmd:hostid=9.7-r1', 'cmd:id=9.7-r1', 'cmd:install=9.7-r1', 'cmd:join=9.7-r1', 'cmd:link=9.7-r1', 'cmd:ln=9.7-r1', 'cmd:logname=9.7-r1', 'cmd:ls=9.7-r1', 'cmd:md5sum=9.7-r1', 'cmd:mkdir=9.7-r1', 'cmd:mkfifo=9.7-r1', 'cmd:mknod=9.7-r1', 'cmd:mktemp=9.7-r1', 'cmd:mv=9.7-r1', 'cmd:nice=9.7-r1', 'cmd:nl=9.7-r1', 'cmd:nohup=9.7-r1', 'cmd:nproc=9.7-r1', 'cmd:numfmt=9.7-r1', 'cmd:od=9.7-r1', 'cmd:paste=9.7-r1', 'cmd:pathchk=9.7-r1', 'cmd:pinky=9.7-r1', 'cmd:pr=9.7-r1', 'cmd:printenv=9.7-r1', 'cmd:printf=9.7-r1', 'cmd:ptx=9.7-r1', 'cmd:pwd=9.7-r1', 'cmd:readlink=9.7-r1', 'cmd:realpath=9.7-r1', 'cmd:rm=9.7-r1', 'cmd:rmdir=9.7-r1', 'cmd:runcon=9.7-r1', 'cmd:seq=9.7-r1', 'cmd:sha1sum=9.7-r1', 'cmd:sha224sum=9.7-r1', 'cmd:sha256sum=9.7-r1', 'cmd:sha384sum=9.7-r1', 'cmd:shred=9.7-r1', 'cmd:shuf=9.7-r1', 'cmd:sleep=9.7-r1', 'cmd:sort=9.7-r1', 'cmd:split=9.7-r1', 'cmd:stat=9.7-r1', 'cmd:stdbuf=9.7-r1', 'cmd:stty=9.7-r1', 'cmd:sum=9.7-r1', 'cmd:sync=9.7-r1', 'cmd:tac=9.7-r1', 'cmd:tail=9.7-r1', 'cmd:tee=9.7-r1', 'cmd:test=9.7-r1', 'cmd:timeout=9.7-r1', 'cmd:touch=9.7-r1', 'cmd:tr=9.7-r1', 'cmd:true=9.7-r1', 'cmd:truncate=9.7-r1', 'cmd:tsort=9.7-r1', 'cmd:tty=9.7-r1', 'cmd:uname=9.7-r1', 'cmd:unexpand=9.7-r1', 'cmd:uniq=9.7-r1', 'cmd:unlink=9.7-r1', 'cmd:users=9.7-r1', 'cmd:vdir=9.7-r1', 'cmd:wc=9.7-r1', 'cmd:who=9.7-r1', 'cmd:whoami=9.7-r1', 'cmd:yes=9.7-r1']
Builddate 16-04-2025 17:39:05
Architecture x86_64
Distro-Version v3.22
Licenses ['GPL-3.0-or-later']
Hash Q1z5gZ2G5hd/0cZGPzPbaZP6zF9Fg=
# Contributor: Valery Kartel <valery.kartel@gmail.com>
# Contributor: Michael Mason <ms13sp@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=coreutils
pkgver=9.7
pkgrel=1
pkgdesc="The basic file, shell and text manipulation utilities"
url="https://www.gnu.org/software/coreutils/"
arch="all"
license="GPL-3.0-or-later"
makedepends="acl-dev attr-dev utmps-dev perl openssl-dev"
subpackages="$pkgname-doc $pkgname-env $pkgname-fmt $pkgname-sha512sum:_sha512sum"
install="$pkgname.post-deinstall"
source="https://ftp.gnu.org/gnu/coreutils/coreutils-$pkgver.tar.xz
	renameat2-fakeroot.patch
	"
options="!check" # FAIL: tests/cp/reflink-auto

# secfixes:
#   9.4-r2:
#     - CVE-2024-0684
#   8.30-r0:
#     - CVE-2017-18018

build() {
	# statvfs API is broken on 32 bit and musl implementation is equally
	# broken on 64 bit. Avoid using it.
	# https://lists.gnu.org/archive/html/bug-coreutils/2024-08/msg00021.html
	fu_cv_sys_stat_statvfs=n \
	CFLAGS="$CFLAGS -I/usr/include/utmps -flto=auto" \
	LIBS="-lutmps -lskarnet" \
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--bindir=/bin \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--disable-nls \
		--enable-no-install-program=hostname,su,kill,uptime \
		--enable-single-binary=symlinks \
		--enable-single-binary-exceptions=env,fmt,sha512sum \
		--with-openssl
	make
}

check() {
	make check
}

package() {
	# we put this separately
	depends="
		coreutils-env=$pkgver-r$pkgrel
		coreutils-fmt=$pkgver-r$pkgrel
		coreutils-sha512sum=$pkgver-r$pkgrel
		"
	make DESTDIR="$pkgdir" install

	rm -rf "$pkgdir"/usr/lib/charset.alias
	rmdir -p "$pkgdir"/usr/lib 2>/dev/null || true

	install -d "$pkgdir"/usr/bin "$pkgdir"/usr/sbin

	for i in "$pkgdir"/bin/*; do
		case "${i##*/}" in
			# Keep some binaries in /bin to replace busybox symlinks
			base64|cat|chgrp|chmod|chown|cp|date|dd|df|echo|false|ln|ls|mkdir|\
			mknod|mktemp|mv|nice|printenv|pwd|rm|rmdir|sleep|stat|stty|sync|\
			touch|true|uname|coreutils|link) ;;
			*)
				if [ -L "$i" ]; then
					rm "$i"
					ln -s ../../bin/coreutils "$pkgdir/usr/bin/${i##*/}"
				else
					mv "$i" "$pkgdir"/usr/bin/
				fi
				;;
		esac
	done

	# chroot lives in /usr/sbin with busybox
	rm "$pkgdir"/usr/bin/chroot
	ln -s ../../bin/coreutils "$pkgdir"/usr/sbin/chroot

	# resolve conflict between shadow and coreutils for cmd:groups
	rm "$pkgdir"/usr/bin/groups
}

env() {
	amove usr/bin/env
}

fmt() {
	amove usr/bin/fmt
}

_sha512sum() {
	amove usr/bin/sha512sum
}

sha512sums="
fe81e6ba4fb492095153d5baac1eca8f07ece0957849de746a2a858cf007893cc2ded595a31a5e5d43d13216cc44b9d74a3245d9f23221ecc8cd00f428f27414  coreutils-9.7.tar.xz
a0317f6f42a0f821c6ec6745ff0f6be4ed9d2330ef1f886947a80a0f24dcddc6a28660c1d661da996577cc26b02c095a8aa058e553050acf90bce445ab07136a  renameat2-fakeroot.patch
"