diff --git a/Makefile b/Makefile index c210365..fa31cba 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/image_deps.json b/image_deps.json index 81efb26..62beb31 100644 --- a/image_deps.json +++ b/image_deps.json @@ -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"] } } \ No newline at end of file diff --git a/images/devel/LICENSE.md b/images/base-devel/LICENSE.md similarity index 100% rename from images/devel/LICENSE.md rename to images/base-devel/LICENSE.md diff --git a/images/devel/Makefile b/images/base-devel/Makefile similarity index 100% rename from images/devel/Makefile rename to images/base-devel/Makefile diff --git a/images/base-devel/README.md b/images/base-devel/README.md new file mode 100644 index 0000000..c20d19c --- /dev/null +++ b/images/base-devel/README.md @@ -0,0 +1 @@ +base-devel is a layer which contains common packages use to compile and build programs. diff --git a/images/base-devel/debian-pkgs.sh b/images/base-devel/debian-pkgs.sh new file mode 100644 index 0000000..2dec42b --- /dev/null +++ b/images/base-devel/debian-pkgs.sh @@ -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" diff --git a/images/base-devel/rockylinux-pkgs.sh b/images/base-devel/rockylinux-pkgs.sh new file mode 100644 index 0000000..a85ee2c --- /dev/null +++ b/images/base-devel/rockylinux-pkgs.sh @@ -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" diff --git a/images/devel/stacker.yaml b/images/base-devel/stacker.yaml similarity index 71% rename from images/devel/stacker.yaml rename to images/base-devel/stacker.yaml index 0f81e04..7241095 100644 --- a/images/devel/stacker.yaml +++ b/images/base-devel/stacker.yaml @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/images/base-devel/ubuntu-pkgs.sh b/images/base-devel/ubuntu-pkgs.sh new file mode 100644 index 0000000..ad25b45 --- /dev/null +++ b/images/base-devel/ubuntu-pkgs.sh @@ -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" diff --git a/images/devel/README.md b/images/devel/README.md deleted file mode 100644 index 7e90e67..0000000 --- a/images/devel/README.md +++ /dev/null @@ -1 +0,0 @@ -devel is a layer which contains common packages use to compile and build programs. diff --git a/images/devel/debian-pkgs.sh b/images/devel/debian-pkgs.sh deleted file mode 100644 index 4cad313..0000000 --- a/images/devel/debian-pkgs.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -PKGS="make cmake zlib1g libarchive13 libcurl4 libjsoncpp24 libuv1 librhash0 libstdc++6 libgcc-s1 libnettle8 libacl1 liblzma5 libzstd1 liblz4-1 libbz2-1.0 libxml2 libnghttp2-14 libidn2-0 librtmp1 libssh-4 libpsl5 libgssapi-krb5-2 libldap-2.4-2 libbrotli1 libicu67 libunistring2 libgnutls30 libhogweed6 libgmp10 libkrb5-3 libk5crypto3 libcom-err2 libkrb5support0 libsasl2-2 libp11-kit0 libtasn1-6 libkeyutils1 libffi7 libssh2-1 libgcrypt20 libgpg-error0 wget curl git" diff --git a/images/devel/rockylinux-pkgs.sh b/images/devel/rockylinux-pkgs.sh deleted file mode 100644 index 1795224..0000000 --- a/images/devel/rockylinux-pkgs.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -PKGS="make cmake audit-libs bzip2-libs cyrus-sasl-lib keyutils-libs krb5-libs libarchive libacl libattr libbrotli libcap libcap-ng libcom_err libcurl libevent libffi libgcc libidn2 libnghttp2 libpsl libselinux libsepol libsigsegv libssh libssh-config libstdc++ libtasn1 libunistring libuuid libuv libverto libxcrypt libxml2 libzstd lua-libs lz4-libs ncurses-libs openldap openssl-libs pcre2 xz-libs zlib wget curl-minimal git" diff --git a/images/devel/ubuntu-pkgs.sh b/images/devel/ubuntu-pkgs.sh deleted file mode 100644 index 7734182..0000000 --- a/images/devel/ubuntu-pkgs.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -PKGS="make cmake zlib1g libarchive13 libcurl4 libjsoncpp25 libuv1 librhash0 libstdc++6 libgcc-s1 libnettle8 libacl1 liblzma5 libzstd1 liblz4-1 libbz2-1.0 libxml2 libnghttp2-14 libidn2-0 librtmp1 libssh-4 libpsl5 libgssapi-krb5-2 libldap-2.5-0 libbrotli1 libicu70 libunistring2 libgnutls30 libhogweed6 libgmp10 libkrb5-3 libk5crypto3 libcom-err2 libkrb5support0 libsasl2-2 libp11-kit0 libtasn1-6 libkeyutils1 libffi8 wget curl git" diff --git a/images/go-devel/stacker.yaml b/images/go-devel/stacker.yaml index 836c5f3..90c91ea 100644 --- a/images/go-devel/stacker.yaml +++ b/images/go-devel/stacker.yaml @@ -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: / diff --git a/images/rust-devel/debian-pkgs.sh b/images/rust-devel/debian-pkgs.sh deleted file mode 100644 index d511f71..0000000 --- a/images/rust-devel/debian-pkgs.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -PKGS="binutils binutils-x86-64-linux-gnu gcc gcc-10 libbinutils libc6-dev libctf0 libgcc-10-dev" diff --git a/images/rust-devel/rockylinux-pkgs.sh b/images/rust-devel/rockylinux-pkgs.sh deleted file mode 100644 index a4de403..0000000 --- a/images/rust-devel/rockylinux-pkgs.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -PKGS="gcc binutils glibc-devel" diff --git a/images/rust-devel/stacker.yaml b/images/rust-devel/stacker.yaml index ca0ba6f..0d154db 100644 --- a/images/rust-devel/stacker.yaml +++ b/images/rust-devel/stacker.yaml @@ -7,7 +7,6 @@ build-rust-devel: type: built tag: build-env import: - - ${{DISTRO}}-pkgs.sh - ../../pkgmgr/defs.sh run: | export DISTRO=${{DISTRO}} @@ -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 @@ -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/* @@ -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 @@ -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 diff --git a/images/rust-devel/ubuntu-pkgs.sh b/images/rust-devel/ubuntu-pkgs.sh deleted file mode 100644 index 8f6c2d6..0000000 --- a/images/rust-devel/ubuntu-pkgs.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -PKGS="binutils binutils-x86-64-linux-gnu gcc gcc-11 libbinutils libc6-dev libctf0 libgcc-11-dev"