1################################################################################
2#
3# pcm-tools
4#
5################################################################################
6
7# Don't use the github helper, as pcm-tools uses git attributes that are
8# replaced when gnerating the archive.
9# 93fc9193a70e2f1f054be554c48f4a4791be5032 is the hash of the 202110 tag.
10PCM_TOOLS_VERSION = 93fc9193a70e2f1f054be554c48f4a4791be5032
11PCM_TOOLS_SITE = https://github.com/opcm/pcm
12PCM_TOOLS_SITE_METHOD = git
13PCM_TOOLS_LICENSE = BSD-3-Clause
14PCM_TOOLS_LICENSE_FILES = LICENSE
15
16PCM_TOOLS_EXE_FILES = \
17	pcm-core pcm-iio pcm-lspci pcm-memory pcm-msr pcm-numa \
18	pcm-pcicfg pcm-pcie pcm-power pcm-sensor pcm-tsx pcm
19
20define PCM_TOOLS_BUILD_CMDS
21	touch $(@D)/daemon-binaries
22	$(TARGET_MAKE_ENV) $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D) \
23		CXXFLAGS="$(TARGET_CXXFLAGS) -std=c++11 -fPIC" \
24		UNAME=Linux HOST=_LINUX \
25		$(foreach f,$(PCM_TOOLS_EXE_FILES),$(f).x)
26endef
27
28ifeq ($(BR2_PACKAGE_PCM_TOOLS_PMU_QUERY),y)
29define PCM_TOOLS_INSTALL_PMU_QUERY
30	$(INSTALL) -D -m 755 $(@D)/pmu-query.py $(TARGET_DIR)/usr/bin/pmu-query
31endef
32endif
33
34define PCM_TOOLS_INSTALL_TARGET_CMDS
35	$(foreach f,$(PCM_TOOLS_EXE_FILES),\
36		$(INSTALL) -D -m 755 $(@D)/$(f).x $(TARGET_DIR)/usr/bin/$(f)
37	)
38	$(PCM_TOOLS_INSTALL_PMU_QUERY)
39endef
40
41define PCM_TOOLS_LINUX_CONFIG_FIXUPS
42	$(call KCONFIG_ENABLE_OPT,CONFIG_X86_MSR)
43endef
44
45$(eval $(generic-package))
46