--- /usr/portage/eclass/kernel-2.eclass 2006-10-26 09:05:59.000000000 +0200 +++ kernel-2.eclass 2006-11-28 14:02:50.000000000 +0100 @@ -294,7 +294,7 @@ SLOT="${PVR}" DESCRIPTION="Sources for the ${KV_MAJOR}.${KV_MINOR} linux kernel" - IUSE="symlink build" + IUSE="symlink build no_other_archs" elif [[ ${ETYPE} == headers ]]; then DESCRIPTION="Linux system headers" @@ -991,6 +991,54 @@ "$@" } +#This function removes the arch specific stuff +remove_other_archs() { + + #The arch should include all the available architectures + cd ${S}/arch + + #The sources are not completely separated, so we would need to make + case "${ARCH}" in + "x86") + KEEP="i386 x86_64" + ;; + *) + ;; + esac + + #If no KEEP is defined, no one has taken time to consider what to remove. + #Better safe than sorry, do nothing + if [ -n "${KEEP}" ] + then + + #Double loop, remove every directory, except if they are in $KEEP + for dir in * + do + #Check if we have this directory in $KEEP + for keep in ${KEEP} + do + k=1 + if [ "${dir}" = "${keep}" ] + then + k=0 + break + fi + done + + #If not in $KEEP, remove + if [ ${k} -ne 0 ] + then + #We remove 'arch/*', 'include/asm-*' + #and relevant 'Documentation' + rm -rf ${dir} + rm -rf ../include/asm-${dir} + rm -rf ../Documentation/${dir} + fi + done + fi +} + + # common functions #============================================================== kernel-2_src_unpack() { @@ -1023,6 +1071,8 @@ kernel_is 2 4 && unpack_2_4 kernel_is 2 6 && unpack_2_6 fi + + use no_other_archs && remove_other_archs } kernel-2_src_compile() {