Skip to content

Commit

Permalink
CI: Fix Appimage build
Browse files Browse the repository at this point in the history
  • Loading branch information
vladisslav2011 committed Sep 24, 2024
1 parent 0b529eb commit 10d3431
Show file tree
Hide file tree
Showing 2 changed files with 137 additions and 76 deletions.
162 changes: 124 additions & 38 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,63 +6,149 @@ on:
- v*
- test*

env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

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 base dependencies
- name: Install dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends \
libopengl0 \
libegl1
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
- 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
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
git checkout 2020.12
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
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
cd /tmp
apt install -y gawk bison
wget -c https://ftp.gnu.org/gnu/glibc/glibc-2.28.tar.gz
tar -zxf glibc-2.28.tar.gz
cd glibc-2.28
mkdir glibc-build
cd glibc-build
echo "bindir = /usr/bin" > configparms
echo "sbindir = /sbin" >> configparms
echo "libdir = /lib/x86_64-linux-gnu" >> configparms
echo "slibdir = /lib/x86_64-linux-gnu" >> configparms
echo "sysconfdir = /etc" >> configparms
../configure --prefix=/opt/glibc-2.28
make -j4
make install DESTDIR=$(pwd)/../install
cp -var ../install/* /
/lib/x86_64-linux-gnu/ld-2.28.so /bin/ln -sf /lib/x86_64-linux-gnu/ld-2.28.so /lib64/ld-linux-x86-64.so.2
ldconfig
- name: Checkout code
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 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX ..
cmake ..
- name: Compile
shell: bash -el {0}
working-directory: build
run: |
make -j4
make install
run: make -j4
- 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@v4
Expand Down
51 changes: 13 additions & 38 deletions appimage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,19 @@
# 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 installation into a
# prefix passed as the PREFIX variable
# * 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)
# * 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

# 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"
# Tweak this please: this is the path of the gqrx executable relative to
#the project root will reside after build
APP="build/src/gqrx"

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

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

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

Expand All @@ -63,15 +62,12 @@ 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/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage"
wget -c -nv "https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/continuous/linuxdeploy-plugin-appimage-x86_64.AppImage"
chmod a+x *.AppImage

# 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
# abra-cadabra
mkdir -p ./AppDir/usr/lib
cp -R /usr/lib/x86_64-linux-gnu/SoapySDR/modules* ./AppDir/usr/soapy-modules

# force otherwise excluded libraries that we really need because of library
# dependence on newer versions
Expand All @@ -93,34 +89,13 @@ linuxdeploy_lib_args+=(
)

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

# 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
./linuxdeploy-x86_64.AppImage -e "$APP" -d "$DESKTOP" -i "$ICON" -p qt --output appimage --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

0 comments on commit 10d3431

Please sign in to comment.