diff --git a/.gitmodules b/.gitmodules index e69de29bb2..3e0838dc08 100644 --- a/.gitmodules +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "ci/flatpak/shared-modules"] + path = ci/flatpak/shared-modules + url = https://github.com/flathub/shared-modules.git diff --git a/ci/flatpak/.gitignore b/ci/flatpak/.gitignore new file mode 100644 index 0000000000..73bbfdb2fe --- /dev/null +++ b/ci/flatpak/.gitignore @@ -0,0 +1,5 @@ +Scopy.flatpak +.flatpak-builder +build +repo +org.adi.Scopy.json \ No newline at end of file diff --git a/ci/flatpak/Makefile b/ci/flatpak/Makefile new file mode 100644 index 0000000000..293c227ce7 --- /dev/null +++ b/ci/flatpak/Makefile @@ -0,0 +1,37 @@ +TARGET := Scopy.flatpak +SRC := org.adi.Scopy.json + +ifndef ARCH + ARCH := x86_64 +endif +ifndef EN_PREPROCESS + EN_PREPROCESS := true +endif + +.PHONY: all clean + +all: $(TARGET) + +$(TARGET): repo + flatpak build-bundle $< $@ org.adi.Scopy + +repo: build + flatpak build-export $@ $< + +build: preprocess + flatpak-builder --verbose --arch=$(ARCH) $@ $(SRC) + +preprocess: clean + if [ $(EN_PREPROCESS) = true ]; then \ + if [ $(ARCH) = x86_64 ]; then \ + echo "-- Preprocessing org.adi.Scopy.json for ARCH = X86_64"; \ + gcc -E -P -D__X86__ org.adi.Scopy.json.c -o org.adi.Scopy.json; \ + elif [ $(ARCH) = arm ]; then \ + echo "-- Preprocessing org.adi.Scopy.json for ARCH = arm"; \ + gcc -E -P -D__ARM__ org.adi.Scopy.json.c -o org.adi.Scopy.json; \ + fi \ + fi + +clean: + rm -rf $(TARGET) build repo + diff --git a/ci/flatpak/README.md b/ci/flatpak/README.md new file mode 100644 index 0000000000..6ace3ea355 --- /dev/null +++ b/ci/flatpak/README.md @@ -0,0 +1,10 @@ +# Scopy Flatpak Recipe +Flatpak build recipe for Scopy + + +Scopy is a software oscilloscope and signal analysis toolset. [The official repository](https://github.com/analogdevicesinc/scopy) provides releases for Windows, Linux, MacOS. +This recipe is used to build the Linux Flatpak installer. + +[Get Flatpak using these instructions](http://flatpak.org/getting.html) + +[Install Scopy using the Flatpak release for Linux using these instructions](https://wiki.analog.com/university/tools/m2k/scopy#installation) diff --git a/ci/flatpak/defined_variables.h b/ci/flatpak/defined_variables.h new file mode 100644 index 0000000000..873ad9d5eb --- /dev/null +++ b/ci/flatpak/defined_variables.h @@ -0,0 +1,26 @@ +#define _EXPAND(A) #A +#define EXPAND(A) _EXPAND(A) + +#define DENABLE_INTERNAL_VOLK -DENABLE_INTERNAL_VOLK:BOOL=_ENABLE_VOLK + +#ifdef __ARM__ + #define RUNTIME_VERSION 5.14 + + #define _ASFLAGS_VALUE -mcpu=cortex-a5 -mfpu=neon-vfpv4 -mfloat-abi=hard + #define _CFLAGS_VALUE -march=armv7-a -mfpu=neon -mfloat-abi=hard + + #define ASFLAGS ASFLAGS= _ASFLAGS_VALUE + #define CFLAGS CFLAGS= _CFLAGS_VALUE + + #define CMAKE_ASM_FLAGS -DCMAKE_ASM_FLAGS= _ASFLAGS_VALUE + #define CMAKE_C_FLAGS -DCMAKE_C_FLAGS= -fno-asynchronous-unwind-tables _CFLAGS_VALUE + + #define _ENABLE_VOLK OFF + +#elif __X86__ + #define RUNTIME_VERSION 5.15-22.08 + #define CFLAGS --disable-assembly + #define CMAKE_C_FLAGS -DCMAKE_C_FLAGS= -fno-asynchronous-unwind-tables -fPIC + #define CMAKE_ASM_FLAGS -DCMAKE_ASM_FLAGS= + #define _ENABLE_VOLK OFF +#endif \ No newline at end of file diff --git a/ci/flatpak/docker/Dockerfile b/ci/flatpak/docker/Dockerfile new file mode 100644 index 0000000000..8185e0dfd2 --- /dev/null +++ b/ci/flatpak/docker/Dockerfile @@ -0,0 +1,32 @@ +FROM ubuntu:20.04 +ENV TZ=Europe/Bucharest +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +RUN apt-get update -y + +# Install base dependencies +RUN apt-get install -y software-properties-common build-essential git sudo apt-utils subversion mm-common + +# Install flatpak +RUN add-apt-repository ppa:alexlarsson/flatpak -y +RUN apt-get update -y +RUN apt install flatpak flatpak-builder -y + +# Install remote +RUN flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo +RUN flatpak install flathub org.kde.Platform//5.15-22.08 -y +RUN flatpak install flathub org.kde.Sdk//5.15-22.08 -y + +# Clean +RUN apt-get clean -y && apt-get autoclean -y + +RUN echo Cloning scopy-flatpak +ARG REPO_LINK=https://github.com/analogdevicesinc/scopy-flatpak +ARG REPO_LOCAL=/home/docker/scopy-flatpak +ARG REPO_BRANCH=ci-for-scopy2 + +RUN git clone --recurse-submodules "$REPO_LINK" -b "$REPO_BRANCH" "$REPO_LOCAL" 2> /dev/null || (cd "$REPO_LOCAL"; git pull) + +#RUN cd /home/docker/scopy-flatpak && make -j4 +#RUN rm -rf Scopy.flatpak +CMD ["/bin/bash"] \ No newline at end of file diff --git a/ci/flatpak/docker/README b/ci/flatpak/docker/README new file mode 100644 index 0000000000..4e9a665fdd --- /dev/null +++ b/ci/flatpak/docker/README @@ -0,0 +1,11 @@ +KDE Runtime Docker image based on Ubuntu 18.04 + +The provided Dockerfile will install the KDE Runtime over the Ubuntu 18.04 base image. +Also, the obtained Docker image will contain the clone of https://github.com/analogdevicesinc/scopy-flatpak the scopy-flatpak recipe repository which can be found at /home/docker/scopy-flatpak + +In order to build the Flatpak package for Scopy inside this Docker image, it needs to be run using "--privileged" (otherwise there is a lack of access to necessary utilities). + +We built Scopy Flatpak in this image, then saved the newly created image as alexandratr/scopy-flatpak-bionic:scopy on Dockerhub. However, a clean image (without the Scopy Flatpak build) can be found as alexandratr/scopy-flatpak-bionic:clean on Dockerhub. + +Running make inside the scopy-flatpak folder will build the Scopy.flatpak artifact. An example of how to do this is illustrated in the "build_appveyor_flatpak.sh" and "inside_flatpak_docker.sh" scripts (which deploys a Scopy.flatpak for each Appveyor nightly build). + diff --git a/ci/flatpak/org.adi.Scopy.json.c b/ci/flatpak/org.adi.Scopy.json.c new file mode 100644 index 0000000000..933e9ed92b --- /dev/null +++ b/ci/flatpak/org.adi.Scopy.json.c @@ -0,0 +1,529 @@ +#include "defined_variables.h" + +{ + "app-id": "org.adi.Scopy", + "runtime": "org.kde.Platform", + "runtime-version": EXPAND(RUNTIME_VERSION), + "sdk": "org.kde.Sdk", + "command": "scopy", + "rename-desktop-file": "scopy.desktop", + "rename-icon": "scopy", + "finish-args": [ + "--socket=x11", + "--socket=wayland", + "--socket=pulseaudio", + "--share=network", + "--share=ipc", + "--filesystem=host:create", + "--filesystem=~/.config/dconf:create", + "--filesystem=xdg-config/ADI:create", + "--device=all", + "--system-talk-name=org.freedesktop.Avahi" + ], + + "build-options" : { + "cflags": "-O2 -g", + "cxxflags": "-O2 -g", + "env": { + "V": "1" + } + + }, + "cleanup": [ + "/include", + "/lib/python2.7", + "/lib/pkgconfig", + "/lib/cmake", + "/lib/*.la", + "/lib/*.a", + "/lib/gio", + "/lib/giomm-2.4", + "/lib/libzip", + "/lib/libgthread*", + "/lib/xml2Conf.sh" + ], + "modules": [ + { + "name":"git-config-update", + "buildsystem": "simple", + "build-commands": [ + "git config --global protocol.file.allow always" + ] + }, + { + "name": "sshpass", + "sources": [ + { + "type": "archive", + "url": "https://sourceforge.net/projects/sshpass/files/sshpass/1.08/sshpass-1.08.tar.gz", + "sha1": "efe4573ba2fe972b08cf1cdd95739b7f456e55c1" + } + ] + }, + { + "name": "libusb", + "config-opts": [ "--disable-udev", "--prefix=/app" ], + "sources": [ + { + "type": "archive", + "url": "https://downloads.sourceforge.net/project/libusb/libusb-1.0/libusb-1.0.24/libusb-1.0.24.tar.bz2", + "sha256": "7efd2685f7b327326dcfb85cee426d9b871fd70e22caa15bb68d595ce2a2b12a" + } + ] + }, + { + "name": "boost", + "cleanup": [ "/bin", "/share" ], + "sources": [ + { + "type": "archive", + "url": "https://boostorg.jfrog.io/artifactory/main/release/1.73.0/source/boost_1_73_0.tar.gz", + "sha256": "9995e192e68528793755692917f9eb6422f3052a53c5e13ba278a228af6c7acf" + }, + { + "type": "script", + "commands": [ + "#!/bin/sh", + "exec ./bootstrap.sh --with-libraries=date_time,filesystem,program_options,regex,system,test,thread,atomic,chrono --prefix=/app" + ], + "dest-filename": "configure" + }, + { + "type": "script", + "commands": [ + "all:", + "\t./b2", + "install:", + "\t./b2 install" + ], + "dest-filename": "Makefile" + } + ] + }, + "shared-modules/dbus-glib/dbus-glib.json", + { + "name": "dbus-glib-submodule" + }, + "shared-modules/intltool/intltool-0.51.json", + { + "name": "intltool-submodule" + }, +#ifndef __ARM__ + { + "name": "dbus-python", + "sources": [ + { + "type": "archive", + "url": "https://dbus.freedesktop.org/releases/dbus-python/dbus-python-1.2.16.tar.gz", + "sha256": "11238f1d86c995d8aed2e22f04a1e3779f0d70e587caffeab4857f3c662ed5a4" + } + ] + }, +#endif + { + "name": "avahi", + "config-opts": [ + "--disable-monodoc", + "--disable-gtk", + "--disable-gtk3", + "--disable-qt3", + "--disable-qt4", + "--disable-pygobject", + "--disable-gdbm", + "--disable-libdaemon", + "--disable-mono", + "--disable-pygtk", +#ifdef __ARM__ + "--disable-dbus", +#endif + "--enable-compat-libdns_sd", + "--with-distro=none" + ], + "sources": [ + { + "type": "archive", + "url": "https://github.com/lathiat/avahi/releases/download/v0.7/avahi-0.7.tar.gz", + "sha256": "57a99b5dfe7fdae794e3d1ee7a62973a368e91e414bd0dfa5d84434de5b14804" + } + ] + }, + { + "name": "libxml2", + "cleanup": [ "/bin", "/share" ], + "config-opts": [ "--prefix=/app"], + "sources": [ + { + "type": "git", + "url": "https://github.com/GNOME/libxml2", + "tag": "v2.9.14" + } + ] + }, + { + "name": "matio", + "cleanup": [ "/bin", "/share" ], + "config-opts": [ "" ], + "build-commands": [ "true"], + "sources": [ + { + "type": "archive", + "url": "https://github.com/tbeu/matio/releases/download/v1.5.12/matio-1.5.12.tar.gz", + "sha1": "cb05a4a9a3af992890237b3f7a87f01cd8819528" + } + ] + }, + { + "name": "libfftw3", + "config-opts": [ + "--enable-shared", + "--disable-static", + "--enable-threads", + "--enable-single" +#ifdef __X86__ + ,"--enable-float", + "--enable-sse2", + "--enable-avx", + "--enable-openmp" +#endif + ], + "sources": [ + { + "type": "archive", + "url": "http://swdownloads.analog.com/cse/scopydeps/fftw-3.3.8.tar.gz", + "sha256": "6113262f6e92c5bd474f2875fa1b01054c4ad5040f6b0da7c03c98821d9ae303" + } + ] + }, + { + "name": "python3-mako", + "buildsystem": "simple", + "build-commands": [ + "pip3 install --no-index --find-links=\"file://${PWD}\" --prefix=/app mako" + ], + "sources": [ + { + "type": "file", + "url": "https://files.pythonhosted.org/packages/b9/2e/64db92e53b86efccfaea71321f597fa2e1b2bd3853d8ce658568f7a13094/MarkupSafe-1.1.1.tar.gz", + "sha256": "29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b" + }, + { + "type": "file", + "url": "https://files.pythonhosted.org/packages/28/03/329b21f00243fc2d3815399413845dbbfb0745cff38a29d3597e97f8be58/Mako-1.1.1.tar.gz", + "sha256": "2984a6733e1d472796ceef37ad48c26f4a984bb18119bb2dbc37a44d8f6e75a4" + } + ], + "cleanup": [ "*" ] + }, + { + "name": "libgmp", + "config-opts": [ "--prefix=/app", "--enable-cxx", + EXPAND(CFLAGS) +#ifdef __ARM__ + ,EXPAND(ASFLAGS) +#endif + ], + "sources": [ + { + "type": "archive", + "url": "https://ftp.gnu.org/gnu/gmp/gmp-6.2.0.tar.bz2", + "sha256": "f51c99cb114deb21a60075ffb494c1a210eb9d7cb729ed042ddb7de9534451ea" + } + ] + }, + { + "name": "liborc", + "config-opts": [ "--prefix=/app" +#ifdef __ARM__ + ,EXPAND(CFLAGS) ,EXPAND(ASFLAGS) +#endif + ], + "sources": [ + { + "type": "archive", + "url": "https://gstreamer.freedesktop.org/data/src/orc/orc-0.4.28.tar.xz", + "sha256": "bfcd7c6563b05672386c4eedfc4c0d4a0a12b4b4775b74ec6deb88fc2bcd83ce" + } + ] + }, + { + "name": "libvolk", + "cleanup": [ "/bin", "/share" ], + "builddir": true, + "buildsystem": "cmake", + "config-opts": [ + "-DCMAKE_INSTALL_PREFIX:PATH=/app", + EXPAND(CMAKE_C_FLAGS), EXPAND(CMAKE_ASM_FLAGS) + ], + "sources": [ + { + "type": "git", + "url": "https://github.com/gnuradio/volk", + "branch": "v2.5.1" + } + ] + }, + { + "name": "spdlog", + "cleanup": [ "/bin", "/share" ], + "builddir": true, + "buildsystem": "cmake", + "config-opts": [ + "-DCMAKE_INSTALL_PREFIX:PATH=/app", "-DSPDLOG_BUILD_SHARED=ON", + EXPAND(CMAKE_C_FLAGS), EXPAND(CMAKE_ASM_FLAGS) + ], + "sources": [ + { + "type": "git", + "url": "https://github.com/gabime/spdlog", + "branch": "v1.10.0" + } + ] + }, + + { + + "name": "serialport", + "builddir": false, + "buildsystem": "autotools", + "config-opts": [ "--prefix=/app" ], + "sources": [ + { + "type": "git", + "url": "https://github.com/sigrokproject/libserialport", + "branch" : "master" + } + ] + + }, + + { + "name": "libiio", + "builddir": true, + "buildsystem": "cmake", + "config-opts": [ + "-DCMAKE_PREFIX_PATH:PATH=/app", + "-DCMAKE_INSTALL_PREFIX:PATH=/app", + "-DCMAKE_INSTALL_LIBDIR:STRING=lib", + "-DINSTALL_UDEV_RULE:BOOL=OFF", + "-DWITH_TESTS:BOOL=OFF", + "-DWITH_DOC:BOOL=OFF", + "-DHAVE_DNS_SD:BOOL=ON", + "-DWITH_IIOD:BOOL=OFF", + "-DWITH_LOCAL_BACKEND:BOOL=OFF", + "-DENABLE_IPV6:BOOL=OFF", + "-DWITH_SERIAL_BACKEND:BOOL=ON" + ], + "sources": [ + { + "type": "git", + "url": "https://github.com/analogdevicesinc/libiio", + "tag": "v0.25" + } + ] + }, + { + "name": "libad9361", + "builddir": true, + "buildsystem": "cmake", + "config-opts": [ "-DCMAKE_INSTALL_PREFIX:PATH=/app" ], + "sources": [ + { + "type": "git", + "url": "https://github.com/analogdevicesinc/libad9361-iio", + "branch" : "main" + } + ] + }, + { + "name": "gnuradio", + "cleanup": [ "/bin", "/share" ], + "builddir": true, + "buildsystem": "cmake", + "config-opts": [ + "-DCMAKE_INSTALL_PREFIX:PATH=/app", + "-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", + EXPAND(CMAKE_C_FLAGS) +#ifdef __ARM__ + , EXPAND(CMAKE_ASM_FLAGS) +#endif + ], + "sources": [ + { + "type": "git", + "url": "https://github.com/gnuradio/gnuradio", + "branch" : "maint-3.10" + } + ] + }, + { + "name": "glog", + "builddir": true, + "buildsystem": "cmake", + "config-opts": [ + "-DCMAKE_INSTALL_PREFIX:PATH=/app", + "-DWITH_GFLAGS=OFF" + ], + "sources": [ + { + "type": "git", + "commit": "17e7679fd9beb95277ccd0708056ba85363f892b" , + "url": "https://github.com/google/glog" + } + ] + }, + { + "name": "libm2k", + "builddir": true, + "buildsystem": "cmake", + "config-opts": [ + "-DCMAKE_INSTALL_PREFIX:PATH=/app", + "-DENABLE_PYTHON=OFF", + "-DENABLE_CSHARP=OFF", + "-DENABLE_LOG=ON", + "-DENABLE_TOOLS=ON", + "-DINSTALL_UDEV_RULES=OFF" + ], + "sources": [ + { + "type": "git", + "url": "https://github.com/analogdevicesinc/libm2k", + "commit": "b37bbeb24e159fe975390d72cfd87629b40f352d" + } + ] + }, + { + "name": "gr-m2k", + "cleanup": [ "/share" ], + "builddir": true, + "buildsystem": "cmake", + "config-opts": [ "-DCMAKE_INSTALL_PREFIX:PATH=/app" ], + "sources": [ + { + "type": "git", + "url": "https://github.com/analogdevicesinc/gr-m2k", + "branch" : "main" + } + ] + }, + { + "name": "gr-scopy", + "cleanup": [ "/share" ], + "builddir": true, + "buildsystem": "cmake", + "config-opts": [ "-DCMAKE_INSTALL_PREFIX:PATH=/app" ], + "sources": [ + { + "type": "git", + "url": "https://github.com/analogdevicesinc/gr-scopy", + "branch" : "3.10" + } + ] + }, + { + "name": "qwt", + "cleanup": [ "/features", "/plugins", "/share" ], + "sources": [ + { + "type": "git", + "url": "https://github.com/cseci/qwt", + "branch": "qwt-multiaxes" + }, + { + "type": "script", + "commands": [ + "sed -i \"s/^\\s*QWT_INSTALL_PREFIX.*$/QWT_INSTALL_PREFIX=\\/app/g\" qwtconfig.pri", + "qmake" + ], + "dest-filename": "configure" + } + ] + }, + { + "name": "libzip", + "cleanup": [ "/bin", "/share" ], + "sources": [ + { + "type": "archive", + "url": "https://nih.at/libzip/libzip-1.1.3.tar.xz", + "sha256": "729a295a59a9fd6e5b9fe9fd291d36ae391a9d2be0b0824510a214cfaa05ceee" + } + ] + }, + { + "name": "sigrokdecode", + "builddir": false, + "buildsystem": "autotools", + "config-opts": [ "--prefix=/app" ], + "sources": [ + { + "type": "git", + "url": "https://github.com/sigrokproject/libsigrokdecode", + "commit": "e556e1168af7027df08622ecfe11309811249e81" + } + ] + }, + { + "name": "libtinyiiod", + "builddir": true, + "buildsystem": "cmake", + "config-opts": [ + "-DCMAKE_INSTALL_PREFIX:PATH=/app", + "-DBUILD_SHARED_LIBS=OFF", + "-DBUILD_EXAMPLES=OFF" + ], + "sources": [ + { + "type": "git", + "url": "https://github.com/analogdevicesinc/libtinyiiod", + "commit": "15e79e7c0064b0476ab4608d02d5efb988b93fc9" + } + ] + }, + + { + "name": "iio-emu", + "builddir": true, + "buildsystem": "cmake", + "config-opts": [ "-DCMAKE_INSTALL_PREFIX:PATH=/app" ], + "sources": [ + { + "type": "git", + "url": "https://github.com/analogdevicesinc/iio-emu", + "commit": "b8208485f50573a38263031ab05e9cd30712bf0c" + } + ] + }, + { + "name": "qtadvanceddocking", + "builddir": true, + "config-opts": [ "-DCMAKE_INSTALL_PREFIX:PATH=/app" ], + "buildsystem": "cmake", + "sources": [ + { + "type": "git", + "url": "https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System", + "tag": "3.8.1" + } + ] + }, + { + "name": "scopy", + "builddir": true, + "buildsystem": "cmake", + "config-opts": [ "-DCMAKE_INSTALL_PREFIX:PATH=/app", "-DCMAKE_PREFIX_PATH=/app/lib/pkgconfig;/app/lib/cmake", "-DCMAKE_BUILD_TYPE=Release", "-DENABLE_TESTING=OFF"], + "sources": [ + { + "type": "git", + "url": "https://github.com/analogdevicesinc/scopy", + "branch": "dev" + } + ] + } + ] + } \ No newline at end of file diff --git a/ci/flatpak/shared-modules b/ci/flatpak/shared-modules new file mode 160000 index 0000000000..83acd36912 --- /dev/null +++ b/ci/flatpak/shared-modules @@ -0,0 +1 @@ +Subproject commit 83acd36912481cd9079cf0e65194c1df8d4afb34