2022-08-12 12:06:08 +00:00
|
|
|
{ lib
|
2024-04-21 15:54:59 +00:00
|
|
|
, _experimental-update-script-combinators
|
|
|
|
, curl
|
|
|
|
, darwin
|
|
|
|
, duktape
|
2020-04-24 23:36:52 +00:00
|
|
|
, fetchFromGitHub
|
2024-04-21 15:54:59 +00:00
|
|
|
, gi-docgen
|
|
|
|
, gitUpdater
|
2020-04-24 23:36:52 +00:00
|
|
|
, glib
|
2024-04-21 15:54:59 +00:00
|
|
|
, gobject-introspection
|
|
|
|
, gsettings-desktop-schemas
|
|
|
|
, makeHardcodeGsettingsPatch
|
|
|
|
, meson
|
|
|
|
, ninja
|
|
|
|
, pkg-config
|
|
|
|
, stdenv
|
|
|
|
, substituteAll
|
|
|
|
, vala
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "libproxy";
|
2024-05-15 15:35:15 +00:00
|
|
|
version = "0.5.6";
|
2024-04-21 15:54:59 +00:00
|
|
|
|
|
|
|
outputs = [ "out" "dev" "devdoc" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "libproxy";
|
|
|
|
repo = "libproxy";
|
2024-04-21 15:54:59 +00:00
|
|
|
rev = finalAttrs.version;
|
2024-05-15 15:35:15 +00:00
|
|
|
hash = "sha256-2uDlKjxzrKlyZKV0BSUDzmLSo2voJKDerbZZkamgNYk=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
patches = [
|
|
|
|
]
|
|
|
|
++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
|
|
|
|
# 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;
|
2022-08-12 12:06:08 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
# Fix include-path propagation in non-static builds.
|
|
|
|
# https://github.com/libproxy/libproxy/pull/239#issuecomment-2056620246
|
|
|
|
substituteInPlace src/libproxy/meson.build \
|
|
|
|
--replace-fail "requires_private: 'gobject-2.0'" "requires: 'gobject-2.0'"
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2024-04-21 15:54:59 +00:00
|
|
|
gi-docgen
|
|
|
|
gobject-introspection
|
|
|
|
meson
|
|
|
|
ninja
|
2021-02-05 17:12:51 +00:00
|
|
|
pkg-config
|
2024-04-21 15:54:59 +00:00
|
|
|
vala
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
2024-04-21 15:54:59 +00:00
|
|
|
curl
|
|
|
|
duktape
|
|
|
|
] ++ (if stdenv.hostPlatform.isDarwin then (with darwin.apple_sdk.frameworks; [
|
|
|
|
Foundation
|
|
|
|
]) else [
|
2020-04-24 23:36:52 +00:00
|
|
|
glib
|
2024-04-21 15:54:59 +00:00
|
|
|
gsettings-desktop-schemas
|
2020-04-24 23:36:52 +00:00
|
|
|
]);
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
mesonFlags = [
|
|
|
|
# Prevent installing commit hook.
|
|
|
|
"-Drelease=true"
|
|
|
|
]
|
|
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
2024-04-21 15:54:59 +00:00
|
|
|
"-Dconfig-gnome=false"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
doCheck = !stdenv.hostPlatform.isDarwin;
|
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
# Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back.
|
|
|
|
moveToOutput "share/doc" "$devdoc"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
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
|
|
|
|
];
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Library that provides automatic proxy configuration management";
|
2024-04-21 15:54:59 +00:00
|
|
|
homepage = "https://libproxy.github.io/libproxy/";
|
|
|
|
license = licenses.lgpl21Plus;
|
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
|
|
|
mainProgram = "proxy";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2024-04-21 15:54:59 +00:00
|
|
|
})
|