1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-13 04:04:35 +03:00

mruby-builder: Manage -g flag for mrbc

This commit is contained in:
Samuel Dionne-Riel 2020-12-31 20:47:42 -05:00
parent ac315d791f
commit f3b51bfafd

View File

@ -17,6 +17,7 @@ in
, fetchFromGitHub
, file
, mruby
, runtimeShell
, writeText
, writeShellScriptBin
@ -31,6 +32,8 @@ in
, additionalBuildConfig ? ""
# Adds `enable_debug`.
, debug ? false
# Adds `-g` to mrbc wrapper.
, mrbWithDebug ? true
# Prepends defaults to `gems` and `gemBoxes`.
, useDefaults ? true
}:
@ -210,6 +213,20 @@ stdenv.mkDerivation rec {
cp mruby_linker_flags.sh $out/nix-support/
'';
# Wrap `mrbc` with -g conditional to the debug flag.
postInstall = ''
mkdir -p $out/libexec/
mv $out/bin/mrbc $out/libexec/mrbc
cat > $out/bin/mrbc <<EOF
#!${runtimeShell}
exec $out/libexec/mrbc ${optionalString mrbWithDebug "-g"} "\''${@}"
EOF
'';
passthru = {
inherit debug;
};
meta = with stdenv.lib; {
description = "An embeddable implementation of the Ruby language";
homepage = https://mruby.org;