/[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.78
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.78 2008/01/22 21:05:32 dsd 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 emake HOSTCC="$(tc-getBUILD_CC)" CC="$(get-KERNEL_CC)" LDFLAGS="$(get_abi_LDFLAGS)" \
518 ${BUILD_FIXES} ${BUILD_PARAMS} ${BUILD_TARGETS} \
519 || die "Unable to make ${BUILD_FIXES} ${BUILD_PARAMS} ${BUILD_TARGETS}."
520 touch ${srcdir}/.built
521 cd ${OLDPWD}
522 fi
523 done
524
525 ARCH="${myARCH}"
526 ABI="${myABI}"
527}
528
529linux-mod_src_install() {
530 debug-print-function ${FUNCNAME} $*
531
532 local modulename libdir srcdir objdir i n
533
493 strip_modulenames; 534 strip_modulenames;
494 for i in ${MODULE_NAMES} 535 for i in ${MODULE_NAMES}
495 do 536 do
496 unset libdir srcdir objdir 537 unset libdir srcdir objdir
497 for n in $(find_module_params ${i}) 538 for n in $(find_module_params ${i})
500 done 541 done
501 libdir=${libdir:-misc} 542 libdir=${libdir:-misc}
502 srcdir=${srcdir:-${S}} 543 srcdir=${srcdir:-${S}}
503 objdir=${objdir:-${srcdir}} 544 objdir=${objdir:-${srcdir}}
504 545
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" 546 einfo "Installing ${modulename} module"
545 cd ${objdir} || die "${objdir} does not exist" 547 cd ${objdir} || die "${objdir} does not exist"
546 insinto /lib/modules/${KV_FULL}/${libdir} 548 insinto /lib/modules/${KV_FULL}/${libdir}
547 doins ${modulename}.${KV_OBJ} || die "doins ${modulename}.${KV_OBJ} failed" 549 doins ${modulename}.${KV_OBJ} || die "doins ${modulename}.${KV_OBJ} failed"
548 cd ${OLDPWD} 550 cd ${OLDPWD}
552} 554}
553 555
554linux-mod_pkg_preinst() { 556linux-mod_pkg_preinst() {
555 debug-print-function ${FUNCNAME} $* 557 debug-print-function ${FUNCNAME} $*
556 558
557 [ -d ${IMAGE}/lib/modules ] && UPDATE_DEPMOD=true || UPDATE_DEPMOD=false 559 [ -d "${D}lib/modules" ] && UPDATE_DEPMOD=true || UPDATE_DEPMOD=false
558 [ -d ${IMAGE}/etc/modules.d ] && UPDATE_MODULES=true || UPDATE_MODULES=false 560 [ -d "${D}etc/modules.d" ] && UPDATE_MODULES=true || UPDATE_MODULES=false
559 [ -d ${IMAGE}/lib/modules ] && UPDATE_MODULEDB=true || UPDATE_MODULEDB=false 561 [ -d "${D}lib/modules" ] && UPDATE_MODULEDB=true || UPDATE_MODULEDB=false
560} 562}
561 563
562linux-mod_pkg_postinst() { 564linux-mod_pkg_postinst() {
563 debug-print-function ${FUNCNAME} $* 565 debug-print-function ${FUNCNAME} $*
564 566

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

  ViewVC Help
Powered by ViewVC 1.1.20