add piston nix pkg for mono-basic

This commit is contained in:
Dan Vargas 2022-03-21 09:44:08 -06:00
parent daeed0ce5e
commit 9fe9b4db48
9 changed files with 48 additions and 91 deletions

View File

@ -1,32 +0,0 @@
#!/bin/bash
PREFIX=$(realpath $(dirname $0))
mkdir -p build/mono build/mono-basic
cd build
curl "https://download.mono-project.com/sources/mono/mono-6.12.0.122.tar.xz" -o mono.tar.xz
curl -L "https://github.com/mono/mono-basic/archive/refs/tags/4.7.tar.gz" -o mono-basic.tar.gz
tar xf mono.tar.xz --strip-components=1 -C mono
tar xf mono-basic.tar.gz --strip-components=1 -C mono-basic
# Compiling Mono
cd mono
./configure --prefix "$PREFIX"
make -j$(nproc)
make install -j$(nproc)
export PATH="$PREFIX/bin:$PATH" # To be able to use mono commands
# Compiling mono-basic
cd ../mono-basic
./configure --prefix="$PREFIX"
make -j$(nproc) PLATFORM="linux" # Avoids conflict with the $PLATFORM variable we have
make install -j$(nproc) PLATFORM="linux"
# Remove redundant files
cd ../../
rm -rf build

View File

@ -1,16 +0,0 @@
#!/bin/bash
case "${PISTON_LANGUAGE}" in
csharp)
rename 's/$/\.cs/' "$@" # Add .cs extension
csc -out:out *.cs
;;
basic)
rename 's/$/\.vb/' "$@" # Add .vb extension
vbnc -out:out *.vb
;;
*)
echo "How did you get here? (${PISTON_LANGUAGE})"
exit 1
;;
esac

View File

@ -1 +0,0 @@
export PATH=$PWD/bin:$PATH

View File

@ -1,20 +0,0 @@
{
"language": "mono",
"version": "6.12.0",
"provides": [
{
"language": "csharp",
"aliases": ["mono", "mono-csharp", "mono-c#", "mono-cs", "c#", "cs"]
},
{
"language": "basic",
"aliases": [
"vb",
"mono-vb",
"mono-basic",
"visual-basic",
"visual basic"
]
}
]
}

View File

@ -1,4 +0,0 @@
#!/bin/bash
shift
mono out "$@"

View File

@ -1,9 +0,0 @@
using System;
public class Test
{
public static void Main(string[] args)
{
Console.WriteLine("OK");
}
}

View File

@ -1,9 +0,0 @@
Imports System
Module Module1
Sub Main()
Console.WriteLine("OK")
End Sub
End Module

View File

@ -62,4 +62,5 @@ args: {
"node-coffeescript" = import ./node-coffeescript.nix args; "node-coffeescript" = import ./node-coffeescript.nix args;
"jvm-scala" = import ./jvm-scala.nix args; "jvm-scala" = import ./jvm-scala.nix args;
"llvm_ir" = import ./llvm_ir.nix args; "llvm_ir" = import ./llvm_ir.nix args;
"mono-basic" = import ./mono-basic.nix args;
} }

47
runtimes/mono-basic.nix Normal file
View File

@ -0,0 +1,47 @@
{pkgs, piston, ...}:
let
pkg = pkgs.mono;
in piston.mkRuntime {
language = "basic";
version = pkg.version;
runtime = "mono";
aliases = [
"vb"
"mono-vb"
"mono-basic"
"visual-basic"
];
compile = ''
rename 's/$/\.vb/' "$@" # Add .vb extension
${pkg}/bin/vbc -out:out -sdkpath:${pkg}/lib/mono/4.8-api *.vb
'';
run = ''
shift
${pkg}/bin/mono out.exe "$@"
'';
tests = [
(piston.mkTest {
files = {
"test.vb" = ''
Imports System
Module Module1
Sub Main()
Console.WriteLine("OK")
End Sub
End Module
'';
};
args = [];
stdin = "";
packages = [];
main = "test.vb";
})
];
}