-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes issues with all plans till core/hab-studio
Signed-off-by: Johny Jose <[email protected]>
- Loading branch information
Showing
78 changed files
with
307 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
HAB_BOOTSTRAP_IMAGE_VERSION = "20230523" | ||
HAB_AUTO_BUILD_GIT_REPO = "https://github.com/habitat-sh/hab-auto-build.git" | ||
HAB_AUTO_BUILD_BRANCH = "v2" | ||
PACKAGE = "*/*" | ||
|
||
check-docker: | ||
@if ! command -v docker &> /dev/null; then \ | ||
echo "Docker is not installed. Please install Docker: https://docs.docker.com/get-docker/"; \ | ||
exit 1; \ | ||
fi | ||
|
||
check-rust: | ||
@if ! command -v cargo &> /dev/null; then \ | ||
echo "Cargo is not installed. Please install Rust: https://www.rust-lang.org/tools/install"; \ | ||
exit 1; \ | ||
fi | ||
|
||
check-hab-auto-build: | ||
@if ! command -v hab-auto-build &> /dev/null; then \ | ||
echo "hab-auto-build is not found. Please install it by running 'make setup'"; \ | ||
exit 1; \ | ||
fi | ||
|
||
build-hab-bootstrap-image: check-docker | ||
@echo "Building Docker Image for build tools: hab-bootstrap:$(HAB_BOOTSTRAP_IMAGE_VERSION)" | ||
@docker build -q -t hab-bootstrap:$(HAB_BOOTSTRAP_IMAGE_VERSION) docker/hab-bootstrap &> /dev/null | ||
@echo "Docker Image built hab-bootstrap:$(HAB_BOOTSTRAP_IMAGE_VERSION)" | ||
|
||
install-hab-auto-build: check-rust | ||
@if ! command -v hab-auto-build &> /dev/null; then \ | ||
echo "Installing hab-auto-build"; \ | ||
cargo install --git $(HAB_AUTO_BUILD_GIT_REPO) --branch $(HAB_AUTO_BUILD_BRANCH); \ | ||
echo "Installed hab-auto-build"; \ | ||
else \ | ||
echo "Found hab-auto-build already installed at $$(which hab-auto-build)"; \ | ||
fi | ||
|
||
update-hab-auto-build: check-rust | ||
@echo "Updating hab-auto-build" | ||
@cargo install --git $(HAB_AUTO_BUILD_GIT_REPO) --branch $(HAB_AUTO_BUILD_BRANCH) --quiet; | ||
@echo "Updated hab-auto-build" | ||
|
||
setup: build-hab-bootstrap-image install-hab-auto-build | ||
@echo "Installed all tools for building packages" | ||
|
||
update: build-hab-bootstrap-image update-hab-auto-build | ||
@echo "Updated all tools for building packages" | ||
|
||
build-dry-run: check-hab-auto-build | ||
hab-auto-build build -d $(PACKAGE) | ||
|
||
build: check-hab-auto-build setup | ||
@echo "Building all packages matching $(PACKAGE)" | ||
hab-auto-build build $(PACKAGE) | ||
@echo "Built all packages matching $(PACKAGE)" | ||
|
||
check: check-hab-auto-build | ||
@echo "Checking all packages matching $(PACKAGE)" | ||
hab-auto-build check $(PACKAGE) | ||
@echo "Checked all packages matching $(PACKAGE)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,167 +1,17 @@ | ||
# Habitat Packages Bootstrap | ||
# Habitat Core Packages | ||
|
||
This repo contains plan files that can be used to bootstrap a set of self contained GNU build tools | ||
that are completely isolated from the host system environment. These build tools can then be used to | ||
bootstrap a set of standard habitat packages for new platforms. | ||
This repository houses plan files designed to bootstrap a comprehensive suite of self-sufficient GNU build tools. These tools are designed to operate independently from the host system environment, providing a foundation to bootstrap a complete set of standard habitat packages for both new and existing platforms. | ||
|
||
This repo builds on knowledge available from the Linux From Scratch project (LFS) and adapts it for | ||
Habitat's packaging system. There are many variants of the LFS project for different platforms and versions. | ||
This repo largely follows the instructions [mentioned here](https://clfs.org/~kb0iic/lfs-systemd/index.html). | ||
The repository leverages knowledge from various sources, including the Linux From Scratch (LFS) project and Nix, and tailors it to suit Habitat's packaging system. | ||
|
||
## Building | ||
There exist numerous LFS project variants tailored for different platforms and versions. This repository primarily adheres to the instructions [found here](https://clfs.org/~kb0iic/lfs-systemd/index.html). | ||
|
||
### Checking the Host System tools | ||
## Compilation Process | ||
|
||
Before you start building, you can run the `version-check.sh` script to check the versions of the various required tools on your system. | ||
Be sure to cross check the version meets the minimum specified version mentioned [here](https://clfs.org/~kb0iic/lfs-systemd/chapter02/hostreqs.html). | ||
To compile all the packages contained within this repository, clone the repository and execute the following command: | ||
|
||
```bash | ||
bash version-check.sh | ||
make build | ||
``` | ||
|
||
### Building with hab-auto-build | ||
|
||
The packages in this repo can be built using [hab-auto-build](https://github.com/habitat-sh/hab-auto-build). | ||
|
||
To build all the packages you can use the following command: | ||
|
||
```bash | ||
hab-auto-build build | ||
``` | ||
|
||
**IMPORTANT** If you make any changes to any plans in any of the folders, the hab-auto-build | ||
tool will consider the package as updated and rebuild that package and all it's | ||
dependants. | ||
|
||
You can also build a specific package and all packages that depend on it with | ||
the following command: | ||
|
||
```bash | ||
hab-auto-build build -i dev <package-name> | ||
#Eg: hab-auto-build build -i dev core/build-tools-glibc | ||
``` | ||
|
||
### Building Manually | ||
|
||
The packages involved in the bootstrapping process are almost always native packages. | ||
To build them you must make sure you have enabled native package support for Habitat. | ||
|
||
As of this writing, you need a habitat build of the latest commit on [jj/aarch64-linux-bootstrap branch](https://github.com/habitat-sh/habitat/tree/jj/aarch64-linux-bootstrap) to build these plans. | ||
|
||
```bash | ||
export HAB_FEAT_NATIVE_PACKAGE_SUPPORT=1 | ||
``` | ||
|
||
To build a package you can use the following command | ||
|
||
```bash | ||
# In the root folder of this repo | ||
hab pkg build -N <package-folder> | ||
# Eg: hab pkg build -N bootstrap/cross-tools/build-tools-glibc | ||
``` | ||
### Cross Building | ||
|
||
You should theoretically be able to follow the same build process to cross build the arm packages on | ||
`x86_64` linux platforms as well. To do so you need to set an additional environment variable before | ||
running a build. | ||
|
||
```bash | ||
# On an x86_64 machine | ||
export TARGET_ARCH="aarch64-linux" | ||
``` | ||
|
||
### Running Tests | ||
|
||
Most of the packages have tests defined. You can run it by setting the `DO_CHECK` environment variable. | ||
|
||
```bash | ||
DO_CHECK=1 hab pkg build -N <package-folder> | ||
# Eg: DO_CHECK=1 hab pkg build -N bootstrap/cross-tools/build-tools-file | ||
``` | ||
|
||
## Manual Build Order | ||
|
||
This is a build order for the initial set of build tools packages that can be followed if you | ||
are building each plan manually. | ||
|
||
### Temporary Cross Compilation Toolchain | ||
|
||
These are a minimal set of packages that can be used to build an isolated set of build tools. | ||
At this stage the build process completely depends on tools available on the host system. | ||
|
||
- native-libgmp | ||
- native-libmpfr | ||
- native-libmpc | ||
- native-libisl | ||
- native-cross-binutils | ||
- native-cross-gcc-real | ||
- build-tools-linux-headers | ||
- build-tools-glibc | ||
- build-tools-libstdcpp | ||
- native-cross-gcc | ||
|
||
### Build Tools | ||
|
||
These are the set of packages that compromise the isolated build tools. They still depend on tools | ||
available on the host for their build process, however they have no runtime dependencies on the host system. | ||
|
||
- build-tools-binutils | ||
- build-tools-libgmp | ||
- build-tools-libmpfr | ||
- build-tools-libmpc | ||
- build-tools-libisl | ||
- build-tools-gcc | ||
- build-tools-gcc-libs | ||
- build-tools-patchelf | ||
- build-tools-m4 | ||
- build-tools-ncurses | ||
- build-tools-bash | ||
- build-tools-coreutils | ||
- build-tools-diffutils | ||
- native-file | ||
- build-tools-file | ||
- build-tools-findutils | ||
- build-tools-gawk | ||
- build-tools-grep | ||
- build-tools-gzip | ||
- build-tools-make | ||
- build-tools-patch | ||
- build-tools-sed | ||
- build-tools-tar | ||
- build-tools-xz | ||
- build-tools-cacerts | ||
- build-tools-openssl | ||
- build-tools-wget | ||
- native-busybox-static | ||
|
||
### Hab Bootstrap Studio Toolchain | ||
|
||
These next set of packages are the minimum set of native packages required to get a functional | ||
habitat bootstrap studio running to start building standard packages in a clean room environment. | ||
|
||
Since these components already have existing standard plans, we have an alternative set of native | ||
bootstrapping plans in this repo which we use to build a minimal hab chroot studio with support for | ||
the `bootstrap` studio type. | ||
|
||
- build-tools-hab | ||
- build-tools-hab-plan-build | ||
- build-tools-hab-backline | ||
- build-tools-studio | ||
|
||
On you have built a bootstrap studio you can use it for isolated package builds using the following | ||
commands. | ||
|
||
```bash | ||
# Entering a studio | ||
sudo HAB_LICENSE=accept-no-persist HAB_ORIGIN=core hab pkg exec core/build-tools-hab-studio hab-studio -- -t bootstrap enter | ||
``` | ||
|
||
**IMPORTANT**: If you have not yet been able to push your packages to the builder you will need to ensure | ||
that the correct version of each build dependency is installed inside the bootstrap studio before doing a build. | ||
|
||
You can do this using the following command inside the studio: | ||
|
||
```bash | ||
hab pkg install /hab/cache/artifacts/<dependency-hart-file> | ||
# Eg: hab pkg install /hab/cache/artifacts/core-build-tools-util-linux-2.38.1-20221018054208-aarch64-linux.hart | ||
``` | ||
The Habitat Auto Build tool is utilized internally to build the packages. For more complex tasks, please refer to the Habitat Auto Build tool's [readme](https://github.com/habitat-sh/hab-auto-build/tree/v2). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM ubuntu:20.04 | ||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y wget curl sudo tar xz-utils gawk bison python3 make m4 patch gcc g++ texinfo bash autoconf protobuf-compiler pkg-config | ||
RUN ln -sfv bash /bin/sh | ||
COPY build.sh /bin/build | ||
RUN chmod +x /bin/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
# This installs any additional packages before starting the studio. | ||
# It is useful in scenarios where you have a newer version of a package | ||
# and want habitat to pick the newer locally installed version during | ||
# a studio build. We do exactly this during the package refresh process. | ||
if [ -n "${HAB_STUDIO_INSTALL_PKGS-}" ]; then | ||
echo "Installing additional packages in image" | ||
deps=$(echo "$HAB_STUDIO_INSTALL_PKGS" | tr ":" "\n") | ||
for dep in $deps; do | ||
hab pkg install "$dep" | ||
done | ||
fi | ||
hab pkg build -N "$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ pkg_deps=( | |
core/geos | ||
core/glibc | ||
core/json-c | ||
core/libpcre2 | ||
core/pcre | ||
core/libxml2 | ||
core/icu | ||
core/perl | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ pkg_deps=( | |
core/zlib | ||
core/bzip2 | ||
core/openssl | ||
core/pcre2 | ||
core/pcre | ||
) | ||
pkg_build_deps=( | ||
core/gcc | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
packages/bootstrap/build-support/hab-cc-wrapper/.hab-plan-config.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
docker-image = "hab-bootstrap:20230523" | ||
|
||
[rules] | ||
missing-license = { level = "off", source-shasum = "c62127bdd4e60916c5556b8be2ee0f10a54450ebda6cd30e71a1add59b78a59b" } | ||
license-not-found = { level = "off", source-shasum = "c62127bdd4e60916c5556b8be2ee0f10a54450ebda6cd30e71a1add59b78a59b" } | ||
license-not-found = { level = "off", source-shasum = "c62127bdd4e60916c5556b8be2ee0f10a54450ebda6cd30e71a1add59b78a59b" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
packages/bootstrap/build-support/hab-ld-wrapper/.hab-plan-config.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
docker-image = "hab-bootstrap:20230523" | ||
|
||
[rules] | ||
missing-license = { level = "off", source-shasum = "c62127bdd4e60916c5556b8be2ee0f10a54450ebda6cd30e71a1add59b78a59b" } | ||
license-not-found = { level = "off", source-shasum = "c62127bdd4e60916c5556b8be2ee0f10a54450ebda6cd30e71a1add59b78a59b" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
packages/bootstrap/build-tools/cross-compiler/native-cross-binutils/.hab-plan-config.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
packages/bootstrap/build-tools/cross-compiler/native-cross-gcc-base/.hab-plan-config.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
packages/bootstrap/build-tools/cross-compiler/native-cross-gcc/.hab-plan-config.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
packages/bootstrap/build-tools/cross-tools/build-tools-bash-static/.hab-plan-config.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
docker-image = "hab-bootstrap:20230523" | ||
|
||
[rules] | ||
missing-license = { level = "off", source-shasum = "5bac17218d3911834520dad13cd1f85ab944e1c09ae1aba55906be1f8192f558" } | ||
license-not-found = { level = "off", source-shasum = "5bac17218d3911834520dad13cd1f85ab944e1c09ae1aba55906be1f8192f558" } |
2 changes: 2 additions & 0 deletions
2
packages/bootstrap/build-tools/cross-tools/build-tools-binutils/.hab-plan-config.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.