2021-12-06 16:07:01 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, buildPackages
|
|
|
|
, autoreconfHook
|
|
|
|
, pkg-config
|
|
|
|
, gettext
|
2020-12-07 07:45:13 +00:00
|
|
|
, libusb1
|
|
|
|
, libtool
|
|
|
|
, libexif
|
2021-12-06 16:07:01 +00:00
|
|
|
, libgphoto2
|
2020-12-07 07:45:13 +00:00
|
|
|
, libjpeg
|
2021-12-06 16:07:01 +00:00
|
|
|
, curl
|
|
|
|
, libxml2
|
|
|
|
, gd
|
2020-12-07 07:45:13 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2020-12-07 07:45:13 +00:00
|
|
|
pname = "libgphoto2";
|
2023-10-09 19:29:22 +00:00
|
|
|
version = "2.5.31";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "gphoto";
|
|
|
|
repo = "libgphoto2";
|
2020-12-07 07:45:13 +00:00
|
|
|
rev = "libgphoto2-${builtins.replaceStrings [ "." ] [ "_" ] version}-release";
|
2023-10-09 19:29:22 +00:00
|
|
|
sha256 = "sha256-UmyDKEaPP9VJqi8f+y6JZcTlQomhMTN+/C//ODYx6/w=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
depsBuildBuild = [ pkg-config ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-12-07 07:45:13 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
autoreconfHook
|
|
|
|
gettext
|
|
|
|
libtool
|
2021-12-06 16:07:01 +00:00
|
|
|
pkg-config
|
2020-12-07 07:45:13 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
libjpeg
|
2021-12-06 16:07:01 +00:00
|
|
|
libtool # for libltdl
|
2020-12-07 07:45:13 +00:00
|
|
|
libusb1
|
2021-12-06 16:07:01 +00:00
|
|
|
curl
|
|
|
|
libxml2
|
|
|
|
gd
|
2020-12-07 07:45:13 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# These are mentioned in the Requires line of libgphoto's pkg-config file.
|
|
|
|
propagatedBuildInputs = [ libexif ];
|
|
|
|
|
|
|
|
hardeningDisable = [ "format" ];
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
postInstall =
|
|
|
|
let
|
|
|
|
executablePrefix =
|
|
|
|
if stdenv.buildPlatform == stdenv.hostPlatform then
|
|
|
|
"$out"
|
|
|
|
else
|
|
|
|
buildPackages.libgphoto2;
|
|
|
|
in
|
|
|
|
''
|
2023-04-29 16:46:19 +00:00
|
|
|
mkdir -p $out/lib/udev/{rules.d,hwdb.d}
|
2021-12-06 16:07:01 +00:00
|
|
|
${executablePrefix}/lib/libgphoto2/print-camera-list \
|
2023-04-29 16:46:19 +00:00
|
|
|
udev-rules version 201 group camera \
|
|
|
|
>$out/lib/udev/rules.d/40-libgphoto2.rules
|
|
|
|
${executablePrefix}/lib/libgphoto2/print-camera-list \
|
|
|
|
hwdb version 201 group camera \
|
|
|
|
>$out/lib/udev/hwdb.d/20-gphoto.hwdb
|
2021-12-06 16:07:01 +00:00
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
meta = {
|
|
|
|
homepage = "http://www.gphoto.org/proj/libgphoto2/";
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Library for accessing digital cameras";
|
2020-04-24 23:36:52 +00:00
|
|
|
longDescription = ''
|
|
|
|
This is the library backend for gphoto2. It contains the code for PTP,
|
|
|
|
MTP, and other vendor specific protocols for controlling and transferring data
|
|
|
|
from digital cameras.
|
|
|
|
'';
|
|
|
|
# XXX: the homepage claims LGPL, but several src files are lgpl21Plus
|
2021-02-05 17:12:51 +00:00
|
|
|
license = lib.licenses.lgpl21Plus;
|
|
|
|
platforms = with lib.platforms; unix;
|
|
|
|
maintainers = with lib.maintainers; [ jcumming ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|