Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenv, fetchFromGitHub, fetchpatch, pkg-config, glib, zlib, libpng, cmake, libxml2, python3 }:
2
3let
4 version = "0.3.3";
5 pname = "lensfun";
6
7 # Fetch a more recent version of the repo containing a more recent lens
8 # database
9 lensfunDatabase = fetchFromGitHub {
10 owner = "lensfun";
11 repo = "lensfun";
12 rev = "ec9412d27d5fa8f377848a59c768b12c243cb80d";
13 sha256 = "sha256-/u/3oQzac/dQrgFaiYvzT5uQ108XarkXnA2DByA5sic=";
14 };
15
16in
17stdenv.mkDerivation {
18 inherit pname version;
19
20 src = fetchFromGitHub {
21 owner = "lensfun";
22 repo = "lensfun";
23 rev = "v${version}";
24 sha256 = "0ixf0f7qv0mc7zrw9w1sb60w833g4rqrfj8cjxwzv2vimqcksccz";
25 };
26
27 patches = [
28 (fetchpatch {
29 name = "fix-compilation-with-clang.patch";
30 url = "https://github.com/lensfun/lensfun/commit/5c2065685a22f19f8138365c0e5acf0be8329c02.patch";
31 sha256 = "sha256-tAOCNL37pKE7hfQCu+hUTKLFnRHWF5Dplqf+GaucG+4=";
32 })
33 ];
34
35 # replace database with a more recent snapshot
36 # the mastr branch uses version 2 profiles, while 0.3.3 requires version 1 profiles,
37 # so we run the conversion tool the project provides,
38 # then untar the verson 1 profiles into the source dir before we build
39 prePatch = ''
40 rm -R data/db
41 python3 ${lensfunDatabase}/tools/lensfun_convert_db_v2_to_v1.py $TMPDIR ${lensfunDatabase}/data/db
42 mkdir -p data/db
43 tar xvf $TMPDIR/db/version_1.tar -C data/db
44 date +%s > data/db/timestamp.txt
45 '';
46
47 nativeBuildInputs = [
48 cmake pkg-config
49 python3 python3.pkgs.lxml # For the db converison
50 ];
51
52 buildInputs = [ glib zlib libpng ];
53
54 cmakeFlags = [ "-DINSTALL_HELPER_SCRIPTS=OFF" ];
55
56 meta = with lib; {
57 platforms = platforms.linux ++ platforms.darwin;
58 maintainers = with maintainers; [ flokli ];
59 license = lib.licenses.lgpl3;
60 description = "An opensource database of photographic lenses and their characteristics";
61 homepage = "https://lensfun.github.io";
62 };
63}