Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sdrsharp: add package #4261

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lists/to-release
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sdrsharp
87 changes: 87 additions & 0 deletions packages/sdrsharp/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

# Initial PKGBUILD from AUR.
# Old Maintainer: Echo J. <aidas957 at gmail dot com>
# Old Contributor: Viktor Drobot (aka dviktor) linux776 [at] gmail [dot] com
# shellcheck shell=bash disable=SC2034,SC2164

pkgname=sdrsharp
pkgver=1.0.0.1457
pkgrel=5
pkgdesc="The most popular SDR program"
arch=(i686 x86_64)
groups=('blackarch' 'blackarch-radio')
url="https://airspy.com"
license=(LicenseRef-SDRSharp) # It's basically identical to MS-RSL (which may not be suitable for binaries)
depends=('alsa-lib' 'bash' 'hicolor-icon-theme' 'mono' 'portaudio' 'rtl-sdr')
makedepends=('icoutils' 'unzip')
_sdrsharp="${pkgname}-${pkgver}"
source=("${_sdrsharp}.zip::https://www.iz3mez.it/software/SDRSharp/SDRSharp_v${pkgver:(-4)}.zip"
"sdrsharp_wrapper"
"${pkgname}.desktop"
"adsbspy.desktop"
"airspycalibrate.desktop"
"astrospy.desktop"
"spectrumspy.desktop")
noextract=("${_sdrsharp}.zip")
sha512sums=('8319dbb13d07cd0b2199aa381146c9a70eb8ca00e48373013135f6204fe513ec222830d427c25d7c570083402de0cfcbe29d9cf69927c532a5e45a26cc279606'
'1b166b9ab5bf7b91be03d93c5ce621f49c7b8ec4e1775e03d758dd65eb9863b4232233226685390cd253db63ef756fe67bdc03ebec9dd998dda1ee1f9e9dab43'
'188c8611c59c6c0a8666f3e7601036e915dee70b15c6ec41fef66a8ab35b22f056cd45e1455848c395a77485d128eedccd37a7c786001190a66d09626f62ef16'
'81108093640aba8cda04140710dda6b0073b3a49f3610ddf7df0e2dde9689e18e86adcce074338ec00f16e6bf2db8fd0a25af69578d877a2ed0963e6557eb2db'
'b94e6c02fd4e8d6ba3af6fca359e7a89f15b760bffbc392eff483ea44c1ac6699c3c96bf4e4731497234d4c010cd2853a2b03ff209e3f6c89e26b18a502577ed'
'85787ccf6b0fb68c98f624a4096f4919f894ae76f7dc49bc9d8076fae5bb8eae10c4153aacfcb121cb034573aa2c3f834db086e19e230671f3b831a6c3c4e0a1'
'2e86a0e3e987fabf4b3d95eb320e28f079ac566a4d00ac084c1a0ffab080b808776e892fc7fe9c54205e247f3e2f29bc08201d2e113859e5c58a32632519f746')
install="${pkgname}.install"

prepare() {
echo "Extracting SDRSharp archive..."
unzip -q -o ${_sdrsharp}.zip -d ${_sdrsharp}
cd ${_sdrsharp}

rm httpget.exe install-rtlsdr.bat unzip.exe
}

build() {
mkdir build || true

# compile and optimize executables
mono --aot --optimize=all ${_sdrsharp}/*.exe
mv ${_sdrsharp}/*.exe.so build
}

package() {
# install stuff
install -Dm644 "${srcdir}"/${_sdrsharp}/* -t "${pkgdir}"/opt/${pkgname}
install -Dm644 "${srcdir}"/build/*.exe.so "${pkgdir}"/opt/${pkgname} || true

cd "${pkgdir}"/opt/${pkgname}

# link libraries
ln -s /usr/lib/librtlsdr.so librtlsdr.dll
ln -s /usr/lib/libportaudio.so libportaudio.so

# extract/install the icons
for app in AirspyCalibrate AstroSpy SDRSharp SpectrumSpy; do
wrestool -x -t14 ${app}.exe | icotool -x -w 64 -o - - | install -Dm644 \
/dev/stdin "${pkgdir}"/usr/share/icons/hicolor/64x64/apps/${app}.png
done
wrestool -x -t14 ADSBSpy.exe | icotool -x -w 48 -o - - | install -Dm644 \
/dev/stdin "${pkgdir}"/usr/share/icons/hicolor/48x48/apps/ADSBSpy.png

# install the config files
install -Dm644 *.exe.config -t "${pkgdir}"/usr/share/${pkgname}

# install wrapper stuff/desktop entries
install -Dm755 "${srcdir}"/sdrsharp_wrapper -t "${pkgdir}"/usr/bin
for app in ADSBSpy AirspyCalibrate AstroSpy SDRSharp SpectrumSpy; do
[ ${app} = ADSBSpy ] || ln -sf /tmp/${app}.exe.config "${pkgdir}"/opt/${pkgname}/${app}.exe.config
ln -s sdrsharp_wrapper "${pkgdir}"/usr/bin/${app}
ln -s ${app} "${pkgdir}"/usr/bin/${app,,}
done
install -Dm644 "${srcdir}"/*.desktop -t "${pkgdir}"/usr/share/applications

# install license
install -Dm644 LICENSE.txt "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE.txt
}

7 changes: 7 additions & 0 deletions packages/sdrsharp/adsbspy.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Desktop Entry]
Name=ADSBSpy
Type=Application
Comment=ADSB Decoder for Airspy
Exec=ADSBSpy
Icon=ADSBSpy
Categories=HamRadio;Network;
6 changes: 6 additions & 0 deletions packages/sdrsharp/airspycalibrate.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[Desktop Entry]
Name=AirspyCalibrate
Type=Application
Exec=AirspyCalibrate
Icon=AirspyCalibrate
Categories=HamRadio;Network;
7 changes: 7 additions & 0 deletions packages/sdrsharp/astrospy.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Desktop Entry]
Name=AstroSpy
Type=Application
Comment=Radio Astronomy Analysis Tool for Airspy
Exec=AstroSpy
Icon=AstroSpy
Categories=HamRadio;Network;
8 changes: 8 additions & 0 deletions packages/sdrsharp/sdrsharp.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Desktop Entry]
Name=SDR#
Type=Application
Comment=Software Defined Radio
Exec=SDRSharp
Icon=SDRSharp
Keywords=SDRSharp
Categories=HamRadio;Network;
26 changes: 26 additions & 0 deletions packages/sdrsharp/sdrsharp_wrapper
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

set -eu

_PROGRAM=$(basename "$0")
[ "${_PROGRAM}" = "${_PROGRAM,,}" ] && _PROGRAM=$(readlink "$0")
[ "${_PROGRAM}" = "sdrsharp_wrapper" ] && (echo "This can't be executed directly"; exit 1)

[ "${XDG_CONFIG_HOME-default}" == "default" ] && XDG_CONFIG_HOME="$HOME/.config"
SDR_CONFIG_HOME="$XDG_CONFIG_HOME/sdrsharp"
[ ! -d "$SDR_CONFIG_HOME" ] && mkdir -p "$SDR_CONFIG_HOME"

if [ -L /opt/sdrsharp/"${_PROGRAM}".exe.config ]; then
ln -sf "$SDR_CONFIG_HOME"/"${_PROGRAM}".exe.config /tmp/"${_PROGRAM}".exe.config

if [ -f /opt/sdrsharp/"${_PROGRAM}".exe.config.old ] && [ ! -f "$SDR_CONFIG_HOME"/"${_PROGRAM}".exe.config ]; then
cp /opt/sdrsharp/"${_PROGRAM}".exe.config.old "$SDR_CONFIG_HOME"/"${_PROGRAM}".exe.config
fi

[ -f "$SDR_CONFIG_HOME"/"${_PROGRAM}".exe.config ] || cp /usr/share/sdrsharp/"${_PROGRAM}".exe.config "$SDR_CONFIG_HOME"/"${_PROGRAM}".exe.config
fi

# Disable the problematic GTK theming support
export GTK_DATA_PREFIX=

exec mono /opt/sdrsharp/"${_PROGRAM}".exe "$@"
7 changes: 7 additions & 0 deletions packages/sdrsharp/spectrumspy.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Desktop Entry]
Name=SpectrumSpy
Type=Application
Comment=Airspy Spectrum Analyzer
Exec=SpectrumSpy
Icon=SpectrumSpy
Categories=HamRadio;Network;
Loading