Unverified Commit 5220b6e2 authored by Lily Foster's avatar Lily Foster
Browse files

plymouth: unstable-2021-10-18 -> unstable-2023-06-05



Includes switch from autotools-based build system to meson-based build
system.

Co-Authored-By: default avatarIlan Joselevich <personal@ilanjoselevich.com>
parent 0eeebd64
Loading
Loading
Loading
Loading
+67 −0
Original line number Diff line number Diff line
diff --git a/meson.build b/meson.build
index 650ad189..1e1ebe1d 100644
--- a/meson.build
+++ b/meson.build
@@ -18,6 +18,11 @@ plymouth_time_dir = get_option('prefix') / get_option('localstatedir') / 'lib' /
 
 plymouth_runtime_dir = get_option('runstatedir') / 'plymouth'
 plymouth_runtime_theme_path = plymouth_runtime_dir / 'themes/'
+if get_option('runtime-plugins')
+  plymouth_runtime_plugin_path = plymouth_runtime_dir / 'plugins/'
+else
+  plymouth_runtime_plugin_path = plymouth_plugin_path
+endif
 
 # Dependencies
 cc = meson.get_compiler('c')
@@ -76,7 +81,7 @@ conf.set('PLY_ENABLE_TRACING', get_option('tracing'))
 conf.set_quoted('PLYMOUTH_RUNTIME_DIR', plymouth_runtime_dir)
 conf.set_quoted('PLYMOUTH_THEME_PATH', plymouth_theme_path)
 conf.set_quoted('PLYMOUTH_RUNTIME_THEME_PATH', plymouth_runtime_theme_path)
-conf.set_quoted('PLYMOUTH_PLUGIN_PATH', plymouth_plugin_path)
+conf.set_quoted('PLYMOUTH_PLUGIN_PATH', plymouth_runtime_plugin_path)
 conf.set_quoted('PLYMOUTH_POLICY_DIR', plymouth_policy_dir)
 conf.set_quoted('PLYMOUTH_CONF_DIR', plymouth_conf_dir)
 conf.set_quoted('PLYMOUTH_TIME_DIRECTORY', plymouth_time_dir)
diff --git a/meson_options.txt b/meson_options.txt
index 4f601bb0..61fccc12 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -28,6 +28,11 @@ option('runstatedir',
   value: '/run',
   description: 'runstatedir',
 )
+option('runtime-plugins',
+  type: 'boolean',
+  value: false,
+  description: 'Use runstatedir for loading theme plugins',
+)
 option('boot-tty',
   type: 'string',
   value: '/dev/tty1',
diff --git a/src/libply-splash-core/meson.build b/src/libply-splash-core/meson.build
index 69636b13..02bd5cbd 100644
--- a/src/libply-splash-core/meson.build
+++ b/src/libply-splash-core/meson.build
@@ -31,7 +31,7 @@ libply_splash_core_cflags = [
   '-DPLYMOUTH_BACKGROUND_COLOR=@0@'.format(get_option('background-color')),
   '-DPLYMOUTH_BACKGROUND_START_COLOR=@0@'.format(get_option('background-start-color-stop')),
   '-DPLYMOUTH_BACKGROUND_END_COLOR=@0@'.format(get_option('background-end-color-stop')),
-  '-DPLYMOUTH_PLUGIN_PATH="@0@"'.format(plymouth_plugin_path),
+  '-DPLYMOUTH_PLUGIN_PATH="@0@"'.format(plymouth_runtime_plugin_path),
 ]
 
 libply_splash_core = library('ply-splash-core',
diff --git a/src/libply-splash-graphics/meson.build b/src/libply-splash-graphics/meson.build
index 32fad963..02b8440b 100644
--- a/src/libply-splash-graphics/meson.build
+++ b/src/libply-splash-graphics/meson.build
@@ -20,7 +20,7 @@ libply_splash_graphics_cflags = [
   '-DPLYMOUTH_BACKGROUND_COLOR=@0@'.format(get_option('background-color')),
   '-DPLYMOUTH_BACKGROUND_START_COLOR=@0@'.format(get_option('background-start-color-stop')),
   '-DPLYMOUTH_BACKGROUND_END_COLOR=@0@'.format(get_option('background-end-color-stop')),
-  '-DPLYMOUTH_PLUGIN_PATH="@0@"'.format(plymouth_plugin_path),
+  '-DPLYMOUTH_PLUGIN_PATH="@0@"'.format(plymouth_runtime_plugin_path),
 ]
 
 libply_splash_graphics = library('ply-splash-graphics',
+74 −56
Original line number Diff line number Diff line
{ lib
, stdenv
, fetchpatch
, fetchFromGitLab
, writeText
, meson
, pkg-config
, autoreconfHook
, libxslt
, ninja
, docbook-xsl-nons
, gettext
, libxslt
, gtk3
, systemd
, pango
, cairo
, libdrm
, libevdev
, libpng
, libxkbcommon
, pango
, systemd
, xorg
}:

stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
  pname = "plymouth";
  version = "unstable-2021-10-18";
  version = "unstable-2023-06-05";

  outputs = [
    "out"
    "dev"
  ];
  outputs = [ "out" "dev" ];

  src = fetchFromGitLab {
    domain = "gitlab.freedesktop.org";
    owner = "plymouth";
    repo = "plymouth";
    rev = "18363cd887dbfe7e82a2f4cc1a49ef9513919142";
    sha256 = "sha256-+AP4ALOFdYFt/8MDXjMaHptkogCwK1iXKuza1zfMaws=";
    rev = "a5eda165689864cc9a25ec14fd8c6da458598f42";
    hash = "sha256-TpMZZ0naC4D0Knmclc8JpmXPfnpM6q8YotIkNX+aRVo=";
  };

  patches = [
    # do not create unnecessary symlink to non-existent header-image.png
    ./dont-create-broken-symlink.patch
    # add support for loading plugins from /run to assist NixOS module
    ./add-runtime-plugin-path.patch
  ];

  strictDeps = true;

  nativeBuildInputs = [
    autoreconfHook
    meson
    pkg-config
    ninja
    docbook-xsl-nons
    gettext
    libxslt
    pkg-config
  ];

  buildInputs = [
    cairo
    gtk3
    libdrm
    libevdev
    libpng
    libxkbcommon
    pango
    systemd
    xorg.xkeyboardconfig
  ];

  postPatch = ''
    sed -i \
      -e "s#plymouthplugindir=.*#plymouthplugindir=/etc/plymouth/plugins/#" \
      -e "s#plymouththemedir=.*#plymouththemedir=/etc/plymouth/themes#" \
      -e "s#plymouthpolicydir=.*#plymouthpolicydir=/etc/plymouth/#" \
      -e "s#plymouthconfdir=.*#plymouthconfdir=/etc/plymouth/#" \
      configure.ac
  mesonFlags = let
    # https://gitlab.freedesktop.org/plymouth/plymouth/-/blob/a5eda165689864cc9a25ec14fd8c6da458598f42/meson.build#L47
    crossFile = writeText "cross-file.conf" ''
      [binaries]
      systemd-tty-ask-password-agent = '${lib.getBin systemd}/bin/systemd-tty-ask-password-agent'
    '';

  configurePlatforms = [ "host" ];

  configureFlags = [
    "--enable-documentation"
    "--enable-drm"
    "--enable-gtk"
    "--enable-pango"
    "--enable-systemd-integration"
    "--enable-tracing"
    "--localstatedir=/var"
  in [
    "--sysconfdir=/etc"
    "--with-background-color=0x000000"
    "--with-background-end-color-stop=0x000000"
    "--with-background-start-color-stop=0x000000"
    "--with-logo=/etc/plymouth/logo.png"
    "--with-release-file=/etc/os-release"
    "--with-runtimedir=/run"
    "--with-systemdunitdir=${placeholder "out"}/etc/systemd/system"
    "--without-rhgb-compat-link"
    "--without-system-root-install"
    "ac_cv_path_SYSTEMD_ASK_PASSWORD_AGENT=${lib.getBin systemd}/bin/systemd-tty-ask-password-agent"
    "--localstatedir=/var"
    "-Dlogo=/etc/plymouth/logo.png"
    "-Dbackground-color=0x000000"
    "-Dbackground-start-color-stop=0x000000"
    "-Dbackground-end-color-stop=0x000000"
    "-Drelease-file=/etc/os-release"
    "-Dudev=enabled"
    "-Drunstatedir=/run"
    "-Druntime-plugins=true"
    "--cross-file=${crossFile}"
  ];

  installFlags = [
    "localstatedir=\${TMPDIR}"
    "plymouthd_confdir=${placeholder "out"}/etc/plymouth"
    "plymouthd_defaultsdir=${placeholder "out"}/share/plymouth"
    "sysconfdir=${placeholder "out"}/etc"
  ];
  postPatch = ''
    substituteInPlace meson.build \
      --replace "run_command(['scripts/generate-version.sh'], check: true).stdout().strip()" "'${finalAttrs.version}'"

    # prevent installing unused non-$out dirs to DESTDIR
    sed -i '/^install_emptydir/d' src/meson.build
  '';

  postInstall = ''
    # Makes a symlink to /usr/share/pixmaps/system-logo-white.png
    # We'll handle it in the nixos module.
    rm $out/share/plymouth/themes/spinfinity/header-image.png
    # Move stuff from DESTDIR to proper location.
    cp -a "$DESTDIR/etc" "$out"
    rm -r "$DESTDIR/etc"
    for o in $(getAllOutputNames); do
        if [[ "$o" = "debug" ]]; then continue; fi
        cp -a "$DESTDIR/''${!o}" "$(dirname "''${!o}")"
        rm -r "$DESTDIR/''${!o}"
    done
    # Ensure the DESTDIR is removed.
    rmdir "$DESTDIR/${builtins.storeDir}" "$DESTDIR/${builtins.dirOf builtins.storeDir}" "$DESTDIR"
  '';

  # HACK: We want to install configuration files to $out/etc
  # but Plymouth should read them from /etc on a NixOS system.
  # With autotools, it was possible to override Make variables
  # at install time but Meson does not support this
  # so we need to convince it to install all files to a temporary
  # location using DESTDIR and then move it to proper one in postInstall.
  env.DESTDIR = "${placeholder "out"}/dest";

  meta = with lib; {
    homepage = "https://www.freedesktop.org/wiki/Software/Plymouth/";
    description = "Boot splash and boot logger";
@@ -99,4 +117,4 @@ stdenv.mkDerivation rec {
    maintainers = [ maintainers.goibhniu ] ++ teams.gnome.members;
    platforms = platforms.linux;
  };
}
})
+13 −0
Original line number Diff line number Diff line
diff --git a/themes/spinfinity/meson.build b/themes/spinfinity/meson.build
index f48e8e55..5a2050c8 100644
--- a/themes/spinfinity/meson.build
+++ b/themes/spinfinity/meson.build
@@ -53,8 +53,3 @@ install_data(
   'throbber-33.png',
   install_dir: plymouth_theme_path / 'spinfinity',
 )
-
-install_symlink('header-image.png',
-  install_dir: plymouth_theme_path / 'spinfinity',
-  pointing_to: plymouth_logo_file,
-)