| 1 | # Copyright 1999-2004 Gentoo Foundation |
1 | # Copyright 1999-2004 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/linux-mod.eclass,v 1.15 2005/01/06 13:58:15 johnm Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/linux-mod.eclass,v 1.16 2005/01/06 17:58:59 johnm Exp $ |
| 4 | |
4 | |
| 5 | # Description: This eclass is used to interface with linux-info in such a way |
5 | # Description: This eclass is used to interface with linux-info in such a way |
| 6 | # to provide the functionality required and initial functions |
6 | # to provide the functionality required and initial functions |
| 7 | # required to install external modules against a kernel source |
7 | # required to install external modules against a kernel source |
| 8 | # tree. |
8 | # tree. |
| … | |
… | |
| 22 | # BUILD_TARGETS <string> clean modules The build targets to pass to make. |
22 | # BUILD_TARGETS <string> clean modules The build targets to pass to make. |
| 23 | # MODULE_NAMES <string> This is the modules which are |
23 | # MODULE_NAMES <string> This is the modules which are |
| 24 | # to be built automatically using the |
24 | # to be built automatically using the |
| 25 | # default pkg_compile/install. They |
25 | # default pkg_compile/install. They |
| 26 | # are explained properly below. |
26 | # are explained properly below. |
|
|
27 | # It will only make BUILD_TARGETS once |
|
|
28 | # in any directory. |
| 27 | # NO_MODULESD <string> Set this to something to prevent |
29 | # NO_MODULESD <string> Set this to something to prevent |
| 28 | # modulesd file generation |
30 | # modulesd file generation |
| 29 | |
31 | |
| 30 | |
32 | |
| 31 | # MODULE_NAMES - Detailed Overview |
33 | # MODULE_NAMES - Detailed Overview |
| … | |
… | |
| 256 | } |
258 | } |
| 257 | |
259 | |
| 258 | linux-mod_src_compile() { |
260 | linux-mod_src_compile() { |
| 259 | local modulename moduledir sourcedir moduletemp xarch i |
261 | local modulename moduledir sourcedir moduletemp xarch i |
| 260 | xarch="${ARCH}" |
262 | xarch="${ARCH}" |
| 261 | unset ARCH |
263 | unset ARCH |
|
|
264 | |
|
|
265 | BUILD_TARGETS=${BUILD_TARGETS:-clean module} |
| 262 | |
266 | |
| 263 | for i in ${MODULE_NAMES} |
267 | for i in ${MODULE_NAMES} |
| 264 | do |
268 | do |
| 265 | moduletemp="$(echo ${i} | sed -e "s:\(.*\)(\(.*\)):\1 \2:")" |
269 | moduletemp="$(echo ${i} | sed -e "s:\(.*\)(\(.*\)):\1 \2:")" |
| 266 | modulename="${moduletemp/ */}" |
270 | modulename="${moduletemp/ */}" |
| … | |
… | |
| 270 | # if we didnt pass the brackets, then we shouldnt accept anything |
274 | # if we didnt pass the brackets, then we shouldnt accept anything |
| 271 | [ -n "${moduletemp/${modulename}/}" ] && sourcedir="${moduletemp/*:/}" |
275 | [ -n "${moduletemp/${modulename}/}" ] && sourcedir="${moduletemp/*:/}" |
| 272 | moduledir="${moduledir:-misc}" |
276 | moduledir="${moduledir:-misc}" |
| 273 | sourcedir="${sourcedir:-${S}}" |
277 | sourcedir="${sourcedir:-${S}}" |
| 274 | |
278 | |
|
|
279 | if [ ! -f "${sourcedir}/.built" ]; |
|
|
280 | then |
|
|
281 | cd ${sourcedir} |
| 275 | einfo "Preparing ${modulename} module" |
282 | einfo "Preparing ${modulename} module" |
| 276 | cd ${sourcedir} |
|
|
| 277 | emake ${BUILD_FIXES} ${BUILD_PARAMS} ${BUILD_TARGETS:-clean module} || \ |
283 | emake ${BUILD_FIXES} ${BUILD_PARAMS} ${BUILD_TARGETS} || \ |
| 278 | die Unable to make ${BUILD_FIXES} ${BUILD_PARAMS} ${BUILD_TARGETS:-clean module}. |
284 | die Unable to make ${BUILD_FIXES} ${BUILD_PARAMS} ${BUILD_TARGETS}. |
|
|
285 | touch ${sourcedir}/.built |
|
|
286 | cd ${OLDPWD} |
|
|
287 | fi |
| 279 | done |
288 | done |
| 280 | ARCH="${xarch}" |
289 | ARCH="${xarch}" |
| 281 | } |
290 | } |
| 282 | |
291 | |
| 283 | linux-mod_src_install() { |
292 | linux-mod_src_install() { |
| … | |
… | |
| 297 | |
306 | |
| 298 | einfo "Installing ${modulename} module" |
307 | einfo "Installing ${modulename} module" |
| 299 | cd ${sourcedir} |
308 | cd ${sourcedir} |
| 300 | insinto /lib/modules/${KV_FULL}/${moduledir} |
309 | insinto /lib/modules/${KV_FULL}/${moduledir} |
| 301 | doins ${modulename}.${KV_OBJ} |
310 | doins ${modulename}.${KV_OBJ} |
|
|
311 | cd ${OLDPWD} |
| 302 | |
312 | |
| 303 | [ -z "${NO_MODULESD}" ] && generate_modulesd ${sourcedir}/${modulename} |
313 | [ -z "${NO_MODULESD}" ] && generate_modulesd ${sourcedir}/${modulename} |
| 304 | done |
314 | done |
| 305 | } |
315 | } |
| 306 | |
316 | |