Skip to content
This repository has been archived by the owner on Mar 7, 2023. It is now read-only.

Compilation (Docker)

Speak2Erase edited this page Mar 22, 2021 · 6 revisions

Building using Docker on Linux

This is probably one of the easiest methods and is recommended.

A Dockerfile-linux is attached that handles all the dependencies and allows you to build ModShot for Linux. You should already have Docker installed using your favorite package manager on Linux or here on Windows (For Windows, you may also have to turn on virtualization in your BIOS/UEFI settings).

Building the image

To pull the image, run the following command in bash or Powershell:

docker pull rkevin/build-oneshot-linux:1.2

(Note there are a couple different versions of the image, such as :with-openssl, :1.2 is the latest)

Running the image

You should have 3 directories ready, and write down their paths:

  1. Source directory: This is the path to this repo (Modshot-Core or mkxp-oneshot)
  2. Distribution directory: This is the output folder where you want OneShot.AppImage to be placed after the build. On Linux, make sure that UID 1000 can write to this folder (easiest way is to chmod 777 it, or you can ask the Docker container to run with your permissions)

Keep in mind those paths must be absolute, so /home/user/blah on Linux or C:\Users\user\blah on Windows. No relative paths allowed.

Afterwards, just run this command to build on Linux:

docker run -it -v /path/to/source:/work/src -v /path/to/dist:/work/dist rkevin/build-oneshot-linux:1.2

Or similarly on Windows:

docker run -it -v C:\path\to\source:/work/src -v C:\path\to\dist:/work/dist rkevin/build-oneshot-linux:1.2

Done! Enjoy your built-from-source OneShot.

Partial compilation

If you want to speed up compilation, you can ask the container to keep the build folder by mounting a directory to it, like -v /path/to/build:/work/build. This is optional.

Also note that if the journal file (_______) exists in the build directory, it won't be rebuilt even if you changed the source of the journal. Please delete the file manually if you want a journal rebuild.

Unix only content

If you have game files that you only want in the Linux build of OneShot and not the Windows build, you may place them in a folder that you mount to /work/extra_unix_content. For example, if you want a Map123.rxdata that's for Unix only, put it in a folder like unixonlyfolder/Data/Map123.rxdata, then mount it using -v /path/to/unixonlyfolder:/work/extra_unix_content. This has the same structure as the regular data folder and will take precedence over any files in the regular data folder. You shouldn't need to use this, but it's an option just in case.

Building using Docker on Windows

This is very similar to the Linux build instructions. The major difference is only Windows Docker Desktop can run Windows docker containers. Also, make sure to switch to Windows containers by right clicking on the Docker icon in your system tray. Without it, you can't run Windows containers. Be sure to switch back after you're done if you need to run Linux containers later.

Also note: Running Windows Docker containers require you to have virtualization enabled. If you haven't used VMs before, you might have to turn Virtualization on manually in your BIOS/UEFI settings.

Building the image

You may pull the image from Docker Hub:

docker pull rkevin/build-oneshot-windows:1.2

(Note there are a couple different versions of the image, such as :with-openssl, :1.2 is the latest)

Note the -m 2G. Installing VS BuildTools takes a ton of memory, and without it the build may not succeed. You don't need -m 2G to compile ModShot, though.

Legal disclaimer: Microsoft seems to be pretty stringent about publishing Docker images that contain VS Build Tools. By pulling or building this image, you confirm that you have a valid license for Visual Studio. And to not sue rkevin if things go wrong.

Running the image

You should have at least 2 directories ready, and write down their paths:

  1. Source directory: This is the path to this repo (Modshot-Core or mkxp-oneshot)
  2. Distribution directory: This is the output folder where you want the game files to be placed after the build.

Keep in mind those paths must be absolute, like C:\Users\user\blah. No relative paths allowed.

Afterwards, just run this command to build for Windows:

docker run -it -v C:\path\to\source:C:\work\src -v C:\path\to\dist:C:\work\dist rkevin/build-oneshot-windows:1.2

Done! Enjoy your built-from-source OneShot.

Since starting Windows Docker containers is kinda slow, once ModShot is compiled you can press any key to recompile everything. Press Ctrl+C to actually stop the container.

Also, this does not compile the journal (_______.exe). If you need it, bug rkevin and ask him to add it in. (or better, make a PR!)

Autocopying game files

You can also mount a data folder into the docker container using -v C:\path\to\data:C:\work\data. This folder should contain the Audio, Data, Fonts, Graphics, Languages and Wallpaper folders that contain the game files. If you do this, these files will be automatically copied to the dist directory as well so you don't have to do it manually. Please don't include any other executables in that data directory as they might overwrite the built binaries.

Partial compilation

If you want to speed up compilation, you can ask the container to keep the build folder by mounting a directory to it, like -v C:\path\to\build:C:\work\build. This is optional. Don't reuse the same build folder for Linux and Windows, otherwise things might break.