1{ stdenv
2, lib
3, fetchurl
4, meson
5, mesonEmulatorHook
6, ninja
7, pkg-config
8, exiv2
9, glib
10, gnome
11, gobject-introspection
12, vala
13, gtk-doc
14, docbook-xsl-nons
15, docbook_xml_dtd_43
16, python3
17}:
18
19stdenv.mkDerivation rec {
20 pname = "gexiv2";
21 version = "0.14.1";
22
23 outputs = [ "out" "dev" "devdoc" ];
24
25 src = fetchurl {
26 url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
27 sha256 = "7D7j7DhguceJWKVdqJz3auIwWEjhL0GUW3tSEk2PbPk=";
28 };
29
30 nativeBuildInputs = [
31 meson
32 ninja
33 pkg-config
34 gobject-introspection
35 vala
36 gtk-doc
37 docbook-xsl-nons
38 docbook_xml_dtd_43
39 (python3.pythonForBuild.withPackages (ps: [ ps.pygobject3 ]))
40 ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
41 mesonEmulatorHook
42 ];
43
44 buildInputs = [
45 glib
46 ];
47
48 propagatedBuildInputs = [
49 exiv2
50 ];
51
52 mesonFlags = [
53 "-Dgtk_doc=true"
54 "-Dtests=true"
55 ];
56
57 # Needed for darwin due to std::auto_ptr in exiv2 header files & enabling C++ 17
58 # https://github.com/Exiv2/exiv2/issues/2359
59 # https://gitlab.gnome.org/GNOME/gexiv2/-/issues/73
60 env.NIX_CFLAGS_COMPILE = "-D_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR";
61
62 doCheck = true;
63
64 preCheck = let
65 libSuffix = if stdenv.isDarwin then "2.dylib" else "so.2";
66 in ''
67 # Our gobject-introspection patches make the shared library paths absolute
68 # in the GIR files. When running unit tests, the library is not yet installed,
69 # though, so we need to replace the absolute path with a local one during build.
70 # We are using a symlink that will be overridden during installation.
71 mkdir -p $out/lib
72 ln -s $PWD/gexiv2/libgexiv2.${libSuffix} $out/lib/libgexiv2.${libSuffix}
73 '';
74
75 passthru = {
76 updateScript = gnome.updateScript {
77 packageName = pname;
78 versionPolicy = "odd-unstable";
79 };
80 };
81
82 meta = with lib; {
83 homepage = "https://wiki.gnome.org/Projects/gexiv2";
84 description = "GObject wrapper around the Exiv2 photo metadata library";
85 license = licenses.gpl2Plus;
86 platforms = platforms.unix;
87 maintainers = teams.gnome.members;
88 };
89}