forked from mirrors/nixpkgs
Merge pull request #155492 from veehaitch/discount-r13y
(r)discount: use deterministic mangling
This commit is contained in:
commit
87875829d4
|
@ -26,7 +26,7 @@
|
|||
, file, libvirt, glib, vips, taglib, libopus, linux-pam, libidn, protobuf, fribidi, harfbuzz
|
||||
, bison, flex, pango, python3, patchelf, binutils, freetds, wrapGAppsHook, atk
|
||||
, bundler, libsass, libexif, libselinux, libsepol, shared-mime-info, libthai, libdatrie
|
||||
, CoreServices, DarwinTools, cctools, libtool
|
||||
, CoreServices, DarwinTools, cctools, libtool, discount
|
||||
}@args:
|
||||
|
||||
let
|
||||
|
@ -135,6 +135,17 @@ in
|
|||
hardeningDisable = [ "format" ];
|
||||
};
|
||||
|
||||
rdiscount = attrs: {
|
||||
# Use discount from nixpkgs instead of vendored version
|
||||
dontBuild = false;
|
||||
buildInputs = [ discount ];
|
||||
patches = [
|
||||
# Adapted from Debian:
|
||||
# https://sources.debian.org/data/main/r/ruby-rdiscount/2.1.8-1/debian/patches/01_use-system-libmarkdown.patch
|
||||
./rdiscount-use-nixpkgs-libmarkdown.patch
|
||||
];
|
||||
};
|
||||
|
||||
ethon = attrs: {
|
||||
dontBuild = false;
|
||||
postPatch = ''
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
diff --git a/ext/extconf.rb b/ext/extconf.rb
|
||||
index 30764cb..b87ac2b 100644
|
||||
--- a/ext/extconf.rb
|
||||
+++ b/ext/extconf.rb
|
||||
@@ -46,4 +46,9 @@ if /mswin/.match RbConfig::CONFIG['host_os']
|
||||
$defs.push("-Dinline=__inline")
|
||||
end
|
||||
|
||||
+$srcs = %w[
|
||||
+ rdiscount.c
|
||||
+]
|
||||
+have_library('markdown')
|
||||
+
|
||||
create_makefile('rdiscount')
|
|
@ -1,4 +1,4 @@
|
|||
{ stdenv, lib, bundlerEnv, bundlerUpdateScript, makeWrapper, groff }:
|
||||
{ stdenv, lib, bundlerEnv, bundlerUpdateScript, makeWrapper, groff, callPackage }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "ronn";
|
||||
|
@ -21,6 +21,8 @@ stdenv.mkDerivation rec {
|
|||
|
||||
passthru.updateScript = bundlerUpdateScript "ronn";
|
||||
|
||||
passthru.tests.reproducible-html-manpage = callPackage ./test-reproducible-html.nix { };
|
||||
|
||||
meta = with lib; {
|
||||
description = "markdown-based tool for building manpages";
|
||||
homepage = "https://rtomayko.github.io/ronn/";
|
||||
|
|
30
pkgs/development/tools/ronn/test-reproducible-html.nix
Normal file
30
pkgs/development/tools/ronn/test-reproducible-html.nix
Normal file
|
@ -0,0 +1,30 @@
|
|||
{ runCommand
|
||||
, diffutils
|
||||
, ronn
|
||||
}:
|
||||
runCommand "ronn-test-reproducible-html" { } ''
|
||||
set -euo pipefail
|
||||
|
||||
cat > aprog.1.ronn << EOF
|
||||
aprog
|
||||
=====
|
||||
|
||||
## AUTHORS
|
||||
|
||||
Vincent Haupert <veehaitch@users.noreply.github.com>
|
||||
EOF
|
||||
|
||||
# We have to repeat the manpage generation a few times to be confident
|
||||
# it is in fact reproducible.
|
||||
for i in {1..20}; do
|
||||
${ronn}/bin/ronn --html --pipe aprog.1.ronn > aprog.1.html-1
|
||||
${ronn}/bin/ronn --html --pipe aprog.1.ronn > aprog.1.html-2
|
||||
|
||||
${diffutils}/bin/diff -q aprog.1.html-1 aprog.1.html-2 \
|
||||
|| (printf 'The HTML manpage is not reproducible (round %d)' "$i" && exit 1)
|
||||
done
|
||||
|
||||
echo 'The HTML manpage appears reproducible'
|
||||
|
||||
mkdir $out
|
||||
''
|
|
@ -26,11 +26,17 @@ stdenv.mkDerivation rec {
|
|||
"--pkg-config"
|
||||
"--shared"
|
||||
"--with-fenced-code"
|
||||
# Use deterministic mangling
|
||||
"--debian-glitch"
|
||||
];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
doCheck = true;
|
||||
|
||||
postFixup = lib.optionalString stdenv.isDarwin ''
|
||||
install_name_tool -id $out/lib/libmarkdown.dylib $out/lib/libmarkdown.dylib
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "Implementation of Markdown markup language in C";
|
||||
homepage = "http://www.pell.portland.or.us/~orc/Code/discount/";
|
||||
|
|
Loading…
Reference in a new issue