Bundle the host binaries and libs into a tar file

Bug: 69049778
Test: make dist generates the tar file and it contains the host
binaries and libs.

Change-Id: I8f94df41710dfa98ad811bb17d137af3945a134e
diff --git a/host_package.mk b/host_package.mk
new file mode 100644
index 0000000..d3128af
--- /dev/null
+++ b/host_package.mk
@@ -0,0 +1,48 @@
+LOCAL_PATH := $(call my-dir)
+
+cvd_host_package_tar := $(HOST_OUT)/cvd-host_package.tar.gz
+
+ifeq ($(HOST_OS),linux)
+CVD_TAR_FORMAT := --format=gnu
+endif
+
+# Build and store them on the build server.
+$(call dist-for-goals, dist_files, $(cvd_host_package_tar))
+
+bin_path := $(notdir $(HOST_OUT_EXECUTABLES))
+lib_path := $(notdir $(HOST_OUT_SHARED_LIBRARIES))
+tests_path := $(notdir $(HOST_OUT_NATIVE_TESTS))
+
+cvd_host_executables := \
+    launch_cuttlefish \
+
+cvd_host_tests := \
+    auto_free_buffer_test \
+    circqueue_test \
+    cuttlefish_thread_test \
+    hald_client_test \
+    lock_test \
+    monotonic_time_test \
+    vsoc_graphics_test \
+
+cvd_host_shared_libraries := \
+    libc++ \
+    libicuuc-host \
+
+cvd_host_configs := \
+    vsoc_mem.json
+
+cvd_host_packages := \
+    vsoc_mem_json \
+    $(cvd_host_executables) \
+    $(cvd_host_tests) \
+
+cvd_host_package_files := \
+     $(addprefix config/,$(cvd_host_configs)) \
+     $(addprefix $(bin_path)/,$(cvd_host_executables)) \
+     $(addprefix $(lib_path)/,$(addsuffix .so,$(cvd_host_shared_libraries))) \
+     $(foreach test,$(cvd_host_tests), ${tests_path}/$(test)/$(test)) \
+
+$(cvd_host_package_tar): $(cvd_host_packages)
+	$(hide) rm -rf $@ && tar Scfz $@.tmp -C $(HOST_OUT) $(CVD_TAR_FORMAT) $(cvd_host_package_files)
+	$(hide) mv $@.tmp $@