void-packages/srcpkgs/coreutils/template

115 lines
3.4 KiB
Bash

# Template file for 'coreutils'
pkgname=coreutils
version=8.29
revision=1
bootstrap=yes
makedepends="gmp-devel acl-devel libcap-devel"
replaces="chroot-coreutils>=0 coreutils-doc>=0 b2sum>=0"
short_desc="The GNU core utilities"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
homepage="http://www.gnu.org/software/coreutils"
license="GPL-3"
distfiles="${GNU_SITE}/coreutils/coreutils-${version}.tar.xz"
checksum=92d0fa1c311cacefa89853bdb53c62f4110cdfda3820346b59cbd098f40f955e
make_check_args="RUN_EXPENSIVE_TESTS=1"
if [ "$CHROOT_READY" ]; then
hostmakedepends="perl"
fi
alternatives="
hostname:hostname:/usr/bin/hostname-coreutils
hostname:hostname.1:/usr/share/man/man1/hostname-coreutils.1
"
pre_configure() {
# Build natively all utils for the host, we need this to generate
# the manpages via help2man.
if [ "$CROSS_BUILD" ]; then
CC=cc LD=ld AR=ar RANLIB=ranlib CFLAGS=-Os CXXFLAGS=-Os LDFLAGS= \
./configure --prefix=${wrksrc}/coreutils-${XBPS_MACHINE} \
--enable-install-program=arch,hostname \
--enable-no-install-program=kill,uptime
make ${makejobs}
make install
make distclean
fi
}
do_configure() {
if [ "$CROSS_BUILD" ]; then
configure_args+=" fu_cv_sys_stat_statfs2_bsize=no
gl_cv_func_working_mkstemp=yes
gl_cv_func_working_acl_get_file=yes "
fi
case "$XBPS_TARGET_MACHINE" in
# XXX syncfs() in src/sync.c expects a return value.
*-musl) configure_args+=" ac_cv_func_syncfs=no";;
esac
#
# Do not install kill: provided by util-linux.
# Do not install uptime: provided by procps-ng.
#
./configure ${configure_args} \
--enable-install-program=arch,hostname \
--enable-no-install-program=kill,uptime \
--disable-rpath
if [ "$CROSS_BUILD" ]; then
# Use install when cross compiling
sed -i Makefile -e 's;^\(cu_install_program =\).*;\1 install;'
fi
}
do_build() {
if [ "$CROSS_BUILD" ]; then
cp Makefile Makefile.orig
sed '/src_make_prime_list/d' Makefile.orig > Makefile
depbase=$(echo src/make-prime-list.o | sed 's|[^/]*$|.deps/&|;s|\.o$||');\
cc -std=gnu99 -I. -I./lib -Ilib -I./lib -Isrc -I./src \
-fdiagnostics-show-option -funit-at-a-time -g -O2 -MT \
src/make-prime-list.o -MD -MP -MF $depbase.Tpo -c -o src/make-prime-list.o \
src/make-prime-list.c &&
mv -f $depbase.Tpo $depbase.Po
cc -std=gnu99 -fdiagnostics-show-option -funit-at-a-time -g -O2 \
-Wl,--as-needed -o src/make-prime-list src/make-prime-list.o
cp Makefile Makefile.bak
sed -e '/hostname.1/d' Makefile.bak > Makefile
fi
make ${makejobs}
}
pre_check() {
# chgrp tests fail inside a chroot
sed -i '/tests\/chgrp/d' Makefile
exeext_tests="fchownat chown lchown chdir canonizalize calloc-gnu"
sh_tests="c-strcase"
case "$XBPS_TARGET_MACHINE" in
*-musl* )
# Disable locale tests that fail on musl
exeext_tests+=" localename getlogin getcwd"
sh_tests+=" mbrtowc5"
;;
esac
for test in $exeext_tests ; do
sed -i "/test-$test\$(EXEEXT)/d" gnulib-tests/Makefile
done
for test in $sh_tests ; do
sed -i "/test-$test.sh/d" gnulib-tests/Makefile
done
}
do_install() {
make DESTDIR=${DESTDIR} install
if [ "$CROSS_BUILD" ]; then
mv ${wrksrc}/coreutils-${XBPS_MACHINE}/share/man \
${DESTDIR}/usr/share
# provided by procps-ng
rm -f ${DESTDIR}/usr/share/man/man1/{kill,uptime}.1
fi
mv ${DESTDIR}/usr/bin/hostname ${DESTDIR}/usr/bin/hostname-coreutils
mv ${DESTDIR}/usr/share/man/man1/hostname.1 ${DESTDIR}/usr/share/man/man1/hostname-coreutils.1
}