...
 
Commits (2)
  • Eoin O'Neill's avatar
    Audio Support within an AppImage · 3845a10d
    Eoin O'Neill authored
    GStreamer and QT Multimedia can now be used inside an appimage
    with only a few changes to the docker build environment.
    
    Docker build environment currently:
      ~ Needs to build QT dependencies from source using changes to `3rdpart/ext_qt/CMakeLists.txt`
      ~ Needs to have GStreamer and GStreamer Plugins installed on the system.
    
    Gstreamer specific environment variables are set within main.cc **only** when running
    Krita through an AppImage context.
    
    The appimage_build script could use some cleaning. Notable changes:
      - GStreamer is `install`ed from docker environment libraries into APPDIR
      - QtMultimedia's `mediaserver` plugin is copied into the APPDIR.
      - Most importantly -- linuxdeployqt was filtering out `mediaserver` from our appimage bundle
    when building with the `-appimage` flag for an unknown reason. A simple work around for this
    seems to be to simply remove the `--appimage` flag from linuxdeployqt and use `appimagetool`
    on the appdir manually. This seems to fix the issues I was having with linuxdeployqt.
    
    Future Tasks:
    1 -[ ] Begin reductions on which gstreamer libraries are included on the system. This will be time consuming
    but will result in a smaller appimage size. Shouldn't be needed immediately though and is a polish step.
    2 -[ ] Make sure changes to docker-environment are reduced to the bare-minimum necessary to get a working build.
    If we could get GStreamer binaries with wget or alternatively build gstreamer and all necessary plugins from
    source, it would mean a leaner docker image to download. Building GStreamer from source might be a pain.
    
    Changed `isInAppimage` GStreamer ENV logic to match other parts of Krita
    
    Cherry-Pick from Krita/4.3
    3845a10d
  • Eoin O'Neill's avatar
    Master Specific Corrections for Appimage Audio · 9f8dbe42
    Eoin O'Neill authored
    Due to additional architecture support, some parts of the image_build script had to change.
    
    Also, added some additional comments on why we're building with appimagetool.
    9f8dbe42
......@@ -117,7 +117,8 @@ elseif (ANDROID)
COMMAND ${PATCH_COMMAND} -p1 -d qtbase -i ${CMAKE_CURRENT_SOURCE_DIR}/0093-Fix-QLocale-system-and-uiLanguages-for-the-mobile-pl.patch
COMMAND ${PATCH_COMMAND} -p1 -d qtbase -i ${CMAKE_CURRENT_SOURCE_DIR}/0100-Fix-artifacts-when-rendering-multisubpath-dashed-QPa.patch
CONFIGURE_COMMAND <SOURCE_DIR>/configure -prefix ${EXTPREFIX_qt} -opensource -confirm-license -verbose -nomake examples -nomake tests -nomake tools -skip qt3d -skip qtactiveqt -skip qtcanvas3d -skip qtconnectivity -skip qtgraphicaleffects -skip qtlocation -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip qtserialport -skip qtdatavis3d -skip qtvirtualkeyboard -skip qtspeech -skip qtsensors -skip qtgamepad -skip qtscxml -skip qtremoteobjects -skip qtxmlpatterns -skip qtnetworkauth -skip qtcharts -skip qtdatavis3d -skip qtgamepad -skip qtpurchasing -skip qtscxml -skip qtserialbus -skip qtspeech -skip qtvirtualkeyboard -skip qtmultimedia -android-sdk ${ANDROID_SDK_ROOT} -android-ndk ${CMAKE_ANDROID_NDK} -android-arch ${ANDROID_ABI} -xplatform android-clang -android-ndk-platform android-21 -make libs -qt-sqlite
CONFIGURE_COMMAND <SOURCE_DIR>/configure -prefix ${EXTPREFIX_qt} -opensource -confirm-license -verbose -nomake examples -nomake tests -nomake tools -skip qt3d -skip qtactiveqt -skip qtcanvas3d -skip qtconnectivity -skip qtgraphicaleffects -skip qtlocation -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip qtserialport -skip qtdatavis3d -skip qtvirtualkeyboard -skip qtspeech -skip qtsensors -skip qtgamepad -skip qtscxml -skip qtremoteobjects -skip qtxmlpatterns -skip qtnetworkauth -skip qtcharts -skip qtdatavis3d -skip qtgamepad -skip qtpurchasing -skip qtscxml -skip qtserialbus -skip qtspeech -skip qtvirtualkeyboard -with qtmultimedia -android-sdk ${ANDROID_SDK_ROOT} -android-ndk ${CMAKE_ANDROID_NDK} -android-arch ${ANDROID_ABI} -xplatform android-clang -android-ndk-platform android-21 -make libs -qt-sqlite
INSTALL_DIR ${EXTPREFIX_qt}
BUILD_COMMAND $(MAKE)
......@@ -141,7 +142,8 @@ elseif (NOT APPLE)
CMAKE_ARGS -DOPENSSL_LIBS='-L${EXTPREFIX_qt}/lib -lssl -lcrypto'
CONFIGURE_COMMAND <SOURCE_DIR>/configure -prefix ${EXTPREFIX_qt} -opensource -confirm-license -openssl-linked -verbose -nomake examples -skip qt3d -skip qtactiveqt -skip qtcanvas3d -skip qtconnectivity -skip qtgraphicaleffects -skip qtlocation -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip qtandroidextras -skip qtserialport -skip qtdatavis3d -skip qtvirtualkeyboard -skip qtspeech -skip qtsensors -skip qtgamepad -skip qtscxml -skip qtremoteobjects -skip qtxmlpatterns -skip qtnetworkauth -skip qtcharts -skip qtdatavis3d -skip qtgamepad -skip qtpurchasing -skip qtscxml -skip qtserialbus -skip qtspeech -skip qtvirtualkeyboard -skip qtmultimedia -qt-sqlite
CONFIGURE_COMMAND <SOURCE_DIR>/configure -prefix ${EXTPREFIX_qt} -opensource -confirm-license -openssl-linked -verbose -nomake examples -skip qt3d -skip qtactiveqt -skip qtcanvas3d -skip qtconnectivity -skip qtgraphicaleffects -skip qtlocation -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip qtandroidextras -skip qtserialport -skip qtdatavis3d -skip qtvirtualkeyboard -skip qtspeech -skip qtsensors -skip qtgamepad -skip qtscxml -skip qtremoteobjects -skip qtxmlpatterns -skip qtnetworkauth -skip qtcharts -skip qtdatavis3d -skip qtgamepad -skip qtpurchasing -skip qtscxml -skip qtserialbus -skip qtspeech -skip qtvirtualkeyboard -qt-sqlite
INSTALL_DIR ${EXTPREFIX_qt}
BUILD_COMMAND $(MAKE)
......
......@@ -306,6 +306,29 @@ extern "C" int main(int argc, char **argv)
originalXdgDataDirs = "/usr/local/share/:/usr/share/";
}
qputenv("XDG_DATA_DIRS", QFile::encodeName(root + "share") + ":" + originalXdgDataDirs);
// APPIMAGE SOUND ADDITIONS
// GStreamer needs a few environment variables to properly function in an appimage context.
// The following code should be configured to **only** run when we detect that Krita is being
// run within an appimage. Checking for the presence of an APPDIR path env variable seems to be
// enough to filter out this step for non-appimage krita builds.
const bool isInAppimage = qEnvironmentVariableIsSet("APPIMAGE");
if (isInAppimage) {
QByteArray appimageMountDir = qgetenv("APPDIR");
//We need to add new gstreamer plugin paths for the system to find the
//appropriate plugins.
const QByteArray gstPluginSystemPath = qgetenv("GST_PLUGIN_SYSTEM_PATH_1_0");
const QByteArray gstPluginScannerPath = qgetenv("GST_PLUGIN_SCANNER");
//Plugins Path is where libgstreamer-1.0 should expect to find plugin libraries.
qputenv("GST_PLUGIN_SYSTEM_PATH_1_0", appimageMountDir + QFile::encodeName("/usr/lib/gstreamer-1.0/") + ":" + gstPluginSystemPath);
//Plugin scanner is where gstreamer should expect to find the plugin scanner.
//Perhaps invoking the scanenr earlier in the code manually could allow ldd to quickly find all plugin dependencies?
qputenv("GST_PLUGIN_SCANNER", appimageMountDir + QFile::encodeName("/usr/lib/gstreamer-1.0/gst-plugin-scanner"));
}
}
#else
qputenv("XDG_DATA_DIRS", QFile::encodeName(root + "share"));
......
......@@ -186,15 +186,49 @@ if [ -n "$STRIP_APPIMAGE" ]; then
rm -f $TEMPFILE
fi
# GStreamer + QTMultimedia Support
export GSTREAMER_TARGET=$APPDIR/usr/lib/gstreamer-1.0
# First, lets get the GSTREAMER plugins installed.
# For now, I'm just going to install all plugins. Once it's working, I'll start picking individual libs that Krita actually needs.
mkdir -p $GSTREAMER_TARGET
install -Dm 755 /usr/lib/x86_64-linux-gnu/gstreamer-1.0/*.so $GSTREAMER_TARGET/
install -Dm 755 /usr/lib/x86_64-linux-gnu/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner $GSTREAMER_TARGET/gst-plugin-scanner
install -Dm 755 /usr/lib/x86_64-linux-gnu/libgstreamer-1.0.so $APPDIR/usr/lib/
GSTREAMER_BINARIES="-executable=${GSTREAMER_TARGET}/gst-plugin-scanner -executable=${APPDIR}/usr/lib/libgstreamer-1.0.so"
for plugin in alsa app audioconvert audioparsers audioresample autodetect \
coreelements id3demux jack mpg123 mulaw playback pulse \
typefindfunctions wavparse; do
GSTREAMER_BINARIES="${GSTREAMER_BINARIES} -executable=${GSTREAMER_TARGET}/libgst${plugin}.so"
done
# Second, we need the mediaservice QT plugins to be installed.
mkdir -p $APPDIR/usr/plugins/mediaservice
install -Dm 755 $DEPS_INSTALL_PREFIX/plugins/mediaservice/*.so $APPDIR/usr/plugins/mediaservice/
QT_MEDIA_SERVICES=""
for plugin in audiodecoder mediaplayer mediacapture; do
QT_MEDIA_SERVICES="${QT_MEDIA_SERVICES} -executable=${APPDIR}/usr/plugins/mediaservice/libgst${plugin}.so"
done
# Step 4: Build the image!!!
linuxdeployqt $APPDIR/usr/share/applications/org.kde.krita.desktop \
-executable=$APPDIR/usr/bin/krita \
$GSTREAMER_BINARIES \
$QT_MEDIA_SERVICES \
-qmldir=$DEPS_INSTALL_PREFIX/qml \
-verbose=2 \
-bundle-non-qt-libs \
-extra-plugins=$PLUGINS,$APPDIR/usr/lib/krita-python-libs/PyKrita/krita.so,$APPDIR/usr/lib//qml/org/krita/sketch/libkritasketchplugin.so,$APPDIR/usr/lib/qml/org/krita/draganddrop/libdraganddropplugin.so \
-extra-plugins=mediaservice,$PLUGINS,$APPDIR/usr/lib/krita-python-libs/PyKrita/krita.so,$APPDIR/usr/lib//qml/org/krita/sketch/libkritasketchplugin.so,$APPDIR/usr/lib/qml/org/krita/draganddrop/libdraganddropplugin.so \
-updateinformation="${ZSYNC_URL}" \
-appimage
# Currently, we're skipping linuxdeployqt's automatic image building because it's choosing to ignore the inclusion of QtMultimedia.
# I have an issue pending on linuxdeployqt's github page, but for the time being, manually bundling with appimagetool after linuxdeployqt
# seems to work without any regressions.
appimagetool $APPDIR $BUILD_PREFIX/Krita-$VERSION-$ARCH.AppImage
# Generate a new name for the Appimage file and rename it accordingly
......@@ -206,6 +240,6 @@ else
APPIMAGE_ARCHITECTURE=$ARCH
fi
OLD_APPIMAGE_NAME="Krita-${VERSION}-${APPIMAGE_ARCHITECTURE}.AppImage"
OLD_APPIMAGE_NAME="Krita-${VERSION}-${ARCH}.AppImage"
NEW_APPIMAGE_NAME="krita-${VERSION}-${APPIMAGE_ARCHITECTURE}.appimage"
mv ${OLD_APPIMAGE_NAME} ${NEW_APPIMAGE_NAME}