| 1 | # Copyright 1999-2004 Gentoo Foundation |
1 | # Copyright 1999-2006 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-info.eclass,v 1.32 2005/09/25 12:30:26 swegener Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/linux-info.eclass,v 1.39 2006/02/08 12:57:52 brix Exp $ |
| 4 | # |
4 | # |
| 5 | # Description: This eclass is used as a central eclass for accessing kernel |
5 | # Description: This eclass is used as a central eclass for accessing kernel |
| 6 | # related information for sources already installed. |
6 | # related information for sources already installed. |
| 7 | # It is vital for linux-mod to function correctly, and is split |
7 | # It is vital for linux-mod to function correctly, and is split |
| 8 | # out so that any ebuild behaviour "templates" are abstracted out |
8 | # out so that any ebuild behaviour "templates" are abstracted out |
| … | |
… | |
| 22 | # CONFIG_CHECK <string> a list of .config options to check for before |
22 | # CONFIG_CHECK <string> a list of .config options to check for before |
| 23 | # proceeding with the install. ie: CONFIG_CHECK="MTRR" |
23 | # proceeding with the install. ie: CONFIG_CHECK="MTRR" |
| 24 | # You can also check that an option doesn't exist by |
24 | # You can also check that an option doesn't exist by |
| 25 | # prepending it with an exclamation mark (!). |
25 | # prepending it with an exclamation mark (!). |
| 26 | # ie: CONFIG_CHECK="!MTRR" |
26 | # ie: CONFIG_CHECK="!MTRR" |
|
|
27 | # To simply warn about a missing option, prepend a '~'. |
| 27 | # ERROR_CFG <string> The error message to display when the above check |
28 | # ERROR_CFG <string> The error message to display when the above check |
| 28 | # fails. <CFG> should reference the appropriate option |
29 | # fails. <CFG> should reference the appropriate option |
| 29 | # as above. ie: ERROR_MTRR="MTRR exists in the .config |
30 | # as above. ie: ERROR_MTRR="MTRR exists in the .config |
| 30 | # but shouldn't!!" |
31 | # but shouldn't!!" |
| 31 | # KBUILD_OUTPUT <string> This is passed on commandline, or can be set from |
32 | # KBUILD_OUTPUT <string> This is passed on commandline, or can be set from |
| … | |
… | |
| 50 | |
51 | |
| 51 | # And to ensure all the weirdness with crosscompile |
52 | # And to ensure all the weirdness with crosscompile |
| 52 | inherit toolchain-funcs versionator |
53 | inherit toolchain-funcs versionator |
| 53 | |
54 | |
| 54 | EXPORT_FUNCTIONS pkg_setup |
55 | EXPORT_FUNCTIONS pkg_setup |
|
|
56 | |
|
|
57 | DEPEND="virtual/linux-sources" |
|
|
58 | RDEPEND="" |
| 55 | |
59 | |
| 56 | # Overwritable environment Var's |
60 | # Overwritable environment Var's |
| 57 | # --------------------------------------- |
61 | # --------------------------------------- |
| 58 | KERNEL_DIR="${KERNEL_DIR:-${ROOT}usr/src/linux}" |
62 | KERNEL_DIR="${KERNEL_DIR:-${ROOT}usr/src/linux}" |
| 59 | |
63 | |
| … | |
… | |
| 107 | then |
111 | then |
| 108 | echo -e "\n" |
112 | echo -e "\n" |
| 109 | eerror "getfilevar requires 2 variables, with the second a valid file." |
113 | eerror "getfilevar requires 2 variables, with the second a valid file." |
| 110 | eerror " getfilevar <VARIABLE> <CONFIGFILE>" |
114 | eerror " getfilevar <VARIABLE> <CONFIGFILE>" |
| 111 | else |
115 | else |
| 112 | workingdir=${PWD} |
116 | workingdir="${PWD}" |
| 113 | basefname=$(basename ${2}) |
117 | basefname="$(basename ${2})" |
| 114 | basedname=$(dirname ${2}) |
118 | basedname="$(dirname ${2})" |
| 115 | unset ARCH |
119 | unset ARCH |
| 116 | |
120 | |
| 117 | cd ${basedname} |
121 | cd "${basedname}" |
| 118 | echo -e "include ${basefname}\ne:\n\t@echo \$(${1})" | \ |
122 | echo -e "include ${basefname}\ne:\n\t@echo \$(${1})" | \ |
| 119 | make ${BUILD_FIXES} -s -f - e 2>/dev/null |
123 | make ${BUILD_FIXES} -s -f - e 2>/dev/null |
| 120 | cd ${workingdir} |
124 | cd "${workingdir}" |
| 121 | |
125 | |
| 122 | ARCH=${myARCH} |
126 | ARCH=${myARCH} |
| 123 | fi |
127 | fi |
| 124 | } |
128 | } |
| 125 | |
129 | |
| … | |
… | |
| 289 | KV_LOCAL="$(get_localversion ${KV_OUT_DIR})" |
293 | KV_LOCAL="$(get_localversion ${KV_OUT_DIR})" |
| 290 | fi |
294 | fi |
| 291 | # and if we STILL haven't got it, then we better just set it to KV_DIR |
295 | # and if we STILL haven't got it, then we better just set it to KV_DIR |
| 292 | KV_OUT_DIR="${KV_OUT_DIR:-${KV_DIR}}" |
296 | KV_OUT_DIR="${KV_OUT_DIR:-${KV_DIR}}" |
| 293 | |
297 | |
| 294 | KV_LOCAL="${KV_LOCAL}$(get_localversion ${KV_OUT_DIR})" |
298 | KV_LOCAL="${KV_LOCAL}$(get_localversion ${KV_DIR})" |
| 295 | KV_LOCAL="${KV_LOCAL}$(linux_chkconfig_string LOCALVERSION)" |
299 | KV_LOCAL="${KV_LOCAL}$(linux_chkconfig_string LOCALVERSION)" |
| 296 | KV_LOCAL="${KV_LOCAL//\"/}" |
300 | KV_LOCAL="${KV_LOCAL//\"/}" |
| 297 | |
301 | |
| 298 | # And we should set KV_FULL to the full expanded version |
302 | # And we should set KV_FULL to the full expanded version |
| 299 | KV_FULL="${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${KV_EXTRA}${KV_LOCAL}" |
303 | KV_FULL="${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${KV_EXTRA}${KV_LOCAL}" |
| … | |
… | |
| 409 | temp_config="${config//*:}" |
413 | temp_config="${config//*:}" |
| 410 | config="${config//:*}" |
414 | config="${config//:*}" |
| 411 | if linux_chkconfig_present ${config}; then |
415 | if linux_chkconfig_present ${config}; then |
| 412 | for i in ${MODULE_NAMES}; do |
416 | for i in ${MODULE_NAMES}; do |
| 413 | n="${i//${temp_config}}" |
417 | n="${i//${temp_config}}" |
| 414 | [[ -z ${n//(*} ]] && \ |
418 | [[ -z ${n//\(*} ]] && \ |
| 415 | MODULE_IGNORE="${MODULE_IGNORE} ${temp_config}" |
419 | MODULE_IGNORE="${MODULE_IGNORE} ${temp_config}" |
| 416 | done |
420 | done |
| 417 | error=2 |
421 | error=2 |
| 418 | fi |
422 | fi |
| 419 | else |
423 | else |
| … | |
… | |
| 423 | if [[ ${die} == 0 ]]; then |
427 | if [[ ${die} == 0 ]]; then |
| 424 | ebegin "CONFIG_${config}" |
428 | ebegin "CONFIG_${config}" |
| 425 | eend ${error} |
429 | eend ${error} |
| 426 | else |
430 | else |
| 427 | if [[ ${error} > 0 ]]; then |
431 | if [[ ${error} > 0 ]]; then |
| 428 | local_error="${config}_ERROR" |
432 | local_error="ERROR_${config}" |
| 429 | local_error="${!local_error}" |
433 | local_error="${!local_error}" |
|
|
434 | |
|
|
435 | if [[ -z "${local_error}" ]]; then |
|
|
436 | # using old, deprecated format. |
|
|
437 | local_error="${config}_ERROR" |
|
|
438 | local_error="${!local_error}" |
|
|
439 | fi |
|
|
440 | |
| 430 | if [[ -z "${local_error}" ]]; then |
441 | if [[ -z "${local_error}" ]]; then |
| 431 | [[ ${error} == 1 ]] \ |
442 | [[ ${error} == 1 ]] \ |
| 432 | && local_error="is not set when it should be." \ |
443 | && local_error="is not set when it should be." \ |
| 433 | || local_error="should not be set. But it is." |
444 | || local_error="should not be set. But it is." |
| 434 | local_error="CONFIG_${config}:\t ${local_error}" |
445 | local_error="CONFIG_${config}:\t ${local_error}" |