Skip to content

Commit bf23fb1

Browse files
committed
github/workflow: remove rpm, add ubuntu-20.04 job
The rpm job was removed because the rpm generated by Ubuntu was not compatible with Fedora (and others), e.g. the compiled iio-osc was linked to libcurl.so.4(CURL_OPENSSL_4), which in Fedora does not include this flavour. The method of getting the package version from dkpg was removed, instead, we can check the *_VERSION variable and handle special cases, as in the case of matio between Ubuntu 20.04 and 22.04. Signed-off-by: Jorge Marques <[email protected]>
1 parent f44b844 commit bf23fb1

File tree

3 files changed

+87
-108
lines changed

3 files changed

+87
-108
lines changed

Diff for: .github/workflows/build-deb-ubuntu-20.04.yml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
on:
2+
push:
3+
branches: [master, deb]
4+
name: deb build for Ubuntu 20.04
5+
jobs:
6+
build:
7+
runs-on: ubuntu-20.04
8+
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v3
12+
13+
- name: Install dependencies
14+
run: sudo apt-get update &&
15+
sudo apt-get install -y
16+
build-essential cmake git
17+
libgtk-3-dev libcurl4-gnutls-dev
18+
libaio-dev
19+
libjansson-dev libmatio-dev libfftw3-dev
20+
21+
- name: Install libiio
22+
run: |
23+
wget https://github.com/analogdevicesinc/libiio/releases/download/v0.24/libiio-0.24.gc4498c2-Linux-Ubuntu-20.04.deb
24+
echo "ab84e5374cfab7f46d5006f80d0ac1fed6b104fe2dd2f804b4dd273dadf0ae65 libiio-0.24.gc4498c2-Linux-Ubuntu-20.04.deb" | sha256sum --check
25+
sudo apt install -y ./libiio-0.24.gc4498c2-Linux-Ubuntu-20.04.deb
26+
- name: Build gtkdatabox
27+
run: |
28+
wget https://download.sourceforge.net/project/gtkdatabox/gtkdatabox-1/gtkdatabox-1.0.0.tar.gz
29+
echo "8bee70206494a422ecfec9a88d32d914c50bb7a0c0e8fedc4512f5154aa9d3e3 gtkdatabox-1.0.0.tar.gz" | sha256sum --check
30+
tar -xvf gtkdatabox-1.0.0.tar.gz
31+
cd gtkdatabox-1.0.0
32+
./configure
33+
make
34+
sudo make install
35+
36+
- name: Build libad9166-iio
37+
run: |
38+
git -c http.sslVerify=false clone https://github.com/analogdevicesinc/libad9166-iio
39+
mkdir libad9166-iio/build && cd $_
40+
cmake ..
41+
make && sudo make install
42+
43+
- name: Build libad9361-iio
44+
run: |
45+
git -c http.sslVerify=false clone -b v0.2 https://github.com/analogdevicesinc/libad9361-iio
46+
mkdir libad9361-iio/build && cd $_
47+
cmake ..
48+
make && sudo make install
49+
50+
- name: Generate deb package
51+
run: mkdir build && cd $_ &&
52+
cmake -DENABLE_PACKAGING=ON .. && make package
53+
54+
- name: Upload deb package
55+
uses: actions/upload-artifact@v3
56+
with:
57+
name: iio-oscilloscope-Ubuntu20.04.deb
58+
path: build/iio-oscilloscope-*-Linux.deb
59+
if-no-files-found: error
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
on:
22
push:
33
branches: [master, deb]
4-
name: deb and rpm build
4+
name: deb build for Ubuntu 22.04
55
jobs:
66
build:
7-
runs-on: ubuntu-latest
7+
runs-on: ubuntu-22.04
88

99
steps:
1010
- name: Checkout
@@ -13,9 +13,8 @@ jobs:
1313
- name: Install dependencies
1414
run: sudo apt-get update &&
1515
sudo apt-get install -y
16-
build-essential cmake
17-
rpm git
18-
libgtkdatabox-dev libaio-dev libiio-dev
16+
build-essential cmake git
17+
libaio-dev libiio-dev libgtkdatabox-dev
1918
libjansson-dev libmatio-dev libfftw3-dev
2019

2120
- name: Build libad9166-iio
@@ -32,20 +31,13 @@ jobs:
3231
cmake ..
3332
make && sudo make install
3433
35-
- name: Generate deb and rpm package
34+
- name: Generate deb package
3635
run: mkdir build && cd $_ &&
3736
cmake -DENABLE_PACKAGING=ON .. && make package
3837

39-
- name: Grab deb package
38+
- name: Upload deb package
4039
uses: actions/upload-artifact@v3
4140
with:
42-
name: iio-oscilloscope-Linux.deb
41+
name: iio-oscilloscope-Ubuntu22.04.deb
4342
path: build/iio-oscilloscope-*-Linux.deb
4443
if-no-files-found: error
45-
46-
- name: Grab rpm package
47-
uses: actions/upload-artifact@v3
48-
with:
49-
name: iio-oscilloscope-Linux.rpm
50-
path: build/iio-oscilloscope-*-Linux.rpm
51-
if-no-files-found: error

Diff for: cmake/LinuxPackaging.cmake

+21-93
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,28 @@
11
# support creating some basic binpkgs via `make package`
22
set(CPACK_SET_DESTDIR ON)
3-
set(CPACK_GENERATOR TGZ;DEB)
3+
set(CPACK_GENERATOR TGZ)
44

55
FIND_PROGRAM(RPMBUILD_CMD rpmbuild)
66
if (RPMBUILD_CMD)
7+
# Manual setup of rpm requires, Fedora centric
78
set(CPACK_PACKAGE_RELOCATABLE OFF)
89
set(CPACK_GENERATOR ${CPACK_GENERATOR};RPM)
9-
set(CPACK_RPM_PACKAGE_REQUIRES "libiio >= 0.19, gtk3 >= 3.24, libjansson > 2.12, libmatio >= 1.5.17")
10+
set(CPACK_RPM_PACKAGE_REQUIRES "libiio >= 0.23, gtk3 >= 3.24, jansson > 2.12, matio >= 1.5.17, fftw >= 3.3.8, curl >= 7.68.0")
11+
message(STATUS "Package dependencies (.rpm): " ${CPACK_RPM_PACKAGE_REQUIRES})
12+
endif()
13+
14+
FIND_PROGRAM(DEBBUILD_CMD dpkg)
15+
if (DEBBUILD_CMD)
16+
# Manual setup of deb dependencies, Ubuntu (>= 20.04) centric
17+
# Obtain package name corresponding to version in .pc file
18+
set(CPACK_GENERATOR ${CPACK_GENERATOR};DEB)
19+
if (${MATIO_VERSION} VERSION_GREATER 1.5.21 OR ${MATIO_VERSION} VERSION_EQUAL 1.5.21 )
20+
set(MATIO_PACKAGE "libmatio11 (>= 1.5.21)")
21+
else()
22+
set(MATIO_PACKAGE "libmatio9 (>= 1.5.17)")
23+
endif()
24+
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)")
25+
message(STATUS "Package dependencies (.deb): " ${CPACK_DEBIAN_PACKAGE_DEPENDS})
1026
endif()
1127

1228
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0)
@@ -15,97 +31,9 @@ set(CPACK_PACKAGE_VERSION_MINOR ${OSC_VERSION_MINOR})
1531
set(CPACK_PACKAGE_VERSION_PATCH ${OSC_VERSION_GIT})
1632
set(CPACK_BUNDLE_NAME osc)
1733
set(CPACK_PACKAGE_VERSION ${OSCIO_VERSION})
18-
# debian specific package settings
19-
set(CPACK_PACKAGE_CONTACT "Engineerzone <https://ez.analog.com/sw-interface-tools>")
20-
21-
option(DEB_DETECT_DEPENDENCIES "Detect dependencies for .deb packages" OFF)
22-
23-
# if we are going to be looking for things, make sure we have the utilities
24-
if(DEB_DETECT_DEPENDENCIES)
25-
FIND_PROGRAM(DPKG_CMD dpkg)
26-
FIND_PROGRAM(DPKGQ_CMD dpkg-query)
34+
if (DEBBUILD_CMD)
35+
# debian specific package settings
36+
set(CPACK_PACKAGE_CONTACT "Engineerzone <https://ez.analog.com/sw-interface-tools>")
2737
endif()
2838

29-
# if we want to, and have the capabilities find what is needed,
30-
# based on what backends are turned on and what libraries are installed
31-
if(DEB_DETECT_DEPENDENCIES AND DPKG_CMD AND DPKGQ_CMD)
32-
message(STATUS "querying installed packages on system for dependancies")
33-
execute_process(COMMAND "${DPKG_CMD}" --print-architecture
34-
OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
35-
OUTPUT_STRIP_TRAILING_WHITESPACE)
36-
set(PACKAGES "libiio libgtk-3 libjansson libmatio")
37-
# find the version of the installed package, which is hard to do in
38-
# cmake first, turn the list into an list (seperated by semicolons)
39-
string(REGEX REPLACE " " ";" PACKAGES ${PACKAGES})
40-
# then iterate over each
41-
foreach(package ${PACKAGES})
42-
# List packages matching given pattern ${package},
43-
# key is the glob (*) at the end of the ${package} name,
44-
# so we don't need to be so specific
45-
execute_process(COMMAND "${DPKG_CMD}" -l ${package}*
46-
OUTPUT_VARIABLE DPKG_PACKAGES)
47-
# returns a string, in a format:
48-
# ii libxml2:amd64 2.9.4+dfsg1- amd64 GNOME XML library
49-
# 'ii' means installed - which is what we are looking for
50-
STRING(REGEX MATCHALL "ii ${package}[a-z0-9A-Z.-]*"
51-
DPKG_INSTALLED_PACKAGES ${DPKG_PACKAGES})
52-
# get rid of the 'ii', and split things up, so we can look
53-
# at the name
54-
STRING(REGEX REPLACE "ii " ";" NAME_INSTALLED_PACKAGES
55-
${DPKG_INSTALLED_PACKAGES})
56-
foreach(match ${NAME_INSTALLED_PACKAGES})
57-
# ignore packages marked as dev, debug,
58-
# documentations, or utils
59-
STRING(REGEX MATCHALL "dev|dbg|doc|utils" TEMP_TEST
60-
${match})
61-
if("${TEMP_TEST}" STREQUAL "")
62-
# find the actual version, executes:
63-
# dpkg-query --showformat='\${Version}'
64-
# --show libusb-1.0-0
65-
execute_process(COMMAND "${DPKGQ_CMD}"
66-
--showformat='\${Version}'
67-
--show "${match}"
68-
OUTPUT_VARIABLE DPKGQ_VER)
69-
# debian standard is package_ver-debian_ver,
70-
# "'2.9.4+dfsg1-2.1'"
71-
# ignore patches and debian suffix version, and
72-
# remove single quote
73-
string(REGEX REPLACE "[+-][a-z0-9A-Z.]*" ""
74-
DPKGQ_VER ${DPKGQ_VER})
75-
string(REGEX REPLACE "'" "" DPKGQ_VER
76-
${DPKGQ_VER})
77-
# build the string for the Debian dependancy
78-
set(CPACK_DEBIAN_PACKAGE_DEPENDS
79-
"${CPACK_DEBIAN_PACKAGE_DEPENDS}"
80-
"${match} (>= ${DPKGQ_VER}), ")
81-
endif()
82-
endforeach(match)
83-
endforeach(package)
84-
# remove the dangling end comma
85-
string(REGEX REPLACE ", $" "" CPACK_DEBIAN_PACKAGE_DEPENDS
86-
${CPACK_DEBIAN_PACKAGE_DEPENDS})
87-
else()
88-
# assume everything is turned on, and running on a modern OS
89-
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libiio0 (>= 0.19), libgtk-3-0 (>= 3.24.18), libjansson4 (> 2.12), libmatio11 (>= 1.5.17)")
90-
message(STATUS "Using default dependencies for packaging")
91-
endif()
92-
93-
message(STATUS "Package dependencies (.deb): " ${CPACK_DEBIAN_PACKAGE_DEPENDS})
94-
if (CPACK_RPM_PACKAGE_REQUIRES)
95-
message(STATUS "Package dependencies (.rpm): " ${CPACK_RPM_PACKAGE_REQUIRES})
96-
endif()
97-
98-
if(${CMAKE_MAJOR_VERSION} LESS 3)
99-
# old versions of cmake dont include this, but the same vintage of dpkg requires it
100-
IF(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
101-
FIND_PROGRAM(DPKG_CMD dpkg)
102-
IF(NOT DPKG_CMD)
103-
MESSAGE(STATUS "Can not find dpkg in your path, default to i386.")
104-
SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386)
105-
ENDIF(NOT DPKG_CMD)
106-
EXECUTE_PROCESS(COMMAND "${DPKG_CMD}" --print-architecture
107-
OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
108-
OUTPUT_STRIP_TRAILING_WHITESPACE)
109-
ENDIF(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
110-
endif()
11139
include(CPack)

0 commit comments

Comments
 (0)