diff options
| -rw-r--r-- | meta/classes/externalsrc.bbclass | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass index 6ec46a6b15..bdf23ec6be 100644 --- a/meta/classes/externalsrc.bbclass +++ b/meta/classes/externalsrc.bbclass | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | # Copyright (C) 2009 Chris Larson <clarson@kergoth.com> | 4 | # Copyright (C) 2009 Chris Larson <clarson@kergoth.com> |
| 5 | # Released under the MIT license (see COPYING.MIT for the terms) | 5 | # Released under the MIT license (see COPYING.MIT for the terms) |
| 6 | # | 6 | # |
| 7 | # externalsrc.bbclass enables use of an existing source tree, usually external to | 7 | # externalsrc.bbclass enables use of an existing source tree, usually external to |
| 8 | # the build system to build a piece of software rather than the usual fetch/unpack/patch | 8 | # the build system to build a piece of software rather than the usual fetch/unpack/patch |
| 9 | # process. | 9 | # process. |
| 10 | # | 10 | # |
| @@ -108,6 +108,10 @@ python () { | |||
| 108 | # We don't want the workdir to go away | 108 | # We don't want the workdir to go away |
| 109 | d.appendVar('RM_WORK_EXCLUDE', ' ' + d.getVar('PN')) | 109 | d.appendVar('RM_WORK_EXCLUDE', ' ' + d.getVar('PN')) |
| 110 | 110 | ||
| 111 | bb.build.addtask('do_buildclean', | ||
| 112 | 'do_clean' if d.getVar('S') == d.getVar('B') else None, | ||
| 113 | None, d) | ||
| 114 | |||
| 111 | # If B=S the same builddir is used even for different architectures. | 115 | # If B=S the same builddir is used even for different architectures. |
| 112 | # Thus, use a shared CONFIGURESTAMPFILE and STAMP directory so that | 116 | # Thus, use a shared CONFIGURESTAMPFILE and STAMP directory so that |
| 113 | # change of do_configure task hash is correctly detected and stamps are | 117 | # change of do_configure task hash is correctly detected and stamps are |
| @@ -143,6 +147,17 @@ python externalsrc_compile_prefunc() { | |||
| 143 | bb.plain('NOTE: %s: compiling from external source tree %s' % (d.getVar('PN'), d.getVar('EXTERNALSRC'))) | 147 | bb.plain('NOTE: %s: compiling from external source tree %s' % (d.getVar('PN'), d.getVar('EXTERNALSRC'))) |
| 144 | } | 148 | } |
| 145 | 149 | ||
| 150 | do_buildclean[dirs] = "${S} ${B}" | ||
| 151 | do_buildclean[nostamp] = "1" | ||
| 152 | do_buildclean[doc] = "Call 'make clean' or equivalent in ${B}" | ||
| 153 | externalsrc_do_buildclean() { | ||
| 154 | if [ -e Makefile -o -e makefile -o -e GNUmakefile ]; then | ||
| 155 | oe_runmake clean || die "make failed" | ||
| 156 | else | ||
| 157 | bbnote "nothing to do - no makefile found" | ||
| 158 | fi | ||
| 159 | } | ||
| 160 | |||
| 146 | def srctree_hash_files(d, srcdir=None): | 161 | def srctree_hash_files(d, srcdir=None): |
| 147 | import shutil | 162 | import shutil |
| 148 | import subprocess | 163 | import subprocess |
| @@ -189,3 +204,5 @@ def srctree_configure_hash_files(d): | |||
| 189 | if f in search_files: | 204 | if f in search_files: |
| 190 | out_items.append('%s:True' % os.path.join(root, f)) | 205 | out_items.append('%s:True' % os.path.join(root, f)) |
| 191 | return ' '.join(out_items) | 206 | return ' '.join(out_items) |
| 207 | |||
| 208 | EXPORT_FUNCTIONS do_buildclean | ||
