lol
1{ lib
2, stdenv
3, fetchFromGitHub
4, gst_all_1
5, gtk3
6, libGL
7, libGLU
8, libSM
9, libXinerama
10, libXtst
11, libXxf86vm
12, pkg-config
13, xorgproto
14, compat28 ? false
15, compat30 ? true
16, unicode ? true
17, withEGL ? true
18, withMesa ? !stdenv.isDarwin
19, withWebKit ? stdenv.isDarwin
20, webkitgtk
21, setfile
22, AGL
23, Carbon
24, Cocoa
25, Kernel
26, QTKit
27, AVFoundation
28, AVKit
29, WebKit
30}:
31
32stdenv.mkDerivation rec {
33 pname = "wxwidgets";
34 version = "3.1.7";
35
36 src = fetchFromGitHub {
37 owner = "wxWidgets";
38 repo = "wxWidgets";
39 rev = "v${version}";
40 hash = "sha256-9qYPatpTT28H+fz77o7/Y3YVmiK0OCsiQT5QAYe93M0=";
41 fetchSubmodules = true;
42 };
43
44 patches = [
45 # https://github.com/wxWidgets/wxWidgets/issues/17942
46 ./patches/0001-fix-assertion-using-hide-in-destroy.patch
47 ];
48
49 nativeBuildInputs = [ pkg-config ];
50
51 buildInputs = [
52 gst_all_1.gst-plugins-base
53 gst_all_1.gstreamer
54 ] ++ lib.optionals (!stdenv.isDarwin) [
55 gtk3
56 libSM
57 libXinerama
58 libXtst
59 libXxf86vm
60 xorgproto
61 ]
62 ++ lib.optional withMesa libGLU
63 ++ lib.optional (withWebKit && !stdenv.isDarwin) webkitgtk
64 ++ lib.optional (withWebKit && stdenv.isDarwin) WebKit
65 ++ lib.optionals stdenv.isDarwin [
66 setfile
67 Carbon
68 Cocoa
69 Kernel
70 QTKit
71 AVFoundation
72 AVKit
73 WebKit
74 ];
75
76 propagatedBuildInputs = lib.optional stdenv.isDarwin AGL;
77
78 configureFlags = [
79 "--disable-precomp-headers"
80 # This is the default option, but be explicit
81 "--disable-monolithic"
82 "--enable-mediactrl"
83 (if compat28 then "--enable-compat28" else "--disable-compat28")
84 (if compat30 then "--enable-compat30" else "--disable-compat30")
85 ]
86 ++ lib.optional (!withEGL) "--disable-glcanvasegl"
87 ++ lib.optional unicode "--enable-unicode"
88 ++ lib.optional withMesa "--with-opengl"
89 ++ lib.optionals stdenv.isDarwin [
90 "--with-osx_cocoa"
91 "--with-libiconv"
92 ] ++ lib.optionals withWebKit [
93 "--enable-webview"
94 "--enable-webviewwebkit"
95 ];
96
97 SEARCH_LIB = lib.optionalString (!stdenv.isDarwin) "${libGLU.out}/lib ${libGL.out}/lib ";
98
99 preConfigure = ''
100 substituteInPlace configure --replace \
101 'SEARCH_INCLUDE=' 'DUMMY_SEARCH_INCLUDE='
102 substituteInPlace configure --replace \
103 'SEARCH_LIB=' 'DUMMY_SEARCH_LIB='
104 substituteInPlace configure --replace \
105 /usr /no-such-path
106 '' + lib.optionalString stdenv.isDarwin ''
107 substituteInPlace configure --replace \
108 'ac_cv_prog_SETFILE="/Developer/Tools/SetFile"' \
109 'ac_cv_prog_SETFILE="${setfile}/bin/SetFile"'
110 substituteInPlace configure --replace \
111 "-framework System" "-lSystem"
112 '';
113
114 postInstall = "
115 pushd $out/include
116 ln -s wx-*/* .
117 popd
118 ";
119
120 enableParallelBuilding = true;
121
122 passthru = {
123 inherit compat28 compat30 unicode;
124 };
125
126 meta = with lib; {
127 homepage = "https://www.wxwidgets.org/";
128 description = "A Cross-Platform C++ GUI Library";
129 longDescription = ''
130 wxWidgets gives you a single, easy-to-use API for writing GUI applications
131 on multiple platforms that still utilize the native platform's controls
132 and utilities. Link with the appropriate library for your platform and
133 compiler, and your application will adopt the look and feel appropriate to
134 that platform. On top of great GUI functionality, wxWidgets gives you:
135 online help, network programming, streams, clipboard and drag and drop,
136 multithreading, image loading and saving in a variety of popular formats,
137 database support, HTML viewing and printing, and much more.
138 '';
139 license = licenses.wxWindows;
140 maintainers = with maintainers; [ tfmoraes ];
141 platforms = platforms.unix;
142 };
143}