| 1 | # Copyright 1999-2011 Gentoo Foundation |
1 | # Copyright 1999-2012 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.106 2012/08/28 15:28:01 mpagano Exp $ |
| 4 | |
|
|
| 5 | # Author(s): John Mylchreest <johnm@gentoo.org>, |
|
|
| 6 | # Stefan Schweizer <genstef@gentoo.org> |
|
|
| 7 | # Maintainer: kernel-misc@gentoo.org |
|
|
| 8 | # |
|
|
| 9 | # Please direct your bugs to the current eclass maintainer :) |
|
|
| 10 | |
4 | |
| 11 | # @ECLASS: linux-mod.eclass |
5 | # @ECLASS: linux-mod.eclass |
| 12 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 13 | # kernel-misc@gentoo.org |
7 | # kernel-misc@gentoo.org |
|
|
8 | # @AUTHOR: |
|
|
9 | # John Mylchreest <johnm@gentoo.org>, |
|
|
10 | # Stefan Schweizer <genstef@gentoo.org> |
| 14 | # @BLURB: It provides the functionality required to install external modules against a kernel source tree. |
11 | # @BLURB: It provides the functionality required to install external modules against a kernel source tree. |
| 15 | # @DESCRIPTION: |
12 | # @DESCRIPTION: |
| 16 | # This eclass is used to interface with linux-info.eclass in such a way |
13 | # This eclass is used to interface with linux-info.eclass in such a way |
| 17 | # to provide the functionality and initial functions |
14 | # to provide the functionality and initial functions |
| 18 | # required to install external modules against a kernel source |
15 | # required to install external modules against a kernel source |
| … | |
… | |
| 123 | |
120 | |
| 124 | # @ECLASS-VARIABLE: KV_OBJ |
121 | # @ECLASS-VARIABLE: KV_OBJ |
| 125 | # @DESCRIPTION: |
122 | # @DESCRIPTION: |
| 126 | # It's a read-only variable. It contains the extension of the kernel modules. |
123 | # It's a read-only variable. It contains the extension of the kernel modules. |
| 127 | |
124 | |
| 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 | |
|
|
| 133 | inherit eutils linux-info multilib |
125 | inherit eutils linux-info multilib |
| 134 | EXPORT_FUNCTIONS pkg_setup pkg_preinst pkg_postinst src_install src_compile pkg_postrm |
126 | EXPORT_FUNCTIONS pkg_setup pkg_preinst pkg_postinst src_install src_compile pkg_postrm |
| 135 | |
127 | |
| 136 | IUSE="kernel_linux" |
128 | IUSE="kernel_linux" |
| 137 | SLOT="0" |
129 | SLOT="0" |
| 138 | DESCRIPTION="Based on the $ECLASS eclass" |
130 | DESCRIPTION="Based on the $ECLASS eclass" |
| 139 | RDEPEND="kernel_linux? ( sys-apps/module-init-tools )" |
131 | RDEPEND="kernel_linux? ( virtual/modutils )" |
| 140 | DEPEND="${RDEPEND} |
132 | DEPEND="${RDEPEND} |
| 141 | sys-apps/sed |
133 | sys-apps/sed |
| 142 | kernel_linux? ( virtual/linux-sources )" |
134 | kernel_linux? ( virtual/linux-sources )" |
| 143 | |
135 | |
| 144 | # eclass utilities |
136 | # eclass utilities |
| … | |
… | |
| 193 | # if we haven't determined the version yet, we need too. |
185 | # if we haven't determined the version yet, we need too. |
| 194 | get_version; |
186 | get_version; |
| 195 | |
187 | |
| 196 | # if the kernel version is greater than 2.6.6 then we should use |
188 | # if the kernel version is greater than 2.6.6 then we should use |
| 197 | # M= instead of SUBDIRS= |
189 | # M= instead of SUBDIRS= |
|
|
190 | [ ${KV_MAJOR} -eq 3 ] && return 0 |
| 198 | [ ${KV_MAJOR} -eq 2 -a ${KV_MINOR} -gt 5 -a ${KV_PATCH} -gt 5 ] && \ |
191 | [ ${KV_MAJOR} -eq 2 -a ${KV_MINOR} -gt 5 -a ${KV_PATCH} -gt 5 ] && \ |
| 199 | return 0 || return 1 |
192 | return 0 || return 1 |
| 200 | } |
193 | } |
| 201 | |
194 | |
| 202 | # @FUNCTION: convert_to_m |
195 | # @FUNCTION: convert_to_m |
| … | |
… | |
| 228 | get_version; |
221 | get_version; |
| 229 | |
222 | |
| 230 | ebegin "Updating module dependencies for ${KV_FULL}" |
223 | ebegin "Updating module dependencies for ${KV_FULL}" |
| 231 | if [ -r "${KV_OUT_DIR}"/System.map ] |
224 | if [ -r "${KV_OUT_DIR}"/System.map ] |
| 232 | then |
225 | then |
| 233 | depmod -ae -F "${KV_OUT_DIR}"/System.map -b "${ROOT}" -r ${KV_FULL} |
226 | depmod -ae -F "${KV_OUT_DIR}"/System.map -b "${ROOT}" ${KV_FULL} |
| 234 | eend $? |
227 | eend $? |
| 235 | else |
228 | else |
| 236 | ewarn |
229 | ewarn |
| 237 | ewarn "${KV_OUT_DIR}/System.map not found." |
230 | ewarn "${KV_OUT_DIR}/System.map not found." |
| 238 | ewarn "You must manually update the kernel module dependencies using depmod." |
231 | ewarn "You must manually update the kernel module dependencies using depmod." |
| … | |
… | |
| 326 | # @DESCRIPTION: |
319 | # @DESCRIPTION: |
| 327 | # It sets the KV_OBJ variable. |
320 | # It sets the KV_OBJ variable. |
| 328 | set_kvobj() { |
321 | set_kvobj() { |
| 329 | debug-print-function ${FUNCNAME} $* |
322 | debug-print-function ${FUNCNAME} $* |
| 330 | |
323 | |
| 331 | if kernel_is 2 6 |
324 | if kernel_is ge 2 6 |
| 332 | then |
325 | then |
| 333 | KV_OBJ="ko" |
326 | KV_OBJ="ko" |
| 334 | else |
327 | else |
| 335 | KV_OBJ="o" |
328 | KV_OBJ="o" |
| 336 | fi |
329 | fi |
| … | |
… | |
| 574 | # configured, verifies that the sources are prepared, verifies that the modules support is builtin |
567 | # 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. |
568 | # in the kernel and sets the object extension KV_OBJ. |
| 576 | linux-mod_pkg_setup() { |
569 | linux-mod_pkg_setup() { |
| 577 | debug-print-function ${FUNCNAME} $* |
570 | debug-print-function ${FUNCNAME} $* |
| 578 | |
571 | |
|
|
572 | local is_bin="${MERGE_TYPE}" |
|
|
573 | |
| 579 | # If we are installing a binpkg, take a different path. |
574 | # If we are installing a binpkg, take a different path. |
|
|
575 | # use MERGE_TYPE if available (eapi>=4); else use non-PMS EMERGE_FROM (eapi<4) |
|
|
576 | if has ${EAPI} 0 1 2 3; then |
|
|
577 | is_bin=${EMERGE_FROM} |
|
|
578 | fi |
|
|
579 | |
| 580 | if [[ $EMERGE_FROM == binary ]]; then |
580 | if [[ ${is_bin} == binary ]]; then |
| 581 | linux-mod_pkg_setup_binary |
581 | linux-mod_pkg_setup_binary |
| 582 | return |
582 | return |
| 583 | fi |
583 | fi |
| 584 | |
584 | |
| 585 | linux-info_pkg_setup; |
585 | linux-info_pkg_setup; |