How are host tools different from other build dependencies?

I notice that some packages are "host tools", and have a different set of stanzas to regular packages eg. automake has:

define Host/Configure

define Host/Install

Unfortuantely the wiki only has this to say:

TODO Expand on how to use this, and include examples

...and shortly after there's a broken link to a mailing list post.

What's the difference between these and regular tool, toolchain or build system packages? If I'm packaging, say, Premake (a tool that generates Makefiles, like CMake), should I create these stanzas for it?

The Host sections in some packages define what files are copied/build for the host only.
Those are only needed during build/compile time for cross-compilation, so stuff like helper bins or libs. So mainly libs often have this section, so the static .a lib file and pkgconfig will be copied.

That clarifies it a lot, thanks! I'll see if I can write something for the wiki on this.

Does that mean that things build as part of a Host/Compile section will be built for the host's architecture (eg. amd64) and not the target (eg. mipsel)?

Yes, here is a example how this all works, lets look at the samba4 makefile:

HOST_BUILD_DEPENDS:=python3/host rpcsvc-proto/host perl/host perl-parse-yapp/host
PKG_BUILD_DEPENDS:=samba4/host libtasn1/host

All those host depends are needed to build samba4, so instead of relying on the host package manager or whatever is installed. We assume nothing is installed and build all depends our-self, we than make sure the package picks-up our versions via path search manipulations.

So all those packages also need its own host sections, so they are available to run on the host system. In samba's complicated case it depends itself on its own host pass, where it builds some host utils as well, before it can run the final cross-compile pass.

So here the host pass just builds/installs asn1_compile,compile_et for the later pass.

define Host/Compile
	(cd $(HOST_BUILD_DIR); \
		./buildtools/bin/waf build \
		--targets=asn1_compile,compile_et \

define Host/Install
	# add host tools suffix, prevent conflicts with krb5
	$(INSTALL_BIN) $(HOST_BUILD_DIR)/bin/asn1_compile $(STAGING_DIR_HOSTPKG)/bin/asn1_compile_samba
	$(INSTALL_BIN) $(HOST_BUILD_DIR)/bin/compile_et $(STAGING_DIR_HOSTPKG)/bin/compile_et_samba
1 Like

This is extremely useful, thanks for the detail. I was struggling to find an example that wasn't mostly part of the toolchain itself. It's related to my other question When do build tools (that are dependencies) need to be packaged?

I've used the details in this and the other topic to update the wiki, see Creating packages > Host tools required. If you have the time @Andy2244, I'd appreciate a second pair of eyes to check that I haven't gotten the details wrong. Thanks again!

Looks fine, gj.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.