title: How to create OpenWrt host packages?
body: <p>I've to build my software with OpenWrt to be deployed on a customer's target device. For this to succeed, I need a special tool on the host system. Can anyone give me a few tips and hints on how to write a package which builds a tool for the host rather than for the target?</p>
  
  <p>After searching the Internet for OpenWrt host tools and host packages for the past few hours, the best I've come up with is the following package Makefile for my tool. But these commands do not get invoked by OpenWrt.</p>
  
  <p>What am I missing? Or am I on the wrong track overall?</p>
  
  <pre><code>include $(TOPDIR)/rules.mk
  
  PKG_NAME := project-traits
  PKG_VERSION := 6.0.0
  
  PKG_SOURCE_URL := &lt;internal git repository&gt;
  
  HOST_BUILD_PARALLEL := 1
  HOST_CONFIGURE_PARALLEL := 1
  HOST_BUILD_DIR := $(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION)
  
  include $(INCLUDE_DIR)/host-build.mk
  include $(INCLUDE_DIR)/cmake.mk
  
  MAKE_PATH := llvm-build
  
  CMAKE_OPTIONS += -B$(HOST_BUILD_DIR)/$(MAKE_PATH) -H$(HOST_BUILD_DIR)/llvm &amp;&amp; echo
  
  define Host/Prepare
      echo 'This is the generator build!'
      # stripped: fetch the LLVM source code
      # stripped: fetch the traits generator source code
  endef
  
  # Use Host/Compile from cmake.mk
  
  define Host/Install
      # stripped: install the build generator into the staging dir
  endef
  
  $(eval $(call HostBuild))
  </code></pre>
  
  <p>And in the requiring target package, I've included</p>
  
  <pre><code>PKG_BUILD_DEPENDS += project-traits/host
  </code></pre>
  
  <p>For confidentiality and for the sake of keeping the pasted code reduced to the essentials, I blanked out a few things or left them out. But you
  should get the intention. I don't see any of the build's output on the command line or in the build log. OpenWrt seems to just ignore my generator tool and hence fails to build the target package.</p>
  
  <p>In case it makes any differences: I'm not building on direct OpenWrt source files. Instead I get a pre-built OpenWrt SDK from the customer. But I haven't been able to figure out what the difference is, besides a pre-populated device configuration file.</p>
  
  <p>Any help on this "lightly" documented topic is appreciated.</p>