| 1 | # Copyright 1999-2011 Gentoo Foundation |
1 | # Copyright 1999-2011 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.100 2011/04/24 18:55:20 ulm Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/linux-mod.eclass,v 1.103 2011/08/09 22:11:53 vapier Exp $ |
| 4 | |
4 | |
| 5 | # Author(s): John Mylchreest <johnm@gentoo.org>, |
5 | # Author(s): John Mylchreest <johnm@gentoo.org>, |
| 6 | # Stefan Schweizer <genstef@gentoo.org> |
6 | # Stefan Schweizer <genstef@gentoo.org> |
| 7 | # Maintainer: kernel-misc@gentoo.org |
7 | # Maintainer: kernel-misc@gentoo.org |
| 8 | # |
8 | # |
| … | |
… | |
| 122 | # documents for <modulename>. These files are installed in the live tree. |
122 | # documents for <modulename>. These files are installed in the live tree. |
| 123 | |
123 | |
| 124 | # @ECLASS-VARIABLE: KV_OBJ |
124 | # @ECLASS-VARIABLE: KV_OBJ |
| 125 | # @DESCRIPTION: |
125 | # @DESCRIPTION: |
| 126 | # It's a read-only variable. It contains the extension of the kernel modules. |
126 | # It's a read-only variable. It contains the extension of the kernel modules. |
| 127 | |
|
|
| 128 | # The order of these is important as both of linux-info and eutils contain |
|
|
| 129 | # set_arch_to_kernel and set_arch_to_portage functions and the ones in eutils |
|
|
| 130 | # are deprecated in favor of the ones in linux-info. |
|
|
| 131 | # See http://bugs.gentoo.org/show_bug.cgi?id=127506 |
|
|
| 132 | |
127 | |
| 133 | inherit eutils linux-info multilib |
128 | inherit eutils linux-info multilib |
| 134 | EXPORT_FUNCTIONS pkg_setup pkg_preinst pkg_postinst src_install src_compile pkg_postrm |
129 | EXPORT_FUNCTIONS pkg_setup pkg_preinst pkg_postinst src_install src_compile pkg_postrm |
| 135 | |
130 | |
| 136 | IUSE="kernel_linux" |
131 | IUSE="kernel_linux" |
| … | |
… | |
| 193 | # if we haven't determined the version yet, we need too. |
188 | # if we haven't determined the version yet, we need too. |
| 194 | get_version; |
189 | get_version; |
| 195 | |
190 | |
| 196 | # if the kernel version is greater than 2.6.6 then we should use |
191 | # if the kernel version is greater than 2.6.6 then we should use |
| 197 | # M= instead of SUBDIRS= |
192 | # M= instead of SUBDIRS= |
|
|
193 | [ ${KV_MAJOR} -eq 3 ] && return 0 |
| 198 | [ ${KV_MAJOR} -eq 2 -a ${KV_MINOR} -gt 5 -a ${KV_PATCH} -gt 5 ] && \ |
194 | [ ${KV_MAJOR} -eq 2 -a ${KV_MINOR} -gt 5 -a ${KV_PATCH} -gt 5 ] && \ |
| 199 | return 0 || return 1 |
195 | return 0 || return 1 |
| 200 | } |
196 | } |
| 201 | |
197 | |
| 202 | # @FUNCTION: convert_to_m |
198 | # @FUNCTION: convert_to_m |
| … | |
… | |
| 326 | # @DESCRIPTION: |
322 | # @DESCRIPTION: |
| 327 | # It sets the KV_OBJ variable. |
323 | # It sets the KV_OBJ variable. |
| 328 | set_kvobj() { |
324 | set_kvobj() { |
| 329 | debug-print-function ${FUNCNAME} $* |
325 | debug-print-function ${FUNCNAME} $* |
| 330 | |
326 | |
| 331 | if kernel_is 2 6 |
327 | if kernel_is ge 2 6 |
| 332 | then |
328 | then |
| 333 | KV_OBJ="ko" |
329 | KV_OBJ="ko" |
| 334 | else |
330 | else |
| 335 | KV_OBJ="o" |
331 | KV_OBJ="o" |
| 336 | fi |
332 | fi |
| … | |
… | |
| 574 | # configured, verifies that the sources are prepared, verifies that the modules support is builtin |
570 | # configured, verifies that the sources are prepared, verifies that the modules support is builtin |
| 575 | # in the kernel and sets the object extension KV_OBJ. |
571 | # in the kernel and sets the object extension KV_OBJ. |
| 576 | linux-mod_pkg_setup() { |
572 | linux-mod_pkg_setup() { |
| 577 | debug-print-function ${FUNCNAME} $* |
573 | debug-print-function ${FUNCNAME} $* |
| 578 | |
574 | |
|
|
575 | local is_bin="${MERGE_TYPE}" |
|
|
576 | |
| 579 | # If we are installing a binpkg, take a different path. |
577 | # If we are installing a binpkg, take a different path. |
|
|
578 | # use MERGE_TYPE if available (eapi>=4); else use non-PMS EMERGE_FROM (eapi<4) |
|
|
579 | if has ${EAPI} 0 1 2 3; then |
|
|
580 | is_bin=${EMERGE_FROM} |
|
|
581 | fi |
|
|
582 | |
| 580 | if [[ $EMERGE_FROM == binary ]]; then |
583 | if [[ ${is_bin} == binary ]]; then |
| 581 | linux-mod_pkg_setup_binary |
584 | linux-mod_pkg_setup_binary |
| 582 | return |
585 | return |
| 583 | fi |
586 | fi |
| 584 | |
587 | |
| 585 | linux-info_pkg_setup; |
588 | linux-info_pkg_setup; |