summaryrefslogtreecommitdiffstats
path: root/meta/classes/cml1.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/cml1.bbclass')
-rw-r--r--meta/classes/cml1.bbclass73
1 files changed, 73 insertions, 0 deletions
diff --git a/meta/classes/cml1.bbclass b/meta/classes/cml1.bbclass
new file mode 100644
index 0000000..34c0c4e
--- /dev/null
+++ b/meta/classes/cml1.bbclass
@@ -0,0 +1,73 @@
1cml1_do_configure() {
2 set -e
3 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
4 oe_runmake oldconfig
5}
6
7EXPORT_FUNCTIONS do_configure
8addtask configure after do_unpack do_patch before do_compile
9
10inherit terminal
11
12OE_TERMINAL_EXPORTS += "HOST_EXTRACFLAGS HOSTLDFLAGS HOST_LOADLIBES TERMINFO"
13HOST_EXTRACFLAGS = "${BUILD_CFLAGS} ${BUILD_LDFLAGS}"
14HOSTLDFLAGS = "${BUILD_LDFLAGS}"
15HOST_LOADLIBES = "-lncurses"
16TERMINFO = "${STAGING_DATADIR_NATIVE}/terminfo"
17
18python do_menuconfig() {
19 import shutil
20
21 try:
22 mtime = os.path.getmtime(".config")
23 shutil.copy(".config", ".config.orig")
24 except OSError:
25 mtime = 0
26
27 oe_terminal("${SHELL} -c \"make menuconfig; if [ \$? -ne 0 ]; then echo 'Command failed.'; printf 'Press any key to continue... '; read r; fi\"", '${PN} Configuration', d)
28
29 # FIXME this check can be removed when the minimum bitbake version has been bumped
30 if hasattr(bb.build, 'write_taint'):
31 try:
32 newmtime = os.path.getmtime(".config")
33 except OSError:
34 newmtime = 0
35
36 if newmtime > mtime:
37 bb.note("Configuration changed, recompile will be forced")
38 bb.build.write_taint('do_compile', d)
39}
40do_menuconfig[depends] += "ncurses-native:do_populate_sysroot"
41do_menuconfig[nostamp] = "1"
42addtask menuconfig after do_configure
43
44python do_diffconfig() {
45 import shutil
46 import subprocess
47
48 workdir = d.getVar('WORKDIR', True)
49 fragment = workdir + '/fragment.cfg'
50 configorig = '.config.orig'
51 config = '.config'
52
53 try:
54 md5newconfig = bb.utils.md5_file(configorig)
55 md5config = bb.utils.md5_file(config)
56 isdiff = md5newconfig != md5config
57 except IOError as e:
58 bb.fatal("No config files found. Did you do menuconfig ?\n%s" % e)
59
60 if isdiff:
61 statement = 'diff -Nurp ' + configorig + ' ' + config + '| sed -n "s/^\+//p" >' + fragment
62 subprocess.call(statement, shell=True)
63
64 shutil.copy(configorig, config)
65
66 bb.plain("Config fragment has been dumped into:\n %s" % fragment)
67 else:
68 if os.path.exists(fragment):
69 os.unlink(fragment)
70}
71
72do_diffconfig[nostamp] = "1"
73addtask diffconfig