Skip to content

Commit

Permalink
Merge pull request #402 from friction2d/linux-universal
Browse files Browse the repository at this point in the history
New Linux AppImage/Flatpak binaries (X11+wayland+portal)
  • Loading branch information
rodlie authored Jan 4, 2025
2 parents 944182d + 6870365 commit 0087796
Show file tree
Hide file tree
Showing 20 changed files with 196 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Linux

on: [push, pull_request]
on: workflow_dispatch

jobs:
release:
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,9 @@ skia-build
qt-*
sdk
build-release
src/scripts/flatpak/.flatpak-builder
src/scripts/flatpak/builddir
src/scripts/flatpak/export
src/scripts/flatpak/builder
src/scripts/flatpak/repo-main

22 changes: 22 additions & 0 deletions src/app/GUI/RenderWidgets/renderinstancewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "appsupport.h"

#include <QDesktopServices>
#include <QMessageBox>

RenderInstanceWidget::RenderInstanceWidget(
Canvas *canvas, QWidget *parent) :
Expand Down Expand Up @@ -401,6 +402,27 @@ void RenderInstanceWidget::openOutputDestinationDialog() {
QString saveAs = eDialogs::saveFile("Output Destination",
iniText, supportedExts);
if(saveAs.isEmpty()) return;

#ifdef Q_OS_LINUX
if (AppSupport::isFlatpak()) {
const bool isImgSeq = (format) ? !std::strcmp(format->name, "image2") : false;
if (isImgSeq) {
const QString pixPath = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
const QString docPath = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
if (!saveAs.startsWith(pixPath) &&
!saveAs.startsWith(docPath)) {
QMessageBox box(this);
box.setWindowTitle(tr("Permission issue"));
box.setText(tr("Due to limitations in Flatpak "
"you can only save image sequences to %1 or %2.").arg(pixPath,
docPath));
box.exec();
return;
}
}
}
#endif

mSettings.setOutputDestination(saveAs);
mOutputDestinationLineEdit->setText(saveAs);
updateOutputDestinationFromCurrentFormat();
Expand Down
44 changes: 31 additions & 13 deletions src/app/appdata.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
<id>@PROJECT_FREEDESKTOP@</id>
<launchable type="desktop-id">@[email protected]</launchable>
<name>@FRICTION_DISPLAY_NAME@</name>
<developer_name>@FRICTION_DISPLAY_NAME@</developer_name>
<developer id="@PROJECT_IDENTIFIER@">
<name>@FRICTION_DISPLAY_NAME@</name>
</developer>
<summary>@PROJECT_SUMMARY@</summary>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0-or-later</project_license>
<project_license>GPL-3.0-only</project_license>
<description>
<p>@PROJECT_DESCRIPTION@</p>
</description>
Expand All @@ -16,43 +18,43 @@
<description>
<p>This release includes several fixes, some new features and several UI/UX changes.</p>
</description>
<url>https://friction.graphics/releases/friction-100-beta2.html</url>
<url type="details">https://friction.graphics/releases/friction-100-beta2.html</url>
</release>
<release date="2024-10-16" version="1.0.0-beta.1">
<description>
<p>This release includes several new features and many UI/UX improvements.</p>
</description>
<url>https://friction.graphics/releases/friction-100-beta1.html</url>
<url type="details">https://friction.graphics/releases/friction-100-beta1.html</url>
</release>
<release date="2024-08-22" version="0.9.6.1">
<description>
<p>The first maintenance release for Friction 0.9.6 is now available.</p>
</description>
<url>https://friction.graphics/releases/friction-0961.html</url>
<url type="details">https://friction.graphics/releases/friction-0961.html</url>
</release>
<release date="2024-06-24" version="0.9.6">
<description>
<p>This release includes new features, critical fixes and generic UI/UX improvements.</p>
</description>
<url>https://friction.graphics/releases/friction-096.html</url>
<url type="details">https://friction.graphics/releases/friction-096.html</url>
</release>
<release date="2023-12-24" version="0.9.5">
<description>
<p>This release includes new features, fixes and generic improvements.</p>
</description>
<url>https://friction.graphics/releases/friction-095.html</url>
<url type="details">https://friction.graphics/releases/friction-095.html</url>
</release>
<release date="2023-09-04" version="0.9.4">
<description>
<p>This release includes several fixes and improvements to the user experience.</p>
</description>
<url>https://friction.graphics/releases/friction-094.html</url>
<url type="details">https://friction.graphics/releases/friction-094.html</url>
</release>
<release date="2023-08-05" version="0.9.3">
<description>
<p>This release includes several fixes and improvements to the user experience.</p>
</description>
<url>https://friction.graphics/releases/friction-093.html</url>
<url type="details">https://friction.graphics/releases/friction-093.html</url>
</release>
<release date="2023-07-23" version="0.9.2">
<description>
Expand All @@ -64,28 +66,44 @@
<description>
<p>First public release.</p>
</description>
<url>https://friction.graphics/releases/friction-091.html</url>
<url type="details">https://friction.graphics/releases/friction-091.html</url>
</release>
</releases>
<screenshots>
<screenshot type="default">
<image>https://friction.graphics/assets/screenshots/096/friction-096-screenshot.jpg</image>
<caption>Friction user interface</caption>
<image>https://friction.graphics/assets/screenshots/100/friction-100b2-screenshot.png</image>
<caption>Default user interface</caption>
</screenshot>
</screenshots>
<url type="homepage">@PROJECT_HOMEPAGE_URL@</url>
<url type="bugtracker">@PROJECT_BUGTRACKER_URL@</url>
<url type="help">@PROJECT_HELP_URL@</url>
<url type="faq">@PROJECT_FAQ_URL@</url>
<url type="donation">@PROJECT_DONATE_URL@</url>
<url type="contribute">@PROJECT_CONTRIBUTE_URL@</url>
<url type="vcs-browser">@PROJECT_REPO_URL@</url>
<update_contact>@PROJECT_CONTACT@</update_contact>
<content_rating type="oars-1.1"/>
<supports>
<control>keyboard</control>
<control>pointing</control>
</supports>
<categories>
<category>AudioVideo</category>
<category>Graphics</category>
</categories>
<keywords>
<keyword>2d</keyword>
<keyword>graphics</keyword>
<keyword>motiongraphics</keyword>
<keyword>motion graphics</keyword>
<keyword>mograph</keyword>
<keyword>animation</keyword>
<keyword>web animation</keyword>
<keyword>video</keyword>
<keyword>svg</keyword>
<keyword>vector</keyword>
<keyword>raster</keyword>
<keyword>vfx</keyword>
<keyword>editing</keyword>
</keywords>
</component>
8 changes: 6 additions & 2 deletions src/cmake/friction-meta.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,14 @@ set(FRICTION_DISPLAY_NAME "Friction")
set(PROJECT_COPYRIGHT "Friction contributors")
set(PROJECT_IDENTIFIER "graphics.friction")
set(PROJECT_SUMMARY "Motion graphics and animation")
set(PROJECT_DESCRIPTION "Powerful and versatile motion graphics and animation application that allows you to create vector and raster animations for web and video platforms with ease")
set(PROJECT_LICENSE "GPLv3+")
set(PROJECT_DESCRIPTION "Powerful and versatile motion graphics and animation application that allows you to create vector and raster animations for web and video.")
set(PROJECT_LICENSE "GPLv3")
set(PROJECT_HOMEPAGE_URL "https://friction.graphics")
set(PROJECT_FREEDESKTOP "${PROJECT_IDENTIFIER}.${FRICTION_DISPLAY_NAME}")
set(PROJECT_BUGTRACKER_URL "https://github.com/friction2d/friction/issues")
set(PROJECT_HELP_URL "https://friction.graphics/documentation/")
set(PROJECT_FAQ_URL "https://friction.graphics/documentation/faq.html")
set(PROJECT_DONATE_URL "https://friction.graphics/donate.html")
set(PROJECT_CONTRIBUTE_URL "https://github.com/friction2d/friction/discussions")
set(PROJECT_REPO_URL "https://github.com/friction2d/friction")
set(PROJECT_CONTACT "[email protected]")
23 changes: 23 additions & 0 deletions src/core/appsupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,24 @@ const QString AppSupport::getAppPath()
return QApplication::applicationDirPath();
}

const QString AppSupport::getAppTempPath()
{
#ifdef Q_OS_LINUX
if (isFlatpak()) {
QString path = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
if (!path.isEmpty()) {
path.append("/friction-temp");
if (!QFile::exists(path)) {
QDir dir(path);
dir.mkpath(path);
}
if (QFile::exists(path)) { return path; }
}
}
#endif
return QDir::tempPath();
}

const QString AppSupport::getAppOutputProfilesPath()
{
QString path = QString::fromUtf8("%1/OutputProfiles").arg(getAppConfigPath());
Expand Down Expand Up @@ -696,6 +714,11 @@ bool AppSupport::isWayland()
return QGuiApplication::platformName().startsWith("wayland");
}

bool AppSupport::isFlatpak()
{
return !QString(qgetenv("container")).isEmpty();
}

const QString AppSupport::getAppImagePath()
{
return QString(qgetenv("APPIMAGE"));
Expand Down
2 changes: 2 additions & 0 deletions src/core/appsupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class CORE_EXPORT AppSupport : public QObject
static const QString getAppBranchUrl();
static const QString getAppConfigPath();
static const QString getAppPath();
static const QString getAppTempPath();
static const QString getAppOutputProfilesPath();
static const QString getAppPathEffectsPath();
static const QString getAppRasterEffectsPath();
Expand Down Expand Up @@ -120,6 +121,7 @@ class CORE_EXPORT AppSupport : public QObject
static bool isAppPortable();
static bool isAppImage();
static bool isWayland();
static bool isFlatpak();
static const QString getAppImagePath();
static bool hasXDGDesktopIntegration();
static bool setupXDGDesktopIntegration();
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/Dockerfile.vfxplatform
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
RUN sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo

RUN yum -y group install "Development Tools"
RUN yum -y install pulseaudio-libs-devel wget rpmdevtools git yasm python3 fontconfig-devel zlib-devel autoconf automake xz devtoolset-7 llvm-toolset-7.0 tree curl libICE-devel libSM-devel libX11-devel libXau-devel libXdamage-devel libXext-devel libXfixes-devel libXi-devel libXxf86vm-devel libdrm-devel libxcb-devel mesa-libGL-devel xorg-x11-proto-devel xcb-proto libxcb-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-renderutil-devel xcb-util-wm-devel xorg-x11-util-macros
RUN yum -y install pulseaudio-libs-devel wget rpmdevtools git yasm python3 fontconfig-devel zlib-devel autoconf automake xz devtoolset-7 llvm-toolset-7.0 tree curl libICE-devel libSM-devel libX11-devel libXau-devel libXdamage-devel libXext-devel libXfixes-devel libXi-devel libXxf86vm-devel libdrm-devel libxcb-devel mesa-libGL-devel xorg-x11-proto-devel xcb-proto libxcb-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-renderutil-devel xcb-util-wm-devel xorg-x11-util-macros mesa-libEGL-devel mesa-libGLES-devel wayland-devel
RUN ln -sf /usr/bin/python3 /usr/bin/python
RUN rm -f /usr/lib64/pkgconfig/libpng.pc
RUN rm -f /usr/lib64/pkgconfig/libpng15.pc
Expand Down
4 changes: 2 additions & 2 deletions src/scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ APPIMG=20240401
SDK=1.0.0
URL=https://github.com/friction2d/friction-sdk/releases/download/v${SDK}
APPIMAGE_TAR=friction-appimage-tools-${APPIMG}.tar.xz
SDK_TAR=friction-sdk-${SDK}-linux-x86_64.tar.xz
SKIA_TAR=skia-friction-09e64895-linux-x86_64.tar.xz
SDK_TAR=friction-sdk-${SDK}r5-linux-x86_64.tar.xz
SKIA_TAR=skia-friction-f5941b02-linux-x86_64.tar.xz

mkdir -p distfiles/sdk || true

Expand Down
2 changes: 1 addition & 1 deletion src/scripts/build_vfxplatform.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ CUSTOM=${CUSTOM:-""}
MKJOBS=${MKJOBS:-32}
SDK_VERSION=${SDK_VERSION:-""}
ONLY_SDK=${ONLY_SDK:-0}
SDK_TAR="${DISTFILES}/sdk/friction-sdk-${SDK_VERSION}-linux-x86_64.tar"
SDK_TAR="${DISTFILES}/sdk/friction-sdk-${SDK_VERSION}r5-linux-x86_64.tar"
TAR_VERSION=${TAR_VERSION:-""}

# Build SDK
Expand Down
6 changes: 3 additions & 3 deletions src/scripts/build_vfxplatform_friction.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,13 @@ CMAKE_EXTRA=""
GIT_COMMIT=`git rev-parse --short=8 HEAD`
GIT_BRANCH=`git rev-parse --abbrev-ref HEAD`

cmake -GNinja \
cmake -G Ninja \
-DCMAKE_INSTALL_PREFIX=${SDK} \
-DCMAKE_PREFIX_PATH=${SDK} \
-DCMAKE_BUILD_TYPE=Release \
-DLINUX_DEPLOY=ON \
-DUSE_SKIA_SYSTEM_LIBS=OFF \
-DUSE_EGL=ON \
-DFRICTION_OFFICIAL_RELEASE=${REL_STATUS} \
-DQSCINTILLA_INCLUDE_DIRS=${SDK}/include \
-DQSCINTILLA_LIBRARIES_DIRS=${SDK}/lib \
Expand All @@ -111,13 +112,12 @@ cmake --build .

if [ "${BUILD_ENGINE}" = "ON" ]; then
(cd src/engine ;
tar cf skia-friction-${VERSION}-linux-x86_64.tar skia
tar cf skia-friction-${VERSION}-linux-x86_64.tar skia/libskia.friction.so
mkdir -p /mnt/builds/${VERSION} || true
mv skia-friction-${VERSION}-linux-x86_64.tar /mnt/builds/${VERSION}/
)
fi

FRICTION_INSTALL_DIR=friction-${VERSION}
mkdir -p ${BUILD}/${FRICTION_INSTALL_DIR}/opt/friction/{bin,lib,share} || true
mkdir -p ${BUILD}/${FRICTION_INSTALL_DIR}/opt/friction/plugins/{audio,generic,platforminputcontexts,platforms,xcbglintegrations} || true
DESTDIR=${BUILD}/${FRICTION_INSTALL_DIR} cmake --build . --target install
46 changes: 33 additions & 13 deletions src/scripts/build_vfxplatform_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ FRICTION_PKG=friction-${VERSION}

APPIMAGETOOL=bfe6e0c
APPIMAGERUNTIME=1bb1157
SKIA_LIB=${DISTFILES}/skia/libskia.friction.so

if [ "${VERSION}" = "" ]; then
echo "Missing version"
Expand Down Expand Up @@ -69,12 +68,19 @@ for so in ${LIB_DIR}/*.so*; do
done
done

cp ${SDK}/plugins/audio/libqtmedia_pulse.so ${PLUG_DIR}/audio/
cp ${SDK}/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so ${PLUG_DIR}/platforminputcontexts/
cp ${SDK}/plugins/platforms/libqminimal.so ${PLUG_DIR}/platforms/
cp ${SDK}/plugins/platforms/libqoffscreen.so ${PLUG_DIR}/platforms/
cp ${SDK}/plugins/platforms/libqxcb.so ${PLUG_DIR}/platforms/
cp ${SDK}/plugins/xcbglintegrations/libqxcb-glx-integration.so ${PLUG_DIR}/xcbglintegrations/
mkdir -p ${PLUG_DIR}/platforms
cp -a ${SDK}/plugins/platforms/libqxcb.so ${PLUG_DIR}/platforms/
cp -a ${SDK}/plugins/platforms/libqwayland-generic.so ${PLUG_DIR}/platforms/
cp -a ${SDK}/plugins/platforms/libqwayland-egl.so ${PLUG_DIR}/platforms/

mkdir -p ${PLUG_DIR}/platformthemes
cp -a ${SDK}/plugins/platformthemes/libqxdgdesktopportal.so ${PLUG_DIR}/platformthemes/

cp -a ${SDK}/plugins/audio ${PLUG_DIR}/
cp -a ${SDK}/plugins/xcbglintegrations ${PLUG_DIR}/
cp -a ${SDK}/plugins/wayland-graphics-integration-client ${PLUG_DIR}/
cp -a ${SDK}/plugins/wayland-shell-integration ${PLUG_DIR}/
cp -a ${SDK}/plugins/wayland-decoration-client ${PLUG_DIR}/

for so in ${PLUG_DIR}/*/*.so; do
DEPENDS=`ldd ${so} | awk '{print $3}'`
Expand Down Expand Up @@ -136,25 +142,39 @@ echo "[Paths]" > ${BUILD}/${FRICTION_PKG}/opt/friction/bin/qt.conf
echo "Prefix = .." >> ${BUILD}/${FRICTION_PKG}/opt/friction/bin/qt.conf
echo "Plugins = plugins" >> ${BUILD}/${FRICTION_PKG}/opt/friction/bin/qt.conf

#(cd ${BUILD}/${FRICTION_PKG}/opt/friction/bin ; patchelf --set-rpath '$ORIGIN/../lib' friction)

(cd ${BUILD}/${FRICTION_PKG}/opt/friction/lib ;
for so in *.so*; do
patchelf --set-rpath '$ORIGIN' ${so}
done
)

SKIA_DIST_LIB=${DISTFILES}/skia/libskia.friction.so
PKG_SKIA_LIB64=${BUILD}/${FRICTION_PKG}/opt/friction/lib64/libskia.friction.so
PKG_SKIA_LIB=${BUILD}/${FRICTION_PKG}/opt/friction/lib/libskia.friction.so
if [ -f "${SKIA_LIB}" ] && [ ! -f "${PKG_SKIA_LIB}" ]; then
cp -a ${SKIA_LIB} ${BUILD}/${FRICTION_PKG}/opt/friction/lib/

if [ -f "${PKG_SKIA_LIB64}" ]; then
mv ${PKG_SKIA_LIB64} ${PKG_SKIA_LIB}
strip -s ${PKG_SKIA_LIB}
rm -rf ${BUILD}/${FRICTION_PKG}/opt/friction/lib64
else
if [ -f "${SKIA_DIST_LIB}" ] && [ ! -f "${PKG_SKIA_LIB}" ]; then
cp -a ${SKIA_DIST_LIB} ${PKG_SKIA_LIB}
strip -s ${PKG_SKIA_LIB}
fi
fi

if [ ! -f "${PKG_SKIA_LIB}" ]; then
echo "Missing libskia.friction.so"
exit 1
fi

PLUGS="
audio
platforminputcontexts
platforms
audio
xcbglintegrations
wayland-graphics-integration-client
wayland-shell-integration
wayland-decoration-client
"
for pdir in ${PLUGS}; do
for so in ${BUILD}/${FRICTION_PKG}/opt/friction/plugins/${pdir}/*.so; do
Expand Down
Loading

0 comments on commit 0087796

Please sign in to comment.