blob: 8ab240589a23d9a282ee6a176b0dffe8209e5ea3 [file] [log] [blame]
Andrew Geisslerb7d28612020-07-24 16:15:54 -05001# returns all the elements from the src uri that are .cfg files
2def find_cfgs(d):
3 sources=src_patches(d, True)
4 sources_list=[]
5 for s in sources:
6 if s.endswith('.cfg'):
7 sources_list.append(s)
8
9 return sources_list
10
Patrick Williamsc124f4f2015-09-15 14:41:29 -050011cml1_do_configure() {
12 set -e
13 unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
Brad Bishopc342db32019-05-15 21:57:59 -040014 yes '' | oe_runmake oldconfig
Patrick Williamsc124f4f2015-09-15 14:41:29 -050015}
16
17EXPORT_FUNCTIONS do_configure
18addtask configure after do_unpack do_patch before do_compile
19
20inherit terminal
21
22OE_TERMINAL_EXPORTS += "HOST_EXTRACFLAGS HOSTLDFLAGS TERMINFO CROSS_CURSES_LIB CROSS_CURSES_INC"
23HOST_EXTRACFLAGS = "${BUILD_CFLAGS} ${BUILD_LDFLAGS}"
24HOSTLDFLAGS = "${BUILD_LDFLAGS}"
25CROSS_CURSES_LIB = "-lncurses -ltinfo"
26CROSS_CURSES_INC = '-DCURSES_LOC="<curses.h>"'
27TERMINFO = "${STAGING_DATADIR_NATIVE}/terminfo"
28
29KCONFIG_CONFIG_COMMAND ??= "menuconfig"
30python do_menuconfig() {
31 import shutil
32
33 try:
34 mtime = os.path.getmtime(".config")
35 shutil.copy(".config", ".config.orig")
36 except OSError:
37 mtime = 0
38
Brad Bishop19323692019-04-05 15:28:33 -040039 oe_terminal("sh -c \"make %s; if [ \\$? -ne 0 ]; then echo 'Command failed.'; printf 'Press any key to continue... '; read r; fi\"" % d.getVar('KCONFIG_CONFIG_COMMAND'),
Brad Bishop6e60e8b2018-02-01 10:27:11 -050040 d.getVar('PN') + ' Configuration', d)
Patrick Williamsc124f4f2015-09-15 14:41:29 -050041
42 # FIXME this check can be removed when the minimum bitbake version has been bumped
43 if hasattr(bb.build, 'write_taint'):
44 try:
45 newmtime = os.path.getmtime(".config")
46 except OSError:
47 newmtime = 0
48
49 if newmtime > mtime:
50 bb.note("Configuration changed, recompile will be forced")
51 bb.build.write_taint('do_compile', d)
52}
53do_menuconfig[depends] += "ncurses-native:do_populate_sysroot"
54do_menuconfig[nostamp] = "1"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060055do_menuconfig[dirs] = "${B}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050056addtask menuconfig after do_configure
57
58python do_diffconfig() {
59 import shutil
60 import subprocess
61
Brad Bishop6e60e8b2018-02-01 10:27:11 -050062 workdir = d.getVar('WORKDIR')
Patrick Williamsc124f4f2015-09-15 14:41:29 -050063 fragment = workdir + '/fragment.cfg'
64 configorig = '.config.orig'
65 config = '.config'
66
67 try:
68 md5newconfig = bb.utils.md5_file(configorig)
69 md5config = bb.utils.md5_file(config)
70 isdiff = md5newconfig != md5config
71 except IOError as e:
72 bb.fatal("No config files found. Did you do menuconfig ?\n%s" % e)
73
74 if isdiff:
75 statement = 'diff --unchanged-line-format= --old-line-format= --new-line-format="%L" ' + configorig + ' ' + config + '>' + fragment
76 subprocess.call(statement, shell=True)
Brad Bishopd7bf8c12018-02-25 22:55:05 -050077 # No need to check the exit code as we know it's going to be
78 # non-zero, but that's what we expect.
Patrick Williamsc124f4f2015-09-15 14:41:29 -050079 shutil.copy(configorig, config)
80
81 bb.plain("Config fragment has been dumped into:\n %s" % fragment)
82 else:
83 if os.path.exists(fragment):
84 os.unlink(fragment)
85}
86
87do_diffconfig[nostamp] = "1"
Patrick Williamsc0f7c042017-02-23 20:41:17 -060088do_diffconfig[dirs] = "${B}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050089addtask diffconfig