title: How to install directory structure recursively in OpenEmbedded BitBake recipe?
body: <p>I'd like to simplify a BitBake recipe that installs a large directory structure by using some sort of recursive install routine rather than calling install many times. The source directory layout is frequently changing during development, which is causing far more recipe revisions than I want to deal with.</p>
  
  <p>As an example, how would the following do_install() be simplified from this:</p>
  
  <pre><code>do_install() {
      install -d ${D}/foo
      install -m 0644 ${S}/foo/*.* ${D}/foo
  
      install -d ${D}/foo/a
      install -m 0644 ${S}/foo/a/*.* ${D}/foo/a
  
      install -d ${D}/foo/b
      install -m 0644 ${S}/foo/b/*.* ${D}/foo/b
  
      install -d ${D}/foo/c
      install -m 0644 ${S}/foo/c/*.* ${D}/foo/c
  
      install -d ${D}/bar
      install -m 0644 ${S}/bar/*.* ${D}/bar
  
      install -d ${D}/bar/a
      install -m 0644 ${S}/bar/a/*.* ${D}/bar/a
  
      install -d ${D}/bar/a/bananas
      install -m 0644 ${S}/bar/a/bananas/*.* ${D}/bar/a/bananas
  }
  </code></pre>
  
  <p>To something more like this pseudocode:</p>
  
  <pre><code>do_install() {
      for each subdir in ${S}/foo/
          install subdir recursively to ${D}/foo/subdir
      end
  
      for each subdir in ${S}/bar/
          install subdir recursively to ${D}/bar/subdir
      end
  }
  </code></pre>
  
  <p>The top-level directories in our source files (foo &amp; bar in the above example) rarely change, so calling them out in the recipe is fine. It's the lower level directories that are frequently changing.</p>
  
  <p>It may be that cp -r ends up being the way to go, but I believe I've read that it's frowned upon in BitBake recipes, so I'm wondering if BitBake provides some alternate mechanism, or if there's
  some other reasonably standardized way to do this.</p>