You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.3 KiB

  1. #!/bin/sh
  2. # Instructions!
  3. # cd ~
  4. # wget https://raw.githubusercontent.com/adafruit/Raspberry-Pi-Installer-Scripts/master/libgpiod.sh
  5. # chmod +x libgpiod.sh
  6. # ./libgpiod.sh
  7. echo "Installing build requirements - this may take a few minutes!"
  8. echo
  9. sudo apt-get update && sudo apt-get install -y \
  10. autoconf \
  11. autoconf-archive \
  12. automake \
  13. build-essential \
  14. git \
  15. libtool \
  16. pkg-config \
  17. python3 \
  18. python3-dev \
  19. python3-setuptools \
  20. raspberrypi-kernel-headers \
  21. swig3.0 \
  22. wget
  23. build_dir=`mktemp -d /tmp/libgpiod.XXXX`
  24. echo "Cloning libgpiod repository to $build_dir"
  25. echo
  26. cd "$build_dir"
  27. git clone git://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git .
  28. echo "Building libgpiod"
  29. echo
  30. include_path=`python3 -c "from sysconfig import get_paths; print(get_paths()['include'])"`
  31. export PYTHON_VERSION=3
  32. ./autogen.sh --enable-tools=yes --prefix=/usr/local/ --enable-bindings-python CFLAGS="-I/$include_path" \
  33. && make \
  34. && sudo make install \
  35. && sudo ldconfig
  36. # This is not the right way to do this:
  37. sudo cp bindings/python/.libs/gpiod.so /usr/local/lib/python3.5/dist-packages/
  38. sudo cp bindings/python/.libs/gpiod.la /usr/local/lib/python3.5/dist-packages/
  39. sudo cp bindings/python/.libs/gpiod.a /usr/local/lib/python3.5/dist-packages/
  40. exit 0