summary refs log tree commit diff
path: root/pkgs/tools/misc/mandoc
diff options
context:
space:
mode:
authorsternenseemann <sternenseemann@systemli.org>2022-01-23 14:44:08 +0100
committersterni <sternenseemann@systemli.org>2022-01-23 15:18:45 +0100
commit8499ca252ab0516c9244eb1150ea6e2e808441ac (patch)
tree6835f59054a160d9854eeeee4fc6917621156c97 /pkgs/tools/misc/mandoc
parent3ab8db0ad04f6f6efae25375ae9577a729d9edc5 (diff)
downloadnixpkgs-8499ca252ab0516c9244eb1150ea6e2e808441ac.tar
nixpkgs-8499ca252ab0516c9244eb1150ea6e2e808441ac.tar.gz
nixpkgs-8499ca252ab0516c9244eb1150ea6e2e808441ac.tar.bz2
nixpkgs-8499ca252ab0516c9244eb1150ea6e2e808441ac.tar.lz
nixpkgs-8499ca252ab0516c9244eb1150ea6e2e808441ac.tar.xz
nixpkgs-8499ca252ab0516c9244eb1150ea6e2e808441ac.tar.zst
nixpkgs-8499ca252ab0516c9244eb1150ea6e2e808441ac.zip
mandoc: move executableCross assert into meta.broken
For splicing to work, callPackage needs to be able to attach extra
attributes (e. g. nativeDrv) to pkgsHostTarget.mandoc. If we have the
assert like before, pkgsHostTarget.mandoc would fail to evaluate,
preventing buildPackages.mandoc (which works as expected) to be attached
to the former. This affected cross compilation of the netbsd package set
in particular.
Diffstat (limited to 'pkgs/tools/misc/mandoc')
-rw-r--r--pkgs/tools/misc/mandoc/default.nix28
1 files changed, 14 insertions, 14 deletions
diff --git a/pkgs/tools/misc/mandoc/default.nix b/pkgs/tools/misc/mandoc/default.nix
index 292a28bf313..dc564776d89 100644
--- a/pkgs/tools/misc/mandoc/default.nix
+++ b/pkgs/tools/misc/mandoc/default.nix
@@ -1,16 +1,6 @@
 { lib, stdenv, fetchurl, zlib, perl, nixosTests }:
 
 let
-  # check if we can execute binaries for the host platform on the build platform
-  # even though the platforms aren't the same. mandoc can't be cross compiled
-  # (easily) because of its configurePhase, but we want to allow “native” cross
-  # such as pkgsLLVM and pkgsStatic.
-  # For a lack of a better predicate at the moment, we compare the platforms'
-  # system tuples. See also:
-  # * https://github.com/NixOS/nixpkgs/pull/140271
-  # * https://github.com/NixOS/nixpkgs/issues/61414
-  executableCross = stdenv.buildPlatform.system == stdenv.hostPlatform.system;
-
   # Name of an UTF-8 locale _always_ present at runtime, used for UTF-8 support
   # (locale set by the user may differ). This would usually be C.UTF-8, but
   # darwin has no such locale.
@@ -20,9 +10,6 @@ let
     else "C.UTF-8";
 in
 
-assert executableCross ||
-  throw "mandoc relies on executing compiled programs in configurePhase, can't cross compile";
-
 stdenv.mkDerivation rec {
   pname = "mandoc";
   version = "1.14.6";
@@ -61,7 +48,7 @@ stdenv.mkDerivation rec {
     printf '%s' "$configureLocal" > configure.local
   '';
 
-  doCheck = executableCross;
+  doCheck = true;
   checkTarget = "regress";
   checkInputs = [ perl ];
   preCheck = "patchShebangs --build regress/regress.pl";
@@ -71,6 +58,19 @@ stdenv.mkDerivation rec {
   };
 
   meta = with lib; {
+    # check if we can execute binaries for the host platform on the build platform
+    # even though the platforms aren't the same. mandoc can't be cross compiled
+    # (easily) because of its configurePhase which executes compiled programs
+    # for gathering information about the host system. Consequently, we can only
+    # allow “native” cross such as pkgsLLVM and pkgsStatic.
+    # For a lack of a better predicate at the moment, we compare the platforms'
+    # system tuples. See also:
+    # * https://github.com/NixOS/nixpkgs/pull/140271
+    # * https://github.com/NixOS/nixpkgs/issues/61414
+    # We need to use broken instead of, say a top level assert, to keep splicing
+    # working.
+    broken = stdenv.buildPlatform.system != stdenv.hostPlatform.system;
+
     homepage = "https://mandoc.bsd.lv/";
     description = "suite of tools compiling mdoc and man";
     downloadPage = "http://mandoc.bsd.lv/snapshots/";