From 0eb0361b4518c59b7129cec90d5677ee188a985a Mon Sep 17 00:00:00 2001 From: Yifei Sun Date: Mon, 6 Jan 2025 13:40:50 -0500 Subject: [PATCH] libfm: fetch gcc 14 patch and refactor - instead of vendoring patches, fetch from lxde - use `finalAttrs` pattern and remove `with lib;` Co-authored-by: Jan Tojnar --- pkgs/by-name/li/libfm/package.nix | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/pkgs/by-name/li/libfm/package.nix b/pkgs/by-name/li/libfm/package.nix index d762036a22d074..4ced9fda207ace 100644 --- a/pkgs/by-name/li/libfm/package.nix +++ b/pkgs/by-name/li/libfm/package.nix @@ -2,6 +2,7 @@ lib, stdenv, fetchurl, + fetchpatch, glib, intltool, menu-cache, @@ -18,20 +19,21 @@ let gtk = if withGtk3 then gtk3 else gtk2; inherit (lib) optional optionalString; in -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = if extraOnly then "libfm-extra" else "libfm"; version = "1.3.2"; src = fetchurl { - url = "mirror://sourceforge/pcmanfm/libfm-${version}.tar.xz"; + url = "mirror://sourceforge/pcmanfm/libfm-${finalAttrs.version}.tar.xz"; sha256 = "sha256-pQQmMDBM+OXYz/nVZca9VG8ii0jJYBU+02ajTofK0eU="; }; patches = [ - ./0001-fm-load-all-actions.patch - ./0002-exo-icon-view-key-press-event.patch - ./0003-ask-action-on-drop.patch - ./0004-create-icon-view.patch + # Add casts to fix -Werror=incompatible-pointer-types + (fetchpatch { + url = "https://github.com/lxde/libfm/commit/fbcd183335729fa3e8dd6a837c13a23ff3271000.patch"; + hash = "sha256-RbX8jkP/5ao6NWEnv8Pgy4zwZaiDsslGlRRWdoV3enA="; + }) ]; nativeBuildInputs = [ @@ -52,6 +54,11 @@ stdenv.mkDerivation rec { installFlags = [ "sysconfdir=${placeholder "out"}/etc" ]; + postPatch = '' + # Ensure the files are re-generated from Vala sources. + rm src/actions/*.c + ''; + # libfm-extra is pulled in by menu-cache and thus leads to a collision for libfm postInstall = optionalString (!extraOnly) '' rm $out/lib/libfm-extra.so $out/lib/libfm-extra.so.* $out/lib/libfm-extra.la $out/lib/pkgconfig/libfm-extra.pc @@ -59,12 +66,12 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; - meta = with lib; { + meta = { broken = stdenv.hostPlatform.isDarwin; homepage = "https://blog.lxde.org/category/pcmanfm/"; - license = licenses.lgpl21Plus; + license = lib.licenses.lgpl21Plus; description = "Glib-based library for file management"; - maintainers = [ maintainers.ttuegel ]; - platforms = platforms.linux ++ platforms.darwin; + maintainers = with lib.maintainers; [ ttuegel ]; + platforms = lib.platforms.linux ++ lib.platforms.darwin; }; -} +})