mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-27 17:33:09 +00:00
Merge pull request #268535 from jtojnar/destdir-hack-cleanups
gnome.gdm, upower: Simplify DESTDIR hack
This commit is contained in:
commit
4c10797e5b
@ -5,7 +5,6 @@
|
||||
, substituteAll
|
||||
, meson
|
||||
, ninja
|
||||
, rsync
|
||||
, pkg-config
|
||||
, glib
|
||||
, itstool
|
||||
@ -70,7 +69,6 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
meson
|
||||
ninja
|
||||
pkg-config
|
||||
rsync
|
||||
gobject-introspection
|
||||
];
|
||||
|
||||
@ -131,33 +129,36 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
'';
|
||||
|
||||
preInstall = ''
|
||||
install -D ${override} $DESTDIR/$out/share/glib-2.0/schemas/org.gnome.login-screen.gschema.override
|
||||
install -D ${override} "$DESTDIR/$out/share/glib-2.0/schemas/org.gnome.login-screen.gschema.override"
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
# Move stuff from DESTDIR to proper location.
|
||||
# We use rsync to merge the directories.
|
||||
rsync --archive "$DESTDIR/etc" "$out"
|
||||
rm --recursive "$DESTDIR/etc"
|
||||
for o in $(getAllOutputNames); do
|
||||
# debug is created later by _separateDebugInfo hook.
|
||||
if [[ "$o" = "debug" ]]; then continue; fi
|
||||
rsync --archive "$DESTDIR/''${!o}" "$(dirname "''${!o}")"
|
||||
rm --recursive "$DESTDIR/''${!o}"
|
||||
mv "$DESTDIR''${!o}" "$(dirname "''${!o}")"
|
||||
done
|
||||
# Ensure the DESTDIR is removed.
|
||||
rmdir "$DESTDIR/nix/store" "$DESTDIR/nix" "$DESTDIR"
|
||||
|
||||
mv "$DESTDIR/etc" "$out"
|
||||
|
||||
# Ensure we did not forget to install anything.
|
||||
rmdir --parents --ignore-fail-on-non-empty "$DESTDIR${builtins.storeDir}"
|
||||
! test -e "$DESTDIR"
|
||||
|
||||
# We are setting DESTDIR so the post-install script does not compile the schemas.
|
||||
glib-compile-schemas "$out/share/glib-2.0/schemas"
|
||||
'';
|
||||
|
||||
# HACK: We want to install configuration files to $out/etc
|
||||
# but GDM 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.
|
||||
DESTDIR = "${placeholder "out"}/dest";
|
||||
env = {
|
||||
# HACK: We want to install configuration files to $out/etc
|
||||
# but GDM 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.
|
||||
DESTDIR = "dest";
|
||||
};
|
||||
|
||||
separateDebugInfo = true;
|
||||
|
||||
|
@ -3,7 +3,6 @@
|
||||
, fetchFromGitLab
|
||||
, makeWrapper
|
||||
, pkg-config
|
||||
, rsync
|
||||
, libxslt
|
||||
, meson
|
||||
, ninja
|
||||
@ -69,7 +68,6 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
libxslt
|
||||
makeWrapper
|
||||
pkg-config
|
||||
rsync
|
||||
glib
|
||||
] ++ lib.optionals withIntrospection [
|
||||
gobject-introspection
|
||||
@ -138,7 +136,6 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
# Our gobject-introspection patches make the shared library paths absolute
|
||||
# in the GIR files. When running tests, the library is not yet installed,
|
||||
# though, so we need to replace the absolute path with a local one during build.
|
||||
# We are using a symlink that will be overwitten during installation.
|
||||
mkdir -p "$out/lib"
|
||||
ln -s "$PWD/libupower-glib/libupower-glib.so" "$out/lib/libupower-glib.so.3"
|
||||
'';
|
||||
@ -159,21 +156,28 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
# meson rebuild during install and it is not used at runtime anyway.
|
||||
sed -Ei 's~#!.+/bin/python3~#!/usr/bin/python3~' \
|
||||
../src/linux/integration-test.py
|
||||
|
||||
# Undo preCheck installation since DESTDIR hack expects outputs to not exist.
|
||||
rm "$out/lib/libupower-glib.so.3"
|
||||
rmdir "$out/lib" "$out"
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
# Move stuff from DESTDIR to proper location.
|
||||
# We use rsync to merge the directories.
|
||||
for dir in etc var; do
|
||||
rsync --archive "$DESTDIR/$dir" "$out"
|
||||
rm --recursive "$DESTDIR/$dir"
|
||||
for o in $(getAllOutputNames); do
|
||||
# devdoc is created later by _multioutDocs hook.
|
||||
if [[ "$o" = "devdoc" ]]; then continue; fi
|
||||
mv "$DESTDIR''${!o}" "$(dirname "''${!o}")"
|
||||
done
|
||||
for o in out dev installedTests; do
|
||||
rsync --archive "$DESTDIR/''${!o}" "$(dirname "''${!o}")"
|
||||
rm --recursive "$DESTDIR/''${!o}"
|
||||
done
|
||||
# Ensure the DESTDIR is removed.
|
||||
rmdir "$DESTDIR/nix/store" "$DESTDIR/nix" "$DESTDIR"
|
||||
|
||||
mv "$DESTDIR/var" "$out"
|
||||
# The /etc already exist so we need to merge it.
|
||||
cp --recursive "$DESTDIR/etc" "$out"
|
||||
rm --recursive "$DESTDIR/etc"
|
||||
|
||||
# Ensure we did not forget to install anything.
|
||||
rmdir --parents --ignore-fail-on-non-empty "$DESTDIR${builtins.storeDir}"
|
||||
! test -e "$DESTDIR"
|
||||
'';
|
||||
|
||||
postFixup = ''
|
||||
@ -194,7 +198,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
# 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.
|
||||
DESTDIR = "${placeholder "out"}/dest";
|
||||
DESTDIR = "dest";
|
||||
};
|
||||
|
||||
passthru = {
|
||||
|
Loading…
Reference in New Issue
Block a user