tools-$(CONFIG_USES_MINOR) += kernel2minor
tools-$(CONFIG_USE_SPARSE) += sparse
tools-$(CONFIG_USE_LLVM_BUILD) += llvm-bpf
+tools-$(CONFIG_DWARVES) += dwarves
# builddir dependencies
$(curdir)/autoconf/compile := $(curdir)/m4/compile
--- /dev/null
+# SPDX-License-Identifier: GPL-2.0-only
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=dwarves
+
+PKG_SOURCE_VERSION:=v1.21
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://git.kernel.org/pub/scm/devel/pahole/pahole.git
+PKG_MIRROR_HASH:=da617b5a6ef93e0a1dabd7e4b21212644a3797df2fa11c98e64533ce1358c042
+PKG_LICENSE:=GPL-2.0-only
+PKG_LICENSE_FILES:=COPYING
+
+HOST_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/host-build.mk
+include $(INCLUDE_DIR)/cmake.mk
+
+CMAKE_HOST_OPTIONS += \
+ -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH \
+ -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH \
+ -DCMAKE_BUILD_TYPE=Release \
+ -D__LIB=lib \
+ -DCMAKE_INSTALL_RPATH="$(STAGING_DIR_HOST)/lib" \
+ -DCMAKE_SKIP_RPATH=FALSE
+
+define Host/Clean
+ rm -f $(STAGING_DIR_HOST)/bin/{codiff,ctracer,dtagnames,pahole,pdwtags}
+ rm -f $(STAGING_DIR_HOST)/bin/{pfunct,pglobal,prefcnt,scncopy,syscse}
+ rm -f $(STAGING_DIR_HOST)/bin/{ostra-cg,btfdiff,fullcircle}
+ rm -f $(STAGING_DIR_HOST)/lib/libdwarves*.so*
+ rm -f $(STAGING_DIR_HOST)/share/man/man1/pahole.1
+ rm -rf $(STAGING_DIR_HOST)/include/dwarves
+ rm -rf $(STAGING_DIR_HOST)/share/dwarves
+ $(call Host/Clean/Default)
+endef
+
+$(eval $(call HostBuild))