summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2013-12-01 19:06:19 +0000
committerRobin H. Johnson <robbat2@gentoo.org>2013-12-01 19:06:19 +0000
commit461374b535894fd2715ed19558f313ec8d99eed6 (patch)
treeec4c3ffde013f7c7cf4c840c1559e7d10d301181 /eclass/linux-mod.eclass
parentsci-libs/flann: only depend on hdf5 with USE=mpi and tests, #492584; thanks n... (diff)
downloadgentoo-2-461374b535894fd2715ed19558f313ec8d99eed6.tar.gz
gentoo-2-461374b535894fd2715ed19558f313ec8d99eed6.tar.bz2
gentoo-2-461374b535894fd2715ed19558f313ec8d99eed6.zip
MODULES_OPTIONAL_USE makes it possible to optionally use linux-mod without introducing dependencies on virtual/linux-sources or virtual/modutils where unwanted.
Diffstat (limited to 'eclass/linux-mod.eclass')
-rw-r--r--eclass/linux-mod.eclass23
1 files changed, 19 insertions, 4 deletions
diff --git a/eclass/linux-mod.eclass b/eclass/linux-mod.eclass
index 04f382a3aab7..b5502a965b1a 100644
--- a/eclass/linux-mod.eclass
+++ b/eclass/linux-mod.eclass
@@ -1,6 +1,6 @@
-# Copyright 1999-2012 Gentoo Foundation
+# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/linux-mod.eclass,v 1.113 2013/08/24 11:07:23 ssuominen Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/linux-mod.eclass,v 1.114 2013/12/01 19:06:19 robbat2 Exp $
# @ECLASS: linux-mod.eclass
# @MAINTAINER:
@@ -18,6 +18,11 @@
# A Couple of env vars are available to effect usage of this eclass
# These are as follows:
+# @ECLASS-VARIABLE: MODULES_OPTIONAL_USE
+# @DESCRIPTION:
+# A string containing the USE flag to use for making this eclass optional
+# The recommended non-empty value is 'modules'
+
# @ECLASS-VARIABLE: KERNEL_DIR
# @DESCRIPTION:
# A string containing the directory of the target kernel sources. The default value is
@@ -127,10 +132,12 @@ EXPORT_FUNCTIONS pkg_setup pkg_preinst pkg_postinst src_install src_compile pkg_
IUSE="kernel_linux"
SLOT="0"
-RDEPEND="kernel_linux? ( virtual/modutils )"
+RDEPEND="${MODULES_OPTIONAL_USE}${MODULES_OPTIONAL_USE:+? (} kernel_linux? ( virtual/modutils ) ${MODULES_OPTIONAL_USE:+)}"
DEPEND="${RDEPEND}
+ ${MODULES_OPTIONAL_USE}${MODULES_OPTIONAL_USE:+? (}
sys-apps/sed
- kernel_linux? ( virtual/linux-sources )"
+ kernel_linux? ( virtual/linux-sources )
+ ${MODULES_OPTIONAL_USE:+)}"
# eclass utilities
# ----------------------------------
@@ -140,6 +147,7 @@ check_vermagic() {
local curr_gcc_ver=$(gcc -dumpversion)
local tmpfile old_chost old_gcc_ver result=0
+ [ -n "${MODULES_OPTIONAL_USE}" ] && use !${MODULES_OPTIONAL_USE} && return
tmpfile=`find "${KV_DIR}/" -iname "*.o.cmd" -exec grep usr/lib/gcc {} \; -quit`
tmpfile=${tmpfile//*usr/lib}
@@ -344,6 +352,7 @@ get-KERNEL_CC() {
# At the end the documentation specified with MODULESD_<modulename>_DOCS is installed.
generate_modulesd() {
debug-print-function ${FUNCNAME} $*
+ [ -n "${MODULES_OPTIONAL_USE}" ] && use !${MODULES_OPTIONAL_USE} && return
local currm_path currm currm_t t myIFS myVAR
local module_docs module_enabled module_aliases \
@@ -542,6 +551,7 @@ find_module_params() {
# in the kernel and sets the object extension KV_OBJ.
linux-mod_pkg_setup() {
debug-print-function ${FUNCNAME} $*
+ [ -n "${MODULES_OPTIONAL_USE}" ] && use !${MODULES_OPTIONAL_USE} && return
local is_bin="${MERGE_TYPE}"
@@ -605,6 +615,7 @@ strip_modulenames() {
# Look at the description of these variables for more details.
linux-mod_src_compile() {
debug-print-function ${FUNCNAME} $*
+ [ -n "${MODULES_OPTIONAL_USE}" ] && use !${MODULES_OPTIONAL_USE} && return
local modulename libdir srcdir objdir i n myABI="${ABI}"
set_arch_to_kernel
@@ -670,6 +681,7 @@ linux-mod_src_compile() {
# Look at the description of these variables for more details.
linux-mod_src_install() {
debug-print-function ${FUNCNAME} $*
+ [ -n "${MODULES_OPTIONAL_USE}" ] && use !${MODULES_OPTIONAL_USE} && return
local modulename libdir srcdir objdir i n
@@ -700,6 +712,7 @@ linux-mod_src_install() {
# It checks what to do after having merged the package.
linux-mod_pkg_preinst() {
debug-print-function ${FUNCNAME} $*
+ [ -n "${MODULES_OPTIONAL_USE}" ] && use !${MODULES_OPTIONAL_USE} && return
[ -d "${D}lib/modules" ] && UPDATE_DEPMOD=true || UPDATE_DEPMOD=false
[ -d "${D}lib/modules" ] && UPDATE_MODULEDB=true || UPDATE_MODULEDB=false
@@ -711,6 +724,7 @@ linux-mod_pkg_preinst() {
# database (if ${D}/lib/modules is created)"
linux-mod_pkg_postinst() {
debug-print-function ${FUNCNAME} $*
+ [ -n "${MODULES_OPTIONAL_USE}" ] && use !${MODULES_OPTIONAL_USE} && return
${UPDATE_DEPMOD} && update_depmod;
${UPDATE_MODULEDB} && update_moduledb;
@@ -722,5 +736,6 @@ linux-mod_pkg_postinst() {
# call /sbin/depmod because the modules are still installed.
linux-mod_pkg_postrm() {
debug-print-function ${FUNCNAME} $*
+ [ -n "${MODULES_OPTIONAL_USE}" ] && use !${MODULES_OPTIONAL_USE} && return
remove_moduledb;
}