summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/externalsrc.bbclass20
1 files changed, 20 insertions, 0 deletions
diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass
index 9d7ab00e9e..b608bd04e8 100644
--- a/meta/classes/externalsrc.bbclass
+++ b/meta/classes/externalsrc.bbclass
@@ -25,6 +25,7 @@
25# 25#
26 26
27SRCTREECOVEREDTASKS ?= "do_patch do_unpack do_fetch" 27SRCTREECOVEREDTASKS ?= "do_patch do_unpack do_fetch"
28EXTERNALSRC_SYMLINKS ?= "oe-workdir:${WORKDIR} oe-logs:${T}"
28 29
29python () { 30python () {
30 externalsrc = d.getVar('EXTERNALSRC', True) 31 externalsrc = d.getVar('EXTERNALSRC', True)
@@ -82,6 +83,7 @@ python () {
82 bb.build.deltask(task, d) 83 bb.build.deltask(task, d)
83 84
84 d.prependVarFlag('do_compile', 'prefuncs', "externalsrc_compile_prefunc ") 85 d.prependVarFlag('do_compile', 'prefuncs', "externalsrc_compile_prefunc ")
86 d.prependVarFlag('do_configure', 'prefuncs', "externalsrc_configure_prefunc ")
85 87
86 # Ensure compilation happens every time 88 # Ensure compilation happens every time
87 d.setVarFlag('do_compile', 'nostamp', '1') 89 d.setVarFlag('do_compile', 'nostamp', '1')
@@ -101,6 +103,24 @@ python () {
101 d.setVarFlag('do_configure', 'file-checksums', configstamp + ':True') 103 d.setVarFlag('do_configure', 'file-checksums', configstamp + ':True')
102} 104}
103 105
106python externalsrc_configure_prefunc() {
107 # Create desired symlinks
108 symlinks = (d.getVar('EXTERNALSRC_SYMLINKS', True) or '').split()
109 for symlink in symlinks:
110 symsplit = symlink.split(':', 1)
111 lnkfile = os.path.join(d.getVar('S', True), symsplit[0])
112 target = d.expand(symsplit[1])
113 if len(symsplit) > 1:
114 if os.path.islink(lnkfile):
115 # Link already exists, leave it if it points to the right location already
116 if os.readlink(lnkfile) == target:
117 continue
118 elif os.path.exists(lnkfile):
119 # File/dir exists with same name as link, just leave it alone
120 continue
121 os.symlink(target, lnkfile)
122}
123
104python externalsrc_compile_prefunc() { 124python externalsrc_compile_prefunc() {
105 # Make it obvious that this is happening, since forgetting about it could lead to much confusion 125 # Make it obvious that this is happening, since forgetting about it could lead to much confusion
106 bb.plain('NOTE: %s: compiling from external source tree %s' % (d.getVar('PN', True), d.getVar('EXTERNALSRC', True))) 126 bb.plain('NOTE: %s: compiling from external source tree %s' % (d.getVar('PN', True), d.getVar('EXTERNALSRC', True)))