3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/libraries/lirc/default.nix
Sergei Trofimovich b5fbd8a057 lirc: fix build against pyyaml-6.0
Without the change `lirc` build fails as:

```
$ nix build -f. -L lirc
...
PYTHONPATH=../python-pkg/lirc \
/nix/store/gn4gyzv93izh3lg5iqjb7l04k9r4hxv0-python3-3.9.9-env/bin/python ./data2hwdb ../configs ../configs \
    > lirc.hwdb
Traceback (most recent call last):
  File "/build/lirc-0.10.1/doc/./data2hwdb", line 112, in <module>
    main()
  File "/build/lirc-0.10.1/doc/./data2hwdb", line 100, in main
    db = database.Database(configdir, yamldir)
  File "/build/lirc-0.10.1/python-pkg/lirc/database.py", line 135, in __init__
    cf = yaml.load(f.read())
TypeError: load() missing 1 required positional argument: 'Loader'
make[2]: *** [Makefile:1263: lirc.hwdb] Error 1
```
2021-12-27 17:32:31 +00:00

65 lines
2.1 KiB
Nix

{ lib, stdenv, fetchurl, fetchpatch, autoreconfHook, pkg-config, help2man, python3,
alsa-lib, xlibsWrapper, libxslt, systemd, libusb-compat-0_1, libftdi1 }:
stdenv.mkDerivation rec {
pname = "lirc";
version = "0.10.1";
src = fetchurl {
url = "mirror://sourceforge/lirc/${pname}-${version}.tar.bz2";
sha256 = "1whlyifvvc7w04ahq07nnk1h18wc8j7c6wnvlb6mszravxh3qxcb";
};
# Fix installation of Python bindings
patches = [ (fetchpatch {
url = "https://sourceforge.net/p/lirc/tickets/339/attachment/0001-Fix-Python-bindings.patch";
sha256 = "088a39x8c1qd81qwvbiqd6crb2lk777wmrs8rdh1ga06lglyvbly";
}) ];
postPatch = ''
patchShebangs .
# fix overriding PYTHONPATH
sed -i 's,^PYTHONPATH *= *,PYTHONPATH := $(PYTHONPATH):,' \
Makefile.in
sed -i 's,PYTHONPATH=,PYTHONPATH=$(PYTHONPATH):,' \
doc/Makefile.in
# 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('
'';
preConfigure = ''
# use empty inc file instead of a from linux kernel generated one
touch lib/lirc/input_map.inc
'';
nativeBuildInputs = [ autoreconfHook pkg-config help2man
(python3.withPackages (p: with p; [ pyyaml setuptools ])) ];
buildInputs = [ alsa-lib xlibsWrapper libxslt systemd libusb-compat-0_1 libftdi1 ];
configureFlags = [
"--sysconfdir=/etc"
"--localstatedir=/var"
"--with-systemdsystemunitdir=$(out)/lib/systemd/system"
"--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
];
installFlags = [
"sysconfdir=$out/etc"
"localstatedir=$TMPDIR"
];
meta = with lib; {
description = "Allows to receive and send infrared signals";
homepage = "https://www.lirc.org/";
license = licenses.gpl2;
platforms = platforms.linux;
maintainers = with maintainers; [ pSub ];
};
}