From 5895b5f3e4c74631b103e6083dddbbe3490a8555 Mon Sep 17 00:00:00 2001 From: Radon Rosborough Date: Sun, 10 Jan 2021 15:52:23 -0800 Subject: [PATCH] Everything through MongoDB --- docker/admin/install.bash | 1 + docker/packaging/install.bash | 34 +++++++++--- docker/runtime/install.bash | 19 ++++++- langs/apl.yaml | 3 +- langs/chef.yaml | 3 +- langs/clean.yaml | 18 +++++++ langs/clojure.yaml | 6 +++ langs/cmd.yaml | 11 +++- langs/coffeescript.yaml | 2 +- langs/curry.yaml | 4 +- langs/d.yaml | 14 +++++ langs/dhall.yaml | 8 +++ langs/dylan.yaml | 32 ++++++++++- langs/ec.yaml | 8 ++- langs/elixir.yaml | 9 ++++ langs/elm.yaml | 15 ++++++ langs/emojicode.yaml | 17 ++++++ langs/entropy.yaml | 9 ++++ langs/erlang.yaml | 19 ++++++- langs/euphoria.yaml | 9 ++++ langs/factor.yaml | 10 ++++ langs/false.yaml | 10 ++++ langs/fortran.yaml | 12 ++--- langs/gnuplot.yaml | 2 +- langs/go.yaml | 10 ++++ langs/golfscript.yaml | 10 ++++ langs/grass.yaml | 10 ++++ langs/haskell.yaml | 26 +++++++-- langs/haxe.yaml | 1 + langs/hcl.yaml | 4 ++ langs/hexagony.yaml | 10 +++- langs/hmmm.yaml | 8 +++ langs/idris.yaml | 11 ++++ langs/ink.yaml | 13 +++++ langs/ioke.yaml | 11 ++++ langs/j.yaml | 6 +++ langs/java.yaml | 5 ++ langs/jsf.yaml | 4 ++ langs/julia.yaml | 10 +++- langs/kalyn.yaml | 15 ++++++ langs/kitten.yaml | 16 ++++++ langs/kotlin.yaml | 19 +++++++ langs/lazyk.yaml | 13 +++++ langs/limbo.yaml | 21 ++++++-- langs/lolcode.yaml | 6 +++ langs/lua.yaml | 8 ++- langs/make.yaml | 4 ++ langs/malbolge.yaml | 10 ++++ langs/mariadb.yaml | 23 ++++++-- langs/mongodb.yaml | 23 +++++++- langs/python.yaml | 4 +- shared/sqls.yaml | 9 ++++ shared/yj.yaml | 10 ++++ tools/config.js | 6 +-- tools/generate-build-script.js | 98 +++++++++++++++++++++++++++++----- 55 files changed, 641 insertions(+), 58 deletions(-) create mode 100644 shared/sqls.yaml create mode 100644 shared/yj.yaml diff --git a/docker/admin/install.bash b/docker/admin/install.bash index e27311a..38a3a00 100755 --- a/docker/admin/install.bash +++ b/docker/admin/install.bash @@ -30,6 +30,7 @@ EOF packages=" +apt-file docker-ce-cli g++ git diff --git a/docker/packaging/install.bash b/docker/packaging/install.bash index f4130f2..8a4383c 100755 --- a/docker/packaging/install.bash +++ b/docker/packaging/install.bash @@ -2,15 +2,26 @@ set -euxo pipefail +mkdir /tmp/riju-work +pushd /tmp/riju-work + export DEBIAN_FRONTEND=noninteractive +dpkg --add-architecture i386 + apt-get update (yes || true) | unminimize -apt-get install -y curl gnupg lsb-release +apt-get install -y curl gnupg lsb-release wget -curl -sSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - -curl -sSL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - +wget https://cacerts.digicert.com/DigiCertTLSRSASHA2562020CA1.crt.pem -O /usr/local/share/ca-certificates/DigiCertTLSRSASHA2562020CA1.crt +wget https://letsencrypt.org/certs/lets-encrypt-r3.pem -O /usr/local/share/ca-certificates/lets-encrypt-r3.crt + +update-ca-certificates + +curl -fsSL https://downloads.ceylon-lang.org/apt/ceylon-debian-repo.gpg.key | apt-key add - +curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - +curl -fsSL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - ubuntu_ver="$(lsb_release -rs)" ubuntu_name="$(lsb_release -cs)" @@ -18,26 +29,31 @@ ubuntu_name="$(lsb_release -cs)" node_repo="$(curl -sS https://deb.nodesource.com/setup_current.x | grep NODEREPO= | grep -Eo 'node_[0-9]+\.x' | head -n1)" tee -a /etc/apt/sources.list.d/custom.list >/dev/null </dev/null <<"EOF" %sudo ALL=(ALL:ALL) NOPASSWD: ALL EOF +popd +rm -rf /tmp/riju-work + rm "$0" diff --git a/docker/runtime/install.bash b/docker/runtime/install.bash index e016443..bc92397 100755 --- a/docker/runtime/install.bash +++ b/docker/runtime/install.bash @@ -15,7 +15,15 @@ dpkg --add-architecture i386 apt-get update (yes || true) | unminimize -apt-get install -y curl gnupg lsb-release +apt-get install -y curl gnupg lsb-release wget + +# Ceylon +wget https://cacerts.digicert.com/DigiCertTLSRSASHA2562020CA1.crt.pem -O /usr/local/share/ca-certificates/DigiCertTLSRSASHA2562020CA1.crt + +# D +wget https://letsencrypt.org/certs/lets-encrypt-r3.pem -O /usr/local/share/ca-certificates/lets-encrypt-r3.crt + +update-ca-certificates # Ceylon curl -fsSL https://downloads.ceylon-lang.org/apt/ceylon-debian-repo.gpg.key | apt-key add - @@ -29,6 +37,9 @@ curl -fsSL https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - # Hack apt-key adv --keyserver keyserver.ubuntu.com --recv-keys B4112585D386EB94 +# MongoDB +curl -fsSL https://www.mongodb.org/static/pgp/server-4.4.asc | apt-key add - + # Node.js curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - @@ -57,6 +68,9 @@ deb [arch=amd64] https://storage.googleapis.com/download.dartlang.org/linux/debi # Hack deb [arch=amd64] https://dl.hhvm.com/ubuntu ${ubuntu_name} main +# MongoDB +deb [arch=amd64] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse + # Node.js deb [arch=amd64] https://deb.nodesource.com/${node_repo} ${ubuntu_name} main @@ -74,6 +88,7 @@ libicu="$(grep-aptavail -wF Package 'libicu[0-9]+' -s Package -n | head -n1)" packages=" +apt-file less clang jq @@ -81,10 +96,10 @@ ${libicu} make man nodejs +strace sudo tmux vim -wget yarn " diff --git a/langs/apl.yaml b/langs/apl.yaml index 5a8a315..b03464b 100644 --- a/langs/apl.yaml +++ b/langs/apl.yaml @@ -28,7 +28,8 @@ install: apt: - libtinfo5 manual: | - wget "ftp://ftp.gnu.org/gnu/apl/$(curl -sS ftp://ftp.gnu.org/gnu/apl/ | grep -Eo 'apl_[-0-9.]+_amd64.deb$' | sort -rV | head -n1)" -O apl.deb + path="$(curl -sS ftp://ftp.gnu.org/gnu/apl/ | grep -Eo 'apl_[-0-9.]+_amd64.deb$' | sort -rV | head -n1)" + wget "ftp://ftp.gnu.org/gnu/apl/${path}" -O apl.deb deb: - apl.deb diff --git a/langs/chef.yaml b/langs/chef.yaml index 4d0acdc..c24faee 100644 --- a/langs/chef.yaml +++ b/langs/chef.yaml @@ -21,7 +21,8 @@ info: usage: [] install: - cpan: Acme::Chef + cpan: + - Acme::Chef main: "main.chef" template: | diff --git a/langs/clean.yaml b/langs/clean.yaml index 936c588..8980afc 100644 --- a/langs/clean.yaml +++ b/langs/clean.yaml @@ -26,6 +26,24 @@ info: - functional usage: [] +install: + apt: + - gcc + manual: | + install -d "${pkg}/opt/clean" + install -d "${pkg}/usr/local/bin" + + url="$(curl -fsSL https://clean.cs.ru.nl/Download_Clean | grep linux/clean | grep -F 64.tar.gz | grep -Eo "https://[^>]+\.tar\.gz")" + wget "${url}" + tar -xf clean*_64.tar.gz -C "${pkg}/opt/clean" --strip-components=1 + pushd "${pkg}/opt/clean" + make + popd + ln -s /opt/clean/bin/clm "${pkg}/usr/local/bin/" + + sleep 2 + find "${pkg}/opt/clean" -name '*.o' -exec touch '{}' ';' + main: "main.icl" template: | module main diff --git a/langs/clojure.yaml b/langs/clojure.yaml index 00eed28..670691c 100644 --- a/langs/clojure.yaml +++ b/langs/clojure.yaml @@ -33,6 +33,12 @@ info: install: apt: - clojure + manual: | + install -d "${pkg}/usr/local/bin" + ver="$(latest_release snoe/clojure-lsp)" + wget "https://github.com/snoe/clojure-lsp/releases/download/${ver}/clojure-lsp" + chmod +x clojure-lsp + mv clojure-lsp "${pkg}/usr/local/bin/" repl: | clojure diff --git a/langs/cmd.yaml b/langs/cmd.yaml index df1dd8d..f8955ab 100644 --- a/langs/cmd.yaml +++ b/langs/cmd.yaml @@ -23,12 +23,21 @@ info: usage: [] install: + prepare: + apt: + - wine + - wine32 apt: - wine - wine32 + manual: | + install -d "${pkg}/opt/cmd/skel" + wine cmd < /dev/null + cp -R "$HOME/.wine" "${pkg}/opt/cmd/skel/" + chmod -R a=u,go-w "${pkg}/opt/cmd/skel" setup: | - shopt -s dotglob; cp -R /opt/cmd/home-template/* ./ + shopt -s dotglob; cp -R /opt/cmd/skel/* ./ repl: | wine cmd diff --git a/langs/coffeescript.yaml b/langs/coffeescript.yaml index 2092bfc..2390883 100644 --- a/langs/coffeescript.yaml +++ b/langs/coffeescript.yaml @@ -46,7 +46,7 @@ compile: | run: | node -e ' eval.apply(this, [require("fs").readFileSync("main.js", {encoding: "utf-8"})]) - require("/usr/lib/node_modules/coffeescript/repl").start() + require("/opt/coffeescript/lib/node_modules/coffeescript/repl").start() ' scope: diff --git a/langs/curry.yaml b/langs/curry.yaml index c1b01dc..5e83de6 100644 --- a/langs/curry.yaml +++ b/langs/curry.yaml @@ -9,7 +9,7 @@ install: - pakcs repl: | - pakcs + SWIPL=swipl pakcs main: "main.curry" template: | @@ -17,7 +17,7 @@ template: | main = putStrLn "Hello, world!" run: | - pakcs :load main.curry :eval main + SWIPL=swipl pakcs :load main.curry :eval main scope: code: | diff --git a/langs/d.yaml b/langs/d.yaml index e65b7ef..d24ddc8 100644 --- a/langs/d.yaml +++ b/langs/d.yaml @@ -3,6 +3,20 @@ aliases: - "dmd" name: "D" +install: + prepare: + manual: | + file="$(curl -fsSL https://dlang.org/download.html | grep -Eo '"http://[^"]+amd64.deb"' | grep -v pre-release | tr -d '"')" + wget "${file}" -O dmd.deb + sudo apt-get install -y ./dmd.deb + manual: | + install -d "${pkg}/usr/local/bin" + dub fetch dfmt@~master + dub run dfmt -- --version + cp "$HOME/.dub/packages/dfmt-master/dfmt/bin/dfmt" "${pkg}/usr/local/bin/" + deb: + - dmd.deb + main: "main.d" template: | import std.stdio; diff --git a/langs/dhall.yaml b/langs/dhall.yaml index a55eecd..a2af119 100644 --- a/langs/dhall.yaml +++ b/langs/dhall.yaml @@ -4,6 +4,14 @@ name: "Dhall" install: apt: - dhall + manual: | + install -d "${pkg}/usr/local/bin" + ver="$(latest_release dhall-lang/dhall-haskell)" + file="$(curl -sSL "https://api.github.com/repos/dhall-lang/dhall-haskell/releases/tags/${ver}" | jq -r '.assets | map(select(.name | (contains("dhall-json") and contains("x86_64-linux.tar.bz2")))) | .[0].name')" + wget "https://github.com/dhall-lang/dhall-haskell/releases/download/${ver}/${file}" + mkdir dhall-json + tar -xf dhall-json-*-x86_64-linux.tar.bz2 -C dhall-json + cp dhall-json/bin/dhall-to-json dhall-json/bin/json-to-dhall "${pkg}/usr/local/bin/" main: "main.dhall" template: | diff --git a/langs/dylan.yaml b/langs/dylan.yaml index 4812e9b..858fed7 100644 --- a/langs/dylan.yaml +++ b/langs/dylan.yaml @@ -6,9 +6,39 @@ name: "Dylan" install: apt: - libunwind-dev + manual: | + install -d "${pkg}/opt/dylan" + install -d "${pkg}/usr/local/bin" + + ver="$(latest_release dylan-lang/opendylan)" + wget "https://github.com/dylan-lang/opendylan/releases/download/${ver}/opendylan-$(grep -Eo '[0-9]+\.[0-9]+' <<< "$ver")-x86_64-linux.tar.bz2" -O opendylan.tar.bz2 + tar -xf opendylan.tar.bz2 -C "${pkg}/opt/dylan" --strip-components=1 + ln -s /opt/dylan/bin/dylan-compiler /opt/dylan/bin/make-dylan-app "${pkg}/usr/local/bin/" + + export PATH="${pkg}/opt/dylan/bin:$PATH" + + pushd "${pkg}/opt/dylan" + make-dylan-app main + mv main skel + pushd skel + cat <<"EOF" > main.dylan + Module: main + + define function main + (name :: , arguments :: ) + format-out("Hello, world!\n"); + exit-application(0); + end function main; + + main(application-name(), application-arguments()); + EOF + dylan-compiler -build main.lid + rm main.dylan + popd + popd setup: | - cp -R /opt/dylan/project-template/* ./ + cp -R /opt/dylan/skel/* ./ main: "main.dylan" template: | diff --git a/langs/ec.yaml b/langs/ec.yaml index 27c7487..46a8e54 100644 --- a/langs/ec.yaml +++ b/langs/ec.yaml @@ -7,8 +7,12 @@ aliases: name: "eC" install: - apt: - - ecere-dev + manual: | + ver="$(latest_release ecere/ecere-sdk)" + git clone https://github.com/ecere/ecere-sdk.git -b "${ver}" + pushd ecere-sdk + make + popd main: "main.ec" template: | diff --git a/langs/elixir.yaml b/langs/elixir.yaml index 1d5b1d0..cce2dd6 100644 --- a/langs/elixir.yaml +++ b/langs/elixir.yaml @@ -7,6 +7,15 @@ name: "Elixir" install: apt: - elixir + - erlang-edoc + manual: | + install -d "${pkg}/opt/elixir-ls" + install -d "${pkg}/usr/local/bin" + + ver="$(latest_release elixir-lsp/elixir-ls)" + wget "https://github.com/elixir-lsp/elixir-ls/releases/download/${ver}/elixir-ls.zip" + unzip -d "${pkg}/opt/elixir-ls" elixir-ls.zip + ln -s /opt/elixir-ls/language_server.sh "${pkg}/usr/local/bin/elixir-ls" repl: | iex diff --git a/langs/elm.yaml b/langs/elm.yaml index 82ce638..736dc21 100644 --- a/langs/elm.yaml +++ b/langs/elm.yaml @@ -5,6 +5,21 @@ install: npm: - "@kachkaev/run-elm" - "@elm-tooling/elm-language-server" + manual: | + install -d "${pkg}/opt/elm" + install -d "${pkg}/usr/local/bin" + + ver="$(latest_release elm/compiler)" + wget "https://github.com/elm/compiler/releases/download/${ver}/binary-for-linux-64-bit.gz" + gunzip binary-for-linux-64-bit.gz + chmod +x binary-for-linux-64-bit + cp binary-for-linux-64-bit "${pkg}/usr/local/bin/elm" + + mkdir elm-project + pushd elm-project + (yes || true) | "${pkg}/usr/local/bin/elm" init + cat elm.json | jq '."source-directories" = ["."]' > "${pkg}/opt/elm/elm".json + popd repl: | elm repl diff --git a/langs/emojicode.yaml b/langs/emojicode.yaml index 04e4db8..311940c 100644 --- a/langs/emojicode.yaml +++ b/langs/emojicode.yaml @@ -5,6 +5,23 @@ aliases: - "emojicodec" name: "Emojicode" +install: + apt: + - libtinfo5 + manual: | + install -d "${pkg}/usr/local/bin" + install -d "${pkg}/usr/local/include/emojicode" + install -d "${pkg}/usr/local/EmojicodePackages" + + ver="$(latest_release emojicode/emojicode)" + wget "https://github.com/emojicode/emojicode/releases/download/${ver}/Emojicode-$(sed 's/^v//' <<< "$ver")-Linux-x86_64.tar.gz" + tar -xf Emojicode-*-Linux-x86_64.tar.gz + pushd Emojicode-*-Linux-x86_64 + cp emojicodec "${pkg}/usr/local/bin/" + cp -R include/* "${pkg}/usr/local/include/emojicode/" + cp -R packages/* "${pkg}/usr/local/EmojicodePackages/" + popd + main: "main.emojic" template: | 🏁 🍇 diff --git a/langs/entropy.yaml b/langs/entropy.yaml index 020610d..63a8029 100644 --- a/langs/entropy.yaml +++ b/langs/entropy.yaml @@ -5,6 +5,15 @@ aliases: - "vge" name: "Entropy" +install: + apt: + - mono-runtime + manual: | + install -d "${pkg}/opt/entropy" + + wget http://danieltemkin.com/Content/Entropy/Entropy.zip + unzip -d "${pkg}/opt/entropy" Entropy.zip + main: "main.vge" template: | Program MyNamespace MyProgram [ diff --git a/langs/erlang.yaml b/langs/erlang.yaml index b8fc215..4709328 100644 --- a/langs/erlang.yaml +++ b/langs/erlang.yaml @@ -4,10 +4,25 @@ aliases: name: "Erlang" install: + prepare: + apt: + - erlang-nox + - erlang-dev apt: - - erlang + - erlang-nox - libodbc1 # workaround bug in APT - - rebar + manual: | + install -d "${pkg}/usr/local/bin" + + wget https://s3.amazonaws.com/rebar3/rebar3 + chmod +x rebar3 + export PATH="$PWD:$PATH" + + git clone https://github.com/erlang-ls/erlang_ls.git + pushd erlang_ls + make + cp _build/default/bin/erlang_ls "${pkg}/usr/local/bin/erlang_ls" + popd repl: | erl diff --git a/langs/euphoria.yaml b/langs/euphoria.yaml index f758ace..bfd7506 100644 --- a/langs/euphoria.yaml +++ b/langs/euphoria.yaml @@ -8,6 +8,15 @@ aliases: - "eub" name: "Euphoria" +install: + manual: | + install -d "${pkg}/opt/euphoria" + install -d "${pkg}/usr/local/bin" + + wget http://www.rapideuphoria.com/31/euphor31.tar + tar -xf euphor*.tar -C "${pkg}/opt/euphoria" --strip-components=1 + ln -s /opt/euphoria/bin/exu "${pkg}/usr/local/bin/" + main: "main.exu" template: | puts(1, "Hello, world!\n") diff --git a/langs/factor.yaml b/langs/factor.yaml index 1961bc8..594b13b 100644 --- a/langs/factor.yaml +++ b/langs/factor.yaml @@ -3,6 +3,16 @@ aliases: - "fact" name: "Factor" +install: + manual: | + install -d "${pkg}/opt/factor" + install -d "${pkg}/usr/local/bin" + + ver="$(curl -sSL https://factorcode.org/ | grep -Eo 'release\?os=linux[^>]+>[^<]+' | sed -E 's/[^>]+>//' | head -n1)" + wget "https://downloads.factorcode.org/releases/${ver}/factor-linux-x86-64-${ver}.tar.gz" -O factor.tar.gz + tar -xf factor.tar.gz -C "${pkg}/opt/factor" --strip-components=1 + ln -sT /opt/factor/factor "${pkg}/usr/local/bin/factor-lang" + repl: | factor-lang input: | diff --git a/langs/false.yaml b/langs/false.yaml index 1f56942..dc0f23c 100644 --- a/langs/false.yaml +++ b/langs/false.yaml @@ -3,6 +3,16 @@ aliases: - "falselang" name: "FALSE" +install: + apt: + - ruby + manual: | + install -d "${pkg}/usr/local/bin" + + wget https://github.com/mame/quine-relay/raw/master/vendor/false.rb + cat <(echo '#!/usr/bin/env ruby') false.rb > "${pkg}/usr/local/bin/false-lang" + chmod +x "${pkg}/usr/local/bin/false-lang" + main: "main.false" template: | "Hello, world!" diff --git a/langs/fortran.yaml b/langs/fortran.yaml index d8355eb..e6872d0 100644 --- a/langs/fortran.yaml +++ b/langs/fortran.yaml @@ -11,18 +11,18 @@ name: "FORTRAN" install: apt: - - flang + - gfortran pip: - fortran-language-server -main: "main.f" +main: "main.f95" template: |2 - program hello - print *, "Hello, world!" - end program hello + PROGRAM hello + PRINT *, "Hello, world!" + END PROGRAM hello compile: | - flang main.f -o main + gfortran main.f95 -o main run: | ./main diff --git a/langs/gnuplot.yaml b/langs/gnuplot.yaml index 2fc4c0e..a68dd8f 100644 --- a/langs/gnuplot.yaml +++ b/langs/gnuplot.yaml @@ -3,7 +3,7 @@ name: "Gnuplot" install: apt: - - gnuplot + - gnuplot-nox repl: | gnuplot diff --git a/langs/go.yaml b/langs/go.yaml index 4144c64..67e79ef 100644 --- a/langs/go.yaml +++ b/langs/go.yaml @@ -5,8 +5,18 @@ name: "Go" monacoLang: go install: + prepare: + apt: + - golang apt: - golang + manual: | + install -d "${pkg}/usr/local/bin" + + export GO111MODULE=on + export GOPATH="$PWD/go" + go get golang.org/x/tools/gopls@latest + cp go/bin/gopls "${pkg}/usr/local/bin/" main: "main.go" template: | diff --git a/langs/golfscript.yaml b/langs/golfscript.yaml index f59573e..cd8072b 100644 --- a/langs/golfscript.yaml +++ b/langs/golfscript.yaml @@ -3,6 +3,16 @@ aliases: - "golf" name: "GolfScript" +install: + apt: + - ruby + manual: | + install -d "${pkg}/usr/local/bin" + + wget http://www.golfscript.com/golfscript/golfscript.rb + chmod +x golfscript.rb + cp -T golfscript.rb "${pkg}/usr/local/bin/golfscript" + main: "main.gs" template: | 'Hello, world!' diff --git a/langs/grass.yaml b/langs/grass.yaml index 9ea5866..0548322 100644 --- a/langs/grass.yaml +++ b/langs/grass.yaml @@ -1,6 +1,16 @@ id: "grass" name: "Grass" +install: + apt: + - ruby + manual: | + install -d "${pkg}/usr/local/bin" + + wget http://www.blue.sky.or.jp/grass/grass.rb + chmod +x grass.rb + cp -T grass.rb "${pkg}/usr/local/bin/grass" + main: "main.grass" template: | wWWwwww diff --git a/langs/haskell.yaml b/langs/haskell.yaml index a8785b4..0904ed3 100644 --- a/langs/haskell.yaml +++ b/langs/haskell.yaml @@ -9,8 +9,30 @@ install: prepare: apt: - cabal-install + manual: | + cabal update apt: - ghc + manual: | + install -d "${pkg}/usr/local/bin" + install -d "${pkg}/opt/brittany" + + cabal install brittany --installdir "$PWD" + cp -L brittany "${pkg}/usr/local/bin/" + + mkdir haskell-language-server + pushd haskell-language-server + ver="$(latest_release haskell/haskell-language-server)" + release="$(curl -fsSL "https://api.github.com/repos/haskell/haskell-language-server/releases/tags/${ver}")" + echo "${release}" | jq '.assets[].name' -r | grep Linux | grep -vF .tar | while read asset; do + wget "https://github.com/haskell/haskell-language-server/releases/download/${ver}/${asset}" + gunzip "${asset}" + done + chmod +x * + for binary in *; do + cp -T "${binary}" "${pkg}/usr/local/bin/${binary//-Linux/}" + done + popd repl: | rm -f .ghci && ghci @@ -40,10 +62,8 @@ format: putStrLn "Hello, world!" lsp: - setup: | - cp /opt/haskell/hie.yaml hie.yaml start: | - HIE_HOOGLE_DATABASE=/opt/haskell/hoogle.hoo hie --lsp + haskell-language-server-wrapper --lsp init: languageServerHaskell: {} diff --git a/langs/haxe.yaml b/langs/haxe.yaml index a579d31..5c12145 100644 --- a/langs/haxe.yaml +++ b/langs/haxe.yaml @@ -6,6 +6,7 @@ name: "Haxe" install: apt: - haxe + - nodejs main: "Main.hx" template: | diff --git a/langs/hcl.yaml b/langs/hcl.yaml index 3a47797..55d680b 100644 --- a/langs/hcl.yaml +++ b/langs/hcl.yaml @@ -6,6 +6,10 @@ aliases: - "hc" name: "HCL" +install: + riju: + - yj + main: "main.hcl" template: | output = "Hello, world!" diff --git a/langs/hexagony.yaml b/langs/hexagony.yaml index 1936463..b2ebcb8 100644 --- a/langs/hexagony.yaml +++ b/langs/hexagony.yaml @@ -4,6 +4,14 @@ aliases: - "hex" name: "Hexagony" +install: + manual: | + install -d "${pkg}/usr/local/bin" + install -d "${pkg}/opt" + + git clone https://github.com/m-ender/hexagony.git "${pkg}/opt/hexagony" + ln -sT /opt/hexagony/interpreter.rb "${pkg}/usr/local/bin/hexagony" + main: "main.hxg" template: |2 H ; e ; @@ -15,4 +23,4 @@ template: |2 4 ; * / run: | - /opt/hexagony/interpreter.rb main.hxg + hexagony main.hxg diff --git a/langs/hmmm.yaml b/langs/hmmm.yaml index 1bddc78..5feb71d 100644 --- a/langs/hmmm.yaml +++ b/langs/hmmm.yaml @@ -1,6 +1,14 @@ id: "hmmm" name: "HMMM" +install: + manual: | + install -d "${pkg}/usr/local/bin" + + wget https://www.cs.hmc.edu/~cs5grad/cs5/hmmm/code/hmmm + chmod +x hmmm + cp hmmm "${pkg}/usr/local/bin/" + main: "main.hmmm" template: |2 0 setn r1, 72 diff --git a/langs/idris.yaml b/langs/idris.yaml index 04ba32d..c359dac 100644 --- a/langs/idris.yaml +++ b/langs/idris.yaml @@ -9,6 +9,17 @@ install: apt: - chezscheme - gcc + apt: + - chezscheme + manual: | + wget https://www.idris-lang.org/idris2-src/idris2-latest.tgz + mkdir idris + tar -xf idris2-latest.tgz -C idris --strip-components=1 + pushd idris + make bootstrap-build SCHEME=chezscheme PREFIX="${pkg}/usr/local" + make install PREFIX="${pkg}/usr/local" + chmod -R a=u,go-w "${pkg}/usr/local"/idris2-* + popd repl: | rm -f .idris/repl/init; idris2 diff --git a/langs/ink.yaml b/langs/ink.yaml index 5c77894..a607f19 100644 --- a/langs/ink.yaml +++ b/langs/ink.yaml @@ -1,6 +1,19 @@ id: "ink" name: "Ink" +install: + manual: | + install -d "${pkg}/opt/ink" + install -d "${pkg}/usr/local/bin" + + ver="$(latest_release thesephist/ink)" + wget "https://github.com/thesephist/ink/releases/download/${ver}/ink-linux" + wget "https://github.com/thesephist/ink/releases/download/${ver}/std.ink" + wget "https://github.com/thesephist/ink/releases/download/${ver}/str.ink" + chmod +x ink-linux + cp -T ink-linux "${pkg}/usr/local/bin/ink" + cp std.ink str.ink "${pkg}/opt/ink/" + repl: | ink diff --git a/langs/ioke.yaml b/langs/ioke.yaml index 1abbe45..2cf5ef7 100644 --- a/langs/ioke.yaml +++ b/langs/ioke.yaml @@ -3,6 +3,17 @@ aliases: - "ik" name: "Ioke" +install: + apt: + - default-jdk + manual: | + install -d "${pkg}/opt/ioke" + install -d "${pkg}/usr/local/bin" + + wget https://ioke.org/dist/ioke-ikj-latest.tar.gz -O ioke.tar.gz + tar -xf ioke.tar.gz -C "${pkg}/opt/ioke" --strip-components=1 + ln -s /opt/ioke/bin/ioke "${pkg}/usr/local/bin/ioke" + repl: | JAVA_OPTS="-Duser.home=$PWD" ioke diff --git a/langs/j.yaml b/langs/j.yaml index c59df21..1ca4758 100644 --- a/langs/j.yaml +++ b/langs/j.yaml @@ -4,6 +4,12 @@ aliases: - "ijconsole" name: "J" +install: + manual: | + wget "$(curl -sSL https://code.jsoftware.com/wiki/System/Installation/J901/Debian | grep -F '/dev/null </dev/null; do sleep 0.01; done && mongo --host "$PWD/mongodb-27017.sock" diff --git a/langs/python.yaml b/langs/python.yaml index d61ec3d..6a63fc1 100644 --- a/langs/python.yaml +++ b/langs/python.yaml @@ -44,7 +44,9 @@ install: manual: | install -d "${pkg}/opt/mspyls" install -d "${pkg}/usr/local/bin" - wget "$(curl -fsSL "https://pvsc.blob.core.windows.net/python-language-server-stable?restype=container&comp=list&prefix=Python-Language-Server-linux-x64" | grep -Eo 'https://[^<]+\.nupkg' | tail -n1)" + + url="$(curl -fsSL "https://pvsc.blob.core.windows.net/python-language-server-stable?restype=container&comp=list&prefix=Python-Language-Server-linux-x64" | grep -Eo 'https://[^<]+\.nupkg' | tail -n1)" + wget "${url}" unzip -d "${pkg}/opt/mspyls" Python-Language-Server-linux-x64.*.nupkg chmod +x "${pkg}/opt/mspyls/Microsoft.Python.LanguageServer" ln -s "/opt/mspyls/Microsoft.Python.LanguageServer" "${pkg}/usr/local/bin/Microsoft.Python.LanguageServer" diff --git a/shared/sqls.yaml b/shared/sqls.yaml new file mode 100644 index 0000000..eec8ec3 --- /dev/null +++ b/shared/sqls.yaml @@ -0,0 +1,9 @@ +id: "sqls" + +install: + manual: | + install -d "${pkg}/usr/local/bin" + + ver="$(latest_release lighttiger2505/sqls | sed 's/^v//')" + wget "https://github.com/lighttiger2505/sqls/releases/download/v${ver}/sqls_${ver}_Linux_x86_64.tar.gz" -O sqls.tar.gz + tar -xf sqls.tar.gz -C "${pkg}/usr/local/bin" diff --git a/shared/yj.yaml b/shared/yj.yaml new file mode 100644 index 0000000..6691d5b --- /dev/null +++ b/shared/yj.yaml @@ -0,0 +1,10 @@ +id: "yj" + +install: + manual: | + install -d "${pkg}/usr/local/bin" + + ver="$(latest_release sclevine/yj)" + wget "https://github.com/sclevine/yj/releases/download/${ver}/yj-linux" + chmod +x yj-linux + cp yj-linux "${pkg}/usr/local/bin/yj" diff --git a/tools/config.js b/tools/config.js index 7eca441..9888df5 100644 --- a/tools/config.js +++ b/tools/config.js @@ -61,11 +61,11 @@ export async function getPackages() { // Correct whitespace problems in a language configuration, // destructively. Return the fixed configuration. // -// This basically removes leading and trailing whitespace from all -// values in the configuration recursively. +// This basically removes trailing whitespace from all values in the +// configuration recursively. function fixupLangConfig(langConfig) { if (typeof langConfig === "string") { - return langConfig.trim(); + return langConfig.trimRight(); } else if (typeof langConfig === "object") { for (const key in langConfig) { if (langConfig.id === "whitespace" && key === "template") { diff --git a/tools/generate-build-script.js b/tools/generate-build-script.js index b044999..c2b4f35 100644 --- a/tools/generate-build-script.js +++ b/tools/generate-build-script.js @@ -18,19 +18,36 @@ import { readLangConfig, readSharedDepConfig } from "./config.js"; function makeLangScript(langConfig, isShared) { const { id, name, install } = langConfig; let parts = []; - parts.push(`\ -#!/usr/bin/env bash - -set -euxo pipefail`); let depends = []; + if ( + install && + ((install.prepare && + ((install.prepare.manual && install.prepare.manual.includes("apt-get")) || + (install.prepare.apt && install.prepare.apt.length > 0))) || + (install.apt && + install.apt.filter((pkg) => pkg.includes("$")).length > 0)) + ) { + parts.push(`\ +export DEBIAN_FRONTEND=noninteractive +sudo apt-get update`); + } if (install) { - const { prepare, apt, riju, npm, pip, deb, scripts, manual } = install; + const { + prepare, + apt, + riju, + npm, + pip, + cpan, + files, + scripts, + manual, + deb, + } = install; if (prepare) { const { apt, manual } = prepare; if (apt && apt.length > 0) { parts.push(`\ -export DEBIAN_FRONTEND=noninteractive -sudo apt-get update sudo apt-get install -y ${apt.join(" ")}`); } if (manual) { @@ -51,6 +68,7 @@ sudo apt-get install -y ${apt.join(" ")}`); install -d "\${pkg}/usr/local/bin" install -d "\${pkg}/opt/${basename}/lib" npm install ${arg} -g --prefix "\${pkg}/opt/${basename}" + if [[ -d "$\{pkg}/opt/${basename}/bin" ]]; then ls "$\{pkg}/opt/${basename}/bin" | while read name; do if readlink "\${pkg}/opt/${basename}/bin/\${name}" | grep -q '/${fullname}/'; then @@ -65,6 +83,7 @@ fi`); parts.push(`\ install -d "\${pkg}/usr/local/bin" pip3 install "${basename}" --prefix "\${pkg}/opt/${basename}" + if [[ -d "\${pkg}/opt/${basename}/bin" ]]; then ls "\${pkg}/opt/${basename}/bin" | while read name; do version="$(ls "\${pkg}/opt/${basename}/lib" | head -n1)" @@ -86,15 +105,47 @@ if [[ -d "\${pkg}/opt/${basename}/man" ]]; then fi`); } } - if (deb) { - parts.push( - deb.map((deb) => `dpkg-deb --extract "${deb}" "\${pkg}"`).join("\n") - ); + if (cpan) { + for (const fullname of cpan) { + const basename = fullname.replace(/^.+:/, "").toLowerCase(); + parts.push(`\ +install -d "\${pkg}/usr/local/bin" +cpanm -l "\${pkg}/opt/${basename}" -n "${fullname}" + +if [[ -d "\${pkg}/opt/${basename}/bin" ]]; then + ls "\${pkg}/opt/${basename}/bin" | while read name; do + version="$(ls "\${pkg}/opt/${basename}/lib" | head -n1)" + cat < "\${pkg}/usr/local/bin/\${name}" +#!/usr/bin/env bash +exec env PERL5LIB="/opt/${basename}/lib/\${version}" "/opt/${basename}/bin/\${name}" "\\\$@" +EOF + chmod +x "\${pkg}/usr/local/bin/\${name}" + done +fi + +if [[ -d "\${pkg}/opt/${basename}/man" ]]; then + ls "\${pkg}/opt/${basename}/man" | while read dir; do + install -d "\${pkg}/usr/local/man/\${dir}" + ls "\${pkg}/opt/${basename}/man/\${dir}" | while read name; do + ln -s "/opt/${basename}/man/\${dir}/\${name}" "\${pkg}/usr/local/man/\${dir}/\${name}" + done + done +fi`); + } + } + if (files) { + for (const [file, contents] of Object.entries(files)) { + const path = "${pkg}" + file; + parts.push(`install -d "${nodePath.dirname(path)}" +cat <<"RIJU-EOF" > "${path}" +${contents} +RIJU-EOF`); + } } if (scripts) { for (const [script, contents] of Object.entries(scripts)) { const path = "${pkg}" + nodePath.resolve("/usr/local/bin", script); - parts.push(`install -d "\${pkg}/usr/local/bin" + parts.push(`install -d "${nodePath.dirname(path)}" cat <<"RIJU-EOF" > "${path}" ${contents} RIJU-EOF @@ -104,6 +155,11 @@ chmod +x "${path}"`); if (manual) { parts.push(manual); } + if (deb) { + parts.push( + deb.map((deb) => `dpkg-deb --extract "${deb}" "\${pkg}"`).join("\n") + ); + } if (apt) { depends = depends.concat(apt); } @@ -117,6 +173,12 @@ chmod +x "${path}"`); } } parts.push(`depends=(${depends.map((dep) => `"${dep}"`).join(" ")})`); + let stripDependsFilter = ""; + if (install && install.stripDepends && install.stripDepends.length > 0) { + stripDependsFilter = ` | sed -E 's/(^| )(${install.stripDepends.join( + "|" + )}) *(\\([^)]*\\))? *(,|$)/\\1/g' | sed -E 's/^ *//g'`; + } let debianControlData = `\ Package: riju-${isShared ? "shared" : "lang"}-${id} Version: \$(date +%s%3N) @@ -125,13 +187,23 @@ Maintainer: Radon Rosborough Description: The ${name} ${ isShared ? "shared dependency" : "language" } packaged for Riju -Depends: \$(IFS=,; echo "\${depends[*]}") +Depends: \$(IFS=,; echo "\${depends[*]}" | sed -E 's/,([^ ])/, \\1/g'${stripDependsFilter} | sed -E 's/ +/ /g') Riju-Script-Hash: \$(sha1sum "\$0" | awk '{ print \$1 }')`; parts.push(`\ install -d "\${pkg}/DEBIAN" cat < "\${pkg}/DEBIAN/control" ${debianControlData} EOF`); + if (parts.join("\n\n").includes("latest_release")) { + parts.unshift(`\ +latest_release() { + curl -sSL "https://api.github.com/repos/\$1/releases/latest" | jq -r .tag_name +}`); + } + parts.unshift(`\ +#!/usr/bin/env bash + +set -euxo pipefail`); return parts.join("\n\n"); }