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.

54 lines
1.4 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. # install generic linux packages required
  10. sudo apt-get update && sudo apt-get install -y \
  11. autoconf \
  12. autoconf-archive \
  13. automake \
  14. build-essential \
  15. git \
  16. libtool \
  17. pkg-config \
  18. python3 \
  19. python3-dev \
  20. python3-setuptools \
  21. swig3.0 \
  22. wget
  23. # for raspberry pi we need...
  24. sudo apt-get install -y raspberrypi-kernel-headers
  25. build_dir=`mktemp -d /tmp/libgpiod.XXXX`
  26. echo "Cloning libgpiod repository to $build_dir"
  27. echo
  28. cd "$build_dir"
  29. git clone git://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git .
  30. echo "Building libgpiod"
  31. echo
  32. include_path=`python3 -c "from sysconfig import get_paths; print(get_paths()['include'])"`
  33. export PYTHON_VERSION=3
  34. ./autogen.sh --enable-tools=yes --prefix=/usr/local/ --enable-bindings-python CFLAGS="-I/$include_path" \
  35. && make \
  36. && sudo make install \
  37. && sudo ldconfig
  38. # This is not the right way to do this:
  39. sudo cp bindings/python/.libs/gpiod.so /usr/local/lib/python3.5/dist-packages/
  40. sudo cp bindings/python/.libs/gpiod.la /usr/local/lib/python3.5/dist-packages/
  41. sudo cp bindings/python/.libs/gpiod.a /usr/local/lib/python3.5/dist-packages/
  42. exit 0