/[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.260 Revision 1.281
1# Copyright 1999-2011 Gentoo Foundation 1# Copyright 1999-2013 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/kernel-2.eclass,v 1.260 2011/08/29 01:28:10 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/kernel-2.eclass,v 1.281 2013/03/20 16:45:56 tomwij Exp $
4 4
5# Description: kernel.eclass rewrite for a clean base regarding the 2.6 5# Description: kernel.eclass rewrite for a clean base regarding the 2.6
6# series of kernel with back-compatibility for 2.4 6# series of kernel with back-compatibility for 2.4
7# 7#
8# Original author: John Mylchreest <johnm@gentoo.org> 8# Original author: John Mylchreest <johnm@gentoo.org>
81if [[ ${CTARGET} == ${CHOST} && ${CATEGORY/cross-} != ${CATEGORY} ]]; then 81if [[ ${CTARGET} == ${CHOST} && ${CATEGORY/cross-} != ${CATEGORY} ]]; then
82 export CTARGET=${CATEGORY/cross-} 82 export CTARGET=${CATEGORY/cross-}
83fi 83fi
84 84
85HOMEPAGE="http://www.kernel.org/ http://www.gentoo.org/ ${HOMEPAGE}" 85HOMEPAGE="http://www.kernel.org/ http://www.gentoo.org/ ${HOMEPAGE}"
86[[ -z ${LICENSE} ]] && \
87 LICENSE="GPL-2" 86: ${LICENSE:="GPL-2"}
88 87
89# This is the latest KV_PATCH of the deblob tool available from the 88# This is the latest KV_PATCH of the deblob tool available from the
90# libre-sources upstream. If you bump this, you MUST regenerate the Manifests 89# libre-sources upstream. If you bump this, you MUST regenerate the Manifests
91# for ALL kernel-2 consumer packages where deblob is available. 90# for ALL kernel-2 consumer packages where deblob is available.
92[[ -z ${DEBLOB_MAX_VERSION} ]] && DEBLOB_MAX_VERSION=38 91: ${DEBLOB_MAX_VERSION:=38}
93 92
94# No need to run scanelf/strip on kernel sources/headers (bug #134453). 93# No need to run scanelf/strip on kernel sources/headers (bug #134453).
95RESTRICT="binchecks strip" 94RESTRICT="binchecks strip"
96 95
97# set LINUX_HOSTCFLAGS if not already set 96# set LINUX_HOSTCFLAGS if not already set
98[[ -z ${LINUX_HOSTCFLAGS} ]] && \
99 LINUX_HOSTCFLAGS="-Wall -Wstrict-prototypes -Os -fomit-frame-pointer -I${S}/include" 97: ${LINUX_HOSTCFLAGS:="-Wall -Wstrict-prototypes -Os -fomit-frame-pointer -I${S}/include"}
100 98
101# debugging functions 99# debugging functions
102#============================================================== 100#==============================================================
103# this function exists only to help debug kernel-2.eclass 101# this function exists only to help debug kernel-2.eclass
104# if you are adding new functionality in, put a call to it 102# if you are adding new functionality in, put a call to it
116handle_genpatches() { 114handle_genpatches() {
117 local tarball 115 local tarball
118 [[ -z ${K_WANT_GENPATCHES} || -z ${K_GENPATCHES_VER} ]] && return 1 116 [[ -z ${K_WANT_GENPATCHES} || -z ${K_GENPATCHES_VER} ]] && return 1
119 117
120 debug-print "Inside handle_genpatches" 118 debug-print "Inside handle_genpatches"
121 local oldifs=${IFS}
122 export IFS="."
123 local OKV_ARRAY=( $OKV ) 119 local OKV_ARRAY
124 export IFS=${oldifs} 120 IFS="." read -r -a OKV_ARRAY <<<"${OKV}"
125 121
126 # for > 3.0 kernels, handle genpatches tarball name 122 # for > 3.0 kernels, handle genpatches tarball name
127 # genpatches for 3.0 and 3.0.1 might be named 123 # genpatches for 3.0 and 3.0.1 might be named
128 # genpatches-3.0-1.base.tar.bz2 and genpatches-3.0-2.base.tar.bz2 124 # genpatches-3.0-1.base.tar.xz and genpatches-3.0-2.base.tar.xz
129 # respectively. Handle this. 125 # respectively. Handle this.
130 126
131 for i in ${K_WANT_GENPATCHES} ; do 127 for i in ${K_WANT_GENPATCHES} ; do
132 if [[ ${KV_MAJOR} -ge 3 ]]; then 128 if [[ ${KV_MAJOR} -ge 3 ]]; then
133 if [[ ${#OKV_ARRAY[@]} -ge 3 ]]; then 129 if [[ ${#OKV_ARRAY[@]} -ge 3 ]]; then
134 tarball="genpatches-${KV_MAJOR}.${KV_MINOR}-${K_GENPATCHES_VER}.${i}.tar.bz2" 130 tarball="genpatches-${KV_MAJOR}.${KV_MINOR}-${K_GENPATCHES_VER}.${i}.tar.xz"
135 else 131 else
136 tarball="genpatches-${KV_MAJOR}.${KV_PATCH}-${K_GENPATCHES_VER}.${i}.tar.bz2" 132 tarball="genpatches-${KV_MAJOR}.${KV_PATCH}-${K_GENPATCHES_VER}.${i}.tar.xz"
137 fi 133 fi
138 else 134 else
139 tarball="genpatches-${OKV}-${K_GENPATCHES_VER}.${i}.tar.bz2" 135 tarball="genpatches-${OKV}-${K_GENPATCHES_VER}.${i}.tar.xz"
140 fi 136 fi
141 debug-print "genpatches tarball: $tarball" 137 debug-print "genpatches tarball: $tarball"
142 GENPATCHES_URI="${GENPATCHES_URI} mirror://gentoo/${tarball}" 138 GENPATCHES_URI="${GENPATCHES_URI} mirror://gentoo/${tarball}"
143 UNIPATCH_LIST_GENPATCHES="${UNIPATCH_LIST_GENPATCHES} ${DISTDIR}/${tarball}" 139 UNIPATCH_LIST_GENPATCHES="${UNIPATCH_LIST_GENPATCHES} ${DISTDIR}/${tarball}"
144 done 140 done
148 # this function will detect and set 144 # this function will detect and set
149 # - OKV: Original Kernel Version (2.6.0/2.6.0-test11) 145 # - OKV: Original Kernel Version (2.6.0/2.6.0-test11)
150 # - KV: Kernel Version (2.6.0-gentoo/2.6.0-test11-gentoo-r1) 146 # - KV: Kernel Version (2.6.0-gentoo/2.6.0-test11-gentoo-r1)
151 # - EXTRAVERSION: The additional version appended to OKV (-gentoo/-gentoo-r1) 147 # - EXTRAVERSION: The additional version appended to OKV (-gentoo/-gentoo-r1)
152 148
153 if [[ -n ${KV_FULL} ]]; then 149 # We've already run, so nothing to do here.
154 # we will set this for backwards compatibility. 150 [[ -n ${KV_FULL} ]] && return 0
155 KV=${KV_FULL}
156
157 # we know KV_FULL so lets stop here. but not without resetting S
158 S=${WORKDIR}/linux-${KV_FULL}
159 return
160 fi
161 151
162 # CKV is used as a comparison kernel version, which is used when 152 # CKV is used as a comparison kernel version, which is used when
163 # PV doesnt reflect the genuine kernel version. 153 # PV doesnt reflect the genuine kernel version.
164 # this gets set to the portage style versioning. ie: 154 # this gets set to the portage style versioning. ie:
165 # CKV=2.6.11_rc4 155 # CKV=2.6.11_rc4
170 OKV=${OKV/-r*} 160 OKV=${OKV/-r*}
171 OKV=${OKV/_p*} 161 OKV=${OKV/_p*}
172 162
173 KV_MAJOR=$(get_version_component_range 1 ${OKV}) 163 KV_MAJOR=$(get_version_component_range 1 ${OKV})
174 # handle if OKV is X.Y or X.Y.Z (e.g. 3.0 or 3.0.1) 164 # handle if OKV is X.Y or X.Y.Z (e.g. 3.0 or 3.0.1)
175 local oldifs=${IFS}
176 export IFS="."
177 local OKV_ARRAY=( $OKV ) 165 local OKV_ARRAY
178 export IFS=${oldifs} 166 IFS="." read -r -a OKV_ARRAY <<<"${OKV}"
179 167
180 # if KV_MAJOR >= 3, then we have no more KV_MINOR 168 # if KV_MAJOR >= 3, then we have no more KV_MINOR
181 #if [[ ${KV_MAJOR} -lt 3 ]]; then 169 #if [[ ${KV_MAJOR} -lt 3 ]]; then
182 if [[ ${#OKV_ARRAY[@]} -ge 3 ]]; then 170 if [[ ${#OKV_ARRAY[@]} -ge 3 ]]; then
183 KV_MINOR=$(get_version_component_range 2 ${OKV}) 171 KV_MINOR=$(get_version_component_range 2 ${OKV})
217 205
218# if [[ ${KV_MAJOR} -ge 3 ]]; then 206# if [[ ${KV_MAJOR} -ge 3 ]]; then
219 if [[ ${#OKV_ARRAY[@]} -lt 3 ]]; then 207 if [[ ${#OKV_ARRAY[@]} -lt 3 ]]; then
220 KV_PATCH_ARR=(${KV_PATCH//\./ }) 208 KV_PATCH_ARR=(${KV_PATCH//\./ })
221 209
222 # at this point 080811, Linus is putting 3.1 kernels in 3.0 directory 210 # at this point 031412, Linus is putting all 3.x kernels in a
223 # revisit when 3.1 is released 211 # 3.x directory, may need to revisit when 4.x is released
224 if [[ ${KV_PATCH} -gt 0 ]]; then
225 KERNEL_BASE_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.$((${KV_PATCH_ARR} - 1))"
226 else
227 KERNEL_BASE_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_PATCH_ARR}" 212 KERNEL_BASE_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.x"
228 fi 213
229 # KERNEL_BASE_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_PATCH_ARR}"
230 [[ -n "${K_LONGTERM}" ]] && 214 [[ -n "${K_LONGTERM}" ]] &&
231 KERNEL_BASE_URI="${KERNEL_BASE_URI}/longterm/v${KV_MAJOR}.${KV_PATCH_ARR}" 215 KERNEL_BASE_URI="${KERNEL_BASE_URI}/longterm/v${KV_MAJOR}.${KV_PATCH_ARR}"
232 else 216 else
233 #KERNEL_BASE_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.0" 217 #KERNEL_BASE_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.0"
234 KERNEL_BASE_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}" 218 #KERNEL_BASE_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}"
219 if [[ ${KV_MAJOR} -ge 3 ]]; then
220 KERNEL_BASE_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.x"
221 else
222 KERNEL_BASE_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}"
223 fi
224
235 [[ -n "${K_LONGTERM}" ]] && 225 [[ -n "${K_LONGTERM}" ]] &&
226 #KERNEL_BASE_URI="${KERNEL_BASE_URI}/longterm"
236 KERNEL_BASE_URI="${KERNEL_BASE_URI}/longterm/v${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}" 227 KERNEL_BASE_URI="${KERNEL_BASE_URI}/longterm/v${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
237 fi 228 fi
238 229
239 debug-print "KERNEL_BASE_URI is ${KERNEL_BASE_URI}" 230 debug-print "KERNEL_BASE_URI is ${KERNEL_BASE_URI}"
240 231
241 if [[ ${#OKV_ARRAY[@]} -ge 3 ]] && [[ ${KV_MAJOR} -ge 3 ]]; then 232 if [[ ${#OKV_ARRAY[@]} -ge 3 ]] && [[ ${KV_MAJOR} -ge 3 ]]; then
242 # handle non genpatch using sources correctly 233 # handle non genpatch using sources correctly
243 if [[ -z ${K_WANT_GENPATCHES} && -z ${K_GENPATCHES_VER} && ${KV_PATCH} -gt 0 ]]; then 234 if [[ -z ${K_WANT_GENPATCHES} && -z ${K_GENPATCHES_VER} && ${KV_PATCH} -gt 0 ]]; then
244 KERNEL_URI="${KERNEL_BASE_URI}/patch-${OKV}.bz2" 235 KERNEL_URI="${KERNEL_BASE_URI}/patch-${OKV}.xz"
245 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${CKV}.bz2" 236 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${CKV}.xz"
246 fi 237 fi
247 KERNEL_URI="${KERNEL_URI} ${KERNEL_BASE_URI}/linux-${KV_MAJOR}.${KV_MINOR}.tar.bz2" 238 KERNEL_URI="${KERNEL_URI} ${KERNEL_BASE_URI}/linux-${KV_MAJOR}.${KV_MINOR}.tar.xz"
248 else 239 else
249 KERNEL_URI="${KERNEL_BASE_URI}/linux-${OKV}.tar.bz2" 240 KERNEL_URI="${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
250 fi 241 fi
251 242
252 RELEASE=${CKV/${OKV}} 243 RELEASE=${CKV/${OKV}}
253 RELEASE=${RELEASE/_beta} 244 RELEASE=${RELEASE/_beta}
254 RELEASE=${RELEASE/_rc/-rc} 245 RELEASE=${RELEASE/_rc/-rc}
298 if [[ -n ${KV_MINOR} ]]; then 289 if [[ -n ${KV_MINOR} ]]; then
299 OKV="${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}" 290 OKV="${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
300 else 291 else
301 OKV="${KV_MAJOR}.${KV_PATCH}" 292 OKV="${KV_MAJOR}.${KV_PATCH}"
302 fi 293 fi
303 KERNEL_URI="${KERNEL_BASE_URI}/patch-${CKV}.bz2 294 KERNEL_URI="${KERNEL_BASE_URI}/patch-${CKV}.xz
304 ${KERNEL_BASE_URI}/linux-${OKV}.tar.bz2" 295 ${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
305 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${CKV}.bz2" 296 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${CKV}.xz"
306 fi 297 fi
307 298
308 # We need to set this using OKV, but we need to set it before we do any 299 # We need to set this using OKV, but we need to set it before we do any
309 # messing around with OKV based on RELEASETYPE 300 # messing around with OKV based on RELEASETYPE
310 KV_FULL=${OKV}${EXTRAVERSION} 301 KV_FULL=${OKV}${EXTRAVERSION}
315 306
316 # -rc-git pulls can be achieved by specifying CKV 307 # -rc-git pulls can be achieved by specifying CKV
317 # for example: 308 # for example:
318 # CKV="2.6.11_rc3_pre2" 309 # CKV="2.6.11_rc3_pre2"
319 # will pull: 310 # will pull:
320 # linux-2.6.10.tar.bz2 & patch-2.6.11-rc3.bz2 & patch-2.6.11-rc3-git2.bz2 311 # linux-2.6.10.tar.xz & patch-2.6.11-rc3.xz & patch-2.6.11-rc3-git2.xz
321 312
322 if [[ ${KV_MAJOR}${KV_MINOR} -eq 26 ]]; then 313 if [[ ${KV_MAJOR}${KV_MINOR} -eq 26 ]]; then
323 314
324 if [[ ${RELEASETYPE} == -rc ]] || [[ ${RELEASETYPE} == -pre ]]; then 315 if [[ ${RELEASETYPE} == -rc ]] || [[ ${RELEASETYPE} == -pre ]]; then
325 OKV="${KV_MAJOR}.${KV_MINOR}.$((${KV_PATCH} - 1))" 316 OKV="${KV_MAJOR}.${KV_MINOR}.$((${KV_PATCH} - 1))"
326 KERNEL_URI="${KERNEL_BASE_URI}/testing/patch-${CKV//_/-}.bz2 317 KERNEL_URI="${KERNEL_BASE_URI}/testing/patch-${CKV//_/-}.xz
327 ${KERNEL_BASE_URI}/linux-${OKV}.tar.bz2" 318 ${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
328 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${CKV//_/-}.bz2" 319 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${CKV//_/-}.xz"
329 fi 320 fi
330 321
331 if [[ ${RELEASETYPE} == -git ]]; then 322 if [[ ${RELEASETYPE} == -git ]]; then
332 KERNEL_URI="${KERNEL_BASE_URI}/snapshots/patch-${OKV}${RELEASE}.bz2 323 KERNEL_URI="${KERNEL_BASE_URI}/snapshots/patch-${OKV}${RELEASE}.xz
333 ${KERNEL_BASE_URI}/linux-${OKV}.tar.bz2" 324 ${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
334 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${OKV}${RELEASE}.bz2" 325 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${OKV}${RELEASE}.xz"
335 fi 326 fi
336 327
337 if [[ ${RELEASETYPE} == -rc-git ]]; then 328 if [[ ${RELEASETYPE} == -rc-git ]]; then
338 OKV="${KV_MAJOR}.${KV_MINOR}.$((${KV_PATCH} - 1))" 329 OKV="${KV_MAJOR}.${KV_MINOR}.$((${KV_PATCH} - 1))"
339 KERNEL_URI="${KERNEL_BASE_URI}/snapshots/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.bz2 330 KERNEL_URI="${KERNEL_BASE_URI}/snapshots/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.xz
340 ${KERNEL_BASE_URI}/testing/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE/-git*}.bz2 331 ${KERNEL_BASE_URI}/testing/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE/-git*}.xz
341 ${KERNEL_BASE_URI}/linux-${OKV}.tar.bz2" 332 ${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
342 333
343 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE/-git*}.bz2 ${DISTDIR}/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.bz2" 334 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE/-git*}.xz ${DISTDIR}/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.xz"
344 fi 335 fi
345 else 336 else
346 if [[ ${RELEASETYPE} == -rc ]] || [[ ${RELEASETYPE} == -pre ]]; then 337 if [[ ${RELEASETYPE} == -rc ]] || [[ ${RELEASETYPE} == -pre ]]; then
347 if [[ ${KV_MAJOR}${KV_PATCH} -eq 30 ]]; then 338 if [[ ${KV_MAJOR}${KV_PATCH} -eq 30 ]]; then
348 OKV="2.6.39" 339 OKV="2.6.39"
349 else 340 else
350 KV_PATCH_ARR=(${KV_PATCH//\./ }) 341 KV_PATCH_ARR=(${KV_PATCH//\./ })
351 OKV="${KV_MAJOR}.$((${KV_PATCH_ARR} - 1))" 342 OKV="${KV_MAJOR}.$((${KV_PATCH_ARR} - 1))"
352 fi 343 fi
353 KERNEL_URI="${KERNEL_BASE_URI}/testing/patch-${CKV//_/-}.bz2 344 KERNEL_URI="${KERNEL_BASE_URI}/testing/patch-${CKV//_/-}.xz
354 ${KERNEL_BASE_URI}/testing/linux-${OKV}.tar.bz2" 345 ${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
355 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${CKV//_/-}.bz2" 346 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${CKV//_/-}.xz"
356 fi 347 fi
357 348
358 if [[ ${RELEASETYPE} == -git ]]; then 349 if [[ ${RELEASETYPE} == -git ]]; then
359 KERNEL_URI="${KERNEL_BASE_URI}/snapshots/patch-${OKV}${RELEASE}.bz2 350 KERNEL_URI="${KERNEL_BASE_URI}/snapshots/patch-${OKV}${RELEASE}.xz
360 ${KERNEL_BASE_URI}/linux-${OKV}.tar.bz2" 351 ${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
361 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${OKV}${RELEASE}.bz2" 352 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${OKV}${RELEASE}.xz"
362 fi 353 fi
363 354
364 if [[ ${RELEASETYPE} == -rc-git ]]; then 355 if [[ ${RELEASETYPE} == -rc-git ]]; then
365 if [[ ${KV_MAJOR}${KV_PATCH} -eq 30 ]]; then 356 if [[ ${KV_MAJOR}${KV_PATCH} -eq 30 ]]; then
366 OKV="2.6.39" 357 OKV="2.6.39"
367 else 358 else
368 KV_PATCH_ARR=(${KV_PATCH//\./ }) 359 KV_PATCH_ARR=(${KV_PATCH//\./ })
369 OKV="${KV_MAJOR}.$((${KV_PATCH_ARR} - 1))" 360 OKV="${KV_MAJOR}.$((${KV_PATCH_ARR} - 1))"
370 fi 361 fi
371 KERNEL_URI="${KERNEL_BASE_URI}/snapshots/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE}.bz2 362 KERNEL_URI="${KERNEL_BASE_URI}/snapshots/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE}.xz
372 ${KERNEL_BASE_URI}/testing/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE/-git*}.bz2 363 ${KERNEL_BASE_URI}/testing/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE/-git*}.xz
373 ${KERNEL_BASE_URI}/linux-${OKV}.tar.bz2" 364 ${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
374 365
375 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE/-git*}.bz2 ${DISTDIR}/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE}.bz2" 366 UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE/-git*}.xz ${DISTDIR}/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE}.xz"
376 fi 367 fi
377 368
378 369
379 fi 370 fi
380 371
382 debug-print-kernel2-variables 373 debug-print-kernel2-variables
383 374
384 handle_genpatches 375 handle_genpatches
385} 376}
386 377
378# Note: duplicated in linux-info.eclass
387kernel_is() { 379kernel_is() {
388 # ALL of these should be set before we can safely continue this function. 380 # ALL of these should be set before we can safely continue this function.
389 # some of the sources have in the past had only one set. 381 # some of the sources have in the past had only one set.
390 local v n=0 382 local v n=0
391 for v in OKV KV_{MAJOR,MINOR,PATCH} ; do [[ -z ${!v} ]] && n=1 ; done 383 for v in OKV KV_{MAJOR,MINOR,PATCH} ; do [[ -z ${!v} ]] && n=1 ; done
392 [[ $n -eq 1 ]] && detect_version 384 [[ $n -eq 1 ]] && detect_version
393 unset v n 385 unset v n
394 386
395 # Now we can continue 387 # Now we can continue
396 local operator test value x=0 y=0 z=0 388 local operator test value
397 389
398 case ${1} in 390 case ${1#-} in
399 lt) operator="-lt"; shift;; 391 lt) operator="-lt"; shift;;
400 gt) operator="-gt"; shift;; 392 gt) operator="-gt"; shift;;
401 le) operator="-le"; shift;; 393 le) operator="-le"; shift;;
402 ge) operator="-ge"; shift;; 394 ge) operator="-ge"; shift;;
403 eq) operator="-eq"; shift;; 395 eq) operator="-eq"; shift;;
404 *) operator="-eq";; 396 *) operator="-eq";;
405 esac 397 esac
406
407 for x in ${@}; do
408 for((y=0; y<$((3 - ${#x})); y++)); do value="${value}0"; done
409 value="${value}${x}"
410 z=$((${z} + 1))
411
412 case ${z} in
413 1) for((y=0; y<$((3 - ${#KV_MAJOR})); y++)); do test="${test}0"; done;
414 test="${test}${KV_MAJOR}";;
415 2) for((y=0; y<$((3 - ${#KV_MINOR})); y++)); do test="${test}0"; done;
416 test="${test}${KV_MINOR}";;
417 3) for((y=0; y<$((3 - ${#KV_PATCH})); y++)); do test="${test}0"; done;
418 test="${test}${KV_PATCH}";;
419 *) die "Error in kernel-2_kernel_is(): Too many parameters.";; 398 [[ $# -gt 3 ]] && die "Error in kernel-2_kernel_is(): too many parameters"
420 esac
421 done
422 399
423 [ ${test} ${operator} ${value} ] && return 0 || return 1 400 : $(( test = (KV_MAJOR << 16) + (KV_MINOR << 8) + KV_PATCH ))
401 : $(( value = (${1:-${KV_MAJOR}} << 16) + (${2:-${KV_MINOR}} << 8) + ${3:-${KV_PATCH}} ))
402 [ ${test} ${operator} ${value} ]
424} 403}
425 404
426kernel_is_2_4() { 405kernel_is_2_4() {
427 kernel_is 2 4 406 kernel_is 2 4
428} 407}
434# Capture the sources type and set DEPENDs 413# Capture the sources type and set DEPENDs
435if [[ ${ETYPE} == sources ]]; then 414if [[ ${ETYPE} == sources ]]; then
436 DEPEND="!build? ( sys-apps/sed 415 DEPEND="!build? ( sys-apps/sed
437 >=sys-devel/binutils-2.11.90.0.31 )" 416 >=sys-devel/binutils-2.11.90.0.31 )"
438 RDEPEND="!build? ( >=sys-libs/ncurses-5.2 417 RDEPEND="!build? ( >=sys-libs/ncurses-5.2
439 sys-devel/make )" 418 sys-devel/make
419 dev-lang/perl
420 sys-devel/bc )"
440 PDEPEND="!build? ( virtual/dev-manager )" 421 PDEPEND="!build? ( virtual/dev-manager )"
441 422
442 SLOT="${PVR}" 423 SLOT="${PVR}"
443 DESCRIPTION="Sources for the ${KV_MAJOR}.${KV_MINOR:-$KV_PATCH} linux kernel" 424 DESCRIPTION="Sources for the ${KV_MAJOR}.${KV_MINOR:-$KV_PATCH} linux kernel"
444 IUSE="symlink build" 425 IUSE="symlink build"
476 DEBLOB_CHECK_URI="mirror://gentoo/${DEBLOB_CHECK_A}" 457 DEBLOB_CHECK_URI="mirror://gentoo/${DEBLOB_CHECK_A}"
477 fi 458 fi
478 DEBLOB_URI="${DEBLOB_HOMEPAGE}/${DEBLOB_URI_PATH}/${DEBLOB_A}" 459 DEBLOB_URI="${DEBLOB_HOMEPAGE}/${DEBLOB_URI_PATH}/${DEBLOB_A}"
479 HOMEPAGE="${HOMEPAGE} ${DEBLOB_HOMEPAGE}" 460 HOMEPAGE="${HOMEPAGE} ${DEBLOB_HOMEPAGE}"
480 461
462 DEPEND+=" deblob? ( =dev-lang/python-2* )"
481 KERNEL_URI="${KERNEL_URI} 463 KERNEL_URI="${KERNEL_URI}
482 deblob? ( 464 deblob? (
483 ${DEBLOB_URI} 465 ${DEBLOB_URI}
484 ${DEBLOB_CHECK_URI} 466 ${DEBLOB_CHECK_URI}
485 )" 467 )"
495 477
496 # Since we should NOT honour KBUILD_OUTPUT in headers 478 # Since we should NOT honour KBUILD_OUTPUT in headers
497 # lets unset it here. 479 # lets unset it here.
498 unset KBUILD_OUTPUT 480 unset KBUILD_OUTPUT
499 481
500 if [[ ${CTARGET} = ${CHOST} ]]; then
501 SLOT="0" 482 SLOT="0"
502 else
503 SLOT="${CTARGET}"
504 fi
505else 483else
506 eerror "Unknown ETYPE=\"${ETYPE}\", must be \"sources\" or \"headers\"" 484 eerror "Unknown ETYPE=\"${ETYPE}\", must be \"sources\" or \"headers\""
507 die "Unknown ETYPE=\"${ETYPE}\", must be \"sources\" or \"headers\"" 485 die "Unknown ETYPE=\"${ETYPE}\", must be \"sources\" or \"headers\""
508fi 486fi
509 487
567} 545}
568 546
569universal_unpack() { 547universal_unpack() {
570 debug-print "Inside universal_unpack" 548 debug-print "Inside universal_unpack"
571 549
572 local oldifs=${IFS}
573 export IFS="."
574 local OKV_ARRAY=( $OKV ) 550 local OKV_ARRAY
575 export IFS=${oldifs} 551 IFS="." read -r -a OKV_ARRAY <<<"${OKV}"
576 552
577 cd "${WORKDIR}" 553 cd "${WORKDIR}"
578 if [[ ${#OKV_ARRAY[@]} -ge 3 ]] && [[ ${KV_MAJOR} -ge 3 ]]; then 554 if [[ ${#OKV_ARRAY[@]} -ge 3 ]] && [[ ${KV_MAJOR} -ge 3 ]]; then
579 unpack linux-${KV_MAJOR}.${KV_MINOR}.tar.bz2 555 unpack linux-${KV_MAJOR}.${KV_MINOR}.tar.xz
580 else 556 else
581 unpack linux-${OKV}.tar.bz2 557 unpack linux-${OKV}.tar.xz
582 fi 558 fi
583 559
584 if [[ -d "linux" ]]; then 560 if [[ -d "linux" ]]; then
585 debug-print "Moving linux to linux-${KV_FULL}" 561 debug-print "Moving linux to linux-${KV_FULL}"
586 mv linux linux-${KV_FULL} \ 562 mv linux linux-${KV_FULL} \
603 cd "${S}" 579 cd "${S}"
604 580
605 # remove all backup files 581 # remove all backup files
606 find . -iname "*~" -exec rm {} \; 2> /dev/null 582 find . -iname "*~" -exec rm {} \; 2> /dev/null
607 583
608 # fix a problem on ppc where TOUT writes to /usr/src/linux breaking sandbox
609 # only do this for kernel < 2.6.27 since this file does not exist in later
610 # kernels
611 if [[ -n ${KV_MINOR} && ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} < 2.6.27 ]]
612 then
613 sed -i \
614 -e 's|TOUT := .tmp_gas_check|TOUT := $(T).tmp_gas_check|' \
615 "${S}"/arch/ppc/Makefile
616 else
617 sed -i \
618 -e 's|TOUT := .tmp_gas_check|TOUT := $(T).tmp_gas_check|' \
619 "${S}"/arch/powerpc/Makefile
620 fi
621} 584}
622 585
623unpack_set_extraversion() { 586unpack_set_extraversion() {
624 cd "${S}" 587 cd "${S}"
625 sed -i -e "s:^\(EXTRAVERSION =\).*:\1 ${EXTRAVERSION}:" Makefile 588 sed -i -e "s:^\(EXTRAVERSION =\).*:\1 ${EXTRAVERSION}:" Makefile
702} 665}
703 666
704# install functions 667# install functions
705#============================================================== 668#==============================================================
706install_universal() { 669install_universal() {
707 #fix silly permissions in tarball 670 # Fix silly permissions in tarball
708 cd "${WORKDIR}" 671 cd "${WORKDIR}"
709 chown -R root:0 * >& /dev/null 672 chown -R 0:0 * >& /dev/null
710 chmod -R a+r-w+X,u+w * 673 chmod -R a+r-w+X,u+w *
711 cd ${OLDPWD} 674 cd ${OLDPWD}
712} 675}
713 676
714install_headers() { 677install_headers() {
1127 done 1090 done
1128 fi 1091 fi
1129 done 1092 done
1130} 1093}
1131 1094
1132# sparc nastiness
1133#==============================================================
1134# This script generates the files in /usr/include/asm for sparc systems
1135# during installation of sys-kernel/linux-headers.
1136# Will no longer be needed when full 64 bit support is used on sparc64
1137# systems.
1138#
1139# Shamefully ripped from Debian
1140# ----------------------------------------------------------------------
1141
1142# Idea borrowed from RedHat's kernel package
1143
1144# This is gonna get replaced by something in multilib.eclass soon...
1145# --eradicator
1146generate_sparc_asm() {
1147 local name
1148
1149 cd $1 || die
1150 mkdir asm
1151
1152 for h in `( ls asm-sparc; ls asm-sparc64 ) | grep '\.h$' | sort -u`; do
1153 name="$(echo $h | tr a-z. A-Z_)"
1154 # common header
1155 echo "/* All asm/ files are generated and point to the corresponding
1156 * file in asm-sparc or asm-sparc64.
1157 */
1158
1159#ifndef __SPARCSTUB__${name}__
1160#define __SPARCSTUB__${name}__
1161" > asm/${h}
1162
1163 # common for sparc and sparc64
1164 if [ -f asm-sparc/$h -a -f asm-sparc64/$h ]; then
1165 echo "#ifdef __arch64__
1166#include <asm-sparc64/$h>
1167#else
1168#include <asm-sparc/$h>
1169#endif
1170" >> asm/${h}
1171
1172 # sparc only
1173 elif [ -f asm-sparc/$h ]; then
1174echo "#ifndef __arch64__
1175#include <asm-sparc/$h>
1176#endif
1177" >> asm/${h}
1178
1179 # sparc64 only
1180 else
1181echo "#ifdef __arch64__
1182#include <asm-sparc64/$h>
1183#endif
1184" >> asm/${h}
1185 fi
1186
1187 # common footer
1188 echo "#endif /* !__SPARCSTUB__${name}__ */" >> asm/${h}
1189 done
1190 return 0
1191}
1192
1193headers___fix() { 1095headers___fix() {
1194 # Voodoo to partially fix broken upstream headers. 1096 # Voodoo to partially fix broken upstream headers.
1195 # note: do not put inline/asm/volatile together (breaks "inline asm volatile") 1097 # note: do not put inline/asm/volatile together (breaks "inline asm volatile")
1196 sed -i \ 1098 sed -i \
1197 -e '/^\#define.*_TYPES_H/{:loop n; bloop}' \ 1099 -e '/^\#define.*_TYPES_H/{:loop n; bloop}' \
1241 if [[ $K_DEBLOB_AVAILABLE == 1 ]] && use deblob ; then 1143 if [[ $K_DEBLOB_AVAILABLE == 1 ]] && use deblob ; then
1242 cp "${DISTDIR}/${DEBLOB_A}" "${T}" || die "cp ${DEBLOB_A} failed" 1144 cp "${DISTDIR}/${DEBLOB_A}" "${T}" || die "cp ${DEBLOB_A} failed"
1243 cp "${DISTDIR}/${DEBLOB_CHECK_A}" "${T}/deblob-check" || die "cp ${DEBLOB_CHECK_A} failed" 1145 cp "${DISTDIR}/${DEBLOB_CHECK_A}" "${T}/deblob-check" || die "cp ${DEBLOB_CHECK_A} failed"
1244 chmod +x "${T}/${DEBLOB_A}" "${T}/deblob-check" || die "chmod deblob scripts failed" 1146 chmod +x "${T}/${DEBLOB_A}" "${T}/deblob-check" || die "chmod deblob scripts failed"
1245 fi 1147 fi
1148
1149 # fix a problem on ppc where TOUT writes to /usr/src/linux breaking sandbox
1150 # only do this for kernel < 2.6.27 since this file does not exist in later
1151 # kernels
1152 if [[ -n ${KV_MINOR} && ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} < 2.6.27 ]]
1153 then
1154 sed -i \
1155 -e 's|TOUT := .tmp_gas_check|TOUT := $(T).tmp_gas_check|' \
1156 "${S}"/arch/ppc/Makefile
1157 else
1158 sed -i \
1159 -e 's|TOUT := .tmp_gas_check|TOUT := $(T).tmp_gas_check|' \
1160 "${S}"/arch/powerpc/Makefile
1161 fi
1246} 1162}
1247 1163
1248kernel-2_src_compile() { 1164kernel-2_src_compile() {
1249 cd "${S}" 1165 cd "${S}"
1250 [[ ${ETYPE} == headers ]] && compile_headers 1166 [[ ${ETYPE} == headers ]] && compile_headers
1251 1167
1252 if [[ $K_DEBLOB_AVAILABLE == 1 ]] && use deblob ; then 1168 if [[ $K_DEBLOB_AVAILABLE == 1 ]] && use deblob ; then
1253 echo ">>> Running deblob script ..." 1169 echo ">>> Running deblob script ..."
1254 sh "${T}/${DEBLOB_A}" --force || \ 1170 EPYTHON="python2" sh "${T}/${DEBLOB_A}" --force || die "Deblob script failed to run!!!"
1255 die "Deblob script failed to run!!!"
1256 fi 1171 fi
1257} 1172}
1258 1173
1259# if you leave it to the default src_test, it will run make to 1174# if you leave it to the default src_test, it will run make to
1260# find whether test/check targets are present; since "make test" 1175# find whether test/check targets are present; since "make test"
1278 [[ ${ETYPE} == sources ]] && postinst_sources 1193 [[ ${ETYPE} == sources ]] && postinst_sources
1279} 1194}
1280 1195
1281kernel-2_pkg_setup() { 1196kernel-2_pkg_setup() {
1282 if kernel_is 2 4; then 1197 if kernel_is 2 4; then
1283 if [ "$( gcc-major-version )" -eq "4" ] ; then 1198 if [[ $(gcc-major-version) -ge 4 ]] ; then
1284 echo 1199 echo
1285 ewarn "Be warned !! >=sys-devel/gcc-4.0.0 isn't supported with linux-2.4!" 1200 ewarn "Be warned !! >=sys-devel/gcc-4.0.0 isn't supported with linux-2.4!"
1286 ewarn "Either switch to another gcc-version (via gcc-config) or use a" 1201 ewarn "Either switch to another gcc-version (via gcc-config) or use a"
1287 ewarn "newer kernel that supports gcc-4." 1202 ewarn "newer kernel that supports gcc-4."
1288 echo 1203 echo
1297 [[ ${ETYPE} == headers ]] && setup_headers 1212 [[ ${ETYPE} == headers ]] && setup_headers
1298 [[ ${ETYPE} == sources ]] && echo ">>> Preparing to unpack ..." 1213 [[ ${ETYPE} == sources ]] && echo ">>> Preparing to unpack ..."
1299} 1214}
1300 1215
1301kernel-2_pkg_postrm() { 1216kernel-2_pkg_postrm() {
1217 # This warning only makes sense for kernel sources.
1218 [[ ${ETYPE} == headers ]] && return 0
1219
1220 # If there isn't anything left behind, then don't complain.
1221 [[ -e ${ROOT}usr/src/linux-${KV_FULL} ]] || return 0
1302 echo 1222 echo
1303 ewarn "Note: Even though you have successfully unmerged " 1223 ewarn "Note: Even though you have successfully unmerged "
1304 ewarn "your kernel package, directories in kernel source location: " 1224 ewarn "your kernel package, directories in kernel source location: "
1305 ewarn "${ROOT}usr/src/linux-${KV_FULL}" 1225 ewarn "${ROOT}usr/src/linux-${KV_FULL}"
1306 ewarn "with modified files will remain behind. By design, package managers" 1226 ewarn "with modified files will remain behind. By design, package managers"
1307 ewarn "will not remove these modified files and the directories they reside in." 1227 ewarn "will not remove these modified files and the directories they reside in."
1308 echo 1228 echo
1309} 1229}
1310

Legend:
Removed from v.1.260  
changed lines
  Added in v.1.281

  ViewVC Help
Powered by ViewVC 1.1.20