/[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.190
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.190 2006/09/04 00:19:50 lu_zero 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-${CHOST#*-}"
66 67
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 use crosscompile_opts_headers-only && [[ ${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}
399 || touch include/linux/autoconf.h 429 || touch include/linux/autoconf.h
400 430
401 # if K_DEFCONFIG isn't set, force to "defconfig" 431 # if K_DEFCONFIG isn't set, force to "defconfig"
402 # needed by mips 432 # needed by mips
403 if [[ -z ${K_DEFCONFIG} ]]; then 433 if [[ -z ${K_DEFCONFIG} ]]; then
434 case ${CTARGET} in
435 powerpc64*) K_DEFCONFIG="ppc64_defconfig";;
436 powerpc) K_DEFCONFIG="pmac32_defconfig";;
404 K_DEFCONFIG="defconfig" 437 *) K_DEFCONFIG="defconfig";;
438 esac
405 fi 439 fi
406 440
407 # if there arent any installed headers, then there also isnt an asm 441 # if there arent any installed headers, then there also isnt an asm
408 # symlink in /usr/include/, and make defconfig will fail, so we have 442 # symlink in /usr/include/, and make defconfig will fail, so we have
409 # to force an include path with $S. 443 # to force an include path with $S.
410 HOSTCFLAGS="${HOSTCFLAGS} -I${S}/include/" 444 HOSTCFLAGS="${HOSTCFLAGS} -I${S}/include/"
411 ln -sf asm-${KARCH} "${S}"/include/asm 445 ln -sf asm-${KARCH} "${S}"/include/asm
412 cross_pre_c_headers && return 0 446 cross_pre_c_headers && return 0
413 447
414 make ${K_DEFCONFIG} HOSTCFLAGS="${HOSTCFLAGS}" ${xmakeopts} || die "defconfig failed" 448 make ${K_DEFCONFIG} HOSTCFLAGS="${HOSTCFLAGS}" ${xmakeopts} || die "defconfig failed (${K_DEFCONFIG})"
449 if compile_headers_tweak_config ; then
450 yes "" | make oldconfig HOSTCFLAGS="${HOSTCFLAGS}" ${xmakeopts} || die "2nd oldconfig failed"
451 fi
415 make prepare HOSTCFLAGS="${HOSTCFLAGS}" ${xmakeopts} || die "prepare failed" 452 make prepare HOSTCFLAGS="${HOSTCFLAGS}" ${xmakeopts} || die "prepare failed"
416 make prepare-all HOSTCFLAGS="${HOSTCFLAGS}" ${xmakeopts} || die "prepare failed" 453 make prepare-all HOSTCFLAGS="${HOSTCFLAGS}" ${xmakeopts} || die "prepare failed"
417 fi 454 fi
418} 455}
419 456
420compile_manpages() { 457compile_headers_tweak_config() {
421 einfo "Making manpages ..." 458 # some targets can be very very picky, so let's finesse the
422 env -u ARCH make mandocs 459 # .config based upon any info we may have
460 case ${CTARGET} in
461 sh*)
462 sed -i '/CONFIG_CPU_SH/d' .config
463 echo "CONFIG_CPU_SH${CTARGET:2:1}=y" >> .config
464 return 0;;
465 esac
466
467 # no changes, so lets do nothing
468 return 1
423} 469}
424 470
425# install functions 471# install functions
426#============================================================== 472#==============================================================
427install_universal() { 473install_universal() {
428 #fix silly permissions in tarball 474 #fix silly permissions in tarball
429 cd ${WORKDIR} 475 cd ${WORKDIR}
430 chown -R root:root * 476 chown -R root:0 *
431 chmod -R a+r-w+X,u+w * 477 chmod -R a+r-w+X,u+w *
432 cd ${OLDPWD} 478 cd ${OLDPWD}
433} 479}
434 480
435install_headers() { 481install_headers() {
436 local ddir=$(kernel_header_destdir) 482 local ddir=$(kernel_header_destdir)
437 483
438 cd "${S}" 484 cd "${S}"
439 dodir ${ddir}/linux 485 dodir ${ddir}/linux
440 cp -ax "${S}"/include/linux/* ${D}/${ddir}/linux 486 cp -pPR "${S}"/include/linux/* ${D}/${ddir}/linux
441 rm -rf ${D}/${ddir}/linux/modules 487 rm -rf ${D}/${ddir}/linux/modules
442 488
443 # Handle multilib headers and crap 489 # Handle multilib headers and crap
444 local multi_dirs="" multi_defs="" 490 local multi_dirs="" multi_defs=""
445 case $(tc-arch-kernel) in 491 case $(tc-arch-kernel) in
459 multi_dirs="s390 s390x" 505 multi_dirs="s390 s390x"
460 multi_defs="!__s390x__ __s390x__" 506 multi_defs="!__s390x__ __s390x__"
461 ;; 507 ;;
462 arm) 508 arm)
463 dodir ${ddir}/asm 509 dodir ${ddir}/asm
464 cp -ax "${S}"/include/asm/* "${D}"/${ddir}/asm 510 cp -pPR "${S}"/include/asm/* "${D}"/${ddir}/asm
465 [[ ! -e ${D}/${ddir}/asm/arch ]] && ln -sf arch-ebsa285 "${D}"/${ddir}/asm/arch 511 [[ ! -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 512 [[ ! -e ${D}/${ddir}/asm/proc ]] && ln -sf proc-armv "${D}"/${ddir}/asm/proc
467 ;; 513 ;;
468 powerpc) 514 powerpc)
469 dodir ${ddir}/asm 515 dodir ${ddir}/asm
470 cp -ax "${S}"/include/asm/* ${D}/${ddir}/asm 516 cp -pPR "${S}"/include/asm/* ${D}/${ddir}/asm
471 if [[ -e "${S}"/include/asm-ppc ]] ; then 517 if [[ -e "${S}"/include/asm-ppc ]] ; then
472 dodir ${ddir}/asm-ppc 518 dodir ${ddir}/asm-ppc
473 cp -ax "${S}"/include/asm-ppc/* ${D}/${ddir}/asm-ppc 519 cp -pPR "${S}"/include/asm-ppc/* ${D}/${ddir}/asm-ppc
474 fi 520 fi
475 ;; 521 ;;
476 *) 522 *)
477 dodir ${ddir}/asm 523 dodir ${ddir}/asm
478 cp -ax "${S}"/include/asm/* ${D}/${ddir}/asm 524 cp -pPR "${S}"/include/asm/* ${D}/${ddir}/asm
479 ;; 525 ;;
480 esac 526 esac
481 if [[ -n ${multi_dirs} ]] ; then 527 if [[ -n ${multi_dirs} ]] ; then
482 local d ml_inc="" 528 local d ml_inc=""
483 for d in ${multi_dirs} ; do 529 for d in ${multi_dirs} ; do
484 dodir ${ddir}/asm-${d} 530 dodir ${ddir}/asm-${d}
485 cp -ax "${S}"/include/asm-${d}/* ${D}/${ddir}/asm-${d}/ || die "cp asm-${d} failed" 531 cp -pPR "${S}"/include/asm-${d}/* ${D}/${ddir}/asm-${d}/ || die "cp asm-${d} failed"
486 532
487 ml_inc="${ml_inc} ${multi_defs%% *}:${ddir}/asm-${d}" 533 ml_inc="${ml_inc} ${multi_defs%% *}:${ddir}/asm-${d}"
488 multi_defs=${multi_defs#* } 534 multi_defs=${multi_defs#* }
489 done 535 done
490 create_ml_includes ${ddir}/asm ${ml_inc} 536 create_ml_includes ${ddir}/asm ${ml_inc}
491 fi 537 fi
492 538
493 if kernel_is 2 6; then 539 if kernel_is 2 6; then
494 dodir ${ddir}/asm-generic 540 dodir ${ddir}/asm-generic
495 cp -ax "${S}"/include/asm-generic/* ${D}/${ddir}/asm-generic 541 cp -pPR "${S}"/include/asm-generic/* ${D}/${ddir}/asm-generic
496 fi 542 fi
497 543
498 # clean up 544 # clean up
499 find "${D}" -name '*.orig' -exec rm -f {} \; 545 find "${D}" -name '*.orig' -exec rm -f {} \;
500 546
501 cd ${OLDPWD} 547 cd ${OLDPWD}
502} 548}
503 549
504install_sources() { 550install_sources() {
505 local doc docs file 551 local file
506 552
507 cd "${S}" 553 cd "${S}"
508 dodir /usr/src 554 dodir /usr/src
509 echo ">>> Copying sources ..." 555 echo ">>> Copying sources ..."
510 556
524 [[ -f ${FILESDIR}/../ChangeLog ]] && \ 570 [[ -f ${FILESDIR}/../ChangeLog ]] && \
525 echo "Please check the ebuild ChangeLog for more details." \ 571 echo "Please check the ebuild ChangeLog for more details." \
526 > "${S}"/patches.txt 572 > "${S}"/patches.txt
527 fi 573 fi
528 574
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 575 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} 576}
552 577
553# pkg_preinst functions 578# pkg_preinst functions
554#============================================================== 579#==============================================================
555preinst_headers() { 580preinst_headers() {
565 590
566 # if we have USE=symlink, then force K_SYMLINK=1 591 # if we have USE=symlink, then force K_SYMLINK=1
567 use symlink && K_SYMLINK=1 592 use symlink && K_SYMLINK=1
568 593
569 # if we are to forcably symlink, delete it if it already exists first. 594 # if we are to forcably symlink, delete it if it already exists first.
570 if [[ -n ${K_SYMLINK} ]]; then 595 if [[ ${K_SYMLINK} > 0 ]]; then
571 [[ -h ${ROOT}usr/src/linux ]] && rm ${ROOT}usr/src/linux 596 [[ -h ${ROOT}usr/src/linux ]] && rm ${ROOT}usr/src/linux
572 MAKELINK=1 597 MAKELINK=1
573 fi 598 fi
574 599
575 # if the link doesnt exist, lets create it 600 # if the link doesnt exist, lets create it
939 964
940headers___fix() { 965headers___fix() {
941 # Voodoo to partially fix broken upstream headers. 966 # Voodoo to partially fix broken upstream headers.
942 # Issues with this function should go to plasmaroo. 967 # Issues with this function should go to plasmaroo.
943 sed -i \ 968 sed -i \
944 -e "s/\([ "$'\t'"]\)\(u\|s\)\(8\|16\|32\|64\)\([ "$'\t'"]\)/\1__\2\3\4/g;" \ 969 -e '/^\#define.*_TYPES_H/{:loop n; bloop}' \
945 -e 's/ \(u\|s\)\(8\|16\|32\|64\)$/ __\1\2/g' \ 970 -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" \ 971 -e "s/ inline / __inline__ /g" \
949 "$@" 972 "$@"
950} 973}
951 974
952# common functions 975# common functions
953#============================================================== 976#==============================================================
954kernel-2_src_unpack() { 977kernel-2_src_unpack() {
955 universal_unpack 978 universal_unpack
979 debug-print "Doing unipatch"
956 980
957 [[ -n ${UNIPATCH_LIST} || -n ${UNIPATCH_LIST_DEFAULT} || -n ${UNIPATCH_LIST_GENPATCHES} ]] && \ 981 [[ -n ${UNIPATCH_LIST} || -n ${UNIPATCH_LIST_DEFAULT} || -n ${UNIPATCH_LIST_GENPATCHES} ]] && \
958 unipatch "${UNIPATCH_LIST_DEFAULT} ${UNIPATCH_LIST_GENPATCHES} ${UNIPATCH_LIST}" 982 unipatch "${UNIPATCH_LIST_DEFAULT} ${UNIPATCH_LIST_GENPATCHES} ${UNIPATCH_LIST}"
983
984 debug-print "Doing premake"
959 985
960 # allow ebuilds to massage the source tree after patching but before 986 # allow ebuilds to massage the source tree after patching but before
961 # we run misc `make` functions below 987 # we run misc `make` functions below
962 [[ $(type -t kernel-2_hook_premake) == "function" ]] && kernel-2_hook_premake 988 [[ $(type -t kernel-2_hook_premake) == "function" ]] && kernel-2_hook_premake
963 989
990 debug-print "Doing unpack_set_extraversion"
991
964 [[ -z ${K_NOSETEXTRAVERSION} ]] && unpack_set_extraversion 992 [[ -z ${K_NOSETEXTRAVERSION} ]] && unpack_set_extraversion
965 unpack_fix_docbook
966 unpack_fix_install_path 993 unpack_fix_install_path
967 994
995 # Setup xmakeopts and cd into sourcetree.
996 env_setup_xmakeopts
997 cd "${S}"
998
999 # We dont need a version.h for anything other than headers
1000 # at least, I should hope we dont. If this causes problems
1001 # take out the if/fi block and inform me please.
1002 # unpack_2_6 should now be 2.6.17 safe anyways
1003 if [[ ${ETYPE} == headers ]]; then
968 kernel_is 2 4 && unpack_2_4 1004 kernel_is 2 4 && unpack_2_4
969 kernel_is 2 6 && unpack_2_6 1005 kernel_is 2 6 && unpack_2_6
1006 fi
970} 1007}
971 1008
972kernel-2_src_compile() { 1009kernel-2_src_compile() {
973 cd "${S}" 1010 cd "${S}"
974 [[ ${ETYPE} == headers ]] && compile_headers 1011 [[ ${ETYPE} == headers ]] && compile_headers
975 [[ ${ETYPE} == sources ]] && \
976 use doc && compile_manpages
977} 1012}
978 1013
979kernel-2_pkg_preinst() { 1014kernel-2_pkg_preinst() {
980 [[ ${ETYPE} == headers ]] && preinst_headers 1015 [[ ${ETYPE} == headers ]] && preinst_headers
981} 1016}
990 [[ ${ETYPE} == headers ]] && postinst_headers 1025 [[ ${ETYPE} == headers ]] && postinst_headers
991 [[ ${ETYPE} == sources ]] && postinst_sources 1026 [[ ${ETYPE} == sources ]] && postinst_sources
992} 1027}
993 1028
994kernel-2_pkg_setup() { 1029kernel-2_pkg_setup() {
1030 ABI="${KERNEL_ABI}"
995 [[ ${ETYPE} == headers ]] && setup_headers 1031 [[ ${ETYPE} == headers ]] && setup_headers
996 [[ ${ETYPE} == sources ]] && echo ">>> Preparing to unpack ..." 1032 [[ ${ETYPE} == sources ]] && echo ">>> Preparing to unpack ..."
997} 1033}

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

  ViewVC Help
Powered by ViewVC 1.1.20