-
Notifications
You must be signed in to change notification settings - Fork 16
Compiling and or running
Compiling steven-rust requires a working rust nightly installation, openssl and sdl2. Instructions for setting up openssl and sdl2 are platform-specific and will be covered as such outside of this section.
An easy way to manage multiple Rust toolchains is rustup. Installation instructions for rustup can be found on its website.
Once you've set up rustup, grab rust nightly by running
rustup install nightlyNow we need to make sure that steven-rust is compiled with nightly. To do this without making nightly the default across the entire system, run the following command in the steven-rust directory:
rustup override set nightlyInstall openssl and sdl2 (with headers) via your distro's package manager. (Packages with headers generally end with -dev)
Compile and run:
cargo run --releaseJust compile:
cargo build --releaseInstalling them is easiest with homebrew.
To install openssl and sdl2 issue these commands:
brew install sdl2
brew install opensslOlder versions of OS X come with an older version of openssl while El Capitan and newer do not come with it at all. Compiling steven-rust with older OS X versions would most likely work without installing the openssl library (and using the OPENSSL_ environment variables), but I would recommend installing it anyway.
To compile steven-rust you can use this simple bash script to set the environment variables so the compiler can find the required libraries.
#!/bin/bash
export LIBRARY_PATH="$LIBRARY_PATH:/usr/local/lib"
export OPENSSL_INCLUDE_DIR=`brew --prefix openssl`/include
export OPENSSL_LIB_DIR=`brew --prefix openssl`/lib
cargo "$@"Compile and run:
./scriptname.sh run --releaseJust compile:
./scriptname.sh build --releaseAlternatively you can skip the script and add the variables directly to the command:
LIBRARY_PATH="$LIBRARY_PATH:/usr/local/lib" OPENSSL_INCLUDE_DIR=`brew --prefix openssl`/include OPENSSL_LIB_DIR=`brew --prefix openssl`/lib cargo build --releaseNote: If you're not using homebrew you probably don't need to set the environment variables.
Note: Make sure that you have the rust nightly GNU ABI toolchain installed with rustup rather than the MSVC ABI. You can check this by running rustup show and ensure that you grab the GNU ABI toolchain with rustup install nightly-gnu
Follow the instructions at https://msys2.github.io to install msys and mingw. After that, run the following command from msys:
pacman -S git tar mingw-w64-x86_64-openssl mingw-w64-x86_64-SDL2 mingw-w64-x86_64-gccCompile and run:
cargo run --releaseJust compile:
cargo build --release