Andrew Geissler | b7d2861 | 2020-07-24 16:15:54 -0500 | [diff] [blame] | 1 | # returns all the elements from the src uri that are .cfg files |
| 2 | def 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 Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 11 | cml1_do_configure() { |
| 12 | set -e |
| 13 | unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 14 | yes '' | oe_runmake oldconfig |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 15 | } |
| 16 | |
| 17 | EXPORT_FUNCTIONS do_configure |
| 18 | addtask configure after do_unpack do_patch before do_compile |
| 19 | |
| 20 | inherit terminal |
| 21 | |
| 22 | OE_TERMINAL_EXPORTS += "HOST_EXTRACFLAGS HOSTLDFLAGS TERMINFO CROSS_CURSES_LIB CROSS_CURSES_INC" |
| 23 | HOST_EXTRACFLAGS = "${BUILD_CFLAGS} ${BUILD_LDFLAGS}" |
| 24 | HOSTLDFLAGS = "${BUILD_LDFLAGS}" |
| 25 | CROSS_CURSES_LIB = "-lncurses -ltinfo" |
| 26 | CROSS_CURSES_INC = '-DCURSES_LOC="<curses.h>"' |
| 27 | TERMINFO = "${STAGING_DATADIR_NATIVE}/terminfo" |
| 28 | |
| 29 | KCONFIG_CONFIG_COMMAND ??= "menuconfig" |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame^] | 30 | KCONFIG_CONFIG_ROOTDIR ??= "${B}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 31 | python do_menuconfig() { |
| 32 | import shutil |
| 33 | |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame^] | 34 | config = os.path.join(d.getVar('KCONFIG_CONFIG_ROOTDIR'), ".config") |
| 35 | configorig = os.path.join(d.getVar('KCONFIG_CONFIG_ROOTDIR'), ".config.orig") |
| 36 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 37 | try: |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame^] | 38 | mtime = os.path.getmtime(config) |
| 39 | shutil.copy(config, configorig) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 40 | except OSError: |
| 41 | mtime = 0 |
| 42 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 43 | 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 Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 44 | d.getVar('PN') + ' Configuration', d) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 45 | |
| 46 | # FIXME this check can be removed when the minimum bitbake version has been bumped |
| 47 | if hasattr(bb.build, 'write_taint'): |
| 48 | try: |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame^] | 49 | newmtime = os.path.getmtime(config) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 50 | except OSError: |
| 51 | newmtime = 0 |
| 52 | |
| 53 | if newmtime > mtime: |
| 54 | bb.note("Configuration changed, recompile will be forced") |
| 55 | bb.build.write_taint('do_compile', d) |
| 56 | } |
| 57 | do_menuconfig[depends] += "ncurses-native:do_populate_sysroot" |
| 58 | do_menuconfig[nostamp] = "1" |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame^] | 59 | do_menuconfig[dirs] = "${KCONFIG_CONFIG_ROOTDIR}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 60 | addtask menuconfig after do_configure |
| 61 | |
| 62 | python do_diffconfig() { |
| 63 | import shutil |
| 64 | import subprocess |
| 65 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 66 | workdir = d.getVar('WORKDIR') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 67 | fragment = workdir + '/fragment.cfg' |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame^] | 68 | configorig = os.path.join(d.getVar('KCONFIG_CONFIG_ROOTDIR'), ".config.orig") |
| 69 | config = os.path.join(d.getVar('KCONFIG_CONFIG_ROOTDIR'), ".config") |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 70 | |
| 71 | try: |
| 72 | md5newconfig = bb.utils.md5_file(configorig) |
| 73 | md5config = bb.utils.md5_file(config) |
| 74 | isdiff = md5newconfig != md5config |
| 75 | except IOError as e: |
| 76 | bb.fatal("No config files found. Did you do menuconfig ?\n%s" % e) |
| 77 | |
| 78 | if isdiff: |
| 79 | statement = 'diff --unchanged-line-format= --old-line-format= --new-line-format="%L" ' + configorig + ' ' + config + '>' + fragment |
| 80 | subprocess.call(statement, shell=True) |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 81 | # No need to check the exit code as we know it's going to be |
| 82 | # non-zero, but that's what we expect. |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 83 | shutil.copy(configorig, config) |
| 84 | |
| 85 | bb.plain("Config fragment has been dumped into:\n %s" % fragment) |
| 86 | else: |
| 87 | if os.path.exists(fragment): |
| 88 | os.unlink(fragment) |
| 89 | } |
| 90 | |
| 91 | do_diffconfig[nostamp] = "1" |
Andrew Geissler | 635e0e4 | 2020-08-21 15:58:33 -0500 | [diff] [blame^] | 92 | do_diffconfig[dirs] = "${KCONFIG_CONFIG_ROOTDIR}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 93 | addtask diffconfig |