Last active
December 17, 2015 10:19
-
-
Save ubergeek42/5594216 to your computer and use it in GitHub Desktop.
Domjudge: Compile scripts for fortran, lua, ada, scala. Note: scala requires some additional setup, as it doesn't run with the statically compiled sh included with domjudge. You'll need to add ' Ada,adb Fortran,f95 Scala,scala, Lua,lua' to the LANG_EXTS variable in domserver-config.php.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# ADA compile wrapper-script for 'compile.sh'. | |
# See that script for syntax and more info. | |
DEST="$1" ; shift | |
MEMLIMIT="$1" ; shift | |
MAINSOURCE="$1" | |
# -static: Static link with all libraries | |
# -bargs -static: Static link with all libraries | |
gnatmake -static -o $DEST "$@" -bargs -static | |
exitcode=$? | |
# clean created files: | |
rm -f $DEST.o $DEST.ali | |
exit $exitcode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Fortran compile wrapper-script for 'compile.sh'. | |
# See that script for syntax and more info. | |
DEST="$1" ; shift | |
MEMLIMIT="$1" ; shift | |
MAINSOURCE="$1" | |
# -Wall: Report all warnings | |
# -02: Level 2 optimizations (default for speed) | |
# -static: Static link with all libraries | |
gfortran -static -Wall -O2 -o $DEST "$@" | |
exitcode=$? | |
# clean created files: | |
rm -f $DEST.o | |
exit $exitcode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Lua compile wrapper-script for 'compile.sh'. | |
# See that script for syntax and more info. | |
# | |
# This script does not actually "compile" the source, but writes a | |
# shell script that will function as the executable: when called, it | |
# will execute the source with the correct interpreter syntax, thus | |
# allowing this interpreted source to be used transparantly as if it | |
# was compiled to a standalone binary. | |
# | |
# NOTICE: this compiler script cannot be used with the USE_CHROOT | |
# configuration option turned on! (Unless proper preconfiguration of | |
# the chroot environment has been taken care of.) | |
DEST="$1" ; shift | |
MEMLIMIT="$1" ; shift | |
MAINSOURCE="$1" | |
# Check for '#!' interpreter line: don't allow it to prevent teams | |
# from passing options to the interpreter. | |
if grep '^#!' "$MAINSOURCE" >/dev/null 2>&1 ; then | |
echo "Error: interpreter statement(s) found:" | |
grep -n '^#!' "$MAINSOURCE" | |
exit 1 | |
fi | |
# Write executing script: | |
cat > $DEST <<EOF | |
#!/bin/sh | |
# Generated shell-script to execute lua interpreter on source. | |
# Detect dirname and change dir to prevent class not found errors. | |
if [ "\${0%/*}" != "\$0" ]; then | |
cd "\${0%/*}" | |
fi | |
exec lua "$MAINSOURCE" | |
EOF | |
chmod a+x $DEST | |
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Scala compile wrapper-script for 'compile.sh'. | |
# See that script for syntax and more info. | |
# | |
# NOTICE: this compiler script cannot be used with the USE_CHROOT | |
# configuration option turned on, unless proper preconfiguration of | |
# the chroot environment has been taken care of! | |
DEST="$1" ; shift | |
MEMLIMIT="$1" ; shift | |
MAINSOURCE="$1" | |
scalac "$@" | |
EXITCODE=$? | |
[ "$EXITCODE" -ne 0 ] && exit $EXITCODE | |
MAINCLASS=$(basename $MAINSOURCE .scala) | |
cat > $DEST <<EOF | |
#!/bin/sh | |
# Generated shell-script to execute scala interpreter on source. | |
# Detect dirname and change dir to prevent class not found errors. | |
if [ "\${0%/*}" != "\$0" ]; then | |
cd "\${0%/*}" | |
fi | |
exec scala $MAINCLASS | |
EOF | |
chmod a+x $DEST | |
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- These lines need to be added to sql_db_examples.sql | |
INSERT INTO `language` (`langid`, `name`, `allow_submit`, `allow_judge`, `time_factor`) VALUES ('adb', 'Ada', 1, 1, 1); | |
INSERT INTO `language` (`langid`, `name`, `allow_submit`, `allow_judge`, `time_factor`) VALUES ('f95', 'Fortran', 1, 1, 1); | |
INSERT INTO `language` (`langid`, `name`, `allow_submit`, `allow_judge`, `time_factor`) VALUES ('scala', 'Scala', 1, 1, 1.5); | |
INSERT INTO `language` (`langid`, `name`, `allow_submit`, `allow_judge`, `time_factor`) VALUES ('lua', 'Lua', 1, 1, 1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment