Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / libraries / gtkd / default.nix
blobd773434b8323fb6093b0ce2c9775b8607602c258
1 { lib, stdenv, fetchzip, atk, cairo, dcompiler, gdk-pixbuf, gnome, gst_all_1, librsvg
2 , glib, gtk3, gtksourceview4, libgda, libpeas, pango, pkg-config, which, vte }:
4 let
5   inherit (gst_all_1) gstreamer gst-plugins-base gst-plugins-bad;
6 in stdenv.mkDerivation rec {
7   pname = "gtkd";
8   version = "3.10.0";
10   src = fetchzip {
11     url = "https://gtkd.org/Downloads/sources/GtkD-${version}.zip";
12     sha256 = "DEKVDexGyg/T3SdnnvRjaHq1LbDo8ekNslxKROpMCCE=";
13     stripRoot = false;
14   };
16   nativeBuildInputs = [ dcompiler pkg-config which ];
17   propagatedBuildInputs = [
18     atk cairo gdk-pixbuf glib gstreamer gst-plugins-base gtk3 gtksourceview4
19     libgda libpeas librsvg pango vte
20   ];
22   postPatch = ''
23     substituteAll ${./paths.d} generated/gtkd/gtkd/paths.d
25     substituteInPlace generated/gstreamer/gst/app/c/functions.d \
26       --replace libgstapp-1.0.so.0 ${gst-plugins-base}/lib/libgstapp-1.0.so.0 \
27       --replace libgstapp-1.0.0.dylib ${gst-plugins-base}/lib/libgstapp-1.0.0.dylib
29     substituteInPlace generated/gstreamer/gst/base/c/functions.d \
30       --replace libgstbase-1.0.so.0 ${gstreamer.out}/lib/libgstbase-1.0.so.0 \
31       --replace libgstbase-1.0.0.dylib ${gstreamer.out}/lib/libgstbase-1.0.0.dylib
33     substituteInPlace generated/gstreamer/gst/mpegts/c/functions.d \
34       --replace libgstmpegts-1.0.so.0 ${gst-plugins-bad.out}/lib/libgstmpegts-1.0.so.0 \
35       --replace libgstmpegts-1.0.0.dylib ${gst-plugins-bad.out}/lib/libgstmpegts-1.0.0.dylib
37     substituteInPlace generated/gstreamer/gstinterfaces/c/functions.d \
38       --replace libgstvideo-1.0.so.0 ${gst-plugins-base}/lib/libgstvideo-1.0.so.0 \
39       --replace libgstvideo-1.0.0.dylib ${gst-plugins-base}/lib/libgstvideo-1.0.0.dylib
41     substituteInPlace generated/gstreamer/gstreamer/c/functions.d \
42       --replace libgstreamer-1.0.so.0 ${gstreamer}/lib/libgstreamer-1.0.so.0 \
43       --replace libgstreamer-1.0.0.dylib ${gstreamer}/lib/libgstreamer-1.0.0.dylib
45     substituteInPlace generated/gtkd/atk/c/functions.d \
46       --replace libatk-1.0.so.0 ${atk}/lib/libatk-1.0.so.0 \
47       --replace libatk-1.0.0.dylib ${atk}/lib/libatk-1.0.0.dylib
49     substituteInPlace generated/gtkd/cairo/c/functions.d \
50       --replace libcairo.so.2 ${cairo}/lib/libcairo.so.2 \
51       --replace libcairo.dylib ${cairo}/lib/libcairo.dylib
53     substituteInPlace generated/gtkd/gdk/c/functions.d \
54       --replace libgdk-3.so.0 ${gtk3}/lib/libgdk-3.so.0 \
55       --replace libgdk-3.0.dylib ${gtk3}/lib/libgdk-3.0.dylib
57     substituteInPlace generated/gtkd/gdkpixbuf/c/functions.d \
58       --replace libgdk_pixbuf-2.0.so.0 ${gdk-pixbuf}/lib/libgdk_pixbuf-2.0.so.0 \
59       --replace libgdk_pixbuf-2.0.0.dylib ${gdk-pixbuf}/lib/libgdk_pixbuf-2.0.0.dylib
61     substituteInPlace generated/gtkd/gio/c/functions.d \
62       --replace libgio-2.0.so.0 ${glib.out}/lib/libgio-2.0.so.0 \
63       --replace libgio-2.0.0.dylib ${glib.out}/lib/libgio-2.0.0.dylib
65     substituteInPlace generated/gtkd/glib/c/functions.d \
66       --replace libglib-2.0.so.0 ${glib.out}/lib/libglib-2.0.so.0 \
67       --replace libgmodule-2.0.so.0 ${glib.out}/lib/libgmodule-2.0.so.0 \
68       --replace libgobject-2.0.so.0 ${glib.out}/lib/libgobject-2.0.so.0 \
69       --replace libglib-2.0.0.dylib ${glib.out}/lib/libglib-2.0.0.dylib \
70       --replace libgmodule-2.0.0.dylib ${glib.out}/lib/libgmodule-2.0.0.dylib \
71       --replace libgobject-2.0.0.dylib ${glib.out}/lib/libgobject-2.0.0.dylib
73     substituteInPlace generated/gtkd/gobject/c/functions.d \
74       --replace libgobject-2.0.so.0 ${glib.out}/lib/libgobject-2.0.so.0 \
75       --replace libgobject-2.0.0.dylib ${glib.out}/lib/libgobject-2.0.0.dylib
77     substituteInPlace generated/gtkd/gtk/c/functions.d \
78       --replace libgdk-3.so.0 ${gtk3}/lib/libgdk-3.so.0 \
79       --replace libgtk-3.so.0 ${gtk3}/lib/libgtk-3.so.0 \
80       --replace libgdk-3.0.dylib ${gtk3}/lib/libgdk-3.0.dylib \
81       --replace libgtk-3.0.dylib ${gtk3}/lib/libgtk-3.0.dylib
83     substituteInPlace generated/gtkd/pango/c/functions.d \
84       --replace libpango-1.0.so.0 ${pango.out}/lib/libpango-1.0.so.0 \
85       --replace libpangocairo-1.0.so.0 ${pango.out}/lib/libpangocairo-1.0.so.0 \
86       --replace libpango-1.0.0.dylib ${pango.out}/lib/libpango-1.0.0.dylib \
87       --replace libpangocairo-1.0.0.dylib ${pango.out}/lib/libpangocairo-1.0.0.dylib
89     substituteInPlace generated/gtkd/rsvg/c/functions.d \
90       --replace librsvg-2.so.2 ${librsvg}/lib/librsvg-2.so.2 \
91       --replace librsvg-2.2.dylib ${librsvg}/lib/librsvg-2.2.dylib
93     substituteInPlace generated/peas/peas/c/functions.d \
94       --replace libpeas-1.0.so.0 ${libpeas}/lib/libpeas-1.0.so.0 \
95       --replace libpeas-gtk-1.0.so.0 ${libpeas}/lib/libpeas-gtk-1.0.so.0 \
96       --replace libpeas-1.0.0.dylib ${libpeas}/lib/libpeas-1.0.0.dylib \
97       --replace gtk-1.0.0.dylib ${libpeas}/lib/gtk-1.0.0.dylib
99     substituteInPlace generated/sourceview/gsv/c/functions.d \
100       --replace libgtksourceview-4.so.0 ${gtksourceview4}/lib/libgtksourceview-4.so.0 \
101       --replace libgtksourceview-4.0.dylib ${gtksourceview4}/lib/libgtksourceview-4.0.dylib
103     substituteInPlace generated/vte/vte/c/functions.d \
104       --replace libvte-2.91.so.0 ${vte}/lib/libvte-2.91.so.0 \
105       --replace libvte-2.91.0.dylib ${vte}/lib/libvte-2.91.0.dylib
106   '';
108   makeFlags  = [
109     "prefix=${placeholder "out"}"
110     "PKG_CONFIG=${pkg-config}/bin/${pkg-config.targetPrefix}pkg-config"
111   ];
113   # The .pc files does not declare an `includedir=`, so the multiple
114   # outputs setup hook misses this.
115   postFixup = ''
116     for pc in $dev/lib/pkgconfig/*; do
117       substituteInPlace $pc \
118         --replace "$out/include" "$dev/include"
119     done
120   '';
122   passthru = {
123     inherit dcompiler;
124   };
126   meta = with lib; {
127     description = "D binding and OO wrapper for GTK";
128     homepage = "https://gtkd.org";
129     license = licenses.lgpl3Plus;
130     platforms = platforms.linux ++ platforms.darwin;
131   };