| 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.67 2006/07/24 20:18:09 genstef Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/linux-mod.eclass,v 1.68 2006/10/16 14:10:46 genstef 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. |
| 9 | # |
9 | # |
| 10 | # Maintainer: John Mylchreest <johnm@gentoo.org> |
10 | # Maintainer: John Mylchreest <johnm@gentoo.org>, Stefan Schweizer <genstef@gentoo.org> |
| 11 | # Copyright 2004 Gentoo Linux |
11 | # Copyright 2004 Gentoo Linux |
| 12 | # |
12 | # |
| 13 | # Please direct your bugs to the current eclass maintainer :) |
13 | # Please direct your bugs to the current eclass maintainer :) |
| 14 | |
14 | |
| 15 | # A Couple of env vars are available to effect usage of this eclass |
15 | # A Couple of env vars are available to effect usage of this eclass |
| … | |
… | |
| 226 | KV_OBJ="o" |
226 | KV_OBJ="o" |
| 227 | fi |
227 | fi |
| 228 | # Do we really need to know this? |
228 | # Do we really need to know this? |
| 229 | # Lets silence it. |
229 | # Lets silence it. |
| 230 | # einfo "Using KV_OBJ=${KV_OBJ}" |
230 | # einfo "Using KV_OBJ=${KV_OBJ}" |
|
|
231 | } |
|
|
232 | |
|
|
233 | get-KERNEL_CC() { |
|
|
234 | local kernel_cc |
|
|
235 | if [ -n "${KERNEL_ABI}" ]; then |
|
|
236 | # In future, an arch might want to define CC_$ABI |
|
|
237 | #kernel_cc="$(get_abi_CC)" |
|
|
238 | #[ -z "${kernel_cc}" ] && |
|
|
239 | kernel_cc="$(tc-getCC $(ABI=${KERNEL_ABI} get_abi_CHOST))" |
|
|
240 | else |
|
|
241 | kernel_cc=$(tc-getCC) |
|
|
242 | fi |
|
|
243 | echo "${kernel_cc}" |
| 231 | } |
244 | } |
| 232 | |
245 | |
| 233 | generate_modulesd() { |
246 | generate_modulesd() { |
| 234 | # This function will generate the neccessary modules.d file from the |
247 | # This function will generate the neccessary modules.d file from the |
| 235 | # information contained in the modules exported parms |
248 | # information contained in the modules exported parms |
| … | |
… | |
| 437 | linux-mod_src_compile() { |
450 | linux-mod_src_compile() { |
| 438 | local modulename libdir srcdir objdir i n myARCH="${ARCH}" myABI="${ABI}" |
451 | local modulename libdir srcdir objdir i n myARCH="${ARCH}" myABI="${ABI}" |
| 439 | ARCH="$(tc-arch-kernel)" |
452 | ARCH="$(tc-arch-kernel)" |
| 440 | ABI="${KERNEL_ABI}" |
453 | ABI="${KERNEL_ABI}" |
| 441 | CC_HOSTCC=$(tc-getBUILD_CC) |
454 | CC_HOSTCC=$(tc-getBUILD_CC) |
| 442 | CC_CC=$(tc-getCC) |
455 | CC_CC=$(get-KERNEL_CC) |
| 443 | |
456 | |
| 444 | BUILD_TARGETS=${BUILD_TARGETS:-clean module} |
457 | BUILD_TARGETS=${BUILD_TARGETS:-clean module} |
| 445 | strip_modulenames; |
458 | strip_modulenames; |
| 446 | for i in ${MODULE_NAMES} |
459 | for i in ${MODULE_NAMES} |
| 447 | do |
460 | do |
| … | |
… | |
| 462 | then |
475 | then |
| 463 | econf ${ECONF_PARAMS} || \ |
476 | econf ${ECONF_PARAMS} || \ |
| 464 | die "Unable to run econf ${ECONF_PARAMS}" |
477 | die "Unable to run econf ${ECONF_PARAMS}" |
| 465 | fi |
478 | fi |
| 466 | |
479 | |
| 467 | emake HOSTCC=${CC_HOSTCC} CC=${CC_CC}\ |
480 | emake HOSTCC=${CC_HOSTCC} CC=${CC_CC} LDFLAGS="$(get_abi_LDFLAGS)" \ |
| 468 | ${BUILD_FIXES} ${BUILD_PARAMS} ${BUILD_TARGETS} \ |
481 | ${BUILD_FIXES} ${BUILD_PARAMS} ${BUILD_TARGETS} \ |
| 469 | || die "Unable to make ${BUILD_FIXES} ${BUILD_PARAMS} ${BUILD_TARGETS}." |
482 | || die "Unable to make ${BUILD_FIXES} ${BUILD_PARAMS} ${BUILD_TARGETS}." |
| 470 | touch ${srcdir}/.built |
483 | touch ${srcdir}/.built |
| 471 | cd ${OLDPWD} |
484 | cd ${OLDPWD} |
| 472 | fi |
485 | fi |