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

Diff of /eclass/kernel-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.12 Revision 1.17
1# Copyright 1999-2004 Gentoo Technologies, Inc.
2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/kernel-2.eclass,v 1.17 2004/01/23 21:41:23 johnm Exp $
4
1# kernel.eclass rewrite for a clean base regarding the 2.6 series of kernel 5# kernel.eclass rewrite for a clean base regarding the 2.6 series of kernel
2# with back-compatibility for 2.4 6# with back-compatibility for 2.4
3# 7#
4# Author: John Mylchreest <johnm@gentoo.org> 8# Author: John Mylchreest <johnm@gentoo.org>
5# Copyright 2004 Gentoo Linux 9# Copyright 2004 Gentoo Linux
13# A Couple of env vars are available to effect usage of this eclass 17# A Couple of env vars are available to effect usage of this eclass
14# These are as follows: 18# These are as follows:
15# 19#
16# K_NOSETEXTRAVERSION - if this is set then EXTRAVERSION will not be automatically set within the kernel Makefile 20# K_NOSETEXTRAVERSION - if this is set then EXTRAVERSION will not be automatically set within the kernel Makefile
17# K_NOUSENAME - if this is set then EXTRAVERSION will not include the first part of ${PN} in EXTRAVERSION 21# K_NOUSENAME - if this is set then EXTRAVERSION will not include the first part of ${PN} in EXTRAVERSION
18# 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 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
19# - and not use it as a true package revision 23# - and not use it as a true package revision
20# K_EXTRAEINFO - this is a new-line seperated list of einfo displays in postinst and can be used to carry additional postinst messages 24# K_EXTRAEINFO - this is a new-line seperated list of einfo displays in postinst and can be used to carry additional postinst messages
21# K_EXTRAEWARN - same as K_EXTRAEINFO except ewarn's instead of einfo's 25# K_EXTRAEWARN - same as K_EXTRAEINFO except ewarn's instead of einfo's
22 26
23# H_SUPPORTEDARCH - this should be a space separated list of ARCH's which can be supported by the headers ebuild 27# H_SUPPORTEDARCH - this should be a space separated list of ARCH's which can be supported by the headers ebuild
24 28
25# UNIPATCH_LIST - space delimetered list of patches to be applied to the kernel 29# UNIPATCH_LIST - space delimetered list of patches to be applied to the kernel
26# UNIPATCH_DOCS - space delimemeted list of docs to be installed to the doc dir 30# UNIPATCH_DOCS - space delimemeted list of docs to be installed to the doc dir
31# UNIPATCH_STRICTORDER - if this is set places patches into directories of order, so they are applied in the order passed
27 32
28ECLASS="kernel-2" 33ECLASS="kernel-2"
29EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_preinst pkg_postinst 34EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_preinst pkg_postinst
30 35
31HOMEPAGE="http://www.kernel.org/ http://www.gentoo.org/" 36HOMEPAGE="http://www.kernel.org/ http://www.gentoo.org/"
32LICENSE="GPL-2" 37LICENSE="GPL-2"
33IUSE="${IUSE} build" 38IUSE="${IUSE} build"
34SLOT="${KV}" 39SLOT="${KV}"
44 !build? ( >=sys-libs/ncurses-5.2 49 !build? ( >=sys-libs/ncurses-5.2
45 dev-lang/perl 50 dev-lang/perl
46 sys-apps/module-init-tools 51 sys-apps/module-init-tools
47 sys-devel/make )" 52 sys-devel/make )"
48 53
49 PROVIDE="virtual/linux-sources virtual/alsa" 54 [ $(kernel_is_2_4) $? == 0 ] && PROVIDE="virtual/linux-sources" || PROVIDE="virtual/linux-sources virtual/alsa"
50 55
51elif [ "${ETYPE}" == "headers" ] 56elif [ "${ETYPE}" == "headers" ]
52then 57then
53 PROVIDE="virtual/kernel virtual/os-headers" 58 PROVIDE="virtual/kernel virtual/os-headers"
54else 59else
132 chmod -R a+r-w+X,u+w * 137 chmod -R a+r-w+X,u+w *
133} 138}
134 139
135install_headers() { 140install_headers() {
136 [ $(kernel_is_2_4) $? == 0 ] && unpack_2_4 141 [ $(kernel_is_2_4) $? == 0 ] && unpack_2_4
137 [ $(kernel_is_2_6) $? == 0 ] && ln -sf ${S}/include/asm-${ARCH} ${S}/include/asm 142
138
139 cd ${S} 143 cd ${S}
140 dodir /usr/include/linux 144 dodir /usr/include/linux
145 ln -sf ${S}/include/asm-${ARCH} ${S}/include/asm
141 cp -ax ${S}/include/linux/* ${D}/usr/include/linux 146 cp -ax ${S}/include/linux/* ${D}/usr/include/linux
142 rm -rf ${D}/usr/include/linux/modules 147 rm -rf ${D}/usr/include/linux/modules
148
143 dodir /usr/include/asm 149 dodir /usr/include/asm
144 cp -ax ${S}/include/asm/* ${D}/usr/include/asm 150 cp -ax ${S}/include/asm/* ${D}/usr/include/asm
145 151
146 if [ $(kernel_is_2_6) $? == 0 ] 152 if [ $(kernel_is_2_6) $? == 0 ]
147 then 153 then
279 local PIPE_CMD 285 local PIPE_CMD
280 local UNIPATCH_EXCLUDE 286 local UNIPATCH_EXCLUDE
281 local KPATCH_DIR 287 local KPATCH_DIR
282 local PATCH_DEPTH 288 local PATCH_DEPTH
283 local ELINE 289 local ELINE
290 local STRICT_COUNT
284 291
285 [ -z "${KPATCH_DIR}" ] && KPATCH_DIR="${WORKDIR}/patches/" 292 [ -z "${KPATCH_DIR}" ] && KPATCH_DIR="${WORKDIR}/patches/"
286 [ ! -d ${KPATCH_DIR} ] && mkdir -p ${KPATCH_DIR} 293 [ ! -d ${KPATCH_DIR} ] && mkdir -p ${KPATCH_DIR}
287 294
288 # This function will unpack all passed tarballs, add any passed patches, and remove any passed patchnumbers 295 # This function will unpack all passed tarballs, add any passed patches, and remove any passed patchnumbers
302 gz) PIPE_CMD="tar -xvzf";; 309 gz) PIPE_CMD="tar -xvzf";;
303 *) eerror "Unrecognized tarball compression" 310 *) eerror "Unrecognized tarball compression"
304 die "Unrecognized tarball compression";; 311 die "Unrecognized tarball compression";;
305 esac 312 esac
306 313
314 if [ -n "${UNIPATCH_STRICTORDER}" ]
315 then
316 STRICT_COUNT=$((${STRICT_COUNT} + 1))
317 mkdir -p ${KPATCH_DIR}/${STRICT_COUNT}/
318 ${PIPE_CMD} ${i} -C ${KPATCH_DIR}/${STRICT_COUNT}/ 1>/dev/null
319 else
307 ${PIPE_CMD} ${i} -C ${KPATCH_DIR} 1>/dev/null 320 ${PIPE_CMD} ${i} -C ${KPATCH_DIR} 1>/dev/null
321 fi
322
308 if [ $? == 0 ] 323 if [ $? == 0 ]
309 then 324 then
310 einfo "${i/*\//} unpacked" 325 einfo "${i/*\//} unpacked"
311 else 326 else
312 eerror "Failed to unpack ${i}" 327 eerror "Failed to unpack ${i}"
330 ZIP|zip) PIPE_CMD="unzip -p";; 345 ZIP|zip) PIPE_CMD="unzip -p";;
331 *) UNIPATCH_EXCLUDE="${UNIPATCH_EXCLUDE} ${i}";; 346 *) UNIPATCH_EXCLUDE="${UNIPATCH_EXCLUDE} ${i}";;
332 esac 347 esac
333 x=${i/*\//} 348 x=${i/*\//}
334 x=${x/\.${extention}/} 349 x=${x/\.${extention}/}
350
351 if [ -n "${UNIPATCH_STRICTORDER}" -a -n "${PIPE_CMD}" ]
352 then
353 STRICT_COUNT=$((${STRICT_COUNT} + 1))
354 mkdir -p ${KPATCH_DIR}/${STRICT_COUNT}/
355 $(${PIPE_CMD} ${i} > ${KPATCH_DIR}/${STRICT_COUNT}/${x}.patch)
356 else
335 [ -n "${PIPE_CMD}" ] && ${PIPE_CMD} ${i} > ${KPATCH_DIR}/${x}.patch 357 $(${PIPE_CMD} ${i} > ${KPATCH_DIR}/${x}.patch)
358 fi
336 done 359 done
337 360
338 #populate KPATCH_DIRS so we know where to look to remove the excludes 361 #populate KPATCH_DIRS so we know where to look to remove the excludes
339 x=${KPATCH_DIR} 362 x=${KPATCH_DIR}
340 KPATCH_DIR="" 363 KPATCH_DIR=""
360 # and now, finally, we patch it :) 383 # and now, finally, we patch it :)
361 for x in ${KPATCH_DIR} 384 for x in ${KPATCH_DIR}
362 do 385 do
363 for i in $(find ${x} -maxdepth 1 -iname "*.patch" -or -iname "*.diff" | sort -u) 386 for i in $(find ${x} -maxdepth 1 -iname "*.patch" -or -iname "*.diff" | sort -u)
364 do 387 do
365
366
367 PATCH_DEPTH=0 388 PATCH_DEPTH=0
368 ebegin "Applying ${i/*\//}" 389 ebegin "Applying ${i/*\//}"
369 while [ ${PATCH_DEPTH} -lt 5 ] 390 while [ ${PATCH_DEPTH} -lt 5 ]
370 do 391 do
371 if (patch -p${PATCH_DEPTH} --dry-run -f < ${i} >/dev/null) 392 if (patch -p${PATCH_DEPTH} --dry-run -f < ${i} >/dev/null)
509 [ "${ETYPE}" == "sources" ] && postinst_sources 530 [ "${ETYPE}" == "sources" ] && postinst_sources
510} 531}
511 532
512pkg_setup() { 533pkg_setup() {
513 [ "${ETYPE}" == "headers" ] && setup_headers 534 [ "${ETYPE}" == "headers" ] && setup_headers
535
536 # this is to fix some weird portage bug? in stable versions of portage.
537 [ "${ETYPE}" == "sources" ] && echo ">>> Preparing to unpack..."
514} 538}

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.17

  ViewVC Help
Powered by ViewVC 1.1.20