mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
cpupower: change binding's makefile to use -lcpupower
Originally I believed I needed the .o files to make the bindings. The linking failed due to a missing .so link in Fedora or by using make install-lib from the cpupower directory. Amend the makefile and the README. Big thanks to Wander Lairson Costa <wander@redhat.com> for the help. Link: https://lore.kernel.org/r/20250429204711.127274-1-jwyatt@redhat.com Signed-off-by: "John B. Wyatt IV" <jwyatt@redhat.com> Signed-off-by: "John B. Wyatt IV" <sageofredondo@gmail.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
This commit is contained in:
parent
9c70b779ad
commit
99d2fce9b4
2 changed files with 11 additions and 10 deletions
|
@ -1,22 +1,20 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0-only
|
# SPDX-License-Identifier: GPL-2.0-only
|
||||||
# Makefile for libcpupower's Python bindings
|
# Makefile for libcpupower's Python bindings
|
||||||
#
|
#
|
||||||
# This Makefile expects you have already run the makefile for cpupower to build
|
# This Makefile expects you have already run `make install-lib` in the lib
|
||||||
# the .o files in the lib directory for the bindings to be created.
|
# directory for the bindings to be created.
|
||||||
|
|
||||||
CC := gcc
|
CC := gcc
|
||||||
HAVE_SWIG := $(shell if which swig >/dev/null 2>&1; then echo 1; else echo 0; fi)
|
HAVE_SWIG := $(shell if which swig >/dev/null 2>&1; then echo 1; else echo 0; fi)
|
||||||
HAVE_PYCONFIG := $(shell if which python-config >/dev/null 2>&1; then echo 1; else echo 0; fi)
|
HAVE_PYCONFIG := $(shell if which python-config >/dev/null 2>&1; then echo 1; else echo 0; fi)
|
||||||
|
|
||||||
LIB_DIR := ../../lib
|
|
||||||
PY_INCLUDE = $(firstword $(shell python-config --includes))
|
PY_INCLUDE = $(firstword $(shell python-config --includes))
|
||||||
OBJECTS_LIB = $(wildcard $(LIB_DIR)/*.o)
|
|
||||||
INSTALL_DIR = $(shell python3 -c "import site; print(site.getsitepackages()[0])")
|
INSTALL_DIR = $(shell python3 -c "import site; print(site.getsitepackages()[0])")
|
||||||
|
|
||||||
all: _raw_pylibcpupower.so
|
all: _raw_pylibcpupower.so
|
||||||
|
|
||||||
_raw_pylibcpupower.so: raw_pylibcpupower_wrap.o
|
_raw_pylibcpupower.so: raw_pylibcpupower_wrap.o
|
||||||
$(CC) -shared $(OBJECTS_LIB) raw_pylibcpupower_wrap.o -o _raw_pylibcpupower.so
|
$(CC) -shared -lcpupower raw_pylibcpupower_wrap.o -o _raw_pylibcpupower.so
|
||||||
|
|
||||||
raw_pylibcpupower_wrap.o: raw_pylibcpupower_wrap.c
|
raw_pylibcpupower_wrap.o: raw_pylibcpupower_wrap.c
|
||||||
$(CC) -fPIC -c raw_pylibcpupower_wrap.c $(PY_INCLUDE)
|
$(CC) -fPIC -c raw_pylibcpupower_wrap.c $(PY_INCLUDE)
|
||||||
|
|
|
@ -5,18 +5,21 @@ libcpupower (aside from the libcpupower object files).
|
||||||
requirements
|
requirements
|
||||||
------------
|
------------
|
||||||
|
|
||||||
* You need the object files in the libcpupower directory compiled by
|
* If you are building completely from upstream; please install libcpupower by
|
||||||
cpupower's makefile.
|
running `make install-lib` within the cpupower directory. This installs the
|
||||||
|
libcpupower.so file and symlinks needed. Otherwise, please make sure a symlink
|
||||||
|
to libcpupower.so exists in your library path from your distribution's
|
||||||
|
packages.
|
||||||
* The SWIG program must be installed.
|
* The SWIG program must be installed.
|
||||||
* The Python's development libraries installed.
|
* The Python's development libraries must be installed.
|
||||||
|
|
||||||
Please check that your version of SWIG is compatible with the version of Python
|
Please check that your version of SWIG is compatible with the version of Python
|
||||||
installed on your machine by checking the SWIG changelog on their website.
|
installed on your machine by checking the SWIG changelog on their website.
|
||||||
https://swig.org/
|
https://swig.org/
|
||||||
|
|
||||||
Note that while SWIG itself is GPL v3+ licensed; the resulting output,
|
Note that while SWIG itself is GPL v3+ licensed; the resulting output,
|
||||||
the bindings code: is permissively licensed + the license of libcpupower's .o
|
the bindings code: is permissively licensed + the license of libcpupower's
|
||||||
files. For these bindings that means GPL v2.
|
library files. For these bindings that means GPL v2.
|
||||||
|
|
||||||
Please see https://swig.org/legal.html and the discussion [1] for more details.
|
Please see https://swig.org/legal.html and the discussion [1] for more details.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue