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

Contents of /eclass/kernel-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.38 - (show annotations) (download)
Thu Jul 8 02:03:41 2004 UTC (14 years, 11 months ago) by mr_bones_
Branch: MAIN
Changes since 1.37: +2 -2 lines
fix use invocation

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

  ViewVC Help
Powered by ViewVC 1.1.20