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

Build AppImage based on conda packages #1301

Merged
merged 10 commits into from
Feb 15, 2024
143 changes: 40 additions & 103 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,125 +6,62 @@ jobs:
appimage:
name: AppImage
runs-on: ubuntu-latest
container:
image: "ubuntu:18.04"
env:
DEBIAN_FRONTEND: noninteractive
APPIMAGE_EXTRACT_AND_RUN: "1"
steps:
- name: Install dependencies
- name: Install base dependencies
run: |
apt-get update -qq
apt-get install -y --no-install-recommends software-properties-common
add-apt-repository -y ppa:gnuradio/gnuradio-releases
add-apt-repository -y ppa:git-core/ppa
apt-get install -y --no-install-recommends \
git \
build-essential \
autoconf \
automake \
cmake \
libtool \
wget \
qt5-default \
qt5-gtk-platformtheme \
qttranslations5-l10n \
libqt5svg5-dev \
libboost-dev \
libpulse-dev \
portaudio19-dev \
liblog4cpp5-dev \
gnuradio-dev \
libairspy-dev \
libairspyhf-dev \
libfreesrp-dev \
libhackrf-dev \
libusb-1.0-0-dev \
libsoapysdr-dev \
soapysdr-module-remote \
libuhd-dev \
liborc-0.4-dev \
libhidapi-dev

cd /tmp
git clone https://gitea.osmocom.org/sdr/rtl-sdr.git
cd rtl-sdr
git checkout v2.0.1
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr -DDETACH_KERNEL_DRIVER=ON ..
make -j4
make install
ldconfig

cd /tmp
git clone https://github.com/Nuand/bladeRF.git
cd bladeRF
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr ..
make -j4
make install
ldconfig

cd /tmp
git clone https://github.com/dl1ksv/gr-fcdproplus.git
cd gr-fcdproplus
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr ..
make -j4
make install
ldconfig

cd /tmp
git clone https://gitea.osmocom.org/sdr/libosmo-dsp.git
cd libosmo-dsp
autoreconf -i
./configure --prefix=/usr
make -j4
make install
ldconfig
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends \
libopengl0 \
libegl1

cd /tmp
git clone https://gitea.osmocom.org/sdr/gr-iqbal.git
cd gr-iqbal
git checkout gr3.8
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_MODULES_DIR=/usr/lib/x86_64-linux-gnu/cmake ..
make -j4
make install
ldconfig

cd /tmp
git clone https://gitea.osmocom.org/sdr/gr-osmosdr.git
cd gr-osmosdr
git checkout origin/gr3.8
git cherry-pick -n 9c09c90d920dd4906fa8bb9d8443eef84d2565a3
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_MODULES_DIR=/usr/lib/x86_64-linux-gnu/cmake -DENABLE_PYTHON=False ..
make -j4
make install
ldconfig
- name: Install conda dependencies
id: setup-micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-name: gqrx
create-args: >-
c-compiler
cxx-compiler
cmake
make
pkg-config
gnuradio-core
gnuradio-osmosdr
libboost-headers
mesa-libgl-devel-cos6-x86_64
pybind11
pulseaudio
qt6-gtk-platformtheme
qt6-main
soapysdr-module-lms7
soapysdr-module-plutosdr
soapysdr-module-remote
volk
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure
shell: bash -el {0}
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
mkdir build
cd build
cmake ..
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX ..
- name: Compile
shell: bash -el {0}
working-directory: build
run: make -j4
run: |
make -j4
make install
- name: Build AppImage
shell: bash -el {0}
env:
APPIMAGE_EXTRACT_AND_RUN: "1"
PREFIX: ${{ steps.setup-micromamba.outputs.environment-path }}
run: ./appimage.sh
- name: Save artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: gqrx-appimage-${{ github.run_id }}
path: Gqrx-*.AppImage
Expand Down
72 changes: 59 additions & 13 deletions appimage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,20 @@
# Requirements:
# * VERSION as an ENV var, if not detected will use actual github
# version + commit info
# * This must be run after a successfully build, and need to set the
# APP var below to the path of the executable (default is the current
# travis build place: build/src/gqrx)
# * This must be run after a successfully build and installation into a
# prefix passed as the PREFIX variable
# * Must be run on a Linux version as old as the far distro you need to
# support, tested successfully on Ubuntu 14.04 Trusty Tar
# * If you plan to use the "-u" option you need to configure some things
# for it to work, check this https://github.com/probonopd/uploadtool#usage
#
# On any troubles invoke stdevPavelmc in github

# Tweak this please: this is the path of the gqrx executable relative to
#the project root will reside after build
APP="build/src/gqrx"
# PREFIX variable must be set before calling this script. It points to the
# prefix in which gqrx is installed and from which dependency libraries will be
# gathered.
#PREFIX="micromamba/envs/gqrx"
APP="$PREFIX/bin/gqrx"

# No need to tweak below unless you move files on the actual project
DESKTOP="dk.gqrx.gqrx.desktop"
Expand All @@ -41,12 +42,12 @@ echo ""

# basic tests
if [ ! -f "$APP" ] ; then
echo "Error: the app file is no in the path we need it, update the APP var on this script"
echo "Error: the app file is no in the path we need it, set the PREFIX var before running this script"
exit 1
fi

if [ ! -f "$DESKTOP" ] ; then
echo "Error: can't find the desktop file, please update the DESKTOP var on the scriot"
echo "Error: can't find the desktop file, please update the DESKTOP var on the script"
exit 1
fi

Expand All @@ -62,19 +63,64 @@ rm -rdf Gqrx-*.AppImage 2>/dev/null
# download & set all needed tools
wget -c -nv "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
wget -c -nv "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage"
wget -c -nv "https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/continuous/linuxdeploy-plugin-appimage-x86_64.AppImage"
wget -c -nv "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage"
chmod a+x *.AppImage

# abra-cadabra
mkdir -p ./AppDir/usr/lib
cp -R /usr/lib/x86_64-linux-gnu/SoapySDR/modules* ./AppDir/usr/soapy-modules
# build library arguments so soapy module dependencies are included
soapy_module_libs=("$PREFIX"/lib/SoapySDR/modules*/*)
linuxdeploy_lib_args=()
for lib in ${soapy_module_libs[@]}; do
linuxdeploy_lib_args+=( "-l" "$lib" )
done

# force otherwise excluded libraries that we really need because of library
# dependence on newer versions
linuxdeploy_lib_args+=(
"-l" "$PREFIX"/lib/libasound.so.2
"-l" "$PREFIX"/lib/libexpat.so.1
"-l" "$PREFIX"/lib/libfontconfig.so.1
"-l" "$PREFIX"/lib/libfreetype.so.6
"-l" "$PREFIX"/lib/libgcc_s.so.1
"-l" "$PREFIX"/lib/libgmp.so.10
"-l" "$PREFIX"/lib/libgpg-error.so.0
"-l" "$PREFIX"/lib/libharfbuzz.so.0
"-l" "$PREFIX"/lib/libjack.so.0
"-l" "$PREFIX"/lib/libstdc++.so.6
"-l" "$PREFIX"/lib/libusb-1.0.so.0
"-l" "$PREFIX"/lib/libuuid.so.1
"-l" "$PREFIX"/lib/libxcb.so.1
"-l" "$PREFIX"/lib/libz.so.1
)

mkdir -p ./AppDir/apprun-hooks
echo 'export CONDA_PREFIX="$APPDIR/usr"' >./AppDir/apprun-hooks/soapy-hook.sh
echo 'export UHD_PKG_PATH="$APPDIR/usr"' >./AppDir/apprun-hooks/uhd-hook.sh
echo 'export FONTCONFIG_FILE="$APPDIR/etc/fonts/fonts.conf"
export FONTCONFIG_PATH="$APPDIR/etc/fonts"' >./AppDir/apprun-hooks/fontconfig-hook.sh

./linuxdeploy-x86_64.AppImage -e "$APP" -d "$DESKTOP" -i "$ICON" -p qt --output appimage --appdir=./AppDir
# since libs come from prefix, little use in querying copyright files with dpkg-query
export DISABLE_COPYRIGHT_FILES_DEPLOYMENT=1

# need to set QMAKE variable for linuxdeploy-plugin-qt so it uses PREFIX's Qt
export QMAKE="$PREFIX/bin/qmake6"

./linuxdeploy-x86_64.AppImage -e "$APP" -d "$DESKTOP" -i "$ICON" "${linuxdeploy_lib_args[@]}" -p qt --appdir=./AppDir
RESULT=$?

# copy Soapy modules into their expected path in the AppDir
cp -R "$PREFIX"/lib/SoapySDR ./AppDir/usr/lib/SoapySDR

# copy fontconfig configuration files that the FONTCONFIG_FILE env var points to
mkdir -p ./AppDir/etc/
cp -RL "$PREFIX"/etc/fonts ./AppDir/etc/fonts
# remove any config file lines that refer to the old prefix if it's not /usr
if [ "${PREFIX:0:4}" != "/usr" ] ; then
sed -i "\|$PREFIX|d" ./AppDir/etc/fonts/fonts.conf
fi

# finally make the AppImage
./appimagetool-x86_64.AppImage AppDir/

# check build success
if [ $RESULT -ne 0 ] ; then
# warning something gone wrong
Expand Down