1{ stdenv
2, fetchFromGitHub
3, pkgconfig
4, cmake
5, zlib
6, fetchpatch
7, dbus
8, networkmanager
9, spidermonkey_60
10, pcre
11, gsettings-desktop-schemas
12, glib
13, makeWrapper
14, python3
15, SystemConfiguration
16, CoreFoundation
17, JavaScriptCore
18}:
19
20stdenv.mkDerivation rec {
21 pname = "libproxy";
22 version = "0.4.15";
23
24 src = fetchFromGitHub {
25 owner = "libproxy";
26 repo = "libproxy";
27 rev = version;
28 sha256 = "10swd3x576pinx33iwsbd4h15fbh2snmfxzcmab4c56nb08qlbrs";
29 };
30
31 outputs = [ "out" "dev" "py3" ];
32
33 nativeBuildInputs = [
34 pkgconfig
35 cmake
36 makeWrapper
37 ];
38
39 buildInputs = [
40 pcre
41 python3
42 zlib
43 ] ++ (if stdenv.hostPlatform.isDarwin then [
44 SystemConfiguration
45 CoreFoundation
46 JavaScriptCore
47 ] else [
48 glib
49 spidermonkey_60
50 dbus
51 networkmanager
52 ]);
53
54 cmakeFlags = [
55 "-DWITH_MOZJS=ON"
56 "-DWITH_PYTHON2=OFF"
57 "-DPYTHON3_SITEPKG_DIR=${placeholder "py3"}/${python3.sitePackages}"
58 ];
59
60 patches = [
61 # Make build with spidermonkey_60
62 (fetchpatch {
63 url = "https://github.com/libproxy/libproxy/pull/86.patch";
64 sha256 = "17c06ilinrnzr7xnnmw9pc6zrncyaxcdd6r6k1ah5p156skbykfs";
65 })
66 (fetchpatch {
67 url = "https://github.com/libproxy/libproxy/pull/87.patch";
68 sha256 = "0sagzfwm16f33inbkwsp88w9wmrd034rjmw0y8d122f7k1qfx6zc";
69 })
70 (fetchpatch {
71 url = "https://github.com/libproxy/libproxy/pull/95.patch";
72 sha256 = "18vyr6wlis9zfwml86606jpgb9mss01l9aj31iiciml8p857aixi";
73 })
74 ] ++ stdenv.lib.optionals stdenv.isDarwin [
75 (fetchpatch {
76 url = "https://github.com/libproxy/libproxy/commit/44158f03f8522116758d335688ed840dfcb50ac8.patch";
77 sha256 = "0axfvb6j7gcys6fkwi9dkn006imhvm3kqr83gpwban8419n0q5v1";
78 })
79 ];
80
81 postFixup = stdenv.lib.optionalString stdenv.isLinux ''
82 # config_gnome3 uses the helper to find GNOME proxy settings
83 wrapProgram $out/libexec/pxgsettings --prefix XDG_DATA_DIRS : "${gsettings-desktop-schemas}/share/gsettings-schemas/${gsettings-desktop-schemas.name}"
84 '';
85
86 doCheck = false; # fails 1 out of 10 tests
87
88 meta = with stdenv.lib; {
89 platforms = platforms.linux ++ platforms.darwin;
90 license = licenses.lgpl21;
91 homepage = "http://libproxy.github.io/libproxy/";
92 description = "A library that provides automatic proxy configuration management";
93 };
94}