1{ fetchFromGitLab
2, lib
3, stdenv
4, autoreconfHook
5, fetchpatch2
6, gtk-doc
7, pkg-config
8, intltool
9, gettext
10, glib
11, libxml2
12, zlib
13, bzip2
14, perl
15, gdk-pixbuf
16, libiconv
17, libintl
18, gnome
19}:
20
21stdenv.mkDerivation rec {
22 pname = "libgsf";
23 version = "1.14.52";
24
25 outputs = [ "out" "dev" ];
26
27 src = fetchFromGitLab {
28 domain = "gitlab.gnome.org";
29 owner = "GNOME";
30 repo = "libgsf";
31 rev = "LIBGSF_${lib.replaceStrings ["."] ["_"] version}";
32 hash = "sha256-uSi2/pZiST07YutU8SHNoY2LifEQhohQeyaH9spyG2s=";
33 };
34
35 patches = [
36 # Fixes building when nanohttp is not enabled in libxml2, which is the default since libxml2 2.13.
37 (fetchpatch2 {
38 url = "https://gitlab.gnome.org/GNOME/libgsf/-/commit/5d4bb55095d3d6ef793c1908a88504183e28644c.diff";
39 hash = "sha256-2TF1KDUxJtSMTDze2/dOJQRkW8S1GA9OyFpYzYeKpjQ=";
40 })
41 ];
42
43 postPatch = ''
44 # Fix cross-compilation
45 substituteInPlace configure.ac \
46 --replace "AC_PATH_PROG(PKG_CONFIG, pkg-config, no)" \
47 "PKG_PROG_PKG_CONFIG"
48 '';
49
50 strictDeps = true;
51
52 nativeBuildInputs = [
53 autoreconfHook
54 gtk-doc
55 pkg-config
56 intltool
57 libintl
58 ];
59
60 buildInputs = [
61 gettext
62 bzip2
63 zlib
64 ];
65
66 nativeCheckInputs = [
67 perl
68 ];
69
70 propagatedBuildInputs = [
71 libxml2
72 glib
73 gdk-pixbuf
74 libiconv
75 ];
76
77 doCheck = true;
78
79 preCheck = ''
80 patchShebangs ./tests/
81 '';
82
83 # checking pkg-config is at least version 0.9.0... ./configure: line 15213: no: command not found
84 # configure: error: in `/build/libgsf-1.14.50':
85 # configure: error: The pkg-config script could not be found or is too old. Make sure it
86 # is in your PATH or set the PKG_CONFIG environment variable to the full
87 preConfigure = ''
88 export PKG_CONFIG="$(command -v "$PKG_CONFIG")"
89 '';
90
91 passthru = {
92 updateScript = gnome.updateScript {
93 packageName = pname;
94 versionPolicy = "odd-unstable";
95 };
96 };
97
98 meta = with lib; {
99 description = "GNOME's Structured File Library";
100 homepage = "https://www.gnome.org/projects/libgsf";
101 license = licenses.lgpl21Only;
102 maintainers = with maintainers; [ lovek323 ];
103 platforms = lib.platforms.unix;
104
105 longDescription = ''
106 Libgsf aims to provide an efficient extensible I/O abstraction for
107 dealing with different structured file formats.
108 '';
109 };
110}