/[gentoo-x86]/eclass/linux-mod.eclass
Gentoo

Diff of /eclass/linux-mod.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.113 Revision 1.114
1# Copyright 1999-2012 Gentoo Foundation 1# Copyright 1999-2013 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/linux-mod.eclass,v 1.113 2013/08/24 11:07:23 ssuominen Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/linux-mod.eclass,v 1.114 2013/12/01 19:06:19 robbat2 Exp $
4 4
5# @ECLASS: linux-mod.eclass 5# @ECLASS: linux-mod.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# kernel-misc@gentoo.org 7# kernel-misc@gentoo.org
8# @AUTHOR: 8# @AUTHOR:
16# tree. 16# tree.
17 17
18# A Couple of env vars are available to effect usage of this eclass 18# A Couple of env vars are available to effect usage of this eclass
19# These are as follows: 19# These are as follows:
20 20
21# @ECLASS-VARIABLE: MODULES_OPTIONAL_USE
22# @DESCRIPTION:
23# A string containing the USE flag to use for making this eclass optional
24# The recommended non-empty value is 'modules'
25
21# @ECLASS-VARIABLE: KERNEL_DIR 26# @ECLASS-VARIABLE: KERNEL_DIR
22# @DESCRIPTION: 27# @DESCRIPTION:
23# A string containing the directory of the target kernel sources. The default value is 28# A string containing the directory of the target kernel sources. The default value is
24# "/usr/src/linux" 29# "/usr/src/linux"
25 30
125inherit eutils linux-info multilib 130inherit eutils linux-info multilib
126EXPORT_FUNCTIONS pkg_setup pkg_preinst pkg_postinst src_install src_compile pkg_postrm 131EXPORT_FUNCTIONS pkg_setup pkg_preinst pkg_postinst src_install src_compile pkg_postrm
127 132
128IUSE="kernel_linux" 133IUSE="kernel_linux"
129SLOT="0" 134SLOT="0"
130RDEPEND="kernel_linux? ( virtual/modutils )" 135RDEPEND="${MODULES_OPTIONAL_USE}${MODULES_OPTIONAL_USE:+? (} kernel_linux? ( virtual/modutils ) ${MODULES_OPTIONAL_USE:+)}"
131DEPEND="${RDEPEND} 136DEPEND="${RDEPEND}
137 ${MODULES_OPTIONAL_USE}${MODULES_OPTIONAL_USE:+? (}
132 sys-apps/sed 138 sys-apps/sed
133 kernel_linux? ( virtual/linux-sources )" 139 kernel_linux? ( virtual/linux-sources )
140 ${MODULES_OPTIONAL_USE:+)}"
134 141
135# eclass utilities 142# eclass utilities
136# ---------------------------------- 143# ----------------------------------
137 144
138check_vermagic() { 145check_vermagic() {
139 debug-print-function ${FUNCNAME} $* 146 debug-print-function ${FUNCNAME} $*
140 147
141 local curr_gcc_ver=$(gcc -dumpversion) 148 local curr_gcc_ver=$(gcc -dumpversion)
142 local tmpfile old_chost old_gcc_ver result=0 149 local tmpfile old_chost old_gcc_ver result=0
150 [ -n "${MODULES_OPTIONAL_USE}" ] && use !${MODULES_OPTIONAL_USE} && return
143 151
144 tmpfile=`find "${KV_DIR}/" -iname "*.o.cmd" -exec grep usr/lib/gcc {} \; -quit` 152 tmpfile=`find "${KV_DIR}/" -iname "*.o.cmd" -exec grep usr/lib/gcc {} \; -quit`
145 tmpfile=${tmpfile//*usr/lib} 153 tmpfile=${tmpfile//*usr/lib}
146 tmpfile=${tmpfile//\/include*} 154 tmpfile=${tmpfile//\/include*}
147 old_chost=${tmpfile//*gcc\/} 155 old_chost=${tmpfile//*gcc\/}
342# MODULESD_<modulename>_ALIASES, MODULESD_<modulename>_ADDITION and MODULESD_<modulename>_DOCS). 350# MODULESD_<modulename>_ALIASES, MODULESD_<modulename>_ADDITION and MODULESD_<modulename>_DOCS).
343# 351#
344# At the end the documentation specified with MODULESD_<modulename>_DOCS is installed. 352# At the end the documentation specified with MODULESD_<modulename>_DOCS is installed.
345generate_modulesd() { 353generate_modulesd() {
346 debug-print-function ${FUNCNAME} $* 354 debug-print-function ${FUNCNAME} $*
355 [ -n "${MODULES_OPTIONAL_USE}" ] && use !${MODULES_OPTIONAL_USE} && return
347 356
348 local currm_path currm currm_t t myIFS myVAR 357 local currm_path currm currm_t t myIFS myVAR
349 local module_docs module_enabled module_aliases \ 358 local module_docs module_enabled module_aliases \
350 module_additions module_examples module_modinfo module_opts 359 module_additions module_examples module_modinfo module_opts
351 360
540# It checks the CONFIG_CHECK options (see linux-info.eclass(5)), verifies that the kernel is 549# It checks the CONFIG_CHECK options (see linux-info.eclass(5)), verifies that the kernel is
541# configured, verifies that the sources are prepared, verifies that the modules support is builtin 550# configured, verifies that the sources are prepared, verifies that the modules support is builtin
542# in the kernel and sets the object extension KV_OBJ. 551# in the kernel and sets the object extension KV_OBJ.
543linux-mod_pkg_setup() { 552linux-mod_pkg_setup() {
544 debug-print-function ${FUNCNAME} $* 553 debug-print-function ${FUNCNAME} $*
554 [ -n "${MODULES_OPTIONAL_USE}" ] && use !${MODULES_OPTIONAL_USE} && return
545 555
546 local is_bin="${MERGE_TYPE}" 556 local is_bin="${MERGE_TYPE}"
547 557
548 # If we are installing a binpkg, take a different path. 558 # If we are installing a binpkg, take a different path.
549 # use MERGE_TYPE if available (eapi>=4); else use non-PMS EMERGE_FROM (eapi<4) 559 # use MERGE_TYPE if available (eapi>=4); else use non-PMS EMERGE_FROM (eapi<4)
603# happens inside ${srcdir}. 613# happens inside ${srcdir}.
604# 614#
605# Look at the description of these variables for more details. 615# Look at the description of these variables for more details.
606linux-mod_src_compile() { 616linux-mod_src_compile() {
607 debug-print-function ${FUNCNAME} $* 617 debug-print-function ${FUNCNAME} $*
618 [ -n "${MODULES_OPTIONAL_USE}" ] && use !${MODULES_OPTIONAL_USE} && return
608 619
609 local modulename libdir srcdir objdir i n myABI="${ABI}" 620 local modulename libdir srcdir objdir i n myABI="${ABI}"
610 set_arch_to_kernel 621 set_arch_to_kernel
611 ABI="${KERNEL_ABI}" 622 ABI="${KERNEL_ABI}"
612 623
668# MODULESD_<modulename>_DOCS is also installed. 679# MODULESD_<modulename>_DOCS is also installed.
669# 680#
670# Look at the description of these variables for more details. 681# Look at the description of these variables for more details.
671linux-mod_src_install() { 682linux-mod_src_install() {
672 debug-print-function ${FUNCNAME} $* 683 debug-print-function ${FUNCNAME} $*
684 [ -n "${MODULES_OPTIONAL_USE}" ] && use !${MODULES_OPTIONAL_USE} && return
673 685
674 local modulename libdir srcdir objdir i n 686 local modulename libdir srcdir objdir i n
675 687
676 strip_modulenames; 688 strip_modulenames;
677 for i in ${MODULE_NAMES} 689 for i in ${MODULE_NAMES}
698# @FUNCTION: linux-mod_pkg_preinst 710# @FUNCTION: linux-mod_pkg_preinst
699# @DESCRIPTION: 711# @DESCRIPTION:
700# It checks what to do after having merged the package. 712# It checks what to do after having merged the package.
701linux-mod_pkg_preinst() { 713linux-mod_pkg_preinst() {
702 debug-print-function ${FUNCNAME} $* 714 debug-print-function ${FUNCNAME} $*
715 [ -n "${MODULES_OPTIONAL_USE}" ] && use !${MODULES_OPTIONAL_USE} && return
703 716
704 [ -d "${D}lib/modules" ] && UPDATE_DEPMOD=true || UPDATE_DEPMOD=false 717 [ -d "${D}lib/modules" ] && UPDATE_DEPMOD=true || UPDATE_DEPMOD=false
705 [ -d "${D}lib/modules" ] && UPDATE_MODULEDB=true || UPDATE_MODULEDB=false 718 [ -d "${D}lib/modules" ] && UPDATE_MODULEDB=true || UPDATE_MODULEDB=false
706} 719}
707 720
709# @DESCRIPTION: 722# @DESCRIPTION:
710# It executes /sbin/depmod and adds the package to the /var/lib/module-rebuild/moduledb 723# It executes /sbin/depmod and adds the package to the /var/lib/module-rebuild/moduledb
711# database (if ${D}/lib/modules is created)" 724# database (if ${D}/lib/modules is created)"
712linux-mod_pkg_postinst() { 725linux-mod_pkg_postinst() {
713 debug-print-function ${FUNCNAME} $* 726 debug-print-function ${FUNCNAME} $*
727 [ -n "${MODULES_OPTIONAL_USE}" ] && use !${MODULES_OPTIONAL_USE} && return
714 728
715 ${UPDATE_DEPMOD} && update_depmod; 729 ${UPDATE_DEPMOD} && update_depmod;
716 ${UPDATE_MODULEDB} && update_moduledb; 730 ${UPDATE_MODULEDB} && update_moduledb;
717} 731}
718 732
720# @DESCRIPTION: 734# @DESCRIPTION:
721# It removes the package from the /var/lib/module-rebuild/moduledb database but it doens't 735# It removes the package from the /var/lib/module-rebuild/moduledb database but it doens't
722# call /sbin/depmod because the modules are still installed. 736# call /sbin/depmod because the modules are still installed.
723linux-mod_pkg_postrm() { 737linux-mod_pkg_postrm() {
724 debug-print-function ${FUNCNAME} $* 738 debug-print-function ${FUNCNAME} $*
739 [ -n "${MODULES_OPTIONAL_USE}" ] && use !${MODULES_OPTIONAL_USE} && return
725 remove_moduledb; 740 remove_moduledb;
726} 741}

Legend:
Removed from v.1.113  
changed lines
  Added in v.1.114

  ViewVC Help
Powered by ViewVC 1.1.20