1{
2 lib,
3 stdenv,
4 fetchurl,
5 fetchpatch,
6 pkg-config,
7 intltool,
8 meson,
9 ninja,
10 itstool,
11 libxml2,
12 python3,
13 gtk3,
14 json-glib,
15 isocodes,
16 openssl,
17 gnome,
18 gobject-introspection,
19 vala,
20 libgee,
21 sqlite,
22 gtk-doc,
23 yelp-tools,
24 mysqlSupport ? false,
25 libmysqlclient ? null,
26 postgresSupport ? false,
27 libpq ? null,
28}:
29
30assert mysqlSupport -> libmysqlclient != null;
31assert postgresSupport -> libpq != null;
32
33stdenv.mkDerivation rec {
34 pname = "libgda";
35 version = "6.0.0";
36
37 src = fetchurl {
38 url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
39 sha256 = "0w564z7krgjk19r39mi5qn4kggpdg9ggbyn9pb4aavb61r14npwr";
40 };
41
42 patches = [
43 # Fix undefined behavior
44 (fetchpatch {
45 url = "https://gitlab.gnome.org/GNOME/libgda/-/commit/657b2f8497da907559a6769c5b1d2d7b5bd40688.patch";
46 sha256 = "Qx4S9KQsTAr4M0QJi0Xr5kKuHSp4NwZJHoRPYyxIyTk=";
47 })
48
49 # Fix building vapi
50 (fetchpatch {
51 url = "https://gitlab.gnome.org/GNOME/libgda/-/commit/57f618a3b2a3758ee3dcbf9bbdc566122dd8566d.patch";
52 sha256 = "pyfymUd61m1kHaGyMbUQMma+szB8mlqGWwcFBBQawf8=";
53 })
54
55 (fetchpatch {
56 name = "CVE-2021-39359.patch";
57 url = "https://gitlab.gnome.org/GNOME/libgda/-/commit/bebdffb4de586fb43fd07ac549121f4b22f6812d.patch";
58 sha256 = "sha256-UjHP1nhb5n6TOdaMdQeE2s828T4wv/0ycG3FAk+I1QA=";
59 })
60 ];
61
62 nativeBuildInputs = [
63 pkg-config
64 intltool
65 meson
66 ninja
67 itstool
68 libxml2
69 python3
70 gobject-introspection
71 vala
72 gtk-doc
73 yelp-tools
74 ];
75
76 buildInputs = [
77 gtk3
78 json-glib
79 isocodes
80 openssl
81 libgee
82 sqlite
83 ]
84 ++ lib.optionals mysqlSupport [
85 libmysqlclient
86 ]
87 ++ lib.optionals postgresSupport [
88 libpq
89 ];
90
91 env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=incompatible-function-pointer-types";
92
93 postPatch = ''
94 patchShebangs \
95 providers/raw_spec.py \
96 providers/mysql/gen_bin.py
97 '';
98
99 passthru = {
100 updateScript = gnome.updateScript {
101 packageName = pname;
102 attrPath = "libgda6";
103 versionPolicy = "odd-unstable";
104 };
105 };
106
107 meta = with lib; {
108 description = "Database access library";
109 homepage = "https://www.gnome-db.org/";
110 license = with licenses; [
111 # library
112 lgpl2Plus
113 # CLI tools
114 gpl2Plus
115 ];
116 teams = [ teams.gnome ];
117 platforms = platforms.unix;
118 };
119}