2021-09-24 19:54:08 +01:00
|
|
|
{ lib, stdenv, fetchurl, zlib, perl, nixosTests }:
|
2016-09-11 21:18:13 +01:00
|
|
|
|
2021-09-19 19:42:54 +01:00
|
|
|
let
|
|
|
|
# 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.
|
|
|
|
utf8Locale =
|
|
|
|
if stdenv.hostPlatform.isDarwin
|
|
|
|
then "en_US.UTF-8"
|
|
|
|
else "C.UTF-8";
|
|
|
|
in
|
|
|
|
|
2016-09-11 21:18:13 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "mandoc";
|
2021-09-19 18:49:11 +01:00
|
|
|
version = "1.14.6";
|
2016-09-11 21:18:13 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
2018-08-27 02:12:59 +01:00
|
|
|
url = "https://mandoc.bsd.lv/snapshots/mandoc-${version}.tar.gz";
|
2021-09-19 18:49:11 +01:00
|
|
|
sha256 = "8bf0d570f01e70a6e124884088870cbed7537f36328d512909eb10cd53179d9c";
|
2016-09-11 21:18:13 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs = [ zlib ];
|
|
|
|
|
|
|
|
configureLocal = ''
|
|
|
|
MANPATH_DEFAULT="/run/current-system/sw/share/man"
|
2021-09-20 13:16:46 +01:00
|
|
|
MANPATH_BASE="$MANPATH_DEFAULT"
|
2016-09-11 21:18:13 +01:00
|
|
|
OSNAME="NixOS"
|
|
|
|
PREFIX="$out"
|
|
|
|
LD_OHASH="-lutil"
|
2021-09-20 13:46:22 +01:00
|
|
|
# Use symlinks instead of hardlinks (more commonly used in nixpkgs)
|
|
|
|
LN="ln -sf"
|
2021-09-20 15:09:39 +01:00
|
|
|
# nixpkgs doesn't have sbin, install makewhatis to bin
|
|
|
|
SBINDIR="$PREFIX/bin"
|
2018-08-27 08:21:43 +01:00
|
|
|
CC=${stdenv.cc.targetPrefix}cc
|
2021-09-19 18:49:29 +01:00
|
|
|
AR=${stdenv.cc.bintools.targetPrefix}ar
|
2021-11-15 10:59:04 +00:00
|
|
|
# Allow makewhatis(8) to follow symlinks from a manpath to the nix store
|
|
|
|
READ_ALLOWED_PATH=${builtins.storeDir}
|
2021-09-19 19:42:54 +01:00
|
|
|
# Bypass the locale(1)-based check for UTF-8 support since it causes trouble:
|
|
|
|
# * We only have meaningful locale(1) implementations for glibc and macOS
|
|
|
|
# * NetBSD's locale(1) (used for macOS) depends on mandoc
|
|
|
|
# * Sandbox and locales cause all kinds of trouble
|
|
|
|
# * build and host libc (and thus locale handling) may differ
|
|
|
|
HAVE_WCHAR=1
|
|
|
|
UTF8_LOCALE=${utf8Locale}
|
2016-09-11 21:18:13 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
preConfigure = ''
|
2021-09-19 18:52:50 +01:00
|
|
|
printf '%s' "$configureLocal" > configure.local
|
2016-09-11 21:18:13 +01:00
|
|
|
'';
|
|
|
|
|
2022-01-23 13:44:08 +00:00
|
|
|
doCheck = true;
|
2021-09-19 18:53:16 +01:00
|
|
|
checkTarget = "regress";
|
|
|
|
checkInputs = [ perl ];
|
|
|
|
preCheck = "patchShebangs --build regress/regress.pl";
|
|
|
|
|
2021-09-24 19:54:08 +01:00
|
|
|
passthru.tests = {
|
|
|
|
nixos = nixosTests.man;
|
|
|
|
};
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2022-01-23 13:44:08 +00:00
|
|
|
# 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;
|
|
|
|
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://mandoc.bsd.lv/";
|
2016-09-11 21:18:13 +01:00
|
|
|
description = "suite of tools compiling mdoc and man";
|
2018-08-27 02:12:59 +01:00
|
|
|
downloadPage = "http://mandoc.bsd.lv/snapshots/";
|
2016-09-11 21:18:13 +01:00
|
|
|
license = licenses.bsd3;
|
|
|
|
platforms = platforms.all;
|
2021-09-19 18:52:38 +01:00
|
|
|
maintainers = with maintainers; [ bb010g ramkromberg sternenseemann ];
|
2016-09-11 21:18:13 +01:00
|
|
|
};
|
|
|
|
}
|