From cadb60d058ca540a5fa1a09790e79ed5d3a41779a9b479e01d6eef5ccefa288a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= Date: Fri, 19 Apr 2024 06:32:04 +0000 Subject: [PATCH] [info=213eef462158c131a641724c1772bfa4] OBS-URL: https://build.opensuse.org/package/show/devel:BCI:Tumbleweed/gcc-14-image?expand=0&rev=1 --- .gitattributes | 23 ++++++++++ .gitignore | 1 + Dockerfile | 51 ++++++++++++++++++++++ README.md | 101 +++++++++++++++++++++++++++++++++++++++++++ _service | 10 +++++ gcc-14-image.changes | 4 ++ 6 files changed, 190 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 README.md create mode 100644 _service create mode 100644 gcc-14-image.changes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..60a6f47 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,51 @@ +# SPDX-License-Identifier: MIT + +# Copyright (c) 2024 SUSE LLC + +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. + +# The content of THIS FILE IS AUTOGENERATED and should not be manually modified. +# It is maintained by the BCI team and generated by +# https://github.com/SUSE/BCI-dockerfile-generator + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# You can contact the BCI team via https://github.com/SUSE/bci/discussions + + +#!BuildTag: opensuse/bci/gcc:14 +#!BuildTag: opensuse/bci/gcc:14-%RELEASE% +#!BuildTag: opensuse/bci/gcc:%%gcc_version%% +#!BuildTag: opensuse/bci/gcc:%%gcc_version%%-%RELEASE% +#!BuildTag: opensuse/bci/gcc:latest + +FROM opensuse/tumbleweed:latest + +MAINTAINER openSUSE (https://www.opensuse.org/) + +# Define labels according to https://en.opensuse.org/Building_derived_containers +# labelprefix=org.opensuse.bci.gcc +LABEL org.opencontainers.image.title="openSUSE Tumbleweed BCI GNU Compiler Collection" +LABEL org.opencontainers.image.description="GNU Compiler Collection container based on the openSUSE Tumbleweed Base Container Image." +LABEL org.opencontainers.image.version="14" +LABEL org.opencontainers.image.url="https://www.opensuse.org" +LABEL org.opencontainers.image.created="%BUILDTIME%" +LABEL org.opencontainers.image.vendor="openSUSE Project" +LABEL org.opencontainers.image.source="%SOURCEURL%" +LABEL io.artifacthub.package.readme-url="https://raw.githubusercontent.com/SUSE/BCI-dockerfile-generator/Tumbleweed/gcc-14-image/README.md" +LABEL org.opensuse.reference="registry.opensuse.org/opensuse/bci/gcc:14-%RELEASE%" +LABEL org.openbuildservice.disturl="%DISTURL%" +LABEL org.opensuse.lifecycle-url="https://en.opensuse.org/Lifetime" +LABEL org.opensuse.release-stage="released" + +# endlabelprefix + +RUN set -euo pipefail; zypper -n in --no-recommends gcc14 gcc14-c++ make; zypper -n clean; rm -rf /var/log/{lastlog,tallylog,zypper.log,zypp/history,YaST2} +ENV GCC_VERSION="%%gcc_version%%" + +# symlink all versioned gcc & g++ binaries to unversioned +# ones in /usr/local/bin so that plain gcc works +RUN set -euo pipefail; for gcc_bin in $(rpm -ql gcc14 gcc14-c++ |grep ^/usr/bin/ ); do \ + ln -f $gcc_bin $(echo "$gcc_bin" | sed -e 's|/usr/bin/|/usr/local/bin/|' -e 's|-14$||'); \ + done diff --git a/README.md b/README.md new file mode 100644 index 0000000..de30f41 --- /dev/null +++ b/README.md @@ -0,0 +1,101 @@ +# The GNU Compiler Collection Container Image + +The GNU Compiler Collection (GCC) is an optimizing compiler for various +architectures and operating systems. It is the default compiler in the GNU +project and most Linux distributions, including SUSE Linux Enterprise and +openSUSE. + + +## How to use the image + +### Compile an application with a `Dockerfile` + +Normally, you'd want to compile an application and distribute it as part of a +custom container image. To do this, create a `Dockerfile` similar to the one +below. The `Dockerfile` uses this image to build a custom container image, +copies the sources to a working directory, and compiles the application: + +```Dockerfile +FROM registry.opensuse.org/opensuse/bci/gcc:14 +WORKDIR /src/ +COPY . /src/ +RUN gcc main.c src1.c src2.c +CMD ["./a.out"] +``` + +It is also possible to compile a static binary with gcc as part of a multistage +build: + +```Dockerfile +FROM registry.opensuse.org/opensuse/bci/gcc:14 as builder +WORKDIR /src/ +COPY . /src/ +RUN gcc -o app main.c src1.c src2.c + +FROM registry.suse.com/bci/bci-micro:latest +WORKDIR /build/ +COPY --from=builder /src/app /build/ +CMD ["/build/app"] +``` + +Note that you must build a static binary to deploy it into bci-micro; otherwise +shared libraries might be missing. You cannot deploy such an app into a +`scratch` image, as it is not possible to statically link glibc. + + +### Available build systems + +The container image comes with `make` by default. Other build systems and +related utilities are available in the repository, and they can be installed +using `zypper`. This includes the following: +- `meson` +- `cmake` +- `ninja` +- `autoconf` & `automake` + + +### Available compiler frontends + +The GNU Compiler Collections supports a wide range of frontends. The container +image ships the C and C++ frontends available as `gcc` and `g++` +respectively. The following additional frontends can be installed from the +repository: +- `gcc14-fortran` for Fortran support +- `gcc14-ada` for the Ada frontend (GNAT) +- `gcc14-go` for the Go frontend +- `gcc14-objc` and `gcc14-obj-c++` for the Objective C and Objective C++ +- `gcc14-d` for the frontend to the D Language +- `gcc14-m2` for the Modula 2 compiler frontend +- `gcc14-rust` for the GNU Rust compiler + + +### Using the container image interactively + +You can use the image to create ephemeral containers that execute only gcc. This +can be useful in situations, where building a full container image is not +practical. One way to do this is to mount the working directory of an +application into the launched container and compile the application there: + +```bash +podman run --rm -it -v $(pwd):/src/:Z registry.opensuse.org/opensuse/bci/gcc:14 \ + gcc -o /src/app.out /src/*.c +``` +or by invoking `make` +```bash +podman run --rm -it -v $(pwd):/src/:Z --workdir /src/ \ + registry.opensuse.org/opensuse/bci/gcc:14 \ + make +``` + +Note that the binary built using this approach are unlikely to work on a local +machine. They only work on operating systems that are binary-compatible to +. + +## Licensing +`SPDX-License-Identifier: MIT` + +The build recipe and this documentation is licensed as MIT. +The container itself contains various software components under various open source licenses listed in the associated +Software Bill of Materials (SBOM). + +This image is based on [openSUSE Tumbleweed](https://get.opensuse.org/tumbleweed/). diff --git a/_service b/_service new file mode 100644 index 0000000..811ba96 --- /dev/null +++ b/_service @@ -0,0 +1,10 @@ + + + + + Dockerfile + %%gcc_version%% + gcc14 + minor + + \ No newline at end of file diff --git a/gcc-14-image.changes b/gcc-14-image.changes new file mode 100644 index 0000000..d07dfc9 --- /dev/null +++ b/gcc-14-image.changes @@ -0,0 +1,4 @@ +------------------------------------------------------------------- +Wed Apr 17 14:34:54 UTC 2024 - SUSE Update Bot + +- First version of the GNU Compiler Collection 14 BCI