| 1 |
# Copyright 1999-2012 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: /var/cvsroot/gentoo-x86/sys-apps/coreutils/coreutils-8.17.ebuild,v 1.2 2012/05/24 02:33:02 vapier Exp $
|
| 4 |
|
| 5 |
EAPI="3"
|
| 6 |
|
| 7 |
inherit eutils flag-o-matic toolchain-funcs
|
| 8 |
|
| 9 |
PATCH_VER="1.1"
|
| 10 |
DESCRIPTION="Standard GNU file utilities (chmod, cp, dd, dir, ls...), text utilities (sort, tr, head, wc..), and shell utilities (whoami, who,...)"
|
| 11 |
HOMEPAGE="http://www.gnu.org/software/coreutils/"
|
| 12 |
SRC_URI="mirror://gnu-alpha/coreutils/${P}.tar.xz
|
| 13 |
mirror://gnu/${PN}/${P}.tar.xz
|
| 14 |
mirror://gentoo/${P}.tar.xz
|
| 15 |
mirror://gentoo/${P}-patches-${PATCH_VER}.tar.xz
|
| 16 |
http://dev.gentoo.org/~ryao/dist/${P}-patches-${PATCH_VER}.tar.xz"
|
| 17 |
|
| 18 |
LICENSE="GPL-3"
|
| 19 |
SLOT="0"
|
| 20 |
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd"
|
| 21 |
IUSE="acl caps gmp nls selinux static unicode userland_BSD vanilla xattr"
|
| 22 |
|
| 23 |
RDEPEND="caps? ( sys-libs/libcap )
|
| 24 |
gmp? ( dev-libs/gmp )
|
| 25 |
selinux? ( sys-libs/libselinux )
|
| 26 |
acl? ( sys-apps/acl )
|
| 27 |
xattr? ( !userland_BSD? ( sys-apps/attr ) )
|
| 28 |
nls? ( >=sys-devel/gettext-0.15 )
|
| 29 |
!app-misc/realpath
|
| 30 |
!<sys-apps/util-linux-2.13
|
| 31 |
!sys-apps/stat
|
| 32 |
!net-mail/base64
|
| 33 |
!sys-apps/mktemp
|
| 34 |
!<app-forensics/tct-1.18-r1
|
| 35 |
!<net-fs/netatalk-2.0.3-r4
|
| 36 |
!<sci-chemistry/ccp4-6.1.1"
|
| 37 |
DEPEND="${RDEPEND}
|
| 38 |
app-arch/xz-utils"
|
| 39 |
|
| 40 |
src_prepare() {
|
| 41 |
if ! use vanilla ; then
|
| 42 |
use unicode || rm -f "${WORKDIR}"/patch/000_all_coreutils-i18n.patch
|
| 43 |
EPATCH_SUFFIX="patch" \
|
| 44 |
PATCHDIR="${WORKDIR}/patch" \
|
| 45 |
EPATCH_EXCLUDE="001_all_coreutils-gen-progress-bar.patch" \
|
| 46 |
epatch
|
| 47 |
fi
|
| 48 |
|
| 49 |
# Since we've patched many .c files, the make process will try to
|
| 50 |
# re-build the manpages by running `./bin --help`. When doing a
|
| 51 |
# cross-compile, we can't do that since 'bin' isn't a native bin.
|
| 52 |
# Also, it's not like we changed the usage on any of these things,
|
| 53 |
# so let's just update the timestamps and skip the help2man step.
|
| 54 |
set -- man/*.x
|
| 55 |
tc-is-cross-compiler && touch ${@/%x/1}
|
| 56 |
|
| 57 |
# Avoid perl dep for compiled in dircolors default #348642
|
| 58 |
if ! has_version dev-lang/perl ; then
|
| 59 |
touch src/dircolors.h
|
| 60 |
touch ${@/%x/1}
|
| 61 |
fi
|
| 62 |
}
|
| 63 |
|
| 64 |
src_configure() {
|
| 65 |
local myconf=''
|
| 66 |
if tc-is-cross-compiler && [[ ${CHOST} == *linux* ]] ; then
|
| 67 |
export fu_cv_sys_stat_statfs2_bsize=yes #311569
|
| 68 |
export gl_cv_func_realpath_works=yes #416629
|
| 69 |
fi
|
| 70 |
|
| 71 |
export gl_cv_func_mknod_works=yes #409919
|
| 72 |
use static && append-ldflags -static && sed -i '/elf_sys=yes/s:yes:no:' configure #321821
|
| 73 |
use selinux || export ac_cv_{header_selinux_{context,flash,selinux}_h,search_setfilecon}=no #301782
|
| 74 |
use userland_BSD && myconf="${myconf} -program-prefix=g --program-transform-name=s/stat/nustat/"
|
| 75 |
# kill/uptime - procps
|
| 76 |
# groups/su - shadow
|
| 77 |
# hostname - net-tools
|
| 78 |
econf \
|
| 79 |
--with-packager="Gentoo" \
|
| 80 |
--with-packager-version="${PVR} (p${PATCH_VER:-0})" \
|
| 81 |
--with-packager-bug-reports="http://bugs.gentoo.org/" \
|
| 82 |
--enable-install-program="arch" \
|
| 83 |
--enable-no-install-program="groups,hostname,kill,su,uptime" \
|
| 84 |
--enable-largefile \
|
| 85 |
$(use caps || echo --disable-libcap) \
|
| 86 |
$(use_enable nls) \
|
| 87 |
$(use_enable acl) \
|
| 88 |
$(use_enable xattr) \
|
| 89 |
$(use_with gmp) \
|
| 90 |
${myconf}
|
| 91 |
}
|
| 92 |
|
| 93 |
src_test() {
|
| 94 |
# Non-root tests will fail if the full path isnt
|
| 95 |
# accessible to non-root users
|
| 96 |
chmod -R go-w "${WORKDIR}"
|
| 97 |
chmod a+rx "${WORKDIR}"
|
| 98 |
|
| 99 |
# coreutils tests like to do `mount` and such with temp dirs
|
| 100 |
# so make sure /etc/mtab is writable #265725
|
| 101 |
# make sure /dev/loop* can be mounted #269758
|
| 102 |
mkdir -p "${T}"/mount-wrappers
|
| 103 |
mkwrap() {
|
| 104 |
local w ww
|
| 105 |
for w in "$@" ; do
|
| 106 |
ww="${T}/mount-wrappers/${w}"
|
| 107 |
cat <<-EOF > "${ww}"
|
| 108 |
#!/bin/sh
|
| 109 |
exec env SANDBOX_WRITE="\${SANDBOX_WRITE}:/etc/mtab:/dev/loop" $(type -P $w) "\$@"
|
| 110 |
EOF
|
| 111 |
chmod a+rx "${ww}"
|
| 112 |
done
|
| 113 |
}
|
| 114 |
mkwrap mount umount
|
| 115 |
|
| 116 |
addwrite /dev/full
|
| 117 |
#export RUN_EXPENSIVE_TESTS="yes"
|
| 118 |
#export FETISH_GROUPS="portage wheel"
|
| 119 |
env PATH="${T}/mount-wrappers:${PATH}" \
|
| 120 |
emake -j1 -k check || die "make check failed"
|
| 121 |
}
|
| 122 |
|
| 123 |
src_install() {
|
| 124 |
emake install DESTDIR="${D}" || die
|
| 125 |
dodoc AUTHORS ChangeLog* NEWS README* THANKS TODO
|
| 126 |
|
| 127 |
insinto /etc
|
| 128 |
newins src/dircolors.hin DIR_COLORS || die
|
| 129 |
|
| 130 |
if [[ ${USERLAND} == "GNU" ]] ; then
|
| 131 |
cd "${D}"/usr/bin
|
| 132 |
dodir /bin
|
| 133 |
# move critical binaries into /bin (required by FHS)
|
| 134 |
local fhs="cat chgrp chmod chown cp date dd df echo false ln ls
|
| 135 |
mkdir mknod mv pwd rm rmdir stty sync true uname"
|
| 136 |
mv ${fhs} ../../bin/ || die "could not move fhs bins"
|
| 137 |
# move critical binaries into /bin (common scripts)
|
| 138 |
local com="basename chroot cut dir dirname du env expr head mkfifo
|
| 139 |
mktemp readlink seq sleep sort tail touch tr tty vdir wc yes"
|
| 140 |
mv ${com} ../../bin/ || die "could not move common bins"
|
| 141 |
# create a symlink for uname in /usr/bin/ since autotools require it
|
| 142 |
local x
|
| 143 |
for x in ${com} uname ; do
|
| 144 |
dosym /bin/${x} /usr/bin/${x} || die
|
| 145 |
done
|
| 146 |
else
|
| 147 |
# For now, drop the man pages, collides with the ones of the system.
|
| 148 |
rm -rf "${D}"/usr/share/man
|
| 149 |
fi
|
| 150 |
}
|
| 151 |
|
| 152 |
pkg_postinst() {
|
| 153 |
ewarn "Make sure you run 'hash -r' in your active shells."
|
| 154 |
ewarn "You should also re-source your shell settings for LS_COLORS"
|
| 155 |
ewarn " changes, such as: source /etc/profile"
|
| 156 |
|
| 157 |
# /bin/dircolors sometimes sticks around #224823
|
| 158 |
if [ -e "${ROOT}/usr/bin/dircolors" ] && [ -e "${ROOT}/bin/dircolors" ] ; then
|
| 159 |
if strings "${ROOT}/bin/dircolors" | grep -qs "GNU coreutils" ; then
|
| 160 |
einfo "Deleting orphaned GNU /bin/dircolors for you"
|
| 161 |
rm -f "${ROOT}/bin/dircolors"
|
| 162 |
fi
|
| 163 |
fi
|
| 164 |
|
| 165 |
# Help out users using experimental filesystems
|
| 166 |
if grep -qs btrfs "${ROOT}"/etc/fstab /proc/mounts ; then
|
| 167 |
case $(uname -r) in
|
| 168 |
2.6.[12][0-9]|2.6.3[0-7]*)
|
| 169 |
ewarn "You are running a system with a buggy btrfs driver."
|
| 170 |
ewarn "Please upgrade your kernel to avoid silent corruption."
|
| 171 |
ewarn "See: https://bugs.gentoo.org/353907"
|
| 172 |
;;
|
| 173 |
esac
|
| 174 |
fi
|
| 175 |
}
|