Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…flatpak

Signed-off-by: Bindea Cristian <[email protected]>
  • Loading branch information
bindea-cristian committed Aug 7, 2024
1 parent 3e19c23 commit 8919443
Show file tree
Hide file tree
Showing 9 changed files with 654 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "ci/flatpak/shared-modules"]
path = ci/flatpak/shared-modules
url = https://github.com/flathub/shared-modules.git
5 changes: 5 additions & 0 deletions ci/flatpak/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Scopy.flatpak
.flatpak-builder
build
repo
org.adi.Scopy.json
37 changes: 37 additions & 0 deletions ci/flatpak/Makefile
Original file line number Diff line number Diff line change
@@ -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

10 changes: 10 additions & 0 deletions ci/flatpak/README.md
Original file line number Diff line number Diff line change
@@ -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)
26 changes: 26 additions & 0 deletions ci/flatpak/defined_variables.h
Original file line number Diff line number Diff line change
@@ -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
32 changes: 32 additions & 0 deletions ci/flatpak/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
11 changes: 11 additions & 0 deletions ci/flatpak/docker/README
Original file line number Diff line number Diff line change
@@ -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).

Loading

0 comments on commit 8919443

Please sign in to comment.