/[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.75 Revision 1.79
1# Copyright 1999-2004 Gentoo Foundation 1# Copyright 1999-2004 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.75 2007/10/03 12:53:10 phreak Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/linux-mod.eclass,v 1.79 2008/03/22 01:10:19 robbat2 Exp $
4 4
5# Description: This eclass is used to interface with linux-info in such a way 5# Description: This eclass is used to interface with linux-info in such a way
6# to provide the functionality required and initial functions 6# to provide the functionality required and initial functions
7# required to install external modules against a kernel source 7# required to install external modules against a kernel source
8# tree. 8# tree.
461 461
462linux-mod_pkg_setup() { 462linux-mod_pkg_setup() {
463 debug-print-function ${FUNCNAME} $* 463 debug-print-function ${FUNCNAME} $*
464 464
465 linux-info_pkg_setup; 465 linux-info_pkg_setup;
466 require_configured_kernel
466 check_kernel_built; 467 check_kernel_built;
467 strip_modulenames; 468 strip_modulenames;
468 [[ -n ${MODULE_NAMES} ]] && check_modules_supported 469 [[ -n ${MODULE_NAMES} ]] && check_modules_supported
469 set_kvobj; 470 set_kvobj;
470 # Commented out with permission from johnm until a fixed version for arches 471 # Commented out with permission from johnm until a fixed version for arches
488 local modulename libdir srcdir objdir i n myARCH="${ARCH}" myABI="${ABI}" 489 local modulename libdir srcdir objdir i n myARCH="${ARCH}" myABI="${ABI}"
489 ARCH="$(tc-arch-kernel)" 490 ARCH="$(tc-arch-kernel)"
490 ABI="${KERNEL_ABI}" 491 ABI="${KERNEL_ABI}"
491 492
492 BUILD_TARGETS=${BUILD_TARGETS:-clean module} 493 BUILD_TARGETS=${BUILD_TARGETS:-clean module}
494 strip_modulenames;
495 cd "${S}"
496 for i in ${MODULE_NAMES}
497 do
498 unset libdir srcdir objdir
499 for n in $(find_module_params ${i})
500 do
501 eval ${n/:*}=${n/*:/}
502 done
503 libdir=${libdir:-misc}
504 srcdir=${srcdir:-${S}}
505 objdir=${objdir:-${srcdir}}
506
507 if [ ! -f "${srcdir}/.built" ];
508 then
509 cd ${srcdir}
510 einfo "Preparing ${modulename} module"
511 if [[ -n ${ECONF_PARAMS} ]]
512 then
513 econf ${ECONF_PARAMS} || \
514 die "Unable to run econf ${ECONF_PARAMS}"
515 fi
516
517 # This looks messy, but it is needed to handle multiple variables
518 # being passed in the BUILD_* stuff where the variables also have
519 # spaces that must be preserved. If don't do this, then the stuff
520 # inside the variables gets used as targets for Make, which then
521 # fails.
522 eval "emake HOSTCC=\"$(tc-getBUILD_CC)\" \
523 CC=\"$(get-KERNEL_CC)\" \
524 LDFLAGS=\"$(get_abi_LDFLAGS)\" \
525 ${BUILD_FIXES} \
526 ${BUILD_PARAMS} \
527 ${BUILD_TARGETS} " \
528 || die "Unable to emake HOSTCC="$(tc-getBUILD_CC)" CC="$(get-KERNEL_CC)" LDFLAGS="$(get_abi_LDFLAGS)" ${BUILD_FIXES} ${BUILD_PARAMS} ${BUILD_TARGETS}"
529 touch ${srcdir}/.built
530 cd ${OLDPWD}
531 fi
532 done
533
534 ARCH="${myARCH}"
535 ABI="${myABI}"
536}
537
538linux-mod_src_install() {
539 debug-print-function ${FUNCNAME} $*
540
541 local modulename libdir srcdir objdir i n
542
493 strip_modulenames; 543 strip_modulenames;
494 for i in ${MODULE_NAMES} 544 for i in ${MODULE_NAMES}
495 do 545 do
496 unset libdir srcdir objdir 546 unset libdir srcdir objdir
497 for n in $(find_module_params ${i}) 547 for n in $(find_module_params ${i})
500 done 550 done
501 libdir=${libdir:-misc} 551 libdir=${libdir:-misc}
502 srcdir=${srcdir:-${S}} 552 srcdir=${srcdir:-${S}}
503 objdir=${objdir:-${srcdir}} 553 objdir=${objdir:-${srcdir}}
504 554
505 if [ ! -f "${srcdir}/.built" ];
506 then
507 cd ${srcdir}
508 einfo "Preparing ${modulename} module"
509 if [[ -n ${ECONF_PARAMS} ]]
510 then
511 econf ${ECONF_PARAMS} || \
512 die "Unable to run econf ${ECONF_PARAMS}"
513 fi
514
515 emake HOSTCC="$(tc-getBUILD_CC)" CC="$(get-KERNEL_CC)" LDFLAGS="$(get_abi_LDFLAGS)" \
516 ${BUILD_FIXES} ${BUILD_PARAMS} ${BUILD_TARGETS} \
517 || die "Unable to make ${BUILD_FIXES} ${BUILD_PARAMS} ${BUILD_TARGETS}."
518 touch ${srcdir}/.built
519 cd ${OLDPWD}
520 fi
521 done
522
523 ARCH="${myARCH}"
524 ABI="${myABI}"
525}
526
527linux-mod_src_install() {
528 debug-print-function ${FUNCNAME} $*
529
530 local modulename libdir srcdir objdir i n
531
532 strip_modulenames;
533 for i in ${MODULE_NAMES}
534 do
535 unset libdir srcdir objdir
536 for n in $(find_module_params ${i})
537 do
538 eval ${n/:*}=${n/*:/}
539 done
540 libdir=${libdir:-misc}
541 srcdir=${srcdir:-${S}}
542 objdir=${objdir:-${srcdir}}
543
544 einfo "Installing ${modulename} module" 555 einfo "Installing ${modulename} module"
545 cd ${objdir} || die "${objdir} does not exist" 556 cd ${objdir} || die "${objdir} does not exist"
546 insinto /lib/modules/${KV_FULL}/${libdir} 557 insinto /lib/modules/${KV_FULL}/${libdir}
547 doins ${modulename}.${KV_OBJ} || die "doins ${modulename}.${KV_OBJ} failed" 558 doins ${modulename}.${KV_OBJ} || die "doins ${modulename}.${KV_OBJ} failed"
548 cd ${OLDPWD} 559 cd ${OLDPWD}
552} 563}
553 564
554linux-mod_pkg_preinst() { 565linux-mod_pkg_preinst() {
555 debug-print-function ${FUNCNAME} $* 566 debug-print-function ${FUNCNAME} $*
556 567
557 [ -d ${IMAGE}/lib/modules ] && UPDATE_DEPMOD=true || UPDATE_DEPMOD=false 568 [ -d "${D}lib/modules" ] && UPDATE_DEPMOD=true || UPDATE_DEPMOD=false
558 [ -d ${IMAGE}/etc/modules.d ] && UPDATE_MODULES=true || UPDATE_MODULES=false 569 [ -d "${D}etc/modules.d" ] && UPDATE_MODULES=true || UPDATE_MODULES=false
559 [ -d ${IMAGE}/lib/modules ] && UPDATE_MODULEDB=true || UPDATE_MODULEDB=false 570 [ -d "${D}lib/modules" ] && UPDATE_MODULEDB=true || UPDATE_MODULEDB=false
560} 571}
561 572
562linux-mod_pkg_postinst() { 573linux-mod_pkg_postinst() {
563 debug-print-function ${FUNCNAME} $* 574 debug-print-function ${FUNCNAME} $*
564 575

Legend:
Removed from v.1.75  
changed lines
  Added in v.1.79

  ViewVC Help
Powered by ViewVC 1.1.20