From 01f025ac12d1d9e2406a628cd1ee5dfde10a3acd Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Sat, 9 Feb 2019 21:52:28 -0800 Subject: [PATCH] Add libpixy2 (C++ and Python) to image (#85) --- stage3/01-sys-tweaks/00-packages | 2 ++ stage3/01-sys-tweaks/01-run.sh | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/stage3/01-sys-tweaks/00-packages b/stage3/01-sys-tweaks/00-packages index 9fb1800..10dd7ce 100644 --- a/stage3/01-sys-tweaks/00-packages +++ b/stage3/01-sys-tweaks/00-packages @@ -6,3 +6,5 @@ python3.5-dev python3-numpy python3-pybind11 python3-pip +libusb-1.0-0-dev +swig diff --git a/stage3/01-sys-tweaks/01-run.sh b/stage3/01-sys-tweaks/01-run.sh index d9f5548..f6d3fee 100755 --- a/stage3/01-sys-tweaks/01-run.sh +++ b/stage3/01-sys-tweaks/01-run.sh @@ -55,6 +55,10 @@ wget -nc -nv -O robotpy-cscore.tar.gz \ wget -nc -nv -O pybind11.tar.gz \ https://github.com/pybind/pybind11/archive/v2.2.tar.gz +# pixy2 +wget -nc -nv -O pixy2.tar.gz \ + https://github.com/charmedlabs/pixy2/archive/2adc6caba774a3056448d0feb0c6b89855a392f4.tar.gz + popd # @@ -92,6 +96,13 @@ tar xzf "${DOWNLOAD_DIR}/pybind11.tar.gz" mv pybind11-* pybind11 popd +# pixy2 +tar xzf "${DOWNLOAD_DIR}/pixy2.tar.gz" +mv pixy2-* pixy2 +rm -rf pixy2/releases +sed -i -e 's/python/python3/g;s/_pixy.so/_pixy.*.so/' pixy2/scripts/build_python_demos.sh +sed -i -e 's/print/#print/' pixy2/src/host/libpixyusb2_examples/python_demos/setup.py + popd # @@ -315,6 +326,21 @@ arm-raspbian9-linux-gnueabihf-g++ \ popd +# +# Build pixy2 +# +on_chroot << EOF +pushd /usr/src/pixy2/scripts +./build_libpixyusb2.sh +./build_python_demos.sh +popd +EOF + +install -m 644 "${EXTRACT_DIR}/pixy2/build/libpixyusb2/libpixy2.a" "${ROOTFS_DIR}/usr/local/frc/lib/" +install -m 644 "${EXTRACT_DIR}/pixy2/build/python_demos/pixy.py" "${ROOTFS_DIR}/usr/local/lib/python3.5/dist-packages/" +install -m 755 ${EXTRACT_DIR}/pixy2/build/python_demos/_pixy.*.so "${ROOTFS_DIR}/usr/local/lib/python3.5/dist-packages/" +rm -rf "${EXTRACT_DIR}/pixy2/build" + # # Finish up #