@@ -42,22 +42,49 @@ RUN apt-get update -qq && DEBIAN_FRONTEND="noninteractive" apt-get install -y -q
4242 npm \
4343 unzip
4444
45- RUN mkdir /tools
45+ RUN mkdir -p /tools
4646WORKDIR /tools
4747
4848RUN mkdir -p /tools/nuttx-tools
4949RUN curl -s -L https://bitbucket.org/nuttx/tools/get/9ad3e1ee75c7.tar.gz \
5050 | tar -C nuttx-tools --strip-components=1 -xz
5151
52- RUN mkdir bloaty -p \
53- && git clone --depth 1 --branch v1.1 https://github.com/google/bloaty bloaty \
54- && cd bloaty \
55- && cmake -DCMAKE_SYSTEM_PREFIX_PATH=/tools/bloaty \
56- && make install
52+ RUN mkdir -p /tools/bloaty \
53+ && git clone --depth 1 --branch v1.1 https://github.com/google/bloaty bloaty-src \
54+ && cd bloaty-src \
55+ && cmake -B build -DCMAKE_INSTALL_PREFIX=/tools/bloaty \
56+ && cmake --build build \
57+ && cmake --build build --target install \
58+ && cd /tools && rm -rf bloaty-src
5759
5860RUN cd nuttx-tools/kconfig-frontends \
5961 && ./configure --enable-mconf --disable-gconf --disable-qconf --enable-static --prefix=/tools/kconfig-frontends \
60- && make install
62+ && make install && cd /tools && rm -rf nuttx-tools
63+
64+ RUN mkdir -p /tools/gn \
65+ && cd /tools/gn \
66+ && git clone https://gn.googlesource.com/gn gn \
67+ && cd gn && ./build/gen.py \
68+ && cd out && ninja
69+
70+ ENV ZAP_INSTALL_PATH=/tools/zap_release
71+ RUN mkdir -p $ZAP_INSTALL_PATH \
72+ && cd $ZAP_INSTALL_PATH \
73+ && curl -s -O -L https://github.com/project-chip/zap/releases/download/v2023.10.09-nightly/zap-linux-x64.zip \
74+ && unzip zap-linux-x64.zip \
75+ && rm zap-linux-x64.zip
76+
77+ ENV ZAP_DEVELOPMENT_PATH=/tools/zap
78+ RUN cd /tools \
79+ && curl -s -O -L https://github.com/project-chip/zap/archive/refs/tags/v2023.10.09-nightly.zip \
80+ && unzip v2023.10.09-nightly.zip \
81+ && mv zap-2023.10.09-nightly zap \
82+ && rm v2023.10.09-nightly.zip \
83+ && cd zap && npm install cross-spawn folder-hash
84+
85+ # ########################
86+ # Programming languages
87+ # ########################
6188
6289# Install Rust and targets supported from NuttX
6390ENV RUST_HOME=/tools/rust
@@ -70,49 +97,31 @@ RUN mkdir -p $CARGO_HOME \
7097 && $CARGO_HOME/bin/rustup target add riscv64gc-unknown-none-elf
7198
7299# Install Swift
73- ENV SWIFT_VERSION=6.0-DEVELOPMENT-SNAPSHOT-2024-08-22-a
74- ENV SWIFT_HOME=/tools/swift
75- RUN mkdir -p ${SWIFT_HOME} \
76- && curl -s -O -L https://download.swift.org/swift-6.0-branch/ubuntu2204/swift-${SWIFT_VERSION}/swift-${SWIFT_VERSION}-ubuntu22.04.tar.gz \
77- && tar xzf swift-${SWIFT_VERSION}-ubuntu22.04.tar.gz -C ${SWIFT_HOME} \
78- && rm swift-${SWIFT_VERSION}-ubuntu22.04.tar.gz
100+ # ENV SWIFT_VERSION=6.0-DEVELOPMENT-SNAPSHOT-2024-08-22-a
101+ # ENV SWIFT_HOME=/tools/swift
102+ # RUN mkdir -p ${SWIFT_HOME} \
103+ # && curl -s -O -L https://download.swift.org/swift-6.0-branch/ubuntu2204/swift-${SWIFT_VERSION}/swift-${SWIFT_VERSION}-ubuntu22.04.tar.gz \
104+ # && tar xzf swift-${SWIFT_VERSION}-ubuntu22.04.tar.gz -C ${SWIFT_HOME} \
105+ # && rm swift-${SWIFT_VERSION}-ubuntu22.04.tar.gz
79106
80107# Install Zig latest release
81108ENV ZIG_VERSION=0.13.0
82109ENV ZIG_HOME=/tools/zig
83110RUN mkdir -p ${ZIG_HOME} \
84- && curl -s -O -L https://github.com/marler8997/zigup/releases/download/v2024_05_05/zigup-x86_64-linux.tar.gz \
85- && tar xzf zigup-x86_64-linux.tar.gz -C ${ZIG_HOME} \
86- && rm zigup-x86_64-linux.tar.gz \
87- && chmod +x ${ZIG_HOME}/zigup \
88- && ${ZIG_HOME}/zigup fetch --install-dir ${ZIG_HOME} ${ZIG_VERSION} \
89- && chmod +x ${ZIG_HOME}/${ZIG_VERSION}/files/zig
90-
111+ && curl -s -O -L https://github.com/marler8997/zigup/releases/download/v2024_05_05/zigup-x86_64-linux.tar.gz \
112+ && tar xzf zigup-x86_64-linux.tar.gz -C ${ZIG_HOME} \
113+ && rm zigup-x86_64-linux.tar.gz \
114+ && chmod +x ${ZIG_HOME}/zigup \
115+ && ${ZIG_HOME}/zigup fetch --install-dir ${ZIG_HOME} ${ZIG_VERSION} \
116+ && chmod +x ${ZIG_HOME}/${ZIG_VERSION}/files/zig
91117
92118# Install LDC2 latest release
93119ENV LDC_VERSION=1.39.0
94120ENV D_HOME=/tools/ldc2
95121RUN mkdir -p ${D_HOME} \
96- && curl -s -O -L https://github.com/ldc-developers/ldc/releases/download/v${LDC_VERSION}/ldc2-${LDC_VERSION}-linux-x86_64.tar.xz \
97- && tar xf ldc2-${LDC_VERSION}-linux-x86_64.tar.xz -C ${D_HOME} \
98- && rm ldc2-${LDC_VERSION}-linux-x86_64.tar.xz
99-
100- RUN mkdir /tools/gn -p \
101- && cd /tools/gn \
102- && git clone https://gn.googlesource.com/gn gn \
103- && cd gn && ./build/gen.py && cd out && ninja
104-
105- ENV ZAP_INSTALL_PATH=/tools/zap_release
106- RUN mkdir $ZAP_INSTALL_PATH -p \
107- && cd $ZAP_INSTALL_PATH \
108- && curl -s -O -L https://github.com/project-chip/zap/releases/download/v2023.10.09-nightly/zap-linux-x64.zip \
109- && unzip zap-linux-x64.zip
110-
111- ENV ZAP_DEVELOPMENT_PATH=/tools/zap
112- RUN cd /tools \
113- && curl -s -O -L https://github.com/project-chip/zap/archive/refs/tags/v2023.10.09-nightly.zip \
114- && unzip v2023.10.09-nightly.zip && mv zap-2023.10.09-nightly zap \
115- && cd zap && npm install cross-spawn folder-hash
122+ && curl -s -O -L https://github.com/ldc-developers/ldc/releases/download/v${LDC_VERSION}/ldc2-${LDC_VERSION}-linux-x86_64.tar.xz \
123+ && tar xf ldc2-${LDC_VERSION}-linux-x86_64.tar.xz -C ${D_HOME} \
124+ && rm ldc2-${LDC_VERSION}-linux-x86_64.tar.xz
116125
117126CMD [ "/bin/bash" ]
118127
@@ -121,22 +130,22 @@ CMD [ "/bin/bash" ]
121130# ##############################################################################
122131FROM builder-base AS nuttx-toolchain-base
123132
124- RUN mkdir /tools
133+ RUN mkdir -p /tools
125134WORKDIR /tools
126135
127136# ##############################################################################
128137# Build image for tool required by ARM builds
129138# ##############################################################################
130139FROM nuttx-toolchain-base AS nuttx-toolchain-arm
131140# Download the latest ARM clang toolchain prebuilt by ARM
132- RUN mkdir clang-arm-none-eabi && \
141+ RUN mkdir -p clang-arm-none-eabi && \
133142 curl -s -L "https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-17.0.1/LLVMEmbeddedToolchainForArm-17.0.1-Linux-x86_64.tar.xz" \
134- | tar -C clang-arm-none-eabi --strip-components 1 -xJ
143+ | tar -C clang-arm-none-eabi --strip-components= 1 -xJ
135144
136145# Download the latest ARM GCC toolchain prebuilt by ARM
137- RUN mkdir gcc-arm-none-eabi && \
146+ RUN mkdir -p gcc-arm-none-eabi && \
138147 curl -s -L "https://developer.arm.com/-/media/Files/downloads/gnu/13.2.Rel1/binrel/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi.tar.xz" \
139- | tar -C gcc-arm-none-eabi --strip-components 1 -xJ
148+ | tar -C gcc-arm-none-eabi --strip-components= 1 -xJ
140149
141150# ##############################################################################
142151# Build image for tool required by ARM64 builds
@@ -145,7 +154,7 @@ FROM nuttx-toolchain-base AS nuttx-toolchain-arm64
145154# Download the latest ARM64 GCC toolchain prebuilt by ARM
146155RUN mkdir gcc-aarch64-none-elf && \
147156 curl -s -L "https://developer.arm.com/-/media/Files/downloads/gnu/13.2.Rel1/binrel/arm-gnu-toolchain-13.2.Rel1-x86_64-aarch64-none-elf.tar.xz" \
148- | tar -C gcc-aarch64-none-elf --strip-components 1 -xJ
157+ | tar -C gcc-aarch64-none-elf --strip-components= 1 -xJ
149158
150159# ##############################################################################
151160# Build image for tool required by AVR32 builds
@@ -164,7 +173,7 @@ RUN mkdir -p gcc-avr32-gnu && \
164173FROM nuttx-toolchain-base AS nuttx-toolchain-pinguino
165174# Download the pinguino compilers. Note this includes both 8bit and 32bit
166175# toolchains and builds for multiple host systems. Only copy what is needed.
167- RUN mkdir pinguino-compilers && \
176+ RUN mkdir -p pinguino-compilers && \
168177 curl -s -L "https://github.com/PinguinoIDE/pinguino-compilers/archive/62db5158d7f6d41c6fadb05de81cc31dd81a1958.tar.gz" \
169178 | tar -C pinguino-compilers --strip-components=2 --wildcards -xz */linux64
170179
@@ -224,25 +233,25 @@ RUN cd renesas-tools/source/newlib && \
224233 /tools/renesas-tools/source/newlib/configure --target=rx-elf --prefix=/tools/renesas-toolchain/rx-elf-gcc && \
225234 make && make install
226235RUN cd /tools/renesas-tools/build/gcc && \
227- make && make install
236+ make && make install && cd /tools && rm -rf renesas-tools
228237
229238# ##############################################################################
230239# Build image for tool required by RISCV builds
231240# ##############################################################################
232241FROM nuttx-toolchain-base AS nuttx-toolchain-riscv
233242# Download the latest RISCV GCC toolchain prebuilt by xPack
234- RUN mkdir riscv-none-elf-gcc && \
243+ RUN mkdir -p riscv-none-elf-gcc && \
235244 curl -s -L "https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v13.2.0-2/xpack-riscv-none-elf-gcc-13.2.0-2-linux-x64.tar.gz" \
236- | tar -C riscv-none-elf-gcc --strip-components 1 -xz
245+ | tar -C riscv-none-elf-gcc --strip-components= 1 -xz
237246
238247# ##############################################################################
239248# Build image for tool required by SPARC builds
240249# ##############################################################################
241250FROM nuttx-toolchain-base AS nuttx-toolchain-sparc
242251# Download the SPARC GCC toolchain prebuilt by Gaisler
243- RUN mkdir sparc-gaisler-elf-gcc && \
252+ RUN mkdir -p sparc-gaisler-elf-gcc && \
244253 curl -s -L "https://www.gaisler.com/anonftp/bcc2/bin/bcc-2.1.0-gcc-linux64.tar.xz" \
245- | tar -C sparc-gaisler-elf-gcc --strip-components 1 -xJ
254+ | tar -C sparc-gaisler-elf-gcc --strip-components= 1 -xJ
246255
247256# ##############################################################################
248257# Build image for tool required by ESP32 builds
@@ -251,15 +260,15 @@ FROM nuttx-toolchain-base AS nuttx-toolchain-esp32
251260# Download the latest ESP32 GCC toolchain prebuilt by Espressif
252261RUN mkdir -p xtensa-esp32-elf-gcc && \
253262 curl -s -L "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32-elf-12.2.0_20230208-x86_64-linux-gnu.tar.xz" \
254- | tar -C xtensa-esp32-elf-gcc --strip-components 1 -xJ
263+ | tar -C xtensa-esp32-elf-gcc --strip-components= 1 -xJ
255264
256265RUN mkdir -p xtensa-esp32s2-elf-gcc && \
257266 curl -s -L "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32s2-elf-12.2.0_20230208-x86_64-linux-gnu.tar.xz" \
258- | tar -C xtensa-esp32s2-elf-gcc --strip-components 1 -xJ
267+ | tar -C xtensa-esp32s2-elf-gcc --strip-components= 1 -xJ
259268
260269RUN mkdir -p xtensa-esp32s3-elf-gcc && \
261270 curl -s -L "https://github.com/espressif/crosstool-NG/releases/download/esp-12.2.0_20230208/xtensa-esp32s3-elf-12.2.0_20230208-x86_64-linux-gnu.tar.xz" \
262- | tar -C xtensa-esp32s3-elf-gcc --strip-components 1 -xJ
271+ | tar -C xtensa-esp32s3-elf-gcc --strip-components= 1 -xJ
263272
264273RUN echo "ESP Binaries: 2022/01/26"
265274RUN mkdir -p /tools/blobs && cd /tools/blobs \
@@ -277,12 +286,12 @@ RUN mkdir -p /tools/blobs && cd /tools/blobs \
277286# ##############################################################################
278287FROM nuttx-toolchain-base AS nuttx-toolchain-wasm
279288# Download the latest WASI-enabled WebAssembly C/C++ toolchain prebuilt by WASM
280- RUN mkdir wasi-sdk && \
289+ RUN mkdir -p wasi-sdk && \
281290 curl -s -L "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-19/wasi-sdk-19.0-linux.tar.gz" \
282- | tar -C wasi-sdk --strip-components 1 -xz
291+ | tar -C wasi-sdk --strip-components= 1 -xz
283292
284293# Download the latest "wamrc" AOT compiler prebuilt by WAMR
285- RUN mkdir wamrc && \
294+ RUN mkdir -p wamrc && \
286295 curl -s -L "https://github.com/bytecodealliance/wasm-micro-runtime/releases/download/WAMR-1.1.2/wamrc-1.1.2-x86_64-ubuntu-20.04.tar.gz" \
287296 | tar -C wamrc -xz
288297
@@ -301,8 +310,8 @@ RUN apt-get update -qq && DEBIAN_FRONTEND="noninteractive" apt-get install -y -q
301310
302311RUN mkdir -p cmake && \
303312 curl -s -L wget https://cmake.org/files/v3.26/cmake-3.26.0.tar.gz \
304- | tar -C cmake --strip-components=1 -xz && \
305- cd cmake && ./bootstrap && make && make install && rm -rf cmake
313+ | tar -C cmake --strip-components=1 -xz \
314+ && cd cmake && ./bootstrap && make && make install && rm -rf cmake
306315
307316RUN dpkg --add-architecture i386
308317# This is used for the final images so make sure to not store apt cache
@@ -396,7 +405,7 @@ RUN npm install -g n && n stable && hash -r
396405
397406# Used to generate symbol table files
398407
399- RUN mkdir /tools
408+ RUN mkdir -p /tools
400409WORKDIR /tools
401410
402411# Pull in the tools we just built for nuttx
@@ -420,14 +429,15 @@ COPY --from=nuttx-tools /tools/ldc2/ /tools/ldc2/
420429ENV PATH="/tools/ldc2/ldc2-1.39.0-linux-x86_64/bin:$PATH"
421430
422431# Pull in the swift 6.0 toolchain
423- COPY --from=nuttx-tools /tools/swift/ /tools/swift/
424- ENV PATH="/tools/swift/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-08-22-a/bin:$PATH"
432+ # COPY --from=nuttx-tools /tools/swift/ /tools/swift/
433+ # ENV PATH="/tools/swift/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-08-22-a/bin:$PATH"
425434
426- # ARM toolchain
435+ # ARM clang toolchain
427436COPY --from=nuttx-toolchain-arm /tools/clang-arm-none-eabi/ clang-arm-none-eabi/
428437# RUN cp /usr/bin/clang-extdef-mapping-10 clang-arm-none-eabi/bin/clang-extdef-mapping
429438ENV PATH="/tools/clang-arm-none-eabi/bin:$PATH"
430439
440+ # ARM GCC toolchain
431441COPY --from=nuttx-toolchain-arm /tools/gcc-arm-none-eabi/ gcc-arm-none-eabi/
432442ENV PATH="/tools/gcc-arm-none-eabi/bin:$PATH"
433443
0 commit comments