| 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.86 2008/10/31 22:24:55 dsd Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/linux-mod.eclass,v 1.96 2010/01/10 09:38:50 robbat2 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 | # |
| … | |
… | |
| 41 | |
41 | |
| 42 | # @ECLASS-VARIABLE: MODULE_NAMES |
42 | # @ECLASS-VARIABLE: MODULE_NAMES |
| 43 | # @DESCRIPTION: |
43 | # @DESCRIPTION: |
| 44 | # It's a string containing the modules to be built automatically using the default |
44 | # 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. |
45 | # src_compile/src_install. It will only make ${BUILD_TARGETS} once in any directory. |
| 46 | |
|
|
| 47 | # |
46 | # |
| 48 | # The structure of each MODULE_NAMES entry is as follows: |
47 | # The structure of each MODULE_NAMES entry is as follows: |
| 49 | # |
48 | # |
| 50 | # modulename(libdir:srcdir:objdir) |
49 | # modulename(libdir:srcdir:objdir) |
| 51 | # |
50 | # |
| 52 | # where: |
51 | # where: |
| 53 | # |
52 | # |
| 54 | # modulename = name of the module file excluding the .ko |
53 | # modulename = name of the module file excluding the .ko |
| 55 | # libdir = place in system modules directory where module is installed: |
54 | # libdir = place in system modules directory where module is installed (by default it's misc) |
| 56 | # srcdir = place for ebuild to cd to before running make |
55 | # srcdir = place for ebuild to cd to before running make (by default it's ${S}) |
| 57 | # objdir = place the .ko and objects are located after make runs |
56 | # objdir = place the .ko and objects are located after make runs (by default it's set to srcdir) |
| 58 | # |
57 | # |
| 59 | # To get an idea of how these variables are used, here's a few lines |
58 | # To get an idea of how these variables are used, here's a few lines |
| 60 | # of code from around line 540 in this eclass: |
59 | # of code from around line 540 in this eclass: |
| 61 | # |
60 | # |
| 62 | # einfo "Installing ${modulename} module" |
61 | # einfo "Installing ${modulename} module" |
| … | |
… | |
| 137 | IUSE="kernel_linux" |
136 | IUSE="kernel_linux" |
| 138 | SLOT="0" |
137 | SLOT="0" |
| 139 | DESCRIPTION="Based on the $ECLASS eclass" |
138 | DESCRIPTION="Based on the $ECLASS eclass" |
| 140 | RDEPEND="kernel_linux? ( virtual/modutils )" |
139 | RDEPEND="kernel_linux? ( virtual/modutils )" |
| 141 | DEPEND="${RDEPEND} |
140 | DEPEND="${RDEPEND} |
| 142 | sys-apps/sed" |
141 | sys-apps/sed |
|
|
142 | kernel_linux? ( virtual/linux-sources )" |
| 143 | |
143 | |
| 144 | # eclass utilities |
144 | # eclass utilities |
| 145 | # ---------------------------------- |
145 | # ---------------------------------- |
| 146 | |
146 | |
| 147 | check_vermagic() { |
147 | check_vermagic() { |
| 148 | debug-print-function ${FUNCNAME} $* |
148 | debug-print-function ${FUNCNAME} $* |
| 149 | |
149 | |
| 150 | local curr_gcc_ver=$(gcc -dumpversion) |
150 | local curr_gcc_ver=$(gcc -dumpversion) |
| 151 | local tmpfile old_chost old_gcc_ver result=0 |
151 | local tmpfile old_chost old_gcc_ver result=0 |
| 152 | |
152 | |
| 153 | tmpfile=`find ${KV_DIR}/ -iname "*.o.cmd" -exec grep usr/lib/gcc {} \; -quit` |
153 | tmpfile=`find "${KV_DIR}/" -iname "*.o.cmd" -exec grep usr/lib/gcc {} \; -quit` |
| 154 | tmpfile=${tmpfile//*usr/lib} |
154 | tmpfile=${tmpfile//*usr/lib} |
| 155 | tmpfile=${tmpfile//\/include*} |
155 | tmpfile=${tmpfile//\/include*} |
| 156 | old_chost=${tmpfile//*gcc\/} |
156 | old_chost=${tmpfile//*gcc\/} |
| 157 | old_chost=${old_chost//\/*} |
157 | old_chost=${old_chost//\/*} |
| 158 | old_gcc_ver=${tmpfile//*\/} |
158 | old_gcc_ver=${tmpfile//*\/} |
| … | |
… | |
| 209 | if use_m |
209 | if use_m |
| 210 | then |
210 | then |
| 211 | [ ! -f "${1}" ] && \ |
211 | [ ! -f "${1}" ] && \ |
| 212 | die "convert_to_m() requires a filename as an argument" |
212 | die "convert_to_m() requires a filename as an argument" |
| 213 | ebegin "Converting ${1/${WORKDIR}\//} to use M= instead of SUBDIRS=" |
213 | ebegin "Converting ${1/${WORKDIR}\//} to use M= instead of SUBDIRS=" |
| 214 | sed -i 's:SUBDIRS=:M=:g' ${1} |
214 | sed -i 's:SUBDIRS=:M=:g' "${1}" |
| 215 | eend $? |
215 | eend $? |
| 216 | fi |
216 | fi |
| 217 | } |
217 | } |
| 218 | |
218 | |
| 219 | # internal function |
219 | # internal function |
| … | |
… | |
| 226 | |
226 | |
| 227 | # if we haven't determined the version yet, we need too. |
227 | # if we haven't determined the version yet, we need too. |
| 228 | get_version; |
228 | get_version; |
| 229 | |
229 | |
| 230 | ebegin "Updating module dependencies for ${KV_FULL}" |
230 | ebegin "Updating module dependencies for ${KV_FULL}" |
| 231 | if [ -r ${KV_OUT_DIR}/System.map ] |
231 | if [ -r "${KV_OUT_DIR}"/System.map ] |
| 232 | then |
232 | then |
| 233 | depmod -ae -F ${KV_OUT_DIR}/System.map -b ${ROOT} -r ${KV_FULL} |
233 | depmod -ae -F "${KV_OUT_DIR}"/System.map -b "${ROOT}" -r ${KV_FULL} |
| 234 | eend $? |
234 | eend $? |
| 235 | else |
235 | else |
| 236 | ewarn |
236 | ewarn |
| 237 | ewarn "${KV_OUT_DIR}/System.map not found." |
237 | ewarn "${KV_OUT_DIR}/System.map not found." |
| 238 | ewarn "You must manually update the kernel module dependencies using depmod." |
238 | ewarn "You must manually update the kernel module dependencies using depmod." |
| … | |
… | |
| 248 | # It calls the update-modules utility. |
248 | # It calls the update-modules utility. |
| 249 | update_modules() { |
249 | update_modules() { |
| 250 | debug-print-function ${FUNCNAME} $* |
250 | debug-print-function ${FUNCNAME} $* |
| 251 | |
251 | |
| 252 | if [ -x /sbin/update-modules ] && \ |
252 | if [ -x /sbin/update-modules ] && \ |
| 253 | grep -v -e "^#" -e "^$" ${D}/etc/modules.d/* >/dev/null 2>&1; then |
253 | grep -v -e "^#" -e "^$" "${D}"/etc/modules.d/* >/dev/null 2>&1; then |
| 254 | ebegin "Updating modules.conf" |
254 | ebegin "Updating modules.conf" |
| 255 | /sbin/update-modules |
255 | /sbin/update-modules |
| 256 | eend $? |
256 | eend $? |
| 257 | elif [ -x /sbin/update-modules ] && \ |
257 | elif [ -x /sbin/update-modules ] && \ |
| 258 | grep -v -e "^#" -e "^$" ${D}/etc/modules.d/* >/dev/null 2>&1; then |
258 | grep -v -e "^#" -e "^$" "${D}"/etc/modules.d/* >/dev/null 2>&1; then |
| 259 | ebegin "Updating modules.conf" |
259 | ebegin "Updating modules.conf" |
| 260 | /sbin/update-modules |
260 | /sbin/update-modules |
| 261 | eend $? |
261 | eend $? |
| 262 | fi |
262 | fi |
| 263 | } |
263 | } |
| … | |
… | |
| 268 | # DESCRIPTION: |
268 | # DESCRIPTION: |
| 269 | # It updates the location of the database used by the module-rebuild utility. |
269 | # It updates the location of the database used by the module-rebuild utility. |
| 270 | move_old_moduledb() { |
270 | move_old_moduledb() { |
| 271 | debug-print-function ${FUNCNAME} $* |
271 | debug-print-function ${FUNCNAME} $* |
| 272 | |
272 | |
| 273 | local OLDDIR=${ROOT}/usr/share/module-rebuild/ |
273 | local OLDDIR="${ROOT}"/usr/share/module-rebuild/ |
| 274 | local NEWDIR=${ROOT}/var/lib/module-rebuild/ |
274 | local NEWDIR="${ROOT}"/var/lib/module-rebuild/ |
| 275 | |
275 | |
| 276 | if [[ -f ${OLDDIR}/moduledb ]]; then |
276 | if [[ -f "${OLDDIR}"/moduledb ]]; then |
| 277 | [[ ! -d ${NEWDIR} ]] && mkdir -p ${NEWDIR} |
277 | [[ ! -d "${NEWDIR}" ]] && mkdir -p "${NEWDIR}" |
| 278 | [[ ! -f ${NEWDIR}/moduledb ]] && \ |
278 | [[ ! -f "${NEWDIR}"/moduledb ]] && \ |
| 279 | mv ${OLDDIR}/moduledb ${NEWDIR}/moduledb |
279 | mv "${OLDDIR}"/moduledb "${NEWDIR}"/moduledb |
| 280 | rm -f ${OLDDIR}/* |
280 | rm -f "${OLDDIR}"/* |
| 281 | rmdir ${OLDDIR} |
281 | rmdir "${OLDDIR}" |
| 282 | fi |
282 | fi |
| 283 | } |
283 | } |
| 284 | |
284 | |
| 285 | # internal function |
285 | # internal function |
| 286 | # |
286 | # |
| … | |
… | |
| 288 | # DESCRIPTION: |
288 | # DESCRIPTION: |
| 289 | # It adds the package to the /var/lib/module-rebuild/moduledb database used by the module-rebuild utility. |
289 | # It adds the package to the /var/lib/module-rebuild/moduledb database used by the module-rebuild utility. |
| 290 | update_moduledb() { |
290 | update_moduledb() { |
| 291 | debug-print-function ${FUNCNAME} $* |
291 | debug-print-function ${FUNCNAME} $* |
| 292 | |
292 | |
| 293 | local MODULEDB_DIR=${ROOT}/var/lib/module-rebuild/ |
293 | local MODULEDB_DIR="${ROOT}"/var/lib/module-rebuild/ |
| 294 | move_old_moduledb |
294 | move_old_moduledb |
| 295 | |
295 | |
| 296 | if [[ ! -f ${MODULEDB_DIR}/moduledb ]]; then |
296 | if [[ ! -f "${MODULEDB_DIR}"/moduledb ]]; then |
| 297 | [[ ! -d ${MODULEDB_DIR} ]] && mkdir -p ${MODULEDB_DIR} |
297 | [[ ! -d "${MODULEDB_DIR}" ]] && mkdir -p "${MODULEDB_DIR}" |
| 298 | touch ${MODULEDB_DIR}/moduledb |
298 | touch "${MODULEDB_DIR}"/moduledb |
| 299 | fi |
299 | fi |
| 300 | |
300 | |
| 301 | if ! grep -qs ${CATEGORY}/${PN}-${PVR} ${MODULEDB_DIR}/moduledb ; then |
301 | if ! grep -qs ${CATEGORY}/${PN}-${PVR} "${MODULEDB_DIR}"/moduledb ; then |
| 302 | einfo "Adding module to moduledb." |
302 | einfo "Adding module to moduledb." |
| 303 | echo "a:1:${CATEGORY}/${PN}-${PVR}" >> ${MODULEDB_DIR}/moduledb |
303 | echo "a:1:${CATEGORY}/${PN}-${PVR}" >> "${MODULEDB_DIR}"/moduledb |
| 304 | fi |
304 | fi |
| 305 | } |
305 | } |
| 306 | |
306 | |
| 307 | # internal function |
307 | # internal function |
| 308 | # |
308 | # |
| … | |
… | |
| 311 | # It removes the package from the /var/lib/module-rebuild/moduledb database used by |
311 | # It removes the package from the /var/lib/module-rebuild/moduledb database used by |
| 312 | # the module-rebuild utility. |
312 | # the module-rebuild utility. |
| 313 | remove_moduledb() { |
313 | remove_moduledb() { |
| 314 | debug-print-function ${FUNCNAME} $* |
314 | debug-print-function ${FUNCNAME} $* |
| 315 | |
315 | |
| 316 | local MODULEDB_DIR=${ROOT}/var/lib/module-rebuild/ |
316 | local MODULEDB_DIR="${ROOT}"/var/lib/module-rebuild/ |
| 317 | move_old_moduledb |
317 | move_old_moduledb |
| 318 | |
318 | |
| 319 | if grep -qs ${CATEGORY}/${PN}-${PVR} ${MODULEDB_DIR}/moduledb ; then |
319 | if grep -qs ${CATEGORY}/${PN}-${PVR} "${MODULEDB_DIR}"/moduledb ; then |
| 320 | einfo "Removing ${CATEGORY}/${PN}-${PVR} from moduledb." |
320 | einfo "Removing ${CATEGORY}/${PN}-${PVR} from moduledb." |
| 321 | sed -i -e "/.*${CATEGORY}\/${PN}-${PVR}.*/d" ${MODULEDB_DIR}/moduledb |
321 | sed -i -e "/.*${CATEGORY}\/${PN}-${PVR}.*/d" "${MODULEDB_DIR}"/moduledb |
| 322 | fi |
322 | fi |
| 323 | } |
323 | } |
| 324 | |
324 | |
| 325 | # @FUNCTION: set_kvobj |
325 | # @FUNCTION: set_kvobj |
| 326 | # @DESCRIPTION: |
326 | # @DESCRIPTION: |
| … | |
… | |
| 414 | module_modinfo="$(modinfo -p ${currm_path}.${KV_OBJ})" |
414 | module_modinfo="$(modinfo -p ${currm_path}.${KV_OBJ})" |
| 415 | module_config="${T}/modulesd-${currm}" |
415 | module_config="${T}/modulesd-${currm}" |
| 416 | |
416 | |
| 417 | ebegin "Preparing file for modules.d" |
417 | ebegin "Preparing file for modules.d" |
| 418 | #----------------------------------------------------------------------- |
418 | #----------------------------------------------------------------------- |
| 419 | echo "# modules.d configuration file for ${currm}" >> ${module_config} |
419 | echo "# modules.d configuration file for ${currm}" >> "${module_config}" |
| 420 | #----------------------------------------------------------------------- |
420 | #----------------------------------------------------------------------- |
| 421 | [[ -n ${module_docs} ]] && \ |
421 | [[ -n ${module_docs} ]] && \ |
| 422 | echo "# For more information please read:" >> ${module_config} |
422 | echo "# For more information please read:" >> "${module_config}" |
| 423 | for t in ${module_docs} |
423 | for t in ${module_docs} |
| 424 | do |
424 | do |
| 425 | echo "# ${t//*\/}" >> ${module_config} |
425 | echo "# ${t//*\/}" >> "${module_config}" |
| 426 | done |
426 | done |
| 427 | echo >> ${module_config} |
427 | echo >> "${module_config}" |
| 428 | |
428 | |
| 429 | #----------------------------------------------------------------------- |
429 | #----------------------------------------------------------------------- |
| 430 | if [[ ${module_aliases} -gt 0 ]] |
430 | if [[ ${module_aliases} -gt 0 ]] |
| 431 | then |
431 | then |
| 432 | echo "# Internal Aliases - Do not edit" >> ${module_config} |
432 | echo "# Internal Aliases - Do not edit" >> "${module_config}" |
| 433 | echo "# ------------------------------" >> ${module_config} |
433 | echo "# ------------------------------" >> "${module_config}" |
| 434 | |
434 | |
| 435 | for((t=0; t<${module_aliases}; t++)) |
435 | for((t=0; t<${module_aliases}; t++)) |
| 436 | do |
436 | do |
| 437 | echo "alias $(eval echo \${MODULESD_${currm}_ALIASES[$t]})" \ |
437 | echo "alias $(eval echo \${MODULESD_${currm}_ALIASES[$t]})" \ |
| 438 | >> ${module_config} |
438 | >> "${module_config}" |
| 439 | done |
439 | done |
| 440 | echo '' >> ${module_config} |
440 | echo '' >> "${module_config}" |
| 441 | fi |
441 | fi |
| 442 | |
442 | |
| 443 | #----------------------------------------------------------------------- |
443 | #----------------------------------------------------------------------- |
| 444 | if [[ -n ${module_modinfo} ]] |
444 | if [[ -n ${module_modinfo} ]] |
| 445 | then |
445 | then |
| 446 | echo >> ${module_config} |
446 | echo >> "${module_config}" |
| 447 | echo "# Configurable module parameters" >> ${module_config} |
447 | echo "# Configurable module parameters" >> "${module_config}" |
| 448 | echo "# ------------------------------" >> ${module_config} |
448 | echo "# ------------------------------" >> "${module_config}" |
| 449 | myIFS="${IFS}" |
449 | myIFS="${IFS}" |
| 450 | IFS="$(echo -en "\n\b")" |
450 | IFS="$(echo -en "\n\b")" |
| 451 | |
451 | |
| 452 | for t in ${module_modinfo} |
452 | for t in ${module_modinfo} |
| 453 | do |
453 | do |
| 454 | myVAR="$(echo ${t#*:} | grep -e " [0-9][ =]" | sed "s:.*\([01][= ]\).*:\1:")" |
454 | myVAR="$(echo ${t#*:} | grep -e " [0-9][ =]" | sed "s:.*\([01][= ]\).*:\1:")" |
| 455 | if [[ -n ${myVAR} ]] |
455 | if [[ -n ${myVAR} ]] |
| 456 | then |
456 | then |
| 457 | module_opts="${module_opts} ${t%%:*}:${myVAR}" |
457 | module_opts="${module_opts} ${t%%:*}:${myVAR}" |
| 458 | fi |
458 | fi |
| 459 | echo -e "# ${t%%:*}:\t${t#*:}" >> ${module_config} |
459 | echo -e "# ${t%%:*}:\t${t#*:}" >> "${module_config}" |
| 460 | done |
460 | done |
| 461 | IFS="${myIFS}" |
461 | IFS="${myIFS}" |
| 462 | echo '' >> ${module_config} |
462 | echo '' >> "${module_config}" |
| 463 | fi |
463 | fi |
| 464 | |
464 | |
| 465 | #----------------------------------------------------------------------- |
465 | #----------------------------------------------------------------------- |
| 466 | if [[ $(eval echo \${MODULESD_${currm}_ALIASES[0]}) == guess ]] |
466 | if [[ $(eval echo \${MODULESD_${currm}_ALIASES[0]}) == guess ]] |
| 467 | then |
467 | then |
| 468 | # So lets do some guesswork eh? |
468 | # So lets do some guesswork eh? |
| 469 | if [[ -n ${module_opts} ]] |
469 | if [[ -n ${module_opts} ]] |
| 470 | then |
470 | then |
| 471 | echo "# For Example..." >> ${module_config} |
471 | echo "# For Example..." >> "${module_config}" |
| 472 | echo "# --------------" >> ${module_config} |
472 | echo "# --------------" >> "${module_config}" |
| 473 | for t in ${module_opts} |
473 | for t in ${module_opts} |
| 474 | do |
474 | do |
| 475 | echo "# options ${currm} ${t//:*}=${t//*:}" >> ${module_config} |
475 | echo "# options ${currm} ${t//:*}=${t//*:}" >> "${module_config}" |
| 476 | done |
476 | done |
| 477 | echo '' >> ${module_config} |
477 | echo '' >> "${module_config}" |
| 478 | fi |
478 | fi |
| 479 | elif [[ ${module_examples} -gt 0 ]] |
479 | elif [[ ${module_examples} -gt 0 ]] |
| 480 | then |
480 | then |
| 481 | echo "# For Example..." >> ${module_config} |
481 | echo "# For Example..." >> "${module_config}" |
| 482 | echo "# --------------" >> ${module_config} |
482 | echo "# --------------" >> "${module_config}" |
| 483 | for((t=0; t<${module_examples}; t++)) |
483 | for((t=0; t<${module_examples}; t++)) |
| 484 | do |
484 | do |
| 485 | echo "options $(eval echo \${MODULESD_${currm}_EXAMPLES[$t]})" \ |
485 | echo "options $(eval echo \${MODULESD_${currm}_EXAMPLES[$t]})" \ |
| 486 | >> ${module_config} |
486 | >> "${module_config}" |
| 487 | done |
487 | done |
| 488 | echo '' >> ${module_config} |
488 | echo '' >> "${module_config}" |
| 489 | fi |
489 | fi |
| 490 | |
490 | |
| 491 | #----------------------------------------------------------------------- |
491 | #----------------------------------------------------------------------- |
| 492 | if [[ ${module_additions} -gt 0 ]] |
492 | if [[ ${module_additions} -gt 0 ]] |
| 493 | then |
493 | then |
| 494 | for((t=0; t<${module_additions}; t++)) |
494 | for((t=0; t<${module_additions}; t++)) |
| 495 | do |
495 | do |
| 496 | echo "$(eval echo \${MODULESD_${currm}_ADDITIONS[$t]})" \ |
496 | echo "$(eval echo \${MODULESD_${currm}_ADDITIONS[$t]})" \ |
| 497 | >> ${module_config} |
497 | >> "${module_config}" |
| 498 | done |
498 | done |
| 499 | echo '' >> ${module_config} |
499 | echo '' >> "${module_config}" |
| 500 | fi |
500 | fi |
| 501 | |
501 | |
| 502 | #----------------------------------------------------------------------- |
502 | #----------------------------------------------------------------------- |
| 503 | |
503 | |
| 504 | # then we install it |
504 | # then we install it |
| 505 | if kernel_is ge 2 6; then |
505 | if kernel_is ge 2 6; then |
| 506 | insinto /etc/modprobe.d |
506 | insinto /etc/modprobe.d |
| 507 | else |
507 | else |
| 508 | insinto /etc/modules.d |
508 | insinto /etc/modules.d |
| 509 | fi |
509 | fi |
| 510 | newins ${module_config} ${currm_path//*\/} |
510 | newins "${module_config}" "${currm_path//*\/}.conf" |
| 511 | |
511 | |
| 512 | # and install any documentation we might have. |
512 | # and install any documentation we might have. |
| 513 | [[ -n ${module_docs} ]] && dodoc ${module_docs} |
513 | [[ -n ${module_docs} ]] && dodoc ${module_docs} |
| 514 | done |
514 | done |
| 515 | eend 0 |
515 | eend 0 |
| … | |
… | |
| 613 | ABI="${KERNEL_ABI}" |
613 | ABI="${KERNEL_ABI}" |
| 614 | |
614 | |
| 615 | BUILD_TARGETS=${BUILD_TARGETS:-clean module} |
615 | BUILD_TARGETS=${BUILD_TARGETS:-clean module} |
| 616 | strip_modulenames; |
616 | strip_modulenames; |
| 617 | cd "${S}" |
617 | cd "${S}" |
|
|
618 | touch Module.symvers |
| 618 | for i in ${MODULE_NAMES} |
619 | for i in ${MODULE_NAMES} |
| 619 | do |
620 | do |
| 620 | unset libdir srcdir objdir |
621 | unset libdir srcdir objdir |
| 621 | for n in $(find_module_params ${i}) |
622 | for n in $(find_module_params ${i}) |
| 622 | do |
623 | do |
| … | |
… | |
| 626 | srcdir=${srcdir:-${S}} |
627 | srcdir=${srcdir:-${S}} |
| 627 | objdir=${objdir:-${srcdir}} |
628 | objdir=${objdir:-${srcdir}} |
| 628 | |
629 | |
| 629 | if [ ! -f "${srcdir}/.built" ]; |
630 | if [ ! -f "${srcdir}/.built" ]; |
| 630 | then |
631 | then |
| 631 | cd ${srcdir} |
632 | cd "${srcdir}" |
|
|
633 | ln -s "${S}"/Module.symvers Module.symvers |
| 632 | einfo "Preparing ${modulename} module" |
634 | einfo "Preparing ${modulename} module" |
| 633 | if [[ -n ${ECONF_PARAMS} ]] |
635 | if [[ -n ${ECONF_PARAMS} ]] |
| 634 | then |
636 | then |
| 635 | econf ${ECONF_PARAMS} || \ |
637 | econf ${ECONF_PARAMS} || \ |
| 636 | die "Unable to run econf ${ECONF_PARAMS}" |
638 | die "Unable to run econf ${ECONF_PARAMS}" |
| … | |
… | |
| 646 | LDFLAGS=\"$(get_abi_LDFLAGS)\" \ |
648 | LDFLAGS=\"$(get_abi_LDFLAGS)\" \ |
| 647 | ${BUILD_FIXES} \ |
649 | ${BUILD_FIXES} \ |
| 648 | ${BUILD_PARAMS} \ |
650 | ${BUILD_PARAMS} \ |
| 649 | ${BUILD_TARGETS} " \ |
651 | ${BUILD_TARGETS} " \ |
| 650 | || die "Unable to emake HOSTCC="$(tc-getBUILD_CC)" CROSS_COMPILE=${CHOST}- LDFLAGS="$(get_abi_LDFLAGS)" ${BUILD_FIXES} ${BUILD_PARAMS} ${BUILD_TARGETS}" |
652 | || die "Unable to emake HOSTCC="$(tc-getBUILD_CC)" CROSS_COMPILE=${CHOST}- LDFLAGS="$(get_abi_LDFLAGS)" ${BUILD_FIXES} ${BUILD_PARAMS} ${BUILD_TARGETS}" |
|
|
653 | cd "${OLDPWD}" |
| 651 | touch ${srcdir}/.built |
654 | touch "${srcdir}"/.built |
| 652 | cd ${OLDPWD} |
|
|
| 653 | fi |
655 | fi |
| 654 | done |
656 | done |
| 655 | |
657 | |
| 656 | set_arch_to_portage |
658 | set_arch_to_portage |
| 657 | ABI="${myABI}" |
659 | ABI="${myABI}" |
| … | |
… | |
| 684 | libdir=${libdir:-misc} |
686 | libdir=${libdir:-misc} |
| 685 | srcdir=${srcdir:-${S}} |
687 | srcdir=${srcdir:-${S}} |
| 686 | objdir=${objdir:-${srcdir}} |
688 | objdir=${objdir:-${srcdir}} |
| 687 | |
689 | |
| 688 | einfo "Installing ${modulename} module" |
690 | einfo "Installing ${modulename} module" |
| 689 | cd ${objdir} || die "${objdir} does not exist" |
691 | cd "${objdir}" || die "${objdir} does not exist" |
| 690 | insinto /lib/modules/${KV_FULL}/${libdir} |
692 | insinto /lib/modules/${KV_FULL}/${libdir} |
| 691 | doins ${modulename}.${KV_OBJ} || die "doins ${modulename}.${KV_OBJ} failed" |
693 | doins ${modulename}.${KV_OBJ} || die "doins ${modulename}.${KV_OBJ} failed" |
| 692 | cd ${OLDPWD} |
694 | cd "${OLDPWD}" |
| 693 | |
695 | |
| 694 | generate_modulesd ${objdir}/${modulename} |
696 | generate_modulesd "${objdir}/${modulename}" |
| 695 | done |
697 | done |
| 696 | } |
698 | } |
| 697 | |
699 | |
| 698 | # @FUNCTION: linux-mod_pkg_preinst |
700 | # @FUNCTION: linux-mod_pkg_preinst |
| 699 | # @DESCRIPTION: |
701 | # @DESCRIPTION: |