From 8018090e297a479648a2a45fe6e63be1630bea3e Mon Sep 17 00:00:00 2001 From: Adrian Stanea Date: Fri, 20 Oct 2023 12:54:40 +0300 Subject: [PATCH] ci: build libiio from sources using libiio-v0 - build from sources on Linux and Darwwin - upgrade Python bindings to use version 3.11 Signed-off-by: Adrian Stanea --- CI/travis/before_install_darwin | 36 +++++++++++++++----- CI/travis/before_install_linux | 58 +++++++++++++++++++++------------ CI/travis/lib.sh | 4 +-- azure-pipelines.yml | 23 ++----------- 4 files changed, 69 insertions(+), 52 deletions(-) diff --git a/CI/travis/before_install_darwin b/CI/travis/before_install_darwin index 8244b43e..facbb732 100755 --- a/CI/travis/before_install_darwin +++ b/CI/travis/before_install_darwin @@ -1,21 +1,31 @@ #!/bin/sh -e +TOP_DIR=$(pwd) +LIBIIO_VERSION=libiio-v0 + . CI/travis/lib.sh # Note: not installing 'mono', it comes with Azure images, # but it doesn't look it's installed with Homebrew brew_install_if_not_exists cmake doxygen libusb libxml2 swig curl python +# libiio deps +brew_install_if_not_exists doxygen libusb libxml2 ncurses cdk libserialport sphinx-doc pkg-config +pip3 install sphinx + +# if [ -n "$PACKAGE_TO_INSTALL" ] ; then +# for file in $PACKAGE_TO_INSTALL ; do +# sudo installer -pkg "${file}" -target / +# done +# elif [ "$INSTALL_FROM_SW_DOWNLOADS" = "1" ] ; then +# wget http://swdownloads.analog.com/cse/travis_builds/${LIBIIO_BRANCH}_latest_libiio${LDIST}.pkg +# sudo installer -pkg ${LIBIIO_BRANCH}_latest_libiio${LDIST}.pkg -target / +# fi -if [ -n "$PACKAGE_TO_INSTALL" ] ; then - for file in $PACKAGE_TO_INSTALL ; do - sudo installer -pkg "${file}" -target / - done -elif [ "$INSTALL_FROM_SW_DOWNLOADS" = "1" ] ; then - wget http://swdownloads.analog.com/cse/travis_builds/${LIBIIO_BRANCH}_latest_libiio${LDIST}.pkg - sudo installer -pkg ${LIBIIO_BRANCH}_latest_libiio${LDIST}.pkg -target / -fi +pip3 install wheel twine build virtualenv +# Install glog +echo "Building glog" cd ${TOP_DIR} git clone --branch v0.4.0 --depth 1 https://github.com/google/glog mkdir -p glog/build_0_4_0 && cd glog/build_0_4_0 @@ -23,4 +33,12 @@ cmake .. make sudo make install -pip3 install wheel twine build virtualenv +# Install libiio +echo "Building libiio - version $LIBIIO_VERSION" +cd ${TOP_DIR} +git clone https://github.com/analogdevicesinc/libiio.git -b $LIBIIO_VERSION libiio +mkdir ./libiio/build && cd ./libiio/build +cmake ../ +make +sudo make install + diff --git a/CI/travis/before_install_linux b/CI/travis/before_install_linux index 592c3392..6dde69e7 100755 --- a/CI/travis/before_install_linux +++ b/CI/travis/before_install_linux @@ -1,17 +1,10 @@ #!/bin/sh -e TOP_DIR=$(pwd) +LIBIIO_VERSION=libiio-v0 . CI/travis/lib.sh -get_libiio_release() { - git clone https://github.com/analogdevicesinc/libiio && cd libiio - IIO_TAG=`git describe --tags $(git rev-list --tags --max-count=1)` - git checkout ${IIO_TAG} - IIO_TAG_SHA=${IIO_TAG}.g`git rev-parse --short HEAD` - wget https://github.com/analogdevicesinc/libiio/releases/download/${IIO_TAG}/libiio-${IIO_TAG_SHA}${LDIST}.deb -} - handle_centos() { # FIXME: see about adding `libserialport-dev` from EPEL ; maybe libusb-1.0.0-devel... yum -y groupinstall 'Development Tools' @@ -25,12 +18,12 @@ handle_centos() { yum -y install cmake libxml2-devel libusb1-devel doxygen libaio-devel \ avahi-devel bzip2 gzip rpm rpm-build swig - if [ -n "$PACKAGE_TO_INSTALL" ] ; then - sudo yum localinstall -y $PACKAGE_TO_INSTALL - elif [ "$INSTALL_FROM_SW_DOWNLOADS" = "1" ] ; then - wget https://swdownloads.analog.com/cse/azure_builds/${artifactName}_latest_${LIBIIO_BRANCH}_libiio.deb - sudo dpkg -i ./${artifactName}_latest_${LIBIIO_BRANCH}_libiio.deb - fi + # if [ -n "$PACKAGE_TO_INSTALL" ] ; then + # sudo yum localinstall -y $PACKAGE_TO_INSTALL + # elif [ "$INSTALL_FROM_SW_DOWNLOADS" = "1" ] ; then + # wget https://swdownloads.analog.com/cse/azure_builds/${artifactName}_latest_${LIBIIO_BRANCH}_libiio.deb + # sudo dpkg -i ./${artifactName}_latest_${LIBIIO_BRANCH}_libiio.deb + # fi } handle_generic_docker() { @@ -38,6 +31,8 @@ handle_generic_docker() { } handle_default() { + echo "Handle default" + sudo apt-get -qq update sudo DEBIAN_FRONTEND=noninteractive apt-get install -y cmake doxygen graphviz \ libaio-dev libavahi-client-dev libavahi-common-dev libusb-1.0-0-dev \ @@ -45,14 +40,21 @@ handle_default() { python3-dev python3-setuptools python3-pip python3-all \ debhelper devscripts fakeroot libserialport-dev swig dh-python - if [ -n "$PACKAGE_TO_INSTALL" ] ; then - sudo dpkg -i $PACKAGE_TO_INSTALL - elif [ "$INSTALL_FROM_SW_DOWNLOADS" = "1" ] ; then - wget https://swdownloads.analog.com/cse/azure_builds/${artifactName}_latest_${LIBIIO_BRANCH}_libiio.deb - sudo dpkg -i ./${artifactName}_latest_${LIBIIO_BRANCH}_libiio.deb - fi + # libiio dependencies + sudo DEBIAN_FRONTEND=noninteractive apt-get install -y \ + libxml2-dev bison flex libcdk5-dev cmake \ + libaio-dev libusb-1.0-0-dev \ + libserialport-dev libavahi-client-dev \ + + # if [ -n "$PACKAGE_TO_INSTALL" ] ; then + # sudo dpkg -i $PACKAGE_TO_INSTALL + # elif [ "$INSTALL_FROM_SW_DOWNLOADS" = "1" ] ; then + # wget https://swdownloads.analog.com/cse/azure_builds/${artifactName}_latest_${LIBIIO_BRANCH}_libiio.deb + # sudo dpkg -i ./${artifactName}_latest_${LIBIIO_BRANCH}_libiio.deb + # fi #Install glog + echo "Building glog" cd ${TOP_DIR} git clone --branch v0.4.0 --depth 1 https://github.com/google/glog mkdir -p glog/build_0_4_0 && cd glog/build_0_4_0 @@ -61,9 +63,20 @@ handle_default() { sudo make install sudo pip3 install --upgrade pip stdeb argparse + + # Install libiio + echo "Building libiio - version $LIBIIO_VERSION" + cd ${TOP_DIR} + git clone https://github.com/analogdevicesinc/libiio.git -b $LIBIIO_VERSION libiio + mkdir ./libiio/build && cd ./libiio/build + cmake ../ + make + sudo make install } handle_doxygen() { + echo "Handle doxygen" + # Install a recent version of doxygen DOXYGEN_URL="wget https://sourceforge.net/projects/doxygen/files/rel-1.8.15/doxygen-1.8.15.src.tar.gz" cd ${DEPS_DIR} @@ -92,13 +105,18 @@ handle_doxygen() { } handle_ubuntu() { + echo "Handle ubuntu" + handle_default } handle_debian() { + echo "Handle debian" + handle_default } setup_build_type_env_vars handle_${BUILD_TYPE} +handle_default diff --git a/CI/travis/lib.sh b/CI/travis/lib.sh index 7fea98d6..9695816b 100644 --- a/CI/travis/lib.sh +++ b/CI/travis/lib.sh @@ -2,7 +2,7 @@ TRAVIS_BUILD_DIR=${TRAVIS_BUILD_DIR:-'./'} -LIBIIO_BRANCH=master +LIBIIO_BRANCH=libiio-v0 command_exists() { local cmd=$1 @@ -35,7 +35,7 @@ ensure_command_exists sudo # Get the common stuff from libiio [ -f ${TRAVIS_BUILD_DIR}/build/lib.sh ] || { mkdir -p ${TRAVIS_BUILD_DIR}/build - wget https://raw.githubusercontent.com/analogdevicesinc/libiio/master/CI/travis/lib.sh \ + wget https://raw.githubusercontent.com/analogdevicesinc/libiio/${LIBIIO_BRANCH}/CI/travis/lib.sh \ -O ${TRAVIS_BUILD_DIR}/build/lib.sh } diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1980ebed..f93fb8ae 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -25,7 +25,8 @@ parameters: - name: pythonVersions type: object default: - - '3.10' + - '3.11' + - 3.10 - 3.9 - 3.8 - 3.7 @@ -59,16 +60,6 @@ jobs: fetchDepth: 1 clean: true persistCredentials: true - - task: DownloadPipelineArtifact@2 - displayName: 'Get libiio artifacts' - inputs: - source: 'specific' - project: '$(AnalogDevices_OpenSource_GUID)' - pipeline: $(libiioPipelineId) - artifact: '$(artifactName)' - runVersion: 'latestFromBranch' - runBranch: 'refs/heads/master' - path: '$(Agent.BuildDirectory)/s/build/' - script: ./CI/travis/before_install_linux displayName: "Install Dependencies" - script: ./CI/travis/make_linux @@ -121,16 +112,6 @@ jobs: - checkout: self fetchDepth: 1 clean: true - - task: DownloadPipelineArtifact@2 - displayName: 'Get libiio artifacts' - inputs: - source: 'specific' - project: '$(AnalogDevices_OpenSource_GUID)' - pipeline: $(libiioPipelineId) - artifact: '$(artifactName)' - runVersion: 'latestFromBranch' - runBranch: 'refs/heads/master' - path: '$(Agent.BuildDirectory)/s/build/' - script: ./CI/travis/before_install_darwin displayName: "Install Dependencies" condition: ne(variables['agentName'],'macOS_arm64')