build: Use xtrace in bash scripts in Dockerfile
This commit is contained in:
parent
a4ad72e11d
commit
4ed04b343a
1 changed files with 11 additions and 3 deletions
|
@ -18,13 +18,14 @@ ARG LLVM_VERSION=19
|
||||||
# Line three: for xx-verify
|
# Line three: for xx-verify
|
||||||
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
||||||
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
||||||
apt-get update && apt-get install -y \
|
apt-get update && apt-get install -y \
|
||||||
clang-${LLVM_VERSION} lld-${LLVM_VERSION} pkg-config make jq \
|
clang-${LLVM_VERSION} lld-${LLVM_VERSION} pkg-config make jq \
|
||||||
curl git \
|
curl git \
|
||||||
file
|
file
|
||||||
|
|
||||||
# Create symlinks for LLVM tools
|
# Create symlinks for LLVM tools
|
||||||
RUN <<EOF
|
RUN <<EOF
|
||||||
|
set -o xtrace
|
||||||
# clang
|
# clang
|
||||||
ln -s /usr/bin/clang-${LLVM_VERSION} /usr/bin/clang
|
ln -s /usr/bin/clang-${LLVM_VERSION} /usr/bin/clang
|
||||||
ln -s "/usr/bin/clang++-${LLVM_VERSION}" "/usr/bin/clang++"
|
ln -s "/usr/bin/clang++-${LLVM_VERSION}" "/usr/bin/clang++"
|
||||||
|
@ -46,6 +47,7 @@ ENV LDDTREE_VERSION=0.3.7
|
||||||
|
|
||||||
# Install unpackaged tools
|
# Install unpackaged tools
|
||||||
RUN <<EOF
|
RUN <<EOF
|
||||||
|
set -o xtrace
|
||||||
curl --retry 5 -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
|
curl --retry 5 -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
|
||||||
cargo binstall --no-confirm cargo-sbom --version $CARGO_SBOM_VERSION
|
cargo binstall --no-confirm cargo-sbom --version $CARGO_SBOM_VERSION
|
||||||
cargo binstall --no-confirm lddtree --version $LDDTREE_VERSION
|
cargo binstall --no-confirm lddtree --version $LDDTREE_VERSION
|
||||||
|
@ -59,7 +61,7 @@ ARG TARGETPLATFORM
|
||||||
# xx-* are xx-specific meta-packages
|
# xx-* are xx-specific meta-packages
|
||||||
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
|
||||||
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
--mount=type=cache,target=/var/lib/apt,sharing=locked \
|
||||||
xx-apt-get install -y \
|
xx-apt-get install -y \
|
||||||
xx-c-essentials xx-cxx-essentials pkg-config \
|
xx-c-essentials xx-cxx-essentials pkg-config \
|
||||||
liburing-dev
|
liburing-dev
|
||||||
|
|
||||||
|
@ -75,6 +77,7 @@ RUN echo "CARGO_INCREMENTAL=0" >> /etc/environment
|
||||||
|
|
||||||
# Configure pkg-config
|
# Configure pkg-config
|
||||||
RUN <<EOF
|
RUN <<EOF
|
||||||
|
set -o xtrace
|
||||||
echo "PKG_CONFIG_LIBDIR=/usr/lib/$(xx-info)/pkgconfig" >> /etc/environment
|
echo "PKG_CONFIG_LIBDIR=/usr/lib/$(xx-info)/pkgconfig" >> /etc/environment
|
||||||
echo "PKG_CONFIG=/usr/bin/$(xx-info)-pkg-config" >> /etc/environment
|
echo "PKG_CONFIG=/usr/bin/$(xx-info)-pkg-config" >> /etc/environment
|
||||||
echo "PKG_CONFIG_ALLOW_CROSS=true" >> /etc/environment
|
echo "PKG_CONFIG_ALLOW_CROSS=true" >> /etc/environment
|
||||||
|
@ -82,12 +85,14 @@ EOF
|
||||||
|
|
||||||
# Configure cc to use clang version
|
# Configure cc to use clang version
|
||||||
RUN <<EOF
|
RUN <<EOF
|
||||||
|
set -o xtrace
|
||||||
echo "CC=clang" >> /etc/environment
|
echo "CC=clang" >> /etc/environment
|
||||||
echo "CXX=clang++" >> /etc/environment
|
echo "CXX=clang++" >> /etc/environment
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Cross-language LTO
|
# Cross-language LTO
|
||||||
RUN <<EOF
|
RUN <<EOF
|
||||||
|
set -o xtrace
|
||||||
echo "CFLAGS=-flto" >> /etc/environment
|
echo "CFLAGS=-flto" >> /etc/environment
|
||||||
echo "CXXFLAGS=-flto" >> /etc/environment
|
echo "CXXFLAGS=-flto" >> /etc/environment
|
||||||
# Linker is set to target-compatible clang by xx
|
# Linker is set to target-compatible clang by xx
|
||||||
|
@ -98,6 +103,7 @@ EOF
|
||||||
ARG TARGET_CPU=
|
ARG TARGET_CPU=
|
||||||
RUN <<EOF
|
RUN <<EOF
|
||||||
set -o allexport
|
set -o allexport
|
||||||
|
set -o xtrace
|
||||||
. /etc/environment
|
. /etc/environment
|
||||||
if [ -n "${TARGET_CPU}" ]; then
|
if [ -n "${TARGET_CPU}" ]; then
|
||||||
echo "CFLAGS='${CFLAGS} -march=${TARGET_CPU}'" >> /etc/environment
|
echo "CFLAGS='${CFLAGS} -march=${TARGET_CPU}'" >> /etc/environment
|
||||||
|
@ -118,7 +124,6 @@ COPY . .
|
||||||
ARG TARGETPLATFORM
|
ARG TARGETPLATFORM
|
||||||
|
|
||||||
# Verify environment configuration
|
# Verify environment configuration
|
||||||
RUN cat /etc/environment
|
|
||||||
RUN xx-cargo --print-target-triple
|
RUN xx-cargo --print-target-triple
|
||||||
|
|
||||||
# Conduwuit version info
|
# Conduwuit version info
|
||||||
|
@ -142,6 +147,7 @@ RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
||||||
--mount=type=cache,target=/app/target \
|
--mount=type=cache,target=/app/target \
|
||||||
bash <<'EOF'
|
bash <<'EOF'
|
||||||
set -o allexport
|
set -o allexport
|
||||||
|
set -o xtrace
|
||||||
. /etc/environment
|
. /etc/environment
|
||||||
TARGET_DIR=($(cargo metadata --no-deps --format-version 1 | \
|
TARGET_DIR=($(cargo metadata --no-deps --format-version 1 | \
|
||||||
jq -r ".target_directory"))
|
jq -r ".target_directory"))
|
||||||
|
@ -162,6 +168,7 @@ EOF
|
||||||
RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
||||||
--mount=type=cache,target=/usr/local/cargo/git/db \
|
--mount=type=cache,target=/usr/local/cargo/git/db \
|
||||||
bash <<'EOF'
|
bash <<'EOF'
|
||||||
|
set -o xtrace
|
||||||
mkdir /out/sbom
|
mkdir /out/sbom
|
||||||
typeset -A PACKAGES
|
typeset -A PACKAGES
|
||||||
for BINARY in /out/sbin/*; do
|
for BINARY in /out/sbin/*; do
|
||||||
|
@ -180,6 +187,7 @@ EOF
|
||||||
|
|
||||||
# Extract dynamically linked dependencies
|
# Extract dynamically linked dependencies
|
||||||
RUN <<EOF
|
RUN <<EOF
|
||||||
|
set -o xtrace
|
||||||
mkdir /out/libs
|
mkdir /out/libs
|
||||||
mkdir /out/libs-root
|
mkdir /out/libs-root
|
||||||
for BINARY in /out/sbin/*; do
|
for BINARY in /out/sbin/*; do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue