-
Notifications
You must be signed in to change notification settings - Fork 11
Building kjudge manually
So you are one of the bravely ones, who wishes to jump into master
branch and try out the latest commits.
Or maybe you are a friendly developer who wishes to try out your fork to make sure it works?
Fear not, here goes all the requirements to build and run kjudge manually!
A quick list:
cc: anything that compiles SQLite 3
go: >= 1.13
node.js: >= 9
yarn: >= 1
In depth:
- kjudge is built mainly in Go, so a Go compiler is of course required. We require good module support, so at least 1.13 is desirable.
- Aside from Go, a C compiler is needed to compile the sqlite component of kjudge. We recommend:
- On Linux and OSX, either
gcc
orclang
would be okay, althoughgcc
is preferred bycgo
. Try running either of the command to see if you have it. - On Windows, a
gcc
toolchain likemingw64
is required. Please install and make suregcc
is callable from the command line.
- On Linux and OSX, either
- kjudge relies on some Javascript tools that require
Node.js
, and theYarn
package manager, to build the front-end assets.
Rather than giving installation commands for these tools, I encourage you to try and find the appropriate way to have them installed on your own system. Once you have done it, you can verify the existence and versions of each by
gcc --version # Or clang --version
go version
node --version
yarn --version
-
isolate
: The recommended sandbox. This is actually optional, however the only alternate sandbox implementation available (as of now) is the raw sandbox, which DOES NOT PROVIDE ANY GUARDS AGAINST FOREIGN CODE (which makes it okay to run when you are the only user).isolate
is available on Linux systems only.
If you cannot or do not want to use isolate
, run kjudge with -sandbox raw
.
First you need some Go tools. These can be installed simply by running
scripts/install_tools.sh
For Windows users: Sorry, but a script doesn't exist yet. You can manually install the tools by running
go get -v [tool-url-here]
for each import URL listed in tools.go
.
There are two options:
- A production version: Runs fast, no debugging messages.
- A development version: Much slower, comes with profiling and debugging, live reload of templates etc.
Depending on the goal of running kjudge
, pick your flavor.
Building a production, for Linux users, is as simple as
scripts/production_build.sh
For Windows users: Read the Bash scripts for more information... But in short, you need to:
- Build a production template with
yarn build
inside thefrontend
folder. - Disable debugging mode in
fileb0x.yml
. - Run
go generate
to create model implementations and the filebox archive. - Run
go build -tags production -o kjudge cmd/kjudge/main.go
to compile the main binary.
First, open up a terminal, get to the frontend
folder and start the development environment:
yarn dev
Now open another terminal, run
go generate
to generate the model implementations and the filebox system. Now you can run kjudge with
go run cmd/kjudge/main.go