diff --git a/doc/manual/index.rst b/doc/manual/index.rst index 2af6aeffa8..1ba568179c 100644 --- a/doc/manual/index.rst +++ b/doc/manual/index.rst @@ -26,3 +26,4 @@ Appendices problem-format shadow configuration-reference + install-language diff --git a/doc/manual/install-language.rst b/doc/manual/install-language.rst new file mode 100644 index 0000000000..61ec9b2557 --- /dev/null +++ b/doc/manual/install-language.rst @@ -0,0 +1,97 @@ +Appendix: Installing the example languages +========================================== + +DOMjudge ships with some default languages with a default configuration. +As you might set up contests with those languages we provide how those languages were +installed in the past as guideline. Use ``dj_run_chroot`` for most of those packages, and see +the section :ref:`make-chroot` for more information. + +Most of the languages can be installed from the table below as there is a package available +to install inside the judging chroot. Given that you can install your own chroot we only provide the +packages for Ubuntu as that is the most used at the moment of writing. + +.. list-table:: Packages for languages + :header-rows: 1 + + * - Language + - Ubuntu package + - Remarks + * - Ada + - `gnat` + - + * - AWK + - `mawk`/`gawk` + - `mawk` is default installed + * - Bash + - `bash` + - Default installed in the chroot + * - C + - `gcc` + - Default installed in the chroot + * - C++ + - `g++` + - Default installed in the chroot + * - C# + - `mono-mcs` + - + * - Fortran + - `gfortran` + - + * - Haskell + - `ghc` + - After installing you need to move these files + `/{usr->var}/lib/ghc/package.conf.d` as `/var` + is not mounted during compilation. + * - Java + - `default-jdk-headless` + - Default installed in the chroot + * - Javascript + - `nodejs` + - + * - Kotlin + - `kotlin` + - + * - Lua + - `lua5.4` + - Ubuntu does not ship a generic meta package (yet). + * - Pascal + - `fp-compiler` + - + * - Perl + - `perl-base` + - Default installed in the chroot + * - POSIX shell + - `dash` + - Default installed in the chroot + * - Prolog + - `swi-prolog-core-packages` + - + * - Python3 + - `pypy3`/`python3` + - Default installed in the chroot. + DOMjudge assumes `pypy3` as it runs faster in general. + Consider the `PyPy3 PPA`_ if you need the latest python3 features. PyPy3 does not have 100% + compatibility with all non-standard libraries. In case this is needed you should reconsider the default + CPython implementation. + * - OCaml + - `ocaml` + - + * - R + - `r-base-core` + - + * - Ruby + - `ruby` + - + * - Rust + - `rustc` + - + * - Scala + - `scala` + - + * - Swift + - + - See the `Swift instructions`_, unpack the directory in the chroot and install `libncurses6`. Depending + on where you install the directory you might need to extend the `PATH` in the `run` script. + +.. _PyPy3 PPA: https://launchpad.net/~pypy/+archive/ubuntu/ppa +.. _Swift instructions: https://www.swift.org/documentation/server/guides/deploying/ubuntu.html diff --git a/sql/files/defaultdata/hs/run b/sql/files/defaultdata/hs/run index d48e2930eb..736de457a5 100755 --- a/sql/files/defaultdata/hs/run +++ b/sql/files/defaultdata/hs/run @@ -10,6 +10,9 @@ MAINSOURCE="$1" # Set non-existing HOME variable to make GHC program happy, see: # https://ghc.haskell.org/trac/ghc/ticket/11678 export HOME=/does/not/exist +# Allow temporary files during compilation, this directory is not +# available during the submission run. +export TMPDIR="$PWD" # Add -DONLINE_JUDGE or -DDOMJUDGE below if you want it make easier for teams # to do local debugging. diff --git a/webapp/migrations/Version20240511091916.php b/webapp/migrations/Version20240511091916.php new file mode 100644 index 0000000000..47fd04c297 --- /dev/null +++ b/webapp/migrations/Version20240511091916.php @@ -0,0 +1,82 @@ + 'gnatmake --version', + 'awk'=> 'awk --version', + 'bash'=> 'bash --version', + 'c' => 'gcc --version', + 'cpp' => 'g++ --version', + 'csharp' => 'mcs --version', + 'f95' => 'gfortran --version', + 'hs' => 'ghc --version', + 'java' => 'javac --version', + 'js' => 'nodejs --version', + 'kt' => 'kotlinc --version', + 'lua' => 'luac -v', + 'pas' => 'fpc -iW', + 'pl' => 'perl -v', + 'plg' => 'swipl --version', + 'py3' => 'pypy3 --version', + 'ocaml' => 'ocamlopt --version', + 'r' => 'Rscript --version', + 'rb' => 'ruby --version', + 'rs' => 'rustc --version', + 'scala' => 'scalac --version', + 'sh' => 'md5sum /bin/sh', + 'swift' => 'swiftc --version']; + + private const RUNNER_VERSION_COMMAND = ['awk'=> 'awk --version', + 'bash'=> 'bash --version', + 'csharp' => 'mono --version', + 'java' => 'java --version', + 'js' => 'nodejs --version', + 'kt' => 'kotlin --version', + 'lua' => 'lua -v', + 'pl' => 'perl -v', + 'py3' => 'pypy3 --version', + 'r' => 'Rscript --version', + 'rb' => 'ruby --version', + 'scala' => 'scala --version', + 'sh' => 'md5sum /bin/sh']; + + public function getDescription(): string + { + return 'Fill default version command for compiler/runner.'; + } + + public function up(Schema $schema): void + { + foreach (self::COMPILER_VERSION_COMMAND as $lang => $versionCommand) { + $this->addSql("UPDATE language SET compiler_version_command = '" . $versionCommand ."' WHERE langid='" . $lang . "' AND compiler_version_command IS NULL;"); + } + foreach (self::RUNNER_VERSION_COMMAND as $lang => $versionCommand) { + $this->addSql("UPDATE language SET runner_version_command = '" . $versionCommand ."' WHERE langid='" . $lang . "' AND runner_version_command IS NULL;"); + } + } + + public function down(Schema $schema): void + { + foreach (self::COMPILER_VERSION_COMMAND as $lang => $versionCommand) { + $this->addSql("UPDATE language SET compiler_version_command = NULL WHERE langid='" . $lang . "' AND compiler_version_command = '" . $versionCommand ."';"); + } + foreach (self::RUNNER_VERSION_COMMAND as $lang => $versionCommand) { + $this->addSql("UPDATE language SET runner_version_command = NULL WHERE langid='" . $lang . "' AND runner_version_command = '" . $versionCommand ."';"); + } + } + + public function isTransactional(): bool + { + return false; + } +} diff --git a/webapp/src/DataFixtures/DefaultData/LanguageFixture.php b/webapp/src/DataFixtures/DefaultData/LanguageFixture.php index a4e6007179..09c090ae0a 100644 --- a/webapp/src/DataFixtures/DefaultData/LanguageFixture.php +++ b/webapp/src/DataFixtures/DefaultData/LanguageFixture.php @@ -25,29 +25,29 @@ public function load(ObjectManager $manager): void $data = [ // ID external ID name extensions require entry point allow allow time compile compiler version runner version // entry point description submit judge factor script command command - ['adb', 'ada', 'Ada', ['adb', 'ads'], false, null, false, true, 1, 'adb', '', ''], - ['awk', 'awk', 'AWK', ['awk'], false, null, false, true, 1, 'awk', '', ''], - ['bash', 'bash', 'Bash shell', ['bash'], false, 'Main file', false, true, 1, 'bash', '', ''], + ['adb', 'ada', 'Ada', ['adb', 'ads'], false, null, false, true, 1, 'adb', 'gnatmake --version', ''], + ['awk', 'awk', 'AWK', ['awk'], false, null, false, true, 1, 'awk', 'awk --version', 'awk --version'], + ['bash', 'bash', 'Bash shell', ['bash'], false, 'Main file', false, true, 1, 'bash', 'bash --version', 'bash --version'], ['c', 'c', 'C', ['c'], false, null, true, true, 1, 'c', 'gcc --version', ''], ['cpp', 'cpp', 'C++', ['cpp', 'cc', 'cxx', 'c++'], false, null, true, true, 1, 'cpp', 'g++ --version', ''], ['csharp', 'csharp', 'C#', ['csharp', 'cs'], false, null, false, true, 1, 'csharp', 'mcs --version', 'mono --version'], - ['f95', 'f95', 'Fortran', ['f95', 'f90'], false, null, false, true, 1, 'f95', '', ''], - ['hs', 'haskell', 'Haskell', ['hs', 'lhs'], false, null, false, true, 1, 'hs', '', ''], + ['f95', 'f95', 'Fortran', ['f95', 'f90'], false, null, false, true, 1, 'f95', 'gfortran --version', ''], + ['hs', 'haskell', 'Haskell', ['hs', 'lhs'], false, null, false, true, 1, 'hs', 'ghc --version', ''], ['java', 'java', 'Java', ['java'], false, 'Main class', true, true, 1, 'java_javac_detect', 'javac -version', 'java -version'], - ['js', 'javascript', 'JavaScript', ['js'], false, 'Main file', false, true, 1, 'js', '', ''], - ['lua', 'lua', 'Lua', ['lua'], false, null, false, true, 1, 'lua', '', ''], + ['js', 'javascript', 'JavaScript', ['js'], false, 'Main file', false, true, 1, 'js', 'nodejs --version', 'nodejs --version'], + ['lua', 'lua', 'Lua', ['lua'], false, null, false, true, 1, 'lua', 'luac -v', 'lua -v'], ['kt', 'kotlin', 'Kotlin', ['kt'], true, 'Main class', false, true, 1, 'kt', 'kotlinc -version', 'kotlin -version'], - ['pas', 'pascal', 'Pascal', ['pas', 'p'], false, 'Main file', false, true, 1, 'pas', '', ''], - ['pl', 'pl', 'Perl', ['pl'], false, 'Main file', false, true, 1, 'pl', '', ''], - ['plg', 'prolog', 'Prolog', ['plg'], false, 'Main file', false, true, 1, 'plg', '', ''], + ['pas', 'pascal', 'Pascal', ['pas', 'p'], false, 'Main file', false, true, 1, 'pas', 'fpc -iW', ''], + ['pl', 'pl', 'Perl', ['pl'], false, 'Main file', false, true, 1, 'pl', 'perl -v', 'perl -v'], + ['plg', 'prolog', 'Prolog', ['plg'], false, 'Main file', false, true, 1, 'plg', 'swipl --version', ''], ['py3', 'python3', 'Python 3', ['py'], false, 'Main file', true, true, 1, 'py3', 'pypy3 --version', 'pypy3 --version'], ['ocaml', 'ocaml', 'OCaml', ['ml'], false, null, false, true, 1, 'ocaml', 'ocamlopt --version', ''], - ['r', 'r', 'R', ['R'], false, 'Main file', false, true, 1, 'r', '', ''], - ['rb', 'ruby', 'Ruby', ['rb'], false, 'Main file', false, true, 1, 'rb', '', ''], + ['r', 'r', 'R', ['R'], false, 'Main file', false, true, 1, 'r', 'Rscript --version', 'Rscript --version'], + ['rb', 'ruby', 'Ruby', ['rb'], false, 'Main file', false, true, 1, 'rb', 'ruby --version', 'ruby --version'], ['rs', 'rust', 'Rust', ['rs'], false, null, false, true, 1, 'rs', 'rustc --version', ''], ['scala', 'scala', 'Scala', ['scala'], false, null, false, true, 1, 'scala', 'scalac -version', 'scala -version'], - ['sh', 'sh', 'POSIX shell', ['sh'], false, 'Main file', false, true, 1, 'sh', '', ''], - ['swift', 'swift', 'Swift', ['swift'], false, 'Main file', false, true, 1, 'swift', '', ''], + ['sh', 'sh', 'POSIX shell', ['sh'], false, 'Main file', false, true, 1, 'sh', 'md5sum /bin/sh', 'md5sum /bin/sh'], + ['swift', 'swift', 'Swift', ['swift'], false, 'Main file', false, true, 1, 'swift', 'swiftc --version', ''], ]; foreach ($data as $item) {