From 2a425ac1ad8fe67d8ea124f37cfd86af16034ef4 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 6 Jun 2018 20:00:46 -0400 Subject: [PATCH 1/7] install-gosu-binary.sh: install sudo wrapper when executing the script --- common.docker | 1 - imagefiles/install-gosu-binary.sh | 12 ++++++++++++ imagefiles/sudo.sh | 5 ----- 3 files changed, 12 insertions(+), 6 deletions(-) delete mode 100755 imagefiles/sudo.sh diff --git a/common.docker b/common.docker index 47c9b64..c18c5a2 100644 --- a/common.docker +++ b/common.docker @@ -47,7 +47,6 @@ RUN \ COPY imagefiles/cmake.sh /usr/local/bin/cmake COPY imagefiles/ccmake.sh /usr/local/bin/ccmake -COPY imagefiles/sudo.sh /usr/bin/sudo RUN if [ -e /opt/python/cp35-cp35m/bin/python ]; then \ : nothing to do here since it is updated by manylinux-common/install-python-packages.sh ; \ diff --git a/imagefiles/install-gosu-binary.sh b/imagefiles/install-gosu-binary.sh index 2f43922..8c9153b 100755 --- a/imagefiles/install-gosu-binary.sh +++ b/imagefiles/install-gosu-binary.sh @@ -40,3 +40,15 @@ chmod +x /usr/local/bin/gosu # verify that the binary works gosu nobody true + + +cat << EOF >> /usr/bin/sudo +#!/bin/sh + +# Emulate the sudo command + +exec gosu root:root "\$@" + +EOF + +chmod +x /usr/bin/sudo diff --git a/imagefiles/sudo.sh b/imagefiles/sudo.sh deleted file mode 100755 index 6d86568..0000000 --- a/imagefiles/sudo.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -# Emulate the sudo command - -exec gosu root:root "$@" From 5f5a89071445d3b1aa37e2d3376f42f0f5808769 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 6 Jun 2018 20:17:10 -0400 Subject: [PATCH 2/7] common.*: Clearly differentiate runtime and buildtime scripts Simplify all common.* files by simply removing the "buildscripts" directory instead of listing each script one by one. --- common.debian | 7 ++++--- common.docker | 44 ++++++++++++++++++-------------------------- common.manylinux | 13 +++++++------ 3 files changed, 29 insertions(+), 35 deletions(-) diff --git a/common.debian b/common.debian index e5ef789..4f91915 100644 --- a/common.debian +++ b/common.debian @@ -1,7 +1,8 @@ RUN REPO=http://cdn-fastly.deb.debian.org && \ echo "deb $REPO/debian jessie main\ndeb $REPO/debian jessie-updates main\ndeb $REPO/debian-security jessie/updates main" > /etc/apt/sources.list -COPY imagefiles/install-gosu-binary.sh /dockcross/ +# Image build scripts +COPY imagefiles/install-gosu-binary.sh /buildscripts/ ARG DEBIAN_FRONTEND=noninteractive @@ -39,6 +40,6 @@ RUN \ zlib1g-dev \ && \ apt-get clean --yes && \ - /dockcross/install-gosu-binary.sh && \ - rm /dockcross/install-gosu-binary.sh + /buildscripts/install-gosu-binary.sh && \ + rm -rf /buildscripts diff --git a/common.docker b/common.docker index c18c5a2..018189f 100644 --- a/common.docker +++ b/common.docker @@ -3,6 +3,7 @@ WORKDIR /usr/src ARG GIT_VERSION=2.16.2 ARG CMAKE_VERSION=3.11.0 +# Image build scripts COPY \ imagefiles/build-and-install-git.sh \ imagefiles/utils.sh \ @@ -13,41 +14,29 @@ COPY \ imagefiles/install-liquidprompt-binary.sh \ imagefiles/build-and-install-curl.sh \ imagefiles/build-and-install-ninja.sh \ - /dockcross/ + /buildscripts/ RUN \ if [ "$DEFAULT_DOCKCROSS_IMAGE" = "dockcross/manylinux-x86" ]; then \ - /dockcross/build-and-install-openssl.sh -32 && \ - /dockcross/build-and-install-openssh.sh && \ - /dockcross/build-and-install-curl.sh && \ - /dockcross/build-and-install-git.sh && \ - /dockcross/build-and-install-cmake.sh -32 || exit 1; \ + /buildscripts/build-and-install-openssl.sh -32 && \ + /buildscripts/build-and-install-openssh.sh && \ + /buildscripts/build-and-install-curl.sh && \ + /buildscripts/build-and-install-git.sh && \ + /buildscripts/build-and-install-cmake.sh -32 || exit 1; \ else \ - /dockcross/build-and-install-openssl.sh && \ - /dockcross/build-and-install-openssh.sh && \ - /dockcross/build-and-install-curl.sh && \ - /dockcross/build-and-install-git.sh && \ - /dockcross/install-cmake-binary.sh || exit 1; \ + /buildscripts/build-and-install-openssl.sh && \ + /buildscripts/build-and-install-openssh.sh && \ + /buildscripts/build-and-install-curl.sh && \ + /buildscripts/build-and-install-git.sh && \ + /buildscripts/install-cmake-binary.sh || exit 1; \ fi; \ - /dockcross/install-liquidprompt-binary.sh && \ + /buildscripts/install-liquidprompt-binary.sh && \ PYTHON=$([ -e /opt/python/cp35-cp35m/bin/python ] && echo "/opt/python/cp35-cp35m/bin/python" || echo "python") && \ - /dockcross/build-and-install-ninja.sh -python ${PYTHON} && \ - rm \ - /dockcross/build-and-install-git.sh \ - /dockcross/utils.sh \ - /dockcross/build-and-install-openssl.sh \ - /dockcross/build-and-install-openssh.sh \ - /dockcross/build-and-install-cmake.sh \ - /dockcross/install-cmake-binary.sh \ - /dockcross/install-liquidprompt-binary.sh \ - /dockcross/build-and-install-curl.sh \ - /dockcross/build-and-install-ninja.sh \ + /buildscripts/build-and-install-ninja.sh -python ${PYTHON} && \ + rm -rf /buildscripts \ && \ ${PYTHON} -m pip install --ignore-installed conan -COPY imagefiles/cmake.sh /usr/local/bin/cmake -COPY imagefiles/ccmake.sh /usr/local/bin/ccmake - RUN if [ -e /opt/python/cp35-cp35m/bin/python ]; then \ : nothing to do here since it is updated by manylinux-common/install-python-packages.sh ; \ else \ @@ -60,4 +49,7 @@ RUN echo "root:root" | chpasswd WORKDIR /work ENTRYPOINT ["/dockcross/entrypoint.sh"] +# Runtime scripts +COPY imagefiles/cmake.sh /usr/local/bin/cmake +COPY imagefiles/ccmake.sh /usr/local/bin/ccmake COPY imagefiles/entrypoint.sh imagefiles/dockcross /dockcross/ diff --git a/common.manylinux b/common.manylinux index b8f0de8..011b51a 100644 --- a/common.manylinux +++ b/common.manylinux @@ -1,8 +1,8 @@ +# Image build scripts COPY \ imagefiles/install-gosu-binary.sh \ manylinux-common/install-python-packages.sh \ - manylinux-common/pre_exec.sh \ - /dockcross/ + /buildscripts/ RUN \ set -x && \ @@ -16,11 +16,12 @@ RUN \ zip \ && \ yum clean all && \ - /dockcross/install-gosu-binary.sh && \ - rm /dockcross/install-gosu-binary.sh && \ + /buildscripts/install-gosu-binary.sh && \ # Remove sudo provided by "devtoolset-2" since it doesn't work with # our sudo wrapper calling gosu. rm /opt/rh/devtoolset-2/root/usr/bin/sudo && \ - /dockcross/install-python-packages.sh && \ - rm /dockcross/install-python-packages.sh + /buildscripts/install-python-packages.sh && \ + rm -rf /buildscripts +# Runtime scripts +COPY manylinux-common/pre_exec.sh /dockcross/ From 6cdf33f46f24e4d3181b2c2205f69700bda8e3bc Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 6 Jun 2018 20:27:20 -0400 Subject: [PATCH 3/7] common.docker: Alphabetically list scripts in COPY instruction --- common.docker | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common.docker b/common.docker index 018189f..cb470a5 100644 --- a/common.docker +++ b/common.docker @@ -5,15 +5,15 @@ ARG CMAKE_VERSION=3.11.0 # Image build scripts COPY \ + imagefiles/build-and-install-cmake.sh \ + imagefiles/build-and-install-curl.sh \ imagefiles/build-and-install-git.sh \ - imagefiles/utils.sh \ + imagefiles/build-and-install-ninja.sh \ imagefiles/build-and-install-openssl.sh \ imagefiles/build-and-install-openssh.sh \ - imagefiles/build-and-install-cmake.sh \ imagefiles/install-cmake-binary.sh \ imagefiles/install-liquidprompt-binary.sh \ - imagefiles/build-and-install-curl.sh \ - imagefiles/build-and-install-ninja.sh \ + imagefiles/utils.sh \ /buildscripts/ RUN \ From 2b93dd54120b0b5e3dd0d80aa83ecfd5badfc16b Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Wed, 6 Jun 2018 20:58:31 -0400 Subject: [PATCH 4/7] Centralize python packages installation adding "install-python-packages" script --- common.docker | 13 +++---------- imagefiles/install-python-packages.sh | 27 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 10 deletions(-) create mode 100755 imagefiles/install-python-packages.sh diff --git a/common.docker b/common.docker index cb470a5..4bdf191 100644 --- a/common.docker +++ b/common.docker @@ -13,6 +13,7 @@ COPY \ imagefiles/build-and-install-openssh.sh \ imagefiles/install-cmake-binary.sh \ imagefiles/install-liquidprompt-binary.sh \ + imagefiles/install-python-packages.sh \ imagefiles/utils.sh \ /buildscripts/ @@ -32,18 +33,10 @@ RUN \ fi; \ /buildscripts/install-liquidprompt-binary.sh && \ PYTHON=$([ -e /opt/python/cp35-cp35m/bin/python ] && echo "/opt/python/cp35-cp35m/bin/python" || echo "python") && \ + /buildscripts/install-python-packages.sh -python ${PYTHON} && \ /buildscripts/build-and-install-ninja.sh -python ${PYTHON} && \ - rm -rf /buildscripts \ - && \ - ${PYTHON} -m pip install --ignore-installed conan + rm -rf /buildscripts -RUN if [ -e /opt/python/cp35-cp35m/bin/python ]; then \ - : nothing to do here since it is updated by manylinux-common/install-python-packages.sh ; \ - else \ - curl -# -LO https://bootstrap.pypa.io/get-pip.py && \ - python get-pip.py --ignore-installed && \ - rm get-pip.py || exit 1; \ - fi RUN echo "root:root" | chpasswd WORKDIR /work diff --git a/imagefiles/install-python-packages.sh b/imagefiles/install-python-packages.sh new file mode 100755 index 0000000..1b44460 --- /dev/null +++ b/imagefiles/install-python-packages.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +set -e +set -o pipefail + +PYTHON=python +while [ $# -gt 0 ]; do + case "$1" in + -python) + PYTHON=$2 + shift + ;; + *) + echo "Usage: Usage: ${0##*/} [-python /path/to/bin/python]" + exit 1 + ;; + esac + shift +done + +cd /tmp + +curl -# -LO https://bootstrap.pypa.io/get-pip.py +${PYTHON} get-pip.py --ignore-installed +rm get-pip.py + +${PYTHON} -m pip install --ignore-installed conan From 47d27381599329eb84ddf7e2ccf90673ca9d9daa Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 7 Jun 2018 02:26:54 -0400 Subject: [PATCH 5/7] common.debian: Optimize image size combining RUN instructions --- common.debian | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/common.debian b/common.debian index 4f91915..042e4cb 100644 --- a/common.debian +++ b/common.debian @@ -1,12 +1,13 @@ -RUN REPO=http://cdn-fastly.deb.debian.org && \ - echo "deb $REPO/debian jessie main\ndeb $REPO/debian jessie-updates main\ndeb $REPO/debian-security jessie/updates main" > /etc/apt/sources.list - # Image build scripts COPY imagefiles/install-gosu-binary.sh /buildscripts/ ARG DEBIAN_FRONTEND=noninteractive +ARG REPO=http://cdn-fastly.deb.debian.org RUN \ + bash -c "echo \"deb $REPO/debian jessie main\" > /etc/apt/sources.list" && \ + bash -c "echo \"deb $REPO/debian jessie-updates main\" >> /etc/apt/sources.list" && \ + bash -c "echo \"deb $REPO/debian-security jessie/updates main\" >> /etc/apt/sources.list" && \ apt-get update --yes && \ apt-get install --no-install-recommends --yes \ automake \ From aa202df2835be088a6c1eeb4705a915122a60af4 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Sat, 9 Jun 2018 01:20:20 -0400 Subject: [PATCH 6/7] windows-(x86|x64): Optimize images introducing "common.windows" * Avoid duplication introducing common script * Optimize image size reducing the number of RUN instructions --- Makefile | 5 +- common.windows | 115 ++++++++++++++++++++++++++++++++++++++ windows-x64/Dockerfile | 88 ----------------------------- windows-x64/Dockerfile.in | 20 +++++++ windows-x64/settings.mk | 4 -- windows-x86/Dockerfile | 88 ----------------------------- windows-x86/Dockerfile.in | 21 +++++++ windows-x86/settings.mk | 4 -- 8 files changed, 159 insertions(+), 186 deletions(-) create mode 100644 common.windows delete mode 100644 windows-x64/Dockerfile create mode 100644 windows-x64/Dockerfile.in delete mode 100644 windows-x64/settings.mk delete mode 100644 windows-x86/Dockerfile create mode 100644 windows-x86/Dockerfile.in delete mode 100644 windows-x86/settings.mk diff --git a/Makefile b/Makefile index 4700cfa..dda7f54 100644 --- a/Makefile +++ b/Makefile @@ -16,13 +16,13 @@ BIN = ./bin STANDARD_IMAGES = linux-s390x android-arm android-arm64 linux-x86 linux-x64 linux-arm64 linux-armv5 linux-armv6 linux-armv7 linux-mips linux-mipsel linux-ppc64le windows-x86 windows-x64 # Generated Dockerfiles. -GEN_IMAGES = linux-s390x linux-mips manylinux-x86 manylinux-x64 browser-asmjs linux-arm64 +GEN_IMAGES = linux-s390x linux-mips manylinux-x86 manylinux-x64 browser-asmjs linux-arm64 windows-x86 windows-x64 GEN_IMAGE_DOCKERFILES = $(addsuffix /Dockerfile,$(GEN_IMAGES)) # These images are expected to have explicit rules for *both* build and testing NON_STANDARD_IMAGES = browser-asmjs manylinux-x64 manylinux-x86 -DOCKER_COMPOSITE_SOURCES = common.docker common.debian common.manylinux common.crosstool +DOCKER_COMPOSITE_SOURCES = common.docker common.debian common.manylinux common.crosstool common.windows # This list all available images IMAGES = $(STANDARD_IMAGES) $(NON_STANDARD_IMAGES) @@ -59,6 +59,7 @@ $(GEN_IMAGE_DOCKERFILES) Dockerfile: %Dockerfile: %Dockerfile.in $(DOCKER_COMPOS -e '/common.debian/ r common.debian' \ -e '/common.manylinux/ r common.manylinux' \ -e '/common.crosstool/ r common.crosstool' \ + -e '/common.windows/ r common.windows' \ $< > $@ # diff --git a/common.windows b/common.windows new file mode 100644 index 0000000..da751c9 --- /dev/null +++ b/common.windows @@ -0,0 +1,115 @@ + +# +# Before including this script, make sure to set: +# +# WINEARCH environment variable to either "win64" or "win32" +# MXE_TARGET_ARCH argument to either "x86_64" or "i686". See http://mxe.cc/ +# +# For example: +# +# ENV WINEARCH win64 +# ARG MXE_TARGET_ARCH=x86_64 +# + +# mxe master 2017-10-25 +ARG MXE_GIT_TAG=994ad47302e8811614b7eb49fc05234942b95b89 + +ENV CMAKE_TOOLCHAIN_FILE /usr/src/mxe/usr/${MXE_TARGET_ARCH}-w64-mingw32.static/share/cmake/mxe-conf.cmake + +ARG DEBIAN_FRONTEND=noninteractive + +# +# WINE is used as an emulator for try_run and tests with CMake. +# +# Other dependencies are from the listed MXE requirements: +# http://mxe.cc/#requirements +# 'cmake' is omitted because it is installed from source in the base image +# +RUN \ + apt-get update && \ + apt-get -y install \ + autoconf \ + automake \ + autopoint \ + bash \ + bison \ + bzip2 \ + flex \ + gettext \ + git \ + g++ \ + g++-multilib \ + gperf \ + intltool \ + libffi-dev \ + libgdk-pixbuf2.0-dev \ + libtool-bin \ + libltdl-dev \ + libssl-dev \ + libxml-parser-perl \ + libc6-dev-i386 \ + make \ + openssl \ + p7zip-full \ + patch \ + perl \ + pkg-config \ + python \ + ruby \ + scons \ + sed \ + unzip \ + wget \ + wine \ + xz-utils \ + && \ + # + # Install Wine + # + dpkg --add-architecture i386 && \ + apt-get update && \ + apt-get install -y wine32 && \ + wine hostname && \ + # + # Download MXE sources + # + cd /usr/src && \ + git clone https://github.com/mxe/mxe.git && \ + cd mxe && \ + git checkout ${MXE_GIT_TAG} && \ + # + # Configure "settings.mk" required to build MXE + # + cd /usr/src/mxe && \ + echo "MXE_TARGETS := ${MXE_TARGET_ARCH}-w64-mingw32.static" > settings.mk && \ + echo "LOCAL_PKG_LIST := gcc" >> settings.mk && \ + echo ".DEFAULT local-pkg-list:" >> settings.mk && \ + echo "local-pkg-list: \$(LOCAL_PKG_LIST)" >> settings.mk && \ + # + # Build MXE + # + cd /usr/src/mxe && \ + make -j$(nproc) && \ + # + # Update MXE toolchain file + # + echo 'set(CMAKE_CROSSCOMPILING_EMULATOR "/usr/bin/wine")' >> ${CMAKE_TOOLCHAIN_FILE} && \ + # + # Replace cmake and cpack binaries + # + cd /usr/bin && \ + rm cmake cpack && \ + ln -s /usr/src/mxe/usr/bin/${MXE_TARGET_ARCH}-w64-mingw32.static-cmake cmake && \ + ln -s /usr/src/mxe/usr/bin/${MXE_TARGET_ARCH}-w64-mingw32.static-cpack cpack + +ENV PATH ${PATH}:/usr/src/mxe/usr/bin +ENV CROSS_TRIPLE ${MXE_TARGET_ARCH}-w64-mingw32.static +ENV AS=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-as \ + AR=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-ar \ + CC=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-gcc \ + CPP=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-cpp \ + CXX=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-g++ \ + LD=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-ld \ + FC=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-gfortran + +WORKDIR /work diff --git a/windows-x64/Dockerfile b/windows-x64/Dockerfile deleted file mode 100644 index 6005047..0000000 --- a/windows-x64/Dockerfile +++ /dev/null @@ -1,88 +0,0 @@ -FROM dockcross/base:latest -MAINTAINER Matt McCormick "matt.mccormick@kitware.com" - -# WINE is used as an emulator for try_run and tests with CMake. -# Other dependencies are from the listed MXE requirements: -# http://mxe.cc/#requirements -# 'cmake' is omitted because it is installed from source in the base image -RUN apt-get update && apt-get -y install \ - autoconf \ - automake \ - autopoint \ - bash \ - bison \ - bzip2 \ - flex \ - gettext \ - git \ - g++ \ - g++-multilib \ - gperf \ - intltool \ - libffi-dev \ - libgdk-pixbuf2.0-dev \ - libtool-bin \ - libltdl-dev \ - libssl-dev \ - libxml-parser-perl \ - libc6-dev-i386 \ - make \ - openssl \ - p7zip-full \ - patch \ - perl \ - pkg-config \ - python \ - ruby \ - scons \ - sed \ - unzip \ - wget \ - wine \ - xz-utils -# Set up wine -RUN dpkg --add-architecture i386 && \ - apt-get update && \ - apt-get install -y wine32 -ENV WINEARCH win64 -RUN wine hostname - -WORKDIR /usr/src -# mxe master 2017-10-25 -RUN git clone https://github.com/mxe/mxe.git && \ - cd mxe && \ - git checkout 994ad47302e8811614b7eb49fc05234942b95b89 -WORKDIR /usr/src/mxe -COPY settings.mk /usr/src/mxe/ -RUN make -j$(nproc) - -ENV PATH ${PATH}:/usr/src/mxe/usr/bin -ENV CROSS_TRIPLE x86_64-w64-mingw32.static -ENV AS=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-as \ - AR=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-ar \ - CC=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-gcc \ - CPP=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-cpp \ - CXX=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-g++ \ - LD=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-ld \ - FC=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-gfortran - -ENV DEFAULT_DOCKCROSS_IMAGE dockcross/windows-x64 -WORKDIR /work - -ENV CMAKE_TOOLCHAIN_FILE /usr/src/mxe/usr/x86_64-w64-mingw32.static/share/cmake/mxe-conf.cmake -RUN echo 'set(CMAKE_CROSSCOMPILING_EMULATOR "/usr/bin/wine")' >> ${CMAKE_TOOLCHAIN_FILE} -RUN cd /usr/local/bin \ - && rm cmake \ - && ln -s /usr/src/mxe/usr/bin/x86_64-w64-mingw32.static-cmake cmake \ - && ln -s /usr/src/mxe/usr/bin/x86_64-w64-mingw32.static-cpack cpack - -# Build-time metadata as defined at http://label-schema.org -ARG BUILD_DATE -ARG IMAGE -ARG VCS_REF -ARG VCS_URL -LABEL org.label-schema.build-date=$BUILD_DATE \ - org.label-schema.name=$IMAGE \ - org.label-schema.vcs-ref=$VCS_REF \ - org.label-schema.vcs-url=$VCS_URL \ - org.label-schema.schema-version="1.0" diff --git a/windows-x64/Dockerfile.in b/windows-x64/Dockerfile.in new file mode 100644 index 0000000..b1bec6a --- /dev/null +++ b/windows-x64/Dockerfile.in @@ -0,0 +1,20 @@ +FROM dockcross/base:latest +MAINTAINER Matt McCormick "matt.mccormick@kitware.com" + +ENV WINEARCH win64 +ARG MXE_TARGET_ARCH=x86_64 + +#include "common.windows" + +ENV DEFAULT_DOCKCROSS_IMAGE dockcross/windows-x64 + +# Build-time metadata as defined at http://label-schema.org +ARG BUILD_DATE +ARG IMAGE +ARG VCS_REF +ARG VCS_URL +LABEL org.label-schema.build-date=$BUILD_DATE \ + org.label-schema.name=$IMAGE \ + org.label-schema.vcs-ref=$VCS_REF \ + org.label-schema.vcs-url=$VCS_URL \ + org.label-schema.schema-version="1.0" diff --git a/windows-x64/settings.mk b/windows-x64/settings.mk deleted file mode 100644 index 1f8e4ef..0000000 --- a/windows-x64/settings.mk +++ /dev/null @@ -1,4 +0,0 @@ -MXE_TARGETS := x86_64-w64-mingw32.static -LOCAL_PKG_LIST := gcc -.DEFAULT local-pkg-list: -local-pkg-list: $(LOCAL_PKG_LIST) diff --git a/windows-x86/Dockerfile b/windows-x86/Dockerfile deleted file mode 100644 index 542d3a6..0000000 --- a/windows-x86/Dockerfile +++ /dev/null @@ -1,88 +0,0 @@ -FROM dockcross/base:latest -MAINTAINER Matt McCormick "matt.mccormick@kitware.com" - -# WINE is used as an emulator for try_run and tests with CMake. -# Other dependencies are from the listed MXE requirements: -# http://mxe.cc/#requirements -# 'cmake' is omitted because it is installed from source in the base image -RUN apt-get update && apt-get -y --force-yes install \ - autoconf \ - automake \ - autopoint \ - bash \ - bison \ - bzip2 \ - flex \ - gettext \ - git \ - g++ \ - g++-multilib \ - gperf \ - intltool \ - libffi-dev \ - libgdk-pixbuf2.0-dev \ - libtool-bin \ - libltdl-dev \ - libssl-dev \ - libxml-parser-perl \ - libc6-dev-i386 \ - make \ - openssl \ - p7zip-full \ - patch \ - perl \ - pkg-config \ - python \ - ruby \ - scons \ - sed \ - unzip \ - wget \ - wine \ - xz-utils -# Set up wine -RUN dpkg --add-architecture i386 && \ - apt-get update && \ - apt-get install -y wine32 -ENV WINEARCH win32 -RUN wine hostname - -WORKDIR /usr/src -# mxe master 2017-10-25 -RUN git clone https://github.com/mxe/mxe.git && \ - cd mxe && \ - git checkout 994ad47302e8811614b7eb49fc05234942b95b89 -WORKDIR /usr/src/mxe -COPY settings.mk /usr/src/mxe/ -RUN make -j$(nproc) - -ENV PATH ${PATH}:/usr/src/mxe/usr/bin -ENV CROSS_TRIPLE i686-w64-mingw32.static -ENV AS=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-as \ - AR=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-ar \ - CC=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-gcc \ - CPP=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-cpp \ - CXX=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-g++ \ - LD=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-ld \ - FC=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-gfortran - -ENV DEFAULT_DOCKCROSS_IMAGE dockcross/windows-x86 -WORKDIR /work - -ENV CMAKE_TOOLCHAIN_FILE /usr/src/mxe/usr/i686-w64-mingw32.static/share/cmake/mxe-conf.cmake -RUN echo 'set(CMAKE_CROSSCOMPILING_EMULATOR "/usr/bin/wine")' >> ${CMAKE_TOOLCHAIN_FILE} -RUN cd /usr/local/bin \ - && rm cmake \ - && ln -s /usr/src/mxe/usr/bin/i686-w64-mingw32.static-cmake cmake \ - && ln -s /usr/src/mxe/usr/bin/i686-w64-mingw32.static-cpack cpack - -# Build-time metadata as defined at http://label-schema.org -ARG BUILD_DATE -ARG IMAGE -ARG VCS_REF -ARG VCS_URL -LABEL org.label-schema.build-date=$BUILD_DATE \ - org.label-schema.name=$IMAGE \ - org.label-schema.vcs-ref=$VCS_REF \ - org.label-schema.vcs-url=$VCS_URL \ - org.label-schema.schema-version="1.0" diff --git a/windows-x86/Dockerfile.in b/windows-x86/Dockerfile.in new file mode 100644 index 0000000..a21f1dc --- /dev/null +++ b/windows-x86/Dockerfile.in @@ -0,0 +1,21 @@ +FROM dockcross/base:latest +MAINTAINER Matt McCormick "matt.mccormick@kitware.com" + +ENV WINEARCH win32 +ARG MXE_TARGET_ARCH=i686 + +#include "common.windows" + +ENV DEFAULT_DOCKCROSS_IMAGE dockcross/windows-x86 +WORKDIR /work + +# Build-time metadata as defined at http://label-schema.org +ARG BUILD_DATE +ARG IMAGE +ARG VCS_REF +ARG VCS_URL +LABEL org.label-schema.build-date=$BUILD_DATE \ + org.label-schema.name=$IMAGE \ + org.label-schema.vcs-ref=$VCS_REF \ + org.label-schema.vcs-url=$VCS_URL \ + org.label-schema.schema-version="1.0" diff --git a/windows-x86/settings.mk b/windows-x86/settings.mk deleted file mode 100644 index 582532f..0000000 --- a/windows-x86/settings.mk +++ /dev/null @@ -1,4 +0,0 @@ -MXE_TARGETS := i686-w64-mingw32.static -LOCAL_PKG_LIST := gcc -.DEFAULT local-pkg-list: -local-pkg-list: $(LOCAL_PKG_LIST) From 2e1e18e187d1754408d1e5e9826bcbe1390b45bf Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Sat, 9 Jun 2018 14:14:19 -0400 Subject: [PATCH 7/7] common.docker: Speed-up manylinux-x86 image build downloading CMake binary x86 version of CMake compatible with Centos5 is now available at https://github.com/dockbuild/CMake/releases --- common.docker | 20 ++++++-------------- imagefiles/install-cmake-binary.sh | 18 +++++++++++++++++- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/common.docker b/common.docker index 4bdf191..d7ae3c6 100644 --- a/common.docker +++ b/common.docker @@ -18,26 +18,18 @@ COPY \ /buildscripts/ RUN \ - if [ "$DEFAULT_DOCKCROSS_IMAGE" = "dockcross/manylinux-x86" ]; then \ - /buildscripts/build-and-install-openssl.sh -32 && \ - /buildscripts/build-and-install-openssh.sh && \ - /buildscripts/build-and-install-curl.sh && \ - /buildscripts/build-and-install-git.sh && \ - /buildscripts/build-and-install-cmake.sh -32 || exit 1; \ - else \ - /buildscripts/build-and-install-openssl.sh && \ - /buildscripts/build-and-install-openssh.sh && \ - /buildscripts/build-and-install-curl.sh && \ - /buildscripts/build-and-install-git.sh && \ - /buildscripts/install-cmake-binary.sh || exit 1; \ - fi; \ + X86_FLAG=$([ "$DEFAULT_DOCKCROSS_IMAGE" = "dockcross/manylinux-x86" ] && echo "-32" || echo "") && \ + /buildscripts/build-and-install-openssl.sh $X86_FLAG && \ + /buildscripts/build-and-install-openssh.sh && \ + /buildscripts/build-and-install-curl.sh && \ + /buildscripts/build-and-install-git.sh && \ + /buildscripts/install-cmake-binary.sh $X86_FLAG && \ /buildscripts/install-liquidprompt-binary.sh && \ PYTHON=$([ -e /opt/python/cp35-cp35m/bin/python ] && echo "/opt/python/cp35-cp35m/bin/python" || echo "python") && \ /buildscripts/install-python-packages.sh -python ${PYTHON} && \ /buildscripts/build-and-install-ninja.sh -python ${PYTHON} && \ rm -rf /buildscripts - RUN echo "root:root" | chpasswd WORKDIR /work ENTRYPOINT ["/dockcross/entrypoint.sh"] diff --git a/imagefiles/install-cmake-binary.sh b/imagefiles/install-cmake-binary.sh index edb8de8..575775f 100755 --- a/imagefiles/install-cmake-binary.sh +++ b/imagefiles/install-cmake-binary.sh @@ -1,6 +1,22 @@ #!/bin/bash set -ex +set -o pipefail + +ARCH="x86_64" + +while [ $# -gt 0 ]; do + case "$1" in + -32) + ARCH="x86" + ;; + *) + echo "Usage: Usage: ${0##*/} [-32]" + exit 1 + ;; + esac + shift +done if ! command -v curl &> /dev/null; then echo >&2 'error: "curl" not found!' @@ -19,7 +35,7 @@ fi cd /usr/src -CMAKE_ROOT=cmake-${CMAKE_VERSION}-Centos5-x86_64 +CMAKE_ROOT=cmake-${CMAKE_VERSION}-Centos5-${ARCH} url=https://github.com/dockbuild/CMake/releases/download/v${CMAKE_VERSION}/${CMAKE_ROOT}.tar.gz echo "Downloading $url" curl -# -LO $url