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.bbclass74
1 files changed, 74 insertions, 0 deletions
diff --git a/meta/classes/cml1.bbclass b/meta/classes/cml1.bbclass
new file mode 100644
index 0000000000..43acfd531b
--- /dev/null
+++ b/meta/classes/cml1.bbclass
@@ -0,0 +1,74 @@
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 TERMINFO CROSS_CURSES_LIB CROSS_CURSES_INC"
13HOST_EXTRACFLAGS = "${BUILD_CFLAGS} ${BUILD_LDFLAGS}"
14HOSTLDFLAGS = "${BUILD_LDFLAGS}"
15CROSS_CURSES_LIB = "-lncurses -ltinfo"
16CROSS_CURSES_INC = '-DCURSES_LOC="<curses.h>"'
17TERMINFO = "${STAGING_DATADIR_NATIVE}/terminfo"
18
19python do_menuconfig() {
20 import shutil
21
22 try:
23 mtime = os.path.getmtime(".config")
24 shutil.copy(".config", ".config.orig")
25 except OSError:
26 mtime = 0
27
28 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)
29
30 # FIXME this check can be removed when the minimum bitbake version has been bumped
31 if hasattr(bb.build, 'write_taint'):
32 try:
33 newmtime = os.path.getmtime(".config")
34 except OSError:
35 newmtime = 0
36
37 if newmtime > mtime:
38 bb.note("Configuration changed, recompile will be forced")
39 bb.build.write_taint('do_compile', d)
40}
41do_menuconfig[depends] += "ncurses-native:do_populate_sysroot"
42do_menuconfig[nostamp] = "1"
43addtask menuconfig after do_configure
44
45python do_diffconfig() {
46 import shutil
47 import subprocess
48
49 workdir = d.getVar('WORKDIR', True)
50 fragment = workdir + '/fragment.cfg'
51 configorig = '.config.orig'
52 config = '.config'
53
54 try:
55 md5newconfig = bb.utils.md5_file(configorig)
56 md5config = bb.utils.md5_file(config)
57 isdiff = md5newconfig != md5config
58 except IOError as e:
59 bb.fatal("No config files found. Did you do menuconfig ?\n%s" % e)
60
61 if isdiff:
62 statement = 'diff --unchanged-line-format= --old-line-format= --new-line-format="%L" ' + configorig + ' ' + config + '>' + fragment
63 subprocess.call(statement, shell=True)
64
65 shutil.copy(configorig, config)
66
67 bb.plain("Config fragment has been dumped into:\n %s" % fragment)
68 else:
69 if os.path.exists(fragment):
70 os.unlink(fragment)
71}
72
73do_diffconfig[nostamp] = "1"
74addtask diffconfig