libproxy: 0.4.18 → 0.5.3

https://github.com/libproxy/libproxy/releases/tag/libproxy-0.5.0
https://github.com/libproxy/libproxy/releases/tag/0.5.1
https://github.com/libproxy/libproxy/releases/tag/0.5.2
https://github.com/libproxy/libproxy/releases/tag/0.5.3

Complete rewrite of the project, reduces runtime closure significantly.

Co-authored-by: Jan Tojnar <jtojnar@gmail.com>
This commit is contained in:
Sandro Jäckel 2023-12-05 22:16:52 +01:00
parent c81c241415
commit 3e6ae42d56
No known key found for this signature in database
GPG Key ID: 3AF5A43A3EECC2E5
4 changed files with 258 additions and 52 deletions

View File

@ -1,83 +1,122 @@
{ lib
, stdenv
, _experimental-update-script-combinators
, curl
, darwin
, duktape
, fetchFromGitHub
, fetchpatch
, pkg-config
, cmake
, zlib
, dbus
, networkmanager
, enableJavaScript ? stdenv.isDarwin || lib.meta.availableOn stdenv.hostPlatform duktape
, duktape
, pcre
, gsettings-desktop-schemas
, gi-docgen
, gitUpdater
, glib
, makeWrapper
, python3
, SystemConfiguration
, CoreFoundation
, JavaScriptCore
, gobject-introspection
, gsettings-desktop-schemas
, makeHardcodeGsettingsPatch
, meson
, ninja
, pkg-config
, 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"
];
})
# 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;
})
];
outputs = [ "out" "dev" "py3" ];
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 [
SystemConfiguration
curl
duktape
] ++ (if stdenv.hostPlatform.isDarwin then (with darwin.apple_sdk.frameworks; [
CoreFoundation
] else [
SystemConfiguration
]) 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";
};
}
})

View File

@ -0,0 +1,140 @@
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

View File

@ -0,0 +1,29 @@
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;

View File

@ -22971,9 +22971,7 @@ with pkgs;
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 { };