boot/gui: review simulator build
Can be launched with `DEBUGGER="gdb --args" ./result/bin/simulator`.
@@ -26,8 +26,9 @@ stdenv.mkDerivation {
buildPhase = ''
(PS4=" $ "; set -x
- mrbc -o gui.mrb \
- lib/*.rb main.rb
+ mrbc -g -o gui.mrb \
+ $(find lib -type f -name '*.rb' | sort) \
+ main.rb
)
'';
installPhase = ''
@@ -39,7 +40,16 @@ stdenv.mkDerivation {
mkdir -p $out/bin
cat > $out/bin/simulator <<EOF
#!/bin/sh
- ${loader}/bin/loader $out/libexec/gui.mrb "\$@"
+ args=()
+ if [[ -n "\$DEBUGGER" ]]; then
+ args+=(\$DEBUGGER)
+ fi
+ args+=(
+ ${loader}/bin/loader
+ $out/libexec/gui.mrb
+ "\$@"
+ )
+ exec "\''${args[@]}"
EOF
chmod +x $out/bin/simulator
)
