/[gentoo-x86]/eclass/kernel-2.eclass
Gentoo

Diff of /eclass/kernel-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.135 Revision 1.136
1# Copyright 1999-2005 Gentoo Foundation 1# Copyright 1999-2005 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/kernel-2.eclass,v 1.135 2005/07/11 15:08:06 swegener Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/kernel-2.eclass,v 1.136 2005/07/16 01:28:27 vapier Exp $
4 4
5# Description: kernel.eclass rewrite for a clean base regarding the 2.6 5# Description: kernel.eclass rewrite for a clean base regarding the 2.6
6# series of kernel with back-compatibility for 2.4 6# series of kernel with back-compatibility for 2.4
7# 7#
8# Maintainer: John Mylchreest <johnm@gentoo.org> 8# Maintainer: John Mylchreest <johnm@gentoo.org>
72 72
73HOMEPAGE="http://www.kernel.org/ http://www.gentoo.org/" 73HOMEPAGE="http://www.kernel.org/ http://www.gentoo.org/"
74LICENSE="GPL-2" 74LICENSE="GPL-2"
75 75
76# set LINUX_HOSTCFLAGS if not already set 76# set LINUX_HOSTCFLAGS if not already set
77[ -z "$LINUX_HOSTCFLAGS" ] && \ 77[[ -z ${LINUX_HOSTCFLAGS} ]] && \
78 LINUX_HOSTCFLAGS="-Wall -Wstrict-prototypes -Os -fomit-frame-pointer -I${S}/include" 78 LINUX_HOSTCFLAGS="-Wall -Wstrict-prototypes -Os -fomit-frame-pointer -I${S}/include"
79 79
80#Eclass functions only from here onwards ... 80#Eclass functions only from here onwards ...
81#============================================================== 81#==============================================================
82handle_genpatches() { 82handle_genpatches() {
287 287
288# Unpack functions 288# Unpack functions
289#============================================================== 289#==============================================================
290unpack_2_4() { 290unpack_2_4() {
291 # Kernel ARCH != portage ARCH 291 # Kernel ARCH != portage ARCH
292 local ARCH=$(tc-arch-kernel) 292 local KARCH=$(tc-arch-kernel)
293 293
294 # When cross-compiling, we need to set the ARCH/CROSS_COMPILE
295 # variables properly or bad things happen !
296 local xmakeopts="ARCH=${KARCH}"
297 if [[ ${CTARGET} != ${CHOST} ]]; then
298 xmakeopts="${xmakeopts} CROSS_COMPILE=${CTARGET}-"
299 elif type -p ${CHOST}-ar; then
300 xmakeopts="${xmakeopts} CROSS_COMPILE=${CHOST}-"
301 fi
302
294 cd ${S} 303 cd "${S}"
295 # this file is required for other things to build properly, 304 # this file is required for other things to build properly,
296 # so we autogenerate it 305 # so we autogenerate it
297 make mrproper || die "make mrproper died" 306 make mrproper ${xmakeopts} || die "make mrproper died"
298 make include/linux/version.h || die "make include/linux/version.h failed" 307 make include/linux/version.h ${xmakeopts} || die "make include/linux/version.h failed"
299 echo ">>> version.h compiled successfully." 308 echo ">>> version.h compiled successfully."
300
301 ARCH=$(tc-arch)
302} 309}
303 310
304universal_unpack() { 311universal_unpack() {
305 cd ${WORKDIR} 312 cd ${WORKDIR}
306 unpack linux-${OKV}.tar.bz2 313 unpack linux-${OKV}.tar.bz2
307 if [[ "${OKV}" != "${KV_FULL}" ]]; then 314 if [[ "${OKV}" != "${KV_FULL}" ]]; then
308 mv linux-${OKV} linux-${KV_FULL} \ 315 mv linux-${OKV} linux-${KV_FULL} \
309 || die "Unable to move source tree to ${KV_FULL}." 316 || die "Unable to move source tree to ${KV_FULL}."
310 fi 317 fi
311 cd ${S} 318 cd "${S}"
312 319
313 # remove all backup files 320 # remove all backup files
314 find . -iname "*~" -exec rm {} \; 2> /dev/null 321 find . -iname "*~" -exec rm {} \; 2> /dev/null
315 322
316 # fix a problem on ppc where TOUT writes to /usr/src/linux breaking sandbox 323 # fix a problem on ppc where TOUT writes to /usr/src/linux breaking sandbox
317 use ppc && \ 324 use ppc && \
318 sed -ie 's|TOUT := .tmp_gas_check|TOUT := $(T).tmp_gas_check|' \ 325 sed -ie 's|TOUT := .tmp_gas_check|TOUT := $(T).tmp_gas_check|' \
319 ${S}/arch/ppc/Makefile 326 "${S}"/arch/ppc/Makefile
320} 327}
321 328
322unpack_set_extraversion() { 329unpack_set_extraversion() {
323 cd ${S} 330 cd "${S}"
324 sed -i -e "s:^\(EXTRAVERSION =\).*:\1 ${EXTRAVERSION}:" Makefile 331 sed -i -e "s:^\(EXTRAVERSION =\).*:\1 ${EXTRAVERSION}:" Makefile
325 cd ${OLDPWD} 332 cd ${OLDPWD}
326} 333}
327 334
328# Should be done after patches have been applied 335# Should be done after patches have been applied
329# Otherwise patches that modify the same area of Makefile will fail 336# Otherwise patches that modify the same area of Makefile will fail
330unpack_fix_install_path() { 337unpack_fix_install_path() {
331 cd ${S} 338 cd "${S}"
332 sed -i -e 's:#export\tINSTALL_PATH:export\tINSTALL_PATH:' Makefile 339 sed -i -e 's:#export\tINSTALL_PATH:export\tINSTALL_PATH:' Makefile
333} 340}
334 341
335unpack_fix_docbook() { 342unpack_fix_docbook() {
336 if [[ -d ${S}/Documentation/DocBook ]]; then 343 if [[ -d ${S}/Documentation/DocBook ]]; then
337 cd ${S}/Documentation/DocBook 344 cd "${S}"/Documentation/DocBook
338 sed -ie "s:db2:docbook2:g" Makefile 345 sed -ie "s:db2:docbook2:g" Makefile
339 cd ${OLDPWD} 346 cd ${OLDPWD}
340 fi 347 fi
341} 348}
342 349
347 # if it exists. 354 # if it exists.
348 [[ -n ${KBUILD_OUTPUT} ]] && unset KBUILD_OUTPUT 355 [[ -n ${KBUILD_OUTPUT} ]] && unset KBUILD_OUTPUT
349 356
350 # if we couldnt obtain HOSTCFLAGS from the Makefile, 357 # if we couldnt obtain HOSTCFLAGS from the Makefile,
351 # then set it to something sane 358 # then set it to something sane
352 local HOSTCFLAGS=$(getfilevar HOSTCFLAGS ${S}/Makefile) 359 local HOSTCFLAGS=$(getfilevar HOSTCFLAGS "${S}"/Makefile)
353 HOSTCFLAGS=${HOSTCFLAGS:--Wall -Wstrict-prototypes -O2 -fomit-frame-pointer} 360 HOSTCFLAGS=${HOSTCFLAGS:--Wall -Wstrict-prototypes -O2 -fomit-frame-pointer}
354 361
355 # Kernel ARCH != portage ARCH 362 # Kernel ARCH != portage ARCH
356 local KARCH=$(tc-arch-kernel) 363 local KARCH=$(tc-arch-kernel)
357 364
407} 414}
408 415
409install_headers() { 416install_headers() {
410 local ddir=$(kernel_header_destdir) 417 local ddir=$(kernel_header_destdir)
411 418
412 cd ${S} 419 cd "${S}"
413 dodir ${ddir}/linux 420 dodir ${ddir}/linux
414 cp -ax ${S}/include/linux/* ${D}/${ddir}/linux 421 cp -ax "${S}"/include/linux/* ${D}/${ddir}/linux
415 rm -rf ${D}/${ddir}/linux/modules 422 rm -rf ${D}/${ddir}/linux/modules
416 423
417 # Handle multilib headers 424 # Handle multilib headers
418 case $(tc-arch-kernel) in 425 case $(tc-arch-kernel) in
419 sparc64) 426 sparc64)
420 dodir ${ddir}/asm-sparc 427 dodir ${ddir}/asm-sparc
421 cp -ax ${S}/include/asm-sparc/* ${D}/${ddir}/asm-sparc 428 cp -ax "${S}"/include/asm-sparc/* ${D}/${ddir}/asm-sparc
422 429
423 dodir ${ddir}/asm-sparc64 430 dodir ${ddir}/asm-sparc64
424 cp -ax ${S}/include/asm-sparc64/* ${D}/${ddir}/asm-sparc64 431 cp -ax "${S}"/include/asm-sparc64/* ${D}/${ddir}/asm-sparc64
425 432
426 create_ml_includes ${ddir}/asm !__arch64__:${ddir}/asm-sparc __arch64__:${ddir}/asm-sparc64 433 create_ml_includes ${ddir}/asm !__arch64__:${ddir}/asm-sparc __arch64__:${ddir}/asm-sparc64
427 ;; 434 ;;
428 x86_64) 435 x86_64)
429 dodir ${ddir}/asm-i386 436 dodir ${ddir}/asm-i386
430 cp -ax ${S}/include/asm-i386/* ${D}/${ddir}/asm-i386 437 cp -ax "${S}"/include/asm-i386/* ${D}/${ddir}/asm-i386
431 438
432 dodir ${ddir}/asm-x86_64 439 dodir ${ddir}/asm-x86_64
433 cp -ax ${S}/include/asm-x86_64/* ${D}/${ddir}/asm-x86_64 440 cp -ax "${S}"/include/asm-x86_64/* ${D}/${ddir}/asm-x86_64
434 441
435 create_ml_includes ${ddir}/asm __i386__:${ddir}/asm-i386 __x86_64__:${ddir}/asm-x86_64 442 create_ml_includes ${ddir}/asm __i386__:${ddir}/asm-i386 __x86_64__:${ddir}/asm-x86_64
436 ;; 443 ;;
437 ppc64) 444 ppc64)
438 dodir ${ddir}/asm-ppc 445 dodir ${ddir}/asm-ppc
439 cp -ax ${S}/include/asm-ppc/* ${D}/${ddir}/asm-ppc 446 cp -ax "${S}"/include/asm-ppc/* ${D}/${ddir}/asm-ppc
440 447
441 dodir ${ddir}/asm-ppc64 448 dodir ${ddir}/asm-ppc64
442 cp -ax ${S}/include/asm-ppc64/* ${D}/${ddir}/asm-ppc64 449 cp -ax "${S}"/include/asm-ppc64/* ${D}/${ddir}/asm-ppc64
443 450
444 create_ml_includes ${ddir}/asm !__powerpc64__:${ddir}/asm-ppc __powerpc64__:${ddir}/asm-ppc64 451 create_ml_includes ${ddir}/asm !__powerpc64__:${ddir}/asm-ppc __powerpc64__:${ddir}/asm-ppc64
445 ;; 452 ;;
446 arm) 453 arm)
447 dodir ${ddir}/asm 454 dodir ${ddir}/asm
448 cp -ax ${S}/include/asm/* ${D}/${ddir}/asm 455 cp -ax "${S}"/include/asm/* ${D}/${ddir}/asm
449 [[ ! -e ${D}/${ddir}/asm/arch ]] && ln -s arch-ebsa285 ${D}/${ddir}/asm/arch 456 [[ ! -e ${D}/${ddir}/asm/arch ]] && ln -s arch-ebsa285 ${D}/${ddir}/asm/arch
450 [[ ! -e ${D}/${ddir}/asm/proc ]] && ln -s proc-armv ${D}/${ddir}/asm/proc 457 [[ ! -e ${D}/${ddir}/asm/proc ]] && ln -s proc-armv ${D}/${ddir}/asm/proc
451 ;; 458 ;;
452 *) 459 *)
453 dodir ${ddir}/asm 460 dodir ${ddir}/asm
454 cp -ax ${S}/include/asm/* ${D}/${ddir}/asm 461 cp -ax "${S}"/include/asm/* ${D}/${ddir}/asm
455 ;; 462 ;;
456 esac 463 esac
457 464
458 if kernel_is 2 6; then 465 if kernel_is 2 6; then
459 dodir ${ddir}/asm-generic 466 dodir ${ddir}/asm-generic
460 cp -ax ${S}/include/asm-generic/* ${D}/${ddir}/asm-generic 467 cp -ax "${S}"/include/asm-generic/* ${D}/${ddir}/asm-generic
461 fi 468 fi
462 469
463 # clean up 470 # clean up
464 find "${D}" -name '*.orig' -exec rm -f {} \; 471 find "${D}" -name '*.orig' -exec rm -f {} \;
465 472
467} 474}
468 475
469install_sources() { 476install_sources() {
470 local doc docs file 477 local doc docs file
471 478
472 cd ${S} 479 cd "${S}"
473 dodir /usr/src 480 dodir /usr/src
474 echo ">>> Copying sources ..." 481 echo ">>> Copying sources ..."
475 482
476 file="$(find ${WORKDIR} -iname "docs" -type d)" 483 file="$(find ${WORKDIR} -iname "docs" -type d)"
477 if [[ -n ${file} ]]; then 484 if [[ -n ${file} ]]; then
478 for file in $(find ${file} -type f); do 485 for file in $(find ${file} -type f); do
479 echo "${file//*docs\/}" >> ${S}/patches.txt 486 echo "${file//*docs\/}" >> "${S}"/patches.txt
480 echo "===================================================" >> ${S}/patches.txt 487 echo "===================================================" >> "${S}"/patches.txt
481 cat ${file} >> ${S}/patches.txt 488 cat ${file} >> "${S}"/patches.txt
482 echo "===================================================" >> ${S}/patches.txt 489 echo "===================================================" >> "${S}"/patches.txt
483 echo "" >> ${S}/patches.txt 490 echo "" >> "${S}"/patches.txt
484 done 491 done
485 fi 492 fi
486 493
487 if [[ ! -f ${S}/patches.txt ]]; then 494 if [[ ! -f ${S}/patches.txt ]]; then
488 # patches.txt is empty so lets use our ChangeLog 495 # patches.txt is empty so lets use our ChangeLog
489 [[ -f ${FILESDIR}/../ChangeLog ]] && \ 496 [[ -f ${FILESDIR}/../ChangeLog ]] && \
490 echo "Please check the ebuild ChangeLog for more details." \ 497 echo "Please check the ebuild ChangeLog for more details." \
491 > ${S}/patches.txt 498 > "${S}"/patches.txt
492 fi 499 fi
493 500
494 for doc in ${UNIPATCH_DOCS}; do [[ -f ${doc} ]] && docs="${docs} ${doc}"; done 501 for doc in ${UNIPATCH_DOCS}; do [[ -f ${doc} ]] && docs="${docs} ${doc}"; done
495 if [[ -f ${S}/patches.txt ]]; then docs="${docs} ${S}/patches.txt"; fi 502 if [[ -f ${S}/patches.txt ]]; then docs="${docs} ${S}/patches.txt"; fi
496 use doc && ! use arm && ! use s390 && install_manpages 503 use doc && ! use arm && ! use s390 && install_manpages
907 914
908 kernel_is 2 4 && unpack_2_4 915 kernel_is 2 4 && unpack_2_4
909} 916}
910 917
911kernel-2_src_compile() { 918kernel-2_src_compile() {
912 cd ${S} 919 cd "${S}"
913 [[ ${ETYPE} == headers ]] && compile_headers 920 [[ ${ETYPE} == headers ]] && compile_headers
914 [[ ${ETYPE} == sources ]] && \ 921 [[ ${ETYPE} == sources ]] && \
915 use doc && ! use arm && ! use s390 && compile_manpages 922 use doc && ! use arm && ! use s390 && compile_manpages
916} 923}
917 924

Legend:
Removed from v.1.135  
changed lines
  Added in v.1.136

  ViewVC Help
Powered by ViewVC 1.1.20