about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/text/source-highlight/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/text/source-highlight/default.nix')
-rw-r--r--nixpkgs/pkgs/tools/text/source-highlight/default.nix14
1 files changed, 11 insertions, 3 deletions
diff --git a/nixpkgs/pkgs/tools/text/source-highlight/default.nix b/nixpkgs/pkgs/tools/text/source-highlight/default.nix
index 7052d9e5a44a..2e60d2a31c0c 100644
--- a/nixpkgs/pkgs/tools/text/source-highlight/default.nix
+++ b/nixpkgs/pkgs/tools/text/source-highlight/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, boost }:
+{ lib, stdenv, fetchurl, boost }:
 
 let
   name = "source-highlight";
@@ -12,6 +12,14 @@ stdenv.mkDerivation {
     sha256 = "148w47k3zswbxvhg83z38ifi85f9dqcpg7icvvw1cm6bg21x4zrs";
   };
 
+  # source-highlight uses it's own binary to generate documentation.
+  # During cross-compilation, that binary was built for the target
+  # platform architecture, so it can't run on the build host.
+  patchPhase = lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
+    substituteInPlace Makefile.in --replace "src doc tests" "src tests"
+  '';
+
+  strictDeps = true;
   buildInputs = [ boost ];
 
   configureFlags = [ "--with-boost=${boost.out}" ];
@@ -21,8 +29,8 @@ stdenv.mkDerivation {
   meta = {
     description = "Source code renderer with syntax highlighting";
     homepage = "https://www.gnu.org/software/src-highlite/";
-    license = stdenv.lib.licenses.gpl3Plus;
-    platforms = with stdenv.lib.platforms; linux ++ darwin;
+    license = lib.licenses.gpl3Plus;
+    platforms = with lib.platforms; linux ++ darwin;
     longDescription =
       ''
         GNU Source-highlight, given a source file, produces a document