diff --git a/.gitignore b/.gitignore index dd20fecd22..91a0ef08eb 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,10 @@ #Ignore byond config folder. /cfg/**/* +#Ignore rust-g and auxmos libraries which are compiled with scripts +*.so +/tools/build/binaries/**/* + #Ignore compiled files and other files generated during compilation. *.mdme *.dmb diff --git a/Build.sh b/Build.sh new file mode 100755 index 0000000000..6fd691921e --- /dev/null +++ b/Build.sh @@ -0,0 +1,4 @@ +#!/bin/bash +cd "$(dirname "$(readlink -f "$0")")" +cd ./tools/build +sudo bash ./build.sh diff --git a/dependencies.sh b/dependencies.sh index 0fbad2153c..bc7c499540 100644 --- a/dependencies.sh +++ b/dependencies.sh @@ -8,7 +8,10 @@ export BYOND_MAJOR=513 export BYOND_MINOR=1536 #rust_g git tag -export RUST_G_VERSION=0.4.7 +export RUST_G_VERSION=0.4.8 + +#auxmos git tag +export AUXMOS_VERSION=0.2.0 #node version export NODE_VERSION=12 diff --git a/libauxmos.so b/libauxmos.so deleted file mode 100644 index d7566ab1e4..0000000000 Binary files a/libauxmos.so and /dev/null differ diff --git a/tools/build/binaries/README.md b/tools/build/binaries/README.md new file mode 100644 index 0000000000..625f337d98 --- /dev/null +++ b/tools/build/binaries/README.md @@ -0,0 +1 @@ +This directory is used to store temporary files to create binaries on linux \ No newline at end of file diff --git a/tools/build/build b/tools/build/build index 0e202e1bba..cd4d804e8f 100755 --- a/tools/build/build +++ b/tools/build/build @@ -1,4 +1,6 @@ #!/bin/sh + +#Build TGUI set -e cd "$(dirname "$0")" exec ../bootstrap/node build.js "$@" diff --git a/tools/build/build.sh b/tools/build/build.sh new file mode 100755 index 0000000000..9690ff068b --- /dev/null +++ b/tools/build/build.sh @@ -0,0 +1,75 @@ +#!/bin/sh + +#Detect OS and use corresponding package manager for dependencies. Currently only works for arch, debian/ubuntu, and RHEL/fedora/CentOS +if [[ -f '/etc/arch-release' ]]; then + echo -ne '\n y' | sudo pacman --needed -Sy base-devel git curl nodejs unzip +fi +if [[ -f '/etc/debian version' ]]; then + sudo dpkg --add-architecture i386 + sudo apt-get update + sudo apt-get install -y build-essential git curl lib32z1 pkg-config libssl-dev:i386 libssl-dev nodejs unzip g++-multilib libc6-i386 libstdc++6:i386 +fi +if [[ -f '/etc/centos-release' ]] || [[ -f '/etc/fedora-release' ]]; then #DNF should work for both of these + sudo dnf --refresh install make automake gcc gcc-c++ kernel-devel git curl unzip glibc-devel.i686 openssl-devel.i686 libgcc.i686 libstdc++-devel.i686 +fi + +cd binaries + +#Install rust if not present +if ! [ -x "$has_cargo" ]; then + echo "Installing rust..." + curl https://sh.rustup.rs -sSf | sh -s -- -y + . ~/.profile +fi + +#Download/update rust-g repo +if [ ! -d "rust-g" ]; then + echo "Cloning rust-g..." + git clone https://github.com/tgstation/rust-g + cd rust-g + ~/.cargo/bin/rustup target add i686-unknown-linux-gnu +else + echo "Fetching rust-g..." + cd rust-g + git fetch + ~/.cargo/bin/rustup target add i686-unknown-linux-gnu +fi + +#Compile and move rust-g binary to repo root +echo "Deploying rust-g..." +git checkout "$RUST_G_VERSION" +env PKG_CONFIG_ALLOW_CROSS=1 ~/.cargo/bin/cargo build --release --target=i686-unknown-linux-gnu +mv target/i686-unknown-linux-gnu/release/librust_g.so ../../../../librust_g.so +cd .. + +#Download/update auxmos repo +if [ ! -d "auxmos" ]; then + echo "Cloning auxmos..." + git clone https://github.com/Putnam3145/auxmos + cd auxmos + ~/.cargo/bin/rustup target add i686-unknown-linux-gnu +else + echo "Fetching auxmos..." + cd auxmos + git fetch + ~/.cargo/bin/rustup target add i686-unknown-linux-gnu +fi + +#Compile and move auxmos binary to repo root +echo "Deploying auxmos..." +git checkout "$AUXMOS_VERSION" +env PKG_CONFIG_ALLOW_CROSS=1 ~/.cargo/bin/cargo build --release --target=i686-unknown-linux-gnu +mv target/i686-unknown-linux-gnu/release/libauxmos.so ../../../../libauxmos.so +cd ../.. + +#Install BYOND +cd ../.. +./tools/ci/install_byond.sh +source $HOME/BYOND/byond/bin/byondsetup + +cd tools/build + +#Build TGUI +set -e +cd "$(dirname "$0")" +exec ../bootstrap/node build.js "$@" diff --git a/tools/tgs4_scripts/PreCompile.sh b/tools/tgs4_scripts/PreCompile.sh index f21036ab19..0056042c87 100755 --- a/tools/tgs4_scripts/PreCompile.sh +++ b/tools/tgs4_scripts/PreCompile.sh @@ -66,31 +66,27 @@ env PKG_CONFIG_ALLOW_CROSS=1 ~/.cargo/bin/cargo build --release --target=i686-un mv target/i686-unknown-linux-gnu/release/librust_g.so "$1/librust_g.so" cd .. -# get dependencies for extools -apt-get install -y cmake build-essential gcc-multilib g++-multilib cmake wget +# Auxtools dependencies +apt-get install build-essential g++-multilib libc6-i386 libstdc++6:i386 -# update extools -if [ ! -d "extools" ]; then - echo "Cloning extools..." - git clone https://github.com/MCHSL/extools - cd extools/byond-extools +# Update auxmos +if [ ! -d "auxmos" ]; then + echo "Cloning auxmos..." + git clone https://github.com/Putnam3145/auxmos + cd auxmos + ~/.cargo/bin/rustup target add i686-unknown-linux-gnu else - echo "Fetching extools..." - cd extools/byond-extools + echo "Fetching auxmos..." + cd auxmos git fetch + ~/.cargo/bin/rustup target add i686-unknown-linux-gnu fi -echo "Deploying extools..." -git checkout "$EXTOOLS_VERSION" -if [ -d "build" ]; then - rm -R build -fi -mkdir build -cd build -cmake .. -make -mv libbyond-extools.so "$1/libbyond-extools.so" -cd ../../.. +echo "Deploying auxmos..." +git pull origin master +env PKG_CONFIG_ALLOW_CROSS=1 ~/.cargo/bin/cargo build --release --target=i686-unknown-linux-gnu +mv -f target/i686-unknown-linux-gnu/release/libauxmos.so "$1/libauxmos.so" +cd .. # install or update youtube-dl when not present, or if it is present with pip3, # which we assume was used to install it