mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 21:50:55 +00:00
asciidoctor: move mathematical gem config to default gemset config
This has two benefits: - Anyone else using the `mathematical` gem will benefit from the config. - The gem config overrides the default one, so we were losing the fixes for other gems. I had to change how the update script works. Now it looks at the `gems` passthru from `bundlerApp`.
This commit is contained in:
parent
73392e79aa
commit
5f0c43dea4
|
@ -24,6 +24,7 @@
|
|||
, msgpack, qt59, libsodium, snappy, libossp_uuid, lxc, libpcap, xorg, gtk2, buildRubyGem
|
||||
, cairo, re2, rake, gobject-introspection, gdk_pixbuf, zeromq, czmq, graphicsmagick, libcxx
|
||||
, file, libvirt, glib, vips, taglib, libopus, linux-pam, libidn, protobuf, fribidi, harfbuzz
|
||||
, bison, flex, pango, python3, patchelf
|
||||
, libselinux ? null, libsepol ? null
|
||||
}@args:
|
||||
|
||||
|
@ -245,6 +246,32 @@ in
|
|||
];
|
||||
};
|
||||
|
||||
mathematical = attrs: {
|
||||
buildInputs = [
|
||||
cmake
|
||||
bison
|
||||
flex
|
||||
glib
|
||||
pkgconfig
|
||||
cairo
|
||||
pango
|
||||
gdk_pixbuf
|
||||
libxml2
|
||||
python3
|
||||
];
|
||||
|
||||
# The ruby build script takes care of this
|
||||
dontUseCmakeConfigure = true;
|
||||
|
||||
# For some reason 'mathematical.so' is missing cairo and glib in its RPATH, add them explicitly here
|
||||
postFixup = lib.optionalString stdenv.isLinux ''
|
||||
soPath="$out/${ruby.gemPath}/gems/mathematical-${attrs.version}/lib/mathematical/mathematical.so"
|
||||
${patchelf}/bin/patchelf \
|
||||
--set-rpath "${lib.makeLibraryPath [ glib cairo ]}:$(${patchelf}/bin/patchelf --print-rpath "$soPath")" \
|
||||
"$soPath"
|
||||
'';
|
||||
};
|
||||
|
||||
magic = attrs: {
|
||||
buildInputs = [ file ];
|
||||
postInstall = ''
|
||||
|
|
|
@ -1,59 +1,27 @@
|
|||
{ stdenv, lib, bundlerApp, ruby, bundix, mkShell
|
||||
# Dependencies of the 'mathematical' package
|
||||
, cmake, bison, flex, glib, pkgconfig, cairo
|
||||
, pango, gdk_pixbuf, libxml2, python3, patchelf
|
||||
}:
|
||||
{ lib, bundlerApp, mkShell, bundix, defaultGemConfig }:
|
||||
|
||||
bundlerApp rec {
|
||||
inherit ruby;
|
||||
pname = "asciidoctor";
|
||||
gemdir = ./.;
|
||||
let app = bundlerApp {
|
||||
pname = "asciidoctor";
|
||||
gemdir = ./.;
|
||||
|
||||
exes = [
|
||||
"asciidoctor"
|
||||
"asciidoctor-pdf"
|
||||
"asciidoctor-safe"
|
||||
];
|
||||
exes = [
|
||||
"asciidoctor"
|
||||
"asciidoctor-pdf"
|
||||
"asciidoctor-safe"
|
||||
];
|
||||
|
||||
gemConfig = {
|
||||
mathematical = attrs: {
|
||||
buildInputs = [
|
||||
cmake
|
||||
bison
|
||||
flex
|
||||
glib
|
||||
pkgconfig
|
||||
cairo
|
||||
pango
|
||||
gdk_pixbuf
|
||||
libxml2
|
||||
python3
|
||||
];
|
||||
|
||||
# The ruby build script takes care of this
|
||||
dontUseCmakeConfigure = true;
|
||||
|
||||
# For some reason 'mathematical.so' is missing cairo and glib in its RPATH, add them explicitly here
|
||||
postFixup = lib.optionalString stdenv.isLinux ''
|
||||
soPath="$out/${ruby.gemPath}/gems/mathematical-${attrs.version}/lib/mathematical/mathematical.so"
|
||||
${patchelf}/bin/patchelf \
|
||||
--set-rpath "${lib.makeLibraryPath [ glib cairo ]}:$(${patchelf}/bin/patchelf --print-rpath "$soPath")" \
|
||||
"$soPath"
|
||||
'';
|
||||
meta = with lib; {
|
||||
description = "A faster Asciidoc processor written in Ruby";
|
||||
homepage = https://asciidoctor.org/;
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ gpyh ];
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
};
|
||||
|
||||
passthru.updateShell = mkShell {
|
||||
buildInputs = (gemConfig.mathematical {}).buildInputs ++ [
|
||||
bundix
|
||||
];
|
||||
shell = mkShell {
|
||||
buildInputs =
|
||||
app.gems.mathematical.buildInputs ++
|
||||
[ bundix ];
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "A faster Asciidoc processor written in Ruby";
|
||||
homepage = https://asciidoctor.org/;
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ gpyh ];
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
}
|
||||
in app.overrideAttrs (attrs: { passthru = attrs.passthru // { updateShell = shell; }; })
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
rm gemset.nix Gemfile.lock
|
||||
nix-shell ../../../.. -A asciidoctor.updateShell --run '
|
||||
rm gemset.nix Gemfile.lock
|
||||
bundix -m --bundle-pack-path $TMPDIR/asciidoctor-ruby-bundle
|
||||
rm -r .bundle
|
||||
'
|
||||
rm -r .bundle
|
||||
|
|
Loading…
Reference in a new issue