diff --git a/.github/workflows/kuiperbuild.yml b/.github/workflows/kuiperbuild.yml new file mode 100644 index 0000000000..8ee6e25b6a --- /dev/null +++ b/.github/workflows/kuiperbuild.yml @@ -0,0 +1,46 @@ +name: Kuiper Scopy Build + +on: [push, pull_request] + +env: + BUILD_HOST: ubuntu-20.04 + USERNAME: github-actions + +jobs: + + build_scopy1_for_kuiper: + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v4 + with: + set-safe-directory: 'true' + + - name: Pull the Docker Image + run: docker pull cristianbindea/scopy1-kuiper:latest + + - name: Create Scopy AppImage + shell: bash + run: | + cd $GITHUB_WORKSPACE + sudo apt update + ./CI/kuiper/create_sysroot.sh install_packages install_qemu + ./CI/kuiper/kuiper_build_process.sh generate_ci_envs + + docker run \ + --mount type=bind,source="$GITHUB_WORKSPACE",target=/home/runner/scopy \ + --env-file $GITHUB_WORKSPACE/CI/kuiper/gh-actions.envs \ + cristianbindea/scopy2-kuiper:latest \ + /bin/bash -c 'cd $HOME && \ + sudo chown -R runner:runner scopy && \ + cd $HOME/scopy && \ + ./CI/kuiper/kuiper_build_process.sh install_packages download_cmake download_crosscompiler move_sysroot build_scopy build_iio-emu create_appdir create_appimage move_appimage + ' + - name: Set short git commit SHA + shell: bash + run: echo "commit_sha=$(git rev-parse --short ${{ github.sha }})" >> "$GITHUB_ENV" + + - uses: actions/upload-artifact@v4 + with: + name: scopy-linux-armhf-${{ env.commit_sha }} + path: ${{ github.workspace }}/Scopy-armhf.AppImage diff --git a/.gitignore b/.gitignore index b070d63264..b3fa412766 100644 --- a/.gitignore +++ b/.gitignore @@ -20,5 +20,7 @@ android*.sh *.apk *.aab !CI/android/* +CI/kuiper/staging +CI/kuiper/scopy.AppDir html/ build_arm64-v8a/ diff --git a/CI/kuiper/AppRun b/CI/kuiper/AppRun new file mode 100755 index 0000000000..b936ee66ef --- /dev/null +++ b/CI/kuiper/AppRun @@ -0,0 +1,12 @@ +#!/bin/bash +set -e +SELF=$(readlink -f "$0") +HERE=${SELF%/*} + +export QT_PLUGIN_PATH=$HERE/usr/plugins +export QT_QPA_PLATFORM_PLUGIN_PATH=$HERE/usr/plugins/platforms +export LD_LIBRARY_PATH=$HERE/usr/lib + +ldd $HERE/usr/bin/scopy + +exec $HERE/usr/bin/scopy diff --git a/CI/kuiper/build_qt.sh b/CI/kuiper/build_qt.sh new file mode 100755 index 0000000000..600ca8e0a1 --- /dev/null +++ b/CI/kuiper/build_qt.sh @@ -0,0 +1,75 @@ +#!/bin/bash + +set -ex +SRC_DIR=$(git rev-parse --show-toplevel) +source $SRC_DIR/CI/kuiper/kuiper_build_config.sh + +install_packages(){ + sudo apt install -y build-essential cmake unzip gfortran gcc git bison \ + python gperf pkg-config gdb-multiarch g++ flex texinfo gawk openssl \ + pigz libncurses-dev autoconf automake tar figlet libclang-dev +} + +# Download and extract QT Source (QT 5.15.2) +download_qt(){ + mkdir -p ${STAGING_AREA} + pushd ${STAGING_AREA} + if [ ! -d qt-everywhere-src ];then + wget --progress=dot:giga ${QT_DOWNLOAD_LINK} + tar -xf qt-everywhere-src-*.tar.xz && rm qt-everywhere-src-*.tar.xz && mv qt-everywhere-src-* qt-everywhere-src # unzip and rename + cd qt-everywhere-src + patch -p1 < $SRC_DIR/CI/kuiper/qt_patch.patch # Patch QT Source + else + echo "QT already downloaded" + fi + popd +} + +download_crosscompiler(){ + mkdir -p ${STAGING_AREA} + pushd ${STAGING_AREA} + if [ ! -d cross-pi-gcc ];then + wget --progress=dot:giga ${CROSSCOMPILER_DOWNLOAD_LINK} + tar -xf cross-gcc-*.tar.gz && rm cross-gcc-*.tar.gz && mv cross-pi-* cross-pi-gcc # unzip and rename + else + echo "Crosscompiler already downloaded" + fi + popd +} + +build_qt5.15.2(){ + mkdir -p $STAGING_AREA/build-qt5.15.2 && cd $STAGING_AREA/build-qt5.15.2 + ../qt-everywhere-src/configure \ + -v \ + -release \ + -opensource \ + -confirm-license \ + -sysroot $SYSROOT \ + -prefix $QT_SYSTEM_LOCATION \ + -extprefix $QT_BUILD_LOCATION \ + -eglfs \ + -opengl es2 \ + -device linux-rasp-pi4-v3d-g++ \ + -device-option CROSS_COMPILE=$CROSS_COMPILER/bin/arm-linux-gnueabihf- \ + -skip qtscript \ + -skip qtwayland \ + -skip qtwebengine \ + -nomake tests \ + -make libs \ + -pkg-config \ + -no-use-gold-linker \ + -recheck \ + -xcb \ + -xcb-xlib \ + -bundled-xcb-xinput \ + -qt-pcre \ + -qpa eglfs \ + -L$SYSROOT/usr/lib/arm-linux-gnueabihf -I$SYSROOT/usr/include/arm-linux-gnueabihf + + make -j14 + sudo make install # installs to $QT_BUILD_LOCATION +} + +for arg in $@; do + $arg +done diff --git a/CI/kuiper/cmake_toolchain.cmake b/CI/kuiper/cmake_toolchain.cmake new file mode 100644 index 0000000000..5209043079 --- /dev/null +++ b/CI/kuiper/cmake_toolchain.cmake @@ -0,0 +1,89 @@ +cmake_minimum_required(VERSION 3.18) + +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR arm) +set(CMAKE_LIBRARY_ARCHITECTURE arm-linux-gnueabihf) + +# In this case the variables CMAKE_SYSROOT and STAGING_AREA are defined as parameters to the cmake command +set(TOOLCHAIN_FILE ${STAGING_AREA}/cross-pi-gcc) +set(TOOLCHAIN_BIN ${TOOLCHAIN_FILE}/bin) +set(CMAKE_PREFIX_PATH ${QT_LOCATION}) +list(APPEND CMAKE_PREFIX_PATH "${CMAKE_SYSROOT}/usr/lib/arm-linux-gnueabihf") +list(APPEND CMAKE_PREFIX_PATH "${CMAKE_SYSROOT}/lib") +set(CMAKE_VERBOSE ON) + +set(PKG_CONFIG_EXECUTABLE "${CMAKE_SYSROOT}/usr/bin/arm-linux-gnueabihf-pkg-config" CACHE PATH "PKG_CONFIG_EXECUTABLE" + FORCE +) +set(ENV{PKG_CONFIG_ALLOW_CROSS} 1) +set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH ON) +set(RPI_PKG_CONFIG_LIBDIR "${CMAKE_SYSROOT}/usr/lib/arm-linux-gnueabihf/pkgconfig:${RPI_PKG_CONFIG_LIBDIR}") +set(RPI_PKG_CONFIG_LIBDIR "${CMAKE_SYSROOT}/usr/share/pkgconfig:${RPI_PKG_CONFIG_LIBDIR}") +set(RPI_PKG_CONFIG_LIBDIR "${CMAKE_SYSROOT}/usr/lib/pkgconfig:${RPI_PKG_CONFIG_LIBDIR}") +set(RPI_PKG_CONFIG_LIBDIR "${CMAKE_SYSROOT}/usr/local/lib/pkgconfig:${RPI_PKG_CONFIG_LIBDIR}") +set(ENV{PKG_CONFIG_LIBDIR} "${RPI_PKG_CONFIG_LIBDIR}") +set(ENV{PKG_CONFIG} "${CMAKE_SYSROOT}/usr/bin/arm-linux-gnueabihf-pkg-config") + +set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${CMAKE_SYSROOT}/include:") +set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${CMAKE_SYSROOT}/usr/include:") +set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${CMAKE_SYSROOT}/usr/include/arm-linux-gnueabihf:") +set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${CMAKE_SYSROOT}/usr/share/include:") + +set(ENV{PKG_CONFIG_SYSROOT_DIR} "${CMAKE_SYSROOT}") +set(ENV{LD_LIBRARY_PATH} "${CMAKE_SYSROOT}/usr/lib/arm-linux-gnueabihf:$ENV{LD_LIBRARY_PATH}") + +set(CMAKE_LIBRARY_PATH "${CMAKE_SYSROOT}/usr/lib") +set(CMAKE_LIBRARY_PATH "${CMAKE_LIBRARY_PATH} ${CMAKE_SYSROOT}/usr/lib/arm-linux-gnueabihf") +set(CMAKE_LIBRARY_PATH "${CMAKE_LIBRARY_PATH} ${CMAKE_SYSROOT}/usr/local/lib") +set(CMAKE_LIBRARY_PATH "${CMAKE_LIBRARY_PATH} ${CMAKE_SYSROOT}/usr/local/lib/arm-linux-gnueabihf") + +set(CMAKE_AR ${TOOLCHAIN_BIN}/arm-linux-gnueabihf-ar) +set(CMAKE_ASM_COMPILER ${TOOLCHAIN_BIN}/arm-linux-gnueabihf-gcc) +set(CMAKE_C_COMPILER ${TOOLCHAIN_BIN}/arm-linux-gnueabihf-gcc) +set(CMAKE_CXX_COMPILER ${TOOLCHAIN_BIN}/arm-linux-gnueabihf-g++) +set(CMAKE_LINKER ${TOOLCHAIN_BIN}/arm-linux-gnueabihf-ld) +set(CMAKE_OBJCOPY ${TOOLCHAIN_BIN}/arm-linux-gnueabihf-objcopy) +set(CMAKE_RANLIB ${TOOLCHAIN_BIN}/arm-linux-gnueabihf-ranlib) +set(CMAKE_SIZE ${TOOLCHAIN_BIN}/arm-linux-gnueabihf-size) +set(CMAKE_STRIP ${TOOLCHAIN_BIN}/arm-linux-gnueabihf-strip) + +set(CMAKE_C_FLAGS "-march=armv7-a -mfloat-abi=hard -mfpu=vfp") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${CMAKE_SYSROOT}/include") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${CMAKE_SYSROOT}/usr/include") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${CMAKE_SYSROOT}/usr/include/arm-linux-gnueabihf") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${CMAKE_SYSROOT}/usr/share/include") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") +set(CMAKE_CXX_FLAGS "-fexceptions -frtti ${CMAKE_C_FLAGS}") +set(CMAKE_CXX_FLAGS_DEBUG "-Os -g") +set(CMAKE_CXX_FLAGS_RELEASE "-Os -DNDEBUG") +set(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,-O1 -Wl,--hash-style=gnu -mthumb -lpthread -pthread") +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L${CMAKE_SYSROOT}/usr/lib/arm-linux-gnueabihf") +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L${CMAKE_SYSROOT}/usr/lib") +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L${CMAKE_SYSROOT}/usr/local/lib") +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L${QT_LOCATION}/lib") +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L${TOOLCHAIN_FILE}/arm-linux-gnueabihf/lib") +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L${TOOLCHAIN_FILE}/arm-linux-gnueabihf/libc/lib") +set(CMAKE_SHARED_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS}) + +#[[ +# Debug Mode +set(PKG_CONFIG_ARGN "--debug") +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--verbose ") +]] + +set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) # Perform compiler test with static library +set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) +set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) +set(CMAKE_INSTALL_RPATH + "$ORIGIN" + "$ORIGIN/../lib" + "/usr/lib/arm-linux-gnueabihf" + "/lib/arm-linux-gnueabihf" + "/lib" + "/usr/local/qt5.15/lib" +) +set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) diff --git a/CI/kuiper/copy-deps.sh b/CI/kuiper/copy-deps.sh new file mode 100755 index 0000000000..33069ce9da --- /dev/null +++ b/CI/kuiper/copy-deps.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +set -e +SRC_DIR=$(git rev-parse --show-toplevel) +source $SRC_DIR/CI/kuiper/kuiper_build_config.sh + +BINARY=$1 +LOCATION=$2 + + +if [ ! -f "${SRC_DIR}"/CI/kuiper/ldd-mod ]; then + sed 's|.*RTLDLIST=.*|RTLDLIST="/usr/arm-linux-gnueabihf/lib/ld-2.31.so /usr/arm-linux-gnueabihf/lib/ld-linux-armhf.so.3"|' /usr/bin/ldd | tee "${SRC_DIR}"/CI/kuiper/ldd-mod + chmod +x "${SRC_DIR}"/CI/kuiper/ldd-mod +fi + +export LD_LIBRARY_PATH="${APP_DIR}/usr/lib:${SYSROOT}/lib:${SYSROOT}/lib/arm-linux-gnueabihf:${SYSROOT}/usr/arm-linux-gnueabihf/lib:${SYSROOT}/usr/local/qt5.15/lib:${SYSROOT}/usr/local/lib:${SRC_DIR}/build" +LIBS_ARRAY=() +run_ldd(){ + + if [ ! -z "$(${SRC_DIR}/CI/kuiper/ldd-mod $1 | grep "not found")" ]; then + echo "--- LIB NOT FOUND" + ${SRC_DIR}/CI/kuiper/ldd-mod $1 + exit 1 + fi + + for library in $("${SRC_DIR}"/CI/kuiper/ldd-mod "$1" | cut -d '>' -f 2 | awk '{print $1}') + do + # check if the library exists at that path and if it was processed already + if [ -f "${library}" ] && ! [[ "${LIBS_ARRAY[*]}" =~ "${library}" ]]; then + LIBS_ARRAY+=("${library}") + echo "---NEW: ${library}" + if [ ! -f "${LOCATION}"/"${library##*/}" ]; then + cp --verbose "${library}" "${LOCATION}" + [ -L "${library}" ] && cp --verbose "$(realpath "${library}")" "${LOCATION}" + fi + run_ldd "${library}" + fi + done +} + +for arg in $BINARY; do + run_ldd "${arg}" +done diff --git a/CI/kuiper/create_docker_image.sh b/CI/kuiper/create_docker_image.sh new file mode 100755 index 0000000000..a049943811 --- /dev/null +++ b/CI/kuiper/create_docker_image.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +set -ex +SRC_DIR=$(git rev-parse --show-toplevel) +source $SRC_DIR/CI/kuiper/kuiper_build_config.sh + +# install docker +install_packages(){ + sudo apt-get update + sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common + curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - + sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" + sudo apt-get update + sudo apt-get -y install containerd.io docker-ce docker-ce-cli docker-buildx-plugin +} + +create_sysroot(){ + $SRC_DIR/CI/kuiper/create_sysroot.sh \ + install_packages \ + download_kuiper \ + install_qemu \ + extract_sysroot \ + configure_sysroot +} + +# archive the sysroot and move it next to Dockerfile in order to copy the tar in the docker image +tar_and_move_sysroot(){ + pushd $STAGING_AREA + sudo tar -czvf "${SYSROOT_TAR##*/}" sysroot + sudo mv $SYSROOT_TAR $SYSROOT_DOCKER + popd +} + +create_image(){ + pushd ${SRC_DIR}/CI/kuiper/docker + sudo docker build --load --tag cristianbindea/scopy2-kuiper . + # sudo DOCKER_BUILDKIT=0 docker build --tag cristianbindea/scopy2-kuiper . # build the image using old backend + popd +} + +install_packages +create_sysroot +tar_and_move_sysroot +create_image diff --git a/CI/kuiper/create_sysroot.sh b/CI/kuiper/create_sysroot.sh new file mode 100755 index 0000000000..d9ae51bb5b --- /dev/null +++ b/CI/kuiper/create_sysroot.sh @@ -0,0 +1,68 @@ +#!/bin/bash + +set -ex +SRC_DIR=$(git rev-parse --show-toplevel) +source $SRC_DIR/CI/kuiper/kuiper_build_config.sh + +IMAGE_FILE=2023-12-13-ADI-Kuiper-full.img + +install_packages(){ + sudo apt -y install git wget unzip python3 python +} + +download_kuiper(){ + mkdir -p ${STAGING_AREA} + pushd ${STAGING_AREA} + wget --progress=dot:giga ${KUIPER_DOWNLOAD_LINK} + unzip image*.zip + popd +} + +# install qemu needed for the sysroot configuration +install_qemu(){ + sudo apt -y install qemu qemu-system qemu-user-static qemu-user +} + +# mount the Kuiper image and copy the entire rootfs partition +extract_sysroot(){ + sudo mkdir -p /mnt/kuiper + + # with file ${IMAGE_FILE} we can see the start sector (4218880) and the length (19947520) of the second partition contained in the Kuiper image + # using this info we can directly mount that partition + sudo mount -v -o loop,offset=$((512*4218880)),sizelimit=$((512*19947520)) ${STAGING_AREA}/${IMAGE_FILE} /mnt/kuiper + + mkdir -p ${SYSROOT} + sudo cp -arp /mnt/kuiper/* ${SYSROOT} + sudo cp /etc/resolv.conf ${SYSROOT}/etc/resolv.conf + sudo umount /mnt/kuiper + sudo rm -rf /mnt/kuiper + rm -rf ${STAGING_AREA:?}/${IMAGE_FILE} + rm -rf ${STAGING_AREA}/image*.zip +} + + +# execute chroot inside the sysroot folder and install/remove packages using apt +configure_sysroot(){ + cat $SRC_DIR/CI/kuiper/inside_chroot.sh | sudo chroot ${SYSROOT} +} + +move_and_extract_sysroot(){ + if [ -f $HOME/sysroot.tar.gz ]; then + mkdir -p $STAGING_AREA + sudo tar -xf $HOME/sysroot.tar.gz --directory $STAGING_AREA + rm $HOME/sysroot.tar.gz + fi +} + +fix_relativelinks(){ + pushd ${STAGING_AREA} + wget $SYSROOT_RELATIVE_LINKS + chmod +x sysroot-relativelinks.py + sudo ./sysroot-relativelinks.py ${SYSROOT} + popd +} + +for arg in $@; do + $arg +done + diff --git a/CI/kuiper/docker/Dockerfile b/CI/kuiper/docker/Dockerfile new file mode 100644 index 0000000000..9d40c97732 --- /dev/null +++ b/CI/kuiper/docker/Dockerfile @@ -0,0 +1,60 @@ +FROM --platform=linux/amd64 ubuntu:20.04 AS start +SHELL ["/bin/bash", "-c"] +ARG USER=runner +ENV DEBIAN_FRONTEND=noninteractive +ENV TZ=Europe/Bucharest +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone +RUN apt-get update && \ + apt-get -y upgrade && \ + apt-get install -y apt-utils sudo git wget flex bison pkg-config make python3 pip vim +RUN groupadd -g 1000 -r $USER && \ + useradd -u 1000 -g 1000 --create-home -r $USER + +#Change password +RUN echo "$USER:$USER" | chpasswd + +#Make sudo passwordless +RUN echo "${USER} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-$USER && \ + usermod -aG sudo $USER && \ + usermod -aG plugdev $USER + +USER $USER +WORKDIR /home/${USER} + + + +FROM start AS sysroot_builder +ARG USER=runner +ENV DEBIAN_FRONTEND=noninteractive +COPY sysroot.tar.gz /home/${USER} +RUN git clone https://github.com/analogdevicesinc/scopy -b kuiper-worflow +RUN git clone https://github.com/analogdevicesinc/scopy -b dev +WORKDIR /home/${USER}/scopy +RUN ./CI/kuiper/create_sysroot.sh \ + install_packages \ + move_and_extract_sysroot \ + fix_relativelinks +RUN ./CI/kuiper/build_qt.sh \ + install_packages \ + download_qt \ + download_crosscompiler \ + build_qt5.15.2 +RUN ./CI/kuiper/kuiper_build_process.sh \ + install_packages \ + download_cmake \ + download_crosscompiler \ + clone \ + build_deps + + + +FROM start +ARG USER=runner +ENV DEBIAN_FRONTEND=noninteractive +RUN mkdir -p /home/${USER}/sysroot +COPY --from=sysroot_builder /home/${USER}/scopy/CI/kuiper/staging/sysroot/usr /home/${USER}/sysroot/usr +COPY --from=sysroot_builder /home/${USER}/scopy/CI/kuiper/staging/sysroot/share /home/${USER}/sysroot/share +COPY --from=sysroot_builder /home/${USER}/scopy/CI/kuiper/staging/sysroot/include /home/${USER}/sysroot/include +WORKDIR /home/${USER}/sysroot +RUN ln -s usr/bin bin && ln -s usr/lib lib && ln -s usr/sbin sbin +WORKDIR /home/${USER} \ No newline at end of file diff --git a/CI/kuiper/inside_chroot.sh b/CI/kuiper/inside_chroot.sh new file mode 100644 index 0000000000..24b2d3c623 --- /dev/null +++ b/CI/kuiper/inside_chroot.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +export DEBIAN_FRONTEND=noninteractive +ln -snf /usr/share/zoneinfo/Europe/Bucharest /etc/localtime && echo "Europe/Bucharest" > /etc/timezone +echo "LC_ALL=en_US.UTF-8" | tee -a /etc/environment +echo "LANG=en_US.UTF-8" | tee -a /etc/locale.conf +locale-gen en_US.UTF-8 + +sed -i 's/#deb-src/deb-src/' /etc/apt/sources.list + +apt -y purge openjdk* tex-common +apt -y remove gnuradio gnuradio-* libgnuradio-* libvolk* +apt -y remove qt* libqt5* +apt -y autoremove +apt update && apt -y upgrade +apt -y dist-upgrade +dpkg --configure -a + +rm -rf /usr/local/include/volk /usr/local/lib/libvolk* \ + /usr/local/lib/cmake/volk +rm -rf /usr/lib/arm-linux-gnueabihf/libiio.so* \ + usr/local/src/libiio \ + /usr/lib/arm-linux-gnueabihf/pkgconfig/libiio.pc +rm -rf /usr/local/lib/cmake/m2k \ + /usr/local/lib/arm-linux-gnueabihf/pkgconfig/libm2k.pc \ + /usr/local/lib/arm-linux-gnueabihf/pkgconfig/gnuradio-m2k.pc \ + /usr/local/lib/arm-linux-gnueabihf/libgnuradio-m2k.so* \ + /usr/local/lib/arm-linux-gnueabihf/libm2k.so* \ + /usr/local/lib/arm-linux-gnueabihf/cmake/libm2k \ + /usr/local/include/libm2k /usr/local/include/m2k +rm -rf /usr/local/lib/arm-linux-gnueabihf/libgnuradio-iio.so* \ + /usr/local/lib/arm-linux-gnueabihf/pkgconfig/gnuradio-iio.pc \ + /usr/local/lib/cmake/iio +rm -rf /usr/lib/arm-linux-gnueabihf/libad9361.so* \ + /usr/lib/arm-linux-gnueabihf/pkgconfig/libad9361.pc \ + /usr/lib/libad9166.so* \ + /usr/lib/pkgconfig/libad9166.pc + +apt -y build-dep qtbase5-dev || true +apt -y install build-essential gcc g++ gdb-multiarch cmake autoconf automake bison flex git wget pkg-config figlet gawk unzip libsndfile1-dev \ + libudev-dev libinput-dev libts-dev libxcb-xinerama0-dev libxcb-xinerama0 gdbserver libspeechd-dev perl \ + libgl1-mesa-dev libxcb-composite0-dev libxcb-cursor-dev libxcb-damage0-dev libxcb-xv0-dev \ + libxcb-dpms0-dev libxcb-dri2-0-dev libxcb-ewmh-dev libxcb-imdkit-dev libxcb-xvmc0-dev \ + libxcb-present-dev libxcb-record0-dev libxcb-res0-dev libxcb-xrm-dev libx11-xcb-dev libxcb-glx0-dev libxcb-icccm4 libxcb-icccm4-dev libxcb-xkb-dev libxkbcommon-x11-dev \ + libxcb-screensaver0-dev libxcb-util0-dev libxcb-xf86dri0-dev libxcb-xtest0-dev +apt -y install libunwind-dev libsndfile1-dev mesa-utils* mesa-common-dev libglu1-mesa-dev freeglut3-dev mesa-common-dev python2 libopenal-dev || true +apt -y install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev || true + +wget https://raw.githubusercontent.com/abhiTronix/raspberry-pi-cross-compilers/master/utils/SSymlinker +sed -i 's/sudo//g' SSymlinker +chmod +x SSymlinker +./SSymlinker -s /usr/include/arm-linux-gnueabihf/asm -d /usr/include +./SSymlinker -s /usr/include/arm-linux-gnueabihf/gnu -d /usr/include +./SSymlinker -s /usr/include/arm-linux-gnueabihf/bits -d /usr/include +./SSymlinker -s /usr/include/arm-linux-gnueabihf/sys -d /usr/include +./SSymlinker -s /usr/lib/arm-linux-gnueabihf/crtn.o -d /usr/lib/crtn.o +./SSymlinker -s /usr/lib/arm-linux-gnueabihf/crt1.o -d /usr/lib/crt1.o +./SSymlinker -s /usr/lib/arm-linux-gnueabihf/crti.o -d /usr/lib/crti.o \ No newline at end of file diff --git a/CI/kuiper/kuiper_build_config.sh b/CI/kuiper/kuiper_build_config.sh new file mode 100644 index 0000000000..d9d53f5683 --- /dev/null +++ b/CI/kuiper/kuiper_build_config.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +LIBIIO_VERSION=v0.25 +LIBAD9361_BRANCH=main +GLOG_BRANCH=v0.4.0 +LIBM2K_BRANCH=main +SPDLOG_BRANCH=v1.x +VOLK_BRANCH=main +GNURADIO_BRANCH=maint-3.10 +GRSCOPY_BRANCH=3.10 +GRM2K_BRANCH=main +LIBSIGROKDECODE_BRANCH=master +QWT_BRANCH=qwt-multiaxes-updated +LIBTINYIIOD_BRANCH=master +IIOEMU_BRANCH=master + +STAGING_AREA=$SRC_DIR/CI/kuiper/staging +SYSROOT=$STAGING_AREA/sysroot +SYSROOT_TAR=$STAGING_AREA/sysroot.tar.gz +SYSROOT_DOCKER=$SRC_DIR/CI/kuiper/docker/sysroot.tar.gz +TOOLCHAIN=$STAGING_AREA/cross-pi-gcc +TOOLCHAIN_BIN=$TOOLCHAIN/bin +TOOLCHAIN_HOST="arm-linux-gnueabihf" +TOOLCHAIN_FILE=$SRC_DIR/CI/kuiper/cmake_toolchain.cmake +QT_LOCATION=$SYSROOT/usr/local/qt5.15 + +CMAKE_BIN=$STAGING_AREA/cmake/bin/cmake +QMAKE_BIN=$QT_LOCATION/bin/qmake +JOBS=-j14 + +APP_DIR=$SRC_DIR/CI/kuiper/scopy.AppDir +APP_IMAGE=$SRC_DIR/CI/kuiper/Scopy1-armhf.AppImage +APP_RUN=$SRC_DIR/CI/kuiper/AppRun +APP_DESKTOP=$SRC_DIR/CI/kuiper/scopy.desktop +APP_SQUASHFS=$SRC_DIR/CI/kuiper/scopy.squashfs +RUNTIME_ARMHF=$SRC_DIR/CI/kuiper/runtime-armhf + +CMAKE_OPTS=(\ + -DCMAKE_SYSROOT="$SYSROOT" \ + -DQT_LOCATION="$QT_LOCATION" \ + -DSTAGING_AREA="$STAGING_AREA" \ + -DCMAKE_INSTALL_PREFIX="$SYSROOT" \ + -DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN_FILE" \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DCMAKE_VERBOSE_MAKEFILE=ON \ + ) + +CMAKE="$CMAKE_BIN ${CMAKE_OPTS[*]}" + +QT_BUILD_LOCATION=$QT_LOCATION # the location where Qt will be installed in the system +QT_SYSTEM_LOCATION=/usr/local/qt5.15 # the Qt location relative to the sysroot folder +CROSS_COMPILER=$STAGING_AREA/cross-pi-gcc + +CROSSCOMPILER_DOWNLOAD_LINK=https://sourceforge.net/projects/raspberry-pi-cross-compilers/files/Raspberry%20Pi%20GCC%20Cross-Compiler%20Toolchains/Bullseye/GCC%2010.2.0/Raspberry%20Pi%203A%2B%2C%203B%2B%2C%204/cross-gcc-10.2.0-pi_3%2B.tar.gz +CMAKE_DOWNLOAD_LINK=https://github.com/Kitware/CMake/releases/download/v3.29.0-rc2/cmake-3.29.0-rc2-linux-x86_64.tar.gz +KUIPER_DOWNLOAD_LINK=https://swdownloads.analog.com/cse/kuiper/image_2023-12-13-ADI-Kuiper-full.zip +QT_DOWNLOAD_LINK=http://download.qt.io/archive/qt/5.15/5.15.2/single/qt-everywhere-src-5.15.2.tar.xz +SYSROOT_RELATIVE_LINKS=https://raw.githubusercontent.com/abhiTronix/rpi_rootfs/master/scripts/sysroot-relativelinks.py diff --git a/CI/kuiper/kuiper_build_process.sh b/CI/kuiper/kuiper_build_process.sh new file mode 100755 index 0000000000..8cfe7003a2 --- /dev/null +++ b/CI/kuiper/kuiper_build_process.sh @@ -0,0 +1,357 @@ +#!/bin/bash + +set -ex +git config --global --add safe.directory $HOME/scopy +SRC_DIR=$(git rev-parse --show-toplevel) +source $SRC_DIR/CI/kuiper/kuiper_build_config.sh + +echo -- USING CMAKE COMMAND: +echo $CMAKE +echo -- USING QT: $QT +echo -- USING QMAKE: $QMAKE_BIN + +build_with_cmake() { + BUILD_FOLDER=$PWD/build + rm -rf $BUILD_FOLDER + mkdir -p $BUILD_FOLDER + cd $BUILD_FOLDER + $CMAKE $CURRENT_BUILD_CMAKE_OPTS ../ + make $JOBS + CURRENT_BUILD_CMAKE_OPTS="" +} + +set_config_opts() { + CPP="${TOOLCHAIN_BIN}/${TOOLCHAIN_HOST}-cpp" + CC="${TOOLCHAIN_BIN}/${TOOLCHAIN_HOST}-gcc" + CXX="${TOOLCHAIN_BIN}/${TOOLCHAIN_HOST}-g++" + LD="${TOOLCHAIN_BIN}/${TOOLCHAIN_HOST}-ld" + AS="${TOOLCHAIN_BIN}/${TOOLCHAIN_HOST}-as" + AR="${TOOLCHAIN_BIN}/${TOOLCHAIN_HOST}-ar" + RANLIB="${TOOLCHAIN_BIN}/${TOOLCHAIN_HOST}-ranlib" + + CFLAGS=" -I${SYSROOT}/include -I${SYSROOT}/include/arm-linux-gnueabihf -I${SYSROOT}/usr/include -I${SYSROOT}/usr/include/arm-linux-gnueabihf -I${TOOLCHAIN}/include- -fPIC" + CPPFLAGS="-fexceptions ${CFLAGS}" + LDFLAGS="-Wl,-rpath=XORIGIN -L${TOOLCHAIN}/arm-linux-gnueabihf/lib -L${TOOLCHAIN}/arm-linux-gnueabihf/libc/lib -L${TOOLCHAIN}/arm-linux-gnueabihf/libc/usr/lib -L${SYSROOT}/lib -L${SYSROOT}/usr/lib -L${SYSROOT}/usr/lib/arm-linux-gnueabihf -L${SYSROOT}/usr/lib/arm-linux-gnueabihf" + + CONFIG_OPTS=() + CONFIG_OPTS+=("--prefix=${SYSROOT}") + CONFIG_OPTS+=("--host=${TOOLCHAIN_HOST}") + CONFIG_OPTS+=("--with-sysroot=${SYSROOT}") + CONFIG_OPTS+=("CFLAGS=${CFLAGS}") + CONFIG_OPTS+=("CPPFLAGS=${CPPFLAGS}") + CONFIG_OPTS+=("LDFLAGS=${LDFLAGS}") + CONFIG_OPTS+=("PKG_CONFIG=${SYSROOT}/usr/bin/arm-linux-gnueabihf-pkg-config" ) + CONFIG_OPTS+=("PKG_CONFIG_DIR=") + CONFIG_OPTS+=("PKG_CONFIG_LIBDIR=${SYSROOT}/usr/lib/arm-linux-gnueabihf/pkgconfig:${SYSROOT}/usr/share/pkgconfig:${SYSROOT}/usr/lib/arm-linux-gnueabihf/pkgconfig:${SYSROOT}/usr/local/lib/pkgconfig") + CONFIG_OPTS+=("PKG_CONFIG_SYSROOT=${SYSROOT}") + CONFIG_OPTS+=("PKG_CONFIG_SYSROOT_DIR=${SYSROOT}") + CONFIG_OPTS+=("PKG_CONFIG_PATH=${SYSROOT}/usr/bin/arm-linux-gnueabihf-pkg-config") + CONFIG_OPTS+=("PKG_CONFIG_ALLOW_CROSS=1") + CONFIG_OPTS+=("CPP=${CPP}") + CONFIG_OPTS+=("CC=${CC}") + CONFIG_OPTS+=("CXX=${CXX}") + CONFIG_OPTS+=("LD=${LD}") + CONFIG_OPTS+=("AS=${AS}") + CONFIG_OPTS+=("AR=${AR}") + CONFIG_OPTS+=("RANLIB=${RANLIB}") +} + +install_packages() { + sudo apt install -y build-essential cmake unzip gfortran gcc git bison libtool \ + python3 pip gperf pkg-config gdb-multiarch g++ flex texinfo gawk openssl \ + pigz libncurses-dev autoconf automake tar figlet liborc-0.4-dev* patchelf libc6-dev-armhf-cross squashfs-tools + pip install mako +} + +download_cmake() { + mkdir -p ${STAGING_AREA} + pushd ${STAGING_AREA} + if [ ! -d cmake ];then + wget ${CMAKE_DOWNLOAD_LINK} + # unzip and rename + tar -xvf cmake*.tar.gz && rm cmake*.tar.gz && mv cmake* cmake + else + echo "Cmake already downloaded" + fi + popd +} + +download_crosscompiler(){ + mkdir -p ${STAGING_AREA} + pushd ${STAGING_AREA} + if [ ! -d cross-pi-gcc ];then + wget --progress=dot:giga ${CROSSCOMPILER_DOWNLOAD_LINK} + # unzip and rename + tar -xf cross-gcc-*.tar.gz && rm cross-gcc-*.tar.gz && mv cross-pi-* cross-pi-gcc + else + echo "Crosscompiler already downloaded" + fi + popd +} + +clone() { + echo "#######CLONE#######" + mkdir -p $STAGING_AREA + pushd $STAGING_AREA + [ -d 'libiio' ] || git clone --recursive https://github.com/analogdevicesinc/libiio.git -b $LIBIIO_VERSION libiio + [ -d 'libad9361' ] || git clone --recursive https://github.com/analogdevicesinc/libad9361-iio.git -b $LIBAD9361_BRANCH libad9361 + [ -d 'libm2k' ] || git clone --recursive https://github.com/analogdevicesinc/libm2k.git -b $LIBM2K_BRANCH libm2k + [ -d 'spdlog' ] || git clone --recursive https://github.com/gabime/spdlog.git -b $SPDLOG_BRANCH spdlog + [ -d 'gr-scopy' ] || git clone --recursive https://github.com/analogdevicesinc/gr-scopy.git -b $GRSCOPY_BRANCH gr-scopy + [ -d 'gr-m2k' ] || git clone --recursive https://github.com/analogdevicesinc/gr-m2k.git -b $GRM2K_BRANCH gr-m2k + [ -d 'volk' ] || git clone --recursive https://github.com/gnuradio/volk.git -b $VOLK_BRANCH volk + [ -d 'gnuradio' ] || git clone --recursive https://github.com/gnuradio/gnuradio.git -b $GNURADIO_BRANCH gnuradio + [ -d 'qwt' ] || git clone --recursive https://github.com/cseci/qwt.git -b $QWT_BRANCH qwt + [ -d 'libsigrokdecode' ] || git clone --recursive https://github.com/sigrokproject/libsigrokdecode.git -b $LIBSIGROKDECODE_BRANCH libsigrokdecode + [ -d 'libtinyiiod' ] || git clone --recursive https://github.com/analogdevicesinc/libtinyiiod.git -b $LIBTINYIIOD_BRANCH libtinyiiod + popd +} + +build_libiio() { + echo "### Building libiio - version $LIBIIO_VERSION" + pushd $STAGING_AREA/libiio + CURRENT_BUILD_CMAKE_OPTS="\ + -DWITH_TESTS:BOOL=OFF \ + -DWITH_DOC:BOOL=OFF \ + -DHAVE_DNS_SD:BOOL=OFF\ + -DWITH_MATLAB_BINDINGS:BOOL=OFF \ + -DCSHARP_BINDINGS:BOOL=OFF \ + -DPYTHON_BINDINGS:BOOL=OFF \ + -DWITH_SERIAL_BACKEND:BOOL=ON \ + -DENABLE_IPV6:BOOL=OFF \ + -DINSTALL_UDEV_RULE:BOOL=OFF + " + build_with_cmake + sudo make install + popd +} + +build_libad9361() { + echo "### Building libad9361 - branch $LIBAD9361_BRANCH" + pushd $STAGING_AREA/libad9361 + build_with_cmake + sudo make install + popd +} + +build_spdlog() { + echo "### Building spdlog - branch $SPDLOG_BRANCH" + pushd $STAGING_AREA/spdlog + CURRENT_BUILD_CMAKE_OPTS="-DSPDLOG_BUILD_SHARED=ON" + build_with_cmake + sudo make install + popd +} + +build_libm2k() { + echo "### Building libm2k - branch $LIBM2K_BRANCH" + pushd $STAGING_AREA/libm2k + CURRENT_BUILD_CMAKE_OPTS="\ + -DENABLE_PYTHON=OFF \ + -DENABLE_CSHARP=OFF \ + -DBUILD_EXAMPLES=ON \ + -DENABLE_TOOLS=OFF \ + -DINSTALL_UDEV_RULES=OFF \ + -DENABLE_LOG=OFF + " + build_with_cmake + sudo make install + popd +} + +build_volk() { + echo "### Building volk - branch $VOLK_BRANCH" + pushd $STAGING_AREA/volk + build_with_cmake + sudo make install + popd +} + +build_gnuradio() { + echo "### Building gnuradio - branch $GNURADIO_BRANCH" + pushd $STAGING_AREA/gnuradio + CURRENT_BUILD_CMAKE_OPTS="\ + -DENABLE_DEFAULT=OFF \ + -DENABLE_GNURADIO_RUNTIME=ON \ + -DENABLE_GR_ANALOG=ON \ + -DENABLE_GR_BLOCKS=ON \ + -DENABLE_GR_FFT=ON \ + -DENABLE_GR_FILTER=ON \ + -DENABLE_GR_IIO=ON \ + -DENABLE_POSTINSTALL=OFF + " + build_with_cmake + sudo make install + popd +} + +build_grscopy() { + echo "### Building gr-scopy - branch $GRSCOPY_BRANCH" + pushd $STAGING_AREA/gr-scopy + build_with_cmake + sudo make install + popd +} + +build_grm2k() { + echo "### Building gr-m2k - branch $GRM2K_BRANCH" + pushd $STAGING_AREA/gr-m2k + CURRENT_BUILD_CMAKE_OPTS="\ + -DENABLE_PYTHON=OFF \ + -DDIGITAL=OFF + " + build_with_cmake + sudo make install + popd +} + +build_qwt() { + echo "### Building qwt - branch $QWT_BRANCH" + pushd $STAGING_AREA/qwt + git clean -xdf + sed -i 's|/usr/local/qwt-$$QWT_VERSION-ma|/usr/local|g' qwtconfig.pri + $QMAKE_BIN INCLUDEPATH=$SYSROOT/include LIBS=-L$SYSROOT/lib qwt.pro + make $JOBS + patchelf --force-rpath --set-rpath \$ORIGIN $STAGING_AREA/qwt/lib/libqwt.so + sudo make INSTALL_ROOT=$SYSROOT install + popd +} + +build_libsigrokdecode() { + echo "### Building libsigrokdecode - branch $LIBSIGROKDECODE_BRANCH" + set_config_opts + pushd $STAGING_AREA/libsigrokdecode + git clean -xdf + ./autogen.sh + ./configure "${CONFIG_OPTS[@]}" + make $JOBS + patchelf --force-rpath --set-rpath \$ORIGIN $STAGING_AREA/libsigrokdecode/.libs/libsigrokdecode.so + sudo make install + popd +} + +build_libtinyiiod() { + echo "### Building libtinyiiod - branch $LIBTINYIIOD_BRANCH" + pushd $STAGING_AREA/libtinyiiod + CURRENT_BUILD_CMAKE_OPTS="-DBUILD_EXAMPLES=OFF" + build_with_cmake + sudo make install + popd +} + +build_iio-emu(){ + echo "### Building iio-emu - branch $IIOEMU_BRANCH" + pushd $STAGING_AREA + [ -d 'iio-emu' ] || git clone --recursive https://github.com/analogdevicesinc/iio-emu -b $IIOEMU_BRANCH iio-emu + pushd $STAGING_AREA/iio-emu + build_with_cmake + sudo make install + popd + popd +} + +build_scopy() { + echo "### Building scopy" + pushd $SRC_DIR + CURRENT_BUILD_CMAKE_OPTS="\ + -DCLONE_IIO_EMU=OFF + " + build_with_cmake + popd +} + +build_deps(){ + build_libiio + build_libad9361 + build_spdlog + build_libm2k + build_volk + build_gnuradio + build_grscopy + build_grm2k + build_qwt + build_libsigrokdecode + build_libtinyiiod +} + +create_appdir(){ + + BUILD_FOLDER=$SRC_DIR/build + EMU_BUILD_FOLDER=$STAGING_AREA/iio-emu/build + COPY_DEPS=$SRC_DIR/CI/kuiper/copy-deps.sh + + rm -rf $APP_DIR + mkdir $APP_DIR + mkdir -p $APP_DIR/usr/bin + mkdir -p $APP_DIR/usr/lib + mkdir -p $APP_DIR/usr/share/applications + mkdir -p $APP_DIR/usr/share/icons/hicolor/512x512 + + cp $APP_RUN $APP_DIR + cp $APP_DESKTOP $APP_DIR + cp $SRC_DIR/resources/Scopy.png $APP_DIR + cp $SRC_DIR/resources/Scopy.png $APP_DIR/usr/share/icons/hicolor/512x512 + cp $APP_DESKTOP $APP_DIR/usr/share/applications + + cp $EMU_BUILD_FOLDER/iio-emu $APP_DIR/usr/bin + cp $BUILD_FOLDER/scopy $APP_DIR/usr/bin + + $COPY_DEPS $APP_DIR/usr/bin/scopy $APP_DIR/usr/lib + $COPY_DEPS $APP_DIR/usr/bin/iio-emu $APP_DIR/usr/lib + + + cp -r $QT_LOCATION/plugins $APP_DIR/usr + cp -r $SYSROOT/lib/python3.9 $APP_DIR/usr/lib + cp -r $SYSROOT/share/libsigrokdecode/decoders $APP_DIR/usr/lib + + cp $QT_LOCATION/lib/libQt5XcbQpa.so* $APP_DIR/usr/lib + cp $QT_LOCATION/lib/libQt5EglFSDeviceIntegration.so* $APP_DIR/usr/lib + cp $QT_LOCATION/lib/libQt5DBus.so* $APP_DIR/usr/lib + + + cp $SYSROOT/lib/arm-linux-gnueabihf/libstdc++.so* $APP_DIR/usr/lib + cp $SYSROOT/lib/arm-linux-gnueabihf/libc.so* $APP_DIR/usr/lib + cp $SYSROOT/lib/arm-linux-gnueabihf/libdl.so* $APP_DIR/usr/lib + cp $SYSROOT/lib/arm-linux-gnueabihf/libpthread.so* $APP_DIR/usr/lib + cp $SYSROOT/lib/arm-linux-gnueabihf/libGLESv2.so* $APP_DIR/usr/lib + + cp $SYSROOT/usr/lib/arm-linux-gnueabihf/ld-linux-armhf.so* $APP_DIR/usr/lib + cp $SYSROOT/usr/lib/arm-linux-gnueabihf/libarmmem-v7l.so* $APP_DIR/usr/lib + cp $SYSROOT/usr/lib/arm-linux-gnueabihf/libm.so* $APP_DIR/usr/lib + cp $SYSROOT/usr/lib/arm-linux-gnueabihf/libgcc_s.so* $APP_DIR/usr/lib + cp $SYSROOT/usr/lib/arm-linux-gnueabihf/libdl.so* $APP_DIR/usr/lib + cp $SYSROOT/usr/lib/arm-linux-gnueabihf/libmd.so* $APP_DIR/usr/lib + cp $SYSROOT/lib/arm-linux-gnueabihf/libbsd.so* $APP_DIR/usr/lib + cp $SYSROOT/lib/arm-linux-gnueabihf/libXdmcp.so* $APP_DIR/usr/lib + cp $SYSROOT/usr/lib/arm-linux-gnueabihf/libXau.so* $APP_DIR/usr/lib + cp $SYSROOT/usr/lib/arm-linux-gnueabihf/libxcb.so* $APP_DIR/usr/lib +} + + +create_appimage(){ + rm -rf $APP_IMAGE + mksquashfs $APP_DIR $APP_SQUASHFS -root-owned -noappend + cat $RUNTIME_ARMHF >> $APP_IMAGE + cat $APP_SQUASHFS >> $APP_IMAGE + chmod a+x $APP_IMAGE +} + +# move the sysroot from the home of the docker container to the known location +move_sysroot(){ + mkdir -p $STAGING_AREA + [ -d /home/runner/sysroot ] && sudo mv /home/runner/sysroot $SYSROOT +} + +# move and rename the AppImage artifact +move_appimage(){ + mv $APP_IMAGE $SRC_DIR/Scopy-armhf.AppImage +} + +generate_ci_envs() +{ + $SRC_DIR/CI/appveyor/gen_ci_envs.sh > $SRC_DIR/CI/kuiper/gh-actions.envs +} + +for arg in $@; do + $arg +done diff --git a/CI/kuiper/qt_patch.patch b/CI/kuiper/qt_patch.patch new file mode 100644 index 0000000000..ec1e6bf431 --- /dev/null +++ b/CI/kuiper/qt_patch.patch @@ -0,0 +1,126 @@ +--- new/qt-everywhere-src-5.15.2/qtbase/mkspecs/linux-arm-gnueabihf-g++/qmake.conf ++++ qt-everywhere-src-5.15.2/qtbase/mkspecs/linux-arm-gnueabihf-g++/qmake.conf +@@ -0,0 +1,26 @@ ++# ++# qmake configuration for building with arm-linux-gnueabihf-g++ ++# ++ ++MAKEFILE_GENERATOR = UNIX ++CONFIG += incremental ++QMAKE_INCREMENTAL_STYLE = sublib ++ ++include(../common/linux.conf) ++include(../common/gcc-base-unix.conf) ++include(../common/g++-unix.conf) ++ ++QMAKE_LIBS_EGL = -lEGL ++ ++# modifications to g++.conf ++QMAKE_CC = arm-linux-gnueabihf-gcc ++QMAKE_CXX = arm-linux-gnueabihf-g++ ++QMAKE_LINK = arm-linux-gnueabihf-g++ ++QMAKE_LINK_SHLIB = arm-linux-gnueabihf-g++ ++ ++# modifications to linux.conf ++QMAKE_AR = arm-linux-gnueabihf-ar cqs ++QMAKE_OBJCOPY = arm-linux-gnueabihf-objcopy ++QMAKE_NM = arm-linux-gnueabihf-nm -P ++QMAKE_STRIP = arm-linux-gnueabihf-strip ++load(qt_config) +--- new/qt-everywhere-src-5.15.2/qtbase/mkspecs/linux-arm-gnueabihf-g++/qplatformdefs.h ++++ qt-everywhere-src-5.15.2/qtbase/mkspecs/linux-arm-gnueabihf-g++/qplatformdefs.h +@@ -0,0 +1,40 @@ ++/**************************************************************************** ++** ++** Copyright (C) 2016 The Qt Company Ltd. ++** Contact: https://www.qt.io/licensing/ ++** ++** This file is part of the qmake spec of the Qt Toolkit. ++** ++** $QT_BEGIN_LICENSE:LGPL$ ++** Commercial License Usage ++** Licensees holding valid commercial Qt licenses may use this file in ++** accordance with the commercial license agreement provided with the ++** Software or, alternatively, in accordance with the terms contained in ++** a written agreement between you and The Qt Company. For licensing terms ++** and conditions see https://www.qt.io/terms-conditions. For further ++** information use the contact form at https://www.qt.io/contact-us. ++** ++** GNU Lesser General Public License Usage ++** Alternatively, this file may be used under the terms of the GNU Lesser ++** General Public License version 3 as published by the Free Software ++** Foundation and appearing in the file LICENSE.LGPL3 included in the ++** packaging of this file. Please review the following information to ++** ensure the GNU Lesser General Public License version 3 requirements ++** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ++** ++** GNU General Public License Usage ++** Alternatively, this file may be used under the terms of the GNU ++** General Public License version 2.0 or (at your option) the GNU General ++** Public license version 3 or any later version approved by the KDE Free ++** Qt Foundation. The licenses are as published by the Free Software ++** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 ++** included in the packaging of this file. Please review the following ++** information to ensure the GNU General Public License requirements will ++** be met: https://www.gnu.org/licenses/gpl-2.0.html and ++** https://www.gnu.org/licenses/gpl-3.0.html. ++** ++** $QT_END_LICENSE$ ++** ++****************************************************************************/ ++ ++#include "../linux-g++/qplatformdefs.h" +--- new/qt-everywhere-src-5.15.2/qtbase/src/3rdparty/angle/include/EGL/eglplatform.h ++++ qt-everywhere-src-5.15.2/qtbase/src/3rdparty/angle/include/EGL/eglplatform.h +@@ -141,6 +141,7 @@ + */ + typedef khronos_int32_t EGLint; + ++typedef uint32_t DISPMANX_ELEMENT_HANDLE_T; + + /* C++ / C typecast macros for special EGL handle values */ + #if defined(__cplusplus) +--- new/qt-everywhere-src-5.15.2/qtbase/src/gui/configure.json ++++ qt-everywhere-src-5.15.2/qtbase/src/gui/configure.json +@@ -862,7 +862,10 @@ + "type": "compile", + "test": { + "include": [ "EGL/egl.h", "bcm_host.h" ], +- "main": "vc_dispmanx_display_open(0);" ++ "main": [ ++ "vc_dispmanx_display_open(0);", ++ "EGL_DISPMANX_WINDOW_T *eglWindow = new EGL_DISPMANX_WINDOW_T;" ++ ] + }, + "use": "egl bcm_host" + }, +--- new/qt-everywhere-src-5.15.2/qtbase/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmintegration.cpp ++++ qt-everywhere-src-5.15.2/qtbase/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmintegration.cpp +@@ -44,6 +44,12 @@ + + static DISPMANX_DISPLAY_HANDLE_T dispman_display = 0; + ++typedef struct { ++ DISPMANX_ELEMENT_HANDLE_T element; ++ int width; /* This is necessary because dispmanx elements are not queriable. */ ++ int height; ++} EGL_DISPMANX_WINDOW_T; ++ + static EGLNativeWindowType createDispmanxLayer(const QPoint &pos, const QSize &size, int z, DISPMANX_FLAGS_ALPHA_T flags) + { + VC_RECT_T dst_rect; +@@ -76,12 +82,12 @@ + eglWindow->width = size.width(); + eglWindow->height = size.height(); + +- return eglWindow; ++ return (EGLNativeWindowType)eglWindow; + } + + static void destroyDispmanxLayer(EGLNativeWindowType window) + { +- EGL_DISPMANX_WINDOW_T *eglWindow = static_cast(window); ++ EGL_DISPMANX_WINDOW_T *eglWindow = (EGL_DISPMANX_WINDOW_T*)(window); + DISPMANX_UPDATE_HANDLE_T dispman_update = vc_dispmanx_update_start(0); + vc_dispmanx_element_remove(dispman_update, eglWindow->element); + vc_dispmanx_update_submit_sync(dispman_update); diff --git a/CI/kuiper/runtime-armhf b/CI/kuiper/runtime-armhf new file mode 100644 index 0000000000..d094f36552 Binary files /dev/null and b/CI/kuiper/runtime-armhf differ diff --git a/CI/kuiper/scopy.desktop b/CI/kuiper/scopy.desktop new file mode 100644 index 0000000000..705923d28c --- /dev/null +++ b/CI/kuiper/scopy.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Version=1.0 +Icon=scopy +Exec=scopy +Terminal=false +Type=Application +Categories=Science +Name=Scopy +GenericName=Oscilloscope +Comment=A software oscilloscope diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000000..28f5a4892d --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,56 @@ +clone_depth: 1 +#init: +# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) + +image: Visual Studio 2019 + +environment: + BUILD_NO: $(APPVEYOR_BUILD_NUMBER) + BRANCH: $(APPVEYOR_REPO_BRANCH) + REPO: $(APPVEYOR_REPO_NAME) + CI_BUILD: 1 + matrix: + - ARCH: x86_64 + ARCH_BIT: 64 + APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu2004 + PKG_MANAGER_UPDATE_CMD: "sudo apt-get -y update" + BUILD_DEPS_CMD: "/home/appveyor/projects/scopy/CI/appveyor/install_ubuntu_20_deps.sh /home/appveyor/Qt/5.15.2" + BUILD_CMD: "/home/appveyor/projects/scopy/CI/appveyor/build_appveyor_ubuntu.sh /home/appveyor/Qt/5.15.2" + PACKAGE_CMD: "" + DEPLOY_FILE: "" + +# - ARCH: x86_64 +# ARCH_BIT: 64 +# APPVEYOR_BUILD_WORKER_IMAGE: Ubuntu1804 +# BUILD_DEPS_CMD: "/home/appveyor/projects/scopy/CI/appveyor/build_appveyor_flatpak.sh $BRANCH $REPO" +# BUILD_CMD: "" +# PACKAGE_CMD: "" +# DEPLOY_FILE: "/home/appveyor/projects/scopy/Scopy.flatpak" + +install: + # Install Inno Setup + - cmd: choco install InnoSetup + +build_script: + # Update MSYS2 - https://www.msys2.org/docs/ci/#appveyor + - cmd: C:\msys64\usr\bin\bash -lc "pacman --noconfirm -Syuu" # Core update (in case any core packages are outdated) + - cmd: C:\msys64\usr\bin\bash -lc "pacman --noconfirm -Syuu" # Normal update + + # Then run your code + - cmd: set CHERE_INVOKING='yes' # Preserve the current working directory + - cmd: set MSYSTEM='MINGW64' # Start a 64 bit Mingw environment + - cmd: C:\msys64\usr\bin\bash -lc "/c/projects/scopy/CI/appveyor/extract_msys_deps.sh" + - cmd: set PATH=%PATH%;"C:\Program Files (x86)\Inno Setup 6" + - cmd: "%BUILD_DEPS_CMD%" + + - sh: $PKG_MANAGER_UPDATE_CMD + - sh: echo $BUILD_DEPS_CMD + - sh: $BUILD_DEPS_CMD + - sh: $BUILD_CMD + - sh: $PACKAGE_CMD + + - echo "### Push artifacts ... " + - sh: if [[ $DEPLOY_FILE != "" ]]; then appveyor PushArtifact $DEPLOY_FILE; fi + +#on_finish: +# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) diff --git a/resources/Scopy.png b/resources/Scopy.png new file mode 100644 index 0000000000..ca5a6fc1f9 Binary files /dev/null and b/resources/Scopy.png differ diff --git a/src/tool_launcher.cpp b/src/tool_launcher.cpp index 6a42a1ff5b..bd1873feea 100644 --- a/src/tool_launcher.cpp +++ b/src/tool_launcher.cpp @@ -1825,6 +1825,8 @@ bool adiscope::ToolLauncher::switchContext(const QString& uri) } else { #if defined __APPLE__ bool success = loadDecoders(QCoreApplication::applicationDirPath() + "/decoders"); +#elif defined(__ARM_ARCH_6__) + bool success = loadDecoders(QCoreApplication::applicationDirPath() + "/../lib/decoders"); #else bool success = loadDecoders("decoders"); #endif