1{ lib
2, stdenv
3, fetchurl
4, fetchpatch
5, pkg-config
6, libGL
7, glib
8, gdk-pixbuf
9, xorg
10, libintl
11, pangoSupport ? true
12, pango
13, cairo
14, gobject-introspection
15, wayland
16, gnome
17, mesa
18, automake
19, autoconf
20, gstreamerSupport ? true
21, gst_all_1
22, harfbuzz
23, OpenGL
24}:
25
26stdenv.mkDerivation rec {
27 pname = "cogl";
28 version = "1.22.8";
29
30 src = fetchurl {
31 url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/cogl-${version}.tar.xz";
32 sha256 = "0nfph4ai60ncdx7hy6hl1i1cmp761jgnyjfhagzi0iqq36qb41d8";
33 };
34
35 patches = [
36 # Some deepin packages need the following patches. They have been
37 # submitted by Fedora on the GNOME Bugzilla
38 # (https://bugzilla.gnome.org/787443). Upstream thinks the patch
39 # could be merged, but dev can not make a new release.
40 ./patches/gnome_bugzilla_787443_359589_deepin.patch
41 ./patches/gnome_bugzilla_787443_361056_deepin.patch
42 ];
43
44 outputs = [ "out" "dev" ];
45
46 nativeBuildInputs = [ pkg-config libintl automake autoconf gobject-introspection ];
47
48 configureFlags = [
49 "--enable-introspection"
50 ] ++ lib.optionals (!stdenv.isDarwin) [
51 "--enable-kms-egl-platform"
52 "--enable-wayland-egl-platform"
53 "--enable-wayland-egl-server"
54 "--enable-gles1"
55 "--enable-gles2"
56 # Force linking against libGL.
57 # Otherwise, it tries to load it from the runtime library path.
58 "LIBS=-lGL"
59 ] ++ lib.optionals stdenv.isDarwin [
60 "--disable-glx"
61 "--without-x"
62 ] ++ lib.optionals gstreamerSupport [
63 "--enable-cogl-gst"
64 ];
65
66 # TODO: this shouldn't propagate so many things
67 # especially not gobject-introspection
68 propagatedBuildInputs = [
69 glib
70 gdk-pixbuf
71 gobject-introspection
72 ] ++ lib.optionals stdenv.isLinux [
73 wayland
74 mesa
75 libGL
76 xorg.libXrandr
77 xorg.libXfixes
78 xorg.libXcomposite
79 xorg.libXdamage
80 ] ++ lib.optionals gstreamerSupport [
81 gst_all_1.gstreamer
82 gst_all_1.gst-plugins-base
83 ];
84
85 buildInputs = lib.optionals pangoSupport [ pango cairo harfbuzz ]
86 ++ lib.optionals stdenv.isDarwin [ OpenGL ];
87
88 env = {
89 COGL_PANGO_DEP_CFLAGS = toString (lib.optionals (stdenv.isDarwin && pangoSupport) [
90 "-I${pango.dev}/include/pango-1.0"
91 "-I${cairo.dev}/include/cairo"
92 "-I${harfbuzz.dev}/include/harfbuzz"
93 ]);
94 } // lib.optionalAttrs stdenv.cc.isClang {
95 NIX_CFLAGS_COMPILE = "-Wno-error=implicit-function-declaration";
96 };
97
98 #doCheck = true; # all tests fail (no idea why)
99
100 passthru = {
101 updateScript = gnome.updateScript {
102 packageName = pname;
103 versionPolicy = "odd-unstable";
104 };
105 };
106
107 meta = with lib; {
108 description = "A small open source library for using 3D graphics hardware for rendering";
109 maintainers = with maintainers; [ lovek323 ];
110
111 longDescription = ''
112 Cogl is a small open source library for using 3D graphics hardware for
113 rendering. The API departs from the flat state machine style of OpenGL
114 and is designed to make it easy to write orthogonal components that can
115 render without stepping on each other's toes.
116 '';
117
118 platforms = platforms.unix;
119 license = with licenses; [ mit bsd3 publicDomain sgi-b-20 ];
120 };
121}