summaryrefslogtreecommitdiff
path: root/poky/meta/classes/ccmake.bbclass
diff options
context:
space:
mode:
authorBrad Bishop <bradleyb@fuzziesquirrel.com>2019-04-10 16:02:41 +0300
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2019-04-10 16:02:53 +0300
commitd89cb5f03a8d4951590cee276daee6f9a269b6d0 (patch)
tree568437a86c94af2cec172944c585f1b07af0faf0 /poky/meta/classes/ccmake.bbclass
parent6d4bcf0a75b2a6055055c9ad8ed6b93599082385 (diff)
downloadopenbmc-d89cb5f03a8d4951590cee276daee6f9a269b6d0.tar.xz
poky: refresh master: 8217b477a1..4e511f0abc
Update poky to master HEAD. Adrian Bunk (1): bind: upgrade 9.11.5 -> 9.11.5-P4 Alexey Brodkin (1): busybox: Enable domain search list support Andre Rosa (2): lib/oe/utils: Make prune_suffix prune a suffix bitbake: utils: Make prune_suffix prune a suffix Andreas Müller (1): patch/insane: Rework patch fuzz handling Bruce Ashfield (8): poky-tiny: set 5.0 as the preferred kernel linux-yocto-rt/4.19: fix duplicate TIF_NEED_RESCHED_LAZY linux-yocto/5.0: update CGL audit configuration fragment linux-yocto-tiny/4.18: point KBRANCH to 4.18 linux-yocto/4.18: update to v4.18.33 qemumips: Enable the poweroff driver linux-yocto/5.0: tweak qemuarm -tiny configuration linux-yocto/4.18: remove versioned recipes Gianfranco Costamagna (1): kernel-dev, sdk-manual: Unified question spacing Khem Raj (2): libgcc: Create linux-musleabihf and linux-gnueabihf symlinks Revert "mdadm: fix gcc8 maybe-uninitialized/format-overflow warning" Mark Asselstine (2): go.bbclass: Export more GO* environment variables goarch.bbclass: use MACHINEOVERRIDES and simplify go_map_arm() Nathan Rossi (3): cmake-native: Enable ccmake by default and depend on ncurses ccmake.bbclass: Create a cml1 style class for the CMake curses UI devtool: standard: Handle exporting generated config fragments Nikhil Pal Singh (1): cmake: Support Eclipse and other cmake generators Ovidiu Panait (2): xf86-video-vesa: Refuse to run on UEFI machines ghostscript: Fix 3 CVEs Randy MacLeod (1): autoconf: update runtime perl module dependencies Richard Purdie (4): openssh/util-linux/python*: Ensure ptest output is unbuffered ptest-runner: Add several logging fixes oeqa/utils/qemurunner: Fix typo in previous commit linux-yocto: Drop 4.18 kernel Robert Yang (1): sstate.bbclass: Use bb.utils.to_boolean() for BB_NO_NETWORK Ross Burton (2): sanity: clarify error message if TMPDIR moves insane: fix gettext dependency warning Scott Rifenbark (2): ref-manual: Updated BB_GENERATE_MIRROR_TARBALLS overview-manual: Fixed broken link to pseudo. Tomasz Meresiński (1): systemd: fix predictable network interface names in initrd Yeoh Ee Peng (2): resulttool/manualexecution: Enable configuration options selection resulttool/manualexecution: Enable creation of configuration option file Change-Id: I988df9d6bf0dfdeaa517960fb744c7388f791cf6 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'poky/meta/classes/ccmake.bbclass')
-rw-r--r--poky/meta/classes/ccmake.bbclass97
1 files changed, 97 insertions, 0 deletions
diff --git a/poky/meta/classes/ccmake.bbclass b/poky/meta/classes/ccmake.bbclass
new file mode 100644
index 000000000..4114daa61
--- /dev/null
+++ b/poky/meta/classes/ccmake.bbclass
@@ -0,0 +1,97 @@
+inherit terminal
+
+python do_ccmake() {
+ import shutil
+
+ # copy current config for diffing
+ config = os.path.join(d.getVar("B"), "CMakeCache.txt")
+ if os.path.exists(config):
+ shutil.copy(config, config + ".orig")
+
+ oe_terminal(d.expand("ccmake ${OECMAKE_GENERATOR_ARGS} ${OECMAKE_SOURCEPATH} -Wno-dev"),
+ d.getVar("PN") + " - ccmake", d)
+
+ if os.path.exists(config) and os.path.exists(config + ".orig"):
+ if bb.utils.md5_file(config) != bb.utils.md5_file(config + ".orig"):
+ # the cmake class uses cmake --build, which will by default
+ # regenerate configuration, simply mark the compile step as tainted
+ # to ensure it is re-run
+ bb.note("Configuration changed, recompile will be forced")
+ bb.build.write_taint('do_compile', d)
+
+}
+do_ccmake[depends] += "cmake-native:do_populate_sysroot"
+do_ccmake[nostamp] = "1"
+do_ccmake[dirs] = "${B}"
+addtask ccmake after do_configure
+
+def cmake_parse_config_cache(path):
+ with open(path, "r") as f:
+ for i in f:
+ i = i.rstrip("\n")
+ if len(i) == 0 or i.startswith("//") or i.startswith("#"):
+ continue # empty or comment
+ key, value = i.split("=", 1)
+ key, keytype = key.split(":")
+ if keytype in ["INTERNAL", "STATIC"]:
+ continue # skip internal and static config options
+ yield key, keytype, value
+
+def cmake_diff_config_vars(a, b):
+ removed, added = [], []
+
+ for ak, akt, av in a:
+ found = False
+ for bk, bkt, bv in b:
+ if bk == ak:
+ found = True
+ if bkt != akt or bv != av: # changed
+ removed.append((ak, akt, av))
+ added.append((bk, bkt, bv))
+ break
+ # remove any missing from b
+ if not found:
+ removed.append((ak, akt, av))
+
+ # add any missing from a
+ for bk, bkt, bv in b:
+ if not any(bk == ak for ak, akt, av in a):
+ added.append((bk, bkt, bv))
+
+ return removed, added
+
+python do_ccmake_diffconfig() {
+ import shutil
+ config = os.path.join(d.getVar("B"), "CMakeCache.txt")
+ if os.path.exists(config) and os.path.exists(config + ".orig"):
+ if bb.utils.md5_file(config) != bb.utils.md5_file(config + ".orig"):
+ # scan the changed options
+ old = list(cmake_parse_config_cache(config + ".orig"))
+ new = list(cmake_parse_config_cache(config))
+ _, added = cmake_diff_config_vars(old, new)
+
+ if len(added) != 0:
+ with open(d.expand("${WORKDIR}/configuration.inc"), "w") as f:
+ f.write("EXTRA_OECMAKE += \" \\\n")
+ for k, kt, v in added:
+ escaped = v if " " not in v else "\"{0}\"".format(v)
+ f.write(" -D{0}:{1}={2} \\\n".format(k, kt, escaped))
+ f.write(" \"\n")
+ bb.plain("Configuration recipe fragment written to: {0}".format(d.expand("${WORKDIR}/configuration.inc")))
+
+ with open(d.expand("${WORKDIR}/site-file.cmake"), "w") as f:
+ for k, kt, v in added:
+ f.write("SET({0} \"{1}\" CACHE {2} "")\n".format(k, v, kt))
+ bb.plain("Configuration cmake fragment written to: {0}".format(d.expand("${WORKDIR}/site-file.cmake")))
+
+ # restore the original config
+ shutil.copy(config + ".orig", config)
+ else:
+ bb.plain("No configuration differences, skipping configuration fragment generation.")
+ else:
+ bb.fatal("No config files found. Did you run ccmake?")
+}
+do_ccmake_diffconfig[nostamp] = "1"
+do_ccmake_diffconfig[dirs] = "${B}"
+addtask ccmake_diffconfig
+