2024-09-19 14:19:46 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, pkg-config, glib, zlib, libpng, cmake, python3 }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
let
|
2024-06-24 18:47:55 +00:00
|
|
|
version = "0.3.4";
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "lensfun";
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
# Fetch a more recent version of the repo containing a more recent lens
|
|
|
|
# database
|
|
|
|
lensfunDatabase = fetchFromGitHub {
|
|
|
|
owner = "lensfun";
|
|
|
|
repo = "lensfun";
|
2024-06-24 18:47:55 +00:00
|
|
|
rev = "a1510e6f33ce9bc8b5056a823c6d5bc6b8cba033";
|
|
|
|
sha256 = "sha256-qdONyKk873Tq11M33JmznhJMAGd4dqp5KdXdVhfy/Ak=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
inherit pname version;
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "lensfun";
|
|
|
|
repo = "lensfun";
|
|
|
|
rev = "v${version}";
|
2024-06-24 18:47:55 +00:00
|
|
|
sha256 = "sha256-FyYilIz9ssSHG6S02Z2bXy7fjSY51+SWW3v8bm7sLvY=";
|
2021-01-15 22:18:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# replace database with a more recent snapshot
|
2024-06-24 18:47:55 +00:00
|
|
|
# the master branch uses version 2 profiles, while 0.3.3 requires version 1 profiles,
|
2023-01-20 10:41:00 +00:00
|
|
|
# so we run the conversion tool the project provides,
|
|
|
|
# then untar the verson 1 profiles into the source dir before we build
|
2022-01-13 20:06:32 +00:00
|
|
|
prePatch = ''
|
2023-01-20 10:41:00 +00:00
|
|
|
rm -R data/db
|
|
|
|
python3 ${lensfunDatabase}/tools/lensfun_convert_db_v2_to_v1.py $TMPDIR ${lensfunDatabase}/data/db
|
|
|
|
mkdir -p data/db
|
|
|
|
tar xvf $TMPDIR/db/version_1.tar -C data/db
|
|
|
|
date +%s > data/db/timestamp.txt
|
2021-01-15 22:18:51 +00:00
|
|
|
'';
|
|
|
|
|
2023-01-20 10:41:00 +00:00
|
|
|
nativeBuildInputs = [
|
2024-06-24 18:47:55 +00:00
|
|
|
cmake
|
|
|
|
pkg-config
|
|
|
|
python3
|
|
|
|
python3.pkgs.setuptools
|
|
|
|
python3.pkgs.lxml # For the db converison
|
2023-01-20 10:41:00 +00:00
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
buildInputs = [ glib zlib libpng ];
|
|
|
|
|
2024-06-24 18:47:55 +00:00
|
|
|
cmakeFlags = [ "-DINSTALL_HELPER_SCRIPTS=OFF" "-DCMAKE_BUILD_TYPE=RELEASE" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
2024-06-24 18:47:55 +00:00
|
|
|
maintainers = with maintainers; [ flokli paperdigits ];
|
2021-02-05 17:12:51 +00:00
|
|
|
license = lib.licenses.lgpl3;
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Opensource database of photographic lenses and their characteristics";
|
2021-01-15 22:18:51 +00:00
|
|
|
homepage = "https://lensfun.github.io";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|