about summary refs log tree commit diff
path: root/pkgs/tools
diff options
context:
space:
mode:
authorMasum Reza <50095635+JohnRTitor@users.noreply.github.com>2024-06-23 21:53:15 +0530
committerGitHub <noreply@github.com>2024-06-23 21:53:15 +0530
commit04fe9bbf582fa53ce027ddb8cee95c326c6047ad (patch)
treee8a5919d399e1a59b77ae138632b60c400ac3445 /pkgs/tools
parent713b2344253fecccd7d6c10f7a3e85b798343424 (diff)
parent4f991469fba89c1703f5ff5338fb923c44f09351 (diff)
Merge pull request #321834 from afh/remind-fix-darwin
remind: refactor and fix darwin build
Diffstat (limited to 'pkgs/tools')
-rw-r--r--pkgs/tools/misc/remind/default.nix38
1 files changed, 22 insertions, 16 deletions
diff --git a/pkgs/tools/misc/remind/default.nix b/pkgs/tools/misc/remind/default.nix
index 467981bb0a294..51448931dcfb3 100644
--- a/pkgs/tools/misc/remind/default.nix
+++ b/pkgs/tools/misc/remind/default.nix
@@ -1,4 +1,5 @@
 { lib
+, stdenv
 , fetchurl
 , tk
 , tcllib
@@ -6,38 +7,43 @@
 , tkremind ? true
 }:
 
-let
-  inherit (lib) optionals optionalString;
-  tclLibraries = optionals tkremind [ tcllib tk ];
-  tkremindPatch = optionalString tkremind ''
-    substituteInPlace scripts/tkremind --replace "exec wish" "exec ${tk}/bin/wish"
-  '';
-in
 tcl.mkTclDerivation rec {
   pname = "remind";
   version = "05.00.01";
 
   src = fetchurl {
     url = "https://dianne.skoll.ca/projects/remind/download/remind-${version}.tar.gz";
-    sha256 = "sha256-tj36/lLn67/hkNMrRVGXRLqQ9Sx6oDKZHeajiSYn97c=";
+    hash = "sha256-tj36/lLn67/hkNMrRVGXRLqQ9Sx6oDKZHeajiSYn97c=";
   };
 
-  propagatedBuildInputs = tclLibraries;
+  propagatedBuildInputs = lib.optionals tkremind [ tcllib tk ];
 
-  postPatch = ''
-    substituteInPlace ./configure \
-      --replace "sleep 1" "true"
-    substituteInPlace ./src/init.c \
-      --replace "rkrphgvba(0);" "" \
-      --replace "rkrphgvba(1);" ""
-    ${tkremindPatch}
+  postPatch = lib.optionalString tkremind ''
+    # NOTA BENE: The path to rem2pdf is replaced in tkremind for future use
+    # as rem2pdf is currently not build since it requires the JSON::MaybeXS,
+    # Pango and Cairo Perl modules.
+    substituteInPlace scripts/tkremind \
+      --replace-fail "exec wish" "exec ${lib.getBin tk}/bin/wish" \
+      --replace-fail 'set Remind "remind"' "set Remind \"$out/bin/remind\"" \
+      --replace-fail 'set Rem2PS "rem2ps"' "set Rem2PS \"$out/bin/rem2ps\"" \
+      --replace-fail 'set Rem2PDF "rem2pdf"' "set Rem2PDF \"$out/bin/rem2pdf\""
   '';
 
+  env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin (toString [
+    # Disable clang link time optimization until the following issue is resolved:
+    # https://github.com/NixOS/nixpkgs/issues/19098
+    "-fno-lto"
+    # On Darwin setenv and unsetenv are defined in stdlib.h from libSystem
+    "-DHAVE_SETENV"
+    "-DHAVE_UNSETENV"
+  ]);
+
   meta = with lib; {
     homepage = "https://dianne.skoll.ca/projects/remind/";
     description = "Sophisticated calendar and alarm program for the console";
     license = licenses.gpl2Only;
     maintainers = with maintainers; [ raskin kovirobi ];
+    mainProgram = "remind";
     platforms = platforms.unix;
   };
 }