Skip to content

Commit d4dc1d7

Browse files
committed
one more time
1 parent ff52208 commit d4dc1d7

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

.github/workflows/build_gcc.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ env:
1010
OUTPUT_DIR: /tmp/toolchain/output
1111
WORK_DIR: /tmp/toolchain/work
1212
BUILD_GCC_SH: ./infra/gcc/build_gcc.sh
13-
SUDO: "sudo"
1413

1514
GCC_VERSION: 15
1615
LIBC: gnu

infra/gcc/Dockerfile

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,26 @@
11
FROM ubuntu:latest
22

3+
# =================
4+
# || Create User ||
5+
# =================
6+
# ct-ng cant build as root; it needs to run as a user.
7+
# as well, github actions need sudo to install ct-ng after building and to do apt install
8+
RUN apt update && DEBIAN_FRONTEND=noninteractive apt install -y sudo
9+
10+
RUN useradd -m -s /bin/bash builder && \
11+
usermod -aG sudo builder
12+
RUN echo "builder ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
13+
USER builder
14+
WORKDIR /home/builder
15+
16+
# =======================
17+
# || Environment Setup ||
18+
# =======================
319
ENV CT_NG_SRC_DIR="/tmp/crosstool-ng"
420
ENV ARTIFACT_DIR="/tmp/toolchain/artifacts"
521
ENV OUTPUT_DIR="/tmp/toolchain/output"
622
ENV WORK_DIR="/tmp/toolchain/work"
723
ENV BUILD_GCC_SH="/tmp/build_gcc.sh"
8-
ENV SUDO=""
924

1025
RUN mkdir -p $CT_NG_SRC_DIR
1126
RUN mkdir -p $ARTIFACT_DIR
@@ -19,6 +34,9 @@ ARG LIBC=gnu
1934
ARG LIBC_VERSION=2.34
2035
ARG REBUILD_ID=1
2136

37+
# =====================
38+
# || Build Toolchain ||
39+
# =====================
2240
RUN $BUILD_GCC_SH install_dependencies
2341
RUN $BUILD_GCC_SH build_crosstool_ng
2442
RUN $BUILD_GCC_SH configure_toolchain

infra/gcc/build_gcc.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ ensure_environment_variables() {
1313
}
1414

1515
install_dependencies() {
16-
$SUDO apt update
17-
DEBIAN_FRONTEND=noninteractive $SUDO apt install -y \
16+
sudo apt update
17+
DEBIAN_FRONTEND=noninteractive sudo apt install -y \
1818
build-essential \
1919
autoconf \
2020
flex \
@@ -41,7 +41,7 @@ build_crosstool_ng() {
4141
./bootstrap
4242
./configure
4343
make
44-
make install
44+
sudo make install
4545
popd
4646
}
4747

0 commit comments

Comments
 (0)