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

Contents of /eclass/kernel-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.60 - (show annotations) (download)
Thu Dec 2 21:22:15 2004 UTC (14 years ago) by vapier
Branch: MAIN
Changes since 1.59: +21 -11 lines
cross-compile support

1 # Copyright 1999-2004 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/kernel-2.eclass,v 1.59 2004/12/02 20:34:29 dsd Exp $
4
5 # Description: kernel.eclass rewrite for a clean base regarding the 2.6
6 # series of kernel with back-compatibility for 2.4
7 #
8 # Maintainer: John Mylchreest <johnm@gentoo.org>
9 # Copyright 2004 Gentoo Linux
10 #
11 # Please direct your bugs to the current eclass maintainer :)
12
13 # added functionality:
14 # unipatch - a flexible, singular method to extract, add and remove patches.
15
16 # A Couple of env vars are available to effect usage of this eclass
17 # These are as follows:
18 #
19 # K_NOSETEXTRAVERSION - if this is set then EXTRAVERSION will not be
20 # automatically set within the kernel Makefile
21 # K_NOUSENAME - if this is set then EXTRAVERSION will not include the
22 # first part of ${PN} in EXTRAVERSION
23 # K_PREPATCHED - if the patchset is prepatched (ie: mm-sources,
24 # ck-sources, ac-sources) it will use PR (ie: -r5) as
25 # the patchset version for
26 # - and not use it as a true package revision
27 # K_EXTRAEINFO - this is a new-line seperated list of einfo displays in
28 # postinst and can be used to carry additional postinst
29 # messages
30 # K_EXTRAEWARN - same as K_EXTRAEINFO except ewarn's instead of einfo's
31
32 # H_SUPPORTEDARCH - this should be a space separated list of ARCH's which
33 # can be supported by the headers ebuild
34
35 # UNIPATCH_LIST - space delimetered list of patches to be applied to the
36 # kernel
37 # UNIPATCH_EXCLUDE - an addition var to support exlusion based completely
38 # on "<passedstring>*" and not "<passedno#>_*"
39 # - this should _NOT_ be used from the ebuild as this is
40 # reserved for end users passing excludes from the cli
41 # UNIPATCH_DOCS - space delimemeted list of docs to be installed to
42 # the doc dir
43 # UNIPATCH_STRICTORDER - if this is set places patches into directories of
44 # order, so they are applied in the order passed
45
46 ECLASS="kernel-2"
47 INHERITED="$INHERITED $ECLASS"
48 EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_preinst pkg_postinst
49
50 export CTARGET="${CTARGET:-${CHOST}}"
51
52 HOMEPAGE="http://www.kernel.org/ http://www.gentoo.org/"
53 LICENSE="GPL-2"
54 IUSE="${IUSE} build doc"
55 SLOT="${PVR}"
56
57 # set LINUX_HOSTCFLAGS if not already set
58 [ -z "$LINUX_HOSTCFLAGS" ] && LINUX_HOSTCFLAGS="-Wall -Wstrict-prototypes -Os -fomit-frame-pointer -I${S}/include"
59
60 #Eclass functions only from here onwards ...
61 #==============================================================
62 kernel_is() {
63 local RESULT
64 RESULT=1
65
66 if [ -n "${1}" ]
67 then
68 [ "${1}" = "${KV_MAJOR}" ] && RESULT=0
69 fi
70
71 if [ -n "${2}" ]
72 then
73 RESULT=1
74 [ "${2}" = "${KV_MINOR}" ] && RESULT=0
75 fi
76
77 if [ -n "${3}" ]
78 then
79 RESULT=1
80 [ "${3}" = "${KV_PATCH}" ] && RESULT=0
81 fi
82 return ${RESULT}
83 }
84
85 kernel_is_2_4() {
86 kernel_is 2 4
87 return $?
88 }
89
90 kernel_is_2_6() {
91 [ ${KV_MAJOR} -eq 2 -a ${KV_MINOR} -eq 5 -o ${KV_MINOR} -eq 6 ] && \
92 return 0 || return 1
93 }
94
95 kernel_header_destdir() {
96 [ "${CTARGET}" = "${CHOST}" ] \
97 && echo /usr/include \
98 || echo /usr/${CTARGET}/include
99 }
100
101 # Capture the sources type and set DEPENDs
102 if [ "${ETYPE}" == "sources" ]
103 then
104 # binutils version needed to avoid Athlon/PIII/SSE assembler bugs.
105 DEPEND="!build? ( sys-apps/sed
106 >=sys-devel/binutils-2.11.90.0.31 )
107 doc? ( !arm? ( !s390? ( app-text/docbook-sgml-utils ) ) )"
108
109 RDEPEND="${DEPEND}
110 !build? ( >=sys-libs/ncurses-5.2
111 dev-lang/perl
112 sys-apps/module-init-tools
113 sys-devel/make )"
114
115 [ $(kernel_is_2_4) $? == 0 ] && PROVIDE="virtual/linux-sources" \
116 || PROVIDE="virtual/linux-sources virtual/alsa"
117
118 elif [ "${ETYPE}" == "headers" ]
119 then
120 PROVIDE="virtual/kernel virtual/os-headers"
121 else
122 eerror "Unknown ETYPE=\"${ETYPE}\", must be \"sources\" or \"headers\""
123 die
124 fi
125
126 # Unpack functions
127 #==============================================================
128 unpack_2_4() {
129 cd ${S}
130 # this file is required for other things to build properly,
131 # so we autogenerate it
132 make mrproper || die "make mrproper died"
133 make include/linux/version.h || die "make include/linux/version.h failed"
134 echo ">>> version.h compiled successfully."
135 }
136
137 universal_unpack() {
138 [ -z "${OKV}" ] && OKV="${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
139
140 cd ${WORKDIR}
141 unpack linux-${OKV}.tar.bz2
142 if [ "${OKV}" != "${KV_FULL}" ]
143 then
144 mv linux-${OKV} linux-${KV_FULL} \
145 || die "Unable to move source tree to ${KV_FULL}."
146 fi
147 cd ${S}
148
149 # change incorrect install path
150 sed -ie 's:#export\tINSTALL_PATH:export\tINSTALL_PATH:' Makefile
151
152 # remove all backup files
153 find . -iname "*~" -exec rm {} \; 2> /dev/null
154
155 if [ -d "${S}/Documentation/DocBook" ]
156 then
157 cd ${S}/Documentation/DocBook
158 sed -e "s:db2:docbook2:g" Makefile > Makefile.new \
159 && mv Makefile.new Makefile
160 cd ${S}
161 fi
162 }
163
164 unpack_set_extraversion() {
165 cd ${S}
166 sed -ie "s:^\(EXTRAVERSION =\).*:\1 ${EXTRAVERSION}:" Makefile
167 }
168
169 # Compile Functions
170 #==============================================================
171 compile_headers() {
172 local MY_ARCH
173
174 MY_ARCH=${ARCH}
175 unset ${ARCH}
176 yes "" | make oldconfig
177 echo ">>> make oldconfig complete"
178 ARCH=${MY_ARCH}
179 }
180
181 compile_manpages() {
182 local MY_ARCH
183
184 einfo "Making manpages ..."
185 MY_ARCH=${ARCH}
186 unset ARCH
187 make mandocs
188 ARCH=${MY_ARCH}
189 }
190
191 # install functions
192 #==============================================================
193 install_universal() {
194 #fix silly permissions in tarball
195 cd ${WORKDIR}
196 chown -R root:root *
197 chmod -R a+r-w+X,u+w *
198 }
199
200 install_headers() {
201 [ $(kernel_is_2_4) $? == 0 ] && unpack_2_4
202
203 local ddir=$(kernel_header_destdir)
204 cd ${S}
205 dodir ${ddir}/linux
206 ln -sf ${S}/include/asm-${ARCH} ${S}/include/asm
207 cp -ax ${S}/include/linux/* ${D}/${ddir}/linux
208 rm -rf ${D}/${ddir}/linux/modules
209
210 dodir ${ddir}/asm
211 cp -ax ${S}/include/asm/* ${D}/${ddir}/asm
212
213 if [ $(kernel_is_2_6) $? == 0 ]
214 then
215 dodir ${ddir}/asm-generic
216 cp -ax ${S}/include/asm-generic/* ${D}/${ddir}/asm-generic
217 fi
218 }
219
220 install_sources() {
221 local doc
222 local docs
223 local file
224
225 cd ${S}
226 dodir /usr/src
227 echo ">>> Copying sources ..."
228 file="$(find ${WORKDIR} -iname "docs" -type d)"
229 if [ -n "${file}" ]
230 then
231 for file in $(find ${file} -type f)
232 do
233 echo "${file/*docs\//}" >> ${S}/patches.txt
234 echo "===================================================" >> ${S}/patches.txt
235 cat ${file} >> ${S}/patches.txt
236 echo "===================================================" >> ${S}/patches.txt
237 echo "" >> ${S}/patches.txt
238 done
239 fi
240
241 if [ ! -f ${S}/patches.txt ]
242 then
243 # patches.txt is empty so lets use our ChangeLog
244 [ -f ${FILESDIR}/../ChangeLog ] && echo "Please check the ebuild ChangeLog for more details." > ${S}/patches.txt
245 fi
246
247 for doc in ${UNIPATCH_DOCS}
248 do
249 [ -f ${doc} ] && docs="${docs} ${doc}"
250 done
251
252 if [ -f ${S}/patches.txt ]; then
253 docs="${docs} ${S}/patches.txt"
254 fi
255
256 if use doc && ! use arm && ! use s390; then
257 install_manpages
258 fi
259
260 dodoc ${docs}
261 mv ${WORKDIR}/linux* ${D}/usr/src
262 }
263
264 install_manpages() {
265 local MY_ARCH
266
267 ebegin "Installing manpages"
268 MY_ARCH=${ARCH}
269 unset ARCH
270 sed -ie "s#/usr/local/man#${D}/usr/man#g" scripts/makeman
271 make installmandocs
272 eend $?
273 sed -ie "s#${D}/usr/man#/usr/local/man#g" scripts/makeman
274 ARCH=${MY_ARCH}
275 }
276
277 # pkg_preinst functions
278 #==============================================================
279 preinst_headers() {
280 local ddir=$(kernel_header_destdir)
281 [[ -L ${ROOT}${ddir}/linux ]] && rm "${ROOT}"${ddir}/linux
282 [[ -L ${ROOT}${ddir}/asm ]] && rm "${ROOT}"${ddir}/asm
283 }
284
285 # pkg_postinst functions
286 #==============================================================
287 postinst_sources() {
288 if [ ! -h ${ROOT}usr/src/linux ]
289 then
290 ln -sf ${ROOT}usr/src/linux-${KV_FULL} ${ROOT}usr/src/linux
291 fi
292
293 # Don't forget to make directory for sysfs
294 [ ! -d "${ROOT}/sys" -a $(kernel_is_2_6) $? == 0 ] && mkdir /sys
295
296 echo
297 einfo "After installing a new kernel of any version, it is important"
298 einfo "that you have the appropriate /etc/modules.autoload.d/kernel-X.Y"
299 einfo "created (X.Y is the first 2 parts of your new kernel version)"
300 echo
301 einfo "For example, this kernel will require:"
302 einfo "/etc/modules.autoload.d/kernel-${KV_MAJOR}.${KV_MINOR}"
303 echo
304
305 # if K_EXTRAEINFO is set then lets display it now
306 if [ -n "${K_EXTRAEINFO}" ]
307 then
308 echo ${K_EXTRAEINFO} | fmt |
309 while read -s ELINE
310 do
311 einfo "${ELINE}"
312 done
313
314 echo
315 fi
316
317 # Show policy version, if this kernel has SELinux ...
318 local secfile
319 secfile="${ROOT}usr/src/linux-${KV_FULL}/security/selinux/include/security.h"
320 if use selinux && [ -f "$secfile" ]
321 then
322 local polver=$(awk '/POLICYDB_VERSION /{print $3}' $secfile)
323 einfo "The SELinux policy version of this kernel is $polver."
324 echo
325 fi
326
327 # if K_EXTRAEWARN is set then lets display it now
328 if [ -n "${K_EXTRAEWARN}" ]
329 then
330 echo ${K_EXTRAEWARN} | fmt |
331 while read -s ELINE
332 do
333 ewarn "${ELINE}"
334 done
335
336 echo
337 fi
338 }
339
340 postinst_headers() {
341 echo
342 einfo "Kernel headers are usually only used when recompiling glibc."
343 einfo "Following the installation of newer headers it is advised that"
344 einfo "you re-merge glibc as follows:"
345 einfo "# emerge glibc"
346 einfo "Failure to do so will cause glibc to not make use of newer"
347 einfo "features present in the updated kernelheaders."
348 echo
349 }
350
351 # pkg_setup functions
352 #==============================================================
353 setup_headers() {
354 ARCH=$(uname -m | sed -e s/[i].86/i386/ -e s/x86/i386/ -e s/sun4u/sparc64/ \
355 -e s/arm.*/arm/ -e s/sa110/arm/ -e s/amd64/x86_64/)
356 [ "$ARCH" == "sparc" -a "$PROFILE_ARCH" == "sparc64" ] && ARCH="sparc64"
357
358 [ -z "${H_SUPPORTEDARCH}" ] && H_SUPPORTEDARCH="${PN/-*/}"
359 for i in ${H_SUPPORTEDARCH}
360 do
361 [ "${ARCH}" == "${i}" ] && H_ACCEPT_ARCH="yes"
362 done
363
364 if [ "${H_ACCEPT_ARCH}" != "yes" ]
365 then
366 echo
367 eerror "This version of ${PN} does not support ${ARCH}."
368 eerror "Please merge the appropriate sources, in most cases"
369 eerror "this will be ${ARCH}-headers."
370 die "incorrect headers"
371 fi
372 }
373
374 # unipatch
375 #==============================================================
376 unipatch() {
377 local i
378 local x
379 local extention
380 local PIPE_CMD
381 local UNIPATCH_DROP
382 local KPATCH_DIR
383 local PATCH_DEPTH
384 local ELINE
385 local STRICT_COUNT
386 local PATCH_LEVEL
387
388 [ -z "${KPATCH_DIR}" ] && KPATCH_DIR="${WORKDIR}/patches/"
389 [ ! -d ${KPATCH_DIR} ] && mkdir -p ${KPATCH_DIR}
390
391 # We're gonna need it when doing patches with a predefined patchlevel
392 shopt -s extglob
393
394 # This function will unpack all passed tarballs, add any passed patches, and remove any passed patchnumbers
395 # usage can be either via an env var or by params
396 # although due to the nature we pass this within this eclass
397 # it shall be by param only.
398 # -z "${UNIPATCH_LIST}" ] && UNIPATCH_LIST="${@}"
399 UNIPATCH_LIST="${@}"
400
401 #unpack any passed tarballs
402 for i in ${UNIPATCH_LIST}
403 do
404 if [ -n "$(echo ${i} | grep -e "\.tar" -e "\.tbz" -e "\.tgz")" ]
405 then
406 extention=${i/*./}
407 extention=${extention/:*/}
408 case ${extention} in
409 tbz2) PIPE_CMD="tar -xvjf";;
410 bz2) PIPE_CMD="tar -xvjf";;
411 tgz) PIPE_CMD="tar -xvzf";;
412 gz) PIPE_CMD="tar -xvzf";;
413 *) eerror "Unrecognized tarball compression"
414 die "Unrecognized tarball compression";;
415 esac
416
417 if [ -n "${UNIPATCH_STRICTORDER}" ]
418 then
419 STRICT_COUNT=$((${STRICT_COUNT} + 1))
420 mkdir -p ${KPATCH_DIR}/${STRICT_COUNT}/
421 ${PIPE_CMD} ${i/:*/} -C ${KPATCH_DIR}/${STRICT_COUNT}/ 1>/dev/null
422 else
423 ${PIPE_CMD} ${i/:*/} -C ${KPATCH_DIR} 1>/dev/null
424 fi
425
426 if [ $? == 0 ]
427 then
428 einfo "${i/*\//} unpacked"
429 [ -n "$(echo ${i} | grep ':')" ] && echo ">>> Strict patch levels not currently supported for tarballed patchsets"
430 else
431 eerror "Failed to unpack ${i/:*/}"
432 die "unable to unpack patch tarball"
433 fi
434 else
435 extention=${i/*./}
436 extention=${extention/:*/}
437 PIPE_CMD=""
438 case ${extention} in
439 bz2) PIPE_CMD="bzip2 -dc";;
440 patch) PIPE_CMD="cat";;
441 diff) PIPE_CMD="cat";;
442 gz|Z|z) PIPE_CMD="gzip -dc";;
443 ZIP|zip) PIPE_CMD="unzip -p";;
444 *) UNIPATCH_DROP="${UNIPATCH_DROP} ${i/:*/}";;
445 esac
446
447 PATCH_LEVEL=${i/*([^:])?(:)}
448 i=${i/:*/}
449 x=${i/*\//}
450 x=${x/\.${extention}/}
451
452 if [ -n "${PIPE_CMD}" ]
453 then
454 if [ ! -r "${i}" ]
455 then
456 echo
457 eerror "FATAL: unable to locate:"
458 eerror "${i}"
459 eerror "for read-only. The file either has incorrect permissions"
460 eerror "or does not exist."
461 die Unable to locate ${i}
462 fi
463
464 if [ -n "${UNIPATCH_STRICTORDER}" ]
465 then
466 STRICT_COUNT=$((${STRICT_COUNT} + 1))
467 mkdir -p ${KPATCH_DIR}/${STRICT_COUNT}/
468 $(${PIPE_CMD} ${i} > ${KPATCH_DIR}/${STRICT_COUNT}/${x}.patch${PATCH_LEVEL})
469 else
470 $(${PIPE_CMD} ${i} > ${KPATCH_DIR}/${x}.patch${PATCH_LEVEL})
471 fi
472 fi
473 fi
474 done
475
476 #populate KPATCH_DIRS so we know where to look to remove the excludes
477 x=${KPATCH_DIR}
478 KPATCH_DIR=""
479 LC_ALL="C"
480 for i in $(find ${x} -type d | sort -n)
481 do
482 KPATCH_DIR="${KPATCH_DIR} ${i}"
483 done
484
485 #so now lets get rid of the patchno's we want to exclude
486 UNIPATCH_DROP="${UNIPATCH_EXCLUDE} ${UNIPATCH_DROP}"
487 for i in ${UNIPATCH_DROP}
488 do
489 ebegin "Excluding Patch #${i}"
490 for x in ${KPATCH_DIR}
491 do
492 rm -f ${x}/${i}* 2>/dev/null
493 done
494 eend $?
495 done
496
497 # and now, finally, we patch it :)
498 for x in ${KPATCH_DIR}
499 do
500 for i in $(find ${x} -maxdepth 1 -iname "*.patch*" -or -iname "*.diff*" | sort -n)
501 do
502 STDERR_T="${T}/${i/*\//}"
503 STDERR_T="${STDERR_T/.patch*/.err}"
504
505 [ -z ${i/*.patch*/} ] && PATCH_DEPTH=${i/*.patch/}
506 [ -z ${i/*.diff*/} ] && PATCH_DEPTH=${i/*.diff/}
507
508 if [ -z "${PATCH_DEPTH}" ]; then
509 PATCH_DEPTH=0
510 fi
511
512 ebegin "Applying ${i/*\//} (-p${PATCH_DEPTH}+)"
513 while [ ${PATCH_DEPTH} -lt 5 ]
514 do
515 echo "Attempting Dry-run:" >> ${STDERR_T}
516 echo "cmd: patch -p${PATCH_DEPTH} --dry-run -f < ${i}" >> ${STDERR_T}
517 echo "=======================================================" >> ${STDERR_T}
518 if [ $(patch -p${PATCH_DEPTH} --dry-run -f < ${i} >> ${STDERR_T}) $? -eq 0 ]
519 then
520 echo "Attempting patch:" > ${STDERR_T}
521 echo "cmd: patch -p${PATCH_DEPTH} -f < ${i}" >> ${STDERR_T}
522 echo "=======================================================" >> ${STDERR_T}
523 if [ $(patch -p${PATCH_DEPTH} -f < ${i} >> ${STDERR_T}) "$?" -eq 0 ]
524 then
525 eend 0
526 rm ${STDERR_T}
527 break
528 else
529 eend 1
530 eerror "Failed to apply patch ${i/*\//}"
531 eerror "Please attach ${STDERR_T} to any bug you may post."
532 die "Failed to apply ${i/*\//}"
533 fi
534 else
535 PATCH_DEPTH=$((${PATCH_DEPTH} + 1))
536 fi
537 done
538 if [ ${PATCH_DEPTH} -eq 5 ]
539 then
540 eend 1
541 eerror "Please attach ${STDERR_T} to any bug you may post."
542 die "Unable to dry-run patch."
543 fi
544 done
545 done
546
547 # clean up KPATCH_DIR's - fixes bug #53610
548 for x in ${KPATCH_DIR}
549 do
550 rm -Rf ${x}
551 done
552 unset LC_ALL
553 }
554
555 # custom functions
556 #==============================================================
557 detect_version() {
558 # this function will detect and set
559 # - OKV: Original Kernel Version (2.6.0/2.6.0-test11)
560 # - KV: Kernel Version (2.6.0-gentoo/2.6.0-test11-gentoo-r1)
561 # - EXTRAVERSION: The additional version appended to OKV (-gentoo/-gentoo-r1)
562
563 if [ -n "${KV_FULL}" ] ;
564 then
565 # we will set this for backwards compatibility.
566 KV=${KV_FULL}
567
568 # we know KV_FULL so lets stop here. but not without resetting S
569 S=${WORKDIR}/linux-${KV_FULL}
570 return
571 fi
572
573 OKV=${PV/_beta/-test}
574 OKV=${OKV/_rc/-rc}
575 OKV=${OKV/_pre*/}
576 OKV=${OKV/-r*/}
577
578 KV_MAJOR=$(echo ${OKV} | cut -d. -f1)
579 KV_MINOR=$(echo ${OKV} | cut -d. -f2)
580 KV_PATCH=$(echo ${OKV} | cut -d. -f3-)
581 KV_PATCH=${KV_PATCH/[-_]*/}
582
583 KERNEL_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/linux-${OKV}.tar.bz2"
584
585 RELEASE=${PV/${OKV}/}
586 RELEASE=${RELEASE/_beta/}
587 RELEASE=${RELEASE/_rc/-rc}
588 if [ $(kernel_is_2_4) $? == 0 ]
589 then
590 RELEASE=${RELEASE/_pre/-pre}
591 else
592 RELEASE=${RELEASE/_pre/-bk}
593 fi
594 RELEASETYPE=${RELEASE//[0-9]/}
595 EXTRAVERSION="${RELEASE}"
596
597 if [ -n "${K_PREPATCHED}" ]
598 then
599 EXTRAVERSION="${EXTRAVERSION}-${PN/-*/}${PR/r/}"
600 else
601 [ -z "${K_NOUSENAME}" ] && EXTRAVERSION="${EXTRAVERSION}-${PN/-*/}"
602 [ "${PR}" != "r0" ] && EXTRAVERSION="${EXTRAVERSION}-${PR}"
603 fi
604
605 KV_FULL=${OKV}${EXTRAVERSION}
606
607 # -rcXX-bkXX pulls are *IMPOSSIBLE* to support within the portage naming convention
608 # these cannot be supported, but the code here can handle it up until this point
609 # and theoretically thereafter.
610
611 if [ "${RELEASETYPE}" == "-rc" -o "${RELEASETYPE}" == "-pre" ]
612 then
613 OKV="${KV_MAJOR}.${KV_MINOR}.$([ $((${KV_PATCH} - 1)) -lt 0 ] && echo ${KV_PATCH} || echo $((${KV_PATCH} - 1)))"
614 KERNEL_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/testing/patch-${PV//_/-}.bz2
615 mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/linux-${OKV}.tar.bz2"
616 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${PV//_/-}.bz2"
617 KV_FULL=${PV/[-_]*/}${EXTRAVERSION}
618 fi
619
620 if [ "${RELEASETYPE}" == "-bk" ]
621 then
622 OKV="${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
623 KERNEL_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/snapshots/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.bz2
624 mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/linux-${OKV}.tar.bz2"
625 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.bz2"
626 KV_FULL=${PV/[-_]*/}${EXTRAVERSION}
627 fi
628
629 if [ "${RELEASETYPE}" == "-rc-bk" ]
630 then
631 OKV="${KV_MAJOR}.${KV_MINOR}.$((${KV_PATCH} - 1))-${RELEASE/-bk*}"
632 EXTRAVERSION="$([ -n "${RELEASE}" ] && echo ${RELEASE/*-bk/-bk})$([ -n "${K_USENAME}" ] && echo -${PN/-*/})$([ ! "${PR}" == "r0" ] && echo -${PR})"
633
634 KERNEL_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/snapshots/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.bz2
635 mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/linux-${OKV}.tar.bz2"
636 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.bz2"
637 KV_FULL=${PV/[-_]*/}${EXTRAVERSION}
638 fi
639
640 S=${WORKDIR}/linux-${KV_FULL}
641 # we will set this for backwards compatibility.
642 KV=${KV_FULL}
643 }
644
645 detect_arch() {
646 # This function sets ARCH_URI and ARCH_PATCH
647 # with the neccessary info for the arch sepecific compatibility
648 # patchsets.
649
650 local ALL_ARCH
651 local LOOP_ARCH
652 local COMPAT_URI
653 local i
654
655 # COMPAT_URI is the contents of ${ARCH}_URI
656 # ARCH_URI is the URI for all the ${ARCH}_URI patches
657 # ARCH_PATCH is ARCH_URI broken into files for UNIPATCH
658
659 ARCH_URI=""
660 ARCH_PATCH=""
661 ALL_ARCH="X86 PPC PPC64 SPARC MIPS ALPHA ARM HPPA AMD64 IA64 X86OBSD S390"
662
663 for LOOP_ARCH in ${ALL_ARCH}
664 do
665 COMPAT_URI="${LOOP_ARCH}_URI"
666 COMPAT_URI="${!COMPAT_URI}"
667
668 [ -n "${COMPAT_URI}" ] && \
669 ARCH_URI="${ARCH_URI} $(echo ${LOOP_ARCH} | tr '[:upper:]' '[:lower:]')? ( ${COMPAT_URI} )"
670
671 if [ "${LOOP_ARCH}" == "$(echo ${ARCH} | tr '[:lower:]' '[:upper:]')" ]
672 then
673 for i in ${COMPAT_URI}
674 do
675 ARCH_PATCH="${ARCH_PATCH} ${DISTDIR}/${i/*\//}"
676 done
677 fi
678 done
679 }
680
681
682 # common functions
683 #==============================================================
684 kernel-2_src_unpack() {
685 universal_unpack
686
687 [ -n "${UNIPATCH_LIST}" -o -n "${UNIPATCH_LIST_DEFAULT}" ] && \
688 unipatch "${UNIPATCH_LIST_DEFAULT} ${UNIPATCH_LIST}"
689
690 [ -z "${K_NOSETEXTRAVERSION}" ] && \
691 unpack_set_extraversion
692
693 kernel_is 2 4 && unpack_2_4
694 }
695
696 kernel-2_src_compile() {
697 [ "${ETYPE}" == "headers" ] && compile_headers
698 [ "${ETYPE}" == "sources" ] && \
699 use doc && ! use arm && ! use s390 && compile_manpages
700 }
701
702 kernel-2_pkg_preinst() {
703 [ "${ETYPE}" == "headers" ] && preinst_headers
704 }
705
706 kernel-2_src_install() {
707 install_universal
708 [ "${ETYPE}" == "headers" ] && install_headers
709 [ "${ETYPE}" == "sources" ] && install_sources
710 }
711
712 kernel-2_pkg_postinst() {
713 [ "${ETYPE}" == "headers" ] && postinst_headers
714 [ "${ETYPE}" == "sources" ] && postinst_sources
715 }
716
717 kernel-2_pkg_setup() {
718 [ "${ETYPE}" == "headers" ] && setup_headers
719
720 # This is to fix some weird portage bug? in stable versions of portage.
721 [ "${ETYPE}" == "sources" ] && echo ">>> Preparing to unpack ..."
722 }
723
724

  ViewVC Help
Powered by ViewVC 1.1.20