Skip to content

Commit a546e78

Browse files
committed
Add version commands and installation instructions for chroot in manual
DOMjudge ships with default languages but no documentation on how to install those. This commit documents how to get a working setup in the chroot to get the example problems to run. In the past we had the idea to enable all languages in the integration test. If we would do that we could detect the required package changes also and keep this up to date. For the interpreted languages we use mostly use the same binary as runner & compiler. Some of the versions were already added before and are only documented on how to install those now. The migration is added for people to get the version commands to make it easier to use additional languages and still make it easy to publish the used versions, useful for online mirrors etc. The version for `dash`/`sh` is difficult as there is no simple `--version` and getting the value with `dpkg -s` does not work inside our chroot during runtime as not all locations are mounted. For more information see: https://stackoverflow.com/questions/36660724/how-to-tell-the-version-number-of-dash and https://unix.stackexchange.com/questions/416760/how-to-find-out-the-version-number-of-dash-without-resorting-to-package-manage. The other alternative would be `file` as that gives more information than `md5sum` but its also not available in the chroot. The installation for swift could be easier if we allow tarballs to be unpacked in the future. At the moment people would either need to change `dj_make_chroot` or do it afterwards with `dj_run_chroot`. Javascript is interpreted so we copy the behaviour of python. While testing I found that we can only have run-error but there is a `--check` which we could use to verify that there is a sort of compilation step.
1 parent cb45cd9 commit a546e78

File tree

3 files changed

+112
-14
lines changed

3 files changed

+112
-14
lines changed

doc/manual/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ Appendices
2626
problem-format
2727
shadow
2828
configuration-reference
29+
install-language

doc/manual/install-language.rst

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
Appendix: Installing the example languages
2+
==========================================
3+
4+
DOMjudge ships with some default languages with a default configuration.
5+
As you might set up contests with those languages we provide how those languages were
6+
installed in the past as guideline. Use ``dj_run_chroot`` for most of those packages, and see
7+
the section :ref:`make-chroot` for more information.
8+
9+
Most of the languages can be installed from the table below as there is a package available
10+
to install inside the judging chroot. Given that you can install your own chroot we only provide the
11+
packages for Ubuntu as that is the most used at the moment of writing.
12+
13+
.. list-table:: Packages for languages
14+
:header-rows: 1
15+
16+
* - Language
17+
- Ubuntu package
18+
- Remarks
19+
* - Ada
20+
- `gnat`
21+
-
22+
* - AWK
23+
- `mawk`/`gawk`
24+
- `mawk` is default installed
25+
* - Bash
26+
- `bash`
27+
- Default installed in the chroot
28+
* - C
29+
- `gcc`
30+
- Default installed in the chroot
31+
* - C++
32+
- `g++`
33+
- Default installed in the chroot
34+
* - C#
35+
- `mono-mcs`
36+
-
37+
* - Fortran
38+
- `gfortran`
39+
-
40+
* - Haskell
41+
- `ghc`
42+
- After installing you need to move these files
43+
`/{usr->var}/lib/ghc/package.conf.d` as `/var`
44+
is not mounted during compilation.
45+
* - Java
46+
- `default-jdk-headless`
47+
- Default installed in the chroot
48+
* - Javascript
49+
- `nodejs`
50+
-
51+
* - Kotlin
52+
- `kotlin`
53+
-
54+
* - Lua
55+
- `lua5.4`
56+
- Ubuntu does not ship a generic meta package (yet).
57+
* - Pascal
58+
- `fp-compiler`
59+
-
60+
* - Perl
61+
- `perl-base`
62+
- Default installed in the chroot
63+
* - POSIX shell
64+
- `dash`
65+
- Default installed in the chroot
66+
* - Prolog
67+
- `swi-prolog-core-packages`
68+
-
69+
* - Python3
70+
- `pypy3`/`python3`
71+
- Default installed in the chroot.
72+
DOMjudge assumes `pypy3` as it runs faster in general.
73+
Consider the `PyPy3 PPA`_ if you need the latest python3 features. PyPy3 does not have 100%
74+
compatibility with all non-standard libraries. In case this is needed you should reconsider the default
75+
CPython implementation.
76+
* - OCaml
77+
- `ocaml`
78+
-
79+
* - R
80+
- `r-base-core`
81+
-
82+
* - Ruby
83+
- `ruby`
84+
-
85+
* - Rust
86+
- `rustc`
87+
-
88+
* - Scala
89+
- `scala`
90+
-
91+
* - Swift
92+
-
93+
- See the `Swift instructions`_, unpack the directory in the chroot and install `libncurses6`. Depending
94+
on where you install the directory you might need to extend the `PATH` in the `run` script.
95+
96+
.. _PyPy3 PPA: https://launchpad.net/~pypy/+archive/ubuntu/ppa
97+
.. _Swift instructions: https://www.swift.org/documentation/server/guides/deploying/ubuntu.html

webapp/src/DataFixtures/DefaultData/LanguageFixture.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,29 +25,29 @@ public function load(ObjectManager $manager): void
2525
$data = [
2626
// ID external ID name extensions require entry point allow allow time compile compiler version runner version
2727
// entry point description submit judge factor script command command
28-
['adb', 'ada', 'Ada', ['adb', 'ads'], false, null, false, true, 1, 'adb', '', ''],
29-
['awk', 'awk', 'AWK', ['awk'], false, null, false, true, 1, 'awk', '', ''],
30-
['bash', 'bash', 'Bash shell', ['bash'], false, 'Main file', false, true, 1, 'bash', '', ''],
28+
['adb', 'ada', 'Ada', ['adb', 'ads'], false, null, false, true, 1, 'adb', 'gnatmake --version', ''],
29+
['awk', 'awk', 'AWK', ['awk'], false, null, false, true, 1, 'awk', 'awk --version', ''],
30+
['bash', 'bash', 'Bash shell', ['bash'], false, 'Main file', false, true, 1, 'bash', 'bash --version', ''],
3131
['c', 'c', 'C', ['c'], false, null, true, true, 1, 'c', 'gcc --version', ''],
3232
['cpp', 'cpp', 'C++', ['cpp', 'cc', 'cxx', 'c++'], false, null, true, true, 1, 'cpp', 'g++ --version', ''],
3333
['csharp', 'csharp', 'C#', ['csharp', 'cs'], false, null, false, true, 1, 'csharp', 'mcs --version', 'mono --version'],
34-
['f95', 'f95', 'Fortran', ['f95', 'f90'], false, null, false, true, 1, 'f95', '', ''],
35-
['hs', 'haskell', 'Haskell', ['hs', 'lhs'], false, null, false, true, 1, 'hs', '', ''],
34+
['f95', 'f95', 'Fortran', ['f95', 'f90'], false, null, false, true, 1, 'f95', 'gfortran --version', ''],
35+
['hs', 'haskell', 'Haskell', ['hs', 'lhs'], false, null, false, true, 1, 'hs', 'ghc --version', ''],
3636
['java', 'java', 'Java', ['java'], false, 'Main class', true, true, 1, 'java_javac_detect', 'javac -version', 'java -version'],
37-
['js', 'javascript', 'JavaScript', ['js'], false, 'Main file', false, true, 1, 'js', '', ''],
38-
['lua', 'lua', 'Lua', ['lua'], false, null, false, true, 1, 'lua', '', ''],
37+
['js', 'javascript', 'JavaScript', ['js'], false, 'Main file', false, true, 1, 'js', 'nodejs --version', 'nodejs --version'],
38+
['lua', 'lua', 'Lua', ['lua'], false, null, false, true, 1, 'lua', 'luac -v', ''],
3939
['kt', 'kotlin', 'Kotlin', ['kt'], true, 'Main class', false, true, 1, 'kt', 'kotlinc -version', 'kotlin -version'],
40-
['pas', 'pascal', 'Pascal', ['pas', 'p'], false, 'Main file', false, true, 1, 'pas', '', ''],
41-
['pl', 'pl', 'Perl', ['pl'], false, 'Main file', false, true, 1, 'pl', '', ''],
42-
['plg', 'prolog', 'Prolog', ['plg'], false, 'Main file', false, true, 1, 'plg', '', ''],
40+
['pas', 'pascal', 'Pascal', ['pas', 'p'], false, 'Main file', false, true, 1, 'pas', 'fpc -iW', ''],
41+
['pl', 'pl', 'Perl', ['pl'], false, 'Main file', false, true, 1, 'pl', 'perl -v', 'perl -v'],
42+
['plg', 'prolog', 'Prolog', ['plg'], false, 'Main file', false, true, 1, 'plg', 'swipl --version', 'swipl --version'],
4343
['py3', 'python3', 'Python 3', ['py'], false, 'Main file', true, true, 1, 'py3', 'pypy3 --version', 'pypy3 --version'],
4444
['ocaml', 'ocaml', 'OCaml', ['ml'], false, null, false, true, 1, 'ocaml', 'ocamlopt --version', ''],
45-
['r', 'r', 'R', ['R'], false, 'Main file', false, true, 1, 'r', '', ''],
46-
['rb', 'ruby', 'Ruby', ['rb'], false, 'Main file', false, true, 1, 'rb', '', ''],
45+
['r', 'r', 'R', ['R'], false, 'Main file', false, true, 1, 'r', 'Rscript --version', 'Rscript --version'],
46+
['rb', 'ruby', 'Ruby', ['rb'], false, 'Main file', false, true, 1, 'rb', 'ruby --version', 'ruby --version'],
4747
['rs', 'rust', 'Rust', ['rs'], false, null, false, true, 1, 'rs', 'rustc --version', ''],
4848
['scala', 'scala', 'Scala', ['scala'], false, null, false, true, 1, 'scala', 'scalac -version', 'scala -version'],
49-
['sh', 'sh', 'POSIX shell', ['sh'], false, 'Main file', false, true, 1, 'sh', '', ''],
50-
['swift', 'swift', 'Swift', ['swift'], false, 'Main file', false, true, 1, 'swift', '', ''],
49+
['sh', 'sh', 'POSIX shell', ['sh'], false, 'Main file', false, true, 1, 'sh', 'md5sum /bin/sh', ''],
50+
['swift', 'swift', 'Swift', ['swift'], false, 'Main file', false, true, 1, 'swift', 'swiftc --version', ''],
5151
];
5252

5353
foreach ($data as $item) {

0 commit comments

Comments
 (0)