dockcross: make the default image specific to each compiler

This commit is contained in:
Matt McCormick 2016-07-04 00:10:36 -04:00
parent aa06b9af2c
commit fdb18671e3
15 changed files with 47 additions and 18 deletions

View File

@ -46,7 +46,7 @@ RUN git clone git://cmake.org/cmake.git CMake && \
make install && \ make install && \
cd .. && \ cd .. && \
rm -rf CMake* rm -rf CMake*
# Build and install Ninja from source # Build and install Ninja from source
RUN git clone https://github.com/martine/ninja.git && \ RUN git clone https://github.com/martine/ninja.git && \
cd ninja && \ cd ninja && \

View File

@ -31,5 +31,7 @@ RUN mkdir -p /build && \
cd / && \ cd / && \
rm -rf /build rm -rf /build
ENV DEFAULT_DOCKCROSS_IMAGE thewtex/cross-compiler-android-arm
COPY Toolchain.cmake ${CROSS_ROOT}/ COPY Toolchain.cmake ${CROSS_ROOT}/
ENV CMAKE_TOOLCHAIN_FILE ${CROSS_ROOT}/Toolchain.cmake ENV CMAKE_TOOLCHAIN_FILE ${CROSS_ROOT}/Toolchain.cmake

View File

@ -36,4 +36,6 @@ RUN cd /tmp && \
$CC /tmp/first_run.c && \ $CC /tmp/first_run.c && \
rm /tmp/first_run.* a.out.js 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 ENV CMAKE_TOOLCHAIN_FILE /usr/emsdk_portable/emscripten/tag-${EMSCRIPTEN_VERSION}/cmake/Modules/Platform/Emscripten.cmake

View File

@ -44,7 +44,7 @@ test:
- make windows-x86: - make windows-x86:
timeout: 3000 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 --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: deployment:
hub: hub:

View File

@ -23,3 +23,5 @@ RUN curl -L https://github.com/tpoechtrager/osxcross/archive/master.tar.gz | tar
mv /osxcross-master/target ${CROSS_ROOT} && \ mv /osxcross-master/target ${CROSS_ROOT} && \
mkdir -p ${CROSS_ROOT}/lib && \ mkdir -p ${CROSS_ROOT}/lib && \
rm -rf /osxcross-master rm -rf /osxcross-master
ENV DEFAULT_DOCKCROSS_IMAGE thewtex/cross-compiler-darwin-x64

View File

@ -1,5 +1,7 @@
#!/bin/bash #!/bin/bash
DEFAULT_DOCKCROSS_IMAGE=thewtex/cross-compiler-base
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Helpers # Helpers
# #
@ -123,14 +125,13 @@ done
# 3. defaults # 3. defaults
# Source the config file if it exists # Source the config file if it exists
DEFAULT_CONFIG=~/.dockcross DEFAULT_DOCKCROSS_CONFIG=~/.dockcross
FINAL_CONFIG=${ARG_CONFIG-${DOCKCROSS_CONFIG-$DEFAULT_CONFIG}} FINAL_CONFIG=${ARG_CONFIG-${DOCKCROSS_CONFIG-$DEFAULT_DOCKCROSS_CONFIG}}
[[ -f "$FINAL_CONFIG" ]] && source "$FINAL_CONFIG" [[ -f "$FINAL_CONFIG" ]] && source "$FINAL_CONFIG"
# Set the docker image # Set the docker image
DEFAULT_IMAGE=thewtex/cross-compiler-base FINAL_IMAGE=${ARG_IMAGE-${DOCKCROSS_IMAGE-$DEFAULT_DOCKCROSS_IMAGE}}
FINAL_IMAGE=${ARG_IMAGE-${DOCKCROSS_IMAGE-$DEFAULT_IMAGE}}
# Set the docker run extra args (if any) # Set the docker run extra args (if any)
FINAL_ARGS=${ARG_ARGS-${DOCKCROSS_ARGS}} FINAL_ARGS=${ARG_ARGS-${DOCKCROSS_ARGS}}
@ -178,11 +179,12 @@ docker run -i -t --rm \
# #
# This image is not intended to be run manually. # 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 # 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.
# #
################################################################################ ################################################################################

View File

@ -4,8 +4,15 @@
# container at runtime. # container at runtime.
if [[ $# == 0 ]]; then if [[ $# == 0 ]]; then
# Presumably the image has been run directly, so help the user get started. # Presumably the image has been run directly, so help the user get
cat /dockcross/dockcross # 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 exit 0
fi fi

View File

@ -27,3 +27,5 @@ ENV AS=/usr/bin/${CROSS_TRIPLE}-as \
ENV QEMU_LD_PREFIX ${CROSS_ROOT}/libc ENV QEMU_LD_PREFIX ${CROSS_ROOT}/libc
ENV QEMU_SET_ENV "LD_LIBRARY_PATH=${CROSS_ROOT}/lib:${CROSS_ROOT}/libc/lib/${CROSS_TRIPLE}/" 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

View File

@ -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_LD_PREFIX ${CROSS_ROOT}/libc
ENV QEMU_SET_ENV "LD_LIBRARY_PATH=${CROSS_ROOT}/lib:${CROSS_ROOT}/libc/lib/${CROSS_TRIPLE}/" 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}/ COPY Toolchain.cmake ${CROSS_ROOT}/
ENV CMAKE_TOOLCHAIN_FILE ${CROSS_ROOT}/Toolchain.cmake ENV CMAKE_TOOLCHAIN_FILE ${CROSS_ROOT}/Toolchain.cmake

View File

@ -25,7 +25,7 @@ ENV AS=/usr/bin/${CROSS_TRIPLE}-as \
CXX=/usr/bin/${CROSS_TRIPLE}-g++ \ CXX=/usr/bin/${CROSS_TRIPLE}-g++ \
LD=/usr/bin/${CROSS_TRIPLE}-ld 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: # Note: Toolchain file support is currently in debian Experimental:
# https://wiki.debian.org/CrossToolchains#In_jessie_.28Debian_8.29 # https://wiki.debian.org/CrossToolchains#In_jessie_.28Debian_8.29

View File

@ -34,6 +34,8 @@ ENV AS=/usr/bin/${CROSS_TRIPLE}-as \
CXX=/usr/bin/${CROSS_TRIPLE}-g++ \ CXX=/usr/bin/${CROSS_TRIPLE}-g++ \
LD=/usr/bin/${CROSS_TRIPLE}-ld 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: # Note: Toolchain file support is currently in debian Experimental according to:
# https://wiki.debian.org/CrossToolchains#In_jessie_.28Debian_8.29 # https://wiki.debian.org/CrossToolchains#In_jessie_.28Debian_8.29
# We can switch to that when it becomes stable. # We can switch to that when it becomes stable.

View File

@ -9,3 +9,5 @@ ENV AS=/usr/bin/${CROSS_TRIPLE}-as \
CPP=/usr/bin/${CROSS_TRIPLE}-cpp \ CPP=/usr/bin/${CROSS_TRIPLE}-cpp \
CXX=/usr/bin/${CROSS_TRIPLE}-g++ \ CXX=/usr/bin/${CROSS_TRIPLE}-g++ \
LD=/usr/bin/${CROSS_TRIPLE}-ld LD=/usr/bin/${CROSS_TRIPLE}-ld
ENV DEFAULT_DOCKCROSS_IMAGE thewtex/cross-compiler-linux-x64

View File

@ -34,6 +34,8 @@ ENV AS=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-as \
CC=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-gcc \ CC=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-gcc \
CXX=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-g++ 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: # Note: Toolchain file support is currently in debian Experimental:
# https://wiki.debian.org/CrossToolchains#In_jessie_.28Debian_8.29 # https://wiki.debian.org/CrossToolchains#In_jessie_.28Debian_8.29
COPY Toolchain.cmake /usr/lib/${CROSS_TRIPLE}/ COPY Toolchain.cmake /usr/lib/${CROSS_TRIPLE}/

View File

@ -57,8 +57,6 @@ COPY settings.mk /usr/src/mxe/
RUN make -j$(nproc) RUN make -j$(nproc)
ENV PATH ${PATH}:/usr/src/mxe/usr/bin 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 CROSS_TRIPLE x86_64-w64-mingw32.static
ENV AS=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-as \ ENV AS=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-as \
AR=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-ar \ 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++ \ CXX=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-g++ \
LD=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-ld 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}

View File

@ -57,8 +57,6 @@ COPY settings.mk /usr/src/mxe/
RUN make -j$(nproc) RUN make -j$(nproc)
ENV PATH ${PATH}:/usr/src/mxe/usr/bin 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 CROSS_TRIPLE i686-w64-mingw32.static
ENV AS=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-as \ ENV AS=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-as \
AR=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-ar \ 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++ \ CXX=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-g++ \
LD=/usr/src/mxe/usr/bin/${CROSS_TRIPLE}-ld 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}