From 88f2b5bed45e8b36475cb4108b62d4e1e549810a Mon Sep 17 00:00:00 2001 From: Omar Brikaa Date: Fri, 25 Feb 2022 14:51:26 +0200 Subject: [PATCH] Added Pascal --- packages/pascal/3.2.0/build.sh | 25 ---------------- packages/pascal/3.2.0/compile | 5 ---- packages/pascal/3.2.0/environment | 1 - packages/pascal/3.2.0/metadata.json | 5 ---- packages/pascal/3.2.0/run | 4 --- packages/pascal/3.2.0/test.pp | 5 ---- runtimes/default.nix | 1 + runtimes/fpc-pascal.nix | 44 +++++++++++++++++++++++++++++ 8 files changed, 45 insertions(+), 45 deletions(-) delete mode 100755 packages/pascal/3.2.0/build.sh delete mode 100644 packages/pascal/3.2.0/compile delete mode 100644 packages/pascal/3.2.0/environment delete mode 100644 packages/pascal/3.2.0/metadata.json delete mode 100644 packages/pascal/3.2.0/run delete mode 100644 packages/pascal/3.2.0/test.pp create mode 100644 runtimes/fpc-pascal.nix diff --git a/packages/pascal/3.2.0/build.sh b/packages/pascal/3.2.0/build.sh deleted file mode 100755 index 0d1a3b8..0000000 --- a/packages/pascal/3.2.0/build.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -PREFIX=$(realpath $(dirname $0)) - -mkdir -p build - -cd build -curl -L "https://sourceforge.net/projects/freepascal/files/Linux/3.2.0/fpc-3.2.0-x86_64-linux.tar/download" -o pascal.tar -tar xf pascal.tar --strip-components=1 - -# FreePascal uses an interactive installer -./install.sh << ANSWERS -$PREFIX -n -n -n -ANSWERS - -cd .. -rm -rf build - -# A sample config (needed for each "project") is written to /etc -# We'll copy that into the local lib dir (fpc searches there too on compile) -mkdir lib/fpc/etc -cp -r /etc/fp* lib/fpc/etc/ diff --git a/packages/pascal/3.2.0/compile b/packages/pascal/3.2.0/compile deleted file mode 100644 index 93855b7..0000000 --- a/packages/pascal/3.2.0/compile +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -# Compile pascal files -fpc -oout -v0 "$@" -chmod +x out diff --git a/packages/pascal/3.2.0/environment b/packages/pascal/3.2.0/environment deleted file mode 100644 index bd0ff98..0000000 --- a/packages/pascal/3.2.0/environment +++ /dev/null @@ -1 +0,0 @@ -export PATH=$PWD/bin:$PATH \ No newline at end of file diff --git a/packages/pascal/3.2.0/metadata.json b/packages/pascal/3.2.0/metadata.json deleted file mode 100644 index daaca4f..0000000 --- a/packages/pascal/3.2.0/metadata.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "language": "pascal", - "version": "3.2.0", - "aliases": ["pascal", "freepascal", "pp", "pas"] -} diff --git a/packages/pascal/3.2.0/run b/packages/pascal/3.2.0/run deleted file mode 100644 index 6955ba9..0000000 --- a/packages/pascal/3.2.0/run +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -shift # Filename is only used to compile -./out "$@" diff --git a/packages/pascal/3.2.0/test.pp b/packages/pascal/3.2.0/test.pp deleted file mode 100644 index 3c5165d..0000000 --- a/packages/pascal/3.2.0/test.pp +++ /dev/null @@ -1,5 +0,0 @@ -program test; - - begin - writeln('OK'); - end. \ No newline at end of file diff --git a/runtimes/default.nix b/runtimes/default.nix index 286c4e1..b2cf206 100644 --- a/runtimes/default.nix +++ b/runtimes/default.nix @@ -57,4 +57,5 @@ args: { "dotnet-sdk-fsharp" = import ./dotnet-sdk-fsharp.nix args; "dotnet-sdk-fsharp-interactive" = import ./dotnet-sdk-fsharp-interactive.nix args; "dotnet-sdk-visual-basic" = import ./dotnet-sdk-visual-basic.nix args; + "fpc-pascal" = import ./fpc-pascal.nix args; } diff --git a/runtimes/fpc-pascal.nix b/runtimes/fpc-pascal.nix new file mode 100644 index 0000000..46609f7 --- /dev/null +++ b/runtimes/fpc-pascal.nix @@ -0,0 +1,44 @@ +{pkgs, piston, ...}: +let + binutilsPkg = pkgs.binutils; + pkg = pkgs.fpc; +in piston.mkRuntime { + language = "pascal"; + version = pkg.version; + + runtime = "fpc"; + + aliases = [ + "freepascal" + "pp" + "pas" + ]; + + compile = '' + export PATH="${binutilsPkg}/bin:$PATH" + ${pkg}/bin/fpc -oout -v0 "$@" + chmod +x out + ''; + + run = '' + shift + ./out "$@" + ''; + + tests = [ + (piston.mkTest { + files = { + "test.pp" = '' + program test; + begin + writeln(paramStr(1)); + end. + ''; + }; + args = ["OK"]; + stdin = ""; + packages = []; + main = "test.pp"; + }) + ]; +}