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.
main
sternenseemann 2 years ago committed by sterni
parent 3ab8db0ad0
commit 8499ca252a
  1. 28
      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/";

Loading…
Cancel
Save