/[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.282 Revision 1.293
1# Copyright 1999-2013 Gentoo Foundation 1# Copyright 1999-2014 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.282 2013/04/17 13:52:17 tomwij Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/kernel-2.eclass,v 1.293 2014/01/17 19:05:05 mpagano 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>
38# K_SYMLINK - if this is set, then forcably create symlink anyway 38# K_SYMLINK - if this is set, then forcably create symlink anyway
39# 39#
40# K_DEFCONFIG - Allow specifying a different defconfig target. 40# K_DEFCONFIG - Allow specifying a different defconfig target.
41# If length zero, defaults to "defconfig". 41# If length zero, defaults to "defconfig".
42# K_WANT_GENPATCHES - Apply genpatches to kernel source. Provide any 42# K_WANT_GENPATCHES - Apply genpatches to kernel source. Provide any
43# combination of "base" and "extras" 43# combination of "base", "extras" or "experimental".
44# K_EXP_GENPATCHES_PULL - If set, we pull "experimental" regardless of the USE FLAG
45# but expect the ebuild maintainer to use K_EXP_GENPATCHES_LIST.
46# K_EXP_GENPATCHES_NOUSE - If set, no USE flag will be provided for "experimental";
47# as a result the user cannot choose to apply those patches.
48# K_EXP_GENPATCHES_LIST - A list of patches to pick from "experimental" to apply when
49# the USE flag is unset and K_EXP_GENPATCHES_PULL is set.
44# K_GENPATCHES_VER - The version of the genpatches tarball(s) to apply. 50# K_GENPATCHES_VER - The version of the genpatches tarball(s) to apply.
45# A value of "5" would apply genpatches-2.6.12-5 to 51# A value of "5" would apply genpatches-2.6.12-5 to
46# my-sources-2.6.12.ebuild 52# my-sources-2.6.12.ebuild
47# K_SECURITY_UNSUPPORTED- If set, this kernel is unsupported by Gentoo Security 53# K_SECURITY_UNSUPPORTED- If set, this kernel is unsupported by Gentoo Security
48# K_DEBLOB_AVAILABLE - A value of "0" will disable all of the optional deblob 54# K_DEBLOB_AVAILABLE - A value of "0" will disable all of the optional deblob
72# Changing any other variable in this eclass is not supported; you can request 78# Changing any other variable in this eclass is not supported; you can request
73# for additional variables to be added by contacting the current maintainer. 79# for additional variables to be added by contacting the current maintainer.
74# If you do change them, there is a chance that we will not fix resulting bugs; 80# If you do change them, there is a chance that we will not fix resulting bugs;
75# that of course does not mean we're not willing to help. 81# that of course does not mean we're not willing to help.
76 82
77inherit eutils toolchain-funcs versionator multilib 83inherit eutils toolchain-funcs versionator multilib python
78EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_test src_install pkg_preinst pkg_postinst pkg_postrm 84EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_test src_install pkg_preinst pkg_postinst pkg_postrm
79 85
80# Added by Daniel Ostrow <dostrow@gentoo.org> 86# Added by Daniel Ostrow <dostrow@gentoo.org>
81# This is an ugly hack to get around an issue with a 32-bit userland on ppc64. 87# This is an ugly hack to get around an issue with a 32-bit userland on ppc64.
82# I will remove it when I come up with something more reasonable. 88# I will remove it when I come up with something more reasonable.
128 # genpatches for 3.0 and 3.0.1 might be named 134 # genpatches for 3.0 and 3.0.1 might be named
129 # genpatches-3.0-1.base.tar.xz and genpatches-3.0-2.base.tar.xz 135 # genpatches-3.0-1.base.tar.xz and genpatches-3.0-2.base.tar.xz
130 # respectively. Handle this. 136 # respectively. Handle this.
131 137
132 for i in ${K_WANT_GENPATCHES} ; do 138 for i in ${K_WANT_GENPATCHES} ; do
133 if [[ ${KV_MAJOR} -ge 3 ]]; then 139 if [[ ${KV_MAJOR} -ge 3 ]]; then
134 if [[ ${#OKV_ARRAY[@]} -ge 3 ]]; then 140 if [[ ${#OKV_ARRAY[@]} -ge 3 ]]; then
135 tarball="genpatches-${KV_MAJOR}.${KV_MINOR}-${K_GENPATCHES_VER}.${i}.tar.xz" 141 tarball="genpatches-${KV_MAJOR}.${KV_MINOR}-${K_GENPATCHES_VER}.${i}.tar.xz"
142 else
143 tarball="genpatches-${KV_MAJOR}.${KV_PATCH}-${K_GENPATCHES_VER}.${i}.tar.xz"
144 fi
136 else 145 else
137 tarball="genpatches-${KV_MAJOR}.${KV_PATCH}-${K_GENPATCHES_VER}.${i}.tar.xz"
138 fi
139 else
140 tarball="genpatches-${OKV}-${K_GENPATCHES_VER}.${i}.tar.xz" 146 tarball="genpatches-${OKV}-${K_GENPATCHES_VER}.${i}.tar.xz"
141 fi 147 fi
148
149 local use_cond_start="" use_cond_end=""
150
151 if [[ "${i}" == "experimental" && -z ${K_EXP_GENPATCHES_PULL} && -z ${K_EXP_GENPATCHES_NOUSE} ]] ; then
152 use_cond_start="experimental? ( "
153 use_cond_end=" )"
154
155 if use experimental ; then
156 UNIPATCH_LIST_GENPATCHES+=" ${DISTDIR}/${tarball}"
157 debug-print "genpatches tarball: $tarball"
158 fi
159 else
160 UNIPATCH_LIST_GENPATCHES+=" ${DISTDIR}/${tarball}"
142 debug-print "genpatches tarball: $tarball" 161 debug-print "genpatches tarball: $tarball"
143 GENPATCHES_URI="${GENPATCHES_URI} mirror://gentoo/${tarball}" 162 fi
144 UNIPATCH_LIST_GENPATCHES="${UNIPATCH_LIST_GENPATCHES} ${DISTDIR}/${tarball}" 163
164 GENPATCHES_URI+=" ${use_cond_start}mirror://gentoo/${tarball}${use_cond_end}"
145 done 165 done
146} 166}
147 167
148detect_version() { 168detect_version() {
149 # this function will detect and set 169 # this function will detect and set
210 230
211# if [[ ${KV_MAJOR} -ge 3 ]]; then 231# if [[ ${KV_MAJOR} -ge 3 ]]; then
212 if [[ ${#OKV_ARRAY[@]} -lt 3 ]]; then 232 if [[ ${#OKV_ARRAY[@]} -lt 3 ]]; then
213 KV_PATCH_ARR=(${KV_PATCH//\./ }) 233 KV_PATCH_ARR=(${KV_PATCH//\./ })
214 234
215 # at this point 031412, Linus is putting all 3.x kernels in a 235 # at this point 031412, Linus is putting all 3.x kernels in a
216 # 3.x directory, may need to revisit when 4.x is released 236 # 3.x directory, may need to revisit when 4.x is released
217 KERNEL_BASE_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.x" 237 KERNEL_BASE_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.x"
218 238
219 [[ -n "${K_LONGTERM}" ]] && 239 [[ -n "${K_LONGTERM}" ]] &&
220 KERNEL_BASE_URI="${KERNEL_BASE_URI}/longterm/v${KV_MAJOR}.${KV_PATCH_ARR}" 240 KERNEL_BASE_URI="${KERNEL_BASE_URI}/longterm/v${KV_MAJOR}.${KV_PATCH_ARR}"
415 kernel_is 2 6 || kernel_is 2 5 435 kernel_is 2 6 || kernel_is 2 5
416} 436}
417 437
418# Capture the sources type and set DEPENDs 438# Capture the sources type and set DEPENDs
419if [[ ${ETYPE} == sources ]]; then 439if [[ ${ETYPE} == sources ]]; then
420 DEPEND="!build? ( sys-apps/sed 440 DEPEND="!build? (
441 sys-apps/sed
421 >=sys-devel/binutils-2.11.90.0.31 )" 442 >=sys-devel/binutils-2.11.90.0.31
422 RDEPEND="!build? ( >=sys-libs/ncurses-5.2 443 )"
444 RDEPEND="!build? (
445 >=sys-libs/ncurses-5.2
423 sys-devel/make 446 sys-devel/make
424 dev-lang/perl 447 dev-lang/perl
425 sys-devel/bc )" 448 sys-devel/bc
449 )"
426 PDEPEND="!build? ( virtual/dev-manager )" 450 PDEPEND="!build? ( virtual/dev-manager )"
427 451
428 SLOT="${PVR}" 452 SLOT="${PVR}"
429 DESCRIPTION="Sources based on the Linux Kernel." 453 DESCRIPTION="Sources based on the Linux Kernel."
430 IUSE="symlink build" 454 IUSE="symlink build"
435 kernel_is ge 2 6 27 && \ 459 kernel_is ge 2 6 27 && \
436 [[ -z "${K_DEBLOB_AVAILABLE}" ]] && \ 460 [[ -z "${K_DEBLOB_AVAILABLE}" ]] && \
437 kernel_is le 2 6 ${DEBLOB_MAX_VERSION} && \ 461 kernel_is le 2 6 ${DEBLOB_MAX_VERSION} && \
438 K_DEBLOB_AVAILABLE=1 462 K_DEBLOB_AVAILABLE=1
439 if [[ ${K_DEBLOB_AVAILABLE} == "1" ]] ; then 463 if [[ ${K_DEBLOB_AVAILABLE} == "1" ]] ; then
440 IUSE="${IUSE} deblob" 464 IUSE="${IUSE} deblob python"
441 # Reflect that kernels contain firmware blobs unless otherwise 465 # Reflect that kernels contain firmware blobs unless otherwise
442 # stripped 466 # stripped
443 LICENSE="${LICENSE} !deblob? ( freedist )" 467 LICENSE="${LICENSE} !deblob? ( freedist )"
444 468
445 if [[ -n KV_MINOR ]]; then 469 if [[ -n KV_MINOR ]]; then
462 DEBLOB_CHECK_URI="mirror://gentoo/${DEBLOB_CHECK_A}" 486 DEBLOB_CHECK_URI="mirror://gentoo/${DEBLOB_CHECK_A}"
463 fi 487 fi
464 DEBLOB_URI="${DEBLOB_HOMEPAGE}/${DEBLOB_URI_PATH}/${DEBLOB_A}" 488 DEBLOB_URI="${DEBLOB_HOMEPAGE}/${DEBLOB_URI_PATH}/${DEBLOB_A}"
465 HOMEPAGE="${HOMEPAGE} ${DEBLOB_HOMEPAGE}" 489 HOMEPAGE="${HOMEPAGE} ${DEBLOB_HOMEPAGE}"
466 490
467 DEPEND+=" deblob? ( =dev-lang/python-2* )" 491 #deblob script currently only works with python-2
492 PYTHON_DEPEND="python? 2"
493 PYTHON_USE_WITH_OPT="python"
494
468 KERNEL_URI="${KERNEL_URI} 495 KERNEL_URI="${KERNEL_URI}
469 deblob? ( 496 deblob? (
470 ${DEBLOB_URI} 497 ${DEBLOB_URI}
471 ${DEBLOB_CHECK_URI} 498 ${DEBLOB_CHECK_URI}
472 )" 499 )"
687 if kernel_is ge 2 6 18 ; then 714 if kernel_is ge 2 6 18 ; then
688 env_setup_xmakeopts 715 env_setup_xmakeopts
689 emake headers_install INSTALL_HDR_PATH="${D}"/${ddir}/.. ${xmakeopts} || die 716 emake headers_install INSTALL_HDR_PATH="${D}"/${ddir}/.. ${xmakeopts} || die
690 717
691 # let other packages install some of these headers 718 # let other packages install some of these headers
692 rm -rf "${D}"/${ddir}/sound #alsa-headers
693 rm -rf "${D}"/${ddir}/scsi #glibc/uclibc/etc... 719 rm -rf "${D}"/${ddir}/scsi #glibc/uclibc/etc...
694 return 0 720 return 0
695 fi 721 fi
696 722
697 # Do not use "linux/*" as that can cause problems with very long 723 # Do not use "linux/*" as that can cause problems with very long
740 > "${S}"/patches.txt 766 > "${S}"/patches.txt
741 fi 767 fi
742 768
743 mv ${WORKDIR}/linux* "${D}"/usr/src 769 mv ${WORKDIR}/linux* "${D}"/usr/src
744 770
745 if [[ -z ${UNIPATCH_DOCS} ]] ; then 771 if [[ -n "${UNIPATCH_DOCS}" ]] ; then
746 dodoc ${UNIPATCH_DOCS} 772 for i in ${UNIPATCH_DOCS}; do
773 dodoc "${T}"/${i}
774 done
747 fi 775 fi
748} 776}
749 777
750# pkg_preinst functions 778# pkg_preinst functions
751#============================================================== 779#==============================================================
811 fi 839 fi
812 840
813 # optionally display security unsupported message 841 # optionally display security unsupported message
814 # Start with why 842 # Start with why
815 if [[ ${K_SECURITY_UNSUPPORTED} = deblob ]]; then 843 if [[ ${K_SECURITY_UNSUPPORTED} = deblob ]]; then
816 ewarn "Deblobbed kernels are UNSUPPORTED by Gentoo Security." 844 ewarn "Deblobbed kernels may not be up-to-date security-wise"
845 ewarn "as they depend on external scripts."
817 elif [[ -n ${K_SECURITY_UNSUPPORTED} ]]; then 846 elif [[ -n ${K_SECURITY_UNSUPPORTED} ]]; then
818 ewarn "${PN} is UNSUPPORTED by Gentoo Security." 847 ewarn "${PN} is UNSUPPORTED by Gentoo Security."
819 fi 848 fi
820 # And now the general message. 849 # And now the general message.
821 if [[ -n ${K_SECURITY_UNSUPPORTED} ]]; then 850 if [[ -n ${K_SECURITY_UNSUPPORTED} ]]; then
827 # warn sparc users that they need to do cross-compiling with >= 2.6.25(bug #214765) 856 # warn sparc users that they need to do cross-compiling with >= 2.6.25(bug #214765)
828 KV_MAJOR=$(get_version_component_range 1 ${OKV}) 857 KV_MAJOR=$(get_version_component_range 1 ${OKV})
829 KV_MINOR=$(get_version_component_range 2 ${OKV}) 858 KV_MINOR=$(get_version_component_range 2 ${OKV})
830 KV_PATCH=$(get_version_component_range 3 ${OKV}) 859 KV_PATCH=$(get_version_component_range 3 ${OKV})
831 if [[ "$(tc-arch)" = "sparc" ]]; then 860 if [[ "$(tc-arch)" = "sparc" ]]; then
832 if [[ ${KV_MAJOR} -ge 3 || ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} > 2.6.24 ]] 861 if [[ ${KV_MAJOR} -ge 3 || ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} > 2.6.24 ]] ; then
833 then
834 echo 862 echo
835 elog "NOTE: Since 2.6.25 the kernel Makefile has changed in a way that" 863 elog "NOTE: Since 2.6.25 the kernel Makefile has changed in a way that"
836 elog "you now need to do" 864 elog "you now need to do"
837 elog " make CROSS_COMPILE=sparc64-unknown-linux-gnu-" 865 elog " make CROSS_COMPILE=sparc64-unknown-linux-gnu-"
838 elog "instead of just" 866 elog "instead of just"
914 PIPE_CMD="" 942 PIPE_CMD=""
915 case ${extention} in 943 case ${extention} in
916 xz) PIPE_CMD="xz -dc";; 944 xz) PIPE_CMD="xz -dc";;
917 lzma) PIPE_CMD="lzma -dc";; 945 lzma) PIPE_CMD="lzma -dc";;
918 bz2) PIPE_CMD="bzip2 -dc";; 946 bz2) PIPE_CMD="bzip2 -dc";;
919 patch) PIPE_CMD="cat";; 947 patch*) PIPE_CMD="cat";;
920 diff) PIPE_CMD="cat";; 948 diff) PIPE_CMD="cat";;
921 gz|Z|z) PIPE_CMD="gzip -dc";; 949 gz|Z|z) PIPE_CMD="gzip -dc";;
922 ZIP|zip) PIPE_CMD="unzip -p";; 950 ZIP|zip) PIPE_CMD="unzip -p";;
923 *) UNIPATCH_DROP="${UNIPATCH_DROP} ${i/:*/}";; 951 *) UNIPATCH_DROP="${UNIPATCH_DROP} ${i/:*/}";;
924 esac 952 esac
950 $(${PIPE_CMD} ${i} > ${KPATCH_DIR}/${PATCH_ORDER}/${x}.patch${PATCH_LEVEL}) || die "uncompressing patch failed" 978 $(${PIPE_CMD} ${i} > ${KPATCH_DIR}/${PATCH_ORDER}/${x}.patch${PATCH_LEVEL}) || die "uncompressing patch failed"
951 else 979 else
952 $(${PIPE_CMD} ${i} > ${KPATCH_DIR}/${x}.patch${PATCH_LEVEL}) || die "uncompressing patch failed" 980 $(${PIPE_CMD} ${i} > ${KPATCH_DIR}/${x}.patch${PATCH_LEVEL}) || die "uncompressing patch failed"
953 fi 981 fi
954 fi 982 fi
983 fi
984
985 # If experimental was not chosen by the user, drop experimental patches not in K_EXP_GENPATCHES_LIST.
986 if [[ "${i}" == *"genpatches-"*".experimental."* && -n ${K_EXP_GENPATCHES_PULL} ]] ; then
987 if [[ -z ${K_EXP_GENPATCHES_NOUSE} ]] && use experimental; then
988 continue
989 fi
990
991 local j
992 for j in ${KPATCH_DIR}/*/50*_*.patch*; do
993 for k in ${K_EXP_GENPATCHES_LIST} ; do
994 [[ "$(basename ${j})" == ${k}* ]] && continue 2
995 done
996 UNIPATCH_DROP+=" $(basename ${j})"
997 done
955 fi 998 fi
956 done 999 done
957 1000
958 #populate KPATCH_DIRS so we know where to look to remove the excludes 1001 #populate KPATCH_DIRS so we know where to look to remove the excludes
959 x=${KPATCH_DIR} 1002 x=${KPATCH_DIR}
1038 # them during the install phase. 1081 # them during the install phase.
1039 local tmp 1082 local tmp
1040 for x in ${KPATCH_DIR}; do 1083 for x in ${KPATCH_DIR}; do
1041 for i in ${UNIPATCH_DOCS}; do 1084 for i in ${UNIPATCH_DOCS}; do
1042 if [[ -f "${x}/${i}" ]] ; then 1085 if [[ -f "${x}/${i}" ]] ; then
1043 tmp="${tmp} \"${T}/${i}\"" 1086 tmp="${tmp} ${i}"
1044 cp -f "${x}/${i}" "${T}"/ 1087 cp -f "${x}/${i}" "${T}"/
1045 fi 1088 fi
1046 done 1089 done
1047 done 1090 done
1048 UNIPATCH_DOCS="${tmp}" 1091 UNIPATCH_DOCS="${tmp}"
1166 fi 1209 fi
1167 1210
1168 # fix a problem on ppc where TOUT writes to /usr/src/linux breaking sandbox 1211 # fix a problem on ppc where TOUT writes to /usr/src/linux breaking sandbox
1169 # only do this for kernel < 2.6.27 since this file does not exist in later 1212 # only do this for kernel < 2.6.27 since this file does not exist in later
1170 # kernels 1213 # kernels
1171 if [[ -n ${KV_MINOR} && ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} < 2.6.27 ]] 1214 if [[ -n ${KV_MINOR} && ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} < 2.6.27 ]] ; then
1172 then
1173 sed -i \ 1215 sed -i \
1174 -e "s|TOUT := .tmp_gas_check|TOUT := \"${T}\"/.tmp_gas_check|" \ 1216 -e 's|TOUT := .tmp_gas_check|TOUT := $(T).tmp_gas_check|' \
1175 "${S}"/arch/ppc/Makefile 1217 "${S}"/arch/ppc/Makefile
1176 else 1218 else
1177 sed -i \ 1219 sed -i \
1178 -e "s|TOUT := .tmp_gas_check|TOUT := \"${T}\"/.tmp_gas_check|" \ 1220 -e 's|TOUT := .tmp_gas_check|TOUT := $(T).tmp_gas_check|' \
1179 "${S}"/arch/powerpc/Makefile 1221 "${S}"/arch/powerpc/Makefile
1180 fi 1222 fi
1181} 1223}
1182 1224
1183kernel-2_src_compile() { 1225kernel-2_src_compile() {
1184 cd "${S}" 1226 cd "${S}"
1185 [[ ${ETYPE} == headers ]] && compile_headers 1227 [[ ${ETYPE} == headers ]] && compile_headers
1186 1228
1187 if [[ $K_DEBLOB_AVAILABLE == 1 ]] && use deblob ; then 1229 if [[ $K_DEBLOB_AVAILABLE == 1 ]] && use deblob ; then
1188 echo ">>> Running deblob script ..." 1230 echo ">>> Running deblob script ..."
1189 EPYTHON="python2" sh "${T}/${DEBLOB_A}" --force || die "Deblob script failed to run!!!" 1231 sh "${T}/${DEBLOB_A}" --force || die "Deblob script failed to run!!!"
1190 fi 1232 fi
1191} 1233}
1192 1234
1193# if you leave it to the default src_test, it will run make to 1235# if you leave it to the default src_test, it will run make to
1194# find whether test/check targets are present; since "make test" 1236# find whether test/check targets are present; since "make test"

Legend:
Removed from v.1.282  
changed lines
  Added in v.1.293

  ViewVC Help
Powered by ViewVC 1.1.20