diff --git a/.gitignore b/.gitignore index ca45fd9..e614382 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ build *.so venv dist +docker/boost_* \ No newline at end of file diff --git a/Makefile b/Makefile index 49f939f..2965391 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,29 @@ -all: test +SETUP_FLAGS = G_SPEAK_HOME=/usr APPLY_LP2002043_UBUNTU_CFLAGS_WORKAROUND=1 +BOOST_SRC = "docker/boost_1_49_0.tar.gz" +BOOST_URL = "http://sourceforge.net/projects/boost/files/boost/1.49.0/boost_1_49_0.tar.gz" -.PHONY: test +.PHONY: test shell + +all: test-docker + +test-docker: docker + docker run -ti --rm -v $$PWD:/work -w /work cplasma /bin/bash -c 'make test' test: - python setup.py build_ext --inplace + ${SETUP_FLAGS} python setup.py build_ext --inplace python test/yamlio_test.py python test/pool_server_test.py python test/unicode_test.py python test/hash_test.py python test/test_readable_slaw.py +shell: docker + docker run --name cplasma-shell -ti --rm -v $$PWD:/work -w /work cplasma /bin/bash + +docker: docker/Dockerfile ${BOOST_SRC} + docker build -f docker/Dockerfile docker/ -t cplasma + +# Download Boost from this link https://www.boost.org/users/history/version_1_49_0.html +${BOOST_SRC}: + test -f $@ || wget ${BOOST_URL} -O ${BOOST_SRC} diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..6ed4df3 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,16 @@ +FROM plasma + +RUN add-apt-repository ppa:deadsnakes/ppa && apt-get update +RUN apt-get install -y \ + python2.7 \ + python2.7-dev \ + python-pip + +RUN pip2 install wheel +RUN pip2 install numpy + +RUN ln -s /usr/bin/python2.7 /usr/bin/python + +COPY boost_1_49_0.tar.gz install_boost.sh /opt/boost/ +WORKDIR /opt/boost/ +RUN ./install_boost.sh diff --git a/docker/install_boost.sh b/docker/install_boost.sh new file mode 100755 index 0000000..16e1503 --- /dev/null +++ b/docker/install_boost.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +BOOST_VER=1.49.0 +BOOST_DIR="boost_${BOOST_VER//./_}" + +if ! [ -d "$BOOST_DIR" ]; then + tar -xf "$BOOST_DIR.tar.gz" +fi +cd "$BOOST_DIR" +./bootstrap.sh --with-libraries=python + +cat < py27-config.jam +# Specify Python configuration +using python + : 2.7 # Version of Python + : /usr/bin/python2.7 # Path to the Python interpreter + : /usr/include/python2.7 # Path to the Python headers + : /usr/lib/x86_64-linux-gnu # Path to the Python libraries + : off # No debugging symbols + : -std=c++11 + ; +JAM + +# Install python boost library +sudo ./b2 install --with-python -sNO_BZIP2=1 --prefix=/usr --user-config=py27-config.jam -j$(nproc)