blob: 5834806269133e7e1f8a6889ccb20ea023386791 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001cml1_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
19KCONFIG_CONFIG_COMMAND ??= "menuconfig"
20python do_menuconfig() {
21 import shutil
22
23 try:
24 mtime = os.path.getmtime(".config")
25 shutil.copy(".config", ".config.orig")
26 except OSError:
27 mtime = 0
28
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050029 oe_terminal("${SHELL} -c \"make %s; if [ \$? -ne 0 ]; then echo 'Command failed.'; printf 'Press any key to continue... '; read r; fi\"" % d.getVar('KCONFIG_CONFIG_COMMAND', True),
30 d.getVar('PN', True ) + ' Configuration', d)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050031
32 # FIXME this check can be removed when the minimum bitbake version has been bumped
33 if hasattr(bb.build, 'write_taint'):
34 try:
35 newmtime = os.path.getmtime(".config")
36 except OSError:
37 newmtime = 0
38
39 if newmtime > mtime:
40 bb.note("Configuration changed, recompile will be forced")
41 bb.build.write_taint('do_compile', d)
42}
43do_menuconfig[depends] += "ncurses-native:do_populate_sysroot"
44do_menuconfig[nostamp] = "1"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060045do_menuconfig[dirs] = "${B}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050046addtask menuconfig after do_configure
47
48python do_diffconfig() {
49 import shutil
50 import subprocess
51
52 workdir = d.getVar('WORKDIR', True)
53 fragment = workdir + '/fragment.cfg'
54 configorig = '.config.orig'
55 config = '.config'
56
57 try:
58 md5newconfig = bb.utils.md5_file(configorig)
59 md5config = bb.utils.md5_file(config)
60 isdiff = md5newconfig != md5config
61 except IOError as e:
62 bb.fatal("No config files found. Did you do menuconfig ?\n%s" % e)
63
64 if isdiff:
65 statement = 'diff --unchanged-line-format= --old-line-format= --new-line-format="%L" ' + configorig + ' ' + config + '>' + fragment
66 subprocess.call(statement, shell=True)
67
68 shutil.copy(configorig, config)
69
70 bb.plain("Config fragment has been dumped into:\n %s" % fragment)
71 else:
72 if os.path.exists(fragment):
73 os.unlink(fragment)
74}
75
76do_diffconfig[nostamp] = "1"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060077do_diffconfig[dirs] = "${B}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050078addtask diffconfig