-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile.crosstool-ng
105 lines (89 loc) · 3.19 KB
/
Dockerfile.crosstool-ng
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
## base image
FROM abeimler/simple-cppbuilder:base AS base
ARG extra_libraries
ARG processor="x86_64"
ARG triplet_host="x64-linux"
ARG vcpkg_target_triplet
ARG cross_triple
ARG cmake="cmake"
ARG make="ninja"
ARG cmake_generator="Ninja Multi-Config"
ARG cmake_toolchain_file
# Install packages available from standard repos
RUN pacman-db-upgrade && \
pacman -S --noconfirm --needed \
wget curl pkg-config zip unzip tar go git help2man python unzip wget audit rsync && \
pacman -S --noconfirm \
gcc automake autoconf ${extra_libraries} \
cmake make ninja && \
pacman -Scc --noconfirm
# install crosstool-ng
ARG crosstool_dir="/home/cross/crosstool-ng"
ENV CT_ALLOW_BUILD_AS_ROOT_SURE 1
#COPY ./config/crosstool/crosstool-ng.config.rpi $cross_root/.config
RUN useradd -m -G root -s /bin/bash cross && passwd -d cross && echo "cross ALL=(ALL) ALL" >> /etc/sudoers
#RUN mkdir -p $crosstool_dir && chown cross:root $crosstool_dir
RUN git clone --depth 1 https://github.com/crosstool-ng/crosstool-ng $crosstool_dir
WORKDIR $crosstool_dir
RUN chown -R cross:root . && chmod -R 775 .
USER cross
RUN ./bootstrap && \
./configure --enable-local && \
make
RUN ./ct-ng ${cross_triple} && \
./ct-ng build
USER root
WORKDIR /
ARG cross_root="/home/cross/x-tools/${cross_triple}"
ENV TOOLCHAIN_PATH $cross_root
ENV PATH="${TOOLCHAIN_PATH}/bin:${PATH}"
ARG cc="${cross_triple}-gcc"
ARG cxx="${cross_triple}-g++"
# compiler env settings
#RUN cp ${crosstool_dir}/bash-completion/ct-ng /etc/bash_completion.d/ct-ng
# set default compiler
ENV CC $cc
ENV CXX $cxx
ENV CMAKE $cmake
ENV MAKE $make
# cross compiler settings
ENV PROCESSOR $processor
ENV CROSS_TRIPLET $cross_triple
ENV TARGET_TRIPLET $vcpkg_target_triplet
ENV CROSS_CMAKE $cross_cmake
ENV CROSS_MAKE $cross_make
ENV CROSS "${cross_triple}-"
ENV CROSS_ROOT $cross_root
ENV CROSS_TOOLCHAIN $cmake_toolchain_file
RUN mkdir -p /home/cross && touch /home/cross/.bashrc
ARG setup_env_script="/home/cross/.bashrc"
ARG setup_env_script_args=""
ENV SETUP_ENV_SCRIPT $setup_env_script
ENV SETUP_ENV_SCRIPT_ARGS $setup_env_script_args
RUN echo "source \"$SETUP_ENV_SCRIPT $SETUP_ENV_SCRIPT_ARGS\"" >> /root/.bash_profile && \
. $setup_env_script $setup_env_script_args
# install vcpkg
ENV VCPKG_DEFAULT_HOST_TRIPLET $triplet_host
ENV VCPKG_DEFAULT_TRIPLET $vcpkg_target_triplet
ENV VCPKG_DISABLE_METRICS 1
RUN git clone --depth 1 https://github.com/Microsoft/vcpkg.git /home/project/vcpkg && \
/home/project/vcpkg/bootstrap-vcpkg.sh -disableMetrics
ENV VCPKG_ROOT "/home/project/vcpkg"
ENV CHAINLOAD_TOOLCHAIN_FILE $cmake_toolchain_file
ENV VCPKG_TOOLCHAIN_FILE "$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake"
ENV TOOLCHAIN_FILE "$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake"
ENV VCPKG_CHAINLOAD_TOOLCHAIN_FILE $CHAINLOAD_TOOLCHAIN_FILE
# build script settings
ENV TARGET "all"
ENV BUILD_TYPE "Release"
ENV CMAKE_GENERATOR $cmake_generator
ENV CMAKE_ARGS ""
# setup project env
WORKDIR /home/project
COPY ./cmake /home/cmake
COPY ./scripts/docker-build.crosstool-ng.sh ./docker-build.sh
COPY ./taskfiles/*.yml /home/taskfiles/
COPY ./taskfiles/TaskfileCross.yml /home/taskfiles/Taskfile.yml
ENV PROJECT_DIR /home/project
WORKDIR /home/project
RUN mkdir build