This repository has been archived by the owner. It is now read-only.
Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
stage0,stage1: autoconf-based build
This commit migrates rkt build process to autoconf and make toolchain to provide the following features: * checking for prerequisites in before the build instead of build time * adds the following explicit configuration flags: --with-stage1=type type of stage1 build one of 'src', 'coreos', 'none' --with-stage1-systemd-src=git-path address to git repository of systemd, used in 'src' build mode --with-stage1-systemd-version=version systemd version to build --with-stage1-image-path custom stage1 image path * adds explicit `BUILDDIR` make variable to build outside of the source tree * adds explicit `make stage0` and `make stage1` targets * adds makefile macros library `makelib/lib.mk` for common build operations Build changes ------------- The build is now changed from the "./build" to 3 phase step: 1. First time only `./autogen.sh` step to generate configure script 2. Requried `./configure` build step to generate Makefile 3. Requried `make` bild step Test changes ------------- Stage 0 and stage1 tests can be now run separately. 1. `make stage0-test` executes tests for stage0 binaries 2. `make stage1-test` executes functional stage1 tests 3. `make test` executes all tests Other changes ------------- 1. remove `aggregate` directory in favor of `BUILDDIR` external directory 2. split `aggregate` contents into individual modules in stage1 directory 3. port tests to Makefiles 4. rebase to latest master (Krzesimir Nowak)
- Loading branch information
Showing
with
1,342 additions
and 617 deletions.
- +6 −0 .gitignore
- +2 −2 .travis.yml
- +145 −0 Makefile.in
- +2 −0 autogen.sh
- +0 −96 build
- +145 −0 configure.ac
- +527 −0 install-sh
- +93 −0 makelib/lib.mk
- +0 −1 stage1/.gitignore
- +5 −0 stage1/README.md
- 0 stage1/{rootfs/aggregate → aci}/aci-manifest
- +8 −0 stage1/aci/aci.mk
- +20 −0 stage1/aci/install.tpl.sh
- +16 −0 stage1/bash/bash.mk
- 0 stage1/{rootfs → }/diagexec/diagexec.c
- +16 −0 stage1/diagexec/diagexec.mk
- 0 stage1/{rootfs → }/diagexec/elf.h
- BIN stage1/enter/enter
- 0 stage1/{rootfs → }/enter/enter.c
- +16 −0 stage1/enter/enter.mk
- +12 −0 stage1/gc/gc.mk
- +1 −1 stage1/init/init.go
- +12 −0 stage1/init/init.mk
- +1 −1 stage1/init/pod.go
- 0 stage1/{rootfs → }/net-plugins/.gitignore
- +15 −0 stage1/net-plugins/net-plugins.mk
- 0 stage1/{rootfs/net → net/conf}/99-default-restricted.conf
- 0 stage1/{rootfs/net → net/conf}/99-default.conf
- +9 −0 stage1/net/net.mk
- 0 stage1/{rootfs → }/prepare-app/prepare-app.c
- +16 −0 stage1/prepare-app/prepare-app.mk
- +9 −0 stage1/reaper/reaper.mk
- 0 stage1/{rootfs/aggregate/scripts → reaper}/reaper.sh
- +0 −26 stage1/rootfs/Makefile
- +0 −12 stage1/rootfs/aggregate/Makefile
- +0 −15 stage1/rootfs/aggregate/aggregate.sh
- +0 −23 stage1/rootfs/aggregate/install.d/99misc
- +0 −13 stage1/rootfs/diagexec/Makefile
- +0 −1 stage1/rootfs/diagexec/install
- +0 −13 stage1/rootfs/enter/Makefile
- +0 −1 stage1/rootfs/enter/install
- +0 −9 stage1/rootfs/gc/Makefile
- +0 −1 stage1/rootfs/gc/install
- +0 −9 stage1/rootfs/init/Makefile
- +0 −1 stage1/rootfs/init/install
- +0 −11 stage1/rootfs/net-plugins/Makefile
- +0 −4 stage1/rootfs/net-plugins/install
- +0 −9 stage1/rootfs/net/Makefile
- +0 −3 stage1/rootfs/net/install
- +0 −13 stage1/rootfs/prepare-app/Makefile
- +0 −1 stage1/rootfs/prepare-app/install
- +0 −17 stage1/rootfs/usr_from_coreos/Makefile
- +0 −5 stage1/rootfs/usr_from_coreos/install
- +0 −23 stage1/rootfs/usr_from_host/Makefile
- +0 −120 stage1/rootfs/usr_from_src/Makefile
- +55 −0 stage1/stage1.mk
- +18 −0 stage1/units/install.tpl.sh
- +11 −0 stage1/units/units.mk
- 0 stage1/{rootfs/aggregate → units}/units/default.target
- 0 stage1/{rootfs/aggregate → units}/units/exit-watcher.service
- 0 stage1/{rootfs/aggregate → units}/units/halt.target
- 0 stage1/{rootfs/aggregate → units}/units/local-fs.target
- 0 stage1/{rootfs/aggregate → units}/units/reaper.service
- 0 stage1/{rootfs/aggregate → units}/units/sockets.target
- +1 −0 stage1/usr_from_coreos/.gitignore
- +3 −15 stage1/{rootfs → }/usr_from_coreos/cache.sh
- 0 stage1/{rootfs → }/usr_from_coreos/manifest.d/bash
- 0 stage1/{rootfs → }/usr_from_coreos/manifest.d/journald
- 0 stage1/{rootfs → }/usr_from_coreos/manifest.d/systemd
- +11 −17 stage1/{rootfs → }/usr_from_coreos/mkbase.sh
- +19 −0 stage1/usr_from_coreos/usr_from_coreos.mk
- +8 −0 stage1/usr_from_host/usr_from_host.mk
- 0 ...ootfs → }/usr_from_src/patches/v215/0001-nspawn-just-disable-registration-on-non-sysd-hosts.patch
- 0 stage1/{rootfs → }/usr_from_src/patches/v215/0002-nspawn-add-keep-fd-support.patch
- 0 stage1/{rootfs → }/usr_from_src/patches/v219/0001-nspawn-drop-sd_booted-check.patch
- 0 ...tfs → }/usr_from_src/patches/v219/0002-unit-don-t-add-automatic-dependencies-on-device-unit.patch
- 0 ...tfs → }/usr_from_src/patches/v219/0003-nspawn-only-mount-the-cgroup-root-if-it-s-not-alread.patch
- 0 ...tfs → }/usr_from_src/patches/v219/0004-nspawn-skip-symlink-to-a-combined-cgroup-hierarchy-i.patch
- 0 stage1/{rootfs → }/usr_from_src/patches/v219/0005-nspawn-close-extra-fds-before-execing-init.patch
- +101 −0 stage1/usr_from_src/usr_from_src.mk
- +0 −111 test
- +1 −1 tests/README.md
- +2 −2 tests/install-deps.sh
- +3 −1 tests/run-build.sh
- +0 −39 tests/test
- +33 −0 tests/tests.mk
@@ -0,0 +1,145 @@ | ||
# These variables are set by configure script | ||
# Please check configure.ac instead of modifying these manually | ||
|
||
# package specific substitution names | ||
package := @PACKAGE_NAME@ | ||
version := @PACKAGE_VERSION@ | ||
tarname := @PACKAGE_TARNAME@ | ||
distdir := $(tarname)-$(version) | ||
|
||
# prefix-specific substitution names | ||
prefix := @prefix@ | ||
exec_prefix := @exec_prefix@ | ||
bindir := @bindir@ | ||
|
||
# Setup install scripts for portability | ||
INSTALL = @INSTALL@ | ||
INSTALL_DATA = @INSTALL_DATA@ | ||
INSTALL_PROGRAM = @INSTALL_PROGRAM@ | ||
INSTALL_SCRIPT = @INSTALL_SCRIPT@ | ||
|
||
# these are rkt-build specific variables | ||
|
||
# binaries we need to build things | ||
GO := @GOBINARY@ | ||
GOFMT := @GOFMTBINARY@ | ||
GIT := @GIT@ | ||
BASH := @BASH@ | ||
|
||
# path to rkt source code distro | ||
ORG_PATH := github.com/coreos | ||
REPO_PATH := $(ORG_PATH)/rkt | ||
|
||
# [STAGE1] build settings | ||
|
||
# selinux tags for rkt and functional tests | ||
RKT_TAGS := -tags selinux | ||
# stage1 build mode | ||
RKT_STAGE1_USR_FROM := @RKT_STAGE1_USR_FROM@ | ||
# git path to systemd | ||
RKT_STAGE1_SYSTEMD_SRC := @RKT_STAGE1_SYSTEMD_SRC@ | ||
# systemd build version | ||
RKT_STAGE1_SYSTEMD_VER := @RKT_STAGE1_SYSTEMD_VER@ | ||
# stage1 image flags (the optional custom path linked into binary set by user) | ||
RKT_STAGE1_IMAGE_FLAGS := @RKT_STAGE1_IMAGE_FLAGS@ | ||
|
||
# build-related directories and binaries | ||
BUILDDIR ?= $(shell pwd)/build-$(distdir) | ||
BUILDDIR := $(abspath $(BUILDDIR)) | ||
|
||
BINDIR := $(BUILDDIR)$(bindir) | ||
GOPATH := $(BUILDDIR)/gopath | ||
GOBIN := $(BUILDDIR)/bin | ||
ACTOOL := $(GOBIN)/actool | ||
ROOT = $(BUILDDIR)/aci/rootfs | ||
ACI = $(BUILDDIR)/aci | ||
|
||
# test-related variables | ||
GO_TEST_COVER := -cover | ||
GO_TEST_PACKAGES ?= ./... | ||
GO_TEST_SKIP_DIRS := tests builds | ||
GO_TEST_FUNC_ARGS ?= | ||
|
||
# runtime variables | ||
OSTYPE := $(shell uname) | ||
CORES := $(shell grep -c ^processor /proc/cpuinfo) | ||
|
||
# export variables to inner makefiles | ||
export | ||
|
||
# include standard librares | ||
include makelib/*.mk | ||
|
||
.PHONY: clean stage0 stage1 stage1-tools stage1-deps stage0-test stage1-test test | ||
|
||
# create directories and symlinks needed to for build in advance so we should not worry about them | ||
$(call make-dirs,$(BINDIR) $(GOPATH)/src/$(ORG_PATH) $(GOBIN) $(BUILDDIR)/src $(BUILDDIR)/install.d $(BUILDDIR)/cache $(ROOT)) | ||
$(call make-dir-symlink,$(shell pwd),$(GOPATH)/src/$(REPO_PATH)) | ||
|
||
all: stage0 stage1 | ||
|
||
# stage0 builds rkt binary | ||
stage0: | ||
$(info [STAGE0] building rkt binary...) | ||
$(GO) build -o $(GOBIN)/rkt $(RKT_STAGE1_IMAGE_FLAGS) $(RKT_TAGS) $(REPO_PATH)/rkt | ||
|
||
# stage1 builds stage1 image and associated toolset | ||
ifneq ($(RKT_STAGE1_USR_FROM),none) | ||
stage1: stage1-tools stage1-rootfs | ||
else | ||
stage1: | ||
@echo [STAGE1] skiping stage 1 build as configured by user | ||
endif | ||
|
||
stage1-tools: | ||
@echo [STAGE1] building stage1 build tools... | ||
go build -o $(GOBIN)/actool github.com/coreos/rkt/Godeps/_workspace/src/github.com/appc/spec/actool | ||
|
||
stage1-rootfs: | ||
$(if $(filter-out Linux,$(OSTYPE)),$(error unsupported OS: $(OSTYPE)),@echo building on $(OSTYPE)) | ||
@echo [STAGE1] building stage1 rootfs using $(CORES) cores... | ||
$(MAKE) -C stage1 -j $(CORES) -f stage1.mk | ||
|
||
test: stage0-test stage1-test | ||
@echo "[STAGE0] [STAGE1] executing tests" | ||
|
||
stage0-test: GO_PACKAGES_WITH_TESTS := $(call go-find-packages-with-tests,$(GO_TEST_PACKAGES),$(GO_TEST_SKIP_DIRS)) | ||
stage0-test: GO_PACKAGES_ALL := $(call go-find-packages,$(GO_TEST_PACKAGES),$(GO_TEST_SKIP_DIRS)) | ||
stage0-test: | ||
@echo [STAGE0] checking for gofmt verdict... | ||
@set -e; \ | ||
cd $(GOPATH)/src ;\ | ||
NEED_FORMATTING="$$(GOPATH=$(GOPATH) $(GOFMT) -l $(GO_PACKAGES_WITH_TESTS))"; \ | ||
if [ -n "$$NEED_FORMATTING" ] ; then \ | ||
echo "[STAGE0] ERROR: these packages need formatting: $$NEED_FORMATTING"; \ | ||
exit 255; \ | ||
fi; | ||
|
||
@echo [STAGE0] checking for go vet verdict... | ||
@set -e; $(GO) vet $(GO_PACKAGES_ALL) | ||
|
||
@set -e; echo [STAGE0] checking license headers...; \ | ||
licRes=$$( \ | ||
for file in $$(find . -type f -iname '*.go' ! -path './Godeps/*'); do \ | ||
head -n1 "$${file}" | grep -Eq "(Copyright|generated)" || echo -e " $${file}"; \ | ||
done; \ | ||
); \ | ||
if [ -n "${licRes}" ]; then \ | ||
echo -e "license header checking failed:\n${licRes}"; \ | ||
exit 255; \ | ||
fi | ||
|
||
@echo [STAGE0] executing tests... | ||
@$(GO) test -timeout 60s $(RKT_TAGS) $(GO_TEST_COVER) $(GO_PACKAGES_WITH_TESTS) --race | ||
|
||
ifeq ($(filter true,$(RKT_ENABLE_FUNCTIONAL_TESTS)$(GO_TEST_STAGE1_FORCE)),true) | ||
stage1-test: stage0 stage1 | ||
$(if $(filter-out Linux,$(OSTYPE)),$(error unsupported OS: $(OSTYPE)),@echo building on $(OSTYPE)) | ||
$(MAKE) -C tests -f tests.mk SHELL="/bin/bash -v" | ||
else | ||
stage1-test: | ||
@echo [STAGE1] skipping tests in unsupported environment... | ||
endif | ||
|
||
clean: | ||
rm -rf $(BUILDDIR) |
@@ -0,0 +1,2 @@ | ||
#!/bin/bash -e | ||
autoreconf --install |
Oops, something went wrong.