| 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.108 2012/09/15 16:16:53 zmedico 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 |
| … | |
… | |
| 35 | # @DESCRIPTION: |
32 | # @DESCRIPTION: |
| 36 | # It's a string with the parameters to pass to emake. |
33 | # It's a string with the parameters to pass to emake. |
| 37 | |
34 | |
| 38 | # @ECLASS-VARIABLE: BUILD_TARGETS |
35 | # @ECLASS-VARIABLE: BUILD_TARGETS |
| 39 | # @DESCRIPTION: |
36 | # @DESCRIPTION: |
| 40 | # It's a string with the build targets to pass to make. The default value is "clean modules" |
37 | # It's a string with the build targets to pass to make. The default value is "clean module" |
| 41 | |
38 | |
| 42 | # @ECLASS-VARIABLE: MODULE_NAMES |
39 | # @ECLASS-VARIABLE: MODULE_NAMES |
| 43 | # @DESCRIPTION: |
40 | # @DESCRIPTION: |
| 44 | # It's a string containing the modules to be built automatically using the default |
41 | # It's a string containing the modules to be built automatically using the default |
| 45 | # src_compile/src_install. It will only make ${BUILD_TARGETS} once in any directory. |
42 | # src_compile/src_install. It will only make ${BUILD_TARGETS} once in any directory. |
| … | |
… | |
| 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" |
|
|
| 139 | RDEPEND="kernel_linux? ( sys-apps/module-init-tools )" |
130 | RDEPEND="kernel_linux? ( virtual/modutils )" |
| 140 | DEPEND="${RDEPEND} |
131 | DEPEND="${RDEPEND} |
| 141 | sys-apps/sed |
132 | sys-apps/sed |
| 142 | kernel_linux? ( virtual/linux-sources )" |
133 | kernel_linux? ( virtual/linux-sources )" |
| 143 | |
134 | |
| 144 | # eclass utilities |
135 | # eclass utilities |
| … | |
… | |
| 193 | # if we haven't determined the version yet, we need too. |
184 | # if we haven't determined the version yet, we need too. |
| 194 | get_version; |
185 | get_version; |
| 195 | |
186 | |
| 196 | # if the kernel version is greater than 2.6.6 then we should use |
187 | # if the kernel version is greater than 2.6.6 then we should use |
| 197 | # M= instead of SUBDIRS= |
188 | # M= instead of SUBDIRS= |
|
|
189 | [ ${KV_MAJOR} -eq 3 ] && return 0 |
| 198 | [ ${KV_MAJOR} -eq 2 -a ${KV_MINOR} -gt 5 -a ${KV_PATCH} -gt 5 ] && \ |
190 | [ ${KV_MAJOR} -eq 2 -a ${KV_MINOR} -gt 5 -a ${KV_PATCH} -gt 5 ] && \ |
| 199 | return 0 || return 1 |
191 | return 0 || return 1 |
| 200 | } |
192 | } |
| 201 | |
193 | |
| 202 | # @FUNCTION: convert_to_m |
194 | # @FUNCTION: convert_to_m |
| … | |
… | |
| 228 | get_version; |
220 | get_version; |
| 229 | |
221 | |
| 230 | ebegin "Updating module dependencies for ${KV_FULL}" |
222 | ebegin "Updating module dependencies for ${KV_FULL}" |
| 231 | if [ -r "${KV_OUT_DIR}"/System.map ] |
223 | if [ -r "${KV_OUT_DIR}"/System.map ] |
| 232 | then |
224 | then |
| 233 | depmod -ae -F "${KV_OUT_DIR}"/System.map -b "${ROOT}" -r ${KV_FULL} |
225 | depmod -ae -F "${KV_OUT_DIR}"/System.map -b "${ROOT}" ${KV_FULL} |
| 234 | eend $? |
226 | eend $? |
| 235 | else |
227 | else |
| 236 | ewarn |
228 | ewarn |
| 237 | ewarn "${KV_OUT_DIR}/System.map not found." |
229 | ewarn "${KV_OUT_DIR}/System.map not found." |
| 238 | ewarn "You must manually update the kernel module dependencies using depmod." |
230 | ewarn "You must manually update the kernel module dependencies using depmod." |
| … | |
… | |
| 326 | # @DESCRIPTION: |
318 | # @DESCRIPTION: |
| 327 | # It sets the KV_OBJ variable. |
319 | # It sets the KV_OBJ variable. |
| 328 | set_kvobj() { |
320 | set_kvobj() { |
| 329 | debug-print-function ${FUNCNAME} $* |
321 | debug-print-function ${FUNCNAME} $* |
| 330 | |
322 | |
| 331 | if kernel_is 2 6 |
323 | if kernel_is ge 2 6 |
| 332 | then |
324 | then |
| 333 | KV_OBJ="ko" |
325 | KV_OBJ="ko" |
| 334 | else |
326 | else |
| 335 | KV_OBJ="o" |
327 | KV_OBJ="o" |
| 336 | fi |
328 | fi |
| … | |
… | |
| 574 | # configured, verifies that the sources are prepared, verifies that the modules support is builtin |
566 | # 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. |
567 | # in the kernel and sets the object extension KV_OBJ. |
| 576 | linux-mod_pkg_setup() { |
568 | linux-mod_pkg_setup() { |
| 577 | debug-print-function ${FUNCNAME} $* |
569 | debug-print-function ${FUNCNAME} $* |
| 578 | |
570 | |
|
|
571 | local is_bin="${MERGE_TYPE}" |
|
|
572 | |
| 579 | # If we are installing a binpkg, take a different path. |
573 | # If we are installing a binpkg, take a different path. |
|
|
574 | # use MERGE_TYPE if available (eapi>=4); else use non-PMS EMERGE_FROM (eapi<4) |
|
|
575 | if has ${EAPI} 0 1 2 3; then |
|
|
576 | is_bin=${EMERGE_FROM} |
|
|
577 | fi |
|
|
578 | |
| 580 | if [[ $EMERGE_FROM == binary ]]; then |
579 | if [[ ${is_bin} == binary ]]; then |
| 581 | linux-mod_pkg_setup_binary |
580 | linux-mod_pkg_setup_binary |
| 582 | return |
581 | return |
| 583 | fi |
582 | fi |
| 584 | |
583 | |
| 585 | linux-info_pkg_setup; |
584 | linux-info_pkg_setup; |