joan2937 / pigpio

pigpio is a C library for the Raspberry which allows control of the General Purpose Input Outputs (GPIO).
The Unlicense
1.46k stars 410 forks source link

Makefile ignores DESTDIR parameter for python part of install #403

Open ed-peguillan opened 4 years ago

ed-peguillan commented 4 years ago

Hi, thank you for this wonderful tool!

I am trying to compile and install this software into a separate directory so that I can package it into a .deb installer. However, I am having an issue with the python install section ignoring the make install DESTDIR= parameter, and trying to go right for the system /usr.

Steps to recreate:

git clone https://github.com/joan2937/pigpio.git
cd pigpio
git checkout v78
mkdir --parents build/release build/pigpio-1.78
cd build/release
cmake ../..
make -j5
make install DESTDIR=$HOME/build/src/pigpio/build/pigpio-1.78

This results in:

$ make install DESTDIR=$HOME/build/src/pigpio/build/pigpio-1.78
[ 13%] Built target pigpiod_if
[ 21%] Built target x_pigpiod_if
[ 34%] Built target pigpio
[ 47%] Built target pigpiod_if2
[ 60%] Built target pig2vcd
[ 69%] Built target pigpiod
[ 78%] Built target x_pigpiod_if2
[ 91%] Built target pigs
[100%] Built target x_pigpio
Install the project...
-- Install configuration: ""
-- Installing: /home/pi/build/src/pigpio/build/pigpio-1.78/usr/local/lib/libpigpio.so
-- Installing: /home/pi/build/src/pigpio/build/pigpio-1.78/usr/local/lib/libpigpiod_if.so
-- Installing: /home/pi/build/src/pigpio/build/pigpio-1.78/usr/local/lib/libpigpiod_if2.so
-- Installing: /home/pi/build/src/pigpio/build/pigpio-1.78/usr/local/bin/pig2vcd
-- Installing: /home/pi/build/src/pigpio/build/pigpio-1.78/usr/local/bin/pigpiod
-- Set runtime path of "/home/pi/build/src/pigpio/build/pigpio-1.78/usr/local/bin/pigpiod" to ""
-- Installing: /home/pi/build/src/pigpio/build/pigpio-1.78/usr/local/bin/pigs
-- Installing: /home/pi/build/src/pigpio/build/pigpio-1.78/usr/local/lib/cmake/pigpio/pigpioTargets.cmake
-- Installing: /home/pi/build/src/pigpio/build/pigpio-1.78/usr/local/lib/cmake/pigpio/pigpioTargets-noconfig.cmake
-- Installing: /home/pi/build/src/pigpio/build/pigpio-1.78/usr/local/lib/cmake/pigpio/pigpioConfig.cmake
-- Installing: /home/pi/build/src/pigpio/build/pigpio-1.78/usr/local/lib/cmake/pigpio/pigpioConfigVersion.cmake
-- Installing: /home/pi/build/src/pigpio/build/pigpio-1.78/usr/local/include/pigpio.h
-- Installing: /home/pi/build/src/pigpio/build/pigpio-1.78/usr/local/include/pigpiod_if.h
-- Installing: /home/pi/build/src/pigpio/build/pigpio-1.78/usr/local/include/pigpiod_if2.h
-- Installing: /home/pi/build/src/pigpio/build/pigpio-1.78/usr/local/man/man1/pig2vcd.1
-- Installing: /home/pi/build/src/pigpio/build/pigpio-1.78/usr/local/man/man1/pigpiod.1
-- Installing: /home/pi/build/src/pigpio/build/pigpio-1.78/usr/local/man/man1/pigs.1
-- Installing: /home/pi/build/src/pigpio/build/pigpio-1.78/usr/local/man/man3/pigpio.3
-- Installing: /home/pi/build/src/pigpio/build/pigpio-1.78/usr/local/man/man3/pigpiod_if.3
-- Installing: /home/pi/build/src/pigpio/build/pigpio-1.78/usr/local/man/man3/pigpiod_if2.3
running install
running build
running build_py
running install_lib
creating /usr/local/lib/python3.7/dist-packages
error: could not create '/usr/local/lib/python3.7/dist-packages': Permission denied

Everything installs to the place I intended except for the python bits.

ed-peguillan commented 4 years ago

After playing around with it a little bit, I found this suggestion to modify the call to setup.py, and it seems to work. Doing python setup.py install -h reveals a --prefix flag.

I found the relevant call in cmake_install.cmake after running cmake ../.. on line 200: image

and just appended the prefix I need: image

It installed correctly after this. I'm not sure how to make this work in an automatic way, however.