diff --git a/.gitignore b/.gitignore index 994bbe0..95d72f1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ bin dockcross */test/ +Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 8c8a356..0000000 --- a/Dockerfile +++ /dev/null @@ -1,78 +0,0 @@ -FROM debian:jessie -MAINTAINER Matt McCormick "matt.mccormick@kitware.com" - -# Insert this line before "RUN apt-get update" to dynamically -# replace httpredir.debian.org with a single working domain -# in attempt to "prevent" the "Error reading from server" error. -RUN apt-get update && apt-get install -y curl && \ - sed -i "s/httpredir.debian.org/`curl -s -D - http://httpredir.debian.org/demo/debian/ | awk '/^Link:/ { print $2 }' | sed -e 's@;@\1@g'`/" /etc/apt/sources.list - -RUN apt-get update && apt-get -y install \ - automake \ - autogen \ - bash \ - build-essential \ - bzip2 \ - ca-certificates \ - curl \ - file \ - git \ - gzip \ - libcurl4-openssl-dev \ - libssl-dev \ - make \ - ncurses-dev \ - pkg-config \ - libtool \ - python \ - rsync \ - sed \ - bison \ - flex \ - tar \ - vim \ - wget \ - runit \ - xz-utils && \ - apt-get -y clean - -WORKDIR /usr/share -RUN git clone https://github.com/nojhan/liquidprompt.git && \ - cd liquidprompt && \ - git checkout v_1.11 -COPY imagefiles/.bashrc /root/ - -# Build and install CMake from source. -WORKDIR /usr/src -RUN git clone git://cmake.org/cmake.git CMake && \ - cd CMake && \ - git checkout v3.6.1 && \ - cd .. && mkdir CMake-build && cd CMake-build && \ - /usr/src/CMake/bootstrap \ - --parallel=$(nproc) \ - --prefix=/usr && \ - make -j$(nproc) && \ - ./bin/cmake -DCMAKE_USE_SYSTEM_CURL:BOOL=ON \ - -DCMAKE_BUILD_TYPE:STRING=Release \ - -DCMAKE_USE_OPENSSL:BOOL=ON . && \ - make install && \ - cd .. && \ - rm -rf CMake* -# Wrappers that point to CMAKE_TOOLCHAIN_FILE - -# Build and install Ninja from source -RUN git clone https://github.com/martine/ninja.git && \ - cd ninja && \ - git checkout v1.7.1 && \ - python ./configure.py --bootstrap && \ - ./ninja && \ - cp ./ninja /usr/bin/ && \ - cd .. && rm -rf ninja -COPY imagefiles/cmake.sh /usr/local/bin/cmake -COPY imagefiles/ccmake.sh /usr/local/bin/ccmake - -RUN echo "root:root" | chpasswd -WORKDIR /work -ENTRYPOINT ["/dockcross/entrypoint.sh"] - -COPY imagefiles/entrypoint.sh imagefiles/dockcross /dockcross/ diff --git a/Dockerfile.in b/Dockerfile.in new file mode 100644 index 0000000..09d22a4 --- /dev/null +++ b/Dockerfile.in @@ -0,0 +1,36 @@ +FROM debian:jessie +MAINTAINER Matt McCormick "matt.mccormick@kitware.com" + +RUN apt-get update && apt-get install -y curl && \ + sed -i "s/httpredir.debian.org/`curl -s -D - http://httpredir.debian.org/demo/debian/ | awk '/^Link:/ { print $2 }' | sed -e 's@;@\1@g'`/" /etc/apt/sources.list + +RUN apt-get update && apt-get -y install \ + automake \ + autogen \ + bash \ + build-essential \ + bzip2 \ + ca-certificates \ + curl \ + file \ + git \ + gzip \ + libcurl4-openssl-dev \ + libssl-dev \ + make \ + ncurses-dev \ + pkg-config \ + libtool \ + python \ + rsync \ + sed \ + bison \ + flex \ + tar \ + vim \ + wget \ + runit \ + xz-utils && \ + apt-get -y clean + +#include "common.docker" diff --git a/Makefile b/Makefile index 99dd453..df74c77 100644 --- a/Makefile +++ b/Makefile @@ -71,6 +71,16 @@ linux-ppc64le.test: linux-ppc64le test/run.py $(DOCKER) run --rm dockcross/linux-ppc64le > $(BIN)/dockcross-linux-ppc64le && chmod +x $(BIN)/dockcross-linux-ppc64le $(BIN)/dockcross-linux-ppc64le python test/run.py --languages C +manylinux-x64/Dockerfile: manylinux-x64/Dockerfile.in common.docker + sed '/common.docker/ r common.docker' manylinux-x64/Dockerfile.in > manylinux-x64/Dockerfile + +manylinux-x64: manylinux-x64/Dockerfile + $(DOCKER) build -t $(ORG)/manylinux-x64 -f manylinux-x64/Dockerfile . + +manylinux-x64.test: manylinux-x64 test/run.py + $(DOCKER) run --rm dockcross/manylinux-x64 > $(BIN)/dockcross-manylinux-x64 && chmod +x $(BIN)/dockcross-manylinux-x64 + $(BIN)/dockcross-manylinux-x64 /opt/python/cp35-cp35m/bin/python test/run.py + windows-x86: base windows-x86/Dockerfile windows-x86/settings.mk $(DOCKER) build -t $(ORG)/windows-x86 windows-x86 @@ -85,6 +95,9 @@ windows-x64.test: windows-x64 test/run.py $(DOCKER) run --rm dockcross/windows-x64 > $(BIN)/dockcross-windows-x64 && chmod +x $(BIN)/dockcross-windows-x64 $(BIN)/dockcross-windows-x64 python test/run.py --exe-suffix ".exe" +Dockerfile: Dockerfile.in common.docker + sed '/common.docker/ r common.docker' Dockerfile.in > Dockerfile + base: Dockerfile $(DOCKER) build -t $(ORG)/base . diff --git a/README.rst b/README.rst index 30c85a2..9be40f6 100644 --- a/README.rst +++ b/README.rst @@ -99,6 +99,14 @@ dockcross/linux-x86 |linux-x86-images| Linux i686 cross compiler. +.. |manylinux-x64-images| image:: https://badge.imagelayers.io/dockcross/manylinux-x64:latest.svg + :target: https://imagelayers.io/?images=dockcross/manylinux-x64:latest + +dockcross/manylinux-x64 + |manylinux-x64-images| Docker `manylinux `_ image for building Linux x86_64 / amd64 `Python wheel packages `_. + Also has support for the dockcross script, and it has installations of CMake, Ninja, and `scikit-build `_ + + .. |windows-x64-images| image:: https://badge.imagelayers.io/dockcross/windows-x64:latest.svg :target: https://imagelayers.io/?images=dockcross/windows-x64:latest diff --git a/circle.yml b/circle.yml index 71f6714..097a1f8 100644 --- a/circle.yml +++ b/circle.yml @@ -19,6 +19,7 @@ dependencies: - docker pull dockcross/linux-ppc64le - docker pull dockcross/linux-x64 - docker pull dockcross/linux-x86 + - docker pull dockcross/manylinux-x64 - docker pull dockcross/windows-x64 - docker pull dockcross/windows-x86 @@ -34,6 +35,7 @@ test: - make linux-ppc64le.test - make linux-x64.test - make linux-x86.test + - make manylinux-x64.test - make windows-x64.test: timeout: 3000 - make windows-x86.test: @@ -54,5 +56,6 @@ deployment: - docker push dockcross/linux-ppc64le - docker push dockcross/linux-x64 - docker push dockcross/linux-x86 + - docker push dockcross/manylinux-x64 - docker push dockcross/windows-x64 - docker push dockcross/windows-x86 diff --git a/common.docker b/common.docker new file mode 100644 index 0000000..031e6d2 --- /dev/null +++ b/common.docker @@ -0,0 +1,37 @@ +WORKDIR /usr/share +RUN git clone "https://github.com/nojhan/liquidprompt.git" && \ + cd liquidprompt && \ + git checkout v_1.11 +COPY imagefiles/.bashrc /root/ + +WORKDIR /usr/src +RUN git clone "git://cmake.org/cmake.git" CMake && \ + cd CMake && \ + git checkout v3.6.1 && \ + cd .. && mkdir CMake-build && cd CMake-build && \ + /usr/src/CMake/bootstrap \ + --parallel=$(nproc) \ + --prefix=/usr && \ + make -j$(nproc) && \ + ./bin/cmake \ + -DCMAKE_BUILD_TYPE:STRING=Release \ + -DCMAKE_USE_OPENSSL:BOOL=ON . && \ + make install && \ + cd .. && \ + rm -rf CMake* + +RUN git clone "https://github.com/martine/ninja.git" && \ + cd ninja && \ + git checkout v1.7.1 && \ + ([ -e /opt/python/cp35-cp35m/bin/python ] && /opt/python/cp35-cp35m/bin/python ./configure.py --bootstrap) || python ./configure.py --bootstrap && \ + ./ninja && \ + cp ./ninja /usr/bin/ && \ + cd .. && rm -rf ninja +COPY imagefiles/cmake.sh /usr/local/bin/cmake +COPY imagefiles/ccmake.sh /usr/local/bin/ccmake + +RUN echo "root:root" | chpasswd +WORKDIR /work +ENTRYPOINT ["/dockcross/entrypoint.sh"] + +COPY imagefiles/entrypoint.sh imagefiles/dockcross /dockcross/ diff --git a/manylinux-x64/Dockerfile.in b/manylinux-x64/Dockerfile.in new file mode 100644 index 0000000..b7254fa --- /dev/null +++ b/manylinux-x64/Dockerfile.in @@ -0,0 +1,28 @@ +FROM quay.io/pypa/manylinux1_x86_64:latest +MAINTAINER Matt McCormick "matt.mccormick@kitware.com" + +#include "common.docker" + +RUN cd /opt && \ + wget "http://smarden.org/runit/runit-2.1.2.tar.gz" && \ + tar xvzf runit-2.1.2.tar.gz && \ + cd admin/runit-2.1.2 && \ + ./package/install + +COPY manylinux-x64/install-skbuild.sh /usr/local/bin +RUN /usr/local/bin/install-skbuild.sh + +ENV CROSS_TRIPLE x86_64-linux-gnu +ENV CROSS_ROOT /opt/rh/devtoolset-2/root/usr/bin +ENV AS=${CROSS_ROOT}/as \ + AR=${CROSS_ROOT}/ar \ + CC=${CROSS_ROOT}/gcc \ + CPP=${CROSS_ROOT}/cpp \ + CXX=${CROSS_ROOT}/g++ \ + LD=${CROSS_ROOT}/ld + +COPY linux-x64/${CROSS_TRIPLE}-noop.sh /usr/bin/${CROSS_TRIPLE}-noop + +COPY manylinux-x64/Toolchain.cmake ${CROSS_ROOT}/../lib/ +ENV CMAKE_TOOLCHAIN_FILE ${CROSS_ROOT}/../lib/Toolchain.cmake +ENV DEFAULT_DOCKCROSS_IMAGE dockcross/manylinux-x64 diff --git a/manylinux-x64/Toolchain.cmake b/manylinux-x64/Toolchain.cmake new file mode 100644 index 0000000..ef7cd91 --- /dev/null +++ b/manylinux-x64/Toolchain.cmake @@ -0,0 +1,12 @@ +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_VERSION 1) +set(CMAKE_SYSTEM_PROCESSOR x86_64) + +set(cross_triple "x86_64-linux-gnu") + +set(CMAKE_C_COMPILER /opt/rh/devtoolset-2/root/usr/bin/gcc) +set(CMAKE_CXX_COMPILER /opt/rh/devtoolset-2/root/usr/bin/g++) +set(CMAKE_ASM_COMPILER /opt/rh/devtoolset-2/root/usr/bin/as) +set(CMAKE_Fortran_COMPILER /opt/rh/devtoolset-2/root/usr/bin/gfortran) + +set(CMAKE_CROSSCOMPILING_EMULATOR /usr/bin/${cross_triple}-noop) diff --git a/manylinux-x64/install-skbuild.sh b/manylinux-x64/install-skbuild.sh new file mode 100755 index 0000000..a028024 --- /dev/null +++ b/manylinux-x64/install-skbuild.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +for PIP in /opt/python/*/bin/pip; do + $PIP install scikit-build==0.3.0 +done