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

Contents of /eclass/kernel-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.29 - (hide annotations) (download)
Mon Feb 16 18:30:33 2004 UTC (15 years, 4 months ago) by johnm
Branch: MAIN
Changes since 1.28: +19 -6 lines
update to cause unipatch to fatal error if file doesnt exist (or is not readable)

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

  ViewVC Help
Powered by ViewVC 1.1.20