Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Makefile for polymake (http://polymake.org) on Mac OS systems. Downloads and compiles all necessary software (except command line tools and java)
#
# (c) Andreas Paffenholz, 2016, 2017
# github.com/apaffenholz
# polymake.org
#
# Published under GPL v3
#
# Makefile for polymake on Mac OS systems
# downloads and installs all required software usually not found on Mac OS systems
# EXCEPT: command line tools and java
# for the command line tools type "xcode-select --install" in a terminal and follw the instructions
# download of XCode is NOT necessary, just choose install
# for java type "java" in a terminal and follow instructions
# this redirects you to the java web page. Downloaf and install jdk version 8
#
# to install polymake using this Makefile place the file somewhere in your $HOME and type
# "make fetch" and
# "make"
# this will create subfolders "polymake" and "tmp" in the folder <folder-of-Makefile>
# the final polymake can be found in polymake/bin
# the folder tmp can be deleted afterwards
# you can change the locations using the variables below
# note that the directories polymake and tmp should NOT exist in the folder you place the Makefile, there is NO check!
#
# to run polymake you need to include <folder-of-Makefile>/polymake/perl-modules/lib/perl5/darwin-thread-multi-2level/
# in your perl path, so if you run the Makefile in $HOME/, then do
# "export PERL5LIB=$HOME/polymake/perl-modules/lib/perl5/darwin-thread-multi-2level/:$PERL5LIB"
# in a terminal or include this line at the end of $HOME/.bashrc and open a new terminal
#
ANTVERSION := "1.10.1"
MPFRVERSION := "3.1.5"
GMPVERSION := "6.1.0"
GMPMINORVERSION := ""
POLYMAKEVERSION := "3.1"
NTLVERSION := "9.6.2"
LIBNTLVERSION := "18"
BOOSTVERSION := "1_63_0"
BOOSTVERSIONDIR := "1.63.0"
READLINEVERSION := "6.3"
CDDLIBVERSION := "094h"
GLPKVERSION := "4.57"
4TI2VERSION := "1.6.7"
LIBTOOLVERSION := "2.4"
AUTOCONFVERSION := "2.69"
AUTOMAKEVERSION := "1.14"
TERMRLGNUVERSION := "1.24"
LIBXSLTVERSION := "1.92"
JNIHEADERS = "/System/Library/Frameworks/JavaVM.framework/Headers/"
INSTALL_DIR=$(CURDIR)/polymake
TEMP_DIR=$(CURDIR)/tmp
SRC_DIR=$(TEMP_DIR)/src
TAR_DIR=$(TEMP_DIR)/tar
SED := "sed"
.PHONY: prepare fetch ant boost readline gmp mpfr cddlib glpk 4ti2 flint2 libtool autoconf automake ntl singular ppl termreadline polymake
all: prepare ant boost readline gmp mpfr cddlib glpk 4ti2 flint2 libtool autoconf automake ntl singular ppl termreadline polymake
prepare:
@mkdir -p $(INSTALL_DIR);
@mkdir -p $(INSTALL_DIR)/perl-modules
@mkdir -p $(INSTALL_DIR)/local
@mkdir -p $(TEMP_DIR)
@mkdir -p $(SRC_DIR)
fetch:
@mkdir -p $(TAR_DIR)
@echo "fetching ant"
@cd $(TAR_DIR); curl -O http://apache.mirror.iphh.net//ant/binaries/apache-ant-$(ANTVERSION)-bin.tar.bz2
@echo "fetching 4ti2"
@cd $(TAR_DIR); curl -O http://www.4ti2.de/version_$(4TI2VERSION)/4ti2-$(4TI2VERSION).tar.gz
@echo "fetching term-readline-gnu"
@cd $(TAR_DIR); curl -O -L http://search.cpan.org/CPAN/authors/id/H/HA/HAYASHI/Term-ReadLine-Gnu-$(TERMRLGNUVERSION).tar.gz
@echo "fetching libxslt"
@cd $(TAR_DIR); curl -O -L http://search.cpan.org/CPAN/authors/id/S/SH/SHLOMIF/XML-LibXSLT-$(LIBXSLTVERSION).tar.gz
@echo "fetching boost"
@cd $(TAR_DIR); curl -O -L http://sourceforge.net/projects/boost/files/boost/$(BOOSTVERSIONDIR)/boost_$(BOOSTVERSION).tar.bz2
@echo "fetching gmp"
@cd $(TAR_DIR); curl -O https://gmplib.org/download/gmp/gmp-$(GMPVERSION)$(GMPMINORVERSION).tar.bz2
@echo "fetching mpfr"
@cd $(TAR_DIR); curl -O http://www.mpfr.org/mpfr-current/mpfr-$(MPFRVERSION).tar.bz2
@echo "fetching readline"
@cd $(TAR_DIR); curl -O ftp://ftp.cwru.edu/pub/bash/readline-$(READLINEVERSION).tar.gz
@echo "fetching autoconf"
@cd $(TAR_DIR); curl --remote-name http://ftp.gnu.org/gnu/autoconf/autoconf-$(AUTOCONFVERSION).tar.gz
@echo "fetching automake"
@cd $(TAR_DIR); curl --remote-name http://ftp.gnu.org/gnu/automake/automake-$(AUTOMAKEVERSION).tar.gz
@echo "fetching libtool"
@cd $(TAR_DIR); curl --remote-name http://ftp.gnu.org/gnu/libtool/libtool-$(LIBTOOLVERSION).tar.gz
@echo "fetching ntl"
@cd $(TAR_DIR); curl --remote-name http://www.shoup.net/ntl/ntl-$(NTLVERSION).tar.gz
@echo "fetching cddlib"
@cd $(TAR_DIR); curl -O ftp://ftp.math.ethz.ch/users/fukudak/cdd/cddlib-$(CDDLIBVERSION).tar.gz
@echo "fetching glpk"
@cd $(TAR_DIR); curl -O http://ftp.gnu.org/gnu/glpk/glpk-$(GLPKVERSION).tar.gz
ant:
@cd $(INSTALL_DIR); tar xvfj $(TAR_DIR)/apache-ant-$(ANTVERSION)-bin.tar.bz2
@cd $(INSTALL_DIR); rm -rf ant && mv apache-ant-$(ANTVERSION) ant
boost:
@cd $(INSTALL_DIR); tar xvfj $(TAR_DIR)/boost_$(BOOSTVERSION).tar.bz2
@cd $(INSTALL_DIR); rm -rf boost && mv boost_$(BOOSTVERSION) boost
readline:
@cd $(SRC_DIR); tar xvfz $(TAR_DIR)/readline-$(READLINEVERSION).tar.gz
@cd $(SRC_DIR)/readline-$(READLINEVERSION); ./configure --prefix=$(INSTALL_DIR) && make && make install
gmp:
@cd $(SRC_DIR); tar xvfj $(TAR_DIR)/gmp-$(GMPVERSION).tar.bz2
@cd $(SRC_DIR)/gmp-$(GMPVERSION); ./configure --prefix=$(INSTALL_DIR) --enable-cxx && make && make install
mpfr:
@cd $(SRC_DIR); tar xvfj $(TAR_DIR)/mpfr-$(MPFRVERSION).tar.bz2
@cd $(SRC_DIR)/mpfr-$(MPFRVERSION); \
./configure --prefix=$(INSTALL_DIR) --with-gmp=$(INSTALL_DIR) && make && make install
cddlib:
@cd $(SRC_DIR); tar xvfz $(TAR_DIR)/cddlib-$(CDDLIBVERSION).tar.gz
@cd $(SRC_DIR)/cddlib-$(CDDLIBVERSION); \
./configure --prefix=$(INSTALL_DIR)/cddlib CFLAGS=-I$(INSTALL_DIR)/include LDFLAGS=-L$(INSTALL_DIR)/lib && \
make && make install
glpk:
@cd $(SRC_DIR); tar xvfz $(TAR_DIR)/glpk-$(GLPKVERSION).tar.gz
@cd $(SRC_DIR)/glpk-$(GLPKVERSION); ./configure --prefix=$(INSTALL_DIR) && make && make install
4ti2:
@cd $(SRC_DIR); tar xvfz $(TAR_DIR)/4ti2-$(4TI2VERSION).tar.gz
@cd $(SRC_DIR)/4ti2-$(4TI2VERSION); ./configure --prefix=$(INSTALL_DIR) --with-gmp=$(INSTALL_DIR) --with-glpk=$(INSTALL_DIR) && make && make install
flint2:
@cd $(SRC_DIR); if [ ! -d flint2/.git ]; then git clone https://github.com/wbhart/flint2.git flint2; else cd flint2; git pull; fi
@cd $(SRC_DIR)/flint2; ./configure --prefix=$(INSTALL_DIR) --with-gmp=$(INSTALL_DIR) --with-mpfr=$(INSTALL_DIR) && \
make && make install
libtool:
@cd $(SRC_DIR); tar xvfz $(TAR_DIR)/libtool-$(LIBTOOLVERSION).tar.gz
@cd $(SRC_DIR)/libtool-$(LIBTOOLVERSION); ./configure --prefix=$(INSTALL_DIR)/local && make && make install
autoconf:
@cd $(SRC_DIR); tar xvfz $(TAR_DIR)/autoconf-$(AUTOCONFVERSION).tar.gz
@cd $(SRC_DIR)/autoconf-$(AUTOCONFVERSION); PATH=$(INSTALL_DIR)/local/bin:${PATH} ./configure --prefix=$(INSTALL_DIR)/local && \
make && make install
automake:
@cd $(SRC_DIR); tar xvfz $(TAR_DIR)/automake-$(AUTOMAKEVERSION).tar.gz
@cd $(SRC_DIR)/automake-$(AUTOMAKEVERSION); PATH=$(INSTALL_DIR)/local/bin:${PATH} ./configure --prefix=$(INSTALL_DIR)/local && \
make && make install
ntl:
@cd $(SRC_DIR); rm -rf ntl-$(NTLVERSION) && tar xvfz $(TAR_DIR)/ntl-$(NTLVERSION).tar.gz
@cd $(SRC_DIR)/ntl-$(NTLVERSION)/src; \
PATH=$(INSTALL_DIR)/local/bin:${PATH} \
./configure PREFIX=$(INSTALL_DIR) SHARED=on NTL_GMP_LIP=on GMP_PREFIX=$(INSTALL_DIR) && \
PATH=$(INSTALL_DIR)/local/bin:${PATH} make && PATH=$(INSTALL_DIR)/local/bin:${PATH} make install
singular:
@cd $(SRC_DIR); if [ ! -d singular/.git ]; then git clone https://github.com/Singular/Sources.git singular; else cd singular; git pull; fi
@cd $(SRC_DIR)/singular; PATH=$(INSTALL_DIR)/local/bin:${PATH} ./autogen.sh && \
PATH=$(INSTALL_DIR)/bin:${PATH} ./configure --prefix=$(INSTALL_DIR) --with-flint=$(INSTALL_DIR) --with-gmp=$(INSTALL_DIR) --with-mpfr=$(INSTALL_DIR) --with-ntl=$(INSTALL_DIR) --disable-gfanlib --without-dynamic-kernel --without-MP --disable-static
@cd $(SRC_DIR)/singular; PATH=$(INSTALL_DIR)/local/bin:${PATH} make && make install
ppl:
@cd $(SRC_DIR); if [ ! -d ppl/.git ]; then git clone git://git.cs.unipr.it/ppl/ppl.git ppl; else cd ppl git pull; fi
@cd $(SRC_DIR)/ppl; PATH=$(INSTALL_DIR)/local/bin:${PATH} libtoolize --force && \
PATH=$(INSTALL_DIR)/local/bin:${PATH} autoreconf -fi
@cd $(SRC_DIR)/ppl; ./configure --prefix=$(INSTALL_DIR) --with-gmp=$(INSTALL_DIR)
@cd $(SRC_DIR)/ppl; $(SED) 's/demos doc m4/demos m4/g' Makefile > Makefile.tmp && mv Makefile.tmp Makefile
@cd $(SRC_DIR)/ppl; make && make install
termreadline:
@cd $(SRC_DIR); tar xvfz $(TAR_DIR)/Term-ReadLine-Gnu-$(TERMRLGNUVERSION).tar.gz
@cd $(SRC_DIR)/Term-ReadLine-Gnu-$(TERMRLGNUVERSION); \
ARCHFLAGS='-arch x86_64' perl Makefile.PL INSTALL_BASE=$(INSTALL_DIR)/perl-modules --prefix=$(INSTALL_DIR) && \
make && make install
polymake:
@cd $(SRC_DIR); if [ ! -d polymake/.git ]; then git clone https://github.com/polymake/polymake.git polymake; else cd polymake; git pull; fi
@cd $(SRC_DIR)/polymake; \
export PERL5LIB=$(INSTALL_DIR)/perl-modules/lib/perl5:$PERL5LIB && \
./configure CC=clang CXX=clang++ CFLAGS="-fpic -DPIC -DLIBSINGULAR" \
CXXFLAGS="-fpic -DPIC -DLIBSINGULAR "\
--with-ant=$(INSTALL_DIR)/ant/bin/ant \
--prefix=$(INSTALL_DIR) \
--with-boost=$(INSTALL_DIR)/boost \
--without-fink \
--with-gmp=$(INSTALL_DIR) \
--with-mpfr=$(INSTALL_DIR) \
--with-singular=$(INSTALL_DIR) \
--with-readline=$(INSTALL_DIR) \
--with-jni-headers=$(JNIHEADERS) \
--with-ppl=$(INSTALL_DIR) && \
make && make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment