]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/addons/devshell.bb
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / addons / devshell.bb
1 DESCRIPTION = "Runs a shell in an environment as emitted by BitBake to execute tasks"
2 LICENSE = "GPL"
3 MAINTAINER = "Rene Wagner <rw@handhelds.org>"
4 PR = "r1"
5
6 inherit autotools pkgconfig
7
8 do_configure() {
9         :
10 }
11
12 def devshell_emit_env(o, d, all=False, funcwhitelist=None):
13     """Emits all items in the data store in a format such that it can be sourced by a shell."""
14
15     import bb
16     import bb.data
17
18     env = bb.data.keys(d)
19
20     for e in env:
21         if bb.data.getVarFlag(e, "func", d):
22             continue
23         bb.data.emit_var(e, o, d, all) and o.write('\n')
24
25     for e in env:
26         if not bb.data.getVarFlag(e, "func", d):
27             continue
28         if not funcwhitelist:
29             bb.data.emit_var(e, o, d) and o.write('\n')
30             continue
31         for i in funcwhitelist:
32             if e.startswith(i):
33                 bb.data.emit_var(e, o, d) and o.write('\n')
34                 break
35
36 python do_compile() {
37         import os
38         import os.path
39
40         workdir = bb.data.getVar('WORKDIR', d, 1)
41         shellfile = os.path.join(workdir, bb.data.expand("${TARGET_PREFIX}${DISTRO}-${MACHINE}-devshell", d))
42         
43         f = open(shellfile, "w")
44
45         # emit variables and shell functions
46         devshell_emit_env(f, d, False, ["die", "oe", "autotools_do_configure"])
47
48         f.close()
49 }
50
51 do_install() {
52         :
53 }
54
55 do_stage() {
56         :
57 }
58
59 do_package() {
60         shellfile="${TARGET_PREFIX}${DISTRO}-${MACHINE}-devshell"
61
62         cd ${WORKDIR}
63
64         cp $shellfile tmpfile
65         echo "#!/bin/bash --rcfile" > $shellfile
66         sed -e "s:${S}:.:g" -e "s:exit 1:true:" tmpfile >> $shellfile
67         
68         echo "export PS1='[OE::${TARGET_PREFIX}${DISTRO}-${MACHINE}]:\w\$ '" >> $shellfile
69         echo "alias ./configure=oe_runconf" >> $shellfile
70         echo "alias make=oe_runmake" >> $shellfile
71
72         mkdir -p ${DEPLOY_DIR}/addons
73         install -m 755 $shellfile ${DEPLOY_DIR}/addons
74 }