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