Last active
March 25, 2021 10:23
-
-
Save apaffenholz/a406c3d862f18345c56eddc21907808f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BREW_BASE= | |
SRC_DIR=`mktemp -d` | |
INSTALL_DIR=/Users/vagrant/poly_install | |
BRANCH=master | |
REPO=github | |
BREW_INSTALLED=0 | |
PERLBREW_INSTALLED=0 | |
PERL_VERSION=`perl --version | grep -oE "5.[0-9]{2}"` | |
#------------------------------------------ | |
export CPATH=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Perl/${PERL_VERSION}/darwin-thread-multi-2level/CORE | |
xcode-select -p 1>/dev/null | |
if [ ! $? ]; then | |
echo "Please install the command line tools first. Run 'xcode-select --install' in a terminal"; | |
exit; | |
fi | |
FULL_REPO="git@git.polymake.org:polymake" | |
if [ "$REPO" == "github" ]; then | |
FULL_REPO="https://github.com/polymake/polymake.git" | |
fi | |
brew_binary= | |
if [[ -z $BREW_BASE ]]; then | |
brew_binary=/usr/local/bin/brew | |
else | |
brew_binary=$BREW_BASE/bin/brew | |
fi | |
if [[ -f $brew_binary ]]; then | |
BREW_INSTALLED=1 | |
else | |
echo "this script will install homebrew on your computer." | |
read -p "Continue (y/n)? " -n 1 -r | |
if [[ ! $REPLY =~ ^[Yy]$ ]] | |
then | |
exit; | |
fi | |
fi | |
if [[ -f $brew_binary ]]; then | |
$brew_binary update | |
else | |
if [[ -z $BREW_BASE ]]; then | |
echo | ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
$brew_binary doctor | |
else | |
mkdir -p $BREW_BASE && curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C $BREW_BASE | |
if [[ ! -f $HOME/.bash_profile || ! `grep "PATH.*$BREW_BASE/bin" $HOME/.bash_profile` ]]; then | |
echo "export PATH=$BREW_BASE/bin\${PATH+:\$PATH}" >> $HOME/.bash_profile | |
fi | |
$brew_binary doctor | |
fi | |
fi | |
brew install gmp | |
brew install mpfr | |
brew install boost | |
brew install readline | |
brew install ppl | |
brew install flint | |
brew install singular | |
brew install python3 | |
brew install ninja | |
brew install ccache | |
if [[ -f ~/perl5/perlbrew/bin/perlbrew ]]; then | |
PERLBREW_INSTALLED=1 | |
else | |
echo "this script will install perlbrew on your computer." | |
read -p "Continue (y/n)? " -n 1 -r | |
if [[ ! $REPLY =~ ^[Yy]$ ]] | |
then | |
exit; | |
fi | |
fi | |
if [[ -f ~/perl5/perlbrew/bin/perlbrew ]]; then | |
~/perl5/perlbrew/bin/perlbrew self-upgrade | |
else | |
\curl -L http://install.perlbrew.pl | bash | |
fi | |
if [[ ! -f $HOME/.zshrc || ! `grep "export PERL5LIB=$HOME/perl5/lib/perl5:$HOME/perl5" .zshrc` ]]; then | |
echo "export PERL5LIB=$HOME/perl5/lib/perl5:$HOME/perl5${PERL5LIB+:$PERL5LIB}" >> $HOME/.zshrc | |
fi | |
if [[ ! -f $HOME/.zshrc || ! `grep "source ~/perl5/perlbrew/etc/bashrc" $HOME/.zshrc` ]]; then | |
echo "source ~/perl5/perlbrew/etc/bashrc" >> $HOME/.zshrc | |
fi | |
if [[ ! -f $HOME/.zshrc || ! `grep 'export ARCHFLAGS="-arch x86_64"' $HOME/.zshrc` ]]; then | |
echo 'export ARCHFLAGS="-arch x86_64"' >> $HOME/.zshrc | |
fi | |
source $HOME/.zshrc | |
yes N | perlbrew install-cpanm | |
cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib) | |
configure_args='' | |
if [[ $nonstandard -eq 1 ]]; then | |
configure_args="--cflags=-I$BREW_BASE/include --libs=-L$BREW_BASE/lib --prefix=$BREW_BASE" | |
cpanm --configure-args $configure_args Term::ReadLine::Gnu | |
else | |
cpanm Term::ReadLine::Gnu | |
fi | |
cpanm SVG | |
cpanm Moo | |
# FIXME apparently we need to pin an older version of this module, otherwise everything else fails | |
cpanm ZEFRAM/Module-Runtime-0.013.tar.gz | |
cpanm MongoDB | |
cpanm JSON | |
cpanm install Net::SSLeay | |
pip3 install jupyter --user | |
curdir=`pwd` | |
mkdir -p $SRC_DIR | |
cd $SRC_DIR | |
if [[ ! -d .git ]]; then | |
git clone $FULL_REPO . | |
git checkout $BRANCH | |
fi | |
if [ -z $INSTALL_DIR ]; then | |
./configure --without-java | |
ninja -C build/Opt -l2 | |
sudo ninja -C build/Opt -l2 install | |
else | |
./configure --without-java --prefix=$INSTALL_DIR | |
ninja -C build/Opt -l2 install | |
fi | |
cd $curdir |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment