libfprint-focaltech-2808-a658: init at 1.94.4 (#354311)

This commit is contained in:
Atemu 2024-11-08 22:02:34 +01:00 committed by GitHub
commit bce559e7a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 110 additions and 0 deletions

View File

@ -9402,6 +9402,12 @@
githubId = 36996706;
name = "Philip Rying";
};
imsick = {
email = "lent-lather-excuse@duck.com";
github = "dvishal485";
githubId = 26341736;
name = "Vishal Das";
};
imuli = {
email = "i@imu.li";
github = "imuli";

View File

@ -0,0 +1,104 @@
{
stdenv,
lib,
fetchurl,
rpm,
cpio,
glib,
gusb,
pixman,
libgudev,
nss,
libfprint,
cairo,
pkg-config,
autoPatchelfHook,
makePkgconfigItem,
copyPkgconfigItems,
}:
# https://discourse.nixos.org/t/request-for-libfprint-port-for-2808-a658/55474
let
# The provided `.so`'s name in the binary package we fetch and unpack
libso = "libfprint-2.so.2.0.0";
in
stdenv.mkDerivation rec {
pname = "libfprint-focaltech-2808-a658";
version = "1.94.4";
# https://gitlab.freedesktop.org/libfprint/libfprint/-/merge_requests/413#note_2476573
src = fetchurl {
url = "https://github.com/ftfpteams/RTS5811-FT9366-fingerprint-linux-driver-with-VID-2808-and-PID-a658/raw/b040ccd953c27e26c1285c456b4264e70b36bc3f/libfprint-2-2-${version}+tod1-FT9366_20240627.x86_64.rpm";
hash = "sha256-MRWHwBievAfTfQqjs1WGKBnht9cIDj9aYiT3YJ0/CUM=";
};
nativeBuildInputs = [
rpm
cpio
pkg-config
autoPatchelfHook
copyPkgconfigItems
];
buildInputs = [
stdenv.cc.cc
glib
gusb
pixman
nss
libgudev
libfprint
cairo
];
unpackPhase = ''
runHook preUnpack
rpm2cpio $src | cpio -idmv
runHook postUnpack
'';
# custom pkg-config based on libfprint's pkg-config
pkgconfigItems = [
(makePkgconfigItem rec {
name = "libfprint-2";
inherit version;
inherit (meta) description;
cflags = [ "-I${variables.includedir}/libfprint-2" ];
libs = [
"-L${variables.libdir}"
"-lfprint-2"
];
variables = rec {
prefix = "${placeholder "out"}";
includedir = "${prefix}/include";
libdir = "${prefix}/lib";
};
})
];
installPhase = ''
runHook preInstall
install -Dm444 usr/lib64/${libso} -t $out/lib
# create this symlink as it was there in libfprint
ln -s -T $out/lib/${libso} $out/lib/libfprint-2.so
ln -s -T $out/lib/${libso} $out/lib/libfprint-2.so.2
# get files from libfprint required to build the package
cp -r ${libfprint}/lib/girepository-1.0 $out/lib
cp -r ${libfprint}/include $out
runHook postInstall
'';
meta = {
description = "Focaltech Fingerprint driver for focaltech 0x2808:0xa658";
homepage = "https://github.com/ftfpteams/RTS5811-FT9366-fingerprint-linux-driver-with-VID-2808-and-PID-a658";
license = lib.licenses.unfree;
maintainers = [ lib.maintainers.imsick ];
platforms = [ "x86_64-linux" ];
sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
};
}