Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add llvm-xtensa and ldc-xtensa images #19

Merged
merged 1 commit into from
Aug 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions definitions/containerfiles.ini
Original file line number Diff line number Diff line change
Expand Up @@ -528,3 +528,13 @@ level = false

[llvm:18.1.8]
level = false

[ldc-xtensa:1.39.0]
level = 2.109.1
dependencies[] = llvm-xtensa:16.0
dependencies[] = ldc:1.20
extras[dub] = 1.38.0

[llvm-xtensa:16.0.4]
level = false
env[GIT_TAG] = esp-16.0.4-20231113
57 changes: 57 additions & 0 deletions templates/ldc-xtensa/ldc-xtensa-image.containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{{< ldc/ldc-variables.php }}
###################
# imported images #
###################

FROM {{ $container_namespace }}/llvm-xtensa:{{ $dependencies['llvm-xtensa'] }}-{{ $base_image_alias }} AS llvm-imported
{{# if ($isBootstrappedByLDC): }}
FROM {{ $container_namespace }}/ldc:{{ $dependencies['ldc'] }}-{{ $base_image_alias }} AS ldc-bootstrap-imported
{{# endif }}

###############
# build stage #
###############

{{< ldc/ldc-image-build-stage.containerfile }}

{{# if ($isBootstrappedByLDC): }}

##################
# self bootstrap #
##################

{{< ldc/ldc-image-build-stage.containerfile }}
{{# endif }}

{{< common/make-dub.containerfile }}

{{< common/make-d-tools.containerfile }}

################
# export stage #
################

{{# $buildStage = "build-stage-{$buildStageCounter}"; }}
FROM {{ $base_image }} AS export-stage

{{< common/prepare-runtime-environment.containerfile }}

COPY --from={{ $buildStage }} /opt/ldc /opt/ldc

{{< d-tools/install-d-tools.containerfile }}

# Self-test
COPY ./resources/helloworld.d /opt/helloworld.d
RUN /opt/ldc/bin/ldmd2 -run /opt/helloworld.d
RUN rm /opt/helloworld.d

{{# if (isset($extras['dub'])): }}
COPY --from={{ $buildStage }} /opt/build/dub/bin/dub /usr/bin/dub
{{# endif }}

{{< d-tools/install-d-tools.containerfile }}

COPY ./templates/scripts/entrypoint-ldc.sh /usr/bin/entrypoint

ENTRYPOINT [ "/usr/bin/entrypoint" ]
CMD [ "/opt/ldc/bin/ldc2" ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Download LLVM source

{{# if (!isset($GIT_TAG)): }}
!!! Error: $GIT_TAG is not set !!!
{{# else: }}
RUN curl -fLsSo llvm.tar.gz "https://github.com/espressif/llvm-project/archive/refs/tags/{{ $GIT_TAG }}.tar.gz"
{{# endif }}
29 changes: 29 additions & 0 deletions templates/llvm-xtensa/llvm-xtensa-image.containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
$LLVM_EXPERIMENTAL_TARGETS_TO_BUILD = "Xtensa"
?>

###############
# build stage #
###############

FROM {{ $base_image }} AS build-stage

WORKDIR /opt/build

# Install dependencies
{{< common/install-common-system-tools.containerfile }}
{{< llvm/install-llvm-build-deps.containerfile }}

# Download, build and install LLVM
{{< llvm-xtensa/download-llvm-xtensa-source.containerfile }}
{{< llvm/build-llvm.containerfile }}

################
# export stage #
################

FROM {{ $base_image }} AS export-stage

COPY --from=build-stage /opt/llvm/ /opt/llvm/

CMD ["echo", "This image is not meant to be run. It only provides files located in /opt/llvm."]
3 changes: 3 additions & 0 deletions templates/llvm/build-llvm.containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ RUN cmake \
{{# if ($semver->major >= 12): }}
-DLLVM_ENABLE_RUNTIMES=compiler-rt \
{{# endif }}
{{# if (isset($LLVM_EXPERIMENTAL_TARGETS_TO_BUILD)): }}
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="{{ $LLVM_EXPERIMENTAL_TARGETS_TO_BUILD }}" \
{{# endif }}
-DCMAKE_INSTALL_PREFIX=/opt/llvm \
-DCMAKE_C_COMPILER=gcc \
-DCMAKE_CXX_COMPILER=g++ \
Expand Down