Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New kde-neon extension for Qt6 / KF6 #4698

Merged
merged 38 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
b39bd55
WIP: kde-neon-6 ext for qt6 and kf6.
ScarlettGatelyMoore Mar 21, 2024
62022fd
WIP: KDE neon 6 extension. Add tests, add to the registry.
ScarlettGatelyMoore Mar 25, 2024
d22cf0d
Merge branch 'canonical:main' into sgmoore/kde-neon-6
ScarlettGatelyMoore Mar 26, 2024
724189e
dd spread test, registry update.
ScarlettGatelyMoore Mar 26, 2024
3a75bb1
Fix make parameters to set PLATFORM_PLUG to kf6 content pack.
ScarlettGatelyMoore Mar 27, 2024
85a8057
Merge branch 'main' into sgmoore/kde-neon-6
ScarlettGatelyMoore Mar 27, 2024
f8c133e
Fix Makefile to install to kf6.
ScarlettGatelyMoore Mar 27, 2024
4dae759
Add spread test for kde-neon-6
ScarlettGatelyMoore Mar 28, 2024
c25911c
Merge branch 'main' into sgmoore/kde-neon-6
ScarlettGatelyMoore Mar 28, 2024
73ae265
Fix app name for kde-neon-6 spread test.
ScarlettGatelyMoore Mar 28, 2024
dd2c9a4
kde-neon-6: Fix LD_LIBRARY_CONFIG to point to correct paths.
ScarlettGatelyMoore Mar 28, 2024
8d0ce16
kde-neon-6: Seems we can only have one dir for runtime, use kf6.
ScarlettGatelyMoore Mar 28, 2024
5b656b8
Merge branch 'main' into sgmoore/kde-neon-6
ScarlettGatelyMoore Mar 29, 2024
2c5779e
Merge branch 'main' into sgmoore/kde-neon-6
ScarlettGatelyMoore Apr 2, 2024
66d96d6
Update snapcraft/extensions/kde_neon_6.py
ScarlettGatelyMoore Apr 2, 2024
a6ca1cf
Update snapcraft/extensions/kde_neon_6.py
ScarlettGatelyMoore Apr 2, 2024
1a34e75
Update tests/unit/extensions/test_kde_neon_6.py
ScarlettGatelyMoore Apr 2, 2024
5ed379a
Update snapcraft/extensions/kde_neon_6.py
ScarlettGatelyMoore Apr 2, 2024
29f91e7
Update snapcraft/extensions/kde_neon_6.py
ScarlettGatelyMoore Apr 2, 2024
66b2ca8
Update snapcraft/extensions/kde_neon_6.py
ScarlettGatelyMoore Apr 2, 2024
db99d61
kde-neon-6: Update tests to reflect changes.
ScarlettGatelyMoore Apr 2, 2024
ff9bc4e
Merge branch 'main' into sgmoore/kde-neon-6
ScarlettGatelyMoore Apr 4, 2024
15b394d
Merge branch 'main' into sgmoore/kde-neon-6
lengau Apr 4, 2024
9f08714
Update snapcraft/extensions/kde_neon_6.py
ScarlettGatelyMoore Apr 5, 2024
a19d949
Merge branch 'main' into sgmoore/kde-neon-6
ScarlettGatelyMoore Apr 5, 2024
9afc05a
Fix libgl dep and add 2 more common deps.
ScarlettGatelyMoore Apr 8, 2024
a11a5fd
Fix typo.
ScarlettGatelyMoore Apr 8, 2024
7f735de
Update snapcraft/extensions/kde_neon_6.py
lengau Apr 8, 2024
457c891
Merge branch 'main' into sgmoore/kde-neon-6
ScarlettGatelyMoore Apr 9, 2024
221e23c
Bring in fix 2b439f9e75c1e05e1aa5219a455c8239c3e79f9a for $HOME dirs.
ScarlettGatelyMoore Apr 9, 2024
44c5615
Revert "Bring in fix 2b439f9e75c1e05e1aa5219a455c8239c3e79f9a for $HO…
ScarlettGatelyMoore Apr 9, 2024
f6e152a
Merge branch 'main' into sgmoore/kde-neon-6
sergiusens Apr 9, 2024
070a7d2
Revert "Revert "Bring in fix 2b439f9e75c1e05e1aa5219a455c8239c3e79f9a…
ScarlettGatelyMoore Apr 9, 2024
931032c
Fix the missinf fi.
ScarlettGatelyMoore Apr 9, 2024
23bab95
Manual connect neon kf6-core22 content pack for now.
ScarlettGatelyMoore Apr 9, 2024
8d259fa
Merge branch 'main' into sgmoore/kde-neon-6
ScarlettGatelyMoore Apr 9, 2024
33010df
Merge branch 'main' into sgmoore/kde-neon-6
ScarlettGatelyMoore Apr 9, 2024
c499e62
Don't test for the qt6 content pack as we don't need it.
ScarlettGatelyMoore Apr 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions extensions/desktop/kde-neon-6/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/make -f

SRC_DIR ?= .

DATA_DIR := $(DESTDIR)/data-dir
BIN_DIR := $(DESTDIR)/snap/command-chain
LIB_DIR := $(DESTDIR)/lib
DEST_LAUNCHER := desktop-launch6
LOCALE_GENERATOR := locale-gen
DEST_CONFIGURE_HOOK := hooks-configure-desktop

build: $(DEST_LAUNCHER) $(DEST_CONFIGURE_HOOK)

clean:
rm -f $(DEST_LAUNCHER)
rm -f $(DEST_CONFIGURE_HOOK)
rm -f $(BINDTEXTDOMAIN)

$(DEST_LAUNCHER):
@cat $(SRC_DIR)/init > $(DEST_LAUNCHER)
# tail -n +2 to remove the shebang
@tail -n +2 $(SRC_DIR)/desktop-exports | sed -e "s/%PLATFORM_PLUG%/$${PLATFORM_PLUG:?}/" >> $(DEST_LAUNCHER)
@tail -n +2 $(SRC_DIR)/launcher-specific >> $(DEST_LAUNCHER)
@tail -n +2 $(SRC_DIR)/mark-and-exec >> $(DEST_LAUNCHER)

$(DEST_CONFIGURE_HOOK):
@cat $(SRC_DIR)/fonts > $(DEST_CONFIGURE_HOOK)

install: $(DEST_LAUNCHER) $(DEST_CONFIGURE_HOOK)
install -d $(DATA_DIR)
install -d $(DATA_DIR)/kf6
install -D -m755 $(DEST_LAUNCHER) "$(BIN_DIR)"/$(DEST_LAUNCHER)
install -D -m755 $(LOCALE_GENERATOR) "$(BIN_DIR)"/$(LOCALE_GENERATOR)
install -D -m755 $(DEST_CONFIGURE_HOOK) "$(BIN_DIR)"/$(DEST_CONFIGURE_HOOK)
1 change: 1 addition & 0 deletions extensions/desktop/kde-neon-6/desktop-exports
1 change: 1 addition & 0 deletions extensions/desktop/kde-neon-6/fonts
1 change: 1 addition & 0 deletions extensions/desktop/kde-neon-6/init
69 changes: 69 additions & 0 deletions extensions/desktop/kde-neon-6/launcher-specific
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/bin/bash
ScarlettGatelyMoore marked this conversation as resolved.
Show resolved Hide resolved
###################################
# KDE NEON launcher specific part #
###################################

# Add paths for games
append_dir PATH "$SNAP/usr/games"
append_dir PATH "$SNAP_DESKTOP_RUNTIME/usr/games"

# Qt Libs
prepend_dir LD_LIBRARY_PATH "$SNAP_DESKTOP_RUNTIME/usr/lib/$ARCH"

# Add QT_PLUGIN_PATH (Qt Modules).
append_dir QT_PLUGIN_PATH "$SNAP/usr/lib/$ARCH/qt6/plugins"
append_dir QT_PLUGIN_PATH "$SNAP/usr/lib/$ARCH"
append_dir QT_PLUGIN_PATH "$SNAP_DESKTOP_RUNTIME/usr/lib/$ARCH/qt6/plugins"
append_dir QT_PLUGIN_PATH "$SNAP_DESKTOP_RUNTIME/usr/lib/$ARCH/"
# And QML2_IMPORT_PATH (Qt Modules).
append_dir QML2_IMPORT_PATH "$SNAP/usr/lib/$ARCH/qt6/qml"
append_dir QML2_IMPORT_PATH "$SNAP/lib/$ARCH"
append_dir QML2_IMPORT_PATH "$SNAP_DESKTOP_RUNTIME/usr/lib/$ARCH/qt6/qml"
append_dir QML2_IMPORT_PATH "$SNAP_DESKTOP_RUNTIME/lib/$ARCH"

# Fix locating the QtWebEngineProcess executable
export QTWEBENGINEPROCESS_PATH="$SNAP_DESKTOP_RUNTIME/usr/lib/$ARCH/qt6/libexec/QtWebEngineProcess"

# Removes Qt warning: Could not find a location
# of the system Compose files
export QTCOMPOSE="$SNAP_DESKTOP_RUNTIME/usr/share/X11/locale"
export QT_XKB_CONFIG_ROOT="/usr/share/X11/xkb"

# KIO specific
# Directly fork slaves.
export KDE_FORK_SLAVES=1
# Path to KIO slaves.
export KF6_LIBEXEC_DIR="$SNAP_DESKTOP_RUNTIME/usr/lib/$ARCH/libexec/kf6"

# Add path to VLC plugins
export VLC_PLUGIN_PATH="$SNAP_DESKTOP_RUNTIME/usr/lib/$ARCH/vlc/plugins"

# Ensure QtChooser behaves.
export QTCHOOSER_NO_GLOBAL_DIR=1
export QT_SELECT=6
# qtchooser hardcodes reference paths, we'll need to rewrite them properly
ensure_dir_exists "$XDG_CONFIG_HOME/qtchooser"
echo "$SNAP/usr/lib/qt6/bin" > "$XDG_CONFIG_HOME/qtchooser/6.conf"
echo "$SNAP/usr/lib/$ARCH" >> "$XDG_CONFIG_HOME/qtchooser/6.conf"
echo "$SNAP/usr/lib/qt6/bin" > "$XDG_CONFIG_HOME/qtchooser/default.conf"
echo "$SNAP/usr/lib/$ARCH" >> "$XDG_CONFIG_HOME/qtchooser/default.conf"

# This relies on qtbase patch
# 0001-let-qlibraryinfo-fall-back-to-locate-qt.conf-via-XDG.patch
# to make QLibraryInfo look in XDG_* locations for qt.conf. The paths configured
# here are applied to everything that uses QLibraryInfo as final fallback and
# has no XDG_* fallback before that. Currently the most interesting offender
# is QtWebEngine which will not work unless the Data path is correctly set.
cat << EOF > "$XDG_CONFIG_HOME/qt.conf"
[Paths]
Data = $SNAP_DESKTOP_RUNTIME/usr/share/qt6/
Translations = $SNAP_DESKTOP_RUNTIME/usr/share/qt6/translations
EOF

if [ -e "$SNAP_DESKTOP_RUNTIME/usr/share/i18n" ]; then
export I18NPATH="$SNAP_DESKTOP_RUNTIME/usr/share/i18n"
locpath="$XDG_DATA_HOME/locale"
ensure_dir_exists "$locpath"
export LOCPATH="$locpath:/usr/lib/locale"
LC_ALL=C.UTF-8 async_exec "$SNAP/snap/command-chain/locale-gen"
fi
62 changes: 62 additions & 0 deletions extensions/desktop/kde-neon-6/locale-gen
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/usr/bin/perl

use strict;

sub uniq
{
my %seen;
grep !$seen{$_}++, @_;
}

# TODO support for KDE's in-app language switch feature.
ScarlettGatelyMoore marked this conversation as resolved.
Show resolved Hide resolved
sub get_languages
{
# Initialize with sane defaults.
my @found_languages = ($ENV{'LANG'} or 'C.UTF-8');

# Go through LC_.
foreach (sort keys %ENV)
{
if (substr($_, 0, length("LC_")) eq "LC_")
{
push(@found_languages, $ENV{$_});
}
}
# And finally LANGUAGE, but normalize it.
if (my $language = $ENV{'LANGUAGE'})
{
foreach (split(':', $language))
{
push(@found_languages, "$_.UTF-8");
}
}

# Remove duplicates before returning.
@found_languages = uniq(@found_languages);

return @found_languages
}

my $env_locpath = $ENV{'LOCPATH'} or die "LOCPATH must be set";
my @locpaths = split(/:/, $env_locpath);

foreach my $lang (get_languages())
{
my $found = 0;
foreach my $locpath (@locpaths)
{
my $loc_target = "$locpath/$lang";
if (-e $loc_target)
{
$found = 1;
last;
}
}
next if $found;
my $target = "@locpaths[0]/$lang";

# localedef will exit !0 for unknown reasons, even when everything was
# generated fine.
my ($locale, $encoding) = split(/\./, $lang);
system('localedef', '-i', $locale, '-f', $encoding, $target);
}
1 change: 1 addition & 0 deletions extensions/desktop/kde-neon-6/mark-and-exec
Loading
Loading