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

Contents of /eclass/kernel-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.40 - (show annotations) (download)
Sun Jul 11 20:38:24 2004 UTC (14 years, 11 months ago) by spock
Branch: MAIN
Changes since 1.39: +3 -3 lines
Turns out we can't build manpages on arm and s390, because app-text/docbook-sgml-utils doesn't have these arches in KEYWORDS.

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

  ViewVC Help
Powered by ViewVC 1.1.20