mirror of
https://github.com/KDE/kde-linux.git
synced 2026-04-26 09:31:16 -04:00
Create scripts to set up a systemd-sysext and a full development environment
We can simplify this a lot for KDE developers setting up a new development environment. If this is merged, we can replace all of the documentation at https://community.kde.org/KDE_Linux#Setup with a single script invocation. Resolves #213
This commit is contained in:
@@ -5,6 +5,11 @@ path = "mkosi.extra/usr/share/plymouth/themes/breeze-bgrt/*"
|
||||
SPDX-FileCopyrightText = "Plymouth Developers"
|
||||
SPDX-License-Identifier = "GPL-2.0-or-later"
|
||||
|
||||
[[annotations]]
|
||||
path = "mkosi.extra/usr/share/factory/etc/xdg/kde-builder.yaml"
|
||||
SPDX-FileCopyrightText = "none"
|
||||
SPDX-License-Identifier = "CC0-1.0"
|
||||
|
||||
[[annotations]]
|
||||
path = "mkosi.extra/live/usr/calamares/desktop/branding/kde-linux/kde-symbolic.png"
|
||||
SPDX-FileCopyrightText = "2014 Uri Herrera <uri_herrera@nitrux.in> and others"
|
||||
|
||||
49
mkosi.extra/usr/bin/_kde-linux-set-up-system-development
Executable file
49
mkosi.extra/usr/bin/_kde-linux-set-up-system-development
Executable file
@@ -0,0 +1,49 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||
# SPDX-FileCopyrightText: 2025 Nate Graham <nate@kde.org>
|
||||
|
||||
# Set up the rudiments of a development environment for developing KDE software
|
||||
# that's shipped on the KDE Linux OS image
|
||||
|
||||
set -e
|
||||
|
||||
CONFIG_FILE_SOURCE=/usr/share/factory/etc/xdg/kde-builder.yaml
|
||||
CONFIG_FILE_DESTINATION=~/.config/kde-builder.yaml
|
||||
DID_SOMETHING=false
|
||||
|
||||
SYSEXT_OUTPUT="$(_kde-linux-set-up-systemd-extension)"
|
||||
echo "${SYSEXT_OUTPUT}"
|
||||
if [[ "${SYSEXT_OUTPUT}" =~ "Finished setting up extension" ]]; then
|
||||
DID_SOMETHING=true
|
||||
fi
|
||||
|
||||
echo
|
||||
if [ -f "${HOME}/.local/bin/kde-builder" ]; then
|
||||
echo "== kde-builder build tool: already installed, skipping =="
|
||||
else
|
||||
echo "== kde-builder build tool: needs setup =="
|
||||
echo 'Downloading and installing...'
|
||||
curl 'https://invent.kde.org/sdk/kde-builder/-/raw/master/scripts/initial_setup.sh' > /tmp/initial_setup.sh
|
||||
bash /tmp/initial_setup.sh
|
||||
DID_SOMETHING=true
|
||||
fi
|
||||
|
||||
echo
|
||||
if [ -f "${HOME}/.config/kde-builder.yaml" ]; then
|
||||
echo "== kde-builder config file: already present, skipping =="
|
||||
else
|
||||
echo "== kde-builder config file: needs setup =="
|
||||
echo "Copying ${CONFIG_FILE_SOURCE} to ${CONFIG_FILE_DESTINATION}..."
|
||||
cp "${CONFIG_FILE_SOURCE}" "${CONFIG_FILE_DESTINATION}"
|
||||
DID_SOMETHING=true
|
||||
fi
|
||||
|
||||
echo
|
||||
if [ "${DID_SOMETHING}" = "true" ]; then
|
||||
echo "== Done! =="
|
||||
echo "See https://community.kde.org/KDE_Linux/Develop_KDE_software#Use to learn what to do next."
|
||||
echo "See https://community.kde.org/Get_Involved/development to learn about KDE development in general."
|
||||
else
|
||||
echo "== Nothing to do! =="
|
||||
echo "Development environment already appears to be set up properly."
|
||||
fi
|
||||
39
mkosi.extra/usr/bin/_kde-linux-set-up-systemd-extension
Executable file
39
mkosi.extra/usr/bin/_kde-linux-set-up-systemd-extension
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||
# SPDX-FileCopyrightText: 2025 Nate Graham <nate@kde.org>
|
||||
|
||||
# Set up a systemd extension allowing you to create or override files in /usr/
|
||||
|
||||
set -e
|
||||
|
||||
SYSEXT_BASE_LOCATION="${HOME}/kde/usr/"
|
||||
SYSEXT_LOCATION="${SYSEXT_BASE_LOCATION}/lib/extension-release.d/"
|
||||
SYSEXT_ROOT_LOCATION=/var/lib/extensions/
|
||||
|
||||
echo
|
||||
if [ -f "${SYSEXT_LOCATION}/extension-release.kde" ]; then
|
||||
echo '== Systemd system extension: already set up, skipping =='
|
||||
else
|
||||
echo '== Systemd system extension: needs setup =='
|
||||
echo "Setting up extension at ${SYSEXT_BASE_LOCATION}..."
|
||||
|
||||
# Create directory to hold this system extension
|
||||
mkdir -p ${SYSEXT_LOCATION}
|
||||
sudo mkdir -p ${SYSEXT_ROOT_LOCATION}
|
||||
sudo ln -fs "${HOME}/kde" ${SYSEXT_ROOT_LOCATION}
|
||||
|
||||
# Copy the system os-release file to be an extension-release file that identifies this extension
|
||||
sudo cp /usr/lib/os-release "${SYSEXT_LOCATION}/extension-release.kde"
|
||||
|
||||
# Set its ID to "_any" so system updates don't break the extension
|
||||
# Skip this step if you want the extension to only work for the current system build
|
||||
sed -i "s/^ID=.*/ID=_any/g" "${SYSEXT_LOCATION}/extension-release.kde"
|
||||
|
||||
# Make the release file owned by root so it can't be accidentally removed
|
||||
sudo chown root:root "${SYSEXT_LOCATION}/extension-release.kde"
|
||||
|
||||
# Turn it on!
|
||||
sudo systemd-sysext merge
|
||||
|
||||
echo "Finished setting up extension! When you put files in ${SYSEXT_BASE_LOCATION} and run 'sudo systemd-sysext refresh', they will appear in /usr/. See https://community.kde.org/KDE_Linux/Add_or_override_content_in_/usr for more information."
|
||||
fi
|
||||
126
mkosi.extra/usr/share/factory/etc/xdg/kde-builder.yaml
Normal file
126
mkosi.extra/usr/share/factory/etc/xdg/kde-builder.yaml
Normal file
@@ -0,0 +1,126 @@
|
||||
# This file controls options to apply when configuring/building projects, and controls which projects are built in the first place.
|
||||
# List of all options: https://kde-builder.kde.org/en/configuration/conf-options-table.html
|
||||
|
||||
config-version: 2
|
||||
global:
|
||||
branch-group: kf6-qt6
|
||||
|
||||
# All KDE dependencies are already included, so don't do
|
||||
# unnecessary work
|
||||
include-dependencies: false
|
||||
|
||||
source-dir: ~/kde/src # Directory for downloaded source code
|
||||
build-dir: ~/kde/build # Directory to build KDE into before installing
|
||||
# qt-install-dir: ~/kde/qt # Directory to install Qt if kde-builder supplies it
|
||||
log-dir: ~/kde/log # Directory to write logs into
|
||||
|
||||
# Tell kde-builder to use /usr/ as the configure location, but later
|
||||
# we'll actually install everything into ~/kde/ which is the source
|
||||
# for our system extension, so all the files end up at /usr/ anyway.
|
||||
# This somewhat roundabout process is done because we want the
|
||||
# configure paths to be /usr/ to prevent issues from paths differing
|
||||
# between system and source-built stuff.
|
||||
install-dir: /usr/
|
||||
|
||||
# …Now tell kde-builder to actually install the files into ~/kde
|
||||
set-env:
|
||||
DESTDIR: "~/kde"
|
||||
|
||||
# Build RelWithDebInfo because that's our standard thing
|
||||
# Use system Qt paths to prevent issues
|
||||
# Don't build docs because we don't ship them in KDE Linux
|
||||
# Don't build Python bindings because we don't yet include their
|
||||
# dependencies out of the box
|
||||
# Merge libexec and lib, like the base OS does
|
||||
# Use ccache for everything to further avoid unnecessary work
|
||||
cmake-options: >
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DKDE_INSTALL_USE_QT_SYS_PATHS=ON -DBUILD_HTML_DOCS=OFF -DBUILD_MAN_DOCS=OFF -DBUILD_TESTING=OFF -DBUILD_PYTHON_BINDINGS=OFF -DWITH_PYTHON_VENDORING=OFF -DBUILD_QCH=OFF -DCMAKE_INSTALL_LIBEXECDIR=lib -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_LINKER_LAUNCHER=ccache -DCMAKE_CXX_LINKER_LAUNCHER=ccache
|
||||
|
||||
# kde-builder sets 2 options which is used in options like make-options or set-env
|
||||
# to help manage the number of compile jobs that happen during a build:
|
||||
#
|
||||
# 1. num-cores, which is just the number of detected CPU cores, and can be passed
|
||||
# to tools like make (needed for parallel build) or ninja (completely optional).
|
||||
#
|
||||
# 2. num-cores-low-mem, which is set to the largest value that appears safe for
|
||||
# particularly heavyweight projects based on total memory, intended for
|
||||
# projects like qtwebengine.
|
||||
num-cores: "auto"
|
||||
num-cores-low-mem: "auto"
|
||||
|
||||
# Don't install login session files since we're already building
|
||||
# everything to the final location
|
||||
install-login-session: false
|
||||
|
||||
# Stop the build process on the first failure. If set to false, when kde-builder
|
||||
# encounters a build failure, it will attempt to continue building other projects,
|
||||
# using libraries from the system in cases where they would otherwise be provided
|
||||
# by a project that has failed to build.
|
||||
# Unless your system has very up-to-date packages, this is probably not what you want.
|
||||
stop-on-failure: true
|
||||
|
||||
# Use a flat folder layout under ~/kde/src and ~/kde/build
|
||||
# rather than nested directories
|
||||
directory-layout: flat
|
||||
|
||||
# Use Ninja as cmake generator
|
||||
cmake-generator: Ninja
|
||||
|
||||
# Build with LSP support for everything that supports it
|
||||
compile-commands-linking: true
|
||||
compile-commands-export: true
|
||||
|
||||
# Generate .idea config files in project directories
|
||||
# Enable this if you want to use CLion for development
|
||||
generate-clion-project-config: false
|
||||
|
||||
# Generate .vscode config files in project directories
|
||||
# Enable this if you want to use Visual Studio Code for development
|
||||
generate-vscode-project-config: false
|
||||
|
||||
# Generate copy-pastable files for manual qtcreator config creation
|
||||
# Enable this if you want to use Qt Creator for development
|
||||
generate-qtcreator-project-config: false
|
||||
|
||||
# Show a message when kde-builder detects it is outdated.
|
||||
check-self-updates: true
|
||||
|
||||
# Projects that are not supported or needed on KDE Linux
|
||||
ignore-projects:
|
||||
# X11-only and we only ship Wayland
|
||||
- kgamma
|
||||
- kwin-x11
|
||||
- wacomtablet
|
||||
- packagekit-qt
|
||||
# Not supported on immutable distros like KDE Linux
|
||||
- plymouth-kcm
|
||||
|
||||
# With base options set, the remainder of the file is used to define projects to build, in the
|
||||
# desired order, and set any project-specific options.
|
||||
|
||||
# This line includes build configs that are provided in build-configs dir in repo-metadata.
|
||||
# https://invent.kde.org/sysadmin/repo-metadata/-/tree/master/build-configs
|
||||
# KDE Builder automatically updates repo-metadata, so you are always using an up-to-date configs.
|
||||
include ${build-configs-dir}/kde6.yaml: ""
|
||||
|
||||
# ===============================================================================================
|
||||
# Starting from here, you can add your custom projects and override options for defined projects.
|
||||
# ===============================================================================================
|
||||
|
||||
# To change options for projects that have already been defined, use an "override" node.
|
||||
# Example:
|
||||
#
|
||||
# override qt6-set:
|
||||
# branch: dev
|
||||
#
|
||||
# To define a project with some options, use "project" node.
|
||||
# Example:
|
||||
#
|
||||
# project some-app:
|
||||
# repository: https://github.com/YourUser/YourProject.git
|
||||
|
||||
override discover:
|
||||
cmake-options: -DBUILD_SystemdSysupdateBackend=ON
|
||||
|
||||
override plasma-desktop:
|
||||
cmake-options: -DBUILD_KCM_TOUCHPAD_X11=OFF
|
||||
Reference in New Issue
Block a user