summary refs log tree commit diff
diff options
context:
space:
mode:
authorSandro Jäckel <sandro.jaeckel@gmail.com>2022-09-08 01:45:21 +0200
committerArtturin <Artturin@artturin.com>2022-09-10 22:28:56 +0300
commit4795707c9aaa0760eaf24172982ce6fb94a0c7f2 (patch)
tree4184a0ec1ac7a3b55971a9dc0f3c2ad2905273e2
parent6b29af2b84aea67176da8ccb949555e705a04550 (diff)
downloadnixpkgs-4795707c9aaa0760eaf24172982ce6fb94a0c7f2.tar
nixpkgs-4795707c9aaa0760eaf24172982ce6fb94a0c7f2.tar.gz
nixpkgs-4795707c9aaa0760eaf24172982ce6fb94a0c7f2.tar.bz2
nixpkgs-4795707c9aaa0760eaf24172982ce6fb94a0c7f2.tar.lz
nixpkgs-4795707c9aaa0760eaf24172982ce6fb94a0c7f2.tar.xz
nixpkgs-4795707c9aaa0760eaf24172982ce6fb94a0c7f2.tar.zst
nixpkgs-4795707c9aaa0760eaf24172982ce6fb94a0c7f2.zip
lirc: fix cross compile
closure still depends on build python though
-rw-r--r--pkgs/development/libraries/lirc/default.nix19
1 files changed, 16 insertions, 3 deletions
diff --git a/pkgs/development/libraries/lirc/default.nix b/pkgs/development/libraries/lirc/default.nix
index 68b3b86a9ee..8e9561ecd49 100644
--- a/pkgs/development/libraries/lirc/default.nix
+++ b/pkgs/development/libraries/lirc/default.nix
@@ -1,6 +1,9 @@
 { lib, stdenv, fetchurl, fetchpatch, autoreconfHook, pkg-config, help2man, python3,
   alsa-lib, xlibsWrapper, libxslt, systemd, libusb-compat-0_1, libftdi1 }:
 
+let
+  pythonEnv = python3.pythonForBuild.withPackages (p: with p; [ pyyaml setuptools ]);
+in
 stdenv.mkDerivation rec {
   pname = "lirc";
   version = "0.10.1";
@@ -34,6 +37,10 @@ stdenv.mkDerivation rec {
     # Pull fix for new pyyaml pending upstream inclusion
     #   https://sourceforge.net/p/lirc/git/merge-requests/39/
     substituteInPlace python-pkg/lirc/database.py --replace 'yaml.load(' 'yaml.safe_load('
+
+    # cant import '/build/lirc-0.10.1/python-pkg/lirc/_client.so' while cross-compiling to check the version
+    substituteInPlace python-pkg/setup.py \
+      --replace "VERSION='0.0.0'" "VERSION='${version}'"
   '';
 
   preConfigure = ''
@@ -41,10 +48,15 @@ stdenv.mkDerivation rec {
     touch lib/lirc/input_map.inc
   '';
 
-  nativeBuildInputs = [ autoreconfHook pkg-config help2man
-    (python3.withPackages (p: with p; [ pyyaml setuptools ])) ];
+  strictDeps = true;
+
+  nativeBuildInputs = [ autoreconfHook help2man libxslt pythonEnv ];
+
+  depsBuildBuild = [ pkg-config ];
+
+  buildInputs = [ alsa-lib xlibsWrapper systemd libusb-compat-0_1 libftdi1 ];
 
-  buildInputs = [ alsa-lib xlibsWrapper libxslt systemd libusb-compat-0_1 libftdi1 ];
+  DEVINPUT_HEADER = "include/linux/input-event-codes.h";
 
   configureFlags = [
     "--sysconfdir=/etc"
@@ -53,6 +65,7 @@ stdenv.mkDerivation rec {
     "--enable-uinput" # explicit activation because build env has no uinput
     "--enable-devinput" # explicit activation because build env has no /dev/input
     "--with-lockdir=/run/lirc/lock" # /run/lock is not writable for 'lirc' user
+    "PYTHON=${pythonEnv.interpreter}"
   ];
 
   installFlags = [