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

Contents of /eclass/kernel-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.28 - (hide annotations) (download)
Mon Feb 16 00:40:41 2004 UTC (15 years, 4 months ago) by johnm
Branch: MAIN
Changes since 1.27: +16 -0 lines
adding support for ARCH_URI and ARCH_PATCH

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     if [ -n "${UNIPATCH_STRICTORDER}" -a -n "${PIPE_CMD}" ]
354     then
355     STRICT_COUNT=$((${STRICT_COUNT} + 1))
356     mkdir -p ${KPATCH_DIR}/${STRICT_COUNT}/
357     $(${PIPE_CMD} ${i} > ${KPATCH_DIR}/${STRICT_COUNT}/${x}.patch)
358     else
359     $(${PIPE_CMD} ${i} > ${KPATCH_DIR}/${x}.patch)
360     fi
361 johnm 1.16 fi
362 johnm 1.1 done
363    
364     #populate KPATCH_DIRS so we know where to look to remove the excludes
365     x=${KPATCH_DIR}
366     KPATCH_DIR=""
367 johnm 1.25 for i in $(find ${x} -type d | sort -n)
368 johnm 1.1 do
369     KPATCH_DIR="${KPATCH_DIR} ${i}"
370     done
371    
372     #so now lets get rid of the patchno's we want to exclude
373 johnm 1.19 UNIPATCH_DROP="${UNIPATCH_EXCLUDE} ${UNIPATCH_DROP}"
374     for i in ${UNIPATCH_DROP}
375 johnm 1.1 do
376     for x in ${KPATCH_DIR}
377     do
378 johnm 1.19 rm ${x}/${i}* 2>/dev/null
379 johnm 1.1 if [ $? == 0 ]
380     then
381     einfo "Excluding Patch #${i}"
382     einfo "From: ${x/${WORKDIR}/}"
383     fi
384     done
385     done
386    
387     # and now, finally, we patch it :)
388     for x in ${KPATCH_DIR}
389     do
390 johnm 1.25 for i in $(find ${x} -maxdepth 1 -iname "*.patch" -or -iname "*.diff" | sort -n)
391 johnm 1.1 do
392 johnm 1.25 STDERR_T="${T}/${i/*\//}"
393     STDERR_T="${STDERR_T/.patch/.err}"
394    
395 johnm 1.1 PATCH_DEPTH=0
396     ebegin "Applying ${i/*\//}"
397     while [ ${PATCH_DEPTH} -lt 5 ]
398     do
399 johnm 1.25 echo "Attempting Dry-run:" > ${STDERR_T}
400     echo "cmd: patch -p${PATCH_DEPTH} --dry-run -f < ${i}" >> ${STDERR_T}
401     echo "=======================================================" >> ${STDERR_T}
402 johnm 1.26 if [ $(patch -p${PATCH_DEPTH} --dry-run -f < ${i} >> ${STDERR_T}) $? -eq 0 ]
403 johnm 1.1 then
404 johnm 1.25 echo "Attempting patch:" > ${STDERR_T}
405     echo "cmd: patch -p${PATCH_DEPTH} -f < ${i}" >> ${STDERR_T}
406     echo "=======================================================" >> ${STDERR_T}
407 johnm 1.26 if [ $(patch -p${PATCH_DEPTH} -f < ${i} >> ${STDERR_T}) "$?" -eq 0 ]
408 johnm 1.1 then
409     eend 0
410 johnm 1.25 rm ${STDERR_T}
411 johnm 1.1 break
412     else
413     eend 1
414     eerror "Failed to apply patch ${i/*\//}"
415 johnm 1.25 eerror "Please attach ${STDERR_T} to any bug you may post."
416 johnm 1.1 die "Failed to apply ${i/*\//}"
417     fi
418     else
419     PATCH_DEPTH=$((${PATCH_DEPTH} + 1))
420     fi
421     done
422     if [ ${PATCH_DEPTH} -eq 5 ]
423     then
424     eend 1
425 johnm 1.25 eerror "Please attach ${STDERR_T} to any bug you may post."
426 johnm 1.1 die "Unable to dry-run patch."
427     fi
428     done
429     done
430     }
431    
432     # custom functions
433     #==============================================================
434     detect_version() {
435     # this function will detect and set
436     # - OKV: Original Kernel Version (2.6.0/2.6.0-test11)
437     # - KV: Kernel Version (2.6.0-gentoo/2.6.0-test11-gentoo-r1)
438     # - EXTRAVERSION: The additional version appended to OKV (-gentoo/-gentoo-r1)
439    
440     OKV=${PV/_beta/-test}
441     OKV=${OKV/_rc/-rc}
442     OKV=${OKV/_pre*/}
443     OKV=${OKV/-r*/}
444    
445     KV_MAJOR=$(echo ${OKV} | cut -d. -f1)
446     KV_MINOR=$(echo ${OKV} | cut -d. -f2)
447     KV_PATCH=$(echo ${OKV} | cut -d. -f3)
448     KV_PATCH=${KV_PATCH/[-_]*/}
449    
450     KERNEL_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/linux-${OKV}.tar.bz2"
451    
452     RELEASE=${PV/${OKV}/}
453     RELEASE=${RELEASE/_beta/}
454     RELEASE=${RELEASE/_rc/-rc}
455     RELEASE=${RELEASE/_pre/-bk}
456     RELEASETYPE=${RELEASE//[0-9]/}
457    
458     EXTRAVERSION="${RELEASE}"
459    
460 johnm 1.11 if [ -n "${K_PREPATCHED}" ]
461     then
462 johnm 1.21 EXTRAVERSION="${EXTRAVERSION}-${PN/-*/}${PR/r/}"
463 johnm 1.11 else
464     [ -z "${K_NOUSENAME}" ] && EXTRAVERSION="${EXTRAVERSION}-${PN/-*/}"
465 johnm 1.21 [ "${PR}" != "r0" ] && EXTRAVERSION="${EXTRAVERSION}-${PR}"
466 johnm 1.11 fi
467 johnm 1.1
468 johnm 1.21 KV=${OKV}${EXTRAVERSION}
469    
470 johnm 1.1 # -rcXX-bkXX pulls are *IMPOSSIBLE* to support within the portage naming convention
471     # these cannot be supported, but the code here can handle it up until this point
472     # and theoretically thereafter.
473    
474     if [ "${RELEASETYPE}" == "-rc" ]
475     then
476     OKV="${KV_MAJOR}.${KV_MINOR}.$([ $((${KV_PATCH} - 1)) -lt 0 ] && echo ${KV_PATCH} || echo $((${KV_PATCH} - 1)))"
477     KERNEL_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/testing/patch-${PV//_/-}.bz2
478     mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/linux-${OKV}.tar.bz2"
479 johnm 1.25 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${PV//_/-}.bz2"
480 johnm 1.21 KV=${PV/[-_]*/}${EXTRAVERSION}
481 johnm 1.1 fi
482    
483     if [ "${RELEASETYPE}" == "-bk" ]
484     then
485     OKV="${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
486     KERNEL_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/snapshots/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.bz2
487     mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/linux-${OKV}.tar.bz2"
488 johnm 1.25 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.bz2"
489 johnm 1.21 KV=${PV/[-_]*/}${EXTRAVERSION}
490 johnm 1.1 fi
491    
492     if [ "${RELEASETYPE}" == "-rc-bk" ]
493     then
494     OKV="${KV_MAJOR}.${KV_MINOR}.$((${KV_PATCH} - 1))-${RELEASE/-bk*}"
495     EXTRAVERSION="$([ -n "${RELEASE}" ] && echo ${RELEASE/*-bk/-bk})$([ -n "${K_USENAME}" ] && echo -${PN/-*/})$([ ! "${PR}" == "r0" ] && echo -${PR})"
496    
497     KERNEL_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/snapshots/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.bz2
498     mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/linux-${OKV}.tar.bz2"
499 johnm 1.25 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.bz2"
500 johnm 1.21 KV=${PV/[-_]*/}${EXTRAVERSION}
501 johnm 1.1 fi
502 johnm 1.2
503     S=${WORKDIR}/linux-${KV}
504 johnm 1.1 }
505    
506    
507 johnm 1.28 detect_arch() {
508     # This function sets ARCH_URI and ARCH_PATCH
509     # with the neccessary info for the arch sepecific compatibility
510     # patchsets.
511    
512     local LOCAL_ARCH
513     local COMPAT_URI
514    
515     LOCAL_ARCH="$(echo ${ARCH} | tr [a-z] [A-Z])"
516     COMPAT_URI="${LOCAL_ARCH}_URI"
517    
518     ARCH_URI="${!COMPAT_URI}"
519     ARCH_PATCH="${DISTDIR}/${ARCH_URI/*\//}"
520     }
521    
522    
523 johnm 1.1 # common functions
524     #==============================================================
525     src_unpack() {
526     [ -z "${OKV}" ] && OKV="${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
527    
528     cd ${WORKDIR}
529     unpack linux-${OKV}.tar.bz2
530 johnm 1.5 if [ "${OKV}" != "${KV}" ]
531     then
532     mv linux-${OKV} linux-${KV} || die "Unable to move source tree to ${KV}."
533     fi
534 johnm 1.1 cd ${S}
535    
536     universal_unpack
537 johnm 1.25 [ -n "${UNIPATCH_LIST}" -o -n "${UNIPATCH_LIST_DEFAULT}" ] && unipatch "${UNIPATCH_LIST_DEFAULT} ${UNIPATCH_LIST}"
538 johnm 1.1 [ -z "${K_NOSETEXTRAVERSION}" ] && unpack_set_extraversion
539     [ $(kernel_is_2_4) $? == 0 ] && unpack_2_4
540     }
541    
542     src_compile() {
543     [ "${ETYPE}" == "headers" ] && compile_headers
544     }
545    
546     pkg_preinst() {
547     [ "${ETYPE}" == "headers" ] && preinst_headers
548     }
549    
550     src_install() {
551     install_universal
552     [ "${ETYPE}" == "headers" ] && install_headers
553     [ "${ETYPE}" == "sources" ] && install_sources
554     }
555    
556     pkg_postinst() {
557 johnm 1.12 [ "${ETYPE}" == "headers" ] && postinst_headers
558 johnm 1.1 [ "${ETYPE}" == "sources" ] && postinst_sources
559     }
560 johnm 1.12
561     pkg_setup() {
562     [ "${ETYPE}" == "headers" ] && setup_headers
563 johnm 1.13
564     # this is to fix some weird portage bug? in stable versions of portage.
565 johnm 1.15 [ "${ETYPE}" == "sources" ] && echo ">>> Preparing to unpack..."
566 johnm 1.12 }

  ViewVC Help
Powered by ViewVC 1.1.20