build: rename /opt/libseccomp cdylib directory

In a future patch this will contain other cdylibs so it deserves a
slightly more general name.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
This commit is contained in:
Aleksa Sarai
2026-02-02 13:04:50 +01:00
parent 51ae8de054
commit 8292574e7a
2 changed files with 15 additions and 18 deletions
+6 -4
View File
@@ -54,14 +54,16 @@ RUN cd /tmp \
&& ./install.sh /usr/local \ && ./install.sh /usr/local \
&& rm -rf /tmp/bats-core && rm -rf /tmp/bats-core
ENV DYLIB_DIR=/opt/runc-dylibs
# install libseccomp # install libseccomp
ARG LIBSECCOMP_VERSION ARG LIBSECCOMP_VERSION
COPY script/seccomp.sh script/lib.sh /tmp/script/ COPY script/seccomp.sh script/lib.sh /tmp/script/
RUN mkdir -p /opt/libseccomp \ RUN mkdir -p $DYLIB_DIR \
&& /tmp/script/seccomp.sh "$LIBSECCOMP_VERSION" /opt/libseccomp 386 amd64 arm64 armel armhf ppc64le riscv64 s390x && /tmp/script/seccomp.sh "$LIBSECCOMP_VERSION" $DYLIB_DIR 386 amd64 arm64 armel armhf ppc64le riscv64 s390x
ENV LIBSECCOMP_VERSION=$LIBSECCOMP_VERSION ENV LIBSECCOMP_VERSION=$LIBSECCOMP_VERSION
ENV LD_LIBRARY_PATH=/opt/libseccomp/lib ENV LD_LIBRARY_PATH=$DYLIB_DIR/lib
ENV PKG_CONFIG_PATH=/opt/libseccomp/lib/pkgconfig ENV PKG_CONFIG_PATH=$DYLIB_DIR/lib/pkgconfig
# Prevent the "fatal: detected dubious ownership in repository" git complain during build. # Prevent the "fatal: detected dubious ownership in repository" git complain during build.
RUN git config --global --add safe.directory /go/src/github.com/opencontainers/runc RUN git config --global --add safe.directory /go/src/github.com/opencontainers/runc
+9 -14
View File
@@ -40,14 +40,14 @@ function build_project() {
shift shift
local arches=("$@") local arches=("$@")
# Assume that if /opt/libseccomp exists, then we are run # Assume that if /opt/runc-dylibs exists, then we are running via
# via Dockerfile, and seccomp is already built. # Dockerfile, and thus seccomp is already built. Otherwise, build it now.
local seccompdir=/opt/libseccomp temp_dir local dylibdir=/opt/runc-dylibs
if [ ! -d "$seccompdir" ]; then if ! [ -d "$dylibdir" ]; then
temp_dir="$(mktemp -d)" trap 'rm -rf "$dylibdir"' EXIT
seccompdir="$temp_dir" dylibdir="$(mktemp -d)"
# Download and build libseccomp. # Download and build libseccomp.
"$root/script/seccomp.sh" "$LIBSECCOMP_VERSION" "$seccompdir" "${arches[@]}" "$root/script/seccomp.sh" "$LIBSECCOMP_VERSION" "$dylibdir" "${arches[@]}"
fi fi
# For reproducible builds, add these to EXTRA_LDFLAGS: # For reproducible builds, add these to EXTRA_LDFLAGS:
@@ -70,7 +70,7 @@ function build_project() {
CFLAGS="$original_cflags" CFLAGS="$original_cflags"
set_cross_vars "$arch" set_cross_vars "$arch"
make -C "$root" \ make -C "$root" \
PKG_CONFIG_PATH="$seccompdir/$arch/lib/pkgconfig" \ PKG_CONFIG_PATH="$dylibdir/$arch/lib/pkgconfig" \
"${make_args[@]}" "${make_args[@]}"
"$STRIP" "$root/$project" "$STRIP" "$root/$project"
mv "$root/$project" "$builddir/$project.$arch" mv "$root/$project" "$builddir/$project.$arch"
@@ -85,12 +85,7 @@ function build_project() {
fi fi
# Copy libseccomp source tarball. # Copy libseccomp source tarball.
cp "$seccompdir"/src/* "$builddir" cp "$dylibdir"/src/* "$builddir"
# Clean up.
if [ -n "$tempdir" ]; then
rm -rf "$tempdir"
fi
} }
# End of the easy-to-configure portion. # End of the easy-to-configure portion.