about summary refs log tree commit diff
path: root/pkgs/applications
diff options
context:
space:
mode:
authorAdam Joseph <54836058+amjoseph-nixpkgs@users.noreply.github.com>2023-02-22 13:21:54 +0000
committerGitHub <noreply@github.com>2023-02-22 14:21:54 +0100
commitfb3a27fade656122e28afde3d8263e933f54ed93 (patch)
treed523ec71e7bf8a311babb924dfb29b0a0140d162 /pkgs/applications
parentde9d483a2e8e930467a6cbe18597a22637f2c9e6 (diff)
qemacs: 0.3.3 -> 5.4.1c (#209418)
* qemacs: fix cross-compilation

Also adds enableX11 parameter.

* qemacs: 0.3.3 -> 5.4.1c

---------

Co-authored-by: Artturi <Artturin@artturin.com>
Diffstat (limited to 'pkgs/applications')
-rw-r--r--pkgs/applications/editors/qemacs/default.nix43
1 files changed, 37 insertions, 6 deletions
diff --git a/pkgs/applications/editors/qemacs/default.nix b/pkgs/applications/editors/qemacs/default.nix
index 9fc91fbe19771..6960ecb3d34e3 100644
--- a/pkgs/applications/editors/qemacs/default.nix
+++ b/pkgs/applications/editors/qemacs/default.nix
@@ -1,15 +1,46 @@
-{ fetchurl, lib, stdenv, libX11, libXext, libXv, libpng }:
+{ lib
+, stdenv
+, fetchFromGitHub
+, buildPackages
+, which
+, texi2html
+, enableX11 ? true
+, libX11, libXext, libXv, libpng
+}:
 
 stdenv.mkDerivation rec {
   pname = "qemacs";
-  version = "0.3.3";
+  version = "5.4.1c";
 
-  src = fetchurl {
-    url = "https://bellard.org/${pname}/${pname}-${version}.tar.gz";
-    sha256 = "156z4wpj49i6j388yjird5qvrph7hz0grb4r44l4jf3q8imadyrg";
+  src = fetchFromGitHub {
+    owner = "qemacs";
+    repo = "qemacs";
+    rev = "216b3ff8b77ff138aec22045522d5601b7390e58";
+    hash = "sha256-ngVaZZdr/Ym9YswLqzUtDytC0K7L9mKgORopLghGH3k=";
   };
 
-  buildInputs = [ libpng libX11 libXext libXv ];
+  postPatch = ''
+    substituteInPlace Makefile --replace \
+      '$(INSTALL) -m 755 -s' \
+      '$(INSTALL) -m 755 -s --strip-program=${stdenv.cc.targetPrefix}strip'
+  '';
+
+  nativeBuildInputs = [ which texi2html ];
+  buildInputs = lib.optionals enableX11 [ libpng libX11 libXext libXv ];
+
+  enableParallelBuilding = true;
+
+  configureFlags = [
+    "--cross-prefix=${stdenv.cc.targetPrefix}"
+  ] ++ lib.optionals (!enableX11) [
+    "--disable-x11"
+  ];
+
+  makeFlags = [
+    # is actually used as BUILD_CC
+    "HOST_CC=${buildPackages.stdenv.cc}/bin/cc"
+    "CC=${stdenv.cc.targetPrefix}cc"
+  ];
 
   preInstall = ''
     mkdir -p $out/bin $out/man