1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453
|
# Copyright (c) 2025, Benjamin Vernoux <bvernoux@hydrasdr.com>
#
# This workflow is licensed exclusively for HydraSDR products and related development.
# Unauthorized use, modification, or distribution for non-HydraSDR products is prohibited.
# All rights reserved.
#
# SoapyHydraSDR Build and Release Workflow
# For more information about HydraSDR products: https://hydrasdr.com
name: Build and Release SoapyHydraSDR Modules (Windows, GNU/Linux, MacOS)
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
# Global environment variables
PACKAGE_NAME: "soapyhydrasdr"
MAINTAINER: "Benjamin Vernoux <bvernoux@hydrasdr.com>"
HOMEPAGE: "https://hydrasdr.com"
jobs:
# Extract version once and share across all jobs
extract-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
hydrasdr_host_version: ${{ steps.hydrasdr_host_version.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: Extract SoapyHydraSDR version
id: version
run: |
VERSION=$(grep 'set(SOAPYHYDRASDR_VERSION' CMakeLists.txt | sed 's/.*"\([^"]*\)".*/\1/')
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Extracted SoapyHydraSDR version: $VERSION"
- name: Get latest hydrasdr-host release
id: hydrasdr_host_version
run: |
HYDRASDR_HOST_VERSION=$(curl -s https://api.github.com/repos/hydrasdr/hydrasdr-host/releases/latest | jq -r .tag_name)
echo "version=$HYDRASDR_HOST_VERSION" >> $GITHUB_OUTPUT
echo "Latest rfone_host version: $HYDRASDR_HOST_VERSION"
build:
needs: extract-version
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-2022
name: "Windows-x64"
platform: "windows"
- os: ubuntu-24.04
name: "Ubuntu-24.04-LTS-Noble-Numbat"
platform: "linux"
create_deb: true
- os: macos-14
name: "macOS-ARM64"
platform: "macos"
arch: "arm64"
- os: macos-15-intel
name: "macOS-x86_64"
platform: "macos"
arch: "x86_64"
name: ${{ matrix.name }}
steps:
- uses: actions/checkout@v4
# === Download and Build LibHydraSDR from Source ===
- name: Download hydrasdr-host source
uses: actions/checkout@v4
with:
repository: hydrasdr/hydrasdr-host
ref: ${{ needs.extract-version.outputs.hydrasdr_host_version }}
path: hydrasdr_host_src
- name: Verify hydrasdr-host source download
run: |
echo "Verifying hydrasdr-host source download..."
if [ -d hydrasdr_host_src ]; then
echo "Source code downloaded successfully to hydrasdr_host_src/"
ls -la hydrasdr_host_src/ | head -10
else
echo "Failed to download source code"
exit 1
fi
shell: bash
# === Platform Dependencies ===
- name: Install Linux dependencies
if: matrix.platform == 'linux'
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake pkg-config libusb-1.0-0-dev
# Build SoapySDR from source to get ABI 0.8-3 (apt package has ABI 0.8)
# This ensures compatibility with users who build SoapySDR from source
# See: https://github.com/hydrasdr/SoapyHydraSDR/issues/7
echo "Building SoapySDR from source for ABI 0.8-3 compatibility..."
git clone https://github.com/pothosware/SoapySDR.git /tmp/SoapySDR
cd /tmp/SoapySDR
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local
make -j$(nproc)
sudo make install
sudo ldconfig
# Verify SoapySDR ABI version
echo "Installed SoapySDR version:"
SoapySDRUtil --info | head -10
- name: Install macOS dependencies
if: matrix.platform == 'macos'
env:
HOMEBREW_NO_AUTO_UPDATE: 1
run: |
brew install --quiet cmake libusb pkg-config
# Install SoapySDR
brew install --quiet soapysdr
# === Windows Dependencies ===
- name: Setup Windows build tools
if: matrix.platform == 'windows'
uses: microsoft/setup-msbuild@v2
- name: Install Windows dependencies
if: matrix.platform == 'windows'
shell: powershell
run: |
# Install vcpkg and use it to install dependencies
git clone https://github.com/Microsoft/vcpkg.git C:\vcpkg
C:\vcpkg\bootstrap-vcpkg.bat
# Install SoapySDR and libusb
C:\vcpkg\vcpkg.exe install soapysdr:x64-windows libusb:x64-windows
# Set environment for CMake to find vcpkg packages
echo "CMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake" >> $env:GITHUB_ENV
- name: Download Windows dependencies for LibHydraSDR
if: matrix.platform == 'windows'
shell: powershell
run: |
# Download dependencies for building libhydrasdr
Invoke-WebRequest "https://github.com/libusb/libusb/releases/download/v1.0.23/libusb-1.0.23.7z" -OutFile "libusb.7z"
Invoke-WebRequest "https://gcc.gnu.org/pub/pthreads-win32/pthreads-w32-2-9-1-release.zip" -OutFile "pthreads.zip"
# Extract libusb
New-Item -ItemType Directory -Path "deps\libusb" -Force
7z x libusb.7z -o"deps\libusb"
# Extract pthreads
Expand-Archive pthreads.zip -DestinationPath "temp" -Force
$prebuilt = Get-ChildItem "temp" -Recurse -Directory | Where-Object { $_.Name -eq "Pre-built.2" }
New-Item -ItemType Directory -Path "deps\pthreads" -Force
Copy-Item "$($prebuilt.FullName)\*" -Destination "deps\pthreads" -Recurse -Force
Remove-Item "temp" -Recurse -Force
# === Build LibHydraSDR ===
- name: Build LibHydraSDR (Linux/macOS)
if: matrix.platform != 'windows'
run: |
cd hydrasdr_host_src
mkdir build && cd build
if [ "${{ matrix.platform }}" = "macos" ]; then
if [ "${{ matrix.arch }}" = "arm64" ]; then
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../../hydrasdr_host_build/install -DCMAKE_OSX_ARCHITECTURES=arm64 -DINSTALL_UDEV_RULES=OFF -DENABLE_SHARED_LIB=ON
else
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../../hydrasdr_host_build/install -DCMAKE_OSX_ARCHITECTURES=x86_64 -DINSTALL_UDEV_RULES=OFF -DENABLE_SHARED_LIB=ON
fi
else
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../../hydrasdr_host_build/install -DINSTALL_UDEV_RULES=OFF -DENABLE_SHARED_LIB=ON
fi
make -j$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 4)
make install
# Verify installation
echo "=== Verifying LibHydraSDR installation ==="
# Check lib directory (lib or lib64 depending on distro)
if [ -d "../../hydrasdr_host_build/install/lib" ]; then
LIBDIR="../../hydrasdr_host_build/install/lib"
elif [ -d "../../hydrasdr_host_build/install/lib64" ]; then
LIBDIR="../../hydrasdr_host_build/install/lib64"
else
echo "No lib or lib64 directory found"
exit 1
fi
ls -la "$LIBDIR"
ls -la ../../hydrasdr_host_build/install/include/ || echo "No include directory found"
# Check for specific files based on platform
if [ "${{ matrix.platform }}" = "macos" ]; then
EXPECTED_LIB="$LIBDIR/libhydrasdr.dylib"
else
EXPECTED_LIB="$LIBDIR/libhydrasdr.so"
fi
if [ -f "$EXPECTED_LIB" ]; then
echo "✓ Found $(basename $EXPECTED_LIB)"
# Only use file command if available
if command -v file >/dev/null 2>&1; then
file "$EXPECTED_LIB"
else
ls -l "$EXPECTED_LIB"
fi
else
echo "✗ $(basename $EXPECTED_LIB) not found"
echo "Available files in lib directory:"
find ../../hydrasdr_host_build/install -name "*hydrasdr*" 2>/dev/null || echo "No hydrasdr files found"
exit 1
fi
# Check for header file - it might be in libhydrasdr subdirectory
HEADER_FOUND=false
for header_path in "../../hydrasdr_host_build/install/include/hydrasdr.h" "../../hydrasdr_host_build/install/include/libhydrasdr/hydrasdr.h"; do
if [ -f "$header_path" ]; then
echo "✓ Found hydrasdr.h at: $header_path"
HEADER_FOUND=true
break
fi
done
if [ "$HEADER_FOUND" = false ]; then
echo "✗ hydrasdr.h not found in expected locations"
echo "Available header files:"
find ../../hydrasdr_host_build/install/include -name "*.h" 2>/dev/null || echo "No header files found"
exit 1
fi
- name: Build LibHydraSDR (Windows)
if: matrix.platform == 'windows'
shell: powershell
run: |
Set-Location hydrasdr_host_src
New-Item -ItemType Directory -Path "build" -Force | Out-Null
Set-Location build
$currentDir = Get-Location
$depsLibusb = Join-Path $currentDir "..\..\deps\libusb"
$depsPthreads = Join-Path $currentDir "..\..\deps\pthreads"
$installPrefix = Join-Path $currentDir "..\..\hydrasdr_host_build\install"
cmake .. -G "Visual Studio 17 2022" -A x64 -DCMAKE_INSTALL_PREFIX="$installPrefix" -DLIBUSB_INCLUDE_DIR="$depsLibusb\include\libusb-1.0" -DLIBUSB_LIBRARIES="$depsLibusb\MS64\dll\libusb-1.0.lib" -DTHREADS_PTHREADS_INCLUDE_DIR="$depsPthreads\include" -DTHREADS_PTHREADS_WIN32_LIBRARY="$depsPthreads\lib\x64\pthreadVC2.lib" -DENABLE_SHARED_LIB=ON
cmake --build . --config Release --parallel
cmake --install . --config Release
Write-Host "Copying runtime dependencies..."
$installBinDir = Join-Path $installPrefix "bin"
New-Item -ItemType Directory -Path $installBinDir -Force | Out-Null
$libusbDll = Join-Path $depsLibusb "MS64\dll\libusb-1.0.dll"
$pthreadsDll = Join-Path $depsPthreads "dll\x64\pthreadVC2.dll"
if (Test-Path $libusbDll) {
Copy-Item $libusbDll $installBinDir -ErrorAction SilentlyContinue
Write-Host "Copied libusb-1.0.dll"
}
if (Test-Path $pthreadsDll) {
Copy-Item $pthreadsDll $installBinDir -ErrorAction SilentlyContinue
Write-Host "Copied pthreadVC2.dll"
}
Write-Host "Verifying LibHydraSDR installation..."
$libDir = Join-Path $installPrefix "lib"
$includeDir = Join-Path $installPrefix "include"
if (Test-Path $libDir) {
Write-Host "Found lib directory:"
Get-ChildItem $libDir
} else {
Write-Host "No lib directory found"
}
if (Test-Path $includeDir) {
Write-Host "Found include directory:"
Get-ChildItem $includeDir
} else {
Write-Host "No include directory found"
}
Write-Host "Checking for required files..."
$expectedLib = Join-Path $installPrefix "bin\hydrasdr.lib"
if (Test-Path $expectedLib) {
Write-Host "Found hydrasdr.lib in bin directory - SUCCESS"
} else {
Write-Host "ERROR: hydrasdr.lib not found in bin directory"
Write-Host "Available files in install directory:"
Get-ChildItem $installPrefix -Recurse -Filter "*hydrasdr*" -ErrorAction SilentlyContinue | ForEach-Object { Write-Host $_.FullName }
exit 1
}
Write-Host "Checking for header files..."
$headerFound = $false
$headerPath1 = Join-Path $includeDir "hydrasdr.h"
$headerPath2 = Join-Path $includeDir "libhydrasdr\hydrasdr.h"
if (Test-Path $headerPath1) {
Write-Host "Found hydrasdr.h at: $headerPath1"
$headerFound = $true
}
if (Test-Path $headerPath2) {
Write-Host "Found hydrasdr.h at: $headerPath2"
$headerFound = $true
}
if ($headerFound -eq $false) {
Write-Host "ERROR: hydrasdr.h not found in expected locations"
Write-Host "Available header files:"
Get-ChildItem $includeDir -Recurse -Filter "*.h" -ErrorAction SilentlyContinue | ForEach-Object { Write-Host $_.FullName }
exit 1
}
Write-Host "LibHydraSDR build completed successfully"
# === Build SoapyHydraSDR ===
- name: Configure SoapyHydraSDR build (Linux/macOS)
if: matrix.platform != 'windows'
run: |
mkdir build && cd build
# Get absolute path to LibHydraSDR installation
LIBHYDRASDR_PREFIX="$(cd ../hydrasdr_host_build/install && pwd)"
echo "Using LibHydraSDR from: $LIBHYDRASDR_PREFIX"
if [ "${{ matrix.platform }}" = "macos" ]; then
if [ "${{ matrix.arch }}" = "arm64" ]; then
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_PREFIX_PATH="$LIBHYDRASDR_PREFIX" -DLIBHYDRASDR_ROOT="$LIBHYDRASDR_PREFIX"
else
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_PREFIX_PATH="$LIBHYDRASDR_PREFIX" -DLIBHYDRASDR_ROOT="$LIBHYDRASDR_PREFIX"
fi
else
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$LIBHYDRASDR_PREFIX" -DLIBHYDRASDR_ROOT="$LIBHYDRASDR_PREFIX"
fi
- name: Configure SoapyHydraSDR build (Windows)
if: matrix.platform == 'windows'
shell: powershell
run: |
New-Item -ItemType Directory -Path "build" -Force | Out-Null
Set-Location build
$installPrefix = Resolve-Path "..\hydrasdr_host_build\install"
$libhydrasdrLib = Join-Path $installPrefix "bin\hydrasdr.lib"
$libhydrasdrInclude = Join-Path $installPrefix "include"
Write-Host "Configuring with LibHydraSDR paths:"
Write-Host " Install prefix: $installPrefix"
Write-Host " Library: $libhydrasdrLib"
Write-Host " Include: $libhydrasdrInclude"
Write-Host " Library exists: $(Test-Path $libhydrasdrLib)"
Write-Host " Include exists: $(Test-Path $libhydrasdrInclude)"
# Create a symlink or copy the library to where CMake expects it
$expectedLibDir = Join-Path $installPrefix "lib"
$expectedLib = Join-Path $expectedLibDir "hydrasdr.lib"
if (-not (Test-Path $expectedLibDir)) {
New-Item -ItemType Directory -Path $expectedLibDir -Force | Out-Null
}
if (-not (Test-Path $expectedLib)) {
Copy-Item $libhydrasdrLib $expectedLib
Write-Host "Copied library to expected location: $expectedLib"
}
cmake .. -G "Visual Studio 17 2022" -A x64 -DCMAKE_TOOLCHAIN_FILE="C:\vcpkg\scripts\buildsystems\vcpkg.cmake" -DCMAKE_PREFIX_PATH="$installPrefix" -DLIBHYDRASDR_ROOT="$installPrefix"
# === Build ===
- name: Build SoapyHydraSDR (Linux/macOS)
if: matrix.platform != 'windows'
shell: bash
run: |
cd build
if [ "${{ matrix.platform }}" = "macos" ]; then
make -j$(sysctl -n hw.ncpu)
else
make -j$(nproc)
fi
- name: Build SoapyHydraSDR (Windows)
if: matrix.platform == 'windows'
shell: powershell
run: |
cd build
cmake --build . --config Release --parallel
# === Package Artifacts ===
- name: Package artifacts (Linux)
if: matrix.platform == 'linux'
run: |
ARTIFACT_DIR="${{ env.PACKAGE_NAME }}-${{ matrix.name }}-v${{ needs.extract-version.outputs.version }}"
mkdir -p "$ARTIFACT_DIR"
# Find and copy SoapySDR module
find build -name "*SoapyHydraSDR*" -type f -exec cp {} "$ARTIFACT_DIR/" \;
# Copy built libhydrasdr
find hydrasdr_host_build/install -name "libhydrasdr.so*" -exec cp {} "$ARTIFACT_DIR/" \; 2>/dev/null || true
- name: Package artifacts (macOS)
if: matrix.platform == 'macos'
run: |
ARTIFACT_DIR="${{ env.PACKAGE_NAME }}-${{ matrix.name }}-v${{ needs.extract-version.outputs.version }}"
mkdir -p "$ARTIFACT_DIR"
# Find and copy SoapySDR module
find build -name "*SoapyHydraSDR*" -type f -exec cp {} "$ARTIFACT_DIR/" \;
# Copy built libhydrasdr
find hydrasdr_host_build/install -name "libhydrasdr.dylib*" -exec cp {} "$ARTIFACT_DIR/" \; 2>/dev/null || true
- name: Package artifacts (Windows)
if: matrix.platform == 'windows'
shell: powershell
run: |
$dir = "${{ env.PACKAGE_NAME }}-${{ matrix.name }}-v${{ needs.extract-version.outputs.version }}"
New-Item -ItemType Directory -Path $dir -Force
# Find and copy only the SoapySDR module DLL (exclude build artifacts)
Write-Host "Looking for SoapySDR module files..."
Get-ChildItem build -Recurse -Include "*.dll" | Where-Object { $_.Name -like "*SoapyHydraSDR*" } | ForEach-Object {
Write-Host "Found SoapySDR module: $($_.FullName)"
Copy-Item $_.FullName -Destination $dir -ErrorAction SilentlyContinue
}
# Copy built libhydrasdr and dependencies
Write-Host "Copying LibHydraSDR dependencies..."
if (Test-Path "hydrasdr_host_build\install\bin") {
Get-ChildItem "hydrasdr_host_build\install\bin" -Filter "*.dll" | Copy-Item -Destination $dir -ErrorAction SilentlyContinue
}
if (Test-Path "hydrasdr_host_build\install\lib") {
Get-ChildItem "hydrasdr_host_build\install\lib" -Filter "*.lib" | Copy-Item -Destination $dir -ErrorAction SilentlyContinue
}
Write-Host "Final package contents:"
Get-ChildItem $dir | ForEach-Object { Write-Host " $($_.Name)" }
# === Create .deb package ===
# FIXED: Install to multiple SoapySDR paths for compatibility with different installations
- name: Create .deb package
if: matrix.create_deb == true
shell: bash
run: |
PACKAGE_VERSION="${{ needs.extract-version.outputs.version }}"
ARCH="amd64"
PACKAGE_NAME_FULL="${{ env.PACKAGE_NAME }}"
PACKAGE_DIR="${PACKAGE_NAME_FULL}_${PACKAGE_VERSION}_${ARCH}"
# Define all common SoapySDR module paths to support different installations
# System package path (Debian/Ubuntu apt install)
SOAPY_SYSTEM_DIR="/usr/lib/x86_64-linux-gnu/SoapySDR/modules0.8"
# Source-built path (cmake default install prefix)
SOAPY_LOCAL_DIR="/usr/local/lib/SoapySDR/modules0.8"
# Source-built path with ABI version suffix (SoapySDR 0.8.x)
SOAPY_LOCAL_ABI_DIR="/usr/local/lib/SoapySDR/modules0.8-3"
# Create package directory structure for all paths
mkdir -p "${PACKAGE_DIR}/DEBIAN"
mkdir -p "${PACKAGE_DIR}${SOAPY_SYSTEM_DIR}"
mkdir -p "${PACKAGE_DIR}${SOAPY_LOCAL_DIR}"
mkdir -p "${PACKAGE_DIR}${SOAPY_LOCAL_ABI_DIR}"
mkdir -p "${PACKAGE_DIR}/usr/lib"
mkdir -p "${PACKAGE_DIR}/usr/share/doc/${PACKAGE_NAME_FULL}"
# Copy SoapySDR module to ALL common paths for maximum compatibility
find build -name "*SoapyHydraSDR*" -type f -exec cp {} "${PACKAGE_DIR}${SOAPY_SYSTEM_DIR}/" \;
find build -name "*SoapyHydraSDR*" -type f -exec cp {} "${PACKAGE_DIR}${SOAPY_LOCAL_DIR}/" \;
find build -name "*SoapyHydraSDR*" -type f -exec cp {} "${PACKAGE_DIR}${SOAPY_LOCAL_ABI_DIR}/" \;
# NOTE: libhydrasdr.so is NOT bundled - provided by hydrasdr-host-tools package
# Create control file
cat > "${PACKAGE_DIR}/DEBIAN/control" << EOF
Package: ${PACKAGE_NAME_FULL}
Version: ${PACKAGE_VERSION}
Section: electronics
Priority: optional
Architecture: ${ARCH}
Depends: libusb-1.0-0 (>= 1.0.20), hydrasdr-host-tools (>= 1.0.0)
Recommends: soapysdr-tools
Maintainer: ${{ env.MAINTAINER }}
Homepage: ${{ env.HOMEPAGE }}
Description: SoapySDR module for HydraSDR RFOne devices
SoapySDR driver module for HydraSDR RFOne software-defined radio hardware.
Provides seamless integration with SoapySDR ecosystem and applications.
EOF
# Create postinst script with auto-detection and symlink creation
cat > "${PACKAGE_DIR}/DEBIAN/postinst" << 'POSTINST_EOF'
#!/bin/bash
set -e
# SoapyHydraSDR postinst - handles module path detection and symlink creation
create_symlink_if_needed() {
local target_dir="$1"
local module_name="libSoapyHydraSDR.so"
local dest_file="${target_dir}/${module_name}"
# Skip if target already exists or target directory doesn't exist
[ -e "$dest_file" ] && return 0
[ ! -d "$target_dir" ] && return 0
# Find source module in order of preference
for src in /usr/lib/x86_64-linux-gnu/SoapySDR/modules0.8/${module_name} \
/usr/local/lib/SoapySDR/modules0.8/${module_name} \
/usr/local/lib/SoapySDR/modules0.8-3/${module_name}; do
if [ -f "$src" ]; then
ln -sf "$src" "$dest_file"
echo "SoapyHydraSDR: Created symlink in $target_dir"
return 0
fi
done
}
if [ "$1" = "configure" ]; then
# Update library cache first
command -v ldconfig >/dev/null 2>&1 && ldconfig || true
# Detect actual SoapySDR module search path(s)
if command -v SoapySDRUtil >/dev/null 2>&1; then
SOAPY_PATHS=$(SoapySDRUtil --info 2>/dev/null | grep "Search path:" | awk '{print $3}')
for SOAPY_PATH in $SOAPY_PATHS; do
if [ -n "$SOAPY_PATH" ] && [ -d "$SOAPY_PATH" ]; then
create_symlink_if_needed "$SOAPY_PATH"
fi
done
# Verify installation
echo "SoapyHydraSDR: Verifying installation..."
if SoapySDRUtil --info 2>/dev/null | grep -qi "hydrasdr"; then
echo "SoapyHydraSDR: Module successfully detected!"
else
echo "SoapyHydraSDR: Module installed. If not detected, check SoapySDRUtil --info"
fi
fi
fi
exit 0
POSTINST_EOF
# Create postrm script with proper cleanup
cat > "${PACKAGE_DIR}/DEBIAN/postrm" << 'POSTRM_EOF'
#!/bin/bash
set -e
if [ "$1" = "remove" ] || [ "$1" = "purge" ]; then
# Remove any symlinks we may have created
for path in /usr/lib/x86_64-linux-gnu/SoapySDR/modules0.8 \
/usr/local/lib/SoapySDR/modules0.8 \
/usr/local/lib/SoapySDR/modules0.8-3; do
target="${path}/libSoapyHydraSDR.so"
if [ -L "$target" ]; then
rm -f "$target"
fi
done
command -v ldconfig >/dev/null 2>&1 && ldconfig || true
fi
exit 0
POSTRM_EOF
chmod 755 "${PACKAGE_DIR}/DEBIAN/postinst" "${PACKAGE_DIR}/DEBIAN/postrm"
# Create documentation
cat > "${PACKAGE_DIR}/usr/share/doc/${PACKAGE_NAME_FULL}/copyright" << EOF
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: SoapyHydraSDR
Upstream-Contact: ${{ env.MAINTAINER }}
Source: https://github.com/hydrasdr/SoapyHydraSDR
Files: *
Copyright: 2025 ${{ env.MAINTAINER }}
License: Custom-HydraSDR
This software is licensed exclusively for HydraSDR products and related development.
Unauthorized use, modification, or distribution for non-HydraSDR products is prohibited.
All rights reserved.
EOF
cat > "${PACKAGE_DIR}/usr/share/doc/${PACKAGE_NAME_FULL}/changelog.Debian" << EOF
${PACKAGE_NAME_FULL} (${PACKAGE_VERSION}) unstable; urgency=medium
* Automated build from CI for ${{ matrix.name }}
* Built with LibHydraSDR ${{ needs.extract-version.outputs.hydrasdr_host_version }}
* Built from commit ${{ github.sha }}
* Fixed: Module now installs to multiple SoapySDR paths for compatibility
* Fixed: No longer bundles libhydrasdr.so (depends on hydrasdr-host-tools)
-- ${{ env.MAINTAINER }} $(date -R)
EOF
gzip -9 "${PACKAGE_DIR}/usr/share/doc/${PACKAGE_NAME_FULL}/changelog.Debian"
# Set permissions
find "${PACKAGE_DIR}" -type d -exec chmod 755 {} \;
find "${PACKAGE_DIR}${SOAPY_SYSTEM_DIR}" -type f -exec chmod 644 {} \; 2>/dev/null || true
find "${PACKAGE_DIR}${SOAPY_LOCAL_DIR}" -type f -exec chmod 644 {} \; 2>/dev/null || true
find "${PACKAGE_DIR}${SOAPY_LOCAL_ABI_DIR}" -type f -exec chmod 644 {} \; 2>/dev/null || true
find "${PACKAGE_DIR}/usr/lib" -name "*.so*" -exec chmod 644 {} \;
# Build package
dpkg-deb --build "${PACKAGE_DIR}"
# Rename to distribution-specific name
DIST_SPECIFIC_NAME="${{ env.PACKAGE_NAME }}-${{ matrix.name }}-v${PACKAGE_VERSION}.deb"
mv "${PACKAGE_DIR}.deb" "${DIST_SPECIFIC_NAME}"
# Verify the package
dpkg-deb --info "${DIST_SPECIFIC_NAME}"
dpkg-deb --contents "${DIST_SPECIFIC_NAME}"
echo "Created distribution-specific .deb package: ${DIST_SPECIFIC_NAME}"
# === Testing ===
- name: Test (Linux)
if: matrix.platform == 'linux'
run: |
echo "Testing SoapySDR module installation..."
# Test that libhydrasdr was built correctly
export LD_LIBRARY_PATH=hydrasdr_host_build/install/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=hydrasdr_host_build/install/lib64:$LD_LIBRARY_PATH
hydrasdr_host_build/install/bin/hydrasdr_lib_version || echo "hydrasdr_lib_version not available"
# Test that the SoapySDR module can be found
if command -v SoapySDRUtil >/dev/null 2>&1; then
# Copy module to temporary location for testing
TEMP_MODULE_DIR=$(mktemp -d)
find build -name "*SoapyHydraSDR*" -type f -exec cp {} "$TEMP_MODULE_DIR/" \;
export SOAPY_SDR_PLUGIN_PATH="$TEMP_MODULE_DIR"
echo "Available SoapySDR modules:"
SoapySDRUtil --info || echo "SoapySDR info command failed"
echo "Looking for HydraSDR devices:"
SoapySDRUtil --find || echo "No HydraSDR hardware detected (normal in CI environment)"
rm -rf "$TEMP_MODULE_DIR"
else
echo "SoapySDRUtil not available for testing"
fi
- name: Test (macOS)
if: matrix.platform == 'macos'
run: |
echo "Testing SoapySDR module installation..."
# Test that libhydrasdr was built correctly
export DYLD_LIBRARY_PATH=hydrasdr_host_build/install/lib:$DYLD_LIBRARY_PATH
hydrasdr_host_build/install/bin/hydrasdr_lib_version || echo "hydrasdr_lib_version not available"
if command -v SoapySDRUtil >/dev/null 2>&1; then
# Copy module to temporary location for testing
TEMP_MODULE_DIR=$(mktemp -d)
find build -name "*SoapyHydraSDR*" -type f -exec cp {} "$TEMP_MODULE_DIR/" \;
export SOAPY_SDR_PLUGIN_PATH="$TEMP_MODULE_DIR"
echo "Available SoapySDR modules:"
SoapySDRUtil --info || echo "SoapySDR info command failed"
echo "Looking for HydraSDR devices:"
SoapySDRUtil --find || echo "No HydraSDR hardware detected (normal in CI environment)"
rm -rf "$TEMP_MODULE_DIR"
else
echo "SoapySDRUtil not available for testing"
fi
- name: Test (Windows)
if: matrix.platform == 'windows'
shell: powershell
run: |
Write-Host "Testing SoapySDR module installation..."
Write-Host "Testing libhydrasdr..."
# Test libhydrasdr
if (Test-Path "hydrasdr_host_build\install\bin\hydrasdr_lib_version.exe") {
try {
& "hydrasdr_host_build\install\bin\hydrasdr_lib_version.exe"
Write-Host "LibHydraSDR test completed successfully"
} catch {
Write-Host "hydrasdr_lib_version test failed (normal if hardware not connected)"
}
} else {
Write-Host "hydrasdr_lib_version.exe not found"
}
# Test SoapySDR
$SoapySDRUtil = "C:\vcpkg\installed\x64-windows\bin\SoapySDRUtil.exe"
if (Test-Path $SoapySDRUtil) {
Write-Host "Found SoapySDRUtil, running tests..."
try {
Write-Host "Available SoapySDR modules:"
& $SoapySDRUtil --info
Write-Host "Looking for HydraSDR devices:"
& $SoapySDRUtil --find
Write-Host "SoapySDR tests completed successfully"
} catch {
Write-Host "SoapySDR tests failed (normal in CI environment without hardware)"
}
} else {
Write-Host "SoapySDRUtil not available - skipping SoapySDR tests (this is normal)"
}
Write-Host "Windows testing completed - all tests are optional in CI environment"
exit 0
# === Upload ===
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGE_NAME }}-${{ matrix.name }}-v${{ needs.extract-version.outputs.version }}
path: ${{ env.PACKAGE_NAME }}-${{ matrix.name }}-v${{ needs.extract-version.outputs.version }}/*
retention-days: 30
- name: Upload .deb package
if: matrix.create_deb == true
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGE_NAME }}-${{ matrix.name }}-v${{ needs.extract-version.outputs.version }}-deb
path: "${{ env.PACKAGE_NAME }}-${{ matrix.name }}-v*.deb"
retention-days: 30
build_linux_distros:
needs: extract-version
runs-on: ubuntu-latest
container: ${{ matrix.container }}
strategy:
fail-fast: false
matrix:
include:
# Ubuntu LTS Versions
# Note: We build SoapySDR from source to get ABI 0.8-3 compatibility
# See: https://github.com/hydrasdr/SoapyHydraSDR/issues/7
- container: "ubuntu:22.04"
name: "Ubuntu-22.04-LTS-Jammy-Jellyfish"
pkg_manager: "apt"
create_deb: true
build_soapysdr: true
deps: "build-essential cmake pkg-config libusb-1.0-0-dev git wget curl ca-certificates"
- container: "ubuntu:20.04"
name: "Ubuntu-20.04-LTS-Focal-Fossa"
pkg_manager: "apt"
create_deb: true
build_soapysdr: true
deps: "build-essential cmake pkg-config libusb-1.0-0-dev git wget curl ca-certificates"
# Debian Stable/Testing
- container: "debian:trixie"
name: "Debian-13-Trixie"
pkg_manager: "apt"
create_deb: true
build_soapysdr: true
deps: "build-essential cmake pkg-config libusb-1.0-0-dev git wget curl ca-certificates"
- container: "debian:bookworm"
name: "Debian-12-Bookworm"
pkg_manager: "apt"
create_deb: true
build_soapysdr: true
deps: "build-essential cmake pkg-config libusb-1.0-0-dev git wget curl ca-certificates"
- container: "debian:bullseye"
name: "Debian-11-Bullseye"
pkg_manager: "apt"
create_deb: true
build_soapysdr: true
deps: "build-essential cmake pkg-config libusb-1.0-0-dev git wget curl ca-certificates"
# Linux Mint Versions (Ubuntu-based)
- container: "linuxmintd/mint22-amd64:latest"
name: "Linux-Mint-22-Wilma"
pkg_manager: "apt"
create_deb: true
build_soapysdr: true
deps: "build-essential cmake pkg-config libusb-1.0-0-dev git wget curl ca-certificates"
- container: "linuxmintd/mint21.3-amd64:latest"
name: "Linux-Mint-21.3-Virginia"
pkg_manager: "apt"
create_deb: true
build_soapysdr: true
deps: "build-essential cmake pkg-config libusb-1.0-0-dev git wget curl ca-certificates"
- container: "linuxmintd/mint21.2-amd64:latest"
name: "Linux-Mint-21.2-Victoria"
pkg_manager: "apt"
create_deb: true
build_soapysdr: true
deps: "build-essential cmake pkg-config libusb-1.0-0-dev git wget curl ca-certificates"
- container: "linuxmintd/mint21.1-amd64:latest"
name: "Linux-Mint-21.1-Vera"
pkg_manager: "apt"
create_deb: true
build_soapysdr: true
deps: "build-essential cmake pkg-config libusb-1.0-0-dev git wget curl ca-certificates"
# Fedora Latest Versions
- container: "fedora:42"
name: "Fedora-42"
pkg_manager: "dnf"
create_rpm: true
deps: "gcc gcc-c++ cmake pkg-config libusb1-devel make rpm-build rpmdevtools tar gzip SoapySDR-devel wget ca-certificates chrpath"
- container: "fedora:41"
name: "Fedora-41"
pkg_manager: "dnf"
create_rpm: true
deps: "gcc gcc-c++ cmake pkg-config libusb1-devel make rpm-build rpmdevtools tar gzip SoapySDR-devel wget ca-certificates chrpath"
# openSUSE
- container: "opensuse/tumbleweed:latest"
name: "openSUSE-Tumbleweed"
pkg_manager: "zypper"
create_rpm: true
deps: "gcc gcc-c++ cmake pkgconfig libusb-1_0-devel make rpm-build tar gzip soapy-sdr-devel wget ca-certificates chrpath"
# Enterprise Linux
- container: "almalinux:9"
name: "AlmaLinux-9"
pkg_manager: "dnf"
create_rpm: true
deps: "gcc gcc-c++ cmake pkg-config libusb1-devel make epel-release rpm-build rpmdevtools wget ca-certificates chrpath"
enable_repos: true
allow_erasing: true
# Rolling Release Distributions
- container: "archlinux:latest"
name: "Arch-Linux"
pkg_manager: "pacman"
create_pkg: true
deps: "base-devel cmake pkg-config libusb sudo soapysdr wget curl ca-certificates"
name: ${{ matrix.name }}
steps:
- uses: actions/checkout@v4
# === Download and Build LibHydraSDR from Source ===
- name: Download hydrasdr-host source
uses: actions/checkout@v4
with:
repository: hydrasdr/hydrasdr-host
ref: ${{ needs.extract-version.outputs.hydrasdr_host_version }}
path: hydrasdr_host_src
- name: Verify hydrasdr-host source download
shell: bash
run: |
echo "Verifying hydrasdr-host source download..."
if [ -d hydrasdr_host_src ]; then
echo "Source code downloaded successfully to hydrasdr_host_src/"
ls -la hydrasdr_host_src/ | head -10
else
echo "Failed to download source code"
exit 1
fi
# === Install dependencies ===
- name: Install dependencies
run: |
case "${{ matrix.pkg_manager }}" in
"apt")
export DEBIAN_FRONTEND=noninteractive TZ=UTC
apt-get update
apt-get install -y ${{ matrix.deps }}
;;
"dnf")
dnf update -y
# Enable additional repositories for RHEL-based systems
if [[ "${{ matrix.name }}" == *"AlmaLinux"* ]]; then
dnf install -y epel-release
# Enable CodeReady Builder (CRB) repository for AlmaLinux 9
dnf config-manager --set-enabled crb || dnf config-manager --set-enabled powertools || true
# Install SoapySDR from EPEL
dnf install -y SoapySDR-devel
fi
# Handle curl conflicts on RHEL-based systems
if [[ "${{ matrix.allow_erasing }}" == "true" ]]; then
echo "Installing with --allowerasing to handle curl conflicts..."
dnf install -y --allowerasing ${{ matrix.deps }}
else
dnf install -y ${{ matrix.deps }}
fi
;;
"zypper")
zypper refresh
# Handle special package names for openSUSE
if [[ "${{ matrix.name }}" == *"openSUSE"* ]]; then
# Try alternative package names if the main ones fail
zypper install -y gcc gcc-c++ cmake pkgconfig libusb-1_0-devel make rpm-build tar gzip wget ca-certificates chrpath || true
# Try to install SoapySDR - it might have different names
zypper install -y soapy-sdr-devel || zypper install -y SoapySDR-devel || zypper install -y libsoapysdr-devel || echo "SoapySDR not available, will build without"
else
zypper install -y ${{ matrix.deps }}
fi
;;
"pacman")
pacman -Sy --noconfirm archlinux-keyring
pacman -Syu --noconfirm
pacman -S --noconfirm ${{ matrix.deps }}
;;
esac
# === Build SoapySDR from source for ABI 0.8-3 compatibility ===
# This is required for Debian/Ubuntu because apt packages have older ABI 0.8
# Users who build SoapySDR from source get ABI 0.8-3
# See: https://github.com/hydrasdr/SoapyHydraSDR/issues/7
- name: Build SoapySDR from source
if: matrix.build_soapysdr == true
run: |
echo "Building SoapySDR from source for ABI 0.8-3 compatibility..."
git clone https://github.com/pothosware/SoapySDR.git /tmp/SoapySDR
cd /tmp/SoapySDR
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local
make -j$(nproc)
make install
ldconfig
# Verify SoapySDR ABI version
echo "=== Installed SoapySDR version ==="
SoapySDRUtil --info | head -10
# === Build LibHydraSDR ===
- name: Build LibHydraSDR
run: |
cd hydrasdr_host_src
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../../hydrasdr_host_build/install -DINSTALL_UDEV_RULES=OFF -DENABLE_SHARED_LIB=ON
make -j$(nproc)
make install
# Verify installation
echo "=== Verifying LibHydraSDR installation ==="
# Check lib directory (lib or lib64 depending on distro)
if [ -d "../../hydrasdr_host_build/install/lib" ]; then
LIBDIR="../../hydrasdr_host_build/install/lib"
elif [ -d "../../hydrasdr_host_build/install/lib64" ]; then
LIBDIR="../../hydrasdr_host_build/install/lib64"
else
echo "No lib or lib64 directory found"
exit 1
fi
ls -la "$LIBDIR"
ls -la ../../hydrasdr_host_build/install/include/ || echo "No include directory found"
# Check for specific files
if [ -f "$LIBDIR/libhydrasdr.so" ]; then
echo "✓ Found libhydrasdr.so"
# Only use file command if available
if command -v file >/dev/null 2>&1; then
file "$LIBDIR/libhydrasdr.so"
else
ls -l "$LIBDIR/libhydrasdr.so"
fi
else
echo "✗ libhydrasdr.so not found"
echo "Available files in lib directory:"
find ../../hydrasdr_host_build/install -name "*hydrasdr*" 2>/dev/null || echo "No hydrasdr files found"
exit 1
fi
# Check for header file - it might be in libhydrasdr subdirectory
HEADER_FOUND=false
for header_path in "../../hydrasdr_host_build/install/include/hydrasdr.h" "../../hydrasdr_host_build/install/include/libhydrasdr/hydrasdr.h"; do
if [ -f "$header_path" ]; then
echo "✓ Found hydrasdr.h at: $header_path"
HEADER_FOUND=true
break
fi
done
if [ "$HEADER_FOUND" = false ]; then
echo "✗ hydrasdr.h not found in expected locations"
echo "Available header files:"
find ../../hydrasdr_host_build/install/include -name "*.h" 2>/dev/null || echo "No header files found"
exit 1
fi
# === Build SoapyHydraSDR ===
- name: Configure and build SoapyHydraSDR
run: |
mkdir build && cd build
# Get absolute path to LibHydraSDR installation
LIBHYDRASDR_PREFIX="$(cd ../hydrasdr_host_build/install && pwd)"
echo "Using LibHydraSDR from: $LIBHYDRASDR_PREFIX"
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$LIBHYDRASDR_PREFIX" -DLIBHYDRASDR_ROOT="$LIBHYDRASDR_PREFIX"
make -j$(nproc)
# === Package Artifacts ===
- name: Package artifacts
run: |
ARTIFACT_DIR="${{ env.PACKAGE_NAME }}-${{ matrix.name }}-v${{ needs.extract-version.outputs.version }}"
mkdir -p "$ARTIFACT_DIR"
find build -name "*SoapyHydraSDR*" -type f -exec cp {} "$ARTIFACT_DIR/" \;
find hydrasdr_host_build/install -name "libhydrasdr.so*" -exec cp {} "$ARTIFACT_DIR/" \; 2>/dev/null || true
# === Create distribution packages ===
# FIXED: Install to multiple SoapySDR paths for compatibility with different installations
- name: Create .deb package
if: matrix.create_deb == true
shell: bash
run: |
PACKAGE_VERSION="${{ needs.extract-version.outputs.version }}"
ARCH="amd64"
PACKAGE_NAME_FULL="${{ env.PACKAGE_NAME }}"
PACKAGE_DIR="${PACKAGE_NAME_FULL}_${PACKAGE_VERSION}_${ARCH}"
# Define all common SoapySDR module paths
SOAPY_SYSTEM_DIR="/usr/lib/x86_64-linux-gnu/SoapySDR/modules0.8"
SOAPY_LOCAL_DIR="/usr/local/lib/SoapySDR/modules0.8"
SOAPY_LOCAL_ABI_DIR="/usr/local/lib/SoapySDR/modules0.8-3"
# Create package directory structure for all paths
mkdir -p "${PACKAGE_DIR}/DEBIAN"
mkdir -p "${PACKAGE_DIR}${SOAPY_SYSTEM_DIR}"
mkdir -p "${PACKAGE_DIR}${SOAPY_LOCAL_DIR}"
mkdir -p "${PACKAGE_DIR}${SOAPY_LOCAL_ABI_DIR}"
mkdir -p "${PACKAGE_DIR}/usr/share/doc/${PACKAGE_NAME_FULL}"
# Copy to ALL common paths
find build -name "*SoapyHydraSDR*" -type f -exec cp {} "${PACKAGE_DIR}${SOAPY_SYSTEM_DIR}/" \;
find build -name "*SoapyHydraSDR*" -type f -exec cp {} "${PACKAGE_DIR}${SOAPY_LOCAL_DIR}/" \;
find build -name "*SoapyHydraSDR*" -type f -exec cp {} "${PACKAGE_DIR}${SOAPY_LOCAL_ABI_DIR}/" \;
# NOTE: libhydrasdr.so is NOT bundled - provided by hydrasdr-host-tools package
cat > "${PACKAGE_DIR}/DEBIAN/control" << EOF
Package: ${PACKAGE_NAME_FULL}
Version: ${PACKAGE_VERSION}
Section: electronics
Priority: optional
Architecture: ${ARCH}
Depends: libusb-1.0-0 (>= 1.0.20), hydrasdr-host-tools (>= 1.0.0)
Recommends: soapysdr-tools
Maintainer: ${{ env.MAINTAINER }}
Homepage: ${{ env.HOMEPAGE }}
Description: SoapySDR module for HydraSDR RFOne devices
SoapySDR driver module for HydraSDR RFOne software-defined radio hardware.
Provides seamless integration with SoapySDR ecosystem and applications.
EOF
# Create postinst with auto-detection
cat > "${PACKAGE_DIR}/DEBIAN/postinst" << 'POSTINST_EOF'
#!/bin/bash
set -e
create_symlink_if_needed() {
local target_dir="$1"
local dest_file="${target_dir}/libSoapyHydraSDR.so"
[ -e "$dest_file" ] && return 0
[ ! -d "$target_dir" ] && return 0
for src in /usr/lib/x86_64-linux-gnu/SoapySDR/modules0.8/libSoapyHydraSDR.so \
/usr/local/lib/SoapySDR/modules0.8/libSoapyHydraSDR.so \
/usr/local/lib/SoapySDR/modules0.8-3/libSoapyHydraSDR.so; do
if [ -f "$src" ]; then
ln -sf "$src" "$dest_file"
return 0
fi
done
}
if [ "$1" = "configure" ]; then
ldconfig || true
if command -v SoapySDRUtil >/dev/null 2>&1; then
SOAPY_PATHS=$(SoapySDRUtil --info 2>/dev/null | grep "Search path:" | awk '{print $3}')
for SOAPY_PATH in $SOAPY_PATHS; do
[ -n "$SOAPY_PATH" ] && [ -d "$SOAPY_PATH" ] && create_symlink_if_needed "$SOAPY_PATH"
done
SoapySDRUtil --info 2>/dev/null | grep -qi "hydrasdr" && echo "SoapyHydraSDR: Module detected!" || true
fi
fi
exit 0
POSTINST_EOF
cat > "${PACKAGE_DIR}/DEBIAN/postrm" << 'POSTRM_EOF'
#!/bin/bash
set -e
if [ "$1" = "remove" ] || [ "$1" = "purge" ]; then
for path in /usr/lib/x86_64-linux-gnu/SoapySDR/modules0.8 \
/usr/local/lib/SoapySDR/modules0.8 \
/usr/local/lib/SoapySDR/modules0.8-3; do
[ -L "${path}/libSoapyHydraSDR.so" ] && rm -f "${path}/libSoapyHydraSDR.so"
done
ldconfig || true
fi
exit 0
POSTRM_EOF
chmod 755 "${PACKAGE_DIR}/DEBIAN/postinst" "${PACKAGE_DIR}/DEBIAN/postrm"
find "${PACKAGE_DIR}" -type d -exec chmod 755 {} \;
find "${PACKAGE_DIR}${SOAPY_SYSTEM_DIR}" -type f -exec chmod 644 {} \; 2>/dev/null || true
find "${PACKAGE_DIR}${SOAPY_LOCAL_DIR}" -type f -exec chmod 644 {} \; 2>/dev/null || true
find "${PACKAGE_DIR}${SOAPY_LOCAL_ABI_DIR}" -type f -exec chmod 644 {} \; 2>/dev/null || true
find "${PACKAGE_DIR}/usr/lib" -name "*.so*" -exec chmod 644 {} \;
dpkg-deb --build "${PACKAGE_DIR}"
mv "${PACKAGE_DIR}.deb" "${{ env.PACKAGE_NAME }}-${{ matrix.name }}-v${PACKAGE_VERSION}.deb"
- name: Create .rpm package
if: matrix.create_rpm == true
shell: bash
run: |
PACKAGE_VERSION="${{ needs.extract-version.outputs.version }}"
PACKAGE_NAME_FULL="${{ env.PACKAGE_NAME }}"
BUILD_DIR="$(pwd)"
# Setup RPM build environment (different for openSUSE vs Fedora/RHEL)
if [[ "${{ matrix.pkg_manager }}" == "zypper" ]]; then
# openSUSE uses /usr/src/packages (already set by system)
RPM_BUILD_ROOT="/usr/src/packages"
mkdir -p ${RPM_BUILD_ROOT}/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
USE_CUSTOM_TOPDIR=false
else
# Fedora/RHEL uses ~/rpmbuild
rpmdev-setuptree || mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
RPM_BUILD_ROOT="$HOME/rpmbuild"
USE_CUSTOM_TOPDIR=true
fi
# Get SoapySDR module directories - support both package and source-built SoapySDR
# See: https://github.com/hydrasdr/SoapyHydraSDR/issues/7
SOAPY_MODULE_DIR="/usr/lib64/SoapySDR/modules0.8"
SOAPY_LOCAL_DIR="/usr/local/lib64/SoapySDR/modules0.8-3"
# Create temporary build structure
BUILD_ROOT="${RPM_BUILD_ROOT}/BUILD/${PACKAGE_NAME_FULL}-${PACKAGE_VERSION}"
mkdir -p "${BUILD_ROOT}"
# Copy built files to temporary location for packaging
TEMP_INSTALL_DIR="${BUILD_ROOT}/temp_install"
mkdir -p "${TEMP_INSTALL_DIR}${SOAPY_MODULE_DIR}"
mkdir -p "${TEMP_INSTALL_DIR}${SOAPY_LOCAL_DIR}"
# Copy SoapySDR module to both paths and strip problematic RPATHs
find "${BUILD_DIR}/build" -name "*SoapyHydraSDR*" -type f -exec cp {} "${TEMP_INSTALL_DIR}${SOAPY_MODULE_DIR}/" \; 2>/dev/null || echo "No SoapyHydraSDR module found"
find "${BUILD_DIR}/build" -name "*SoapyHydraSDR*" -type f -exec cp {} "${TEMP_INSTALL_DIR}${SOAPY_LOCAL_DIR}/" \; 2>/dev/null || true
# Strip RPATHs from SoapySDR modules to avoid packaging issues
if command -v chrpath >/dev/null 2>&1; then
find "${TEMP_INSTALL_DIR}" -name "*.so" -exec chrpath -d {} \; 2>/dev/null || true
elif command -v patchelf >/dev/null 2>&1; then
find "${TEMP_INSTALL_DIR}" -name "*.so" -exec patchelf --remove-rpath {} \; 2>/dev/null || true
fi
# NOTE: libhydrasdr.so is NOT bundled - provided by hydrasdr-host-tools package
# List what we actually have
echo "=== Files prepared for RPM packaging ==="
find "${TEMP_INSTALL_DIR}" -type f | head -20
# Create spec file with proper changelog format
cat > ${RPM_BUILD_ROOT}/SPECS/${PACKAGE_NAME_FULL}.spec << 'EOF'
Name: soapyhydrasdr
Version: %{version}
Release: 1%{?dist}
Summary: SoapySDR module for HydraSDR RFOne devices
License: Custom-HydraSDR
URL: %{homepage}
BuildArch: x86_64
BuildRequires: gcc-c++, cmake
%if 0%{?suse_version}
BuildRequires: pkgconfig, libusb-1_0-devel, soapy-sdr-devel
Requires: libusb-1_0-0, soapy-sdr, hydrasdr-host-tools >= 1.0.0
%else
BuildRequires: pkg-config, libusb1-devel, SoapySDR-devel
Requires: libusb1, SoapySDR, hydrasdr-host-tools >= 1.0.0
%endif
%description
SoapySDR driver module for HydraSDR RFOne software-defined radio hardware.
Provides seamless integration with SoapySDR ecosystem and applications.
%prep
# No prep needed for binary package
%build
# No build needed for binary package
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}/usr/lib64/SoapySDR/modules0.8
mkdir -p %{buildroot}/usr/local/lib64/SoapySDR/modules0.8-3
# Copy SoapySDR module files from temporary install location
if [ -d "%{temp_install}/usr/lib64/SoapySDR/modules0.8" ]; then
cp -a "%{temp_install}/usr/lib64/SoapySDR/modules0.8"/* %{buildroot}/usr/lib64/SoapySDR/modules0.8/ 2>/dev/null || true
fi
if [ -d "%{temp_install}/usr/local/lib64/SoapySDR/modules0.8-3" ]; then
cp -a "%{temp_install}/usr/local/lib64/SoapySDR/modules0.8-3"/* %{buildroot}/usr/local/lib64/SoapySDR/modules0.8-3/ 2>/dev/null || true
fi
%files
%defattr(-,root,root,-)
/usr/lib64/SoapySDR/modules0.8/*
/usr/local/lib64/SoapySDR/modules0.8-3/*
%post
/sbin/ldconfig
if command -v SoapySDRUtil >/dev/null 2>&1; then
SoapySDRUtil --info >/dev/null 2>&1 || true
fi
%postun
/sbin/ldconfig
%changelog
* Tue Jul 30 2024 Benjamin Vernoux <bvernoux@hydrasdr.com> - %{version}-1
- Automated build from CI for %{distname}
- Built with LibHydraSDR %{hydrasdr_host_version}
- Fixed: No longer bundles libhydrasdr.so (depends on hydrasdr-host-tools)
EOF
# Build RPM with RPATH checking disabled and variable substitution
cd ${RPM_BUILD_ROOT}/SPECS
# Choose the right rpmbuild command based on whether we need custom topdir
if [[ "$USE_CUSTOM_TOPDIR" == "true" ]]; then
rpmbuild -bb \
--define "_topdir ${RPM_BUILD_ROOT}" \
--define "version ${PACKAGE_VERSION}" \
--define "homepage ${{ env.HOMEPAGE }}" \
--define "distname ${{ matrix.name }}" \
--define "hydrasdr_host_version ${{ needs.extract-version.outputs.hydrasdr_host_version }}" \
--define "temp_install ${TEMP_INSTALL_DIR}" \
--define "__brp_check_rpaths %{nil}" \
--define "_binaries_in_noarch_packages_terminate_build 0" \
${PACKAGE_NAME_FULL}.spec
else
rpmbuild -bb \
--define "version ${PACKAGE_VERSION}" \
--define "homepage ${{ env.HOMEPAGE }}" \
--define "distname ${{ matrix.name }}" \
--define "hydrasdr_host_version ${{ needs.extract-version.outputs.hydrasdr_host_version }}" \
--define "temp_install ${TEMP_INSTALL_DIR}" \
--define "__brp_check_rpaths %{nil}" \
--define "_binaries_in_noarch_packages_terminate_build 0" \
${PACKAGE_NAME_FULL}.spec
fi
# Copy RPM to build directory with consistent naming
if [[ "${{ matrix.pkg_manager }}" == "zypper" ]]; then
# openSUSE puts RPMs in /usr/src/packages/RPMS
find ${RPM_BUILD_ROOT}/RPMS -name "*.rpm" -ls
find ${RPM_BUILD_ROOT}/RPMS -name "*.rpm" -exec cp {} "${BUILD_DIR}/${{ env.PACKAGE_NAME }}-${{ matrix.name }}-v${PACKAGE_VERSION}.rpm" \;
else
# Fedora/RHEL puts RPMs in ~/rpmbuild/RPMS
find ~/rpmbuild/RPMS -name "*.rpm" -ls
find ~/rpmbuild/RPMS -name "*.rpm" -exec cp {} "${BUILD_DIR}/${{ env.PACKAGE_NAME }}-${{ matrix.name }}-v${PACKAGE_VERSION}.rpm" \;
fi
# Verify RPM was created
if [ -f "${BUILD_DIR}/${{ env.PACKAGE_NAME }}-${{ matrix.name }}-v${PACKAGE_VERSION}.rpm" ]; then
echo "SUCCESS: Created RPM package: ${{ env.PACKAGE_NAME }}-${{ matrix.name }}-v${PACKAGE_VERSION}.rpm"
ls -la "${BUILD_DIR}/${{ env.PACKAGE_NAME }}-${{ matrix.name }}-v${PACKAGE_VERSION}.rpm"
else
echo "ERROR: Failed to create RPM package"
echo "Available RPM files in all locations:"
find ${RPM_BUILD_ROOT}/RPMS -name "*.rpm" -ls 2>/dev/null || echo "No RPM files in ${RPM_BUILD_ROOT}/RPMS"
find ~/rpmbuild/RPMS -name "*.rpm" -ls 2>/dev/null || echo "No RPM files in ~/rpmbuild/RPMS"
exit 1
fi
# === Upload artifacts ===
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGE_NAME }}-${{ matrix.name }}-v${{ needs.extract-version.outputs.version }}
path: ${{ env.PACKAGE_NAME }}-${{ matrix.name }}-v${{ needs.extract-version.outputs.version }}/*
retention-days: 30
- name: Upload .deb package
if: matrix.create_deb == true
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGE_NAME }}-${{ matrix.name }}-v${{ needs.extract-version.outputs.version }}-deb
path: "${{ env.PACKAGE_NAME }}-${{ matrix.name }}-v*.deb"
retention-days: 30
- name: Pre-upload RPM verification
if: matrix.create_rpm == true
run: |
echo "=== Pre-upload RPM verification ==="
echo "Job: build_linux_distros"
echo "Matrix name: ${{ matrix.name }}"
echo "Matrix create_rpm: ${{ matrix.create_rpm }}"
echo "Expected RPM: ${{ env.PACKAGE_NAME }}-${{ matrix.name }}-v${{ needs.extract-version.outputs.version }}.rpm"
echo "Upload pattern: ${{ env.PACKAGE_NAME }}-${{ matrix.name }}-v*.rpm"
echo ""
# Check if the specific file exists
RPM_FILE="${{ env.PACKAGE_NAME }}-${{ matrix.name }}-v${{ needs.extract-version.outputs.version }}.rpm"
if [ -f "$RPM_FILE" ]; then
echo "✅ Target RPM file exists: $RPM_FILE"
ls -la "$RPM_FILE"
else
echo "❌ Target RPM file missing: $RPM_FILE"
exit 1
fi
# Check what files match the upload pattern
echo ""
echo "=== Files matching upload pattern ==="
ls -la ${{ env.PACKAGE_NAME }}-${{ matrix.name }}-v*.rpm 2>/dev/null || echo "No files match the upload pattern"
# Double-check working directory
echo ""
echo "=== Current working directory ==="
pwd
echo ""
echo "=== All RPM files in current directory ==="
find . -maxdepth 1 -name "*.rpm" -type f -exec ls -la {} \;
- name: Upload .rpm package
if: matrix.create_rpm == true
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGE_NAME }}-${{ matrix.name }}-v${{ needs.extract-version.outputs.version }}-rpm
path: "${{ env.PACKAGE_NAME }}-${{ matrix.name }}-v*.rpm"
retention-days: 30
if-no-files-found: error
- name: Post-upload RPM confirmation
if: matrix.create_rpm == true
run: |
echo "=== Post-upload confirmation ==="
echo "Job: build_linux_distros"
echo "If you see this message, the upload step completed"
echo "Check the GitHub Actions Artifacts section for:"
echo " ${{ env.PACKAGE_NAME }}-${{ matrix.name }}-v${{ needs.extract-version.outputs.version }}-rpm"
create_full_archive:
needs: [extract-version, build, build_linux_distros]
runs-on: ubuntu-latest
steps:
- name: Download All Builds
uses: actions/download-artifact@v4
- name: Create platform-specific archives
run: |
mkdir soapyhydrasdr_all
# Copy all native package files
echo "=== Looking for .deb packages ==="
find . -name "${{ env.PACKAGE_NAME }}-*-v*.deb" -exec ls -la {} \; -exec cp {} soapyhydrasdr_all/ \;
echo "=== Looking for .rpm packages ==="
find . -name "${{ env.PACKAGE_NAME }}-*-v*.rpm" -exec ls -la {} \; -exec cp {} soapyhydrasdr_all/ \;
echo "=== Looking for .pkg.tar.* packages ==="
find . -name "${{ env.PACKAGE_NAME }}-*-v*.pkg.tar.*" -exec ls -la {} \; -exec cp {} soapyhydrasdr_all/ \;
# Create archives for platforms without native packages
for dir in ${{ env.PACKAGE_NAME }}-*; do
if [ -d "$dir" ]; then
if [[ "$dir" == *"-deb" ]] || [[ "$dir" == *"-rpm" ]] || [[ "$dir" == *"-pkg" ]]; then
continue
fi
if [[ "$dir" == *"Windows"* ]]; then
cd "$dir" && zip -r "../soapyhydrasdr_all/${dir}.zip" . && cd ..
elif [[ "$dir" == *"macOS"* ]]; then
tar -czf "soapyhydrasdr_all/${dir}.tar.gz" -C "$dir" .
elif [[ "$dir" == *"Ubuntu-24.04"* ]] || [[ "$dir" == *"Ubuntu-22.04"* ]]; then
# Always create ZIP archives for Ubuntu (CI/CD requirement)
cd "$dir" && zip -r "../soapyhydrasdr_all/${dir}.zip" . && cd ..
fi
fi
done
echo "=== Final contents of soapyhydrasdr_all ==="
ls -la soapyhydrasdr_all/
echo "=== Summary of package types ==="
echo "DEB packages:"
ls soapyhydrasdr_all/*.deb 2>/dev/null || echo "No .deb packages found"
echo "RPM packages:"
ls soapyhydrasdr_all/*.rpm 2>/dev/null || echo "No .rpm packages found"
echo "PKG packages:"
ls soapyhydrasdr_all/*.pkg.tar.* 2>/dev/null || echo "No .pkg packages found"
echo "Archive files:"
ls soapyhydrasdr_all/*.{zip,tar.gz} 2>/dev/null || echo "No archive files found"
- name: Upload Full Archive
uses: actions/upload-artifact@v4
with:
name: soapyhydrasdr_all
path: soapyhydrasdr_all/*
update_nightly_release:
needs: [extract-version, create_full_archive]
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
steps:
- name: Download All Builds
uses: actions/download-artifact@v4
- name: Create or Update Nightly Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Delete existing nightly release
gh release delete nightly -R ${{github.repository}} --yes || echo "Nightly release doesn't exist"
# Create fresh nightly release
gh release create nightly -R ${{github.repository}} --title "Nightly Build" --notes "Automated nightly build from CI - Built from commit ${{ github.sha }} with LibHydraSDR ${{ needs.extract-version.outputs.hydrasdr_host_version }}" --prerelease
# Upload platform-specific archives
if [ -d "soapyhydrasdr_all" ] && [ "$(ls -A soapyhydrasdr_all)" ]; then
gh release upload nightly soapyhydrasdr_all/* -R ${{github.repository}}
fi
- name: Update Release Notes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release edit nightly -R ${{github.repository}} --notes "Automated nightly build from CI
**Built from commit:** ${{ github.sha }}
**Build Date:** $(date -u)
**Branch:** ${{ github.ref_name }}
**SoapyHydraSDR Version:** ${{ needs.extract-version.outputs.version }}
**LibHydraSDR Version:** ${{ needs.extract-version.outputs.hydrasdr_host_version }}
## SoapySDR Module for HydraSDR RFOne
This release provides SoapySDR driver modules for HydraSDR RFOne software-defined radio hardware, enabling seamless integration with the SoapySDR ecosystem and applications like GQRX, SDR++, GNU Radio, and more.
**Key Features:**
- Built with latest LibHydraSDR (${{ needs.extract-version.outputs.hydrasdr_host_version }}) from source
- **Built against SoapySDR ABI 0.8-3** for compatibility with source-built SoapySDR
- No hardcoded dependencies - always uses latest HydraSDR host libraries
- Full SoapySDR integration for all compatible applications
- Multi-platform native packages with automatic dependency management
- Comprehensive distribution support
- Module installs to multiple SoapySDR paths for maximum compatibility
**Important:** For best compatibility, build SoapySDR from source:
\`\`\`bash
git clone https://github.com/pothosware/SoapySDR.git
cd SoapySDR && mkdir build && cd build
cmake .. && make -j\$(nproc) && sudo make install && sudo ldconfig
\`\`\`
For detailed installation instructions and usage information, see the project README."
|