2022-08-12 12:06:08 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-04-24 23:36:52 +00:00
|
|
|
, fetchFromGitHub
|
2022-08-12 12:06:08 +00:00
|
|
|
, fetchpatch
|
2021-02-05 17:12:51 +00:00
|
|
|
, pkg-config
|
2020-04-24 23:36:52 +00:00
|
|
|
, cmake
|
|
|
|
, zlib
|
|
|
|
, dbus
|
|
|
|
, networkmanager
|
2022-08-12 12:06:08 +00:00
|
|
|
, enableJavaScript ? stdenv.isDarwin || lib.meta.availableOn stdenv.hostPlatform duktape
|
|
|
|
, duktape
|
2020-04-24 23:36:52 +00:00
|
|
|
, pcre
|
|
|
|
, gsettings-desktop-schemas
|
|
|
|
, glib
|
|
|
|
, makeWrapper
|
|
|
|
, python3
|
|
|
|
, SystemConfiguration
|
|
|
|
, CoreFoundation
|
|
|
|
, JavaScriptCore
|
|
|
|
}:
|
|
|
|
|
2022-02-10 20:34:41 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "libproxy";
|
2022-08-12 12:06:08 +00:00
|
|
|
version = "0.4.18";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "libproxy";
|
|
|
|
repo = "libproxy";
|
|
|
|
rev = version;
|
2022-08-12 12:06:08 +00:00
|
|
|
hash = "sha256-pqj1LwRdOK2CUu3hYIsogQIXxWzShDuKEbDTbtWkgnQ=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
patches = lib.optionals stdenv.isDarwin [
|
|
|
|
# https://github.com/libproxy/libproxy/pull/189
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/libproxy/libproxy/commit/4331b9db427ce2c25ff5eeb597bec4bc35ed1a0b.patch";
|
|
|
|
sha256 = "sha256-uTh3rYVvEke1iWVHsT3Zj2H1F+gyLrffcmyt0JEKaCA=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
outputs = [ "out" "dev" "py3" ];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2021-02-05 17:12:51 +00:00
|
|
|
pkg-config
|
2020-04-24 23:36:52 +00:00
|
|
|
cmake
|
|
|
|
makeWrapper
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
pcre
|
|
|
|
python3
|
|
|
|
zlib
|
2021-07-14 22:03:04 +00:00
|
|
|
] ++ lib.optionals enableJavaScript [
|
2022-08-12 12:06:08 +00:00
|
|
|
(if stdenv.hostPlatform.isDarwin then JavaScriptCore else duktape)
|
2020-04-24 23:36:52 +00:00
|
|
|
] ++ (if stdenv.hostPlatform.isDarwin then [
|
|
|
|
SystemConfiguration
|
|
|
|
CoreFoundation
|
|
|
|
] else [
|
|
|
|
glib
|
|
|
|
dbus
|
|
|
|
networkmanager
|
|
|
|
]);
|
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DWITH_PYTHON2=OFF"
|
|
|
|
"-DPYTHON3_SITEPKG_DIR=${placeholder "py3"}/${python3.sitePackages}"
|
2021-07-14 22:03:04 +00:00
|
|
|
] ++ lib.optional (enableJavaScript && !stdenv.hostPlatform.isDarwin) "-DWITH_MOZJS=ON";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
postFixup = lib.optionalString stdenv.isLinux ''
|
2020-04-24 23:36:52 +00:00
|
|
|
# config_gnome3 uses the helper to find GNOME proxy settings
|
|
|
|
wrapProgram $out/libexec/pxgsettings --prefix XDG_DATA_DIRS : "${gsettings-desktop-schemas}/share/gsettings-schemas/${gsettings-desktop-schemas.name}"
|
|
|
|
'';
|
|
|
|
|
|
|
|
doCheck = false; # fails 1 out of 10 tests
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
|
|
|
license = licenses.lgpl21;
|
|
|
|
homepage = "http://libproxy.github.io/libproxy/";
|
|
|
|
description = "A library that provides automatic proxy configuration management";
|
|
|
|
};
|
|
|
|
}
|