43 lines
2.8 KiB
Docker
43 lines
2.8 KiB
Docker
# SPDX-FileCopyrightText: 2023 - 2024 Daniel Wolf <nephatrine@gmail.com>
|
|
#
|
|
# SPDX-License-Identifier: ISC
|
|
|
|
FROM code.nephatrine.net/nephnet/nxb-debian:llvm16
|
|
LABEL maintainer="Daniel Wolf <nephatrine@gmail.com>"
|
|
|
|
ENV FREEBSD_VERSION=14.0 FREEBSD_PORTS_VERSION=14 FREEBSD_SYSROOT=/opt/freebsd/sysroot
|
|
|
|
COPY override/usr/local/bin/freebsd-install /usr/local/bin/freebsd-install
|
|
WORKDIR /opt/freebsd/sysroot
|
|
RUN FREEBSD_DIST="$(uname -m)" && FREEBSD_ARCH="$(uname -m)" \
|
|
&& if [ "$(uname -m)" = "x86_64" ]; then FREEBSD_DIST="amd64" && FREEBSD_ARCH="amd64"; fi \
|
|
&& if [ "$(uname -m)" = "i686" ]; then FREEBSD_DIST="i386" && FREEBSD_ARCH="i386"; fi \
|
|
&& if [ "$(uname -m)" = "aarch64" ]; then FREEBSD_DIST="arm64"; fi \
|
|
&& if [ "$(uname -m)" = "riscv64" ]; then FREEBSD_DIST="riscv"; fi \
|
|
&& export FREEBSD_ARCH && export FREEBSD_DIST \
|
|
&& wget --progress=dot:giga -O "${HOME}/freebsd.txz" "https://download.freebsd.org/ftp/releases/${FREEBSD_DIST}/${FREEBSD_ARCH}/${FREEBSD_VERSION}-RELEASE/base.txz" \
|
|
&& if [ "$(uname -m)" = "x86_64" ]; then wget --progress=dot:giga -O "${HOME}/freebsd32.txz" "https://download.freebsd.org/ftp/releases/${FREEBSD_DIST}/${FREEBSD_ARCH}/${FREEBSD_VERSION}-RELEASE/lib32.txz"; fi \
|
|
&& if [ "$(uname -m)" = "aarch64" ]; then wget --progress=dot:giga -O "${HOME}/freebsd32.txz" "https://download.freebsd.org/ftp/releases/${FREEBSD_DIST}/${FREEBSD_ARCH}/${FREEBSD_VERSION}-RELEASE/lib32.txz"; fi \
|
|
&& bsdtar -xf "${HOME}/freebsd.txz" \
|
|
&& if [ -e "${HOME}/freebsd32.txz" ]; then bsdtar -xf "${HOME}/freebsd32.txz"; fi \
|
|
&& mkdir "/usr/lib/clang/${LLVM_MAJOR}/lib/freebsd" \
|
|
&& cp -nrvs /opt/freebsd/sysroot/usr/lib/clang/"${LLVM_MAJOR}"*/lib/freebsd/. "/usr/lib/clang/${LLVM_MAJOR}/lib/freebsd/" \
|
|
&& freebsd-install \
|
|
&& rm -rf /tmp/* /var/tmp/* "${HOME}"/*.txz
|
|
|
|
RUN if [ "$(uname -m)" = "x86_64" ]; then FREEBSD_ARCH="i386" freebsd-install archivers/zstd devel/icu ftp/curl security/openssl-devel textproc/libxml2; fi \
|
|
&& if [ "$(uname -m)" = "aarch64" ]; then FREEBSD_ARCH="armv7" freebsd-install archivers/zstd devel/icu ftp/curl security/openssl-devel textproc/libxml2; fi \
|
|
&& if [ ! "$(uname -m)" = "riscv64" ]; then freebsd-install archivers/zstd devel/icu ftp/curl security/openssl-devel textproc/libxml2; fi \
|
|
&& rm -rf /tmp/* /var/tmp/*
|
|
|
|
COPY override /
|
|
# hadolint ignore=DL3003
|
|
RUN git -C "${HOME}" clone --single-branch --depth=1 https://code.nephatrine.net/nephatrine/hello-test.git \
|
|
&& mkdir "/tmp/build-$(uname -m)" && cd "/tmp/build-$(uname -m)" \
|
|
&& "nxbuild-freebsd-$(uname -m)" -GNinja "${HOME}/hello-test" \
|
|
&& ninja && file HelloTest \
|
|
&& if [ "$(uname -m)" = "x86_64" ]; then mkdir /tmp/build-i686 && cd /tmp/build-i686 \
|
|
&& nxbuild-freebsd-i686 -GNinja "${HOME}/hello-test" \
|
|
&& ninja && file HelloTest; fi \
|
|
&& cd .. && rm -rf /tmp/* /var/tmp/* "${HOME}/hello-test"
|