Skip to content

Instantly share code, notes, and snippets.

@genotrance
Created February 27, 2019 12:42
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save genotrance/8789260aff1570c7c5fe930eaba7ce33 to your computer and use it in GitHub Desktop.
Save genotrance/8789260aff1570c7c5fe930eaba7ce33 to your computer and use it in GitHub Desktop.
Nim Holy Build Box
#! /bin/bash
export SRCFILE=nim-$VERSION.tar.xz
export BINFILE=nim-$VERSION-linux_x$ARCH.tar
echo "Building Nim $VERSION for $ARCH"
set -e
# Activate Holy Build Box environment.
source /hbb_exe/activate
set -x
# Install xz
yum -y install wget xz || yum clean all
# Download xz if not already
if [ ! -f /io/$SRCFILE ]; then
wget -P /io https://nim-lang.org/download/$SRCFILE
fi
# Extract and enter source
tar -xJf /io/$SRCFILE
cd nim-$VERSION
# Compile
case $ARCH in
32) cpu="i386" ;;
64) cpu="amd64" ;;
esac
./build.sh --cpu $cpu
./bin/nim c koch
./koch boot -d:release
./koch tools -d:release
# Cleanup
find -name *.o | xargs rm -f
find -name nimcache | xargs rm -rf
rm -f compiler/nim0
rm -f compiler/nim1
rm -f compiler/nim
rm -f /io/$BINFILE.xz
# Create XZ
cd ..
tar cf $BINFILE nim-$VERSION
xz -9fc $BINFILE > /io/$BINFILE.xz
#! /bin/bash
export ARCH=32
export VERSION=0.19.4
docker run -t -i -e VERSION=$VERSION -e ARCH=$ARCH --rm -v `pwd`:/io phusion/holy-build-box-$ARCH:latest bash /io/compile.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment