diff --git a/Dockerfile b/Dockerfile index f33ff31..b308870 100644 --- a/Dockerfile +++ b/Dockerfile @@ -46,7 +46,7 @@ RUN git clone git://cmake.org/cmake.git CMake && \ make install && \ cd .. && \ rm -rf CMake* - + # Build and install Ninja from source RUN git clone https://github.com/martine/ninja.git && \ cd ninja && \ diff --git a/android-arm/Dockerfile b/android-arm/Dockerfile index 9a6b6dc..6aa1ae0 100644 --- a/android-arm/Dockerfile +++ b/android-arm/Dockerfile @@ -31,5 +31,7 @@ RUN mkdir -p /build && \ cd / && \ rm -rf /build +ENV DEFAULT_DOCKCROSS_IMAGE thewtex/cross-compiler-android-arm + COPY Toolchain.cmake ${CROSS_ROOT}/ ENV CMAKE_TOOLCHAIN_FILE ${CROSS_ROOT}/Toolchain.cmake diff --git a/browser-asmjs/Dockerfile b/browser-asmjs/Dockerfile index a082ac0..178c815 100644 --- a/browser-asmjs/Dockerfile +++ b/browser-asmjs/Dockerfile @@ -36,4 +36,6 @@ RUN cd /tmp && \ $CC /tmp/first_run.c && \ rm /tmp/first_run.* a.out.js +ENV DEFAULT_DOCKCROSS_IMAGE thewtex/cross-compiler-browser-asmjs + ENV CMAKE_TOOLCHAIN_FILE /usr/emsdk_portable/emscripten/tag-${EMSCRIPTEN_VERSION}/cmake/Modules/Platform/Emscripten.cmake diff --git a/circle.yml b/circle.yml index a65b56f..26c51f0 100644 --- a/circle.yml +++ b/circle.yml @@ -47,7 +47,7 @@ test: - make windows-x86: timeout: 3000 - docker run --rm -v ~/cross-compilers/test/:/usr/src/test:ro thewtex/cross-compiler-windows-x86 python /usr/src/test/run.py --emulator /usr/bin/wine --exe-suffix ".exe" - - docker run thewtex/cross-compiler-linux-armv7 > dockcross && chmod +x dockcross && ./dockcross gcc test/C/hello.c -o hello_arm + - docker run thewtex/cross-compiler-linux-armv7 > ./dockcross && chmod +x ./dockcross && ./dockcross bash -c '$CC test/C/hello.c -o hello_arm' deployment: hub: diff --git a/darwin-x64/Dockerfile b/darwin-x64/Dockerfile index 5288479..6bedc94 100644 --- a/darwin-x64/Dockerfile +++ b/darwin-x64/Dockerfile @@ -23,3 +23,5 @@ RUN curl -L https://github.com/tpoechtrager/osxcross/archive/master.tar.gz | tar mv /osxcross-master/target ${CROSS_ROOT} && \ mkdir -p ${CROSS_ROOT}/lib && \ rm -rf /osxcross-master + +ENV DEFAULT_DOCKCROSS_IMAGE thewtex/cross-compiler-darwin-x64 diff --git a/imagefiles/dockcross b/imagefiles/dockcross index 77de6fc..0411c02 100755 --- a/imagefiles/dockcross +++ b/imagefiles/dockcross @@ -1,5 +1,7 @@ #!/bin/bash +DEFAULT_DOCKCROSS_IMAGE=thewtex/cross-compiler-base + #------------------------------------------------------------------------------ # Helpers # @@ -123,14 +125,13 @@ done # 3. defaults # Source the config file if it exists -DEFAULT_CONFIG=~/.dockcross -FINAL_CONFIG=${ARG_CONFIG-${DOCKCROSS_CONFIG-$DEFAULT_CONFIG}} +DEFAULT_DOCKCROSS_CONFIG=~/.dockcross +FINAL_CONFIG=${ARG_CONFIG-${DOCKCROSS_CONFIG-$DEFAULT_DOCKCROSS_CONFIG}} [[ -f "$FINAL_CONFIG" ]] && source "$FINAL_CONFIG" # Set the docker image -DEFAULT_IMAGE=thewtex/cross-compiler-base -FINAL_IMAGE=${ARG_IMAGE-${DOCKCROSS_IMAGE-$DEFAULT_IMAGE}} +FINAL_IMAGE=${ARG_IMAGE-${DOCKCROSS_IMAGE-$DEFAULT_DOCKCROSS_IMAGE}} # Set the docker run extra args (if any) FINAL_ARGS=${ARG_ARGS-${DOCKCROSS_ARGS}} @@ -178,11 +179,12 @@ docker run -i -t --rm \ # # This image is not intended to be run manually. # -# To install the dockcross helper, run the following commands: +# To create a dockcross helper script for the +# thewtex/cross-compiler-linux-armv7 image, run: # -# docker run thewtex/cross-compiler-linux-armv7 > dockcross +# docker run --rm thewtex/cross-compiler-linux-armv7 > dockcross # chmod +x dockcross # -# You may then wish to move dockcross to somewhere in your path. +# You may then wish to move the dockcross script to somewhere in your path. # ################################################################################ diff --git a/imagefiles/entrypoint.sh b/imagefiles/entrypoint.sh index b278367..15a2082 100755 --- a/imagefiles/entrypoint.sh +++ b/imagefiles/entrypoint.sh @@ -4,8 +4,15 @@ # container at runtime. if [[ $# == 0 ]]; then - # Presumably the image has been run directly, so help the user get started. - cat /dockcross/dockcross + # Presumably the image has been run directly, so help the user get + # started by outputting the dockcross script + if [[ -n $DEFAULT_DOCKCROSS_IMAGE ]]; then + head -n 2 /dockcross/dockcross + echo "DEFAULT_DOCKCROSS_IMAGE=$DEFAULT_DOCKCROSS_IMAGE" + tail -n +4 /dockcross/dockcross + else + cat /dockcross/dockcross + fi exit 0 fi diff --git a/linux-armv5/Dockerfile b/linux-armv5/Dockerfile index d6aad9a..31d0542 100644 --- a/linux-armv5/Dockerfile +++ b/linux-armv5/Dockerfile @@ -28,5 +28,7 @@ ENV AS=/usr/bin/${CROSS_TRIPLE}-as \ ENV QEMU_LD_PREFIX ${CROSS_ROOT}/libc ENV QEMU_SET_ENV "LD_LIBRARY_PATH=${CROSS_ROOT}/lib:${CROSS_ROOT}/libc/lib/${CROSS_TRIPLE}/" +ENV DEFAULT_DOCKCROSS_IMAGE thewtex/cross-compiler-linux-armv5 + COPY Toolchain.cmake ${CROSS_ROOT}/ ENV CMAKE_TOOLCHAIN_FILE ${CROSS_ROOT}/Toolchain.cmake diff --git a/linux-armv6/Dockerfile b/linux-armv6/Dockerfile index 870cc63..e815d54 100644 --- a/linux-armv6/Dockerfile +++ b/linux-armv6/Dockerfile @@ -39,5 +39,7 @@ RUN mkdir rpi_tools && cd rpi_tools && git init && git remote add -f origin http ENV QEMU_LD_PREFIX ${CROSS_ROOT}/libc ENV QEMU_SET_ENV "LD_LIBRARY_PATH=${CROSS_ROOT}/lib:${CROSS_ROOT}/libc/lib/${CROSS_TRIPLE}/" +ENV DEFAULT_DOCKCROSS_IMAGE thewtex/cross-compiler-linux-armv6 + COPY Toolchain.cmake ${CROSS_ROOT}/ ENV CMAKE_TOOLCHAIN_FILE ${CROSS_ROOT}/Toolchain.cmake diff --git a/linux-armv7/Dockerfile b/linux-armv7/Dockerfile index 9573dd5..9b6c652 100644 --- a/linux-armv7/Dockerfile +++ b/linux-armv7/Dockerfile @@ -25,7 +25,7 @@ ENV AS=/usr/bin/${CROSS_TRIPLE}-as \ CXX=/usr/bin/${CROSS_TRIPLE}-g++ \ LD=/usr/bin/${CROSS_TRIPLE}-ld -WORKDIR /build +ENV DEFAULT_DOCKCROSS_IMAGE thewtex/cross-compiler-linux-armv7 # Note: Toolchain file support is currently in debian Experimental: # https://wiki.debian.org/CrossToolchains#In_jessie_.28Debian_8.29 diff --git a/linux-ppc64le/Dockerfile b/linux-ppc64le/Dockerfile index 802444b..09f8e39 100644 --- a/linux-ppc64le/Dockerfile +++ b/linux-ppc64le/Dockerfile @@ -34,6 +34,8 @@ ENV AS=/usr/bin/${CROSS_TRIPLE}-as \ CXX=/usr/bin/${CROSS_TRIPLE}-g++ \ LD=/usr/bin/${CROSS_TRIPLE}-ld +ENV DEFAULT_DOCKCROSS_IMAGE thewtex/cross-compiler-linux-ppc64le + # Note: Toolchain file support is currently in debian Experimental according to: # https://wiki.debian.org/CrossToolchains#In_jessie_.28Debian_8.29 # We can switch to that when it becomes stable. diff --git a/linux-x64/Dockerfile b/linux-x64/Dockerfile index cb93a38..fb8d967 100644 --- a/linux-x64/Dockerfile +++ b/linux-x64/Dockerfile @@ -9,3 +9,5 @@ ENV AS=/usr/bin/${CROSS_TRIPLE}-as \ CPP=/usr/bin/${CROSS_TRIPLE}-cpp \ CXX=/usr/bin/${CROSS_TRIPLE}-g++ \ LD=/usr/bin/${CROSS_TRIPLE}-ld + +ENV DEFAULT_DOCKCROSS_IMAGE thewtex/cross-compiler-linux-x64 diff --git a/linux-x86/Dockerfile b/linux-x86/Dockerfile index bbd9bd1..bc729f8 100644 --- a/linux-x86/Dockerfile +++ b/linux-x86/Dockerfile @@ -34,6 +34,8 @@ ENV AS=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-as \ CC=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-gcc \ CXX=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-g++ +ENV DEFAULT_DOCKCROSS_IMAGE thewtex/cross-compiler-linux-x86 + # Note: Toolchain file support is currently in debian Experimental: # https://wiki.debian.org/CrossToolchains#In_jessie_.28Debian_8.29 COPY Toolchain.cmake /usr/lib/${CROSS_TRIPLE}/ diff --git a/windows-x64/Dockerfile b/windows-x64/Dockerfile index 4671c77..175416d 100644 --- a/windows-x64/Dockerfile +++ b/windows-x64/Dockerfile @@ -57,8 +57,6 @@ COPY settings.mk /usr/src/mxe/ RUN make -j$(nproc) ENV PATH ${PATH}:/usr/src/mxe/usr/bin -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} 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 \ @@ -67,4 +65,8 @@ ENV AS=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-as \ CXX=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-g++ \ LD=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-ld -WORKDIR /usr/src +ENV DEFAULT_DOCKCROSS_IMAGE thewtex/cross-compiler-windows-x64 +WORKDIR /build + +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} diff --git a/windows-x86/Dockerfile b/windows-x86/Dockerfile index e34f8aa..bad451c 100644 --- a/windows-x86/Dockerfile +++ b/windows-x86/Dockerfile @@ -57,8 +57,6 @@ COPY settings.mk /usr/src/mxe/ RUN make -j$(nproc) ENV PATH ${PATH}:/usr/src/mxe/usr/bin -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} 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 \ @@ -67,4 +65,8 @@ ENV AS=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-as \ CXX=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-g++ \ LD=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-ld -WORKDIR /usr/src +ENV DEFAULT_DOCKCROSS_IMAGE thewtex/cross-compiler-windows-x86 +WORKDIR /build + +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}