Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

refactor(devel): rename image 'devel' to 'base-devel' and add C build toolchain #86

Merged
merged 3 commits into from
May 15, 2023
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include config.mk
include tools.mk

SUBDIRS := static base devel go-devel rust-devel openj9-devel openj9 multitool
SUBDIRS := static base base-devel go-devel rust-devel openj9-devel openj9 multitool
BUILD_ORDER_FILE := $(BUILD_DIR)/build_order.json
PREREQUISITES_FILE := $(BUILD_DIR)/prerequisites.json

Expand Down
6 changes: 3 additions & 3 deletions image_deps.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"images": {
"static": [],
"base": ["static"],
"devel": ["base"],
"go-devel": ["devel"],
"base-devel": ["base"],
"go-devel": ["base-devel"],
"openj9-devel": ["base"],
"openj9": ["base", "openj9-devel"],
"rust-devel": ["devel"],
"rust-devel": ["base-devel"],
"multitool": ["static"]
}
}
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions images/base-devel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
base-devel is a layer which contains common packages use to compile and build programs.
3 changes: 3 additions & 0 deletions images/base-devel/debian-pkgs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

PKGS="binutils binutils-common binutils-x86-64-linux-gnu clang clang-11 cmake cpp cpp-10 curl gcc gcc-10 git lib32gcc-s1 lib32stdc++6 libacl1 libarchive13 libasan6 libatomic1 libbinutils libbrotli1 libbsd0 libbz2-1.0 libc-dev-bin libc6-dev libc6-i386 libcc1-0 libclang-common-11-dev libclang1-11 libclang-cpp11 libcom-err2 libcrypt-dev libctf-nobfd0 libctf0 libcurl4 libedit2 libffi7 libgc1 libgcc-10-dev libgcc-s1 libgcrypt20 libgmp10 libgnutls30 libgomp1 libgpg-error0 libgssapi-krb5-2 libhogweed6 libicu67 libidn2-0 libisl23 libitm1 libjsoncpp24 libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0 libldap-2.4-2 libllvm11 liblsan0 liblz4-1 liblzma5 libmd0 libmpc3 libmpfr6 libnettle8 libnghttp2-14 libnsl-dev libobjc-10-dev libobjc4 libp11-kit0 libpsl5 libquadmath0 librhash0 librtmp1 libsasl2-2 libssh-4 libssh2-1 libstdc++-10-dev libstdc++6 libtasn1-6 libtinfo6 libtirpc-dev libtsan0 libubsan1 libunistring2 libuv1 libxml2 libz3-4 libzstd1 linux-libc-dev make wget zlib1g"
andaaron marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 3 additions & 0 deletions images/base-devel/rockylinux-pkgs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

PKGS="cmake audit-libs binutils bzip2-libs checkpolicy clang clang-libs clang-resource-filesystem cyrus-sasl-lib cpp diffutils gcc gcc-c++ gcc-toolset-12-binutils gcc-toolset-12-binutils-gold gcc-toolset-12-gcc gcc-toolset-12-gcc-c++ gcc-toolset-12-libstdc++-devel gcc-toolset-12-runtime glibc-devel glibc-headers gmp groff-base keyutils-libs krb5-libs libarchive libacl libattr libbrotli libcap libcap-ng libcom_err libcurl libedit libevent libffi libgcc libidn2 libmpc libnghttp2 libpipeline libpkgconf libpsl libselinux libselinux-utils libstdc++-devel libsepol libsigsegv libssh libssh-config libstdc++ libtasn1 libunistring libuuid libuv libverto libxcrypt libxcrypt-devel libxml2 libzstd llvm-libs lua-libs lz4-libs make mpfr ncurses-libs openldap openssl-libs pcre2 pkgconf pkgconf-m4 pkgconf-pkg-config policycoreutils procps-ng xz-libs zlib wget curl-minimal git"
33 changes: 25 additions & 8 deletions images/devel/stacker.yaml → images/base-devel/stacker.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# "devel" is an image that can be used to package binaries
# "base-devel" is an image that can be used to package binaries
# that require libc runtime

config:
prerequisites:
- ../build-env/stacker.yaml

build-devel:
build-base-devel:
from:
type: built
tag: build-env
Expand All @@ -29,8 +29,10 @@ build-devel:
install_pkgs /rootfs_diff $PKGS
# install busybox
install_busybox /rootfs_diff
# cleanup unnecessary files, do not use the cleanup_rootfs function as it deletes
# binaries we intentionally installed under /rootfs_diff/usr/bin/ and /rootfs_diff/usr/sbin/
[ ! -f "/rootfs_diff/usr/bin/ld" ] && ln -sf /usr/bin/ld.bfd /rootfs_diff/usr/bin/ld
[ ! -f "/rootfs_diff/usr/bin/cc" ] && ln -sf /usr/bin/gcc /rootfs_diff/usr/bin/cc
# cleanup unnecessary files, do not use the cleanup_rootfs function as it deletes
rm -rf /rootfs_diff/tmp/*
rm -rf /rootfs_diff/var/*
# remove all docs
Expand All @@ -40,17 +42,17 @@ build-devel:
ls /rootfs_diff/usr/sbin/
build_only: true

devel-${{ARCH}}:
base-devel-${{ARCH}}:
from:
type: oci
url: ${{BUILD_OCI_DIR}}:base-${{ARCH}}${{LAYER_SUFFIX}}
import:
- path: stacker://build-devel/rootfs_diff/
- path: stacker://build-base-devel/rootfs_diff/
dest: /
- ${{DISTRO}}-pkgs.sh # The import purpose is to force a rebuild if file changed
- ../../pkgmgr/defs.sh # The import purpose is to force a rebuild if file changed
annotations:
org.opencontainers.image.title: devel-${{ARCH}}
org.opencontainers.image.title: base-devel-${{ARCH}}
org.opencontainers.image.description: ${{DESCRIPTION}}
org.opencontainers.image.url: https://github.com/project-stacker/c3
org.opencontainers.image.source: https://github.com/project-stacker/c3
Expand All @@ -59,14 +61,29 @@ devel-${{ARCH}}:
org.opencontainers.image.licenses: ${{LICENSES}}
org.opencontainers.image.vendor: Cisco Systems, Inc.

test-devel:
test-base-devel:
from:
type: built
tag: devel-${{ARCH}}
tag: base-devel-${{ARCH}}
import:
- ../test/test.c
run: |
ls -l /
make --version
cmake --version
wget --help
curl --version
gcc --version
clang --version
cc --version
# looks like rustc errors if this folder is not created
# on Rockylinux it is not
mkdir -p /tmp
# test compiling
cp /stacker/test.c .
gcc test.c -o test_gcc
clang test.c -o test_clang
# test output binaries
./test_gcc
./test_clang
build_only: true
3 changes: 3 additions & 0 deletions images/base-devel/ubuntu-pkgs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

PKGS="binutils binutils-common binutils-x86-64-linux-gnu clang clang-14 cmake cpp cpp-11 curl gcc gcc-11 gcc-11-base git lib32gcc-s1 lib32stdc++6 libacl1 libarchive13 libasan6 libatomic1 libbinutils libbrotli1 libbsd0 libbz2-1.0 libc-dev-bin libc6-dev libc6-i386 libcc1-0 libclang-common-14-dev libclang-cpp14 libclang1-14 libcom-err2 libcrypt-dev libctf-nobfd0 libctf0 libcurl4 libedit2 libgc1 libgcc-11-dev libgcc-s1 libgmp10 libgnutls30 libgomp1 libgssapi-krb5-2 libhogweed6 libicu70 libidn2-0 libisl23 libitm1 libjsoncpp25 libk5crypto3 libkeyutils1 libffi8 libkrb5-3 libkrb5support0 libldap-2.5-0 libllvm14 liblsan0 liblz4-1 liblzma5 libmd0 libmpc3 libmpfr6 libnettle8 libnghttp2-14 libnsl-dev libobjc-11-dev libobjc4 libp11-kit0 libpsl5 libquadmath0 librhash0 librtmp1 libsasl2-2 libssh-4 libstdc++-11-dev libstdc++6 libtasn1-6 libtinfo6 libtirpc-dev libtsan0 libubsan1 libunistring2 libuv1 libxml2 libzstd1 linux-libc-dev llvm-14-linker-tools make rpcsvc-proto wget zlib1g"
1 change: 0 additions & 1 deletion images/devel/README.md

This file was deleted.

3 changes: 0 additions & 3 deletions images/devel/debian-pkgs.sh

This file was deleted.

3 changes: 0 additions & 3 deletions images/devel/rockylinux-pkgs.sh

This file was deleted.

3 changes: 0 additions & 3 deletions images/devel/ubuntu-pkgs.sh

This file was deleted.

2 changes: 1 addition & 1 deletion images/go-devel/stacker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ build-go-devel:
go-devel-${{ARCH}}:
from:
type: oci
url: ${{BUILD_OCI_DIR}}:devel-${{ARCH}}${{LAYER_SUFFIX}}
url: ${{BUILD_OCI_DIR}}:base-devel-${{ARCH}}${{LAYER_SUFFIX}}
import:
- path: stacker://build-go-devel/rootfs_diff/
dest: /
Expand Down
3 changes: 0 additions & 3 deletions images/rust-devel/debian-pkgs.sh

This file was deleted.

3 changes: 0 additions & 3 deletions images/rust-devel/rockylinux-pkgs.sh

This file was deleted.

11 changes: 1 addition & 10 deletions images/rust-devel/stacker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ build-rust-devel:
type: built
tag: build-env
import:
- ${{DISTRO}}-pkgs.sh
- ../../pkgmgr/defs.sh
run: |
export DISTRO=${{DISTRO}}
Expand All @@ -16,8 +15,6 @@ build-rust-devel:
export OS=${{OS}}
# rust
export RUST=${{RUST}}
# source pkgs to install into rootfs
. /stacker/$DISTRO-pkgs.sh
# source pkgmgr func defs
. /stacker/defs.sh
# prepare the rootfs
Expand All @@ -37,16 +34,12 @@ build-rust-devel:
rustc -V
# copy binaries under /opt/bin
mkdir -p /rootfs_diff/opt/bin
# install pkgs
install_pkgs /rootfs_diff $PKGS
cp -R ${RUSTUP} /rootfs_diff/opt/
cp -R ${CARGO_HOME} /rootfs_diff/opt/
# HOME folder
mkdir -p /rootfs_diff/rust/
# cleanup unnecessary files
# binaries were intentionally installed under /rootfs_diff/usr/bin/
[ ! -f "/rootfs_diff/usr/bin/cc" ] && ln -sf /usr/bin/gcc /rootfs_diff/usr/bin/cc
[ ! -f "/rootfs_diff/usr/bin/ld" ] && ln -sf /usr/bin/ld.bfd /rootfs_diff/usr/bin/ld
# remove all docs
rm -rf /rootfs_diff/usr/share/doc/*
rm -rf /rootfs_diff/usr/share/man/*
Expand All @@ -55,11 +48,10 @@ build-rust-devel:
rust-devel-${{ARCH}}:
from:
type: oci
url: ${{BUILD_OCI_DIR}}:devel-${{ARCH}}${{LAYER_SUFFIX}}
url: ${{BUILD_OCI_DIR}}:base-devel-${{ARCH}}${{LAYER_SUFFIX}}
import:
- path: stacker://build-rust-devel/rootfs_diff/
dest: /
- ${{DISTRO}}-pkgs.sh # The import purpose is to force a rebuild if file changed
- ../../pkgmgr/defs.sh # The import purpose is to force a rebuild if file changed
run: |
echo 'export HOME=/rust' > /etc/profile
Expand Down Expand Up @@ -95,7 +87,6 @@ test-rust-devel:
ls -lrL ${SSL_CERT_DIR}/
rustc --version
cargo --version
cc --version
rustup show
# looks like rustc errors if this folder is not created
# on Rockylinux it is not
Expand Down
3 changes: 0 additions & 3 deletions images/rust-devel/ubuntu-pkgs.sh

This file was deleted.