Skip to content

Commit

Permalink
build: update rpm build spec to build libbpf based rpm (#1087)
Browse files Browse the repository at this point in the history
Signed-off-by: Huamin Chen <[email protected]>
  • Loading branch information
rootfs authored Nov 28, 2023
1 parent 1ae5c47 commit 9aa7eaf
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions packaging/rpm/kepler.spec
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,10 @@ URL: https://github.com/sustainable-computing-io/kepler/
Source0: kepler.tar.gz

BuildRequires: systemd
BuildRequires: make
BuildRequires: clang llvm llvm-devel zlib-devel make libbpf golang

Requires: cpuid
Requires: kmod
Requires: xz
Requires: python3
Requires: bcc-devel
Requires: bcc
Requires: elfutils-libelf
Requires: elfutils-libelf-devel

%{?systemd_requires}

Expand All @@ -33,9 +29,10 @@ CROSS_BUILD_BINDIR=_output/bin
GOARCH=amd64
%endif

make _build_local GOOS=${GOOS} GOARCH=${GOARCH} ATTACHER_TAG=libbpf
make genlibbpf _build_local GOOS=${GOOS} GOARCH=${GOARCH} ATTACHER_TAG=libbpf

cp ./${CROSS_BUILD_BINDIR}/${GOOS}_${GOARCH}/kepler ./_output/kepler
echo -n "true" > ./_output/ENABLE_PROCESS_METRICS

%install

Expand All @@ -44,9 +41,13 @@ install -d %{buildroot}%{_bindir}
install -d %{buildroot}%{_sysconfdir}/kepler/

install -d %{buildroot}/var/lib/kepler/data
install -d %{buildroot}/var/lib/kepler/bpfassets
install -d %{buildroot}/etc/kepler/kepler.config

install -p -m755 ./_output/kepler %{buildroot}%{_bindir}/kepler
install -p -m644 ./packaging/rpm/kepler.service %{buildroot}%{_unitdir}/kepler.service
install -p -m644 ./bpfassets/libbpf/bpf.o/amd64_kepler.bpf.o %{buildroot}/var/lib/kepler/bpfassets/amd64_kepler.bpf.o
install -p -m644 ./_output/ENABLE_PROCESS_METRICS %{buildroot}/etc/kepler/kepler.config/ENABLE_PROCESS_METRICS
install -p -m644 ./data/cpus.yaml %{buildroot}/var/lib/kepler/data/cpus.yaml
install -p -m644 ./data/model_weight/acpi_AbsPowerModel.json %{buildroot}/var/lib/kepler/data/acpi_AbsPowerModel.json
install -p -m644 ./data/model_weight/acpi_DynPowerModel.json %{buildroot}/var/lib/kepler/data/acpi_DynPowerModel.json
Expand All @@ -61,11 +62,13 @@ install -p -m644 ./data/model_weight/rapl_DynPowerModel.json %{buildroot}/var/li
%license LICENSE
%{_bindir}/kepler
%{_unitdir}/kepler.service
/var/lib/kepler/bpfassets/amd64_kepler.bpf.o
/var/lib/kepler/data/cpus.yaml
/var/lib/kepler/data/acpi_AbsPowerModel.json
/var/lib/kepler/data/acpi_DynPowerModel.json
/var/lib/kepler/data/rapl_AbsPowerModel.json
/var/lib/kepler/data/rapl_DynPowerModel.json
/etc/kepler/kepler.config/ENABLE_PROCESS_METRICS

%changelog
* %{getenv:_TIMESTAMP_} %{getenv:_COMMITTER_}
Expand Down

0 comments on commit 9aa7eaf

Please sign in to comment.