at 24.11-pre 126 lines 3.3 kB view raw
1{ lib 2, _experimental-update-script-combinators 3, curl 4, darwin 5, duktape 6, fetchFromGitHub 7, gi-docgen 8, gitUpdater 9, glib 10, gobject-introspection 11, gsettings-desktop-schemas 12, makeHardcodeGsettingsPatch 13, meson 14, ninja 15, pkg-config 16, stdenv 17, substituteAll 18, vala 19}: 20 21stdenv.mkDerivation (finalAttrs: { 22 pname = "libproxy"; 23 version = "0.5.6"; 24 25 outputs = [ "out" "dev" "devdoc" ]; 26 27 src = fetchFromGitHub { 28 owner = "libproxy"; 29 repo = "libproxy"; 30 rev = finalAttrs.version; 31 hash = "sha256-2uDlKjxzrKlyZKV0BSUDzmLSo2voJKDerbZZkamgNYk="; 32 }; 33 34 patches = [ 35 ] 36 ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ 37 # Disable schema presence detection, it would fail because it cannot be autopatched, 38 # and it will be hardcoded by the next patch anyway. 39 ./skip-gsettings-detection.patch 40 41 # Hardcode path to Settings schemas for GNOME & related desktops. 42 # Otherwise every app using libproxy would need to be wrapped individually. 43 (substituteAll { 44 src = ./hardcode-gsettings.patch; 45 gds = glib.getSchemaPath gsettings-desktop-schemas; 46 }) 47 ]; 48 49 postPatch = '' 50 # Fix running script that will try to install git hooks. 51 # Though it will not do anything since we do not keep .git/ directory. 52 # https://github.com/libproxy/libproxy/issues/262 53 chmod +x data/install-git-hook.sh 54 patchShebangs data/install-git-hook.sh 55 56 # Fix include-path propagation in non-static builds. 57 # https://github.com/libproxy/libproxy/pull/239#issuecomment-2056620246 58 substituteInPlace src/libproxy/meson.build \ 59 --replace-fail "requires_private: 'gobject-2.0'" "requires: 'gobject-2.0'" 60 ''; 61 62 nativeBuildInputs = [ 63 gi-docgen 64 gobject-introspection 65 meson 66 ninja 67 pkg-config 68 vala 69 ]; 70 71 buildInputs = [ 72 curl 73 duktape 74 ] ++ (if stdenv.hostPlatform.isDarwin then (with darwin.apple_sdk.frameworks; [ 75 Foundation 76 ]) else [ 77 glib 78 gsettings-desktop-schemas 79 ]); 80 81 mesonFlags = [ 82 # Prevent installing commit hook. 83 "-Drelease=true" 84 ] 85 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 86 "-Dconfig-gnome=false" 87 ]; 88 89 doCheck = !stdenv.hostPlatform.isDarwin; 90 91 postFixup = '' 92 # Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back. 93 moveToOutput "share/doc" "$devdoc" 94 ''; 95 96 passthru = { 97 hardcodeGsettingsPatch = makeHardcodeGsettingsPatch { 98 schemaIdToVariableMapping = { 99 "org.gnome.system.proxy" = "gds"; 100 "org.gnome.system.proxy.http" = "gds"; 101 "org.gnome.system.proxy.https" = "gds"; 102 "org.gnome.system.proxy.ftp" = "gds"; 103 "org.gnome.system.proxy.socks" = "gds"; 104 }; 105 inherit (finalAttrs) src; 106 }; 107 108 updateScript = 109 let 110 updateSource = gitUpdater { }; 111 updatePatch = _experimental-update-script-combinators.copyAttrOutputToFile "libproxy.hardcodeGsettingsPatch" ./hardcode-gsettings.patch; 112 in 113 _experimental-update-script-combinators.sequence [ 114 updateSource 115 updatePatch 116 ]; 117 }; 118 119 meta = with lib; { 120 description = "A library that provides automatic proxy configuration management"; 121 homepage = "https://libproxy.github.io/libproxy/"; 122 license = licenses.lgpl21Plus; 123 platforms = platforms.linux ++ platforms.darwin; 124 mainProgram = "proxy"; 125 }; 126})