/[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.159 Revision 1.186
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.159 2006/02/17 22:18:20 swegener Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/kernel-2.eclass,v 1.186 2006/08/04 04:24:22 plasmaroo 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>
21# EXTRAVERSION would be something like : -wolk-4.19-r1 21# EXTRAVERSION would be something like : -wolk-4.19-r1
22# K_NOSETEXTRAVERSION - if this is set then EXTRAVERSION will not be 22# K_NOSETEXTRAVERSION - if this is set then EXTRAVERSION will not be
23# automatically set within the kernel Makefile 23# automatically set within the kernel Makefile
24# K_NOUSENAME - if this is set then EXTRAVERSION will not include the 24# K_NOUSENAME - if this is set then EXTRAVERSION will not include the
25# first part of ${PN} in EXTRAVERSION 25# first part of ${PN} in EXTRAVERSION
26# K_NOUSEPR - if this is set then EXTRAVERSION will not include the
27# anything based on ${PR}.
26# K_PREPATCHED - if the patchset is prepatched (ie: mm-sources, 28# K_PREPATCHED - if the patchset is prepatched (ie: mm-sources,
27# ck-sources, ac-sources) it will use PR (ie: -r5) as 29# ck-sources, ac-sources) it will use PR (ie: -r5) as
28# the patchset version for 30# the patchset version for
29# and not use it as a true package revision 31# and not use it as a true package revision
30# K_EXTRAEINFO - this is a new-line seperated list of einfo displays in 32# K_EXTRAEINFO - this is a new-line seperated list of einfo displays in
54# the doc dir 56# the doc dir
55# UNIPATCH_STRICTORDER - if this is set places patches into directories of 57# UNIPATCH_STRICTORDER - if this is set places patches into directories of
56# order, so they are applied in the order passed 58# order, so they are applied in the order passed
57 59
58inherit toolchain-funcs versionator multilib 60inherit toolchain-funcs versionator multilib
59EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install \ 61EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_preinst pkg_postinst
60 pkg_preinst pkg_postinst
61 62
62# Added by Daniel Ostrow <dostrow@gentoo.org> 63# Added by Daniel Ostrow <dostrow@gentoo.org>
63# This is an ugly hack to get around an issue with a 32-bit userland on ppc64. 64# This is an ugly hack to get around an issue with a 32-bit userland on ppc64.
64# I will remove it when I come up with something more reasonable. 65# I will remove it when I come up with something more reasonable.
65[[ ${PROFILE_ARCH} == 'ppc64' ]] && CHOST='powerpc64-unknown-linux-gnu' 66[[ ${PROFILE_ARCH} == 'ppc64' ]] && CHOST='powerpc64-unknown-linux-gnu'
67export CTARGET=${CTARGET:-${CHOST}} 68export CTARGET=${CTARGET:-${CHOST}}
68if [[ ${CTARGET} == ${CHOST} && ${CATEGORY/cross-} != ${CATEGORY} ]]; then 69if [[ ${CTARGET} == ${CHOST} && ${CATEGORY/cross-} != ${CATEGORY} ]]; then
69 export CTARGET=${CATEGORY/cross-} 70 export CTARGET=${CATEGORY/cross-}
70fi 71fi
71 72
72HOMEPAGE="http://www.kernel.org/ http://www.gentoo.org/" 73HOMEPAGE="http://www.kernel.org/ http://www.gentoo.org/ ${HOMEPAGE}"
73LICENSE="GPL-2" 74LICENSE="GPL-2"
75
76# No need to run scanelf/strip on kernel sources/headers (bug #134453).
77RESTRICT="binchecks strip"
74 78
75# set LINUX_HOSTCFLAGS if not already set 79# set LINUX_HOSTCFLAGS if not already set
76[[ -z ${LINUX_HOSTCFLAGS} ]] && \ 80[[ -z ${LINUX_HOSTCFLAGS} ]] && \
77 LINUX_HOSTCFLAGS="-Wall -Wstrict-prototypes -Os -fomit-frame-pointer -I${S}/include" 81 LINUX_HOSTCFLAGS="-Wall -Wstrict-prototypes -Os -fomit-frame-pointer -I${S}/include"
82
83# debugging functions
84#==============================================================
85# this function exists only to help debug kernel-2.eclass
86# if you are adding new functionality in, put a call to it
87# at the start of src_unpack, or during SRC_URI/dep generation.
88debug-print-kernel2-variables() {
89 debug-print "PVR: ${PVR}"
90 debug-print "CKV: ${CKV}"
91 debug-print "OKV: ${OKV}"
92 debug-print "KV: ${KV}"
93 debug-print "KV_FULL: ${KV_FULL}"
94 debug-print "RELEASETYPE: ${RELEASETYPE}"
95 debug-print "RELEASE: ${RELEASE}"
96 debug-print "UNIPATCH_LIST_DEFAULT: ${UNIPATCH_LIST_DEFAULT} "
97 debug-print "UNIPATCH_LIST_GENPATCHES: ${UNIPATCH_LIST_GENPATCHES} "
98 debug-print "UNIPATCH_LIST: ${UNIPATCH_LIST}"
99 debug-print "S: ${S}"
100 debug-print "KERNEL_URI: ${KERNEL_URI}"
101}
78 102
79#Eclass functions only from here onwards ... 103#Eclass functions only from here onwards ...
80#============================================================== 104#==============================================================
81handle_genpatches() { 105handle_genpatches() {
82 local tarball 106 local tarball
139 # Now we know that RELEASE is the -rc/-git 163 # Now we know that RELEASE is the -rc/-git
140 # and RELEASETYPE is the same but with its numerics stripped 164 # and RELEASETYPE is the same but with its numerics stripped
141 # we can work on better sorting EXTRAVERSION. 165 # we can work on better sorting EXTRAVERSION.
142 # first of all, we add the release 166 # first of all, we add the release
143 EXTRAVERSION="${RELEASE}" 167 EXTRAVERSION="${RELEASE}"
168 debug-print "0 EXTRAVERSION:${EXTRAVERSION}"
144 [[ -n ${KV_EXTRA} ]] && EXTRAVERSION=".${KV_EXTRA}${EXTRAVERSION}" 169 [[ -n ${KV_EXTRA} ]] && EXTRAVERSION=".${KV_EXTRA}${EXTRAVERSION}"
145 170
171 debug-print "1 EXTRAVERSION:${EXTRAVERSION}"
172 if [[ -n "${K_NOUSEPR}" ]]; then
173 # Don't add anything based on PR to EXTRAVERSION
174 debug-print "1.0 EXTRAVERSION:${EXTRAVERSION}"
146 if [[ -n ${K_PREPATCHED} ]]; then 175 elif [[ -n ${K_PREPATCHED} ]]; then
176 debug-print "1.1 EXTRAVERSION:${EXTRAVERSION}"
147 EXTRAVERSION="${EXTRAVERSION}-${PN/-*}${PR/r}" 177 EXTRAVERSION="${EXTRAVERSION}-${PN/-*}${PR/r}"
148 elif [[ "${ETYPE}" = "sources" ]]; then 178 elif [[ "${ETYPE}" = "sources" ]]; then
179 debug-print "1.2 EXTRAVERSION:${EXTRAVERSION}"
149 # For some sources we want to use the PV in the extra version 180 # For some sources we want to use the PV in the extra version
150 # This is because upstream releases with a completely different 181 # This is because upstream releases with a completely different
151 # versioning scheme. 182 # versioning scheme.
152 case ${PN/-*} in 183 case ${PN/-*} in
153 wolk) K_USEPV=1;; 184 wolk) K_USEPV=1;;
154 vserver) K_USEPV=1;; 185 vserver) K_USEPV=1;;
155 esac 186 esac
156 187
157 [[ -z ${K_NOUSENAME} ]] && EXTRAVERSION="${EXTRAVERSION}-${PN/-*}" 188 [[ -z "${K_NOUSENAME}" ]] && EXTRAVERSION="${EXTRAVERSION}-${PN/-*}"
158 [[ -n ${K_USEPV} ]] && EXTRAVERSION="${EXTRAVERSION}-${PV//_/-}" 189 [[ -n "${K_USEPV}" ]] && EXTRAVERSION="${EXTRAVERSION}-${PV//_/-}"
159 [[ -n ${PR//r0} ]] && EXTRAVERSION="${EXTRAVERSION}-${PR}" 190 [[ -n "${PR//r0}" ]] && EXTRAVERSION="${EXTRAVERSION}-${PR}"
160 fi 191 fi
192 debug-print "2 EXTRAVERSION:${EXTRAVERSION}"
161 193
162 # The only messing around which should actually effect this is for KV_EXTRA 194 # The only messing around which should actually effect this is for KV_EXTRA
163 # since this has to limit OKV to MAJ.MIN.PAT and strip EXTRA off else 195 # since this has to limit OKV to MAJ.MIN.PAT and strip EXTRA off else
164 # KV_FULL evaluates to MAJ.MIN.PAT.EXT.EXT after EXTRAVERSION 196 # KV_FULL evaluates to MAJ.MIN.PAT.EXT.EXT after EXTRAVERSION
165 if [[ -n ${KV_EXTRA} ]]; then 197 if [[ -n ${KV_EXTRA} ]]; then
201 KERNEL_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/snapshots/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.bz2 233 KERNEL_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/snapshots/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.bz2
202 mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/testing/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE/-git*}.bz2 234 mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/testing/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE/-git*}.bz2
203 mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/linux-${OKV}.tar.bz2" 235 mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/linux-${OKV}.tar.bz2"
204 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE/-git*}.bz2 ${DISTDIR}/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.bz2" 236 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE/-git*}.bz2 ${DISTDIR}/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.bz2"
205 fi 237 fi
238
239 debug-print-kernel2-variables
206 240
207 handle_genpatches 241 handle_genpatches
208} 242}
209 243
210kernel_is() { 244kernel_is() {
248} 282}
249 283
250# Capture the sources type and set DEPENDs 284# Capture the sources type and set DEPENDs
251if [[ ${ETYPE} == sources ]]; then 285if [[ ${ETYPE} == sources ]]; then
252 DEPEND="!build? ( sys-apps/sed 286 DEPEND="!build? ( sys-apps/sed
253 >=sys-devel/binutils-2.11.90.0.31 ) 287 >=sys-devel/binutils-2.11.90.0.31 )"
254 doc? ( app-text/docbook-sgml-utils
255 app-text/xmlto )"
256 RDEPEND="!build? ( >=sys-libs/ncurses-5.2 288 RDEPEND="!build? ( >=sys-libs/ncurses-5.2
257 sys-devel/make ) 289 sys-devel/make )
258 virtual/dev-manager" 290 virtual/dev-manager"
259 291
260 PROVIDE="virtual/linux-sources" 292 PROVIDE="virtual/linux-sources"
261 kernel_is gt 2 4 && PROVIDE="${PROVIDE} virtual/alsa" 293 kernel_is gt 2 4 && PROVIDE="${PROVIDE} virtual/alsa"
262 294
263 SLOT="${PVR}" 295 SLOT="${PVR}"
264 DESCRIPTION="Sources for the ${KV_MAJOR}.${KV_MINOR} linux kernel" 296 DESCRIPTION="Sources for the ${KV_MAJOR}.${KV_MINOR} linux kernel"
265 IUSE="symlink build doc" 297 IUSE="symlink build"
266elif [[ ${ETYPE} == headers ]]; then 298elif [[ ${ETYPE} == headers ]]; then
267 DESCRIPTION="Linux system headers" 299 DESCRIPTION="Linux system headers"
268 IUSE="" 300 [[ "${PN}" == 'linux-headers' ]] && IUSE="gcc64"
301
302 # Since we should NOT honour KBUILD_OUTPUT in headers
303 # lets unset it here.
304 unset KBUILD_OUTPUT
269 305
270 if [[ ${CTARGET} = ${CHOST} ]]; then 306 if [[ ${CTARGET} = ${CHOST} ]]; then
271 DEPEND="!virtual/os-headers" 307 DEPEND="!virtual/os-headers"
272 PROVIDE="virtual/os-headers" 308 PROVIDE="virtual/os-headers"
273 SLOT="0" 309 SLOT="0"
282# Cross-compile support functions 318# Cross-compile support functions
283#============================================================== 319#==============================================================
284kernel_header_destdir() { 320kernel_header_destdir() {
285 [[ ${CTARGET} == ${CHOST} ]] \ 321 [[ ${CTARGET} == ${CHOST} ]] \
286 && echo /usr/include \ 322 && echo /usr/include \
287 || echo /usr/${CTARGET}/include 323 || echo /usr/${CTARGET}/usr/include
288} 324}
289 325
290cross_pre_c_headers() { 326cross_pre_c_headers() {
291 [[ -z ${_E_CROSS_HEADERS_ONLY} ]] && return 1 327 has _E_CROSS_HEADERS_ONLY ${USE} && [[ ${CHOST} != ${CTARGET} ]]
292 [[ ${CHOST} == ${CTARGET} ]] && return 1
293 return 0
294} 328}
295 329
296env_setup_xmakeopts() { 330env_setup_xmakeopts() {
297 # Kernel ARCH != portage ARCH 331 # Kernel ARCH != portage ARCH
298 export KARCH=$(tc-arch-kernel) 332 export KARCH=$(tc-arch-kernel)
309} 343}
310 344
311# Unpack functions 345# Unpack functions
312#============================================================== 346#==============================================================
313unpack_2_4() { 347unpack_2_4() {
314 env_setup_xmakeopts
315
316 cd "${S}"
317 # this file is required for other things to build properly, 348 # this file is required for other things to build properly,
318 # so we autogenerate it 349 # so we autogenerate it
319 make -s mrproper ${xmakeopts} || die "make mrproper failed" 350 make -s mrproper ${xmakeopts} || die "make mrproper failed"
320 make -s symlinks ${xmakeopts} || die "make symlinks failed" 351 make -s symlinks ${xmakeopts} || die "make symlinks failed"
321 make -s include/linux/version.h ${xmakeopts} || die "make include/linux/version.h failed" 352 make -s include/linux/version.h ${xmakeopts} || die "make include/linux/version.h failed"
322 echo ">>> version.h compiled successfully." 353 echo ">>> version.h compiled successfully."
323} 354}
324 355
325unpack_2_6() { 356unpack_2_6() {
326 env_setup_xmakeopts
327
328 cd "${S}"
329 # this file is required for other things to build properly, so we 357 # this file is required for other things to build properly, so we
330 # autogenerate it ... touch .config to keep version.h build from 358 # autogenerate it ... generate a .config to keep version.h build from
331 # spitting out an annoying warning 359 # spitting out an annoying warning
332 make -s mrproper ${xmakeopts} || die "make mrproper failed" 360 make -s mrproper ${xmakeopts} 2>/dev/null \
361 || die "make mrproper failed"
362
363 # quick fix for bug #132152 which triggers when it cannot include linux
364 # headers (ie, we have not installed it yet)
365 if ! (make -s defconfig ${xmakeopts} &>/dev/null 2>&1); then
333 touch .config 366 touch .config
334 make -s include/linux/version.h ${xmakeopts} || die "make include/linux/version.h failed" 367 eerror "make defconfig failed."
335 rm -f .config 368 eerror "assuming you dont have any headers installed yet and continuing"
369 epause 5
370 fi
371
372 make -s include/linux/version.h ${xmakeopts} 2>/dev/null \
373 || die "make include/linux/version.h failed"
374 rm -f .config >/dev/null
336} 375}
337 376
338universal_unpack() { 377universal_unpack() {
339 cd ${WORKDIR} 378 cd ${WORKDIR}
340 unpack linux-${OKV}.tar.bz2 379 unpack linux-${OKV}.tar.bz2
380 if [[ -d "linux" ]]; then
381 mv linux linux-${KV_FULL} \
382 || die "Unable to move source tree to ${KV_FULL}."
341 if [[ "${OKV}" != "${KV_FULL}" ]]; then 383 elif [[ "${OKV}" != "${KV_FULL}" ]]; then
342 mv linux-${OKV} linux-${KV_FULL} \ 384 mv linux-${OKV} linux-${KV_FULL} \
343 || die "Unable to move source tree to ${KV_FULL}." 385 || die "Unable to move source tree to ${KV_FULL}."
344 fi 386 fi
345 cd "${S}" 387 cd "${S}"
346 388
347 # remove all backup files 389 # remove all backup files
348 find . -iname "*~" -exec rm {} \; 2> /dev/null 390 find . -iname "*~" -exec rm {} \; 2> /dev/null
349 391
350 # fix a problem on ppc where TOUT writes to /usr/src/linux breaking sandbox 392 # fix a problem on ppc where TOUT writes to /usr/src/linux breaking sandbox
351 use ppc && \ 393 sed -i \
352 sed -ie 's|TOUT := .tmp_gas_check|TOUT := $(T).tmp_gas_check|' \ 394 -e 's|TOUT := .tmp_gas_check|TOUT := $(T).tmp_gas_check|' \
353 "${S}"/arch/ppc/Makefile 395 "${S}"/arch/ppc/Makefile
354} 396}
355 397
356unpack_set_extraversion() { 398unpack_set_extraversion() {
357 cd "${S}" 399 cd "${S}"
358 sed -i -e "s:^\(EXTRAVERSION =\).*:\1 ${EXTRAVERSION}:" Makefile 400 sed -i -e "s:^\(EXTRAVERSION =\).*:\1 ${EXTRAVERSION}:" Makefile
359 cd ${OLDPWD} 401 cd "${OLDPWD}"
360} 402}
361 403
362# Should be done after patches have been applied 404# Should be done after patches have been applied
363# Otherwise patches that modify the same area of Makefile will fail 405# Otherwise patches that modify the same area of Makefile will fail
364unpack_fix_install_path() { 406unpack_fix_install_path() {
365 cd "${S}" 407 cd "${S}"
366 sed -i -e 's:#export\tINSTALL_PATH:export\tINSTALL_PATH:' Makefile 408 sed -i -e 's:#export\tINSTALL_PATH:export\tINSTALL_PATH:' Makefile
367} 409}
368 410
369unpack_fix_docbook() {
370 if [[ -d ${S}/Documentation/DocBook ]]; then
371 cd "${S}"/Documentation/DocBook
372 sed -ie "s:db2:docbook2:g" Makefile
373 cd ${OLDPWD}
374 fi
375}
376
377# Compile Functions 411# Compile Functions
378#============================================================== 412#==============================================================
379compile_headers() { 413compile_headers() {
380 env_setup_xmakeopts 414 env_setup_xmakeopts
381
382 # Since KBUILD_OUTPUT shouldnt be used when compiling headers, lets unset it
383 # if it exists.
384 [[ -n ${KBUILD_OUTPUT} ]] && unset KBUILD_OUTPUT
385 415
386 # if we couldnt obtain HOSTCFLAGS from the Makefile, 416 # if we couldnt obtain HOSTCFLAGS from the Makefile,
387 # then set it to something sane 417 # then set it to something sane
388 local HOSTCFLAGS=$(getfilevar HOSTCFLAGS "${S}"/Makefile) 418 local HOSTCFLAGS=$(getfilevar HOSTCFLAGS "${S}"/Makefile)
389 HOSTCFLAGS=${HOSTCFLAGS:--Wall -Wstrict-prototypes -O2 -fomit-frame-pointer} 419 HOSTCFLAGS=${HOSTCFLAGS:--Wall -Wstrict-prototypes -O2 -fomit-frame-pointer}
409 # to force an include path with $S. 439 # to force an include path with $S.
410 HOSTCFLAGS="${HOSTCFLAGS} -I${S}/include/" 440 HOSTCFLAGS="${HOSTCFLAGS} -I${S}/include/"
411 ln -sf asm-${KARCH} "${S}"/include/asm 441 ln -sf asm-${KARCH} "${S}"/include/asm
412 cross_pre_c_headers && return 0 442 cross_pre_c_headers && return 0
413 443
414 make ${K_DEFCONFIG} HOSTCFLAGS="${HOSTCFLAGS}" ${xmakeopts} || die "defconfig failed" 444 make ${K_DEFCONFIG} HOSTCFLAGS="${HOSTCFLAGS}" ${xmakeopts} || die "defconfig failed (${K_DEFCONFIG})"
445 if compile_headers_tweak_config ; then
446 yes "" | make oldconfig HOSTCFLAGS="${HOSTCFLAGS}" ${xmakeopts} || die "2nd oldconfig failed"
447 fi
415 make prepare HOSTCFLAGS="${HOSTCFLAGS}" ${xmakeopts} || die "prepare failed" 448 make prepare HOSTCFLAGS="${HOSTCFLAGS}" ${xmakeopts} || die "prepare failed"
416 make prepare-all HOSTCFLAGS="${HOSTCFLAGS}" ${xmakeopts} || die "prepare failed" 449 make prepare-all HOSTCFLAGS="${HOSTCFLAGS}" ${xmakeopts} || die "prepare failed"
417 fi 450 fi
418} 451}
419 452
420compile_manpages() { 453compile_headers_tweak_config() {
421 einfo "Making manpages ..." 454 # some targets can be very very picky, so let's finesse the
422 env -u ARCH make mandocs 455 # .config based upon any info we may have
456 case ${CTARGET} in
457 sh*)
458 sed -i '/CONFIG_CPU_SH/d' .config
459 echo "CONFIG_CPU_SH${CTARGET:2:1}=y" >> .config
460 return 0;;
461 esac
462
463 # no changes, so lets do nothing
464 return 1
423} 465}
424 466
425# install functions 467# install functions
426#============================================================== 468#==============================================================
427install_universal() { 469install_universal() {
428 #fix silly permissions in tarball 470 #fix silly permissions in tarball
429 cd ${WORKDIR} 471 cd ${WORKDIR}
430 chown -R root:root * 472 chown -R root:0 *
431 chmod -R a+r-w+X,u+w * 473 chmod -R a+r-w+X,u+w *
432 cd ${OLDPWD} 474 cd ${OLDPWD}
433} 475}
434 476
435install_headers() { 477install_headers() {
436 local ddir=$(kernel_header_destdir) 478 local ddir=$(kernel_header_destdir)
437 479
438 cd "${S}" 480 cd "${S}"
439 dodir ${ddir}/linux 481 dodir ${ddir}/linux
440 cp -ax "${S}"/include/linux/* ${D}/${ddir}/linux 482 cp -pPR "${S}"/include/linux/* ${D}/${ddir}/linux
441 rm -rf ${D}/${ddir}/linux/modules 483 rm -rf ${D}/${ddir}/linux/modules
442 484
443 # Handle multilib headers and crap 485 # Handle multilib headers and crap
444 local multi_dirs="" multi_defs="" 486 local multi_dirs="" multi_defs=""
445 case $(tc-arch-kernel) in 487 case $(tc-arch-kernel) in
459 multi_dirs="s390 s390x" 501 multi_dirs="s390 s390x"
460 multi_defs="!__s390x__ __s390x__" 502 multi_defs="!__s390x__ __s390x__"
461 ;; 503 ;;
462 arm) 504 arm)
463 dodir ${ddir}/asm 505 dodir ${ddir}/asm
464 cp -ax "${S}"/include/asm/* "${D}"/${ddir}/asm 506 cp -pPR "${S}"/include/asm/* "${D}"/${ddir}/asm
465 [[ ! -e ${D}/${ddir}/asm/arch ]] && ln -sf arch-ebsa285 "${D}"/${ddir}/asm/arch 507 [[ ! -e ${D}/${ddir}/asm/arch ]] && ln -sf arch-ebsa285 "${D}"/${ddir}/asm/arch
466 [[ ! -e ${D}/${ddir}/asm/proc ]] && ln -sf proc-armv "${D}"/${ddir}/asm/proc 508 [[ ! -e ${D}/${ddir}/asm/proc ]] && ln -sf proc-armv "${D}"/${ddir}/asm/proc
467 ;; 509 ;;
468 powerpc) 510 powerpc)
469 dodir ${ddir}/asm 511 dodir ${ddir}/asm
470 cp -ax "${S}"/include/asm/* ${D}/${ddir}/asm 512 cp -pPR "${S}"/include/asm/* ${D}/${ddir}/asm
471 if [[ -e "${S}"/include/asm-ppc ]] ; then 513 if [[ -e "${S}"/include/asm-ppc ]] ; then
472 dodir ${ddir}/asm-ppc 514 dodir ${ddir}/asm-ppc
473 cp -ax "${S}"/include/asm-ppc/* ${D}/${ddir}/asm-ppc 515 cp -pPR "${S}"/include/asm-ppc/* ${D}/${ddir}/asm-ppc
474 fi 516 fi
475 ;; 517 ;;
476 *) 518 *)
477 dodir ${ddir}/asm 519 dodir ${ddir}/asm
478 cp -ax "${S}"/include/asm/* ${D}/${ddir}/asm 520 cp -pPR "${S}"/include/asm/* ${D}/${ddir}/asm
479 ;; 521 ;;
480 esac 522 esac
481 if [[ -n ${multi_dirs} ]] ; then 523 if [[ -n ${multi_dirs} ]] ; then
482 local d ml_inc="" 524 local d ml_inc=""
483 for d in ${multi_dirs} ; do 525 for d in ${multi_dirs} ; do
484 dodir ${ddir}/asm-${d} 526 dodir ${ddir}/asm-${d}
485 cp -ax "${S}"/include/asm-${d}/* ${D}/${ddir}/asm-${d}/ || die "cp asm-${d} failed" 527 cp -pPR "${S}"/include/asm-${d}/* ${D}/${ddir}/asm-${d}/ || die "cp asm-${d} failed"
486 528
487 ml_inc="${ml_inc} ${multi_defs%% *}:${ddir}/asm-${d}" 529 ml_inc="${ml_inc} ${multi_defs%% *}:${ddir}/asm-${d}"
488 multi_defs=${multi_defs#* } 530 multi_defs=${multi_defs#* }
489 done 531 done
490 create_ml_includes ${ddir}/asm ${ml_inc} 532 create_ml_includes ${ddir}/asm ${ml_inc}
491 fi 533 fi
492 534
493 if kernel_is 2 6; then 535 if kernel_is 2 6; then
494 dodir ${ddir}/asm-generic 536 dodir ${ddir}/asm-generic
495 cp -ax "${S}"/include/asm-generic/* ${D}/${ddir}/asm-generic 537 cp -pPR "${S}"/include/asm-generic/* ${D}/${ddir}/asm-generic
496 fi 538 fi
497 539
498 # clean up 540 # clean up
499 find "${D}" -name '*.orig' -exec rm -f {} \; 541 find "${D}" -name '*.orig' -exec rm -f {} \;
500 542
501 cd ${OLDPWD} 543 cd ${OLDPWD}
502} 544}
503 545
504install_sources() { 546install_sources() {
505 local doc docs file 547 local file
506 548
507 cd "${S}" 549 cd "${S}"
508 dodir /usr/src 550 dodir /usr/src
509 echo ">>> Copying sources ..." 551 echo ">>> Copying sources ..."
510 552
524 [[ -f ${FILESDIR}/../ChangeLog ]] && \ 566 [[ -f ${FILESDIR}/../ChangeLog ]] && \
525 echo "Please check the ebuild ChangeLog for more details." \ 567 echo "Please check the ebuild ChangeLog for more details." \
526 > "${S}"/patches.txt 568 > "${S}"/patches.txt
527 fi 569 fi
528 570
529 if use doc ; then
530 install_manpages
531
532 for doc in ${UNIPATCH_DOCS}; do [[ -f ${doc} ]] && docs="${docs} ${doc}"; done
533 if [[ -f ${S}/patches.txt ]]; then docs="${docs} ${S}/patches.txt"; fi
534 [[ -n ${docs} ]] && dodoc ${docs}
535 fi
536
537 mv ${WORKDIR}/linux* ${D}/usr/src 571 mv ${WORKDIR}/linux* ${D}/usr/src
538}
539
540install_manpages() {
541 kernel_is lt 2 5 && return
542
543 local myfiles="Documentation/DocBook/Makefile"
544 kernel_is lt 2 6 12 && myfiles="scripts/makeman ${myfiles}"
545
546 sed -ie "s#/usr/local/man#${D}/usr/share/man#g" ${myfiles}
547 ebegin "Installing manpages"
548 env -u ARCH make installmandocs
549 eend $?
550 sed -ie "s#${D}/usr/share/man#/usr/local/man#g" ${myfiles}
551} 572}
552 573
553# pkg_preinst functions 574# pkg_preinst functions
554#============================================================== 575#==============================================================
555preinst_headers() { 576preinst_headers() {
565 586
566 # if we have USE=symlink, then force K_SYMLINK=1 587 # if we have USE=symlink, then force K_SYMLINK=1
567 use symlink && K_SYMLINK=1 588 use symlink && K_SYMLINK=1
568 589
569 # if we are to forcably symlink, delete it if it already exists first. 590 # if we are to forcably symlink, delete it if it already exists first.
570 if [[ -n ${K_SYMLINK} ]]; then 591 if [[ ${K_SYMLINK} > 0 ]]; then
571 [[ -h ${ROOT}usr/src/linux ]] && rm ${ROOT}usr/src/linux 592 [[ -h ${ROOT}usr/src/linux ]] && rm ${ROOT}usr/src/linux
572 MAKELINK=1 593 MAKELINK=1
573 fi 594 fi
574 595
575 # if the link doesnt exist, lets create it 596 # if the link doesnt exist, lets create it
939 960
940headers___fix() { 961headers___fix() {
941 # Voodoo to partially fix broken upstream headers. 962 # Voodoo to partially fix broken upstream headers.
942 # Issues with this function should go to plasmaroo. 963 # Issues with this function should go to plasmaroo.
943 sed -i \ 964 sed -i \
944 -e "s/\([ "$'\t'"]\)\(u\|s\)\(8\|16\|32\|64\)\([ "$'\t'"]\)/\1__\2\3\4/g;" \ 965 -e '/^\#define.*_TYPES_H/{:loop n; bloop}' \
945 -e 's/ \(u\|s\)\(8\|16\|32\|64\)$/ __\1\2/g' \ 966 -e 's:\<\([us]\(8\|16\|32\|64\)\)\>:__\1:g' \
946 -e 's/\([(, ]\)\(u\|s\)64\([, )]\)/\1__\264\3/g' \
947 -e "s/^\(u\|s\)\(8\|16\|32\|64\)\([ "$'\t'"]\)/__\1\2\3/g;" \
948 -e "s/ inline / __inline__ /g" \ 967 -e "s/ inline / __inline__ /g" \
949 "$@" 968 "$@"
950} 969}
951 970
952# common functions 971# common functions
953#============================================================== 972#==============================================================
954kernel-2_src_unpack() { 973kernel-2_src_unpack() {
955 universal_unpack 974 universal_unpack
975 debug-print "Doing unipatch"
956 976
957 [[ -n ${UNIPATCH_LIST} || -n ${UNIPATCH_LIST_DEFAULT} || -n ${UNIPATCH_LIST_GENPATCHES} ]] && \ 977 [[ -n ${UNIPATCH_LIST} || -n ${UNIPATCH_LIST_DEFAULT} || -n ${UNIPATCH_LIST_GENPATCHES} ]] && \
958 unipatch "${UNIPATCH_LIST_DEFAULT} ${UNIPATCH_LIST_GENPATCHES} ${UNIPATCH_LIST}" 978 unipatch "${UNIPATCH_LIST_DEFAULT} ${UNIPATCH_LIST_GENPATCHES} ${UNIPATCH_LIST}"
979
980 debug-print "Doing premake"
959 981
960 # allow ebuilds to massage the source tree after patching but before 982 # allow ebuilds to massage the source tree after patching but before
961 # we run misc `make` functions below 983 # we run misc `make` functions below
962 [[ $(type -t kernel-2_hook_premake) == "function" ]] && kernel-2_hook_premake 984 [[ $(type -t kernel-2_hook_premake) == "function" ]] && kernel-2_hook_premake
963 985
986 debug-print "Doing unpack_set_extraversion"
987
964 [[ -z ${K_NOSETEXTRAVERSION} ]] && unpack_set_extraversion 988 [[ -z ${K_NOSETEXTRAVERSION} ]] && unpack_set_extraversion
965 unpack_fix_docbook
966 unpack_fix_install_path 989 unpack_fix_install_path
967 990
991 # Setup xmakeopts and cd into sourcetree.
992 env_setup_xmakeopts
993 cd "${S}"
994
995 # We dont need a version.h for anything other than headers
996 # at least, I should hope we dont. If this causes problems
997 # take out the if/fi block and inform me please.
998 # unpack_2_6 should now be 2.6.17 safe anyways
999 if [[ ${ETYPE} == headers ]]; then
968 kernel_is 2 4 && unpack_2_4 1000 kernel_is 2 4 && unpack_2_4
969 kernel_is 2 6 && unpack_2_6 1001 kernel_is 2 6 && unpack_2_6
1002 fi
970} 1003}
971 1004
972kernel-2_src_compile() { 1005kernel-2_src_compile() {
973 cd "${S}" 1006 cd "${S}"
974 [[ ${ETYPE} == headers ]] && compile_headers 1007 [[ ${ETYPE} == headers ]] && compile_headers
975 [[ ${ETYPE} == sources ]] && \
976 use doc && compile_manpages
977} 1008}
978 1009
979kernel-2_pkg_preinst() { 1010kernel-2_pkg_preinst() {
980 [[ ${ETYPE} == headers ]] && preinst_headers 1011 [[ ${ETYPE} == headers ]] && preinst_headers
981} 1012}
990 [[ ${ETYPE} == headers ]] && postinst_headers 1021 [[ ${ETYPE} == headers ]] && postinst_headers
991 [[ ${ETYPE} == sources ]] && postinst_sources 1022 [[ ${ETYPE} == sources ]] && postinst_sources
992} 1023}
993 1024
994kernel-2_pkg_setup() { 1025kernel-2_pkg_setup() {
1026 ABI="${KERNEL_ABI}"
995 [[ ${ETYPE} == headers ]] && setup_headers 1027 [[ ${ETYPE} == headers ]] && setup_headers
996 [[ ${ETYPE} == sources ]] && echo ">>> Preparing to unpack ..." 1028 [[ ${ETYPE} == sources ]] && echo ">>> Preparing to unpack ..."
997} 1029}

Legend:
Removed from v.1.159  
changed lines
  Added in v.1.186

  ViewVC Help
Powered by ViewVC 1.1.20