diff --git a/.github/workflows/build-deb-ubuntu-20.04.yml b/.github/workflows/build-deb-ubuntu-20.04.yml new file mode 100644 index 00000000..ab3e92b1 --- /dev/null +++ b/.github/workflows/build-deb-ubuntu-20.04.yml @@ -0,0 +1,54 @@ +on: + push: + branches: [master, deb] +name: deb build for Ubuntu 20.04 +jobs: + build: + runs-on: ubuntu-20.04 + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install dependencies + run: sudo apt-get update && + sudo apt-get install -y + build-essential cmake git + libgtk-3-dev libcurl4-gnutls-dev + libaio-dev libiio-dev + libjansson-dev libmatio-dev libfftw3-dev + + - name: Build gtkdatabox + run: | + wget https://download.sourceforge.net/project/gtkdatabox/gtkdatabox-1/gtkdatabox-1.0.0.tar.gz + echo "8bee70206494a422ecfec9a88d32d914c50bb7a0c0e8fedc4512f5154aa9d3e3 gtkdatabox-1.0.0.tar.gz" | sha256sum --check + tar -xvf gtkdatabox-1.0.0.tar.gz + cd gtkdatabox-1.0.0 + ./configure + make + sudo make install + + - name: Build libad9166-iio + run: | + git -c http.sslVerify=false clone https://github.com/analogdevicesinc/libad9166-iio + mkdir libad9166-iio/build && cd $_ + cmake .. + make && sudo make install + + - name: Build libad9361-iio + run: | + git -c http.sslVerify=false clone -b v0.2 https://github.com/analogdevicesinc/libad9361-iio + mkdir libad9361-iio/build && cd $_ + cmake .. + make && sudo make install + + - name: Generate deb package + run: mkdir build && cd $_ && + cmake -DENABLE_PACKAGING=ON .. && make package + + - name: Upload deb package + uses: actions/upload-artifact@v3 + with: + name: iio-oscilloscope-Ubuntu20.04.deb + path: build/iio-oscilloscope-*-Linux.deb + if-no-files-found: error diff --git a/.github/workflows/build-deb-rpm.yml b/.github/workflows/build-deb-ubuntu-22.04.yml similarity index 68% rename from .github/workflows/build-deb-rpm.yml rename to .github/workflows/build-deb-ubuntu-22.04.yml index 7a65bdf0..e69c28a3 100644 --- a/.github/workflows/build-deb-rpm.yml +++ b/.github/workflows/build-deb-ubuntu-22.04.yml @@ -1,10 +1,10 @@ on: push: branches: [master, deb] -name: deb and rpm build +name: deb build for Ubuntu 22.04 jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Checkout @@ -13,9 +13,8 @@ jobs: - name: Install dependencies run: sudo apt-get update && sudo apt-get install -y - build-essential cmake - rpm git - libgtkdatabox-dev libaio-dev libiio-dev + build-essential cmake git + libaio-dev libiio-dev libgtkdatabox-dev libjansson-dev libmatio-dev libfftw3-dev - name: Build libad9166-iio @@ -32,20 +31,13 @@ jobs: cmake .. make && sudo make install - - name: Generate deb and rpm package + - name: Generate deb package run: mkdir build && cd $_ && cmake -DENABLE_PACKAGING=ON .. && make package - - name: Grab deb package + - name: Upload deb package uses: actions/upload-artifact@v3 with: - name: iio-oscilloscope-Linux.deb + name: iio-oscilloscope-Ubuntu22.04.deb path: build/iio-oscilloscope-*-Linux.deb if-no-files-found: error - - - name: Grab rpm package - uses: actions/upload-artifact@v3 - with: - name: iio-oscilloscope-Linux.rpm - path: build/iio-oscilloscope-*-Linux.rpm - if-no-files-found: error diff --git a/cmake/LinuxPackaging.cmake b/cmake/LinuxPackaging.cmake index 78c67391..66536ad9 100644 --- a/cmake/LinuxPackaging.cmake +++ b/cmake/LinuxPackaging.cmake @@ -1,12 +1,28 @@ # support creating some basic binpkgs via `make package` set(CPACK_SET_DESTDIR ON) -set(CPACK_GENERATOR TGZ;DEB) +set(CPACK_GENERATOR TGZ) FIND_PROGRAM(RPMBUILD_CMD rpmbuild) if (RPMBUILD_CMD) + # Manual setup of rpm requires, Fedora centric set(CPACK_PACKAGE_RELOCATABLE OFF) set(CPACK_GENERATOR ${CPACK_GENERATOR};RPM) - set(CPACK_RPM_PACKAGE_REQUIRES "libiio >= 0.19, gtk3 >= 3.24, libjansson > 2.12, libmatio >= 1.5.17") + set(CPACK_RPM_PACKAGE_REQUIRES "libiio >= 0.19, gtk3 >= 3.24, jansson > 2.12, matio >= 1.5.17, fftw >= 3.3.8, curl >= 7.68.0") + message(STATUS "Package dependencies (.rpm): " ${CPACK_RPM_PACKAGE_REQUIRES}) +endif() + +FIND_PROGRAM(DEBBUILD_CMD dpkg) +if (DEBBUILD_CMD) + # Manual setup of deb dependencies, Ubuntu (>= 20.04) centric + # Obtain package name corresponding to version in .pc file + set(CPACK_GENERATOR ${CPACK_GENERATOR};DEB) + if (${MATIO_VERSION} VERSION_GREATER 1.5.21 OR ${MATIO_VERSION} VERSION_EQUAL 1.5.21 ) + set(MATIO_PACKAGE "libmatio11 (>= 1.5.21)") + else() + set(MATIO_PACKAGE "libmatio9 (>= 1.5.17)") + endif() + set(CPACK_DEBIAN_PACKAGE_DEPENDS "libiio0 (>= 0.19), libgtk-3-0 (>= 3.24.18), libjansson4 (> 2.12), ${MATIO_PACKAGE}, libfftw3-3 (>= 3.3.8), curl (>= 7.68.0)") + message(STATUS "Package dependencies (.deb): " ${CPACK_DEBIAN_PACKAGE_DEPENDS}) endif() set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0) @@ -15,97 +31,9 @@ set(CPACK_PACKAGE_VERSION_MINOR ${OSC_VERSION_MINOR}) set(CPACK_PACKAGE_VERSION_PATCH ${OSC_VERSION_GIT}) set(CPACK_BUNDLE_NAME osc) set(CPACK_PACKAGE_VERSION ${OSCIO_VERSION}) -# debian specific package settings -set(CPACK_PACKAGE_CONTACT "Engineerzone ") - -option(DEB_DETECT_DEPENDENCIES "Detect dependencies for .deb packages" OFF) - -# if we are going to be looking for things, make sure we have the utilities -if(DEB_DETECT_DEPENDENCIES) - FIND_PROGRAM(DPKG_CMD dpkg) - FIND_PROGRAM(DPKGQ_CMD dpkg-query) +if (DEBBUILD_CMD) + # debian specific package settings + set(CPACK_PACKAGE_CONTACT "Engineerzone ") endif() -# if we want to, and have the capabilities find what is needed, -# based on what backends are turned on and what libraries are installed -if(DEB_DETECT_DEPENDENCIES AND DPKG_CMD AND DPKGQ_CMD) - message(STATUS "querying installed packages on system for dependancies") - execute_process(COMMAND "${DPKG_CMD}" --print-architecture - OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE - OUTPUT_STRIP_TRAILING_WHITESPACE) - set(PACKAGES "libiio libgtk-3 libjansson libmatio") - # find the version of the installed package, which is hard to do in - # cmake first, turn the list into an list (seperated by semicolons) - string(REGEX REPLACE " " ";" PACKAGES ${PACKAGES}) - # then iterate over each - foreach(package ${PACKAGES}) - # List packages matching given pattern ${package}, - # key is the glob (*) at the end of the ${package} name, - # so we don't need to be so specific - execute_process(COMMAND "${DPKG_CMD}" -l ${package}* - OUTPUT_VARIABLE DPKG_PACKAGES) - # returns a string, in a format: - # ii libxml2:amd64 2.9.4+dfsg1- amd64 GNOME XML library - # 'ii' means installed - which is what we are looking for - STRING(REGEX MATCHALL "ii ${package}[a-z0-9A-Z.-]*" - DPKG_INSTALLED_PACKAGES ${DPKG_PACKAGES}) - # get rid of the 'ii', and split things up, so we can look - # at the name - STRING(REGEX REPLACE "ii " ";" NAME_INSTALLED_PACKAGES - ${DPKG_INSTALLED_PACKAGES}) - foreach(match ${NAME_INSTALLED_PACKAGES}) - # ignore packages marked as dev, debug, - # documentations, or utils - STRING(REGEX MATCHALL "dev|dbg|doc|utils" TEMP_TEST - ${match}) - if("${TEMP_TEST}" STREQUAL "") - # find the actual version, executes: - # dpkg-query --showformat='\${Version}' - # --show libusb-1.0-0 - execute_process(COMMAND "${DPKGQ_CMD}" - --showformat='\${Version}' - --show "${match}" - OUTPUT_VARIABLE DPKGQ_VER) - # debian standard is package_ver-debian_ver, - # "'2.9.4+dfsg1-2.1'" - # ignore patches and debian suffix version, and - # remove single quote - string(REGEX REPLACE "[+-][a-z0-9A-Z.]*" "" - DPKGQ_VER ${DPKGQ_VER}) - string(REGEX REPLACE "'" "" DPKGQ_VER - ${DPKGQ_VER}) - # build the string for the Debian dependancy - set(CPACK_DEBIAN_PACKAGE_DEPENDS - "${CPACK_DEBIAN_PACKAGE_DEPENDS}" - "${match} (>= ${DPKGQ_VER}), ") - endif() - endforeach(match) - endforeach(package) - # remove the dangling end comma - string(REGEX REPLACE ", $" "" CPACK_DEBIAN_PACKAGE_DEPENDS - ${CPACK_DEBIAN_PACKAGE_DEPENDS}) -else() - # assume everything is turned on, and running on a modern OS - set(CPACK_DEBIAN_PACKAGE_DEPENDS "libiio0 (>= 0.19), libgtk-3-0 (>= 3.24.18), libjansson4 (> 2.12), libmatio11 (>= 1.5.17)") - message(STATUS "Using default dependencies for packaging") -endif() - -message(STATUS "Package dependencies (.deb): " ${CPACK_DEBIAN_PACKAGE_DEPENDS}) -if (CPACK_RPM_PACKAGE_REQUIRES) - message(STATUS "Package dependencies (.rpm): " ${CPACK_RPM_PACKAGE_REQUIRES}) -endif() - -if(${CMAKE_MAJOR_VERSION} LESS 3) - # old versions of cmake dont include this, but the same vintage of dpkg requires it - IF(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE) - FIND_PROGRAM(DPKG_CMD dpkg) - IF(NOT DPKG_CMD) - MESSAGE(STATUS "Can not find dpkg in your path, default to i386.") - SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386) - ENDIF(NOT DPKG_CMD) - EXECUTE_PROCESS(COMMAND "${DPKG_CMD}" --print-architecture - OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE - OUTPUT_STRIP_TRAILING_WHITESPACE) - ENDIF(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE) -endif() include(CPack)