Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 1 | cml1_do_configure() { |
| 2 | set -e |
| 3 | unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 4 | yes '' | oe_runmake oldconfig |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 5 | } |
| 6 | |
| 7 | EXPORT_FUNCTIONS do_configure |
| 8 | addtask configure after do_unpack do_patch before do_compile |
| 9 | |
| 10 | inherit terminal |
| 11 | |
| 12 | OE_TERMINAL_EXPORTS += "HOST_EXTRACFLAGS HOSTLDFLAGS TERMINFO CROSS_CURSES_LIB CROSS_CURSES_INC" |
| 13 | HOST_EXTRACFLAGS = "${BUILD_CFLAGS} ${BUILD_LDFLAGS}" |
| 14 | HOSTLDFLAGS = "${BUILD_LDFLAGS}" |
| 15 | CROSS_CURSES_LIB = "-lncurses -ltinfo" |
| 16 | CROSS_CURSES_INC = '-DCURSES_LOC="<curses.h>"' |
| 17 | TERMINFO = "${STAGING_DATADIR_NATIVE}/terminfo" |
| 18 | |
| 19 | KCONFIG_CONFIG_COMMAND ??= "menuconfig" |
| 20 | python 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 | |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 29 | 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] | 30 | d.getVar('PN') + ' Configuration', d) |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 31 | |
| 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 | } |
| 43 | do_menuconfig[depends] += "ncurses-native:do_populate_sysroot" |
| 44 | do_menuconfig[nostamp] = "1" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 45 | do_menuconfig[dirs] = "${B}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 46 | addtask menuconfig after do_configure |
| 47 | |
| 48 | python do_diffconfig() { |
| 49 | import shutil |
| 50 | import subprocess |
| 51 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 52 | workdir = d.getVar('WORKDIR') |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 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) |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 67 | # No need to check the exit code as we know it's going to be |
| 68 | # non-zero, but that's what we expect. |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 69 | shutil.copy(configorig, config) |
| 70 | |
| 71 | bb.plain("Config fragment has been dumped into:\n %s" % fragment) |
| 72 | else: |
| 73 | if os.path.exists(fragment): |
| 74 | os.unlink(fragment) |
| 75 | } |
| 76 | |
| 77 | do_diffconfig[nostamp] = "1" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 78 | do_diffconfig[dirs] = "${B}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 79 | addtask diffconfig |