nixpkgs/pkgs/development/libraries/libxklavier/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

51 lines
1.7 KiB
Nix

{ lib, stdenv, fetchgit, fetchpatch, autoreconfHook, pkg-config, gtk-doc, xkeyboard_config, libxml2, xorg, docbook_xsl
, glib, isocodes, gobject-introspection
, withDoc ? (stdenv.buildPlatform == stdenv.hostPlatform)
}:
stdenv.mkDerivation rec {
pname = "libxklavier";
version = "5.4";
src = fetchgit {
url = "https://gitlab.freedesktop.org/archived-projects/libxklavier.git";
rev = "${pname}-${version}";
sha256 = "1w1x5mrgly2ldiw3q2r6y620zgd89gk7n90ja46775lhaswxzv7a";
};
patches = [
./honor-XKB_CONFIG_ROOT.patch
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
(fetchpatch {
url = "https://gitlab.freedesktop.org/archived-projects/libxklavier/-/commit/1387c21a788ec1ea203c8392ea1460fc29d83f70.patch";
sha256 = "sha256-fyWu7sVfDv/ozjhLSLCVsv+iNFawWgJqHUsQHHSkQn4=";
})
];
outputs = [ "out" "dev" ] ++ lib.optionals withDoc [ "devdoc" ];
# TODO: enable xmodmap support, needs xmodmap DB
propagatedBuildInputs = with xorg; [ libX11 libXi xkeyboard_config libxml2 libICE glib libxkbfile isocodes ];
nativeBuildInputs = [ autoreconfHook pkg-config gtk-doc docbook_xsl gobject-introspection ];
preAutoreconf = ''
export NOCONFIGURE=1
gtkdocize
'';
configureFlags = [
"--with-xkb-base=${xkeyboard_config}/etc/X11/xkb"
"--with-xkb-bin-base=${xorg.xkbcomp}/bin"
"--disable-xmodmap-support"
"${if withDoc then "--enable-gtk-doc" else "--disable-gtk-doc"}"
];
meta = with lib; {
description = "Library providing high-level API for X Keyboard Extension known as XKB";
homepage = "http://freedesktop.org/wiki/Software/LibXklavier";
license = licenses.lgpl2Plus;
platforms = platforms.unix;
};
}