Merge pull request #272353 from SuperSandro2000/libproxy

Sandro 57e4ea00 9f677027

Changed files
+258 -52
pkgs
+88 -49
pkgs/development/libraries/libproxy/default.nix
···
{ lib
-
, stdenv
+
, _experimental-update-script-combinators
+
, curl
+
, darwin
+
, duktape
, fetchFromGitHub
, fetchpatch
+
, gi-docgen
+
, gitUpdater
+
, glib
+
, gobject-introspection
+
, gsettings-desktop-schemas
+
, makeHardcodeGsettingsPatch
+
, meson
+
, ninja
, pkg-config
-
, cmake
-
, zlib
-
, dbus
-
, networkmanager
-
, enableJavaScript ? stdenv.isDarwin || lib.meta.availableOn stdenv.hostPlatform duktape
-
, duktape
-
, pcre
-
, gsettings-desktop-schemas
-
, glib
-
, makeWrapper
-
, python3
-
, SystemConfiguration
-
, CoreFoundation
-
, JavaScriptCore
+
, stdenv
+
, substituteAll
+
, vala
}:
-
stdenv.mkDerivation rec {
+
stdenv.mkDerivation (finalAttrs: {
pname = "libproxy";
-
version = "0.4.18";
+
version = "0.5.3";
+
+
outputs = [ "out" "dev" "devdoc" ];
src = fetchFromGitHub {
owner = "libproxy";
repo = "libproxy";
-
rev = version;
-
hash = "sha256-pqj1LwRdOK2CUu3hYIsogQIXxWzShDuKEbDTbtWkgnQ=";
+
rev = finalAttrs.version;
+
hash = "sha256-qdYB6HJkgboS8kkTvTqLy6Z3JYY5SOJsRl6nZM0iuvw=";
};
-
patches = lib.optionals stdenv.isDarwin [
-
# https://github.com/libproxy/libproxy/pull/189
+
patches = [
+
# Minor refactoring. Allows the following patches to apply without rebasing.
(fetchpatch {
-
url = "https://github.com/libproxy/libproxy/commit/4331b9db427ce2c25ff5eeb597bec4bc35ed1a0b.patch";
-
sha256 = "sha256-uTh3rYVvEke1iWVHsT3Zj2H1F+gyLrffcmyt0JEKaCA=";
+
url = "https://github.com/libproxy/libproxy/commit/397f4dc72607cc1bb3b584ffd3de49f8ba80491a.patch";
+
hash = "sha256-iUMBMpcVOLG+NxEj8Nd7JtKZFmoGXn0t6A2r2ayiteg=";
+
includes = [
+
"src/backend/plugins/config-gnome/config-gnome.c"
+
];
})
-
];
-
outputs = [ "out" "dev" "py3" ];
+
# Disable schema presence detection, it would fail because it cannot be autopatched,
+
# and it will be hardcoded by the next patch anyway.
+
./skip-gsettings-detection.patch
+
+
# Hardcode path to Settings schemas for GNOME & related desktops.
+
# Otherwise every app using libproxy would need to be wrapped individually.
+
(substituteAll {
+
src = ./hardcode-gsettings.patch;
+
gds = glib.getSchemaPath gsettings-desktop-schemas;
+
})
+
];
nativeBuildInputs = [
+
gi-docgen
+
gobject-introspection
+
meson
+
ninja
pkg-config
-
cmake
-
makeWrapper
+
vala
];
buildInputs = [
-
pcre
-
python3
-
zlib
-
] ++ lib.optionals enableJavaScript [
-
(if stdenv.hostPlatform.isDarwin then JavaScriptCore else duktape)
-
] ++ (if stdenv.hostPlatform.isDarwin then [
+
curl
+
duktape
+
] ++ (if stdenv.hostPlatform.isDarwin then (with darwin.apple_sdk.frameworks; [
+
CoreFoundation
SystemConfiguration
-
CoreFoundation
-
] else [
+
]) else [
glib
-
dbus
-
networkmanager
+
gsettings-desktop-schemas
]);
-
cmakeFlags = [
-
"-DWITH_PYTHON2=OFF"
-
"-DPYTHON3_SITEPKG_DIR=${placeholder "py3"}/${python3.sitePackages}"
-
] ++ lib.optional (enableJavaScript && !stdenv.hostPlatform.isDarwin) "-DWITH_MOZJS=ON";
+
doCheck = true;
-
postFixup = lib.optionalString stdenv.isLinux ''
-
# 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}"
+
postPatch = ''
+
# Fix running script that will try to install git hooks.
+
# Though it will not do anything since we do not keep .git/ directory.
+
# https://github.com/libproxy/libproxy/issues/262
+
chmod +x data/install-git-hook.sh
+
patchShebangs data/install-git-hook.sh
'';
-
doCheck = false; # fails 1 out of 10 tests
+
postFixup = ''
+
# Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back.
+
moveToOutput "share/doc" "$devdoc"
+
'';
+
+
passthru = {
+
hardcodeGsettingsPatch = makeHardcodeGsettingsPatch {
+
schemaIdToVariableMapping = {
+
"org.gnome.system.proxy" = "gds";
+
"org.gnome.system.proxy.http" = "gds";
+
"org.gnome.system.proxy.https" = "gds";
+
"org.gnome.system.proxy.ftp" = "gds";
+
"org.gnome.system.proxy.socks" = "gds";
+
};
+
inherit (finalAttrs) src;
+
};
+
+
updateScript =
+
let
+
updateSource = gitUpdater { };
+
updatePatch = _experimental-update-script-combinators.copyAttrOutputToFile "libproxy.hardcodeGsettingsPatch" ./hardcode-gsettings.patch;
+
in
+
_experimental-update-script-combinators.sequence [
+
updateSource
+
updatePatch
+
];
+
};
meta = with lib; {
-
platforms = platforms.linux ++ platforms.darwin;
-
license = licenses.lgpl21;
-
homepage = "https://libproxy.github.io/libproxy/";
description = "A library that provides automatic proxy configuration management";
+
homepage = "https://libproxy.github.io/libproxy/";
+
license = licenses.lgpl21Plus;
+
platforms = platforms.linux ++ platforms.darwin;
mainProgram = "proxy";
};
-
}
+
})
+140
pkgs/development/libraries/libproxy/hardcode-gsettings.patch
···
+
diff --git a/src/backend/plugins/config-gnome/config-gnome.c b/src/backend/plugins/config-gnome/config-gnome.c
+
index 820827b..338e269 100644
+
--- a/src/backend/plugins/config-gnome/config-gnome.c
+
+++ b/src/backend/plugins/config-gnome/config-gnome.c
+
@@ -85,11 +85,60 @@ px_config_gnome_init (PxConfigGnome *self)
+
if (!self->available)
+
return;
+
+
- self->proxy_settings = g_settings_new ("org.gnome.system.proxy");
+
- self->http_proxy_settings = g_settings_new ("org.gnome.system.proxy.http");
+
- self->https_proxy_settings = g_settings_new ("org.gnome.system.proxy.https");
+
- self->ftp_proxy_settings = g_settings_new ("org.gnome.system.proxy.ftp");
+
- self->socks_proxy_settings = g_settings_new ("org.gnome.system.proxy.socks");
+
+ {
+
+ g_autoptr(GSettingsSchemaSource) schema_source;
+
+ g_autoptr(GSettingsSchema) schema;
+
+ schema_source = g_settings_schema_source_new_from_directory("@gds@",
+
+ g_settings_schema_source_get_default(),
+
+ TRUE, NULL);
+
+ schema = g_settings_schema_source_lookup(schema_source,
+
+ "org.gnome.system.proxy", FALSE);
+
+ self->proxy_settings = g_settings_new_full(schema, NULL, NULL);
+
+ }
+
+ {
+
+ g_autoptr(GSettingsSchemaSource) schema_source;
+
+ g_autoptr(GSettingsSchema) schema;
+
+ schema_source = g_settings_schema_source_new_from_directory("@gds@",
+
+ g_settings_schema_source_get_default(),
+
+ TRUE, NULL);
+
+ schema = g_settings_schema_source_lookup(schema_source,
+
+ "org.gnome.system.proxy.http",
+
+ FALSE);
+
+ self->http_proxy_settings = g_settings_new_full(schema, NULL, NULL);
+
+ }
+
+ {
+
+ g_autoptr(GSettingsSchemaSource) schema_source;
+
+ g_autoptr(GSettingsSchema) schema;
+
+ schema_source = g_settings_schema_source_new_from_directory("@gds@",
+
+ g_settings_schema_source_get_default(),
+
+ TRUE, NULL);
+
+ schema = g_settings_schema_source_lookup(schema_source,
+
+ "org.gnome.system.proxy.https",
+
+ FALSE);
+
+ self->https_proxy_settings = g_settings_new_full(schema, NULL, NULL);
+
+ }
+
+ {
+
+ g_autoptr(GSettingsSchemaSource) schema_source;
+
+ g_autoptr(GSettingsSchema) schema;
+
+ schema_source = g_settings_schema_source_new_from_directory("@gds@",
+
+ g_settings_schema_source_get_default(),
+
+ TRUE, NULL);
+
+ schema = g_settings_schema_source_lookup(schema_source,
+
+ "org.gnome.system.proxy.ftp",
+
+ FALSE);
+
+ self->ftp_proxy_settings = g_settings_new_full(schema, NULL, NULL);
+
+ }
+
+ {
+
+ g_autoptr(GSettingsSchemaSource) schema_source;
+
+ g_autoptr(GSettingsSchema) schema;
+
+ schema_source = g_settings_schema_source_new_from_directory("@gds@",
+
+ g_settings_schema_source_get_default(),
+
+ TRUE, NULL);
+
+ schema = g_settings_schema_source_lookup(schema_source,
+
+ "org.gnome.system.proxy.socks",
+
+ FALSE);
+
+ self->socks_proxy_settings = g_settings_new_full(schema, NULL, NULL);
+
+ }
+
}
+
+
static void
+
diff --git a/tests/config-gnome-test.c b/tests/config-gnome-test.c
+
index f80914a..118d429 100644
+
--- a/tests/config-gnome-test.c
+
+++ b/tests/config-gnome-test.c
+
@@ -60,11 +60,60 @@ static void
+
fixture_setup (Fixture *self,
+
gconstpointer data)
+
{
+
- self->proxy_settings = g_settings_new ("org.gnome.system.proxy");
+
- self->http_proxy_settings = g_settings_new ("org.gnome.system.proxy.http");
+
- self->https_proxy_settings = g_settings_new ("org.gnome.system.proxy.https");
+
- self->ftp_proxy_settings = g_settings_new ("org.gnome.system.proxy.ftp");
+
- self->socks_proxy_settings = g_settings_new ("org.gnome.system.proxy.socks");
+
+ {
+
+ g_autoptr(GSettingsSchemaSource) schema_source;
+
+ g_autoptr(GSettingsSchema) schema;
+
+ schema_source = g_settings_schema_source_new_from_directory("@gds@",
+
+ g_settings_schema_source_get_default(),
+
+ TRUE, NULL);
+
+ schema = g_settings_schema_source_lookup(schema_source,
+
+ "org.gnome.system.proxy", FALSE);
+
+ self->proxy_settings = g_settings_new_full(schema, NULL, NULL);
+
+ }
+
+ {
+
+ g_autoptr(GSettingsSchemaSource) schema_source;
+
+ g_autoptr(GSettingsSchema) schema;
+
+ schema_source = g_settings_schema_source_new_from_directory("@gds@",
+
+ g_settings_schema_source_get_default(),
+
+ TRUE, NULL);
+
+ schema = g_settings_schema_source_lookup(schema_source,
+
+ "org.gnome.system.proxy.http",
+
+ FALSE);
+
+ self->http_proxy_settings = g_settings_new_full(schema, NULL, NULL);
+
+ }
+
+ {
+
+ g_autoptr(GSettingsSchemaSource) schema_source;
+
+ g_autoptr(GSettingsSchema) schema;
+
+ schema_source = g_settings_schema_source_new_from_directory("@gds@",
+
+ g_settings_schema_source_get_default(),
+
+ TRUE, NULL);
+
+ schema = g_settings_schema_source_lookup(schema_source,
+
+ "org.gnome.system.proxy.https",
+
+ FALSE);
+
+ self->https_proxy_settings = g_settings_new_full(schema, NULL, NULL);
+
+ }
+
+ {
+
+ g_autoptr(GSettingsSchemaSource) schema_source;
+
+ g_autoptr(GSettingsSchema) schema;
+
+ schema_source = g_settings_schema_source_new_from_directory("@gds@",
+
+ g_settings_schema_source_get_default(),
+
+ TRUE, NULL);
+
+ schema = g_settings_schema_source_lookup(schema_source,
+
+ "org.gnome.system.proxy.ftp",
+
+ FALSE);
+
+ self->ftp_proxy_settings = g_settings_new_full(schema, NULL, NULL);
+
+ }
+
+ {
+
+ g_autoptr(GSettingsSchemaSource) schema_source;
+
+ g_autoptr(GSettingsSchema) schema;
+
+ schema_source = g_settings_schema_source_new_from_directory("@gds@",
+
+ g_settings_schema_source_get_default(),
+
+ TRUE, NULL);
+
+ schema = g_settings_schema_source_lookup(schema_source,
+
+ "org.gnome.system.proxy.socks",
+
+ FALSE);
+
+ self->socks_proxy_settings = g_settings_new_full(schema, NULL, NULL);
+
+ }
+
}
+
+
static void
+29
pkgs/development/libraries/libproxy/skip-gsettings-detection.patch
···
+
diff --git a/src/backend/plugins/config-gnome/config-gnome.c b/src/backend/plugins/config-gnome/config-gnome.c
+
index 52e812e..a1edcab 100644
+
--- a/src/backend/plugins/config-gnome/config-gnome.c
+
+++ b/src/backend/plugins/config-gnome/config-gnome.c
+
@@ -57,7 +57,6 @@ enum {
+
static void
+
px_config_gnome_init (PxConfigGnome *self)
+
{
+
- GSettingsSchemaSource *source;
+
g_autoptr (GSettingsSchema) proxy_schema = NULL;
+
const char *desktops;
+
+
@@ -71,15 +70,7 @@ px_config_gnome_init (PxConfigGnome *self)
+
if (strstr (desktops, "GNOME") == NULL)
+
return;
+
+
- source = g_settings_schema_source_get_default ();
+
- if (!source) {
+
- g_warning ("GNOME desktop detected but no schemes installed, aborting.");
+
- return;
+
- }
+
-
+
- proxy_schema = g_settings_schema_source_lookup (source, "org.gnome.system.proxy", TRUE);
+
-
+
- self->available = proxy_schema != NULL;
+
+ self->available = TRUE;
+
if (!self->available)
+
return;
+
+1 -3
pkgs/top-level/all-packages.nix
···
stdenv = gccStdenv; # Required for darwin
}) libprom libpromhttp;
-
libproxy = callPackage ../development/libraries/libproxy {
-
inherit (darwin.apple_sdk.frameworks) SystemConfiguration CoreFoundation JavaScriptCore;
-
};
+
libproxy = callPackage ../development/libraries/libproxy { };
libpseudo = callPackage ../development/libraries/libpseudo { };